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

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