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

Last change on this file since 3764 was 3759, checked in by gaug, 21 years ago
*** empty log message ***
File size: 42.3 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//
233// Search all available QE's of a certain colour after the F-Factor method,
234// compare them to the default QE of that colour and
235// add up a weighted average (wav) and a sum of weights (sumw)
236//
237// FIXME: This has to be replaced by a decent fit the QE-spectrum!
238//
239void MCalibrationQEPix::AddAverageFFactorQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
240{
241
242 if (IsFFactorMethodValid (col))
243 {
244 const Float_t newavqe = GetQEFFactor(col) / GetDefaultQE (col) ;
245 const Float_t newavqevar = ( GetQEFFactorRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
246 wav += newavqe / newavqevar;
247 sumw += 1./ newavqevar;
248
249 }
250
251
252}
253
254// ----------------------------------------------------------------------------------------------
255//
256// Search all available QE's of a certain colour after the PIN Diode method,
257// compare them to the default QE of that colour and
258// add up a weighted average (wav) and a sum of weights (sumw)
259//
260// FIXME: This has to be replaced by a decent fit the QE-spectrum!
261//
262void MCalibrationQEPix::AddAveragePINDiodeQEs(const MCalibrationCam::PulserColor_t col, Float_t &wav, Float_t &sumw )
263{
264
265 if (IsPINDiodeMethodValid (col))
266 {
267 const Float_t newavqe = GetQEPINDiode(col) / GetDefaultQE (col) ;
268 const Float_t newavqevar = ( GetQEPINDiodeRelVar(col) + GetDefaultQERelVar(col) ) * newavqe * newavqe;
269 wav += newavqe / newavqevar;
270 sumw += 1./ newavqevar;
271 }
272}
273
274
275
276// ------------------------------------------------------------------------
277//
278// Sets all quantum efficiencies to the gkDefaultQE*
279// Sets all Variances to the square root of gkDefaultQE*Err
280// Sets all flags to kFALSE
281// Sets all fAvNorm-Variables to 1.;
282// Sets all fAvNorm-Variances to 0.;
283//
284// Calls:
285// - MCalibrationPix::Clear()
286//
287void MCalibrationQEPix::Clear(Option_t *o)
288{
289
290 SetAverageQEBlindPixelAvailable ( kFALSE );
291 SetAverageQEFFactorAvailable ( kFALSE );
292 SetAverageQECombinedAvailable ( kFALSE );
293 SetAverageQEPINDiodeAvailable ( kFALSE );
294
295 fQEBlindPixel [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;
296 fQEBlindPixelVar [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
297 fQEFFactor [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;
298 fQEFFactorVar [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
299 fQECombined [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;
300 fQECombinedVar [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
301 fQEPINDiode [ MCalibrationCam::kGREEN ] = gkDefaultQEGreen;
302 fQEPINDiodeVar [ MCalibrationCam::kGREEN ] = gkDefaultQEGreenErr*gkDefaultQEGreenErr;
303
304 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kGREEN);
305 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kGREEN);
306 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kGREEN);
307 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kGREEN);
308
309 fQEBlindPixel [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;
310 fQEBlindPixelVar [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
311 fQEFFactor [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;
312 fQEFFactorVar [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
313 fQECombined [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;
314 fQECombinedVar [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
315 fQEPINDiode [ MCalibrationCam::kBLUE ] = gkDefaultQEBlue;
316 fQEPINDiodeVar [ MCalibrationCam::kBLUE ] = gkDefaultQEBlueErr*gkDefaultQEBlueErr;
317
318 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kBLUE);
319 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kBLUE);
320 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kBLUE);
321 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kBLUE);
322
323 fQEBlindPixel [ MCalibrationCam::kUV ] = gkDefaultQEUV;
324 fQEBlindPixelVar [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
325 fQEFFactor [ MCalibrationCam::kUV ] = gkDefaultQEUV;
326 fQEFFactorVar [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
327 fQECombined [ MCalibrationCam::kUV ] = gkDefaultQEUV;
328 fQECombinedVar [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
329 fQEPINDiode [ MCalibrationCam::kUV ] = gkDefaultQEUV;
330 fQEPINDiodeVar [ MCalibrationCam::kUV ] = gkDefaultQEUVErr*gkDefaultQEUVErr;
331
332 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kUV);
333 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kUV);
334 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kUV);
335 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kUV);
336
337 fQEBlindPixel [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;
338 fQEBlindPixelVar [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
339 fQEFFactor [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;
340 fQEFFactorVar [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
341 fQECombined [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;
342 fQECombinedVar [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
343 fQEPINDiode [ MCalibrationCam::kCT1 ] = gkDefaultQECT1;
344 fQEPINDiodeVar [ MCalibrationCam::kCT1 ] = gkDefaultQECT1Err*gkDefaultQECT1Err;
345
346 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kCT1);
347 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kCT1);
348 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kCT1);
349 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kCT1);
350
351 fAvNormBlindPixel = 1.;
352 fAvNormBlindPixelVar = 0.;
353 fAvNormCombined = 1.;
354 fAvNormCombinedVar = 0.;
355 fAvNormFFactor = 1.;
356 fAvNormFFactorVar = 0.;
357 fAvNormPINDiode = 1.;
358 fAvNormPINDiodeVar = 0.;
359
360 MCalibrationPix::Clear();
361}
362
363
364// -----------------------------------------------------------------
365//
366// Return the average Default QE (depending on zenith angle)
367//
368const Float_t MCalibrationQEPix::GetAverageQE( const Float_t zenith ) const
369{
370 return gkDefaultAverageQE ;
371}
372
373// -----------------------------------------------------------------
374//
375// Return the relative variance of the average Default QE (depending on zenith angle)
376//
377const Float_t MCalibrationQEPix::GetAverageQERelVar( const Float_t zenith ) const
378{
379 return gkDefaultAverageQEErr * gkDefaultAverageQEErr / (gkDefaultAverageQE * gkDefaultAverageQE );
380}
381
382// -----------------------------------------------------------------
383//
384// Return the relative variance of the average normalization (Blind Pixel Method)
385//
386const Float_t MCalibrationQEPix::GetAvNormBlindPixelRelVar( ) const
387{
388 return fAvNormBlindPixelVar / (fAvNormBlindPixel * fAvNormBlindPixel );
389}
390
391// -----------------------------------------------------------------
392//
393// Return the relative variance of the average normalization (Combined Method)
394//
395const Float_t MCalibrationQEPix::GetAvNormCombinedRelVar( ) const
396{
397 return fAvNormCombinedVar / (fAvNormCombined * fAvNormCombined );
398}
399
400// -----------------------------------------------------------------
401//
402// Return the relative variance of the average normalization (F-Factor Method)
403//
404const Float_t MCalibrationQEPix::GetAvNormFFactorRelVar( ) const
405{
406 return fAvNormFFactorVar / (fAvNormFFactor * fAvNormFFactor );
407}
408
409// -----------------------------------------------------------------
410//
411// Return the relative variance of the average normalization (PIN Diode Method)
412//
413const Float_t MCalibrationQEPix::GetAvNormPINDiodeRelVar( ) const
414{
415 return fAvNormPINDiodeVar / (fAvNormPINDiode * fAvNormPINDiode );
416}
417
418// ------------------------------------------------------------------------------
419//
420// Get the default Quantum efficiency for pulser colour "col"
421//
422Float_t MCalibrationQEPix::GetDefaultQE( const MCalibrationCam::PulserColor_t col ) const
423{
424 switch (col)
425 {
426 case MCalibrationCam::kGREEN:
427 return gkDefaultQEGreen;
428 break;
429 case MCalibrationCam::kBLUE:
430 return gkDefaultQEBlue;
431 break;
432 case MCalibrationCam::kUV:
433 return gkDefaultQEUV;
434 break;
435 case MCalibrationCam::kCT1:
436 return gkDefaultQECT1;
437 break;
438 default:
439 return gkDefaultQECT1;
440 break;
441 }
442 return -1.;
443}
444
445// ------------------------------------------------------------------------------
446//
447// Get the relative variance of the default Quantum efficiency for pulser colour "col"
448//
449Float_t MCalibrationQEPix::GetDefaultQERelVar( const MCalibrationCam::PulserColor_t col ) const
450{
451 switch (col)
452 {
453 case MCalibrationCam::kGREEN:
454 return gkDefaultQEGreenErr * gkDefaultQEGreenErr / (gkDefaultQEGreen * gkDefaultQEGreen );
455 break;
456 case MCalibrationCam::kBLUE:
457 return gkDefaultQEBlueErr * gkDefaultQEBlueErr / (gkDefaultQEBlue * gkDefaultQEBlue );
458 break;
459 case MCalibrationCam::kUV:
460 return gkDefaultQEUVErr * gkDefaultQEUVErr / (gkDefaultQEUV * gkDefaultQEUV );
461 break;
462 case MCalibrationCam::kCT1:
463 return gkDefaultQECT1Err * gkDefaultQECT1Err / (gkDefaultQECT1 * gkDefaultQECT1 );
464 break;
465 default:
466 return gkDefaultQECT1Err * gkDefaultQECT1Err / (gkDefaultQECT1 * gkDefaultQECT1 );
467 break;
468 }
469 return -1.;
470}
471
472// ------------------------------------------------------------------------------
473//
474// Get the calculated Quantum efficiency with the blind pixel method,
475// obtained with pulser colour "col"
476//
477Float_t MCalibrationQEPix::GetQEBlindPixel( const MCalibrationCam::PulserColor_t col ) const
478{
479 return fQEBlindPixel[col];
480}
481
482// ------------------------------------------------------------------------------
483//
484// Get the error on the calculated Quantum efficiency with the blind pixel method,
485// obtained with pulser colour "col"
486// Tests for variances smaller than 0. (e.g. if it has not yet been set)
487// and returns -1. in that case
488//
489Float_t MCalibrationQEPix::GetQEBlindPixelErr( const MCalibrationCam::PulserColor_t col ) const
490{
491
492 if (fQEBlindPixelVar[col] < 0.)
493 return -1.;
494
495 return TMath::Sqrt(fQEBlindPixelVar[col]);
496
497}
498
499// ------------------------------------------------------------------------------
500//
501// Get the relative variance of the calculated Quantum efficiency with the blind pixel method,
502// obtained with pulser colour "col"
503// Tests for variances smaller than 0. (e.g. if it has not yet been set)
504// and returns -1. in that case
505// Tests for quantum efficiency equal to 0. and returns -1. in that case
506//
507Float_t MCalibrationQEPix::GetQEBlindPixelRelVar( const MCalibrationCam::PulserColor_t col ) const
508{
509
510 if (fQEBlindPixelVar[col] < 0.)
511 return -1.;
512 if (fQEBlindPixel[col] < 0.)
513 return -1.;
514 return fQEBlindPixelVar[col] / ( fQEBlindPixel[col] * fQEBlindPixel[col] );
515
516}
517
518// ------------------------------------------------------------------------------
519//
520// Get the calculated Quantum efficiency with the combination of the three methods
521// obtained with pulser colour "col"
522//
523Float_t MCalibrationQEPix::GetQECombined( const MCalibrationCam::PulserColor_t col ) const
524{
525 return fQECombined[col];
526}
527
528
529// ------------------------------------------------------------------------------
530//
531// Get the error on the calculated Quantum efficiency with the combination of the three methods
532// obtained with pulser colour "col"
533// Tests for variances smaller than 0. (e.g. if it has not yet been set)
534// and returns -1. in that case
535//
536Float_t MCalibrationQEPix::GetQECombinedErr( const MCalibrationCam::PulserColor_t col ) const
537{
538
539 if (fQECombinedVar[col] < 0.)
540 return -1.;
541
542 return TMath::Sqrt(fQECombinedVar[col]);
543
544}
545
546
547// ----------------------------------------------------------------------------------------
548//
549// Get the relative variance of the calculated Quantum efficiency with the combination of
550// the three methods,
551// obtained with pulser colour "col"
552// Tests for variances smaller than 0. (e.g. if it has not yet been set)
553// and returns -1. in that case
554// Tests for quantum efficiency equal to 0. and returns -1. in that case
555//
556Float_t MCalibrationQEPix::GetQECombinedRelVar( const MCalibrationCam::PulserColor_t col ) const
557{
558
559 if (fQECombinedVar[col] < 0.)
560 return -1.;
561 if (fQECombined[col] < 0.)
562 return -1.;
563 return fQECombinedVar[col] / ( fQECombined[col] * fQECombined[col] );
564
565}
566
567// ------------------------------------------------------------------------------
568//
569// Get the calculated Quantum efficiency with the F-Factor method
570// obtained with pulser colour "col"
571//
572Float_t MCalibrationQEPix::GetQEFFactor( const MCalibrationCam::PulserColor_t col ) const
573{
574 return fQEFFactor[col];
575}
576
577
578// ------------------------------------------------------------------------------
579//
580// Get the error on the calculated Quantum efficiency with the F-Factor method,
581// obtained with pulser colour "col"
582// Tests for variances smaller than 0. (e.g. if it has not yet been set)
583// and returns -1. in that case
584//
585Float_t MCalibrationQEPix::GetQEFFactorErr( const MCalibrationCam::PulserColor_t col ) const
586{
587
588 if (fQEFFactorVar[col] < 0.)
589 return -1.;
590
591 return TMath::Sqrt(fQEFFactorVar[col]);
592
593}
594
595
596// ----------------------------------------------------------------------------------------
597//
598// Get the relative variance of the calculated Quantum efficiency with the F-Factor method,
599// obtained with pulser colour "col"
600// Tests for variances smaller than 0. (e.g. if it has not yet been set)
601// and returns -1. in that case
602// Tests for quantum efficiency equal to 0. and returns -1. in that case
603//
604Float_t MCalibrationQEPix::GetQEFFactorRelVar( const MCalibrationCam::PulserColor_t col ) const
605{
606
607 if (fQEFFactorVar[col] < 0.)
608 return -1.;
609 if (fQEFFactor[col] < 0.)
610 return -1.;
611 return fQEFFactorVar[col] / ( fQEFFactor[col] * fQEFFactor[col] );
612
613}
614
615// ------------------------------------------------------------------------------
616//
617// Get the calculated Quantum efficiency with the PIN-Diode method
618// obtained with pulser colour "col"
619//
620Float_t MCalibrationQEPix::GetQEPINDiode( const MCalibrationCam::PulserColor_t col ) const
621{
622 return fQEPINDiode[col];
623}
624
625
626// ------------------------------------------------------------------------------
627//
628// Get the error on the calculated Quantum efficiency with the PIN Diode method,
629// obtained with pulser colour "col"
630// Tests for variances smaller than 0. (e.g. if it has not yet been set)
631// and returns -1. in that case
632//
633Float_t MCalibrationQEPix::GetQEPINDiodeErr( const MCalibrationCam::PulserColor_t col ) const
634{
635
636 if (fQEPINDiodeVar[col] < 0.)
637 return -1.;
638
639 return TMath::Sqrt(fQEPINDiodeVar[col]);
640
641}
642
643// ----------------------------------------------------------------------------------------
644//
645// Get the relative variance of the calculated Quantum efficiency with the PIN Diode method,
646// obtained with pulser colour "col"
647// Tests for variances smaller than 0. (e.g. if it has not yet been set)
648// and returns -1. in that case
649// Tests for quantum efficiency equal to 0. and returns -1. in that case
650//
651Float_t MCalibrationQEPix::GetQEPINDiodeRelVar( const MCalibrationCam::PulserColor_t col ) const
652{
653
654 if (fQEPINDiodeVar[col] < 0.)
655 return -1.;
656 if (fQEPINDiode[col] < 0.)
657 return -1.;
658 return fQEPINDiodeVar[col] / ( fQEPINDiode[col] * fQEPINDiode[col] );
659
660}
661
662// ------------------------------------------------------------------------------
663//
664// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained
665// with the blind pixel method and averaged over the results from the different colours.
666//
667Float_t MCalibrationQEPix::GetQECascadesBlindPixel( const Float_t zenith ) const
668{
669 return fAvNormBlindPixel * GetAverageQE ( zenith );
670}
671
672// ------------------------------------------------------------------------------
673//
674// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum,
675// obtained with the blind pixel method and averaged over the results from the
676// different colours.
677//
678Float_t MCalibrationQEPix::GetQECascadesBlindPixelVar( const Float_t zenith ) const
679{
680 return ( GetAvNormBlindPixelRelVar() + GetAverageQERelVar(zenith))
681 * GetQECascadesBlindPixel(zenith) * GetQECascadesBlindPixel(zenith);
682}
683
684// ------------------------------------------------------------------------------
685//
686// Get the error on the averaged Quantum efficiency folded over the cascade spectrum,
687// obtained with the blind pixel method and averaged over the results from the
688// different colours.
689//
690Float_t MCalibrationQEPix::GetQECascadesBlindPixelErr( const Float_t zenith ) const
691{
692 const Float_t var = GetQECascadesBlindPixelVar(zenith);
693
694 if (var < 0.)
695 return -1.;
696
697 return TMath::Sqrt(var);
698}
699
700// ------------------------------------------------------------------------------
701//
702// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained
703// with the combination of the three methods and averaged over the results
704// from the different colours.
705//
706Float_t MCalibrationQEPix::GetQECascadesCombined( const Float_t zenith ) const
707{
708 return fAvNormCombined * GetAverageQE ( zenith );
709}
710
711// ------------------------------------------------------------------------------
712//
713// Get the error on the averaged Quantum efficiency folded over the cascade spectrum,
714// obtained with the combined method and averaged over the results from the
715// different colours.
716//
717Float_t MCalibrationQEPix::GetQECascadesCombinedErr( const Float_t zenith ) const
718{
719 const Float_t var = GetQECascadesCombinedVar(zenith);
720
721 if (var < 0.)
722 return -1.;
723
724 return TMath::Sqrt(var);
725}
726
727// ------------------------------------------------------------------------------
728//
729// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum,
730// obtained with the combination of the three methods and averaged over the results from the
731// different colours.
732//
733Float_t MCalibrationQEPix::GetQECascadesCombinedVar( const Float_t zenith ) const
734{
735 return ( GetAvNormCombinedRelVar() + GetAverageQERelVar(zenith))
736 * GetQECascadesCombined(zenith) * GetQECascadesCombined(zenith);
737}
738
739// ------------------------------------------------------------------------------
740//
741// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained
742// with the F-Factor method and averaged over the results from the different colours.
743//
744Float_t MCalibrationQEPix::GetQECascadesFFactor( const Float_t zenith ) const
745{
746 return fAvNormFFactor * GetAverageQE ( zenith );
747}
748
749// ------------------------------------------------------------------------------
750//
751// Get the error on the averaged Quantum efficiency folded over the cascade spectrum,
752// obtained with the F-Factor method and averaged over the results from the
753// different colours.
754//
755Float_t MCalibrationQEPix::GetQECascadesFFactorErr( const Float_t zenith ) const
756{
757 const Float_t var = GetQECascadesFFactorVar(zenith);
758
759 if (var < 0.)
760 return -1.;
761
762 return TMath::Sqrt(var);
763}
764
765// ------------------------------------------------------------------------------
766//
767// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum,
768// obtained with the F-Factor method and averaged over the results from the
769// different colours.
770//
771Float_t MCalibrationQEPix::GetQECascadesFFactorVar( const Float_t zenith ) const
772{
773 return ( GetAvNormFFactorRelVar() + GetAverageQERelVar(zenith))
774 * GetQECascadesFFactor(zenith) * GetQECascadesFFactor(zenith);
775}
776
777// ------------------------------------------------------------------------------
778//
779// Get the averaged Quantum efficiency folded over the cascade spectrum, obtained
780// with the PIN Diode method and averaged over the results from the different colours.
781//
782Float_t MCalibrationQEPix::GetQECascadesPINDiode( const Float_t zenith ) const
783{
784 return fAvNormPINDiode * GetAverageQE ( zenith );
785}
786
787// ------------------------------------------------------------------------------
788//
789// Get the error on the averaged Quantum efficiency folded over the cascade spectrum,
790// obtained with the PIN Diode method and averaged over the results from the
791// different colours.
792//
793Float_t MCalibrationQEPix::GetQECascadesPINDiodeErr( const Float_t zenith ) const
794{
795 const Float_t var = GetQECascadesPINDiodeVar(zenith);
796
797 if (var < 0.)
798 return -1.;
799
800 return TMath::Sqrt(var);
801}
802
803// ------------------------------------------------------------------------------
804//
805// Get the variance of the averaged Quantum efficiency folded over the cascade spectrum,
806// obtained with the PIN Diode method and averaged over the results from the
807// different colours.
808//
809Float_t MCalibrationQEPix::GetQECascadesPINDiodeVar( const Float_t zenith ) const
810{
811 return ( GetAvNormPINDiodeRelVar() + GetAverageQERelVar(zenith))
812 * GetQECascadesPINDiode(zenith) * GetQECascadesPINDiode(zenith);
813}
814
815// ------------------------------------------------------------------------------
816//
817// Test if the average QE can be obtained from the blind pixel method
818//
819Bool_t MCalibrationQEPix::IsAverageQEBlindPixelAvailable() const
820{
821 return TESTBIT(fAvailableFlags,kAverageQEBlindPixelAvailable);
822}
823
824// ------------------------------------------------------------------------------
825//
826// Test if the average QE can be obtained from the combination of the three methods
827//
828Bool_t MCalibrationQEPix::IsAverageQECombinedAvailable() const
829{
830 return TESTBIT(fAvailableFlags,kAverageQECombinedAvailable);
831}
832
833// ------------------------------------------------------------------------------
834//
835// Test if the average QE can be obtained from the F-Factor method
836//
837Bool_t MCalibrationQEPix::IsAverageQEFFactorAvailable() const
838{
839 return TESTBIT(fAvailableFlags,kAverageQEFFactorAvailable);
840}
841
842// ------------------------------------------------------------------------------
843//
844// Test if the average QE can be obtained from the PIN Diode method
845//
846Bool_t MCalibrationQEPix::IsAverageQEPINDiodeAvailable() const
847{
848 return TESTBIT(fAvailableFlags,kAverageQEPINDiodeAvailable);
849}
850
851// ------------------------------------------------------------------------------
852//
853// Test if any of the three colours has already been calibrated with the blind pixel method
854//
855Bool_t MCalibrationQEPix::IsBlindPixelMethodValid () const
856{
857
858 if (IsBlindPixelMethodValid (MCalibrationCam::kGREEN))
859 return kTRUE;
860 if (IsBlindPixelMethodValid (MCalibrationCam::kBLUE ))
861 return kTRUE;
862 if (IsBlindPixelMethodValid (MCalibrationCam::kUV ))
863 return kTRUE;
864 if (IsBlindPixelMethodValid (MCalibrationCam::kCT1 ))
865 return kTRUE;
866
867 return kFALSE;
868}
869
870// ------------------------------------------------------------------------------
871//
872// Test if any of the three colours has already been calibrated with the combination
873// of the three methods
874//
875Bool_t MCalibrationQEPix::IsCombinedMethodValid () const
876{
877 if (IsCombinedMethodValid (MCalibrationCam::kGREEN))
878 return kTRUE;
879 if (IsCombinedMethodValid (MCalibrationCam::kBLUE ))
880 return kTRUE;
881 if (IsCombinedMethodValid (MCalibrationCam::kUV ))
882 return kTRUE;
883 if (IsCombinedMethodValid (MCalibrationCam::kCT1 ))
884 return kTRUE;
885
886 return kFALSE;
887}
888
889// ------------------------------------------------------------------------------
890//
891// Test if any of the three colours has already been calibrated with the F-Factor method
892//
893Bool_t MCalibrationQEPix::IsFFactorMethodValid () const
894{
895 if (IsFFactorMethodValid (MCalibrationCam::kGREEN))
896 return kTRUE;
897 if (IsFFactorMethodValid (MCalibrationCam::kBLUE ))
898 return kTRUE;
899 if (IsFFactorMethodValid (MCalibrationCam::kUV ))
900 return kTRUE;
901 if (IsFFactorMethodValid (MCalibrationCam::kCT1 ))
902 return kTRUE;
903
904 return kFALSE;
905}
906
907
908// ------------------------------------------------------------------------------
909//
910// Test if any of the three colours has already been calibrated with the PIN Diode method
911//
912Bool_t MCalibrationQEPix::IsPINDiodeMethodValid () const
913{
914 if (IsPINDiodeMethodValid (MCalibrationCam::kGREEN))
915 return kTRUE;
916 if (IsPINDiodeMethodValid (MCalibrationCam::kBLUE ))
917 return kTRUE;
918 if (IsPINDiodeMethodValid (MCalibrationCam::kUV ))
919 return kTRUE;
920 if (IsPINDiodeMethodValid (MCalibrationCam::kCT1 ))
921 return kTRUE;
922
923 return kFALSE;
924}
925
926// ------------------------------------------------------------------------------
927//
928// Test if the colour "col" has already been calibrated with the Blind Pixel method
929//
930Bool_t MCalibrationQEPix::IsBlindPixelMethodValid (MCalibrationCam::PulserColor_t col) const
931{
932 return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
933}
934
935// ------------------------------------------------------------------------------
936//
937// Test if the colour "col" has already been calibrated with the combination of
938// the three methods
939//
940Bool_t MCalibrationQEPix::IsCombinedMethodValid (MCalibrationCam::PulserColor_t col) const
941{
942 return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
943}
944
945// ------------------------------------------------------------------------------
946//
947// Test if the colour "col" has already been calibrated with the F-Factor method
948//
949Bool_t MCalibrationQEPix::IsFFactorMethodValid (MCalibrationCam::PulserColor_t col) const
950{
951 return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
952}
953
954// ------------------------------------------------------------------------------
955//
956// Test if the colour "col" has already been calibrated with the PIN Diode method
957//
958Bool_t MCalibrationQEPix::IsPINDiodeMethodValid (MCalibrationCam::PulserColor_t col) const
959{
960 return TESTBIT(fValidFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
961}
962
963// ------------------------------------------------------------------------------
964//
965// Set the bit Average QE Blind Pixel method available from outside (only for MC!)
966//
967void MCalibrationQEPix::SetAverageQEBlindPixelAvailable ( Bool_t b )
968{
969 if (b)
970 SETBIT(fAvailableFlags,kAverageQEBlindPixelAvailable);
971 else
972 CLRBIT(fAvailableFlags,kAverageQEBlindPixelAvailable);
973}
974
975// ------------------------------------------------------------------------------
976//
977// Set the bit Average QE combination of three methods available from outside (only for MC!)
978//
979void MCalibrationQEPix::SetAverageQECombinedAvailable ( Bool_t b )
980{
981 if (b)
982 SETBIT(fAvailableFlags,kAverageQECombinedAvailable);
983 else
984 CLRBIT(fAvailableFlags,kAverageQECombinedAvailable);
985}
986
987// ------------------------------------------------------------------------------
988//
989// Set the bit Average QE F-Factor method available from outside (only for MC!)
990//
991void MCalibrationQEPix::SetAverageQEFFactorAvailable ( Bool_t b )
992{
993 if (b)
994 SETBIT(fAvailableFlags,kAverageQEFFactorAvailable);
995 else
996 CLRBIT(fAvailableFlags,kAverageQEFFactorAvailable);
997}
998
999// ------------------------------------------------------------------------------
1000//
1001// Set the bit Average QE PIN Diode method available from outside (only for MC!)
1002//
1003void MCalibrationQEPix::SetAverageQEPINDiodeAvailable ( Bool_t b )
1004{
1005 if (b)
1006 SETBIT(fAvailableFlags,kAverageQEPINDiodeAvailable);
1007 else
1008 CLRBIT(fAvailableFlags,kAverageQEPINDiodeAvailable);
1009}
1010
1011// ------------------------------------------------------------------------------
1012//
1013// Set the bit QE Blind Pixel method available from colour "col"
1014//
1015void MCalibrationQEPix::SetBlindPixelMethodValid ( Bool_t b, MCalibrationCam::PulserColor_t col )
1016{
1017 if (b)
1018 SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
1019 else
1020 CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
1021}
1022
1023// ------------------------------------------------------------------------------
1024//
1025// Set the bit QE Combination of three methods available from colour "col"
1026//
1027void MCalibrationQEPix::SetCombinedMethodValid ( Bool_t b, MCalibrationCam::PulserColor_t col )
1028{
1029 if (b)
1030 SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
1031 else
1032 CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
1033}
1034
1035// ------------------------------------------------------------------------------
1036//
1037// Set the bit QE F-Factor method available from colour "col"
1038//
1039void MCalibrationQEPix::SetFFactorMethodValid ( Bool_t b, MCalibrationCam::PulserColor_t col )
1040{
1041 if (b)
1042 SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
1043 else
1044 CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
1045}
1046
1047// ------------------------------------------------------------------------------
1048//
1049// Set the bit QE PIN Diode method available from colour "col"
1050//
1051void MCalibrationQEPix::SetPINDiodeMethodValid ( Bool_t b, MCalibrationCam::PulserColor_t col )
1052{
1053 if (b)
1054 SETBIT(fValidFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
1055 else
1056 CLRBIT(fValidFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
1057}
1058
1059// ------------------------------------------------------------------------------
1060//
1061// Update the Blind Pixel Method: Calculate new average QE's
1062//
1063Bool_t MCalibrationQEPix::UpdateBlindPixelMethod()
1064{
1065
1066 Float_t weightedav = 0.;
1067 Float_t sumweights = 0.;
1068
1069 AddAverageBlindPixelQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
1070 AddAverageBlindPixelQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
1071 AddAverageBlindPixelQEs(MCalibrationCam::kUV , weightedav, sumweights);
1072 AddAverageBlindPixelQEs(MCalibrationCam::kCT1 , weightedav, sumweights);
1073
1074 if (weightedav == 0. || sumweights == 0.)
1075 return kFALSE;
1076
1077 weightedav /= sumweights;
1078
1079 fAvNormBlindPixel = gkDefaultAverageQE * weightedav;
1080 fAvNormBlindPixelVar = GetAverageQERelVar() + (sumweights / weightedav / weightedav );
1081 fAvNormBlindPixelVar *= fAvNormBlindPixel * fAvNormBlindPixel;
1082
1083 return kTRUE;
1084}
1085
1086// ------------------------------------------------------------------------------
1087//
1088// Update the Combination of the three Methods: Calculate new average QE's
1089//
1090Bool_t MCalibrationQEPix::UpdateCombinedMethod()
1091{
1092
1093 Float_t weightedav = 0.;
1094 Float_t sumweights = 0.;
1095
1096 AddAverageCombinedQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
1097 AddAverageCombinedQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
1098 AddAverageCombinedQEs(MCalibrationCam::kUV , weightedav, sumweights);
1099 AddAverageCombinedQEs(MCalibrationCam::kCT1 , weightedav, sumweights);
1100
1101 if (weightedav == 0. || sumweights == 0.)
1102 return kFALSE;
1103
1104 weightedav /= sumweights;
1105
1106 fAvNormCombined = gkDefaultAverageQE * weightedav;
1107 fAvNormCombinedVar = GetAverageQERelVar() + (sumweights / weightedav / weightedav );
1108 fAvNormCombinedVar *= fAvNormCombined * fAvNormCombined;
1109
1110 return kTRUE;
1111
1112}
1113
1114// ------------------------------------------------------------------------------
1115//
1116// Update the F-Factor Method: Calculate new average QE's
1117//
1118Bool_t MCalibrationQEPix::UpdateFFactorMethod()
1119{
1120
1121 Float_t weightedav = 0.;
1122 Float_t sumweights = 0.;
1123
1124 AddAverageFFactorQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
1125 AddAverageFFactorQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
1126 AddAverageFFactorQEs(MCalibrationCam::kUV , weightedav, sumweights);
1127 AddAverageFFactorQEs(MCalibrationCam::kCT1 , weightedav, sumweights);
1128
1129 if (weightedav == 0. || sumweights == 0.)
1130 return kFALSE;
1131
1132 fAvNormFFactor = weightedav / sumweights;
1133 fAvNormFFactorVar = 1./ sumweights ;
1134
1135 SetAverageQEFFactorAvailable();
1136
1137 return kTRUE;
1138
1139
1140}
1141
1142// ------------------------------------------------------------------------------
1143//
1144// Update the PIN Diode Method: Calculate new average QE's
1145//
1146Bool_t MCalibrationQEPix::UpdatePINDiodeMethod()
1147{
1148
1149 Float_t weightedav = 0.;
1150 Float_t sumweights = 0.;
1151
1152 AddAveragePINDiodeQEs(MCalibrationCam::kGREEN, weightedav, sumweights);
1153 AddAveragePINDiodeQEs(MCalibrationCam::kBLUE , weightedav, sumweights);
1154 AddAveragePINDiodeQEs(MCalibrationCam::kUV , weightedav, sumweights);
1155 AddAveragePINDiodeQEs(MCalibrationCam::kCT1 , weightedav, sumweights);
1156
1157 if (weightedav == 0. || sumweights == 0.)
1158 return kFALSE;
1159
1160 weightedav /= sumweights;
1161
1162 fAvNormPINDiode = gkDefaultAverageQE * weightedav;
1163 fAvNormPINDiodeVar = GetAverageQERelVar() + (sumweights / weightedav / weightedav );
1164 fAvNormPINDiodeVar *= fAvNormPINDiode * fAvNormPINDiode;
1165
1166 return kTRUE;
1167
1168
1169}
1170
Note: See TracBrowser for help on using the repository browser.