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