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

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