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