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

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