-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdrs4pulsegenerator.h
120 lines (96 loc) · 3.9 KB
/
drs4pulsegenerator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/****************************************************************************
**
** DDRS4PALS, a software for the acquisition of lifetime spectra using the
** DRS4 evaluation board of PSI: https://www.psi.ch/drs/evaluation-board
**
** Copyright (C) 2016-2022 Dr. Danny Petschke
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see http://www.gnu.org/licenses/.
**
*****************************************************************************
**
** @author: Dr. Danny Petschke
** @contact: [email protected]
**
*****************************************************************************
**
** related publications:
**
** when using DDRS4PALS for your research purposes please cite:
**
** DDRS4PALS: A software for the acquisition and simulation of lifetime spectra using the DRS4 evaluation board:
** https://www.sciencedirect.com/science/article/pii/S2352711019300676
**
** and
**
** Data on pure tin by Positron Annihilation Lifetime Spectroscopy (PALS) acquired with a semi-analog/digital setup using DDRS4PALS
** https://www.sciencedirect.com/science/article/pii/S2352340918315142?via%3Dihub
**
** when using the integrated simulation tool /DLTPulseGenerator/ of DDRS4PALS for your research purposes please cite:
**
** DLTPulseGenerator: A library for the simulation of lifetime spectra based on detector-output pulses
** https://www.sciencedirect.com/science/article/pii/S2352711018300530
**
** Update (v1.1) to DLTPulseGenerator: A library for the simulation of lifetime spectra based on detector-output pulses
** https://www.sciencedirect.com/science/article/pii/S2352711018300694
**
** Update (v1.2) to DLTPulseGenerator: A library for the simulation of lifetime spectra based on detector-output pulses
** https://www.sciencedirect.com/science/article/pii/S2352711018301092
**
** Update (v1.3) to DLTPulseGenerator: A library for the simulation of lifetime spectra based on detector-output pulses
** https://www.sciencedirect.com/science/article/pii/S235271101930038X
**/
#ifndef DDRS4PULSEGENERATOR_H
#define DDRS4PULSEGENERATOR_H
#include <QMutex>
#include <QMutexLocker>
#include <iostream>
#include <random>
#include <array>
#include "DRS/drs507/DRS.h"
#include "DLib.h"
#include "dversion.h"
#include "drs4simulationsettingsmanager.h"
#include "drs4settingsmanager.h"
#include "include/DLTPulseGenerator/DLTPulseGenerator.h"
typedef enum {
LogNormalPulse = 0,
ElectronicComponents = 1
} DPulseSimulationType;
class DRS4PulseGenerator : public DLifeTime::DLTCallback
{
DLifeTime::DLTPulseGenerator *m_generator;
DLifeTime::DLTPHS m_phsDistribution;
DLifeTime::DLTSetup m_deviceInfo;
DLifeTime::DLTPulse m_pulseInfo;
DLifeTime::DLTSimulationInput m_simulationInput;
DLifeTime::DLTError m_error;
DPulseSimulationType m_type;
mutable QMutex m_mutex;
public:
static DRS4PulseGenerator *sharedInstance();
DPulseSimulationType type() const;
QString getErrorString() const;
void update();
bool receiveGeneratedPulsePair(float *pulseATime, float *pulseAVoltage, float *pulseBTime, float *pulseBVoltage);
virtual void onEvent(DLifeTime::DLTError error) override {
m_error = error;
DLifeTime::DLTCallback::onEvent(error);
}
private:
DRS4PulseGenerator();
virtual ~DRS4PulseGenerator();
std::vector<double> readPHSFile(const QString& filename);
};
#endif // DDRS4PULSEGENERATOR_H