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