source: trunk/Mars/mcalib/MCalibrationQECam.cc@ 17667

Last change on this file since 17667 was 5137, checked in by gaug, 20 years ago
*** empty log message ***
File size: 30.1 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!
19! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es>
20!
21! Copyright: MAGIC Software Development, 2000-2004
22!
23!
24\* ======================================================================== */
25
26/////////////////////////////////////////////////////////////////////////////
27//
28// MCalibrationQECam
29//
30// Storage container for the calibrated Quantum Efficiency of the whole camera.
31//
32// For a complete description of the quantum efficiency calibration process,
33// see MCalibrationQEPix.
34//
35// Individual pixels have to be cast when retrieved e.g.:
36// MCalibrationQEPix &avpix = (MCalibrationQEPix&)(*fQECam)[i]
37//
38// Averaged values over one whole area index (e.g. inner or outer pixels for
39// the MAGIC camera), can be retrieved via:
40// MCalibrationQEPix &avpix = (MCalibrationQEPix&)fQECam->GetAverageArea(i)
41//
42// Averaged values over one whole camera sector can be retrieved via:
43// MCalibrationQEPix &avpix = (MCalibrationQEPix&)fQECam->GetAverageSector(i)
44//
45// The following "calibration" constants are used for the calibration of each pixel:
46//
47// - MCalibrationQEPix::GetQECascadesBlindPixel(): The mean quantum efficiency folded
48// into a cascades spectrum obtained with the Blind Pixel Method.
49// - MCalibrationQEPix::GetQECascadesFFactor(): The mean quantum efficiency folded
50// into a cascades spectrum obtained with the F-Factor Method
51// - MCalibrationQEPix::GetQECascadesPINDiode(): The mean quantum efficiency folded
52// into a cascades spectrum obtained with the PIN Diode Method
53// - MCalibrationQEPix::GetQECascadesCombined(): The mean quantum efficiency folded
54// into a cascades spectrum obtained with the combination of the three methods
55//
56// The following "calibration" constants have been measured to obtain the above values:
57//
58// - MCalibrationQEPix::GetQEBlindPixel( MCalibrationCam::PulserColor_t color ):
59// The mean quantum efficiency obtained with the calibration pulser color
60// (e.g. kGREEN, kBLUE, kUV, kCT1) after the Blind Pixel Method
61// - MCalibrationQEPix::GetQEFFactor( MCalibrationCam::PulserColor_t color ):
62// The mean quantum efficiency obtained with the calibration pulser color
63// (e.g. kGREEN, kBLUE, kUV, kCT1) after the F-Factor Method
64// - MCalibrationQEPix::GetQEPINDiode( MCalibrationCam::PulserColor_t color ):
65// The mean quantum efficiency obtained with the calibration pulser color
66// (e.g. kGREEN, kBLUE, kUV, kCT1) after the PIN Diode Method
67// - MCalibrationQEPix::GetQECombined( MCalibrationCam::PulserColor_t color ):
68// The mean quantum efficiency obtained with the calibration pulser color
69// (e.g. kGREEN, kBLUE, kUV, kCT1) after the combination of the three methods
70//
71// See also: MCalibrationQEPix, MCalibrationChargeCam, MCalibrationChargeCalc
72// MCalibrationChargeBlindPix, MCalibrationChargePINDiode, MCalibrationChargePix
73//
74/////////////////////////////////////////////////////////////////////////////
75#include "MCalibrationQECam.h"
76#include "MCalibrationQEPix.h"
77
78#include <TOrdCollection.h>
79#include <TGraphErrors.h>
80#include <TH2D.h>
81
82#include "MLog.h"
83#include "MLogManip.h"
84
85ClassImp(MCalibrationQECam);
86
87using namespace std;
88
89const Float_t MCalibrationQECam::gkPlexiglassQE = 0.92;
90const Float_t MCalibrationQECam::gkPlexiglassQEErr = 0.01;
91// --------------------------------------------------------------------------
92//
93// Default constructor.
94//
95MCalibrationQECam::MCalibrationQECam(const char *name, const char *title)
96{
97 fName = name ? name : "MCalibrationQECam";
98 fTitle = title ? title : "Storage container for the calibrated Quantum Efficiency of the camera";
99
100 fFlags.Set(MCalibrationCam::gkNumPulserColors);
101
102 Clear();
103}
104
105// -------------------------------------------------------------------
106//
107// Add MCalibrationQEPix's in the ranges from - to to fPixels
108//
109void MCalibrationQECam::Add(const UInt_t a, const UInt_t b)
110{
111 for (UInt_t i=a; i<b; i++)
112 fPixels->AddAt(new MCalibrationQEPix,i);
113}
114
115// -------------------------------------------------------------------
116//
117// Add MCalibrationQEPix's in the ranges from - to to fAverageAreas
118//
119void MCalibrationQECam::AddArea(const UInt_t a, const UInt_t b)
120{
121 for (UInt_t i=a; i<b; i++)
122 fAverageAreas->AddAt(new MCalibrationQEPix,i);
123}
124
125// -------------------------------------------------------------------
126//
127// Add MCalibrationQEPix's in the ranges from - to to fAverageSectors
128//
129void MCalibrationQECam::AddSector(const UInt_t a, const UInt_t b)
130{
131 for (UInt_t i=a; i<b; i++)
132 fAverageSectors->AddAt(new MCalibrationQEPix,i);
133}
134
135// ------------------------------------------------------------------------
136//
137// Sets all bits to kFALSE
138//
139// Calls:
140// - MCalibrationCam::Clear()
141//
142void MCalibrationQECam::Clear(Option_t *o)
143{
144
145 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kGREEN);
146 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kGREEN);
147 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kGREEN);
148 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kGREEN);
149 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kBLUE);
150 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kBLUE);
151 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kBLUE);
152 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kBLUE);
153 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kUV);
154 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kUV);
155 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kUV);
156 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kUV);
157 SetBlindPixelMethodValid ( kFALSE, MCalibrationCam::kCT1);
158 SetFFactorMethodValid ( kFALSE, MCalibrationCam::kCT1);
159 SetCombinedMethodValid ( kFALSE, MCalibrationCam::kCT1);
160 SetPINDiodeMethodValid ( kFALSE, MCalibrationCam::kCT1);
161
162 MCalibrationCam::Clear();
163}
164
165// --------------------------------------------------------------------------
166//
167// Copy 'constructor'
168//
169void MCalibrationQECam::Copy(TObject& object) const
170{
171
172 MCalibrationQECam &qecam = (MCalibrationQECam&)object;
173
174 MCalibrationCam::Copy(qecam);
175
176 qecam.fFlags = fFlags;
177 qecam.fCorningBlues = fCorningBlues;
178 qecam.fCorningReds = fCorningReds;
179
180}
181
182// --------------------------------------------------------------------
183//
184// Types used by MCalibrate and MCalibrateData:
185// ============================================
186//
187// 0: Mean Quantum Efficiency for cascades, obtained with the F-Factor method
188// 1: Error of the Mean QE for cascades, obtained with the F-Factor method
189// 2: Mean Quantum Efficiency for cascades, obtained with the Blind Pixel method
190// 3: Error of the Mean QE for cascades, obtained with the Blind Pixel method
191// 4: Mean Quantum Efficiency for cascades, obtained with the PIN Diode method
192// 5: Error of the Mean QE for cascades, obtained with the PIN Diode method
193// 6: Mean Quantum Efficiency for cascades, obtained with combination of the 3 methods
194// 7: Error of the Mean QE for cascades, obtained with combination of the 3 methods
195// 8: Availabiliy of Quantum Efficiency for cascades, F-Factor method
196// 9: Availabiliy of Quantum Efficiency for cascades, F-Factor method
197// 10: Availabiliy of Quantum Efficiency for cascades, F-Factor method
198// 11: Availabiliy of Quantum Efficiency for cascades, F-Factor method
199//
200// Types filled by MCalibrationChargeCalc in combination of MCalibrationChargePix:
201// ===============================================================================
202//
203// 12: Mean Quantum Efficiency obtained with F-Factor Method ( color: kCT1)
204// 13: Error of the Mean QE obtained with F-Factor Method ( color: kCT1)
205// 14: Mean Quantum Efficiency obtained with F-Factor Method ( color: kGREEN)
206// 15: Error of the Mean QE obtained with F-Factor Method ( color: kGREEN)
207// 16: Mean Quantum Efficiency obtained with F-Factor Method ( color: kBLUE)
208// 17: Error of the Mean QE obtained with F-Factor Method ( color: kBLUE)
209// 18: Mean Quantum Efficiency obtained with F-Factor Method ( color: kUV)
210// 19: Error of the Mean QE obtained with F-Factor Method ( color: kUV)
211//
212// Types filled by MCalibrationChargeCalc in combination of MCalibrationChargeBlindPix:
213// ====================================================================================
214//
215// 20: Mean Quantum Efficiency obtained with Blind Pixel Method ( color: kCT1)
216// 21: Error of the Mean QE obtained with Blind Pixel Method ( color: kCT1)
217// 22: Mean Quantum Efficiency obtained with Blind Pixel Method ( color: kGREEN)
218// 23: Error of the Mean QE obtained with Blind Pixel Method ( color: kGREEN)
219// 24: Mean Quantum Efficiency obtained with Blind Pixel Method ( color: kBLUE)
220// 25: Error of the Mean QE obtained with Blind Pixel Method ( color: kBLUE)
221// 26: Mean Quantum Efficiency obtained with Blind Pixel Method ( color: kUV)
222// 27: Error of the Mean QE obtained with Blind Pixel Method ( color: kUV)
223//
224// Types filled by MCalibrationChargeCalc in combination of MCalibrationChargePINDiode:
225// ====================================================================================
226//
227// 28: Mean Quantum Efficiency obtained with PIN Diode Method ( color: kCT1)
228// 29: Error of the Mean QE obtained with PIN Diode Method ( color: kCT1)
229// 30: Mean Quantum Efficiency obtained with PIN Diode Method ( color: kGREEN)
230// 31: Error of the Mean QE obtained with PIN Diode Method ( color: kGREEN)
231// 32: Mean Quantum Efficiency obtained with PIN Diode Method ( color: kBLUE)
232// 33: Error of the Mean QE obtained with PIN Diode Method ( color: kBLUE)
233// 34: Mean Quantum Efficiency obtained with PIN Diode Method ( color: kUV)
234// 35: Error of the Mean QE obtained with PIN Diode Method ( color: kUV)
235//
236// Types filled by MCalibrationChargeCalc in combination of MCalibrationQEPix:
237// ===========================================================================
238//
239// 36: Mean Quantum Efficiency obtained with combination of 3 methods ( color: kCT1)
240// 37: Error of the Mean QE obtained with combination of 3 methods ( color: kCT1)
241// 38: Mean Quantum Efficiency obtained with combination of 3 methods ( color: kGREEN)
242// 39: Error of the Mean QE obtained with combination of 3 methods ( color: kGREEN)
243// 40: Mean Quantum Efficiency obtained with combination of 3 methods ( color: kBLUE)
244// 41: Error of the Mean QE obtained with combination of 3 methods ( color: kBLUE)
245// 42: Mean Quantum Efficiency obtained with combination of 3 methods ( color: kUV)
246// 43: Error of the Mean QE obtained with combination of 3 methods ( color: kUV)
247//
248Bool_t MCalibrationQECam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
249{
250
251 if (idx > GetSize())
252 return kFALSE;
253
254 MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[idx];
255
256 if (pix.IsExcluded())
257 return kFALSE;
258
259 switch (type)
260 {
261 case 0:
262 if (!pix.IsAverageQEFFactorAvailable())
263 return kFALSE;
264 val = pix.GetQECascadesFFactor();
265 break;
266 case 1:
267 if (!pix.IsAverageQEFFactorAvailable())
268 return kFALSE;
269 val = pix.GetQECascadesFFactorErr();
270 break;
271 case 2:
272 if (!pix.IsAverageQEBlindPixelAvailable())
273 return kFALSE;
274 val = pix.GetQECascadesBlindPixel();
275 break;
276 case 3:
277 if (!pix.IsAverageQEBlindPixelAvailable())
278 return kFALSE;
279 val = pix.GetQECascadesBlindPixelErr();
280 break;
281 case 4:
282 if (!pix.IsAverageQEPINDiodeAvailable())
283 return kFALSE;
284 val = pix.GetQECascadesPINDiode();
285 break;
286 case 5:
287 if (!pix.IsAverageQEPINDiodeAvailable())
288 return kFALSE;
289 val = pix.GetQECascadesPINDiodeErr();
290 break;
291 case 6:
292 if (!pix.IsAverageQECombinedAvailable())
293 return kFALSE;
294 val = pix.GetQECascadesCombined();
295 break;
296 case 7:
297 if (!pix.IsAverageQECombinedAvailable())
298 return kFALSE;
299 val = pix.GetQECascadesCombinedErr();
300 break;
301 case 8:
302 if (pix.IsAverageQEFFactorAvailable())
303 val = 1;
304 else
305 return kFALSE;
306 break;
307 case 9:
308 if (pix.IsAverageQEBlindPixelAvailable())
309 val = 1;
310 else
311 return kFALSE;
312 break;
313 case 10:
314 if (pix.IsAverageQEPINDiodeAvailable())
315 val = 1;
316 else
317 return kFALSE;
318 break;
319 case 11:
320 if (pix.IsAverageQECombinedAvailable())
321 val = 1;
322 else
323 return kFALSE;
324 break;
325 case 12:
326 val = pix.GetQEFFactor(kCT1);
327 break;
328 case 13:
329 val = pix.GetQEFFactorErr(kCT1);
330 break;
331 case 14:
332 val = pix.GetQEFFactor(kGREEN);
333 break;
334 case 15:
335 val = pix.GetQEFFactorErr(kGREEN);
336 break;
337 case 16:
338 val = pix.GetQEFFactor(kBLUE);
339 break;
340 case 17:
341 val = pix.GetQEFFactorErr(kBLUE);
342 break;
343 case 18:
344 val = pix.GetQEFFactor(kUV);
345 break;
346 case 19:
347 val = pix.GetQEFFactorErr(kUV);
348 break;
349 case 20:
350 val = pix.GetQEBlindPixel(kCT1);
351 break;
352 case 21:
353 val = pix.GetQEBlindPixelErr(kCT1);
354 break;
355 case 22:
356 val = pix.GetQEBlindPixel(kGREEN);
357 break;
358 case 23:
359 val = pix.GetQEBlindPixelErr(kGREEN);
360 break;
361 case 24:
362 val = pix.GetQEBlindPixel(kBLUE);
363 break;
364 case 25:
365 val = pix.GetQEBlindPixelErr(kBLUE);
366 break;
367 case 26:
368 val = pix.GetQEBlindPixel(kUV);
369 break;
370 case 27:
371 val = pix.GetQEBlindPixelErr(kUV);
372 break;
373 case 28:
374 val = pix.GetQEPINDiode(kCT1);
375 break;
376 case 29:
377 val = pix.GetQEPINDiodeErr(kCT1);
378 break;
379 case 30:
380 val = pix.GetQEPINDiode(kGREEN);
381 break;
382 case 31:
383 val = pix.GetQEPINDiodeErr(kGREEN);
384 break;
385 case 32:
386 val = pix.GetQEPINDiode(kBLUE);
387 break;
388 case 33:
389 val = pix.GetQEPINDiodeErr(kBLUE);
390 break;
391 case 34:
392 val = pix.GetQEPINDiode(kUV);
393 break;
394 case 35:
395 val = pix.GetQEPINDiodeErr(kUV);
396 break;
397 case 36:
398 val = pix.GetQECombined(kCT1);
399 break;
400 case 37:
401 val = pix.GetQECombinedErr(kCT1);
402 break;
403 case 38:
404 val = pix.GetQECombined(kGREEN);
405 break;
406 case 39:
407 val = pix.GetQECombinedErr(kGREEN);
408 break;
409 case 40:
410 val = pix.GetQECombined(kBLUE);
411 break;
412 case 41:
413 val = pix.GetQECombinedErr(kBLUE);
414 break;
415 case 42:
416 val = pix.GetQECombined(kUV);
417 break;
418 case 43:
419 val = pix.GetQECombinedErr(kUV);
420 break;
421 default:
422 return kFALSE;
423 }
424 return val!=-1.;
425}
426
427// --------------------------------------------------------------------------
428//
429// Return -1 if gkPlexiglassQEErr is smaller than 0.
430// Return -1 if gkPlexiglassQE is 0.
431// Return gkPlexiglassQEErr^2 / gkPlexiglassQE^2
432//
433Float_t MCalibrationQECam::GetPlexiglassQERelVar() const
434{
435 if (gkPlexiglassQEErr < 0.)
436 return -1.;
437
438 if (gkPlexiglassQE == 0.)
439 return -1.;
440
441 return gkPlexiglassQEErr * gkPlexiglassQEErr / gkPlexiglassQE / gkPlexiglassQE ;
442}
443
444
445// --------------------------------------------------------------------------------
446//
447// Returns kTRUE if ANY of the four colours have the bit kBlindPixelMethodValid set,
448// otherwise kFALSE
449//
450Bool_t MCalibrationQECam::IsBlindPixelMethodValid () const
451{
452 if (IsBlindPixelMethodValid (MCalibrationCam::kGREEN))
453 return kTRUE;
454 if (IsBlindPixelMethodValid (MCalibrationCam::kBLUE ))
455 return kTRUE;
456 if (IsBlindPixelMethodValid (MCalibrationCam::kUV ))
457 return kTRUE;
458 if (IsBlindPixelMethodValid (MCalibrationCam::kCT1 ))
459 return kTRUE;
460
461 return kFALSE;
462}
463
464// --------------------------------------------------------------------------------
465//
466// Returns kTRUE if ANY of the four colours have the bit kCombinedMethodValid set,
467// otherwise kFALSE
468//
469Bool_t MCalibrationQECam::IsCombinedMethodValid () const
470{
471 if (IsCombinedMethodValid (MCalibrationCam::kGREEN))
472 return kTRUE;
473 if (IsCombinedMethodValid (MCalibrationCam::kBLUE ))
474 return kTRUE;
475 if (IsCombinedMethodValid (MCalibrationCam::kUV ))
476 return kTRUE;
477 if (IsCombinedMethodValid (MCalibrationCam::kCT1 ))
478 return kTRUE;
479
480 return kFALSE;
481}
482
483// --------------------------------------------------------------------------------
484//
485// Returns kTRUE if ANY of the four colours have the bit kFFactorMethodValid set,
486// otherwise kFALSE
487//
488Bool_t MCalibrationQECam::IsFFactorMethodValid () const
489{
490 if (IsFFactorMethodValid (MCalibrationCam::kGREEN))
491 return kTRUE;
492 if (IsFFactorMethodValid (MCalibrationCam::kBLUE ))
493 return kTRUE;
494 if (IsFFactorMethodValid (MCalibrationCam::kUV ))
495 return kTRUE;
496 if (IsFFactorMethodValid (MCalibrationCam::kCT1 ))
497 return kTRUE;
498
499 return kFALSE;
500}
501
502
503// --------------------------------------------------------------------------------
504//
505// Returns kTRUE if ANY of the four colours have the bit kPINDiodeMethodValid set,
506// otherwise kFALSE
507//
508Bool_t MCalibrationQECam::IsPINDiodeMethodValid () const
509{
510 if (IsPINDiodeMethodValid (MCalibrationCam::kGREEN))
511 return kTRUE;
512 if (IsPINDiodeMethodValid (MCalibrationCam::kBLUE ))
513 return kTRUE;
514 if (IsPINDiodeMethodValid (MCalibrationCam::kUV ))
515 return kTRUE;
516 if (IsPINDiodeMethodValid (MCalibrationCam::kCT1 ))
517 return kTRUE;
518
519 return kFALSE;
520}
521
522// --------------------------------------------------------------------------------
523//
524// Returns kTRUE if ANY of the bit kBlindPixelMethodValid is set for colour "col"
525// otherwise kFALSE
526//
527Bool_t MCalibrationQECam::IsBlindPixelMethodValid (MCalibrationCam::PulserColor_t col) const
528{
529 return TESTBIT(fFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
530}
531
532// --------------------------------------------------------------------------------
533//
534// Returns kTRUE if ANY of the bit kCombinedMethodValid is set for colour "col"
535// otherwise kFALSE
536//
537Bool_t MCalibrationQECam::IsCombinedMethodValid (MCalibrationCam::PulserColor_t col) const
538{
539 return TESTBIT(fFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
540}
541
542// --------------------------------------------------------------------------------
543//
544// Returns kTRUE if ANY of the bit kFFactorMethodValid is set for colour "col"
545// otherwise kFALSE
546//
547Bool_t MCalibrationQECam::IsFFactorMethodValid (MCalibrationCam::PulserColor_t col) const
548{
549 return TESTBIT(fFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
550}
551
552// --------------------------------------------------------------------------------
553//
554// Returns kTRUE if ANY of the bit kPINDiodeMethodValid is set for colour "col"
555// otherwise kFALSE
556//
557Bool_t MCalibrationQECam::IsPINDiodeMethodValid (MCalibrationCam::PulserColor_t col) const
558{
559 return TESTBIT(fFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
560}
561
562// --------------------------------------------------------------------------
563//
564// Print the
565// - MCalibrationQEPix::GetQECascadesFFactor()
566// - MCalibrationQEPix::GetQECascadesBlindPixel()
567// - MCalibrationQEPix::GetQECascadesPINDiode()
568// - MCalibrationQEPix::GetQECascadesCombined()
569// for all pixels
570//
571void MCalibrationQECam::Print(Option_t *o) const
572{
573
574 *fLog << all << GetDescriptor() << ":" << endl;
575 int id = 0;
576
577 *fLog << all << endl;
578 *fLog << all << "Quantum Efficiencies averaged over cascades spectra, measured with F-Factor method:" << endl;
579 *fLog << all << endl;
580
581 TIter Next(fPixels);
582 MCalibrationQEPix *pix;
583 while ((pix=(MCalibrationQEPix*)Next()))
584 {
585
586 if (!pix->IsExcluded() && pix->IsAverageQEFFactorAvailable())
587 {
588 *fLog << all
589 << Form("%s%4i%s%4.2f%s%4.2f","Pix ",pix->GetPixId(),
590 ": QE: ",pix->GetQECascadesFFactor()," +- ",pix->GetQECascadesFFactorErr())
591 << endl;
592 id++;
593 }
594 }
595
596 *fLog << all << id << " succesful pixels :-))" << endl;
597 id = 0;
598
599 *fLog << all << endl;
600 *fLog << all << "Quantum Efficiencies averaged over cascades spectra, "
601 << "measured with Blind Pixel method:" << endl;
602 *fLog << all << endl;
603
604 TIter Next2(fPixels);
605 while ((pix=(MCalibrationQEPix*)Next2()))
606 {
607
608 if (!pix->IsExcluded() && pix->IsAverageQEBlindPixelAvailable())
609 {
610 *fLog << all
611 << Form("%s%4i%s%4.2f%s%4.2f","Pix ",pix->GetPixId(),
612 ": QE: ",pix->GetQECascadesBlindPixel()," +- ",pix->GetQECascadesBlindPixelErr())
613 << endl;
614 id++;
615 }
616 }
617
618 *fLog << all << id << " succesful pixels :-))" << endl;
619 id = 0;
620
621 *fLog << all << endl;
622 *fLog << all << "Quantum Efficiencies averaged over cascades spectra, "
623 << "measured with PIN Diode method:" << endl;
624 *fLog << all << endl;
625
626 TIter Next3(fPixels);
627 while ((pix=(MCalibrationQEPix*)Next3()))
628 {
629
630 if (!pix->IsExcluded() && pix->IsAverageQEPINDiodeAvailable())
631 {
632 *fLog << all
633 << Form("%s%4i%s%4.2f%s%4.2f","Pix ",pix->GetPixId(),
634 ": QE: ",pix->GetQECascadesPINDiode()," +- ",pix->GetQECascadesPINDiodeErr())
635 << endl;
636 id++;
637 }
638 }
639
640 *fLog << all << id << " succesful pixels :-))" << endl;
641 id = 0;
642
643
644 *fLog << all << endl;
645 *fLog << all << "Quantum Efficiencies averaged over cascades spectra, "
646 << "measured with combination of the 3 methods:" << endl;
647 *fLog << all << endl;
648
649 TIter Next4(fPixels);
650 while ((pix=(MCalibrationQEPix*)Next4()))
651 {
652
653 if (!pix->IsExcluded() && pix->IsAverageQECombinedAvailable())
654 {
655 *fLog << all
656 << Form("%s%4i%s%4.2f%s%4.2f","Pix ",pix->GetPixId(),
657 ": QE: ",pix->GetQECascadesCombined()," +- ",pix->GetQECascadesCombinedErr())
658 << endl;
659 id++;
660 }
661 }
662
663 *fLog << all << id << " succesful pixels :-))" << endl;
664 id = 0;
665
666 *fLog << all << endl;
667 *fLog << all << "Excluded pixels:" << endl;
668 *fLog << all << endl;
669
670 TIter Next5(fPixels);
671 while ((pix=(MCalibrationQEPix*)Next5()))
672 {
673 if (pix->IsExcluded())
674 {
675 *fLog << all << pix->GetPixId() << endl;
676 id++;
677 }
678 }
679 *fLog << all << id << " Excluded pixels " << endl;
680}
681
682
683// --------------------------------------------------------------------------
684//
685// Sets the validity flag (according to b) for the Blind Pixel Method,
686// for all colours (kGREEN, kBLUE, kUV, kCT1)
687//
688void MCalibrationQECam::SetBlindPixelMethodValid ( const Bool_t b )
689{
690 SetBlindPixelMethodValid ( b, MCalibrationCam::kGREEN);
691 SetBlindPixelMethodValid ( b, MCalibrationCam::kBLUE );
692 SetBlindPixelMethodValid ( b, MCalibrationCam::kUV );
693 SetBlindPixelMethodValid ( b, MCalibrationCam::kCT1 );
694}
695
696// ----------------------------------------------------------------------------
697//
698// Sets the validity flag (according to b) for the combination of the 3 methods
699// for all colours (kGREEN, kBLUE, kUV, kCT1)
700//
701void MCalibrationQECam::SetCombinedMethodValid ( const Bool_t b )
702{
703 SetCombinedMethodValid ( b, MCalibrationCam::kGREEN);
704 SetCombinedMethodValid ( b, MCalibrationCam::kBLUE );
705 SetCombinedMethodValid ( b, MCalibrationCam::kUV );
706 SetCombinedMethodValid ( b, MCalibrationCam::kCT1 );
707}
708
709// --------------------------------------------------------------------------
710//
711// Sets the validity flag (according to b) for the F-Factor Method
712// for all colours (kGREEN, kBLUE, kUV, kCT1)
713//
714void MCalibrationQECam::SetFFactorMethodValid ( const Bool_t b )
715{
716 SetFFactorMethodValid ( b, MCalibrationCam::kGREEN);
717 SetFFactorMethodValid ( b, MCalibrationCam::kBLUE );
718 SetFFactorMethodValid ( b, MCalibrationCam::kUV );
719 SetFFactorMethodValid ( b, MCalibrationCam::kCT1 );
720}
721
722// --------------------------------------------------------------------------
723//
724// Sets the validity flag (according to b) for the PIN Diode Method,
725// for all colours (kGREEN, kBLUE, kUV, kCT1)
726//
727void MCalibrationQECam::SetPINDiodeMethodValid ( const Bool_t b )
728{
729 SetPINDiodeMethodValid ( b, MCalibrationCam::kGREEN);
730 SetPINDiodeMethodValid ( b, MCalibrationCam::kBLUE );
731 SetPINDiodeMethodValid ( b, MCalibrationCam::kUV );
732 SetPINDiodeMethodValid ( b, MCalibrationCam::kCT1 );
733}
734
735// --------------------------------------------------------------------------
736//
737// Sets the validity flag (according to b) for the Blind Pixel Method,
738// for colour "col"
739//
740void MCalibrationQECam::SetBlindPixelMethodValid ( const Bool_t b, MCalibrationCam::PulserColor_t col )
741{
742 if (b)
743 SETBIT(fFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
744 else
745 CLRBIT(fFlags[ MCalibrationCam::kGREEN ],kBlindPixelMethodValid);
746}
747
748// --------------------------------------------------------------------------
749//
750// Sets the validity flag (according to b) for the combination of 3 methods
751// for colour "col"
752//
753void MCalibrationQECam::SetCombinedMethodValid ( const Bool_t b, MCalibrationCam::PulserColor_t col )
754{
755 if (b)
756 SETBIT(fFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
757 else
758 CLRBIT(fFlags[ MCalibrationCam::kGREEN ],kCombinedMethodValid);
759}
760
761// --------------------------------------------------------------------------
762//
763// Sets the validity flag (according to b) for the F-Factor Method,
764// for colour "col"
765//
766void MCalibrationQECam::SetFFactorMethodValid ( const Bool_t b, MCalibrationCam::PulserColor_t col )
767{
768 if (b)
769 SETBIT(fFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
770 else
771 CLRBIT(fFlags[ MCalibrationCam::kGREEN ],kFFactorMethodValid);
772}
773
774// --------------------------------------------------------------------------
775//
776// Sets the validity flag (according to b) for the PIN Diode Method,
777// for colour "col"
778//
779void MCalibrationQECam::SetPINDiodeMethodValid ( const Bool_t b, MCalibrationCam::PulserColor_t col )
780{
781 if (b)
782 SETBIT(fFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
783 else
784 CLRBIT(fFlags[ MCalibrationCam::kGREEN ],kPINDiodeMethodValid);
785}
786
787// --------------------------------------------------------------------------
788//
789// Returns a TGraphErrors correlating the corning blues with the
790// calcualted quantum efficiency of each pixel, obtained with the F-Factor
791// method.
792//
793TGraphErrors *MCalibrationQECam::GetGraphQEvsCorningBlues() const
794{
795
796 const UInt_t size = GetSize();
797
798 if (fCorningBlues.GetSize() == 0)
799 {
800 *fLog << warn << "Size of intialized Cornings Blue is zero, please use MCalibrationQECamMagic" << endl;
801 return NULL;
802 }
803
804 if (fCorningBlues.GetSize() != size)
805 *fLog << warn << "Sizes mismatch, cannot create Graph!! " << endl;
806
807 TArrayD qes(size);
808 TArrayD qeerrs(size);
809 TArrayD corns(size);
810 TArrayD cornerrs(size);
811
812 Int_t cnt = 0;
813
814 for (UInt_t i=0; i<size; i++)
815 {
816 MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[i];
817 if (pix.IsFFactorMethodValid() && fCorningBlues[i] > 0. && pix.GetQECascadesFFactorErr() > 0.)
818 {
819 qes [i] = pix.GetQECascadesFFactor();
820 qeerrs[i] = pix.GetQECascadesFFactorErr();
821 corns [i] = fCorningBlues[i];
822 cornerrs[i] = 0.05;
823 cnt++;
824 }
825 }
826
827 TGraphErrors *gr = new TGraphErrors(cnt,
828 corns.GetArray(),qes.GetArray(),
829 cornerrs.GetArray(),qeerrs.GetArray());
830 return gr;
831}
832
833// --------------------------------------------------------------------------
834//
835// Returns a TGraphErrors correlating the corning reds with the
836// calcualted quantum efficiency of each pixel, obtained with the F-Factor
837// method.
838//
839TGraphErrors *MCalibrationQECam::GetGraphQEvsCorningReds() const
840{
841
842 const UInt_t size = GetSize();
843
844 if (fCorningReds.GetSize() == 0)
845 {
846 *fLog << warn << "Size of intialized Cornings Red is zero, please use MCalibrationQECamMagic" << endl;
847 return NULL;
848 }
849
850 if (fCorningReds.GetSize() != size)
851 *fLog << warn << "Sizes mismatch, cannot create Graph!! " << endl;
852
853 TArrayD qes(size);
854 TArrayD qeerrs(size);
855 TArrayD corns(size);
856 TArrayD cornerrs(size);
857
858 Int_t cnt = 0;
859
860 for (UInt_t i=0; i<size; i++)
861 {
862 MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[i];
863 if (pix.IsFFactorMethodValid() && fCorningReds[i] > 0. && pix.GetQECascadesFFactorErr() > 0.)
864 {
865 qes [i] = pix.GetQECascadesFFactor();
866 qeerrs [i] = pix.GetQECascadesFFactorErr();
867 corns [i] = fCorningReds[i];
868 cornerrs[i] = 0.05;
869 cnt++;
870 }
871
872 }
873
874 TGraphErrors *gr = new TGraphErrors(cnt,
875 corns.GetArray(),qes.GetArray(),
876 cornerrs.GetArray(),qeerrs.GetArray());
877
878 return gr;
879}
880
881TH2D *MCalibrationQECam::GetHistQEvsCorningBlues( const Int_t nbins, const Axis_t first, const Axis_t last ) const
882{
883
884 const UInt_t size = GetSize();
885
886 if (fCorningBlues.GetSize() == 0)
887 return NULL;
888
889 if (fCorningBlues.GetSize() != size)
890 *fLog << warn << "Sizes mismatch, cannot create Graph!! " << endl;
891
892 TH2D *h = new TH2D("hist","QE vs. Corning Blue",nbins,first,last,nbins,0.,0.35);
893
894 for (UInt_t i=0; i<size; i++)
895 {
896 MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[i];
897 if (pix.IsFFactorMethodValid() && fCorningBlues[i] > 0.)
898 h->Fill(fCorningBlues[i],pix.GetQECascadesFFactor());
899 }
900
901 return h;
902}
903
904TH2D *MCalibrationQECam::GetHistQEvsCorningReds( const Int_t nbins, const Axis_t first, const Axis_t last ) const
905{
906
907 const UInt_t size = GetSize();
908
909 if (fCorningReds.GetSize() == 0)
910 return NULL;
911
912 if (fCorningReds.GetSize() != size)
913 *fLog << warn << "Sizes mismatch, cannot create Graph!! " << endl;
914
915 TH2D *h = new TH2D("hist","QE vs. Corning Red",nbins,first,last,nbins,0.,0.35);
916
917 for (UInt_t i=0; i<size; i++)
918 {
919 MCalibrationQEPix &pix = (MCalibrationQEPix&)(*this)[i];
920 if (pix.IsFFactorMethodValid() && fCorningReds[i] > 0.)
921 h->Fill(fCorningReds[i],pix.GetQECascadesFFactor());
922 }
923
924 return h;
925}
Note: See TracBrowser for help on using the repository browser.