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

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