source: trunk/MagicSoft/Mars/mcalib/MCalibrationQEPix.cc@ 3687

Last change on this file since 3687 was 3685, checked in by gaug, 22 years ago
*** empty log message ***
File size: 41.5 KB
Line 
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/////////////////////////////////////////////////////////////////////////////
26//
27// MCalibrationQEPix
28//
29// Storage container of the calibrated Quantrum Efficiency of one pixel.
30// This container (like MCalibrationQECam) is designed to persist during
31// several eventloops over different calibration files, especially those
32// with different colour LEDs. This class contains all measured Quantum
33// Efficiencies with the calibration system for each individual pixel.
34//
35// At the moment, this calibration works in the following steps:
36//
37// 1) MHCalibrationChargeCam extracts mean and sigma (and its errors) of
38// the summed FADC slices distribution and stores them in MCalibrationCam
39//
40// 2) MHCalibrationChargeBlindPix extracts the mean of a Poisson fit to the
41// single photo-electron spectrum and stores it in MCalibrationChargeBlindPix
42//
43// 3) MHCalibrationChargePINDiode extracts the mean of a charge distribution
44// of the signals collected by the PIN Diode and stores it in
45// MCalibrationChargePINDiode
46//
47// 4) MCalibrationChargeCalc calculates for every pixel the number of
48// photo-electrons with the F-Factor method and stores them in MCalibrationChargePix
49//
50// 5) MCalibrationChargeCalc calculates the (weighted) average number of photo-
51// electrons from the pixels with the area index 0 (Inner pixels for the MAGIC
52// camera) and divides this number by gkDefaultQEGreen, gkDefaultQEBlue,
53// gkDefaultQEUV or gkDefaultQECT1, depending on the used pulser LED colour,
54// and further by MCalibrationQECam::gkPlexiglassQE. The obtained number gives
55// the NUMBER OF PHOTONS incident on a pixel with area index 0 (INNER pixel)
56// OUTSIDE THE PLEXIGLASS of the camera, obtained with the F-Factor method.
57//
58// 6) MCalibrationChargeCalc calculates the mean photon flux per mm^2 in the camera
59// from the MCalibrationChargeBlindPix, multiplies it with the area of
60// one pixel with area index 0 (Inner pixel) and divides it by the quantum
61// efficiency of the plexi-glass (MCalibrationQECam::gkPlexiglassQE). The obtained
62// number gives the NUMBER OF PHOTONS incident on a pixel with area index 0
63// (INNER pixel) OUTSIDE THE PLEXIGLASS of the camera, obtained with the
64// Blind Pixel method.
65//
66// 7) MCalibrationChargeCalc calculates the mean photon flux per mm^2 in the camera
67// from the MCalibrationChargePINDiode and multiplies it with the area of
68// one pixel with area index 0 (Inner pixel). The obtained number gives the
69// NUMBER OF PHOTONS incident on a pixel with area index 0 (INNER pixel)
70// OUTSIDE THE PLEXIGLASS of the camera, obtained with the PIN Diode method.
71//
72// 8) Each of the three photons numbers is divided by the mean sum of FADC counts
73// and defined as MEASURED QUANTUM EFFICIENCY AT A GIVEN COLOUR. They are stored
74// in the variables SetQEBlindPixel(qe, color), SetQEFFactor(qe,color) and
75// SetQEPINDiode(qe,color)
76//
77// 9) Errors are propagated and corresponding variances get stored in
78// SetQEBlindPixelVar(var,color), SetQEFFactorVar(var,color) and
79// SetQEPINDiodeVar(var,color).
80//
81// 10) After every eventloop, MCalibrationChargeCalc calls the functions UpdateBlindPixelMethod(),
82// UpdateFFactorMethod() and UpdatePINDiodeMethod() which calculate the ratio
83// measured QE / gkDefaultQEGreen (or gkDefaultQEBlue or gkDefaultQEUV or gkDefaultQECT1)
84// and calculates an weighted average of these quantum-efficiency normalizations obtained
85// by one of the three methods.
86//
87// 11) A call to GetQECascadesBlindPixel(zenith), GetQECascadesFFactor(zenith) or
88// GetQECascadesPINDiode(zenith) returns then the normalization multiplied with an average QE
89// folded into a cascades spectrum. This number should be dependent on zenith angle, but
90// this feature is not yet implemented, instead a fixed number gkDefaultAverageQE is used.
91//
92// The number gkDefaultAverageQE = 0.20 +- 0.02 can be obtained in the following way:
93//
94// * Averaged QE coated PMTs: zenith value
95// 0. 0.237
96// 20. 0.237
97// 40. 0.236
98// 60. 0.234
99// (from D.Paneque et al., NIM A 504, 2003, 109-115
100//
101// * PMT photoelectron collection efficiency: 0.9
102// (from D.Paneque, email 14.2.2004)
103//
104// * Light guides efficiency: 0.94
105// (from D.Paneque, email 14.2.2004)
106//
107// "Concerning the light guides effiency estimation... Daniel Ferenc
108// is preparing some work (simulations) to estimate it. Yet so far, he has
109// been busy with other stuff, and this work is still UNfinished.
110//
111// The estimation I did comes from:
112// 1) Reflectivity of light guide walls is 85 % (aluminum)
113// 2) At ZERO degree light incidence, 37% of the light hits such walls
114// (0.15X37%= 5.6% of light lost)
115// 3) When increasing the light incidence angle, more and more light hits
116// the walls.
117//
118// However, the loses due to larger amount of photons hitting the walls is more
119// or less counteracted by the fact that more and more photon trajectories cross
120// the PMT photocathode twice, increasing the effective sensitivity of the PMT.
121//
122// Jurgen Gebauer did some quick measurements about this issue. I attach a
123// plot. You can see that the angular dependence is (more or less) in agreement
124// with a CosTheta function (below 20-25 degrees),
125// which is the variation of teh entrance window cross section. So, in
126// first approximation, no loses when increasing light incidence angle;
127// and therefore, the factor 0.94."
128//
129/////////////////////////////////////////////////////////////////////////////
130#include "MCalibrationQEPix.h"
131#include "MCalibrationCam.h"
132
133#include "MLog.h"
134#include "MLogManip.h"
135
136#include "TArrayF.h"
137#include "TArrayC.h"
138
139ClassImp(MCalibrationQEPix);
140
141using namespace std;
142
143const Float_t MCalibrationQEPix::gkDefaultQEGreen = 0.192;
144const Float_t MCalibrationQEPix::gkDefaultQEBlue = 0.27;
145const Float_t MCalibrationQEPix::gkDefaultQEUV = 0.285;
146const Float_t MCalibrationQEPix::gkDefaultQECT1 = 0.285;
147const Float_t MCalibrationQEPix::gkDefaultQEGreenErr = 0.05 ;
148const Float_t MCalibrationQEPix::gkDefaultQEBlueErr = 0.07 ;
149const Float_t MCalibrationQEPix::gkDefaultQEUVErr = 0.07 ;
150const Float_t MCalibrationQEPix::gkDefaultQECT1Err = 0.07 ;
151const Float_t MCalibrationQEPix::gkDefaultAverageQE = 0.20;
152const Float_t MCalibrationQEPix::gkDefaultAverageQEErr = 0.02;
153// --------------------------------------------------------------------------
154//
155// Default Constructor:
156//
157// Initializes all TArrays to MCalibrationCam::gkNumPulserColors
158//
159// Calls:
160// - Clear()
161//
162MCalibrationQEPix::MCalibrationQEPix(const char *name, const char *title)
163 : fQEBlindPixel ( MCalibrationCam::gkNumPulserColors),
164 fQEBlindPixelVar ( MCalibrationCam::gkNumPulserColors ),
165 fQECombined ( MCalibrationCam::gkNumPulserColors ),
166 fQECombinedVar ( MCalibrationCam::gkNumPulserColors ),
167 fQEFFactor ( MCalibrationCam::gkNumPulserColors ),
168 fQEFFactorVar ( MCalibrationCam::gkNumPulserColors ),
169 fQEPINDiode ( MCalibrationCam::gkNumPulserColors ),
170 fQEPINDiodeVar ( MCalibrationCam::gkNumPulserColors ),
171 fValidFlags ( MCalibrationCam::gkNumPulserColors )
172{
173
174 fName = name ? name : "MCalibrationQEPix";
175 fTitle = title ? title : "Container of the calibrated quantum efficiency ";
176
177 Clear();
178
179}
180
181// ----------------------------------------------------------------------------------------------
182//
183// Search all available QE's of a certain colour after the blind pixel method,
184// compare them to the default QE of that colour and
185// add up a weighted average (wav) and a sum of weights (sumw)
186//
187// FIXME: This has to be replaced by a decent fit the QE-spectrum!
188//
189void MCalibrationQEPix::AddAverageBlindPixelQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
190{
191
192 if (IsBlindPixelMethodValid (col))
193 {
194 const Float_t newavqe = GetQEBlindPixel(col) / GetDefaultQE (col) ;
195 const Float_t newavqevar = ( GetQEBlindPixelRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
196 wav += newavqe / newavqevar;
197 sumw += 1. / newavqevar ;
198 }
199}
200
201// ----------------------------------------------------------------------------------------------
202//
203// Search all available QE's of a certain colour after the combination of the three methods
204// compare them to the default QE of that colour and
205// add up a weighted average (wav) and a sum of weights (sumw)
206//
207// FIXME: This has to be replaced by a decent fit the QE-spectrum!
208//
209void MCalibrationQEPix::AddAverageCombinedQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
210{
211
212 if (IsCombinedMethodValid (col))
213 {
214 const Float_t newavqe = GetQECombined(col) / GetDefaultQE (col) ;
215 const Float_t newavqevar = ( GetQECombinedRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
216 wav += newavqe / newavqevar;
217 sumw += 1./ newavqevar;
218 }
219}
220
221// ----------------------------------------------------------------------------------------------
222//
223// Search all available QE's of a certain colour after the F-Factor method,
224// compare them to the default QE of that colour and
225// add up a weighted average (wav) and a sum of weights (sumw)
226//
227// FIXME: This has to be replaced by a decent fit the QE-spectrum!
228//
229void MCalibrationQEPix::AddAverageFFactorQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
230{
231
232 if (IsFFactorMethodValid (col))
233 {
234 const Float_t newavqe = GetQEFFactor(col) / GetDefaultQE (col) ;
235 const Float_t newavqevar = ( GetQEFFactorRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
236 wav += newavqe / newavqevar;
237 sumw += 1./ newavqevar;
238 }
239}
240
241// ----------------------------------------------------------------------------------------------
242//
243// Search all available QE's of a certain colour after the PIN Diode method,
244// compare them to the default QE of that colour and
245// add up a weighted average (wav) and a sum of weights (sumw)
246//
247// FIXME: This has to be replaced by a decent fit the QE-spectrum!
248//
249void MCalibrationQEPix::AddAveragePINDiodeQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
250{
251
252 if (IsPINDiodeMethodValid (col))
253 {
254 const Float_t newavqe = GetQEPINDiode(col) / GetDefaultQE (col) ;
255 const Float_t newavqevar = ( GetQEPINDiodeRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
256 wav += newavqe / newavqevar;
257 sumw += 1./ newavqevar;
258 }
259}
260
261
262
263// ------------------------------------------------------------------------
264//
265// Sets all quantum efficiencies to the gkDefaultQE*
266// Sets all Variances to the square root of gkDefaultQE*Err
267// Sets all flags to kFALSE
268//
269// Calls:
270// - MCalibrationPix::Clear()
271//
272void MCalibrationQEPix::Clear(Option_t *o)
273{
274
275 SetAverageQEBlindPixelAvailable ( kFALSE );
276 SetAverageQEFFactorAvailable ( kFALSE );
277 SetAverageQECombinedAvailable ( kFALSE );
278 SetAverageQEPINDiodeAvailable ( kFALSE );
279
280 fQEBlindPixel [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;
281 fQEBlindPixelVar [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
282 fQEFFactor [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;
283 fQEFFactorVar [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
284 fQECombined [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;
285 fQECombinedVar [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
286 fQEPINDiode [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;
287 fQEPINDiodeVar [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
288
289 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kGREEN);
290 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kGREEN);
291 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kGREEN);
292 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kGREEN);
293
294 fQEBlindPixel [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;
295 fQEBlindPixelVar [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
296 fQEFFactor [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;
297 fQEFFactorVar [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
298 fQECombined [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;
299 fQECombinedVar [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
300 fQEPINDiode [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;
301 fQEPINDiodeVar [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
302
303 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kBLUE);
304 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kBLUE);
305 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kBLUE);
306 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kBLUE);
307
308 fQEBlindPixel [ MCalibrationCam::kUV ] = gkDefaultQEUV;
309 fQEBlindPixelVar [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
310 fQEFFactor [ MCalibrationCam::kUV ] = gkDefaultQEUV;
311 fQEFFactorVar [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
312 fQECombined [ MCalibrationCam::kUV ] = gkDefaultQEUV;
313 fQECombinedVar [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
314 fQEPINDiode [ MCalibrationCam::kUV ] = gkDefaultQEUV;
315 fQEPINDiodeVar [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
316
317 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kUV);
318 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kUV);
319 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kUV);
320 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kUV);
321
322 fQEBlindPixel [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;
323 fQEBlindPixelVar [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
324 fQEFFactor [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;
325 fQEFFactorVar [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
326 fQECombined [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;
327 fQECombinedVar [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
328 fQEPINDiode [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;
329 fQEPINDiodeVar [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
330
331 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kCT1);
332 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kCT1);
333 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kCT1);
334 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kCT1);
335
336 MCalibrationPix::Clear();
337}
338
339
340// -----------------------------------------------------------------
341//
342// Return the average Default QE (depending on zenith angle)
343//
344const Float_t MCalibrationQEPix::GetAverageQE( const Float_t zenith ) const
345{
346 return gkDefaultAverageQE ;
347}
348
349// -----------------------------------------------------------------
350//
351// Return the relative variance of the average Default QE (depending on zenith angle)
352//
353const Float_t MCalibrationQEPix::GetAverageQERelVar( const Float_t zenith ) const
354{
355 return gkDefaultAverageQEErr * gkDefaultAverageQEErr / (gkDefaultAverageQE * gkDefaultAverageQE );
356}
357
358// -----------------------------------------------------------------
359//
360// Return the relative variance of the average normalization (Blind Pixel Method)
361//
362const Float_t MCalibrationQEPix::GetAvNormBlindPixelRelVar( ) const
363{
364 return fAvNormBlindPixelVar / (fAvNormBlindPixel * fAvNormBlindPixel );
365}
366
367// -----------------------------------------------------------------
368//
369// Return the relative variance of the average normalization (Combined Method)
370//
371const Float_t MCalibrationQEPix::GetAvNormCombinedRelVar( ) const
372{
373 return fAvNormCombinedVar / (fAvNormCombined * fAvNormCombined );
374}
375
376// -----------------------------------------------------------------
377//
378// Return the relative variance of the average normalization (F-Factor Method)
379//
380const Float_t MCalibrationQEPix::GetAvNormFFactorRelVar( ) const
381{
382 return fAvNormFFactorVar / (fAvNormFFactor * fAvNormFFactor );
383}
384
385// -----------------------------------------------------------------
386//
387// Return the relative variance of the average normalization (PIN Diode Method)
388//
389const Float_t MCalibrationQEPix::GetAvNormPINDiodeRelVar( ) const
390{
391 return fAvNormPINDiodeVar / (fAvNormPINDiode * fAvNormPINDiode );
392}
393
394// ------------------------------------------------------------------------------
395//
396// Get the default Quantum efficiency for pulser colour "col"
397//
398Float_t MCalibrationQEPix::GetDefaultQE( const MCalibrationCam::PulserColor_t col ) const
399{
400 switch (col)
401 {
402 case MCalibrationCam::kGREEN:
403 return gkDefaultQEGreen;
404 break;
405 case MCalibrationCam::kBLUE:
406 return gkDefaultQEBlue;
407 break;
408 case MCalibrationCam::kUV:
409 return gkDefaultQEUV;
410 break;
411 case MCalibrationCam::kCT1:
412 return gkDefaultQECT1;
413 break;
414 default:
415 return gkDefaultQECT1;
416 break;
417 }
418 return -1.;
419}
420
421// ------------------------------------------------------------------------------
422//
423// Get the relative variance of the default Quantum efficiency for pulser colour "col"
424//
425Float_t MCalibrationQEPix::GetDefaultQERelVar( const MCalibrationCam::PulserColor_t col ) const
426{
427 switch (col)
428 {
429 case MCalibrationCam::kGREEN:
430 return gkDefaultQEGreenErr * gkDefaultQEGreenErr / (gkDefaultQEGreen * gkDefaultQEGreen );
431 break;
432 case MCalibrationCam::kBLUE:
433 return gkDefaultQEBlueErr * gkDefaultQEBlueErr / (gkDefaultQEBlue * gkDefaultQEBlue );
434 break;
435 case MCalibrationCam::kUV:
436 return gkDefaultQEUVErr * gkDefaultQEUVErr / (gkDefaultQEUV * gkDefaultQEUV );
437 break;
438 case MCalibrationCam::kCT1:
439 return gkDefaultQECT1Err * gkDefaultQECT1Err / (gkDefaultQECT1 * gkDefaultQECT1 );
440 break;
441 default:
442 return gkDefaultQECT1Err * gkDefaultQECT1Err / (gkDefaultQECT1 * gkDefaultQECT1 );
443 break;
444 }
445 return -1.;
446}
447
448// ------------------------------------------------------------------------------
449//
450// Get the calculated Quantum efficiency with the blind pixel method,
451// obtained with pulser colour "col"
452//
453Float_t MCalibrationQEPix::GetQEBlindPixel( const MCalibrationCam::PulserColor_t col ) const
454{
455 return fQEBlindPixel[col];
456}
457
458// ------------------------------------------------------------------------------
459//
460// Get the error on the calculated Quantum efficiency with the blind pixel method,
461// obtained with pulser colour "col"
462// Tests for variances smaller than 0. (e.g. if it has not yet been set)
463// and returns -1. in that case
464//
465Float_t MCalibrationQEPix::GetQEBlindPixelErr( const MCalibrationCam::PulserColor_t col ) const
466{
467
468 if (fQEBlindPixelVar[col] < 0.)
469 return -1.;
470
471 return TMath::Sqrt(fQEBlindPixelVar[col]);
472
473}
474
475// ------------------------------------------------------------------------------
476//
477// Get the relative variance of the calculated Quantum efficiency with the blind pixel method,
478// obtained with pulser colour "col"
479// Tests for variances smaller than 0. (e.g. if it has not yet been set)
480// and returns -1. in that case
481// Tests for quantum efficiency equal to 0. and returns -1. in that case
482//
483Float_t MCalibrationQEPix::GetQEBlindPixelRelVar( const MCalibrationCam::PulserColor_t col ) const
484{
485
486 if (fQEBlindPixelVar[col] < 0.)
487 return -1.;
488 if (fQEBlindPixel[col] < 0.)
489 return -1.;
490 return fQEBlindPixelVar[col] / ( fQEBlindPixel[col] * fQEBlindPixel[col] );
491
492}
493
494// ------------------------------------------------------------------------------
495//
496// Get the calculated Quantum efficiency with the combination of the three methods
497// obtained with pulser colour "col"
498//
499Float_t MCalibrationQEPix::GetQECombined( const MCalibrationCam::PulserColor_t col ) const
500{
501 return fQECombined[col];
502}
503
504
505// ------------------------------------------------------------------------------
506//
507// Get the error on the calculated Quantum efficiency with the combination of the three methods
508// obtained with pulser colour "col"
509// Tests for variances smaller than 0. (e.g. if it has not yet been set)
510// and returns -1. in that case
511//
512Float_t MCalibrationQEPix::GetQECombinedErr( const MCalibrationCam::PulserColor_t col ) const
513{
514
515 if (fQECombinedVar[col] < 0.)
516 return -1.;
517
518 return TMath::Sqrt(fQECombinedVar[col]);
519
520}
521
522
523// ----------------------------------------------------------------------------------------
524//
525// Get the relative variance of the calculated Quantum efficiency with the combination of
526// the three methods,
527// obtained with pulser colour "col"
528// Tests for variances smaller than 0. (e.g. if it has not yet been set)
529// and returns -1. in that case
530// Tests for quantum efficiency equal to 0. and returns -1. in that case
531//
532Float_t MCalibrationQEPix::GetQECombinedRelVar( const MCalibrationCam::PulserColor_t col ) const
533{
534
535 if (fQECombinedVar[col] < 0.)
536 return -1.;
537 if (fQECombined[col] < 0.)
538 return -1.;
539 return fQECombinedVar[col] / ( fQECombined[col] * fQECombined[col] );
540
541}
542
543// ------------------------------------------------------------------------------
544//
545// Get the calculated Quantum efficiency with the F-Factor method
546// obtained with pulser colour "col"
547//
548Float_t MCalibrationQEPix::GetQEFFactor( const MCalibrationCam::PulserColor_t col ) const
549{
550 return fQEFFactor[col];
551}
552
553
554// ------------------------------------------------------------------------------
555//
556// Get the error on the calculated Quantum efficiency with the F-Factor method,
557// obtained with pulser colour "col"
558// Tests for variances smaller than 0. (e.g. if it has not yet been set)
559// and returns -1. in that case
560//
561Float_t MCalibrationQEPix::GetQEFFactorErr( const MCalibrationCam::PulserColor_t col ) const
562{
563
564 if (fQEFFactorVar[col] < 0.)
565 return -1.;
566
567 return TMath::Sqrt(fQEFFactorVar[col]);
568
569}
570
571
572// ----------------------------------------------------------------------------------------
573//
574// Get the relative variance of the calculated Quantum efficiency with the F-Factor method,
575// obtained with pulser colour "col"
576// Tests for variances smaller than 0. (e.g. if it has not yet been set)
577// and returns -1. in that case
578// Tests for quantum efficiency equal to 0. and returns -1. in that case
579//
580Float_t MCalibrationQEPix::GetQEFFactorRelVar( const MCalibrationCam::PulserColor_t col ) const
581{
582
583 if (fQEFFactorVar[col] < 0.)
584 return -1.;
585 if (fQEFFactor[col] < 0.)
586 return -1.;
587 return fQEFFactorVar[col] / ( fQEFFactor[col] * fQEFFactor[col] );
588
589}
590
591// ------------------------------------------------------------------------------
592//
593// Get the calculated Quantum efficiency with the PIN-Diode method
594// obtained with pulser colour "col"
595//
596Float_t MCalibrationQEPix::GetQEPINDiode( const MCalibrationCam::PulserColor_t col ) const
597{
598 return fQEPINDiode[col];
599}
600
601
602// ------------------------------------------------------------------------------
603//
604// Get the error on the calculated Quantum efficiency with the PIN Diode method,
605// obtained with pulser colour "col"
606// Tests for variances smaller than 0. (e.g. if it has not yet been set)
607// and returns -1. in that case
608//
609Float_t MCalibrationQEPix::GetQEPINDiodeErr( const MCalibrationCam::PulserColor_t col ) const
610{
611
612 if (fQEPINDiodeVar[col] < 0.)
613 return -1.;
614
615 return TMath::Sqrt(fQEPINDiodeVar[col]);
616
617}
618
619// ----------------------------------------------------------------------------------------
620//
621// Get the relative variance of the calculated Quantum efficiency with the PIN Diode method,
622// obtained with pulser colour "col"
623// Tests for variances smaller than 0. (e.g. if it has not yet been set)
624// and returns -1. in that case
625// Tests for quantum efficiency equal to 0. and returns -1. in that case
626//
627Float_t MCalibrationQEPix::GetQEPINDiodeRelVar( const MCalibrationCam::PulserColor_t col ) const
628{
629
630 if (fQEPINDiodeVar[col] < 0.)
631 return -1.;
632 if (fQEPINDiode[col] < 0.)
633 return -1.;
634 return fQEPINDiodeVar[col] / ( fQEPINDiode[col] * fQEPINDiode[col] );
635
636}
637
638// ------------------------------------------------------------------------------
639//
640// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained
641// with the blind pixel method and averaged over the results from the different colours.
642//
643Float_t MCalibrationQEPix::GetQECascadesBlindPixel( const Float_t zenith ) const
644{
645 return fAvNormBlindPixel * GetAverageQE ( zenith );
646}
647
648// ------------------------------------------------------------------------------
649//
650// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum,
651// obtained with the blind pixel method and averaged over the results from the
652// different colours.
653//
654Float_t MCalibrationQEPix::GetQECascadesBlindPixelVar( const Float_t zenith ) const
655{
656 return ( GetAvNormBlindPixelRelVar() + GetAverageQERelVar(zenith))
657 * GetQECascadesBlindPixel(zenith) * GetQECascadesBlindPixel(zenith);
658}
659
660// ------------------------------------------------------------------------------
661//
662// Get the error on the averaged Quantum efficiency folded over the cascade spectrum,
663// obtained with the blind pixel method and averaged over the results from the
664// different colours.
665//
666Float_t MCalibrationQEPix::GetQECascadesBlindPixelErr( const Float_t zenith ) const
667{
668 const Float_t var = GetQECascadesBlindPixel(zenith);
669
670 if (var < 0.)
671 return -1.;
672
673 return TMath::Sqrt(var);
674}
675
676// ------------------------------------------------------------------------------
677//
678// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained
679// with the combination of the three methods and averaged over the results
680// from the different colours.
681//
682Float_t MCalibrationQEPix::GetQECascadesCombined( const Float_t zenith ) const
683{
684 return fAvNormCombined * GetAverageQE ( zenith );
685}
686
687// ------------------------------------------------------------------------------
688//
689// Get the error on the averaged Quantum efficiency folded over the cascade spectrum,
690// obtained with the combined method and averaged over the results from the
691// different colours.
692//
693Float_t MCalibrationQEPix::GetQECascadesCombinedErr( const Float_t zenith ) const
694{
695 const Float_t var = GetQECascadesCombined(zenith);
696
697 if (var < 0.)
698 return -1.;
699
700 return TMath::Sqrt(var);
701}
702
703// ------------------------------------------------------------------------------
704//
705// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum,
706// obtained with the combination of the three methods and averaged over the results from the
707// different colours.
708//
709Float_t MCalibrationQEPix::GetQECascadesCombinedVar( const Float_t zenith ) const
710{
711 return ( GetAvNormCombinedRelVar() + GetAverageQERelVar(zenith))
712 * GetQECascadesCombined(zenith) * GetQECascadesCombined(zenith);
713}
714
715// ------------------------------------------------------------------------------
716//
717// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained
718// with the F-Factor method and averaged over the results from the different colours.
719//
720Float_t MCalibrationQEPix::GetQECascadesFFactor( const Float_t zenith ) const
721{
722 return fAvNormFFactor * GetAverageQE ( zenith );
723}
724
725// ------------------------------------------------------------------------------
726//
727// Get the error on the averaged Quantum efficiency folded over the cascade spectrum,
728// obtained with the F-Factor method and averaged over the results from the
729// different colours.
730//
731Float_t MCalibrationQEPix::GetQECascadesFFactorErr( const Float_t zenith ) const
732{
733 const Float_t var = GetQECascadesFFactor(zenith);
734
735 if (var < 0.)
736 return -1.;
737
738 return TMath::Sqrt(var);
739}
740
741// ------------------------------------------------------------------------------
742//
743// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum,
744// obtained with the F-Factor method and averaged over the results from the
745// different colours.
746//
747Float_t MCalibrationQEPix::GetQECascadesFFactorVar( const Float_t zenith ) const
748{
749 return ( GetAvNormFFactorRelVar() + GetAverageQERelVar(zenith))
750 * GetQECascadesFFactor(zenith) * GetQECascadesFFactor(zenith);
751}
752
753// ------------------------------------------------------------------------------
754//
755// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained
756// with the PIN Diode method and averaged over the results from the different colours.
757//
758Float_t MCalibrationQEPix::GetQECascadesPINDiode( const Float_t zenith ) const
759{
760 return fAvNormPINDiode * GetAverageQE ( zenith );
761}
762
763// ------------------------------------------------------------------------------
764//
765// Get the error on the averaged Quantum efficiency folded over the cascade spectrum,
766// obtained with the PIN Diode method and averaged over the results from the
767// different colours.
768//
769Float_t MCalibrationQEPix::GetQECascadesPINDiodeErr( const Float_t zenith ) const
770{
771 const Float_t var = GetQECascadesPINDiode(zenith);
772
773 if (var < 0.)
774 return -1.;
775
776 return TMath::Sqrt(var);
777}
778
779// ------------------------------------------------------------------------------
780//
781// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum,
782// obtained with the PIN Diode method and averaged over the results from the
783// different colours.
784//
785Float_t MCalibrationQEPix::GetQECascadesPINDiodeVar( const Float_t zenith ) const
786{
787 return ( GetAvNormPINDiodeRelVar() + GetAverageQERelVar(zenith))
788 * GetQECascadesPINDiode(zenith) * GetQECascadesPINDiode(zenith);
789}
790
791// ------------------------------------------------------------------------------
792//
793// Test if the average QE can be obtained from the blind pixel method
794//
795Bool_t MCalibrationQEPix::IsAverageQEBlindPixelAvailable() const
796{
797 return TESTBIT(fAvailableFlags,kAverageQEBlindPixelAvailable);
798}
799
800// ------------------------------------------------------------------------------
801//
802// Test if the average QE can be obtained from the combination of the three methods
803//
804Bool_t MCalibrationQEPix::IsAverageQECombinedAvailable() const
805{
806 return TESTBIT(fAvailableFlags,kAverageQECombinedAvailable);
807}
808
809// ------------------------------------------------------------------------------
810//
811// Test if the average QE can be obtained from the F-Factor method
812//
813Bool_t MCalibrationQEPix::IsAverageQEFFactorAvailable() const
814{
815 return TESTBIT(fAvailableFlags,kAverageQEFFactorAvailable);
816}
817
818// ------------------------------------------------------------------------------
819//
820// Test if the average QE can be obtained from the PIN Diode method
821//
822Bool_t MCalibrationQEPix::IsAverageQEPINDiodeAvailable() const
823{
824 return TESTBIT(fAvailableFlags,kAverageQEPINDiodeAvailable);
825}
826
827// ------------------------------------------------------------------------------
828//
829// Test if any of the three colours has already been calibrated with the blind pixel method
830//
831Bool_t MCalibrationQEPix::IsBlindPixelMethodValid () const
832{
833
834 if (IsBlindPixelMethodValid (MCalibrationCam::kGREEN))
835 return kTRUE;
836 if (IsBlindPixelMethodValid (MCalibrationCam::kBLUE ))
837 return kTRUE;
838 if (IsBlindPixelMethodValid (MCalibrationCam::kUV ))
839 return kTRUE;
840 if (IsBlindPixelMethodValid (MCalibrationCam::kCT1 ))
841 return kTRUE;
842
843 return kFALSE;
844}
845
846// ------------------------------------------------------------------------------
847//
848// Test if any of the three colours has already been calibrated with the combination
849// of the three methods
850//
851Bool_t MCalibrationQEPix::IsCombinedMethodValid () const
852{
853 if (IsCombinedMethodValid (MCalibrationCam::kGREEN))
854 return kTRUE;
855 if (IsCombinedMethodValid (MCalibrationCam::kBLUE ))
856 return kTRUE;
857 if (IsCombinedMethodValid (MCalibrationCam::kUV ))
858 return kTRUE;
859 if (IsCombinedMethodValid (MCalibrationCam::kCT1 ))
860 return kTRUE;
861
862 return kFALSE;
863}
864
865// ------------------------------------------------------------------------------
866//
867// Test if any of the three colours has already been calibrated with the F-Factor method
868//
869Bool_t MCalibrationQEPix::IsFFactorMethodValid () const
870{
871 if (IsFFactorMethodValid (MCalibrationCam::kGREEN))
872 return kTRUE;
873 if (IsFFactorMethodValid (MCalibrationCam::kBLUE ))
874 return kTRUE;
875 if (IsFFactorMethodValid (MCalibrationCam::kUV ))
876 return kTRUE;
877 if (IsFFactorMethodValid (MCalibrationCam::kCT1 ))
878 return kTRUE;
879
880 return kFALSE;
881}
882
883
884// ------------------------------------------------------------------------------
885//
886// Test if any of the three colours has already been calibrated with the PIN Diode method
887//
888Bool_t MCalibrationQEPix::IsPINDiodeMethodValid () const
889{
890 if (IsPINDiodeMethodValid (MCalibrationCam::kGREEN))
891 return kTRUE;
892 if (IsPINDiodeMethodValid (MCalibrationCam::kBLUE ))
893 return kTRUE;
894 if (IsPINDiodeMethodValid (MCalibrationCam::kUV ))
895 return kTRUE;
896 if (IsPINDiodeMethodValid (MCalibrationCam::kCT1 ))
897 return kTRUE;
898
899 return kFALSE;
900}
901
902// ------------------------------------------------------------------------------
903//
904// Test if the colour "col" has already been calibrated with the Blind Pixel method
905//
906Bool_t MCalibrationQEPix::IsBlindPixelMethodValid (MCalibrationCam::PulserColor_t col) const
907{
908 return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
909}
910
911// ------------------------------------------------------------------------------
912//
913// Test if the colour "col" has already been calibrated with the combination of
914// the three methods
915//
916Bool_t MCalibrationQEPix::IsCombinedMethodValid (MCalibrationCam::PulserColor_t col) const
917{
918 return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
919}
920
921// ------------------------------------------------------------------------------
922//
923// Test if the colour "col" has already been calibrated with the F-Factor method
924//
925Bool_t MCalibrationQEPix::IsFFactorMethodValid (MCalibrationCam::PulserColor_t col) const
926{
927 return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
928}
929
930// ------------------------------------------------------------------------------
931//
932// Test if the colour "col" has already been calibrated with the PIN Diode method
933//
934Bool_t MCalibrationQEPix::IsPINDiodeMethodValid (MCalibrationCam::PulserColor_t col) const
935{
936 return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
937}
938
939// ------------------------------------------------------------------------------
940//
941// Set the bit Average QE Blind Pixel method available from outside (only for MC!)
942//
943void MCalibrationQEPix::SetAverageQEBlindPixelAvailable ( Bool_t b )
944{
945 if (b)
946 SETBIT(fAvailableFlags,kAverageQEBlindPixelAvailable);
947 else
948 CLRBIT(fAvailableFlags,kAverageQEBlindPixelAvailable);
949}
950
951// ------------------------------------------------------------------------------
952//
953// Set the bit Average QE combination of three methods available from outside (only for MC!)
954//
955void MCalibrationQEPix::SetAverageQECombinedAvailable ( Bool_t b )
956{
957 if (b)
958 SETBIT(fAvailableFlags,kAverageQECombinedAvailable);
959 else
960 CLRBIT(fAvailableFlags,kAverageQECombinedAvailable);
961}
962
963// ------------------------------------------------------------------------------
964//
965// Set the bit Average QE F-Factor method available from outside (only for MC!)
966//
967void MCalibrationQEPix::SetAverageQEFFactorAvailable ( Bool_t b )
968{
969 if (b)
970 SETBIT(fAvailableFlags,kAverageQEFFactorAvailable);
971 else
972 CLRBIT(fAvailableFlags,kAverageQEFFactorAvailable);
973}
974
975// ------------------------------------------------------------------------------
976//
977// Set the bit Average QE PIN Diode method available from outside (only for MC!)
978//
979void MCalibrationQEPix::SetAverageQEPINDiodeAvailable ( Bool_t b )
980{
981 if (b)
982 SETBIT(fAvailableFlags,kAverageQEPINDiodeAvailable);
983 else
984 CLRBIT(fAvailableFlags,kAverageQEPINDiodeAvailable);
985}
986
987// ------------------------------------------------------------------------------
988//
989// Set the bit QE Blind Pixel method available from colour "col"
990//
991void MCalibrationQEPix::SetBlindPixelMethodValid ( Bool_t b, MCalibrationCam::PulserColor_t col )
992{
993 if (b)
994 SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
995 else
996 CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
997}
998
999// ------------------------------------------------------------------------------
1000//
1001// Set the bit QE Combination of three methods available from colour "col"
1002//
1003void MCalibrationQEPix::SetCombinedMethodValid ( Bool_t b, MCalibrationCam::PulserColor_t col )
1004{
1005 if (b)
1006 SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
1007 else
1008 CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
1009}
1010
1011// ------------------------------------------------------------------------------
1012//
1013// Set the bit QE F-Factor method available from colour "col"
1014//
1015void MCalibrationQEPix::SetFFactorMethodValid ( Bool_t b, MCalibrationCam::PulserColor_t col )
1016{
1017 if (b)
1018 SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
1019 else
1020 CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
1021}
1022
1023// ------------------------------------------------------------------------------
1024//
1025// Set the bit QE PIN Diode method available from colour "col"
1026//
1027void MCalibrationQEPix::SetPINDiodeMethodValid ( Bool_t b, MCalibrationCam::PulserColor_t col )
1028{
1029 if (b)
1030 SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
1031 else
1032 CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
1033}
1034
1035// ------------------------------------------------------------------------------
1036//
1037// Update the Blind Pixel Method: Calculate new average QE's
1038//
1039Bool_t MCalibrationQEPix::UpdateBlindPixelMethod()
1040{
1041
1042 Float_t weightedav = 0.;
1043 Float_t sumweights = 0.;
1044
1045 AddAverageBlindPixelQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
1046 AddAverageBlindPixelQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
1047 AddAverageBlindPixelQEs(MCalibrationCam::kUV , weightedav, sumweights);
1048 AddAverageBlindPixelQEs(MCalibrationCam::kCT1 , weightedav, sumweights);
1049
1050 if (weightedav == 0. || sumweights == 0.)
1051 return kFALSE;
1052
1053 weightedav /= sumweights;
1054
1055 fAvNormBlindPixel = gkDefaultAverageQE * weightedav;
1056 fAvNormBlindPixelVar = GetAverageQERelVar() + (sumweights / weightedav / weightedav );
1057 fAvNormBlindPixelVar *= fAvNormBlindPixel * fAvNormBlindPixel;
1058
1059 return kTRUE;
1060}
1061
1062// ------------------------------------------------------------------------------
1063//
1064// Update the Combination of the three Methods: Calculate new average QE's
1065//
1066Bool_t MCalibrationQEPix::UpdateCombinedMethod()
1067{
1068
1069 Float_t weightedav = 0.;
1070 Float_t sumweights = 0.;
1071
1072 AddAverageCombinedQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
1073 AddAverageCombinedQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
1074 AddAverageCombinedQEs(MCalibrationCam::kUV , weightedav, sumweights);
1075 AddAverageCombinedQEs(MCalibrationCam::kCT1 , weightedav, sumweights);
1076
1077 if (weightedav == 0. || sumweights == 0.)
1078 return kFALSE;
1079
1080 weightedav /= sumweights;
1081
1082 fAvNormCombined = gkDefaultAverageQE * weightedav;
1083 fAvNormCombinedVar = GetAverageQERelVar() + (sumweights / weightedav / weightedav );
1084 fAvNormCombinedVar *= fAvNormCombined * fAvNormCombined;
1085
1086 return kTRUE;
1087
1088}
1089
1090// ------------------------------------------------------------------------------
1091//
1092// Update the F-Factor Method: Calculate new average QE's
1093//
1094Bool_t MCalibrationQEPix::UpdateFFactorMethod()
1095{
1096
1097 Float_t weightedav = 0.;
1098 Float_t sumweights = 0.;
1099
1100 AddAverageFFactorQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
1101 AddAverageFFactorQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
1102 AddAverageFFactorQEs(MCalibrationCam::kUV , weightedav, sumweights);
1103 AddAverageFFactorQEs(MCalibrationCam::kCT1 , weightedav, sumweights);
1104
1105 if (weightedav == 0. || sumweights == 0.)
1106 return kFALSE;
1107
1108 fAvNormFFactor = weightedav / sumweights;
1109 fAvNormFFactorVar = 1./ sumweights ;
1110
1111 return kTRUE;
1112
1113
1114}
1115
1116// ------------------------------------------------------------------------------
1117//
1118// Update the PIN Diode Method: Calculate new average QE's
1119//
1120Bool_t MCalibrationQEPix::UpdatePINDiodeMethod()
1121{
1122
1123 Float_t weightedav = 0.;
1124 Float_t sumweights = 0.;
1125
1126 AddAveragePINDiodeQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
1127 AddAveragePINDiodeQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
1128 AddAveragePINDiodeQEs(MCalibrationCam::kUV , weightedav, sumweights);
1129 AddAveragePINDiodeQEs(MCalibrationCam::kCT1 , weightedav, sumweights);
1130
1131 if (weightedav == 0. || sumweights == 0.)
1132 return kFALSE;
1133
1134 weightedav /= sumweights;
1135
1136 fAvNormPINDiode = gkDefaultAverageQE * weightedav;
1137 fAvNormPINDiodeVar = GetAverageQERelVar() + (sumweights / weightedav / weightedav );
1138 fAvNormPINDiodeVar *= fAvNormPINDiode * fAvNormPINDiode;
1139
1140 return kTRUE;
1141
1142
1143}
1144
Note: See TracBrowser for help on using the repository browser.