Jpp 20.0.0-195-g190c9e876
the software that should make you happy
Loading...
Searching...
No Matches
JPMTParameters.hh
Go to the documentation of this file.
1#ifndef __JDETECTOR__JPMTPARAMETERS__
2#define __JDETECTOR__JPMTPARAMETERS__
3
4#include <istream>
5#include <ostream>
6#include <iomanip>
7#include <cmath>
8
9#include "JLang/JManip.hh"
10#include "Jeep/JProperties.hh"
11
12
13/**
14 * \author mdejong
15 * \file
16 * PMT parameters and auxiliary methods.
17 */
18
19namespace JDETECTOR {}
20namespace JPP { using namespace JDETECTOR; }
21
22namespace JDETECTOR {
23
25
26
27 /**
28 * Data structure for PMT parameters.
29 */
31 public:
32 /**
33 * Default constructor.
34 *
35 * This constuctor provides for default values of all PMT parameters.
36 * Note that only when the value of <tt>TTS_ns</tt> is positive, it will be used to generate the PMT transition times.
37 * In this case, a normal distribution is used with a sigma equal to the specified value.
38 * By default, the value is negative.
39 * As a consequence, the PMT transition times will be generated according
40 * the measured distribution (see <tt>JPMTTransitTimeGenerator.hh</tt>).
41 */
43 {
44 this->QE = 1.0; // [unit]
45 this->gain = 1.0; // [unit]
46 this->gainSpread = 0.4; // [unit]
47 this->riseTime_ns = 7.24; // [ns]
48 this->TTS_ns = -1.0; // [ns]
49 this->threshold = 0.24; // [npe]
50 this->PunderAmplified = 0.05; //
51 this->thresholdBand = 0.12; // [npe]
52 this->mean_ns = 4.5; // [ns]
53 this->sigma_ns = 1.5; // [ns]
54 this->slope = 7.0; // [ns/npe]
55 this->saturation = 210; // [ns]
56 this->slewing = true; //
57 }
58
59
60 /**
61 * Constructor.
62 *
63 * \param QE relative quantum efficiency
64 * \param gain gain [unit]
65 * \param gainSpread gain spread [unit]
66 * \param riseTime_ns rise time of analogue pulse [ns]
67 * \param TTS_ns transition time spread [ns]
68 * \param threshold threshold [npe]
69 * \param thresholdBand threshold-band [npe]
70 * \param mean_ns mean time-over-threshold of threshold-band hits [ns]
71 * \param sigma_ns time-over-threshold standard deviation of threshold-band hits [ns]
72 * \param PunderAmplified probability of underamplified hit
73 * \param slope slope [ns/npe]
74 * \param saturation saturation [ns]
75 * \param slewing time slewing of analogue signal
76 */
77 JPMTParameters(const double QE,
78 const double gain,
79 const double gainSpread,
80 const double riseTime_ns,
81 const double TTS_ns,
82 const double threshold,
83 const double PunderAmplified,
84 const double thresholdBand,
85 const double mean_ns,
86 const double sigma_ns,
87 const double slope,
88 const double saturation,
89 const bool slewing = true)
90 {
91 this->QE = QE;
92 this->gain = gain;
93 this->gainSpread = gainSpread;
94 this->riseTime_ns = riseTime_ns;
95 this->TTS_ns = TTS_ns;
96 this->threshold = threshold;
97 this->PunderAmplified = PunderAmplified;
98 this->thresholdBand = thresholdBand;
99 this->mean_ns = mean_ns;
100 this->sigma_ns = sigma_ns;
101 this->slope = slope;
102 this->saturation = saturation;
103 this->slewing = slewing;
104 }
105
106
107 /**
108 * Get PMT parameters.
109 *
110 * \return PMT parameters
111 */
113 {
114 return static_cast<const JPMTParameters&>(*this);
115 }
116
117
118 /**
119 * Set PMT parameters.
120 *
121 * \param parameters PMT parameters
122 */
123 void setPMTParameters(const JPMTParameters& parameters)
124 {
125 static_cast<JPMTParameters&>(*this) = parameters;
126 }
127
128
129 /**
130 * Check validity of PMT parameters.
131 *
132 * \return true if valid; else false
133 */
134 bool is_valid() const
135 {
136 if (this->QE < 0.0 ||
137 this->gain < 0.0 ||
138 this->gainSpread < 0.0 ||
139 this->threshold < 0.0 ||
140 this->thresholdBand < 0.0) {
141 return false;
142 }
143
144 return true;
145 }
146
147
148 /**
149 * Get type for for time-slewing correction
150 *
151 * \return type
152 */
153 int getType() const
154 {
155 if (this->TTS_ns < 0.0)
156 return -lrint(this->TTS_ns);
157 else
158 return 0;
159 }
160
161
162 /**
163 * Stream input of PMT parameters.
164 *
165 * \param in input stream
166 * \param object PMT parameters
167 * \return input stream
168 */
169 friend inline std::istream& operator>>(std::istream& in, JPMTParameters& object)
170 {
171 return in >> object.QE
172 >> object.gain
173 >> object.gainSpread
174 >> object.riseTime_ns
175 >> object.TTS_ns
176 >> object.threshold;
177 }
178
179
180 /**
181 * Stream output of PMT parameters.
182 *
183 * \param out output stream
184 * \param object PMT parameters
185 * \return output stream
186 */
187 friend inline std::ostream& operator<<(std::ostream& out, const JPMTParameters& object)
188 {
189 using namespace JPP;
190
191 const JFormat format(out);
192
193 out << FIXED(5,3) << object.QE << ' '
194 << FIXED(5,3) << object.gain << ' '
195 << FIXED(5,3) << object.gainSpread << ' '
196 << FIXED(5,2) << object.riseTime_ns << ' '
197 << FIXED(5,2) << object.TTS_ns << ' '
198 << FIXED(5,3) << object.threshold;
199
200 return out;
201 }
202
203
204 /**
205 * Get equation parameters.
206 *
207 * \return equation parameters
208 */
210 {
211 static JEquationParameters equation("=", ",", "./", "#");
212
213 return equation;
214 }
215
216
217 /**
218 * Set equation parameters.
219 *
220 * \param equation equation parameters
221 */
222 static inline void setEquationParameters(const JEquationParameters& equation)
223 {
224 getEquationParameters() = equation;
225 }
226
227
228 /**
229 * Get properties of this class.
230 *
231 * \param equation equation parameters
232 */
237
238
239 /**
240 * Get properties of this class.
241 *
242 * \param equation equation parameters
243 */
245 {
246 return JPMTParametersHelper(*this, equation);
247 }
248
249
250 double QE; //!< relative quantum efficiency
251 double gain; //!< gain [unit]
252 double gainSpread; //!< gain spread [unit]
253 double riseTime_ns; //!< rise time of analogue pulse [ns]
254 double TTS_ns; //!< transition time spread [ns]
255 double threshold; //!< threshold [npe]
256 double PunderAmplified; //!< probability of underamplified hit
257 double thresholdBand; //!< threshold-band [npe]
258 double mean_ns; //!< mean time-over-threshold of threshold-band hits [ns]
259 double sigma_ns; //!< time-over-threshold standard deviation of threshold-band hits [ns]
260 double slope; //!< slope [ns/npe]
261 double saturation; //!< saturation [ns]
262 bool slewing; //!< time slewing of analogue signal
263
264 private:
265 /**
266 * Auxiliary class for I/O of PMT parameters.
267 */
269 public JProperties
270 {
271 public:
272 /**
273 * Constructor.
274 *
275 * \param object PMT parameters
276 * \param equation equation parameters
277 */
278 template<class JPMTParameters_t>
280 const JEquationParameters& equation) :
281 JProperties(equation, 1)
282 {
283 insert(gmake_property(object.QE));
284 insert(gmake_property(object.gain));
285 insert(gmake_property(object.gainSpread));
286 insert(gmake_property(object.riseTime_ns));
287 insert(gmake_property(object.TTS_ns));
288 insert(gmake_property(object.threshold));
289 insert(gmake_property(object.PunderAmplified));
290 insert(gmake_property(object.thresholdBand));
291 insert(gmake_property(object.mean_ns));
292 insert(gmake_property(object.sigma_ns));
293 insert(gmake_property(object.slope));
294 insert(gmake_property(object.saturation));
295 insert(gmake_property(object.slewing));
296 }
297 };
298 };
299}
300
301#endif
I/O manipulators.
Utility class to parse parameter values.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Auxiliary class for I/O of PMT parameters.
JPMTParametersHelper(JPMTParameters_t &object, const JEquationParameters &equation)
Constructor.
Data structure for PMT parameters.
JProperties getProperties(const JEquationParameters &equation=JPMTParameters::getEquationParameters()) const
Get properties of this class.
bool is_valid() const
Check validity of PMT parameters.
static JEquationParameters & getEquationParameters()
Get equation parameters.
double sigma_ns
time-over-threshold standard deviation of threshold-band hits [ns]
double QE
relative quantum efficiency
friend std::istream & operator>>(std::istream &in, JPMTParameters &object)
Stream input of PMT parameters.
int getType() const
Get type for for time-slewing correction.
double thresholdBand
threshold-band [npe]
double gainSpread
gain spread [unit]
JPMTParameters()
Default constructor.
double riseTime_ns
rise time of analogue pulse [ns]
double TTS_ns
transition time spread [ns]
double threshold
threshold [npe]
double mean_ns
mean time-over-threshold of threshold-band hits [ns]
static void setEquationParameters(const JEquationParameters &equation)
Set equation parameters.
JProperties getProperties(const JEquationParameters &equation=JPMTParameters::getEquationParameters())
Get properties of this class.
void setPMTParameters(const JPMTParameters &parameters)
Set PMT parameters.
friend std::ostream & operator<<(std::ostream &out, const JPMTParameters &object)
Stream output of PMT parameters.
double slope
slope [ns/npe]
double PunderAmplified
probability of underamplified hit
bool slewing
time slewing of analogue signal
double saturation
saturation [ns]
const JPMTParameters & getPMTParameters() const
Get PMT parameters.
JPMTParameters(const double QE, const double gain, const double gainSpread, const double riseTime_ns, const double TTS_ns, const double threshold, const double PunderAmplified, const double thresholdBand, const double mean_ns, const double sigma_ns, const double slope, const double saturation, const bool slewing=true)
Constructor.
Utility class to parse parameter values.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
file Auxiliary data structures and methods for detector calibration.
Definition JAnchor.hh:12
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
Fit parameters for single PMT.
Definition JFitK40.hh:455
Auxiliary class to temporarily define format specifications.
Definition JManip.hh:636