source: tags/Mars-V0.9/mcalib/MCalibrationQEPix.cc

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