source: branches/removing_cpp11_features/mcalib/MCalibrationQEPix.cc@ 18123

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