1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
21 | !
|
---|
22 | \* ======================================================================== */
|
---|
23 | /////////////////////////////////////////////////////////////////////////////
|
---|
24 | // //
|
---|
25 | // MCalibrationChargePix //
|
---|
26 | // //
|
---|
27 | // Storage container to hold informations about the calibration values //
|
---|
28 | // values of one Pixel (PMT). //
|
---|
29 | // //
|
---|
30 | // The following values are initialized to meaningful values:
|
---|
31 | //
|
---|
32 | // - The Electronic Rms to 1.5 per FADC slice
|
---|
33 | // - The uncertainty about the Electronic RMS to 0.3 per slice
|
---|
34 | // - The F-Factor is assumed to have been measured in Munich to 1.13 - 1.17.
|
---|
35 | // with the Munich definition of the F-Factor, thus:
|
---|
36 | // F = Sigma(Out)/Mean(Out) * Mean(In)/Sigma(In)
|
---|
37 | // Mean F-Factor = 1.15
|
---|
38 | // Error F-Factor = 0.02
|
---|
39 | //
|
---|
40 | // - Average QE: (email David Paneque, 14.2.04):
|
---|
41 | //
|
---|
42 | // The conversion factor that comes purely from QE folded to a Cherenkov
|
---|
43 | // spectrum has to be multiplied by:
|
---|
44 | // * Plexiglass window -->> 0.96 X 0.96
|
---|
45 | // * PMT photoelectron collection efficiency -->> 0.9
|
---|
46 | // * Light guides efficiency -->> 0.94
|
---|
47 | //
|
---|
48 | // Concerning the light guides effiency estimation... Daniel Ferenc
|
---|
49 | // is preparing some work (simulations) to estimate it. Yet so far, he has
|
---|
50 | // been busy with other stuff, and this work is still UNfinished.
|
---|
51 | //
|
---|
52 | // The estimation I did comes from:
|
---|
53 | // 1) Reflectivity of light guide walls is 85 % (aluminum)
|
---|
54 | // 2) At ZERO degree light incidence, 37% of the light hits such walls
|
---|
55 | // (0.15X37%= 5.6% of light lost)
|
---|
56 | // 3) When increasing the light incidence angle, more and more light hits
|
---|
57 | // the walls.
|
---|
58 | //
|
---|
59 | // However, the loses due to larger amount of photons hitting the walls is more
|
---|
60 | // or less counteracted by the fact that more and more photon trajectories cross
|
---|
61 | // the PMT photocathode twice, increasing the effective sensitivity of the PMT.
|
---|
62 | //
|
---|
63 | // Jurgen Gebauer did some quick measurements about this issue. I attach a
|
---|
64 | // plot. You can see that the angular dependence is (more or less) in agreement
|
---|
65 | // with a CosTheta function (below 20-25 degrees),
|
---|
66 | // which is the variation of teh entrance window cross section. So, in
|
---|
67 | // first approximation, no loses when increasing light incidence angle;
|
---|
68 | // and therefore, the factor 0.94.
|
---|
69 | //
|
---|
70 | // So, summarizing... I would propose the following conversion factors
|
---|
71 | // (while working with CT1 cal box) in order to get the final number of photons
|
---|
72 | // from the detected measured size in ADC counts.
|
---|
73 | //
|
---|
74 | // Nph = ADC * FmethodConversionFactor / ConvPhe-PhFactor
|
---|
75 | //
|
---|
76 | // FmethodConversionFactor ; measured for individual pmts
|
---|
77 | //
|
---|
78 | // ConvPhe-PhFactor = 0.98 * 0.23 * 0.90 * 0.94 * 0.96 * 0.96 = 0.18
|
---|
79 | //
|
---|
80 | // I would not apply any smearing of this factor (which we have in nature),
|
---|
81 | // since we might be applying it to PMTs in the totally wrong direction.
|
---|
82 | //
|
---|
83 | //
|
---|
84 | // Error of all variables are calculated by error-propagation. Note that internally,
|
---|
85 | // all error variables contain Variances in order to save the CPU-intensive square rooting
|
---|
86 | //
|
---|
87 | /////////////////////////////////////////////////////////////////////////////
|
---|
88 | #include "MCalibrationChargePix.h"
|
---|
89 |
|
---|
90 | #include "MLog.h"
|
---|
91 | #include "MLogManip.h"
|
---|
92 |
|
---|
93 | #include "MBadPixelsPix.h"
|
---|
94 |
|
---|
95 | ClassImp(MCalibrationChargePix);
|
---|
96 |
|
---|
97 | using namespace std;
|
---|
98 |
|
---|
99 | const Float_t MCalibrationChargePix::gkElectronicPedRms = 1.5;
|
---|
100 | const Float_t MCalibrationChargePix::gkElectronicPedRmsErr = 0.3;
|
---|
101 | const Float_t MCalibrationChargePix::gkFFactor = 1.15;
|
---|
102 | const Float_t MCalibrationChargePix::gkFFactorErr = 0.02;
|
---|
103 |
|
---|
104 | const Float_t MCalibrationChargePix::gkConversionHiLo = 10.;
|
---|
105 | const Float_t MCalibrationChargePix::gkConversionHiLoErr = 2.5;
|
---|
106 |
|
---|
107 | const Float_t MCalibrationChargePix::fgPheFFactorMethodLimit = 5.;
|
---|
108 | // --------------------------------------------------------------------------
|
---|
109 | //
|
---|
110 | // Default Constructor:
|
---|
111 | //
|
---|
112 | MCalibrationChargePix::MCalibrationChargePix(const char *name, const char *title)
|
---|
113 | : fPixId(-1),
|
---|
114 | fFlags(0)
|
---|
115 | {
|
---|
116 |
|
---|
117 | fName = name ? name : "MCalibrationChargePix";
|
---|
118 | fTitle = title ? title : "Container of the fit results of MHCalibrationChargePixs ";
|
---|
119 |
|
---|
120 | Clear();
|
---|
121 |
|
---|
122 | //
|
---|
123 | // At the moment, we don't have a database, yet,
|
---|
124 | // so we get it from the configuration file
|
---|
125 | //
|
---|
126 | SetConversionHiLo();
|
---|
127 | SetConversionHiLoErr();
|
---|
128 |
|
---|
129 | SetPheFFactorMethodLimit();
|
---|
130 |
|
---|
131 | }
|
---|
132 |
|
---|
133 | // ------------------------------------------------------------------------
|
---|
134 | //
|
---|
135 | // Invalidate values
|
---|
136 | //
|
---|
137 | void MCalibrationChargePix::Clear(Option_t *o)
|
---|
138 | {
|
---|
139 |
|
---|
140 | SetHiGainSaturation ( kFALSE );
|
---|
141 | SetExcluded ( kFALSE );
|
---|
142 | SetBlindPixelMethodValid ( kFALSE );
|
---|
143 | SetFFactorMethodValid ( kFALSE );
|
---|
144 | SetPINDiodeMethodValid ( kFALSE );
|
---|
145 | SetCombinedMethodValid ( kFALSE );
|
---|
146 |
|
---|
147 | fHiGainMeanCharge = -1.;
|
---|
148 | fHiGainMeanChargeVar = -1.;
|
---|
149 | fHiGainSigmaCharge = -1.;
|
---|
150 | fHiGainSigmaChargeVar = -1.;
|
---|
151 | fHiGainChargeProb = -1.;
|
---|
152 |
|
---|
153 | fLoGainMeanCharge = -1.;
|
---|
154 | fLoGainMeanChargeVar = -1.;
|
---|
155 | fLoGainSigmaCharge = -1.;
|
---|
156 | fLoGainSigmaChargeVar = -1.;
|
---|
157 | fLoGainChargeProb = -1.;
|
---|
158 |
|
---|
159 | fRSigmaCharge = -1.;
|
---|
160 | fRSigmaChargeVar = -1.;
|
---|
161 |
|
---|
162 | fHiGainNumPickup = -1;
|
---|
163 | fLoGainNumPickup = -1;
|
---|
164 |
|
---|
165 | fPed = -1.;
|
---|
166 | fPedRms = -1.;
|
---|
167 | fPedVar = -1.;
|
---|
168 |
|
---|
169 | fLoGainPedRms = -1.;
|
---|
170 | fLoGainPedRmsVar = -1.;
|
---|
171 |
|
---|
172 | fAbsTimeMean = -1.;
|
---|
173 | fAbsTimeRms = -1.;
|
---|
174 |
|
---|
175 | fPheFFactorMethod = -1.;
|
---|
176 | fPheFFactorMethodVar = -1.;
|
---|
177 |
|
---|
178 | fMeanConversionFFactorMethod = -1.;
|
---|
179 | fMeanConversionBlindPixelMethod = -1.;
|
---|
180 | fMeanConversionPINDiodeMethod = -1.;
|
---|
181 | fMeanConversionCombinedMethod = -1.;
|
---|
182 |
|
---|
183 | fConversionFFactorMethodVar = -1.;
|
---|
184 | fConversionBlindPixelMethodVar = -1.;
|
---|
185 | fConversionPINDiodeMethodVar = -1.;
|
---|
186 | fConversionCombinedMethodVar = -1.;
|
---|
187 |
|
---|
188 | fSigmaConversionFFactorMethod = -1.;
|
---|
189 | fSigmaConversionBlindPixelMethod = -1.;
|
---|
190 | fSigmaConversionPINDiodeMethod = -1.;
|
---|
191 | fSigmaConversionCombinedMethod = -1.;
|
---|
192 |
|
---|
193 | fTotalFFactorFFactorMethod = -1.;
|
---|
194 | fTotalFFactorBlindPixelMethod = -1.;
|
---|
195 | fTotalFFactorPINDiodeMethod = -1.;
|
---|
196 | fTotalFFactorCombinedMethod = -1.;
|
---|
197 |
|
---|
198 | }
|
---|
199 |
|
---|
200 |
|
---|
201 | // --------------------------------------------------------------------------
|
---|
202 | //
|
---|
203 | // Set the pedestals from outside
|
---|
204 | //
|
---|
205 | void MCalibrationChargePix::SetPedestal(const Float_t ped, const Float_t pedrms, const Float_t pederr)
|
---|
206 | {
|
---|
207 |
|
---|
208 | fPed = ped;
|
---|
209 | fPedRms = pedrms;
|
---|
210 | fPedVar = pederr*pederr;
|
---|
211 | }
|
---|
212 |
|
---|
213 |
|
---|
214 | void MCalibrationChargePix::SetMeanCharge( const Float_t f )
|
---|
215 | {
|
---|
216 | if (IsHiGainSaturation())
|
---|
217 | fLoGainMeanCharge = f;
|
---|
218 | else
|
---|
219 | fHiGainMeanCharge = f;
|
---|
220 | }
|
---|
221 |
|
---|
222 | void MCalibrationChargePix::SetMeanChargeErr( const Float_t f )
|
---|
223 | {
|
---|
224 | if (IsHiGainSaturation())
|
---|
225 | fLoGainMeanChargeVar = f*f;
|
---|
226 | else
|
---|
227 | fHiGainMeanChargeVar = f*f;
|
---|
228 |
|
---|
229 | }
|
---|
230 |
|
---|
231 | void MCalibrationChargePix::SetSigmaCharge( const Float_t f )
|
---|
232 | {
|
---|
233 | if (IsHiGainSaturation())
|
---|
234 | fLoGainSigmaCharge = f;
|
---|
235 | else
|
---|
236 | fHiGainSigmaCharge = f;
|
---|
237 | }
|
---|
238 |
|
---|
239 |
|
---|
240 | void MCalibrationChargePix::SetSigmaChargeErr( const Float_t f )
|
---|
241 | {
|
---|
242 | if (IsHiGainSaturation())
|
---|
243 | fLoGainSigmaChargeVar = f*f;
|
---|
244 | else
|
---|
245 | fHiGainSigmaChargeVar = f*f;
|
---|
246 |
|
---|
247 | }
|
---|
248 |
|
---|
249 | // --------------------------------------------------------------------------
|
---|
250 | //
|
---|
251 | // Set the conversion factors from outside (only for MC)
|
---|
252 | //
|
---|
253 | void MCalibrationChargePix::SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig)
|
---|
254 | {
|
---|
255 | fMeanConversionFFactorMethod = c;
|
---|
256 | fConversionFFactorMethodVar = err*err;
|
---|
257 | fSigmaConversionFFactorMethod = sig;
|
---|
258 | }
|
---|
259 |
|
---|
260 | // --------------------------------------------------------------------------
|
---|
261 | //
|
---|
262 | // Set the conversion factors from outside (only for MC)
|
---|
263 | //
|
---|
264 | void MCalibrationChargePix::SetConversionCombinedMethod(Float_t c, Float_t err, Float_t sig)
|
---|
265 | {
|
---|
266 | fMeanConversionCombinedMethod = c;
|
---|
267 | fConversionCombinedMethodVar = err*err;
|
---|
268 | fSigmaConversionCombinedMethod = sig;
|
---|
269 | }
|
---|
270 |
|
---|
271 |
|
---|
272 | // --------------------------------------------------------------------------
|
---|
273 | //
|
---|
274 | // Set the conversion factors from outside (only for MC)
|
---|
275 | //
|
---|
276 | void MCalibrationChargePix::SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig)
|
---|
277 | {
|
---|
278 | fMeanConversionBlindPixelMethod = c;
|
---|
279 | fConversionBlindPixelMethodVar = err*err;
|
---|
280 | fSigmaConversionBlindPixelMethod = sig;
|
---|
281 | }
|
---|
282 |
|
---|
283 | // --------------------------------------------------------------------------
|
---|
284 | //
|
---|
285 | // Set the conversion factors from outside (only for MC)
|
---|
286 | //
|
---|
287 | void MCalibrationChargePix::SetConversionPINDiodeMethod(Float_t c, Float_t err, Float_t sig)
|
---|
288 | {
|
---|
289 | fMeanConversionPINDiodeMethod = c ;
|
---|
290 | fConversionPINDiodeMethodVar = err*err;
|
---|
291 | fSigmaConversionPINDiodeMethod = sig;
|
---|
292 | }
|
---|
293 |
|
---|
294 | // --------------------------------------------------------------------------
|
---|
295 | //
|
---|
296 | // Set the Hi Gain Saturation Bit from outside
|
---|
297 | //
|
---|
298 | void MCalibrationChargePix::SetHiGainSaturation(Bool_t b)
|
---|
299 | {
|
---|
300 | b ? SETBIT(fFlags, kHiGainSaturation) : CLRBIT(fFlags, kHiGainSaturation);
|
---|
301 | }
|
---|
302 |
|
---|
303 |
|
---|
304 | // --------------------------------------------------------------------------
|
---|
305 | //
|
---|
306 | // Set the Excluded Bit from outside
|
---|
307 | //
|
---|
308 | void MCalibrationChargePix::SetExcluded(Bool_t b )
|
---|
309 | {
|
---|
310 | b ? SETBIT(fFlags, kExcluded) : CLRBIT(fFlags, kExcluded);
|
---|
311 | }
|
---|
312 |
|
---|
313 |
|
---|
314 | // --------------------------------------------------------------------------
|
---|
315 | //
|
---|
316 | // Set the Excluded Bit from outside
|
---|
317 | //
|
---|
318 | void MCalibrationChargePix::SetBlindPixelMethodValid(const Bool_t b )
|
---|
319 | {
|
---|
320 | b ? SETBIT(fFlags, kBlindPixelMethodValid) : CLRBIT(fFlags, kBlindPixelMethodValid);
|
---|
321 | }
|
---|
322 |
|
---|
323 | // --------------------------------------------------------------------------
|
---|
324 | //
|
---|
325 | // Set the Excluded Bit from outside
|
---|
326 | //
|
---|
327 | void MCalibrationChargePix::SetFFactorMethodValid(const Bool_t b )
|
---|
328 | {
|
---|
329 | b ? SETBIT(fFlags, kFFactorMethodValid) : CLRBIT(fFlags, kFFactorMethodValid);
|
---|
330 | }
|
---|
331 |
|
---|
332 | // --------------------------------------------------------------------------
|
---|
333 | //
|
---|
334 | // Set the Excluded Bit from outside
|
---|
335 | //
|
---|
336 | void MCalibrationChargePix::SetPINDiodeMethodValid(const Bool_t b )
|
---|
337 | {
|
---|
338 | b ? SETBIT(fFlags, kPINDiodeMethodValid) : CLRBIT(fFlags, kPINDiodeMethodValid);
|
---|
339 | }
|
---|
340 |
|
---|
341 | // --------------------------------------------------------------------------
|
---|
342 | //
|
---|
343 | // Set the Excluded Bit from outside
|
---|
344 | //
|
---|
345 | void MCalibrationChargePix::SetCombinedMethodValid(const Bool_t b )
|
---|
346 | {
|
---|
347 | b ? SETBIT(fFlags, kCombinedMethodValid) : CLRBIT(fFlags, kCombinedMethodValid);
|
---|
348 | }
|
---|
349 |
|
---|
350 |
|
---|
351 | Float_t MCalibrationChargePix::GetPedRms() const
|
---|
352 | {
|
---|
353 | return IsHiGainSaturation() ? fLoGainPedRms : fPedRms;
|
---|
354 | }
|
---|
355 |
|
---|
356 | Float_t MCalibrationChargePix::GetPedRmsErr() const
|
---|
357 | {
|
---|
358 | return IsHiGainSaturation() ? TMath::Sqrt(fLoGainPedRmsVar) : TMath::Sqrt(fPedVar)/2.;
|
---|
359 | }
|
---|
360 |
|
---|
361 | Float_t MCalibrationChargePix::GetPedErr() const
|
---|
362 | {
|
---|
363 | return TMath::Sqrt(fPedVar);
|
---|
364 | }
|
---|
365 |
|
---|
366 | Float_t MCalibrationChargePix::GetMeanCharge() const
|
---|
367 | {
|
---|
368 | return IsHiGainSaturation() ? GetLoGainMeanCharge() : GetHiGainMeanCharge() ;
|
---|
369 | }
|
---|
370 |
|
---|
371 | Float_t MCalibrationChargePix::GetMeanChargeErr() const
|
---|
372 | {
|
---|
373 | return IsHiGainSaturation() ? GetLoGainMeanChargeErr() : GetHiGainMeanChargeErr() ;
|
---|
374 | }
|
---|
375 |
|
---|
376 | Float_t MCalibrationChargePix::GetChargeProb() const
|
---|
377 | {
|
---|
378 | return IsHiGainSaturation() ? fLoGainChargeProb : fHiGainChargeProb ;
|
---|
379 | }
|
---|
380 |
|
---|
381 | Float_t MCalibrationChargePix::GetSigmaCharge() const
|
---|
382 | {
|
---|
383 | return IsHiGainSaturation() ? GetLoGainSigmaCharge() : GetHiGainSigmaCharge() ;
|
---|
384 | }
|
---|
385 |
|
---|
386 | Float_t MCalibrationChargePix::GetSigmaChargeErr() const
|
---|
387 | {
|
---|
388 | return IsHiGainSaturation() ? GetLoGainSigmaChargeErr() : GetHiGainSigmaChargeErr() ;
|
---|
389 | }
|
---|
390 |
|
---|
391 | Float_t MCalibrationChargePix::GetHiGainMeanChargeErr() const
|
---|
392 | {
|
---|
393 | return TMath::Sqrt(fHiGainMeanChargeVar);
|
---|
394 | }
|
---|
395 |
|
---|
396 | Float_t MCalibrationChargePix::GetLoGainMeanCharge() const
|
---|
397 | {
|
---|
398 | return fLoGainMeanCharge * fConversionHiLo;
|
---|
399 | }
|
---|
400 |
|
---|
401 | Float_t MCalibrationChargePix::GetLoGainMeanChargeErr() const
|
---|
402 | {
|
---|
403 |
|
---|
404 | const Float_t chargeRelVar = fLoGainMeanChargeVar
|
---|
405 | /( fLoGainMeanCharge * fLoGainMeanCharge );
|
---|
406 |
|
---|
407 | const Float_t conversionRelVar = fConversionHiLoVar
|
---|
408 | /( fConversionHiLo * fConversionHiLo );
|
---|
409 |
|
---|
410 | return TMath::Sqrt(chargeRelVar+conversionRelVar) * GetLoGainMeanCharge();
|
---|
411 | }
|
---|
412 |
|
---|
413 | Float_t MCalibrationChargePix::GetLoGainSigmaCharge() const
|
---|
414 | {
|
---|
415 | return fLoGainSigmaCharge * fConversionHiLo;
|
---|
416 | }
|
---|
417 |
|
---|
418 | Float_t MCalibrationChargePix::GetLoGainSigmaChargeErr() const
|
---|
419 | {
|
---|
420 |
|
---|
421 | const Float_t sigmaRelVar = fLoGainSigmaChargeVar
|
---|
422 | /( fLoGainSigmaCharge * fLoGainSigmaCharge );
|
---|
423 |
|
---|
424 | const Float_t conversionRelVar = fConversionHiLoVar
|
---|
425 | /( fConversionHiLo * fConversionHiLo );
|
---|
426 |
|
---|
427 | return TMath::Sqrt(sigmaRelVar+conversionRelVar) * GetLoGainSigmaCharge();
|
---|
428 | }
|
---|
429 |
|
---|
430 | Float_t MCalibrationChargePix::GetHiGainSigmaChargeErr() const
|
---|
431 | {
|
---|
432 | return TMath::Sqrt(fHiGainSigmaChargeVar);
|
---|
433 | }
|
---|
434 |
|
---|
435 | Float_t MCalibrationChargePix::GetRSigmaCharge() const
|
---|
436 | {
|
---|
437 | return IsHiGainSaturation() ? fRSigmaCharge*fConversionHiLo : fRSigmaCharge ;
|
---|
438 | }
|
---|
439 |
|
---|
440 | Float_t MCalibrationChargePix::GetRSigmaChargeErr() const
|
---|
441 | {
|
---|
442 | if (IsHiGainSaturation())
|
---|
443 | {
|
---|
444 | const Float_t rsigmaRelVar = fRSigmaChargeVar
|
---|
445 | /( fRSigmaCharge * fRSigmaCharge );
|
---|
446 | const Float_t conversionRelVar = fConversionHiLoVar
|
---|
447 | /( fConversionHiLo * fConversionHiLo );
|
---|
448 | return TMath::Sqrt(rsigmaRelVar+conversionRelVar) * GetRSigmaCharge();
|
---|
449 | }
|
---|
450 | else
|
---|
451 | return TMath::Sqrt(fRSigmaChargeVar);
|
---|
452 |
|
---|
453 | }
|
---|
454 |
|
---|
455 | Float_t MCalibrationChargePix::GetConversionHiLoErr() const
|
---|
456 | {
|
---|
457 | if (fConversionHiLoVar < 0.)
|
---|
458 | return -1.;
|
---|
459 | return TMath::Sqrt(fConversionHiLoVar);
|
---|
460 | }
|
---|
461 |
|
---|
462 | Float_t MCalibrationChargePix::GetPheFFactorMethodErr() const
|
---|
463 | {
|
---|
464 | if (fPheFFactorMethodVar < 0.)
|
---|
465 | return -1.;
|
---|
466 | return TMath::Sqrt(fPheFFactorMethodVar);
|
---|
467 | }
|
---|
468 |
|
---|
469 | Float_t MCalibrationChargePix::GetConversionCombinedMethodErr() const
|
---|
470 | {
|
---|
471 | if (fConversionCombinedMethodVar < 0.)
|
---|
472 | return -1.;
|
---|
473 | return TMath::Sqrt(fConversionCombinedMethodVar);
|
---|
474 | }
|
---|
475 |
|
---|
476 | Float_t MCalibrationChargePix::GetConversionPINDiodeMethodErr() const
|
---|
477 | {
|
---|
478 | if (fConversionPINDiodeMethodVar < 0.)
|
---|
479 | return -1.;
|
---|
480 | return TMath::Sqrt(fConversionPINDiodeMethodVar);
|
---|
481 | }
|
---|
482 |
|
---|
483 | Float_t MCalibrationChargePix::GetConversionBlindPixelMethodErr() const
|
---|
484 | {
|
---|
485 | if (fConversionBlindPixelMethodVar < 0.)
|
---|
486 | return -1.;
|
---|
487 | return TMath::Sqrt(fConversionBlindPixelMethodVar);
|
---|
488 | }
|
---|
489 |
|
---|
490 | Float_t MCalibrationChargePix::GetConversionFFactorMethodErr() const
|
---|
491 | {
|
---|
492 | if (fConversionFFactorMethodVar < 0.)
|
---|
493 | return -1.;
|
---|
494 | return TMath::Sqrt(fConversionFFactorMethodVar);
|
---|
495 | }
|
---|
496 |
|
---|
497 | Float_t MCalibrationChargePix::GetTotalFFactorCombinedMethodErr() const
|
---|
498 | {
|
---|
499 | if (fTotalFFactorCombinedMethodVar < 0.)
|
---|
500 | return -1.;
|
---|
501 | return TMath::Sqrt(fTotalFFactorCombinedMethodVar);
|
---|
502 | }
|
---|
503 |
|
---|
504 | Float_t MCalibrationChargePix::GetTotalFFactorPINDiodeMethodErr() const
|
---|
505 | {
|
---|
506 | if (fTotalFFactorPINDiodeMethodVar < 0.)
|
---|
507 | return -1.;
|
---|
508 | return TMath::Sqrt(fTotalFFactorPINDiodeMethodVar);
|
---|
509 | }
|
---|
510 |
|
---|
511 | Float_t MCalibrationChargePix::GetTotalFFactorBlindPixelMethodErr() const
|
---|
512 | {
|
---|
513 | if (fTotalFFactorBlindPixelMethodVar < 0.)
|
---|
514 | return -1.;
|
---|
515 | return TMath::Sqrt(fTotalFFactorBlindPixelMethodVar);
|
---|
516 | }
|
---|
517 |
|
---|
518 | Float_t MCalibrationChargePix::GetTotalFFactorFFactorMethodErr() const
|
---|
519 | {
|
---|
520 | if (fTotalFFactorFFactorMethodVar < 0.)
|
---|
521 | return -1.;
|
---|
522 | return TMath::Sqrt(fTotalFFactorFFactorMethodVar);
|
---|
523 | }
|
---|
524 |
|
---|
525 | Bool_t MCalibrationChargePix::IsExcluded() const
|
---|
526 | {
|
---|
527 | return TESTBIT(fFlags,kExcluded);
|
---|
528 | }
|
---|
529 |
|
---|
530 | Bool_t MCalibrationChargePix::IsHiGainSaturation() const
|
---|
531 | {
|
---|
532 | return TESTBIT(fFlags,kHiGainSaturation);
|
---|
533 | }
|
---|
534 |
|
---|
535 | Bool_t MCalibrationChargePix::IsBlindPixelMethodValid() const
|
---|
536 | {
|
---|
537 | return TESTBIT(fFlags, kBlindPixelMethodValid);
|
---|
538 | }
|
---|
539 |
|
---|
540 | Bool_t MCalibrationChargePix::IsFFactorMethodValid() const
|
---|
541 | {
|
---|
542 | return TESTBIT(fFlags, kFFactorMethodValid);
|
---|
543 | }
|
---|
544 |
|
---|
545 | Bool_t MCalibrationChargePix::IsPINDiodeMethodValid() const
|
---|
546 | {
|
---|
547 | return TESTBIT(fFlags, kPINDiodeMethodValid);
|
---|
548 | }
|
---|
549 |
|
---|
550 | Bool_t MCalibrationChargePix::IsCombinedMethodValid() const
|
---|
551 | {
|
---|
552 | return TESTBIT(fFlags, kCombinedMethodValid);
|
---|
553 | }
|
---|
554 |
|
---|
555 | //
|
---|
556 | //
|
---|
557 | //
|
---|
558 | Bool_t MCalibrationChargePix::CalcReducedSigma()
|
---|
559 | {
|
---|
560 |
|
---|
561 | const Float_t sigmacharge = IsHiGainSaturation() ? fLoGainSigmaCharge : fHiGainSigmaCharge ;
|
---|
562 | const Float_t sigmachargevar = IsHiGainSaturation() ? fLoGainSigmaChargeVar : fHiGainSigmaChargeVar;
|
---|
563 |
|
---|
564 | const Float_t sigmaSquare = sigmacharge * sigmacharge;
|
---|
565 | const Float_t sigmaSquareVar = 4.* sigmachargevar * sigmaSquare;
|
---|
566 |
|
---|
567 | Float_t pedRmsSquare ;
|
---|
568 | Float_t pedRmsSquareVar;
|
---|
569 |
|
---|
570 | if (IsHiGainSaturation())
|
---|
571 | {
|
---|
572 | pedRmsSquare = fLoGainPedRms * fLoGainPedRms;
|
---|
573 | pedRmsSquareVar = 4.* fLoGainPedRmsVar * pedRmsSquare;
|
---|
574 | }
|
---|
575 | else
|
---|
576 | {
|
---|
577 | pedRmsSquare = fPedRms * fPedRms;
|
---|
578 | pedRmsSquareVar = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2.
|
---|
579 | }
|
---|
580 | //
|
---|
581 | // Calculate the reduced sigmas
|
---|
582 | //
|
---|
583 | const Float_t rsigmachargesquare = sigmaSquare - pedRmsSquare;
|
---|
584 | if (rsigmachargesquare <= 0.)
|
---|
585 | {
|
---|
586 | *fLog << warn
|
---|
587 | << "WARNING: Cannot calculate the reduced sigma: smaller than 0 in pixel "
|
---|
588 | << fPixId << endl;
|
---|
589 | return kFALSE;
|
---|
590 | }
|
---|
591 |
|
---|
592 |
|
---|
593 | fRSigmaCharge = TMath::Sqrt(rsigmachargesquare);
|
---|
594 | fRSigmaChargeVar = 0.25 * (sigmaSquareVar + pedRmsSquareVar) / rsigmachargesquare;
|
---|
595 |
|
---|
596 | return kTRUE;
|
---|
597 | }
|
---|
598 |
|
---|
599 | //
|
---|
600 | // Calculate the number of photo-electrons after the F-Factor method
|
---|
601 | // Calculate the errors of the F-Factor method
|
---|
602 | //
|
---|
603 | Bool_t MCalibrationChargePix::CalcFFactorMethod()
|
---|
604 | {
|
---|
605 |
|
---|
606 | if (fRSigmaCharge < 0.)
|
---|
607 | {
|
---|
608 | SetFFactorMethodValid(kFALSE);
|
---|
609 | return kFALSE;
|
---|
610 | }
|
---|
611 |
|
---|
612 | const Float_t charge = IsHiGainSaturation() ? fLoGainMeanCharge : fHiGainMeanCharge ;
|
---|
613 | const Float_t chargevar = IsHiGainSaturation() ? fLoGainMeanChargeVar : fHiGainMeanChargeVar;
|
---|
614 |
|
---|
615 | //
|
---|
616 | // Square all variables in order to avoid applications of square root
|
---|
617 | //
|
---|
618 | // First the relative error squares
|
---|
619 | //
|
---|
620 | const Float_t chargeSquare = charge * charge;
|
---|
621 | const Float_t chargeSquareRelVar = 4.* chargevar/ chargeSquare;
|
---|
622 |
|
---|
623 | const Float_t ffactorsquare = gkFFactor * gkFFactor;
|
---|
624 | const Float_t ffactorsquareRelVar = 4.*gkFFactorErr * gkFFactorErr / ffactorsquare;
|
---|
625 |
|
---|
626 | const Float_t rsigmaSquare = fRSigmaCharge * fRSigmaCharge;
|
---|
627 | const Float_t rsigmaSquareRelVar = 4.* fRSigmaChargeVar / rsigmaSquare;
|
---|
628 |
|
---|
629 | //
|
---|
630 | // Calculate the number of phe's from the F-Factor method
|
---|
631 | // (independent on Hi Gain or Lo Gain)
|
---|
632 | //
|
---|
633 | fPheFFactorMethod = ffactorsquare * chargeSquare / rsigmaSquare;
|
---|
634 |
|
---|
635 | if (fPheFFactorMethod < fPheFFactorMethodLimit)
|
---|
636 | {
|
---|
637 | SetFFactorMethodValid(kFALSE);
|
---|
638 | return kFALSE;
|
---|
639 | }
|
---|
640 |
|
---|
641 | //
|
---|
642 | // Calculate the Error of Nphe
|
---|
643 | //
|
---|
644 | fPheFFactorMethodVar = (ffactorsquareRelVar + chargeSquareRelVar + rsigmaSquareRelVar)
|
---|
645 | * fPheFFactorMethod * fPheFFactorMethod;
|
---|
646 |
|
---|
647 | SetFFactorMethodValid(kTRUE);
|
---|
648 | return kTRUE;
|
---|
649 | }
|
---|
650 |
|
---|
651 |
|
---|
652 | void MCalibrationChargePix::CalcLoGainPedestal(Float_t logainsamples)
|
---|
653 | {
|
---|
654 |
|
---|
655 | fElectronicPedRms = gkElectronicPedRms * TMath::Sqrt(logainsamples);
|
---|
656 | fElectronicPedRmsVar = gkElectronicPedRmsErr * gkElectronicPedRmsErr * logainsamples;
|
---|
657 |
|
---|
658 | Float_t pedRmsSquare = fPedRms * fPedRms;
|
---|
659 | Float_t pedRmsSquareVar = fPedVar * pedRmsSquare; // fPedRmsErr = fPedErr/2.
|
---|
660 |
|
---|
661 | //
|
---|
662 | // We do not know the Lo Gain Pedestal RMS, so we have to retrieve it
|
---|
663 | // from the HI GAIN (all calculation per slice up to now):
|
---|
664 | //
|
---|
665 | // We extract the pure NSB contribution:
|
---|
666 | //
|
---|
667 | const Float_t elecRmsSquare = fElectronicPedRms * fElectronicPedRms;
|
---|
668 | const Float_t elecRmsSquareVar = 4.*fElectronicPedRmsVar * elecRmsSquare;
|
---|
669 |
|
---|
670 | Float_t nsbSquare = pedRmsSquare - elecRmsSquare;
|
---|
671 | Float_t nsbSquareRelVar = (pedRmsSquareVar + elecRmsSquareVar)
|
---|
672 | / (nsbSquare * nsbSquare) ;
|
---|
673 |
|
---|
674 | if (nsbSquare < 0.)
|
---|
675 | nsbSquare = 0.;
|
---|
676 |
|
---|
677 | //
|
---|
678 | // Now, we divide the NSB by the conversion factor and
|
---|
679 | // add it quadratically to the electronic noise
|
---|
680 | //
|
---|
681 | const Float_t conversionSquare = fConversionHiLo * fConversionHiLo;
|
---|
682 | const Float_t convertedNsbSquare = nsbSquare / conversionSquare;
|
---|
683 | const Float_t convertedNsbSquareVar = nsbSquareRelVar
|
---|
684 | * convertedNsbSquare * convertedNsbSquare;
|
---|
685 |
|
---|
686 | pedRmsSquare = convertedNsbSquare + elecRmsSquare;
|
---|
687 | pedRmsSquareVar = convertedNsbSquareVar + elecRmsSquareVar;
|
---|
688 |
|
---|
689 | fLoGainPedRms = TMath::Sqrt(pedRmsSquare);
|
---|
690 | fLoGainPedRmsVar = 0.25 * pedRmsSquareVar / pedRmsSquare;
|
---|
691 |
|
---|
692 | }
|
---|
693 |
|
---|
694 |
|
---|
695 |
|
---|