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

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