source: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCam.cc@ 5023

Last change on this file since 5023 was 5019, checked in by gaug, 20 years ago
*** empty log message ***
File size: 27.3 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 11/2003 <mailto:markus@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24/////////////////////////////////////////////////////////////////////////////
25//
26// MCalibrationChargeCam
27//
28// Storage container for charge calibration results from the signal distribution
29// fits (see MHCalibrationChargeCam and MHCalibrationChargePix), the calculation
30// of reduced sigmas and number of photo-electrons (this class) and conversion
31// factors sum FADC slices to photo-electrons (see MCalibrationChargeCalc)
32//
33// Individual pixels have to be cast when retrieved e.g.:
34// MCalibrationChargePix &avpix = (MCalibrationChargePix&)(*fChargeCam)[i]
35//
36// Averaged values over one whole area index (e.g. inner or outer pixels for
37// the MAGIC camera), can be retrieved via:
38// MCalibrationChargePix &avpix = (MCalibrationChargePix&)fChargeCam->GetAverageArea(i)
39//
40// Averaged values over one whole camera sector can be retrieved via:
41// MCalibrationChargePix &avpix = (MCalibrationChargePix&)fChargeCam->GetAverageSector(i)
42//
43// Note the averageing has been done on an event-by-event basis. Resulting
44// Sigma's of the Gauss fit have been multiplied with the square root of the number
45// of involved pixels in order to make a direct comparison possible with the mean of
46// sigmas.
47//
48// Final numbers of uncalibrated or unreliable pixels can be retrieved via the commands:
49// GetNumUncalibrated(aidx) and GetNumUnreliable(aidx) where aidx is the area index (0 for
50// inner and 1 for outer pixels in the MAGIC camera).
51//
52// The following "calibration" constants are used for the calibration of each pixel
53// (see MCalibrate):
54//
55// - MCalibrationQEPix::GetMeanConvFADC2Phe(): The mean conversion factor from the
56// summed FADC slices to the number of photo-electrons (in first order independent
57// on colour and intensity)
58// - MCalibrationQEPix::GetMeanFFactorFADC2Phot(): The mean F-Factor of the total
59// readout chain dividing the signal to noise of the incoming number of photons
60// (= sqrt(number photons)) by the signal to noise of the outgoing summed FADC slices
61// signal (= MCalibrationPix::GetMean() / MCalibrationChargePix::GetRSigma() )
62//
63// The following calibration constants can be retrieved directly from this class:
64//
65// - GetConversionFactorFFactor ( Int_t idx, Float_t &mean, Float_t &err, Float_t &sigma );
66//
67// where:
68// - idx is the pixel software ID
69// - "mean" is the mean conversion constant, to be multiplied with the retrieved signal
70// in order to get a calibrated number of PHOTONS.
71// - "err" is the pure statistical uncertainty about the MEAN
72// - "sigma", if mulitplied with the square root of signal, gives the approximate sigma of the
73// retrieved mean number of incident Cherenkov photons.
74//
75// Note, Conversion is ALWAYS (included the F-Factor method!) from summed FADC slices to PHOTONS.
76//
77// See also: MCalibrationChargePix, MCalibrationChargeCalc, MCalibrationQECam
78// MHCalibrationChargePix, MHCalibrationChargeCam
79// MCalibrationChargeBlindPix, MCalibrationChargePINDiode
80//
81/////////////////////////////////////////////////////////////////////////////
82#include "MCalibrationChargeCam.h"
83
84#include <TObjArray.h>
85
86#include "MLog.h"
87#include "MLogManip.h"
88
89#include "MGeomCam.h"
90#include "MGeomPix.h"
91
92#include "MBadPixelsCam.h"
93#include "MBadPixelsPix.h"
94
95#include "MCalibrationQECam.h"
96#include "MCalibrationQEPix.h"
97
98#include "MCalibrationChargePix.h"
99#include "MCalibrationChargeBlindPix.h"
100#include "MCalibrationChargePINDiode.h"
101
102ClassImp(MCalibrationChargeCam);
103
104using namespace std;
105// --------------------------------------------------------------------------
106//
107// Default constructor.
108//
109// Calls:
110// - Clear()
111//
112MCalibrationChargeCam::MCalibrationChargeCam(const char *name, const char *title)
113{
114 fName = name ? name : "MCalibrationChargeCam";
115 fTitle = title ? title : "Storage container for the Calibration Information in the camera";
116
117 Clear();
118}
119
120
121void MCalibrationChargeCam::Add(const UInt_t a, const UInt_t b)
122{
123 for (UInt_t i=a; i<b; i++)
124 (*fPixels)[i] = new MCalibrationChargePix;
125}
126
127
128void MCalibrationChargeCam::AddArea(const UInt_t a, const UInt_t b)
129{
130 for (UInt_t i=a; i<b; i++)
131 (*fAverageAreas)[i] = new MCalibrationChargePix;
132}
133
134void MCalibrationChargeCam::AddSector(const UInt_t a, const UInt_t b)
135{
136 for (UInt_t i=a; i<b; i++)
137 (*fAverageSectors)[i] = new MCalibrationChargePix;
138}
139
140
141// --------------------------------------
142//
143// Sets all variable to 0.
144// Sets all flags to kFALSE
145// Calls MCalibrationCam::Clear()
146//
147void MCalibrationChargeCam::Clear(Option_t *o)
148{
149
150 SetFFactorMethodValid ( kFALSE );
151
152 fNumPhotonsBlindPixelMethod = 0.;
153 fNumPhotonsFFactorMethod = 0.;
154 fNumPhotonsPINDiodeMethod = 0.;
155 fNumPhotonsBlindPixelMethodErr = 0.;
156 fNumPhotonsFFactorMethodErr = 0.;
157 fNumPhotonsPINDiodeMethodErr = 0.;
158
159 MCalibrationCam::Clear();
160
161 return;
162}
163
164// -----------------------------------------------
165//
166// Sets the kFFactorMethodValid bit from outside
167//
168void MCalibrationChargeCam::SetFFactorMethodValid(const Bool_t b)
169{
170 b ? SETBIT(fFlags, kFFactorMethodValid) : CLRBIT(fFlags, kFFactorMethodValid);
171}
172
173
174// --------------------------------------------------------------------------
175//
176// Test bit kFFactorMethodValid
177//
178Bool_t MCalibrationChargeCam::IsFFactorMethodValid() const
179{
180 return TESTBIT(fFlags,kFFactorMethodValid);
181}
182
183// --------------------------------------------------------------------------
184//
185// Print first the well fitted pixels
186// and then the ones which are not FitValid
187//
188void MCalibrationChargeCam::Print(Option_t *o) const
189{
190
191 *fLog << all << GetDescriptor() << ":" << endl;
192 int id = 0;
193
194 *fLog << all << "Calibrated pixels:" << endl;
195 *fLog << all << endl;
196
197 TIter Next(fPixels);
198 MCalibrationChargePix *pix;
199 while ((pix=(MCalibrationChargePix*)Next()))
200 {
201
202 if (!pix->IsExcluded())
203 {
204
205 *fLog << all
206 << Form("%s%3i","Pixel: ",pix->GetPixId())
207 << Form("%s%4.2f%s%4.2f"," Ped.Rms: ",pix->GetPedRms(),"+-",pix->GetPedRmsErr())
208 << Form("%s%4.2f%s%4.2f"," Charge: " ,pix->GetConvertedMean(),"+-",pix->GetConvertedSigma())
209 << Form("%s%4.2f%s%4.2f"," Red.Sigma: ",pix->GetConvertedRSigma(),"+-",pix->GetConvertedRSigmaErr())
210 << Form("%s%4.2f%s%4.2f"," Num.Phes: ",pix->GetPheFFactorMethod(),"+-",pix->GetPheFFactorMethodErr())
211 << Form("%s%4.2f%s%4.2f"," Conv.FADC2Phe: ",pix->GetMeanConvFADC2Phe(),"+-",pix->GetMeanConvFADC2PheErr())
212 << " Saturated? :" << pix->IsHiGainSaturation()
213 << endl;
214 id++;
215 }
216 }
217
218 *fLog << all << id << " pixels" << endl;
219 id = 0;
220
221
222 *fLog << all << endl;
223 *fLog << all << "Excluded pixels:" << endl;
224 *fLog << all << endl;
225
226 id = 0;
227
228 TIter Next4(fPixels);
229 while ((pix=(MCalibrationChargePix*)Next4()))
230 {
231 if (pix->IsExcluded())
232 {
233 *fLog << all << pix->GetPixId() << " ";
234 id++;
235
236 if (!(id % 25))
237 *fLog << endl;
238 }
239 }
240
241 *fLog << endl;
242 *fLog << all << id << " Excluded pixels " << endl;
243 *fLog << endl;
244
245 *fLog << all << endl;
246 *fLog << all << "Averaged Areas:" << endl;
247 *fLog << all << endl;
248
249 TIter Next5(fAverageAreas);
250 while ((pix=(MCalibrationChargePix*)Next5()))
251 {
252 *fLog << all << Form("%s%3i","Area Idx: ",pix->GetPixId())
253 << " Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr()
254 << " Mean signal: " << pix->GetMean() << " +- " << pix->GetMeanErr()
255 << " Sigma signal: " << pix->GetSigma() << " +- "<< pix->GetSigmaErr()
256 << " Reduced Sigma: " << pix->GetRSigma()
257 << " Nr Phe's: " << pix->GetPheFFactorMethod()
258 << endl;
259 }
260
261 *fLog << all << endl;
262 *fLog << all << "Averaged Sectors:" << endl;
263 *fLog << all << endl;
264
265 TIter Next6(fAverageSectors);
266 while ((pix=(MCalibrationChargePix*)Next6()))
267 {
268 *fLog << all << Form("%s%3i","Sector: ",pix->GetPixId())
269 << " Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr()
270 << " Mean signal: " << pix->GetMean() << " +- " << pix->GetMeanErr()
271 << " Sigma signal: " << pix->GetSigma() << " +- "<< pix->GetSigmaErr()
272 << " Reduced Sigma: " << pix->GetRSigma()
273 << " Nr Phe's: " << pix->GetPheFFactorMethod()
274 << endl;
275 }
276 *fLog << all << endl;
277}
278
279
280// --------------------------------------------------------------------------
281//
282// The types are as follows:
283//
284// Fitted values:
285// ==============
286//
287// 0: Fitted Charge (see MCalibrationPix::GetMean())
288// 1: Error of fitted Charge (see MCalibrationPix::GetMeanErr())
289// 2: Sigma of fitted Charge (see MCalibrationPix::GetSigma())
290// 3: Error of Sigma of fitted Charge (see MCalibrationPix::GetSigmaErr())
291//
292// Useful variables derived from the fit results:
293// =============================================
294//
295// 4: Probability Gauss fit Charge distribution (see MCalibrationPix::GetProb())
296// 5: Reduced Sigma of fitted Charge (see MCalibrationChargePix::GetRSigma())
297// 6: Error Reduced Sigma of fitted Charge (see MCalibrationChargePix::GetRSigmaErr())
298// 7: Reduced Sigma per Charge (see MCalibrationChargePix::GetRSigmaPerCharge())
299// 8: Error of Reduced Sigma per Charge (see MCalibrationChargePix::GetRSigmaPerChargeErr())
300//
301// Results of the F-Factor calibration Method:
302// ===========================================
303//
304// 9: Nr. Photo-electrons from F-Factor Method (see MCalibrationChargePix::GetPheFFactorMethod())
305// 10: Error Nr. Photo-el. from F-Factor Method (see MCalibrationChargePix::GetPheFFactorMethodErr())
306// 11: Conversion factor from F-Factor Method (see MCalibrationChargePix::GetMeanConvFADC2Phe()
307// 12: Error conv. factor from F-Factor Method (see MCalibrationChargePix::GetMeanConvFADC2PheErr()
308// 13: Overall F-Factor from F-Factor Method (see MCalibrationChargePix::GetMeanFFactorFADC2Phot()
309// 14: Error F-Factor from F-Factor Method (see MCalibrationChargePix::GetMeanFFactorFADC2PhotErr()
310// 15: Pixels valid calibration F-Factor-Method (see MCalibrationChargePix::IsFFactorMethodValid())
311//
312// Results of the Low-Gain vs. High-Gain Conversion:
313// =================================================
314//
315// 16: Mean Signal Hi-Gain / Mean Signal Lo-Gain (see MCalibrationPix::GetHiLoMeansDivided())
316// 17: Error Signal High-Gain / Signal Low Gain (see MCalibrationPix::GetHiLoMeansDividedErr())
317// 18: Sigma High-Gain / Sigma Low Gain (see MCalibrationPix::GetHiLoSigmasDivided())
318// 19: Error Sigma High-Gain / Sigma Low Gain (see MCalibrationPix::GetHiLoSigmasDividedErr())
319//
320// Localized defects:
321// ==================
322//
323// 20: Excluded Pixels
324// 21: Number of pickup events in the Hi Gain (see MCalibrationPix::GetHiGainNumPickup())
325// 22: Number of pickup events in the Lo Gain (see MCalibrationPix::GetLoGainNumPickup())
326// 23: Number of blackout events in the Hi Gain (see MCalibrationPix::GetHiGainNumBlackout())
327// 24: Number of blackout events in the Lo Gain (see MCalibrationPix::GetLoGainNumBlackout())
328//
329// Other classifications of pixels:
330// ================================
331//
332// 25: Pixels with saturated High-Gain (see MCalibrationPix::IsHiGainSaturation())
333//
334// Calculated absolute arrival times (very low precision!):
335// ========================================================
336//
337// 26: Absolute Arrival time of the signal (see MCalibrationChargePix::GetAbsTimeMean())
338// 27: RMS Ab. Arrival time of the signal (see MCalibrationChargePix::GetAbsTimeRms())
339//
340// Used Pedestals:
341// ===============
342//
343// 28: Pedestal for entire signal extr. range (see MCalibrationChargePix::Ped())
344// 29: Error Pedestal entire signal extr. range (see MCalibrationChargePix::PedErr())
345// 30: Ped. RMS entire signal extraction range (see MCalibrationChargePix::PedRms())
346// 31: Error Ped. RMS entire signal extr. range (see MCalibrationChargePix::PedRmsErr())
347//
348Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
349{
350
351 if (idx > GetSize())
352 return kFALSE;
353
354 Float_t area = cam[idx].GetA();
355
356 if (area == 0)
357 return kFALSE;
358
359 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[idx];
360
361 switch (type)
362 {
363 case 0:
364 if (pix.IsExcluded())
365 return kFALSE;
366 val = pix.GetMean();
367 break;
368 case 1:
369 if (pix.IsExcluded())
370 return kFALSE;
371 val = pix.GetMeanErr();
372 break;
373 case 2:
374 if (pix.IsExcluded())
375 return kFALSE;
376 val = pix.GetSigma();
377 break;
378 case 3:
379 if (pix.IsExcluded())
380 return kFALSE;
381 val = pix.GetSigmaErr();
382 break;
383 case 4:
384 if (pix.IsExcluded())
385 return kFALSE;
386 val = pix.GetProb();
387 break;
388 case 5:
389 if (pix.IsExcluded())
390 return kFALSE;
391 if (pix.GetRSigma() == -1.)
392 return kFALSE;
393 val = pix.GetRSigma();
394 break;
395 case 6:
396 if (pix.IsExcluded())
397 return kFALSE;
398 if (pix.GetRSigma() == -1.)
399 return kFALSE;
400 val = pix.GetRSigmaErr();
401 break;
402 case 7:
403 if (pix.IsExcluded())
404 return kFALSE;
405 val = pix.GetRSigmaPerCharge();
406 break;
407 case 8:
408 if (pix.IsExcluded())
409 return kFALSE;
410 val = pix.GetRSigmaPerChargeErr();
411 break;
412 case 9:
413 if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
414 return kFALSE;
415 val = pix.GetPheFFactorMethod();
416 break;
417 case 10:
418 if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
419 return kFALSE;
420 val = pix.GetPheFFactorMethodErr();
421 break;
422 case 11:
423 if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
424 return kFALSE;
425 val = pix.GetMeanConvFADC2Phe();
426 break;
427 case 12:
428 if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
429 return kFALSE;
430 val = pix.GetMeanConvFADC2PheErr();
431 break;
432 case 13:
433 if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
434 return kFALSE;
435 val = pix.GetMeanFFactorFADC2Phot();
436 break;
437 case 14:
438 if (pix.IsExcluded() || !pix.IsFFactorMethodValid())
439 return kFALSE;
440 val = pix.GetMeanFFactorFADC2PhotErr();
441 break;
442 case 15:
443 if (pix.IsExcluded())
444 return kFALSE;
445 if (pix.IsFFactorMethodValid())
446 val = 1;
447 else
448 return kFALSE;
449 break;
450 case 16:
451 if (pix.IsExcluded())
452 return kFALSE;
453 val = pix.GetHiLoMeansDivided();
454 break;
455 case 17:
456 if (pix.IsExcluded())
457 return kFALSE;
458 val = pix.GetHiLoMeansDividedErr();
459 break;
460 case 18:
461 if (pix.IsExcluded())
462 return kFALSE;
463 val = pix.GetHiLoSigmasDivided();
464 break;
465 case 19:
466 if (pix.IsExcluded())
467 return kFALSE;
468 val = pix.GetHiLoSigmasDividedErr();
469 break;
470 case 20:
471 if (pix.IsExcluded())
472 val = 1.;
473 else
474 return kFALSE;
475 break;
476 case 21:
477 if (pix.IsExcluded())
478 return kFALSE;
479 val = pix.GetHiGainNumPickup();
480 break;
481 case 22:
482 if (pix.IsExcluded())
483 return kFALSE;
484 val = pix.GetLoGainNumPickup();
485 break;
486 case 23:
487 if (pix.IsExcluded())
488 return kFALSE;
489 val = pix.GetHiGainNumBlackout();
490 break;
491 case 24:
492 if (pix.IsExcluded())
493 return kFALSE;
494 val = pix.GetLoGainNumBlackout();
495 break;
496 case 25:
497 if (pix.IsExcluded())
498 return kFALSE;
499 val = pix.IsHiGainSaturation();
500 break;
501 case 26:
502 if (pix.IsExcluded())
503 return kFALSE;
504 val = pix.GetAbsTimeMean();
505 break;
506 case 27:
507 if (pix.IsExcluded())
508 return kFALSE;
509 val = pix.GetAbsTimeRms();
510 break;
511 case 28:
512 if (pix.IsExcluded())
513 return kFALSE;
514 val = pix.GetPed();
515 break;
516 case 29:
517 if (pix.IsExcluded())
518 return kFALSE;
519 val = pix.GetPedErr();
520 break;
521 case 30:
522 if (pix.IsExcluded())
523 return kFALSE;
524 val = pix.GetPedRms();
525 break;
526 case 31:
527 if (pix.IsExcluded())
528 return kFALSE;
529 val = pix.GetPedErr()/2.;
530 break;
531 default:
532 return kFALSE;
533 }
534
535 return val!=-1.;
536}
537
538// --------------------------------------------------------------------------
539//
540// Calls MCalibrationChargePix::DrawClone()
541//
542void MCalibrationChargeCam::DrawPixelContent(Int_t idx) const
543{
544 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[idx];
545 pix.DrawClone();
546}
547
548
549
550Bool_t MCalibrationChargeCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &ffactor)
551{
552
553 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx];
554
555 Float_t conv = pix.GetMeanConvFADC2Phe();
556
557 if (conv < 0.)
558 return kFALSE;
559
560 mean = conv;
561 err = pix.GetMeanConvFADC2PheErr();
562 ffactor = pix.GetMeanFFactorFADC2Phot();
563
564 return kTRUE;
565}
566
567
568// --------------------------------------------------------------------------
569//
570// Calculates the average conversion factor FADC counts to photons for pixel sizes.
571// The geometry container is used to get the necessary
572// geometry information (area index). The MCalibrationQECam container is necessary for
573// the quantum efficiency information.
574// If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
575// in the calculation of the size average.
576//
577// Returns a TArrayF of dimension 2:
578// arr[0]: averaged conversion factors (default: -1.)
579// arr[1]: Error (rms) of averaged conversion factors (default: 0.)
580//
581// ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY
582//
583TArrayF *MCalibrationChargeCam::GetAveragedConvFADC2PhotPerArea ( const MGeomCam &geom, const MCalibrationQECam &qecam,
584 const UInt_t ai, MBadPixelsCam *bad)
585{
586
587 const Int_t np = GetSize();
588
589 Double_t mean = 0.;
590 Double_t mean2 = 0.;
591 Int_t nr = 0;
592
593 for (int i=0; i<np; i++)
594 {
595 if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
596 continue;
597
598 const UInt_t aidx = geom[i].GetAidx();
599
600 if (ai != aidx)
601 continue;
602
603 const MCalibrationQEPix &qepix = (MCalibrationQEPix&)qecam[i];
604 if (!qepix.IsAverageQECombinedAvailable())
605 continue;
606
607 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
608 const Float_t conv = pix.GetMeanConvFADC2Phe();
609 const Float_t qe = qepix.GetQECascadesCombined();
610
611 mean += conv/qe;
612 mean2 += conv*conv/qe/qe;
613 nr ++;
614
615 }
616
617 TArrayF *arr = new TArrayF(2);
618 arr->AddAt(nr ? mean/nr : -1.,0);
619 arr->AddAt(nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0. ,1);
620
621 return arr;
622}
623
624// --------------------------------------------------------------------------
625//
626// Calculates the average conversion factor FADC counts to photons for camera sectors.
627// The geometry container is used to get the necessary
628// geometry information (area index). The MCalibrationQECam container is necessary for
629// the quantum efficiency information.
630// If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
631// in the calculation of the size average.
632//
633// Returns a TArrayF of dimension 2:
634// arr[0]: averaged conversion factors (default: -1.)
635// arr[1]: Error (rms) of averaged conversion factors (default: 0.)
636//
637// ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY
638//
639TArrayF *MCalibrationChargeCam::GetAveragedConvFADC2PhotPerSector( const MGeomCam &geom, const MCalibrationQECam &qecam,
640 const UInt_t sec, MBadPixelsCam *bad)
641{
642 const Int_t np = GetSize();
643
644 Double_t mean = 0.;
645 Double_t mean2 = 0.;
646 Int_t nr = 0;
647
648 for (int i=0; i<np; i++)
649 {
650 if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
651 continue;
652
653 const UInt_t sector = geom[i].GetSector();
654
655 if (sector != sec)
656 continue;
657
658 const MCalibrationQEPix &qepix = (MCalibrationQEPix&)qecam[i];
659 if (!qepix.IsAverageQECombinedAvailable())
660 continue;
661
662 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
663 const Float_t conv = pix.GetMeanConvFADC2Phe();
664 const Float_t qe = qepix.GetQECascadesCombined();
665
666 mean += conv/qe;
667 mean2 += conv*conv/qe/qe;
668 nr ++;
669
670 }
671
672 TArrayF *arr = new TArrayF(2);
673 arr->AddAt(nr ? mean/nr : -1.,0);
674 arr->AddAt(nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0. ,1);
675
676 return arr;
677}
678
679// --------------------------------------------------------------------------
680//
681// Calculates the average mean arrival times for pixel sizes.
682// The geometry container is used to get the necessary
683// geometry information (area index).
684// If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
685// in the calculation of the size average.
686//
687// Returns a TArrayF of dimension 2:
688// arr[0]: averaged mean arrival times (default: -1.)
689// arr[1]: Error (rms) of averaged mean arrival times (default: 0.)
690//
691// ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY
692//
693TArrayF *MCalibrationChargeCam::GetAveragedArrivalTimeMeanPerArea ( const MGeomCam &geom,
694 const UInt_t ai, MBadPixelsCam *bad)
695{
696
697 const Int_t np = GetSize();
698
699 Double_t mean = 0.;
700 Double_t mean2 = 0.;
701 Int_t nr = 0;
702
703 for (int i=0; i<np; i++)
704 {
705 if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
706 continue;
707
708 const UInt_t aidx = geom[i].GetAidx();
709
710 if (ai != aidx)
711 continue;
712
713 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
714 const Float_t time = pix.GetAbsTimeMean();
715
716 mean += time ;
717 mean2 += time*time;
718 nr ++;
719
720 }
721
722 TArrayF *arr = new TArrayF(2);
723 arr->AddAt(nr ? mean/nr : -1.,0);
724 arr->AddAt(nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0. ,1);
725
726 return arr;
727}
728
729// --------------------------------------------------------------------------
730//
731// Calculates the average mean arrival times for camera sectors.
732// The geometry container is used to get the necessary
733// geometry information (area index).
734// If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
735// in the calculation of the size average.
736//
737// Returns a TArrayF of dimension 2:
738// arr[0]: averaged mean arrival times (default: -1.)
739// arr[1]: Error (rms) of averaged mean arrival times (default: 0.)
740//
741// ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY
742//
743TArrayF *MCalibrationChargeCam::GetAveragedArrivalTimeMeanPerSector( const MGeomCam &geom,
744 const UInt_t sec, MBadPixelsCam *bad)
745{
746 const Int_t np = GetSize();
747
748 Double_t mean = 0.;
749 Double_t mean2 = 0.;
750 Int_t nr = 0;
751
752 for (int i=0; i<np; i++)
753 {
754 if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
755 continue;
756
757 const UInt_t sector = geom[i].GetSector();
758
759 if (sector != sec)
760 continue;
761
762 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
763 const Float_t time = pix.GetAbsTimeMean();
764
765 mean += time;
766 mean2 += time*time;
767 nr ++;
768
769 }
770
771 TArrayF *arr = new TArrayF(2);
772 arr->AddAt(nr ? mean/nr : -1.,0);
773 arr->AddAt(nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0. ,1);
774
775 return arr;
776}
777
778// --------------------------------------------------------------------------
779//
780// Calculates the average arrival time RMSs for pixel sizes.
781// The geometry container is used to get the necessary
782// geometry information (area index).
783// If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
784// in the calculation of the size average.
785//
786// Returns a TArrayF of dimension 2:
787// arr[0]: averaged arrival time RMSs (default: -1.)
788// arr[1]: Error (rms) of averaged arrival time RMSs (default: 0.)
789//
790// ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY
791//
792TArrayF *MCalibrationChargeCam::GetAveragedArrivalTimeRmsPerArea ( const MGeomCam &geom,
793 const UInt_t ai, MBadPixelsCam *bad)
794{
795
796 const Int_t np = GetSize();
797
798 Double_t mean = 0.;
799 Double_t mean2 = 0.;
800 Int_t nr = 0;
801
802 for (int i=0; i<np; i++)
803 {
804 if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
805 continue;
806
807 const UInt_t aidx = geom[i].GetAidx();
808
809 if (ai != aidx)
810 continue;
811
812 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
813 const Float_t rms = pix.GetAbsTimeRms();
814
815 mean += rms;
816 mean2 += rms*rms;
817 nr ++;
818
819 }
820
821 TArrayF *arr = new TArrayF(2);
822 arr->AddAt(nr ? mean/nr : -1.,0);
823 arr->AddAt(nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0. ,1);
824
825 return arr;
826}
827
828// --------------------------------------------------------------------------
829//
830// Calculates the average arrival time RMSs for camera sectors.
831// The geometry container is used to get the necessary
832// geometry information (area index).
833// If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
834// in the calculation of the size average.
835//
836// Returns a TArrayF of dimension 2:
837// arr[0]: averaged arrival time RMSs (default: -1.)
838// arr[1]: Error (rms) of averaged arrival time RMSs (default: 0.)
839//
840// ATTENTION: THE USER HAS TO DELETE THE RETURNED TARRAYF ACCORDINGLY
841//
842TArrayF *MCalibrationChargeCam::GetAveragedArrivalTimeRmsPerSector( const MGeomCam &geom, const UInt_t sec, MBadPixelsCam *bad)
843{
844 const Int_t np = GetSize();
845
846 Double_t mean = 0.;
847 Double_t mean2 = 0.;
848 Int_t nr = 0;
849
850 for (int i=0; i<np; i++)
851 {
852 if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
853 continue;
854
855 const UInt_t sector = geom[i].GetSector();
856
857 if (sector != sec)
858 continue;
859
860 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
861 const Float_t rms = pix.GetAbsTimeRms();
862
863 mean += rms;
864 mean2 += rms*rms;
865 nr ++;
866 }
867
868 TArrayF *arr = new TArrayF(2);
869 arr->AddAt(nr ? mean/nr : -1.,0);
870 arr->AddAt(nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0. ,1);
871
872 return arr;
873}
Note: See TracBrowser for help on using the repository browser.