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

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