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

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