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 | #include <TH1D.h>
|
---|
87 | #include <TF1.h>
|
---|
88 |
|
---|
89 | #include "MLog.h"
|
---|
90 | #include "MLogManip.h"
|
---|
91 |
|
---|
92 | #include "MGeomCam.h"
|
---|
93 | #include "MGeomPix.h"
|
---|
94 |
|
---|
95 | #include "MBadPixelsCam.h"
|
---|
96 | #include "MBadPixelsPix.h"
|
---|
97 |
|
---|
98 | #include "MCalibrationQECam.h"
|
---|
99 | #include "MCalibrationQEPix.h"
|
---|
100 |
|
---|
101 | #include "MHCamera.h"
|
---|
102 |
|
---|
103 | ClassImp(MCalibrationChargeCam);
|
---|
104 |
|
---|
105 | using namespace std;
|
---|
106 | // --------------------------------------------------------------------------
|
---|
107 | //
|
---|
108 | // Default constructor.
|
---|
109 | //
|
---|
110 | // Calls:
|
---|
111 | // - Clear()
|
---|
112 | //
|
---|
113 | MCalibrationChargeCam::MCalibrationChargeCam(const char *name, const char *title)
|
---|
114 | {
|
---|
115 | fName = name ? name : "MCalibrationChargeCam";
|
---|
116 | fTitle = title ? title : "Storage container for the Calibration Information in the camera";
|
---|
117 |
|
---|
118 | Clear();
|
---|
119 | }
|
---|
120 |
|
---|
121 | /*
|
---|
122 | // --------------------------------------------------------------------------
|
---|
123 | //
|
---|
124 | // Creates new MCalibrationCam only for the averaged areas:
|
---|
125 | // the rest has to be retrieved directly, e.g. via:
|
---|
126 | //
|
---|
127 | TObject *MCalibrationChargeCam::Clone(const char *) const
|
---|
128 | {
|
---|
129 |
|
---|
130 | //
|
---|
131 | // FIXME, this might be done faster and more elegant, by direct copy.
|
---|
132 | //
|
---|
133 | MCalibrationChargeCam *cam = new MCalibrationChargeCam(fName,fTitle);
|
---|
134 |
|
---|
135 | cam->fNumUnsuitable = fNumUnsuitable;
|
---|
136 | cam->fNumUnreliable = fNumUnreliable;
|
---|
137 | cam->fNumHiGainFADCSlices = fNumHiGainFADCSlices;
|
---|
138 | cam->fNumLoGainFADCSlices = fNumLoGainFADCSlices;
|
---|
139 | cam->fPulserColor = fPulserColor;
|
---|
140 |
|
---|
141 | cam->fFlags = fFlags;
|
---|
142 |
|
---|
143 | cam->fNumPhotonsBlindPixelMethod = fNumPhotonsBlindPixelMethod;
|
---|
144 | cam->fNumPhotonsFFactorMethod = fNumPhotonsFFactorMethod;
|
---|
145 | cam->fNumPhotonsPINDiodeMethod = fNumPhotonsPINDiodeMethod;
|
---|
146 | cam->fNumPhotonsBlindPixelMethodErr = fNumPhotonsBlindPixelMethodErr;
|
---|
147 | cam->fNumPhotonsFFactorMethodErr = fNumPhotonsFFactorMethodErr;
|
---|
148 | cam->fNumPhotonsPINDiodeMethodErr = fNumPhotonsPINDiodeMethodErr;
|
---|
149 |
|
---|
150 | for (Int_t i=0; i<GetSize(); i++)
|
---|
151 | cam->fPixels->AddAt((*this)[i].Clone(),i);
|
---|
152 |
|
---|
153 | for (Int_t i=0; i<GetAverageAreas(); i++)
|
---|
154 | {
|
---|
155 | cam->fAverageAreas->AddAt(GetAverageArea(i).Clone(),i);
|
---|
156 | cam->fAverageBadAreas->AddAt(GetAverageBadArea(i).Clone(),i);
|
---|
157 | }
|
---|
158 | for (Int_t i=0; i<GetAverageSectors(); i++)
|
---|
159 | {
|
---|
160 | cam->fAverageSectors->AddAt(GetAverageSector(i).Clone(),i);
|
---|
161 | cam->fAverageBadSectors->AddAt(GetAverageBadSector(i).Clone(),i);
|
---|
162 | }
|
---|
163 |
|
---|
164 | return cam;
|
---|
165 | }
|
---|
166 | */
|
---|
167 |
|
---|
168 | // -------------------------------------------------------------------
|
---|
169 | //
|
---|
170 | // Add MCalibrationChargePix's in the ranges from - to to fPixels
|
---|
171 | //
|
---|
172 | void MCalibrationChargeCam::Add(const UInt_t a, const UInt_t b)
|
---|
173 | {
|
---|
174 | for (UInt_t i=a; i<b; i++)
|
---|
175 | {
|
---|
176 | fPixels->AddAt(new MCalibrationChargePix,i);
|
---|
177 | (*this)[i].SetPixId(i);
|
---|
178 | }
|
---|
179 | }
|
---|
180 |
|
---|
181 | // -------------------------------------------------------------------
|
---|
182 | //
|
---|
183 | // Add MCalibrationChargePix's in the ranges from - to to fAverageAreas
|
---|
184 | //
|
---|
185 | void MCalibrationChargeCam::AddArea(const UInt_t a, const UInt_t b)
|
---|
186 | {
|
---|
187 | for (UInt_t i=a; i<b; i++)
|
---|
188 | {
|
---|
189 | fAverageAreas->AddAt(new MCalibrationChargePix,i);
|
---|
190 | GetAverageArea(i).SetPixId(i);
|
---|
191 | }
|
---|
192 | }
|
---|
193 |
|
---|
194 | // -------------------------------------------------------------------
|
---|
195 | //
|
---|
196 | // Add MCalibrationChargePix's in the ranges from - to to fAverageSectors
|
---|
197 | //
|
---|
198 | void MCalibrationChargeCam::AddSector(const UInt_t a, const UInt_t b)
|
---|
199 | {
|
---|
200 | for (UInt_t i=a; i<b; i++)
|
---|
201 | {
|
---|
202 | fAverageSectors->AddAt(new MCalibrationChargePix,i);
|
---|
203 | GetAverageSector(i).SetPixId(i);
|
---|
204 | }
|
---|
205 | }
|
---|
206 |
|
---|
207 |
|
---|
208 | // --------------------------------------
|
---|
209 | //
|
---|
210 | // Sets all variable to 0.
|
---|
211 | // Sets all flags to kFALSE
|
---|
212 | // Calls MCalibrationCam::Clear()
|
---|
213 | //
|
---|
214 | void MCalibrationChargeCam::Clear(Option_t *o)
|
---|
215 | {
|
---|
216 |
|
---|
217 | SetFFactorMethodValid ( kFALSE );
|
---|
218 |
|
---|
219 | fNumPhotonsBlindPixelMethod = 0.;
|
---|
220 | fNumPhotonsFFactorMethod = 0.;
|
---|
221 | fNumPhotonsPINDiodeMethod = 0.;
|
---|
222 | fNumPhotonsBlindPixelMethodErr = 0.;
|
---|
223 | fNumPhotonsFFactorMethodErr = 0.;
|
---|
224 | fNumPhotonsPINDiodeMethodErr = 0.;
|
---|
225 |
|
---|
226 | MCalibrationCam::Clear();
|
---|
227 |
|
---|
228 | return;
|
---|
229 | }
|
---|
230 |
|
---|
231 | // -----------------------------------------------
|
---|
232 | //
|
---|
233 | // Sets the kFFactorMethodValid bit from outside
|
---|
234 | //
|
---|
235 | void MCalibrationChargeCam::SetFFactorMethodValid(const Bool_t b)
|
---|
236 | {
|
---|
237 | b ? SETBIT(fFlags, kFFactorMethodValid) : CLRBIT(fFlags, kFFactorMethodValid);
|
---|
238 | }
|
---|
239 |
|
---|
240 |
|
---|
241 | // --------------------------------------------------------------------------
|
---|
242 | //
|
---|
243 | // Test bit kFFactorMethodValid
|
---|
244 | //
|
---|
245 | Bool_t MCalibrationChargeCam::IsFFactorMethodValid() const
|
---|
246 | {
|
---|
247 | return TESTBIT(fFlags,kFFactorMethodValid);
|
---|
248 | }
|
---|
249 |
|
---|
250 | // --------------------------------------------------------------------------
|
---|
251 | //
|
---|
252 | // Copy High-gain vs. low-gain conversion factors from cam to this.
|
---|
253 | //
|
---|
254 | Bool_t MCalibrationChargeCam::MergeHiLoConversionFactors(const MCalibrationChargeCam &cam) const
|
---|
255 | {
|
---|
256 |
|
---|
257 | if (GetSize() != cam.GetSize())
|
---|
258 | {
|
---|
259 | *fLog << warn << "Sizes mismatch! Cannot merge high-gain vs. low-gain convertion factors" << endl;
|
---|
260 | return kFALSE;
|
---|
261 | }
|
---|
262 |
|
---|
263 | for (Int_t i=0; i<GetSize(); i++)
|
---|
264 | {
|
---|
265 | ((MCalibrationChargePix&)(*this)[i]).SetConversionHiLo (((MCalibrationChargePix&)cam[i]).GetConversionHiLo());
|
---|
266 | ((MCalibrationChargePix&)(*this)[i]).SetConversionHiLoErr(((MCalibrationChargePix&)cam[i]).GetConversionHiLoErr());
|
---|
267 | }
|
---|
268 |
|
---|
269 | return kTRUE;
|
---|
270 | }
|
---|
271 |
|
---|
272 | // --------------------------------------------------------------------------
|
---|
273 | //
|
---|
274 | // Print first the well fitted pixels
|
---|
275 | // and then the ones which are not FitValid
|
---|
276 | //
|
---|
277 | void MCalibrationChargeCam::Print(Option_t *o) const
|
---|
278 | {
|
---|
279 |
|
---|
280 | *fLog << all << GetDescriptor() << ":" << endl;
|
---|
281 | int id = 0;
|
---|
282 |
|
---|
283 | *fLog << all << "Calibrated pixels:" << endl;
|
---|
284 | *fLog << all << endl;
|
---|
285 |
|
---|
286 | TIter Next(fPixels);
|
---|
287 | MCalibrationChargePix *pix;
|
---|
288 | while ((pix=(MCalibrationChargePix*)Next()))
|
---|
289 | {
|
---|
290 |
|
---|
291 | if (pix->IsFFactorMethodValid())
|
---|
292 | {
|
---|
293 |
|
---|
294 | *fLog << all
|
---|
295 | << Form("%s%3i","Pixel: ",pix->GetPixId())
|
---|
296 | << Form("%s%4.2f%s%4.2f"," Ped.Rms: ",pix->GetPedRms(),"+-",pix->GetPedRmsErr())
|
---|
297 | << Form("%s%4.2f%s%4.2f"," Charge: " ,pix->GetConvertedMean(),"+-",pix->GetConvertedSigma())
|
---|
298 | << Form("%s%4.2f%s%4.2f"," Red.Sigma: ",pix->GetConvertedRSigma(),"+-",pix->GetConvertedRSigmaErr())
|
---|
299 | << Form("%s%4.2f%s%4.2f"," Num.Phes: ",pix->GetPheFFactorMethod(),"+-",pix->GetPheFFactorMethodErr())
|
---|
300 | << Form("%s%4.2f%s%4.2f"," Conv.FADC2Phe: ",pix->GetMeanConvFADC2Phe(),"+-",pix->GetMeanConvFADC2PheErr())
|
---|
301 | << " Saturated? :" << pix->IsHiGainSaturation()
|
---|
302 | << Form("%s%4.2f%s%4.2f"," Conv.HiLo: ",pix->GetConversionHiLo(),"+-",pix->GetConversionHiLoErr())
|
---|
303 | << endl;
|
---|
304 | id++;
|
---|
305 | }
|
---|
306 | }
|
---|
307 |
|
---|
308 | *fLog << all << id << " pixels" << endl;
|
---|
309 | id = 0;
|
---|
310 |
|
---|
311 |
|
---|
312 | *fLog << all << endl;
|
---|
313 | *fLog << all << "Previously Excluded pixels:" << endl;
|
---|
314 | *fLog << all << endl;
|
---|
315 |
|
---|
316 | id = 0;
|
---|
317 |
|
---|
318 | TIter Next4(fPixels);
|
---|
319 | while ((pix=(MCalibrationChargePix*)Next4()))
|
---|
320 | {
|
---|
321 | if (pix->IsExcluded())
|
---|
322 | {
|
---|
323 | *fLog << all << pix->GetPixId() << " ";
|
---|
324 | id++;
|
---|
325 |
|
---|
326 | if (!(id % 25))
|
---|
327 | *fLog << endl;
|
---|
328 | }
|
---|
329 | }
|
---|
330 |
|
---|
331 | *fLog << all << endl;
|
---|
332 | *fLog << all << "New Excluded pixels:" << endl;
|
---|
333 | *fLog << all << endl;
|
---|
334 |
|
---|
335 | TIter Next5(fPixels);
|
---|
336 | while ((pix=(MCalibrationChargePix*)Next5()))
|
---|
337 | {
|
---|
338 | if (!pix->IsFFactorMethodValid() && !pix->IsExcluded())
|
---|
339 | {
|
---|
340 | *fLog << all << pix->GetPixId() << " ";
|
---|
341 | id++;
|
---|
342 |
|
---|
343 | if (!(id % 25))
|
---|
344 | *fLog << endl;
|
---|
345 | }
|
---|
346 | }
|
---|
347 |
|
---|
348 | *fLog << endl;
|
---|
349 | *fLog << all << id << " Excluded pixels " << endl;
|
---|
350 | *fLog << endl;
|
---|
351 |
|
---|
352 | *fLog << all << endl;
|
---|
353 | *fLog << all << "Averaged Areas:" << endl;
|
---|
354 | *fLog << all << endl;
|
---|
355 |
|
---|
356 | TIter Next6(fAverageAreas);
|
---|
357 | while ((pix=(MCalibrationChargePix*)Next6()))
|
---|
358 | {
|
---|
359 | *fLog << all << Form("%s%3i","Area Idx: ",pix->GetPixId())
|
---|
360 | << " Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr()
|
---|
361 | << " Mean signal: " << pix->GetMean() << " +- " << pix->GetMeanErr()
|
---|
362 | << " Sigma signal: " << pix->GetSigma() << " +- "<< pix->GetSigmaErr()
|
---|
363 | << " Reduced Sigma: " << pix->GetRSigma()
|
---|
364 | << " Nr Phe's: " << pix->GetPheFFactorMethod()
|
---|
365 | << endl;
|
---|
366 | }
|
---|
367 |
|
---|
368 | *fLog << all << endl;
|
---|
369 | *fLog << all << "Averaged Sectors:" << endl;
|
---|
370 | *fLog << all << endl;
|
---|
371 |
|
---|
372 | TIter Next7(fAverageSectors);
|
---|
373 | while ((pix=(MCalibrationChargePix*)Next7()))
|
---|
374 | {
|
---|
375 | *fLog << all << Form("%s%3i","Sector: ",pix->GetPixId())
|
---|
376 | << " Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr()
|
---|
377 | << " Mean signal: " << pix->GetMean() << " +- " << pix->GetMeanErr()
|
---|
378 | << " Sigma signal: " << pix->GetSigma() << " +- "<< pix->GetSigmaErr()
|
---|
379 | << " Reduced Sigma: " << pix->GetRSigma()
|
---|
380 | << " Nr Phe's: " << pix->GetPheFFactorMethod()
|
---|
381 | << endl;
|
---|
382 | }
|
---|
383 | *fLog << all << endl;
|
---|
384 | }
|
---|
385 |
|
---|
386 |
|
---|
387 | // --------------------------------------------------------------------------
|
---|
388 | //
|
---|
389 | // The types are as follows:
|
---|
390 | //
|
---|
391 | // Fitted values:
|
---|
392 | // ==============
|
---|
393 | //
|
---|
394 | // 0: Fitted Charge (see MCalibrationPix::GetMean())
|
---|
395 | // 1: Error of fitted Charge (see MCalibrationPix::GetMeanErr())
|
---|
396 | // 2: Sigma of fitted Charge (see MCalibrationPix::GetSigma())
|
---|
397 | // 3: Error of Sigma of fitted Charge (see MCalibrationPix::GetSigmaErr())
|
---|
398 | //
|
---|
399 | // Useful variables derived from the fit results:
|
---|
400 | // =============================================
|
---|
401 | //
|
---|
402 | // 4: Probability Gauss fit Charge distribution (see MCalibrationPix::GetProb())
|
---|
403 | // 5: Reduced Sigma of fitted Charge (see MCalibrationChargePix::GetRSigma())
|
---|
404 | // 6: Error Reduced Sigma of fitted Charge (see MCalibrationChargePix::GetRSigmaErr())
|
---|
405 | // 7: Reduced Sigma per Charge (see MCalibrationChargePix::GetRSigmaPerCharge())
|
---|
406 | // 8: Error of Reduced Sigma per Charge (see MCalibrationChargePix::GetRSigmaPerChargeErr())
|
---|
407 | //
|
---|
408 | // Results of the F-Factor calibration Method:
|
---|
409 | // ===========================================
|
---|
410 | //
|
---|
411 | // 9: Nr. Photo-electrons from F-Factor Method (see MCalibrationChargePix::GetPheFFactorMethod())
|
---|
412 | // 10: Error Nr. Photo-el. from F-Factor Method (see MCalibrationChargePix::GetPheFFactorMethodErr())
|
---|
413 | // 11: Conversion factor from F-Factor Method (see MCalibrationChargePix::GetMeanConvFADC2Phe()
|
---|
414 | // 12: Error conv. factor from F-Factor Method (see MCalibrationChargePix::GetMeanConvFADC2PheErr()
|
---|
415 | // 13: Overall F-Factor from F-Factor Method (see MCalibrationChargePix::GetMeanFFactorFADC2Phot()
|
---|
416 | // 14: Error F-Factor from F-Factor Method (see MCalibrationChargePix::GetMeanFFactorFADC2PhotErr()
|
---|
417 | // 15: Pixels valid calibration F-Factor-Method (see MCalibrationChargePix::IsFFactorMethodValid())
|
---|
418 | //
|
---|
419 | // Results of the Low-Gain vs. High-Gain Conversion:
|
---|
420 | // =================================================
|
---|
421 | //
|
---|
422 | // 16: Mean Signal Hi-Gain / Mean Signal Lo-Gain (see MCalibrationPix::GetHiLoMeansDivided())
|
---|
423 | // 17: Error Signal High-Gain / Signal Low Gain (see MCalibrationPix::GetHiLoMeansDividedErr())
|
---|
424 | // 18: Sigma High-Gain / Sigma Low Gain (see MCalibrationPix::GetHiLoSigmasDivided())
|
---|
425 | // 19: Error Sigma High-Gain / Sigma Low Gain (see MCalibrationPix::GetHiLoSigmasDividedErr())
|
---|
426 | //
|
---|
427 | // Localized defects:
|
---|
428 | // ==================
|
---|
429 | //
|
---|
430 | // 20: Excluded Pixels
|
---|
431 | // 21: Number of pickup events in the Hi Gain (see MCalibrationPix::GetHiGainNumPickup())
|
---|
432 | // 22: Number of pickup events in the Lo Gain (see MCalibrationPix::GetLoGainNumPickup())
|
---|
433 | // 23: Number of blackout events in the Hi Gain (see MCalibrationPix::GetHiGainNumBlackout())
|
---|
434 | // 24: Number of blackout events in the Lo Gain (see MCalibrationPix::GetLoGainNumBlackout())
|
---|
435 | //
|
---|
436 | // Other classifications of pixels:
|
---|
437 | // ================================
|
---|
438 | //
|
---|
439 | // 25: Pixels with saturated High-Gain (see MCalibrationPix::IsHiGainSaturation())
|
---|
440 | //
|
---|
441 | // Calculated absolute arrival times (very low precision!):
|
---|
442 | // ========================================================
|
---|
443 | //
|
---|
444 | // 26: Absolute Arrival time of the signal (see MCalibrationChargePix::GetAbsTimeMean())
|
---|
445 | // 27: RMS Ab. Arrival time of the signal (see MCalibrationChargePix::GetAbsTimeRms())
|
---|
446 | //
|
---|
447 | // Used Pedestals:
|
---|
448 | // ===============
|
---|
449 | //
|
---|
450 | // 28: Pedestal for entire signal extr. range (see MCalibrationChargePix::Ped())
|
---|
451 | // 29: Error Pedestal entire signal extr. range (see MCalibrationChargePix::PedErr())
|
---|
452 | // 30: Ped. RMS entire signal extraction range (see MCalibrationChargePix::PedRms())
|
---|
453 | // 31: Error Ped. RMS entire signal extr. range (see MCalibrationChargePix::PedRmsErr())
|
---|
454 | //
|
---|
455 | // Special variables (for data check):
|
---|
456 | // ====================================
|
---|
457 | //
|
---|
458 | // 32: HiGain RMS divided by Mean for every pixel (with inclusion of the excluded pixels)
|
---|
459 | //
|
---|
460 | Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
461 | {
|
---|
462 |
|
---|
463 | if (idx > GetSize())
|
---|
464 | return kFALSE;
|
---|
465 |
|
---|
466 | Float_t area = cam[idx].GetA();
|
---|
467 |
|
---|
468 | if (area == 0)
|
---|
469 | return kFALSE;
|
---|
470 |
|
---|
471 | MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[idx];
|
---|
472 |
|
---|
473 | switch (type)
|
---|
474 | {
|
---|
475 | case 0:
|
---|
476 | if (pix.IsExcluded())
|
---|
477 | return kFALSE;
|
---|
478 | val = pix.GetConvertedMean();
|
---|
479 | break;
|
---|
480 | case 1:
|
---|
481 | if (pix.IsExcluded())
|
---|
482 | return kFALSE;
|
---|
483 | val = pix.GetConvertedMeanErr();
|
---|
484 | break;
|
---|
485 | case 2:
|
---|
486 | if (pix.IsExcluded())
|
---|
487 | return kFALSE;
|
---|
488 | val = pix.GetConvertedSigma();
|
---|
489 | break;
|
---|
490 | case 3:
|
---|
491 | if (pix.IsExcluded())
|
---|
492 | return kFALSE;
|
---|
493 | val = pix.GetConvertedSigmaErr();
|
---|
494 | break;
|
---|
495 | case 4:
|
---|
496 | if (pix.IsExcluded())
|
---|
497 | return kFALSE;
|
---|
498 | val = pix.GetProb();
|
---|
499 | break;
|
---|
500 | case 5:
|
---|
501 | if (!pix.IsFFactorMethodValid())
|
---|
502 | return kFALSE;
|
---|
503 | if (pix.GetRSigma() == -1.)
|
---|
504 | return kFALSE;
|
---|
505 | val = pix.GetConvertedRSigma();
|
---|
506 | break;
|
---|
507 | case 6:
|
---|
508 | if (!pix.IsFFactorMethodValid())
|
---|
509 | return kFALSE;
|
---|
510 | if (pix.GetRSigma() == -1.)
|
---|
511 | return kFALSE;
|
---|
512 | val = pix.GetConvertedRSigmaErr();
|
---|
513 | break;
|
---|
514 | case 7:
|
---|
515 | if (!pix.IsFFactorMethodValid())
|
---|
516 | return kFALSE;
|
---|
517 | val = pix.GetRSigmaPerCharge();
|
---|
518 | break;
|
---|
519 | case 8:
|
---|
520 | if (!pix.IsFFactorMethodValid())
|
---|
521 | return kFALSE;
|
---|
522 | val = pix.GetRSigmaPerChargeErr();
|
---|
523 | break;
|
---|
524 | case 9:
|
---|
525 | if (!pix.IsFFactorMethodValid())
|
---|
526 | return kFALSE;
|
---|
527 | val = pix.GetPheFFactorMethod();
|
---|
528 | break;
|
---|
529 | case 10:
|
---|
530 | if (!pix.IsFFactorMethodValid())
|
---|
531 | return kFALSE;
|
---|
532 | val = pix.GetPheFFactorMethodErr();
|
---|
533 | break;
|
---|
534 | case 11:
|
---|
535 | if (!pix.IsFFactorMethodValid())
|
---|
536 | return kFALSE;
|
---|
537 | val = pix.GetMeanConvFADC2Phe();
|
---|
538 | break;
|
---|
539 | case 12:
|
---|
540 | if (!pix.IsFFactorMethodValid())
|
---|
541 | return kFALSE;
|
---|
542 | val = pix.GetMeanConvFADC2PheErr();
|
---|
543 | break;
|
---|
544 | case 13:
|
---|
545 | if (!pix.IsFFactorMethodValid())
|
---|
546 | return kFALSE;
|
---|
547 | val = pix.GetMeanFFactorFADC2Phot();
|
---|
548 | break;
|
---|
549 | case 14:
|
---|
550 | if (!pix.IsFFactorMethodValid())
|
---|
551 | return kFALSE;
|
---|
552 | val = pix.GetMeanFFactorFADC2PhotErr();
|
---|
553 | break;
|
---|
554 | case 15:
|
---|
555 | if (pix.IsExcluded())
|
---|
556 | return kFALSE;
|
---|
557 | if (pix.IsFFactorMethodValid())
|
---|
558 | val = 1;
|
---|
559 | else
|
---|
560 | return kFALSE;
|
---|
561 | break;
|
---|
562 | case 16:
|
---|
563 | if (pix.IsExcluded())
|
---|
564 | return kFALSE;
|
---|
565 | val = pix.GetHiLoMeansDivided();
|
---|
566 | break;
|
---|
567 | case 17:
|
---|
568 | if (pix.IsExcluded())
|
---|
569 | return kFALSE;
|
---|
570 | val = pix.GetHiLoMeansDividedErr();
|
---|
571 | break;
|
---|
572 | case 18:
|
---|
573 | if (pix.IsExcluded())
|
---|
574 | return kFALSE;
|
---|
575 | val = pix.GetHiLoSigmasDivided();
|
---|
576 | break;
|
---|
577 | case 19:
|
---|
578 | if (pix.IsExcluded())
|
---|
579 | return kFALSE;
|
---|
580 | val = pix.GetHiLoSigmasDividedErr();
|
---|
581 | break;
|
---|
582 | case 20:
|
---|
583 | if (pix.IsExcluded())
|
---|
584 | val = 1.;
|
---|
585 | else
|
---|
586 | return kFALSE;
|
---|
587 | break;
|
---|
588 | case 21:
|
---|
589 | if (pix.IsExcluded())
|
---|
590 | return kFALSE;
|
---|
591 | val = pix.GetHiGainNumPickup();
|
---|
592 | break;
|
---|
593 | case 22:
|
---|
594 | if (pix.IsExcluded())
|
---|
595 | return kFALSE;
|
---|
596 | val = pix.GetLoGainNumPickup();
|
---|
597 | break;
|
---|
598 | case 23:
|
---|
599 | if (pix.IsExcluded())
|
---|
600 | return kFALSE;
|
---|
601 | val = pix.GetHiGainNumBlackout();
|
---|
602 | break;
|
---|
603 | case 24:
|
---|
604 | if (pix.IsExcluded())
|
---|
605 | return kFALSE;
|
---|
606 | val = pix.GetLoGainNumBlackout();
|
---|
607 | break;
|
---|
608 | case 25:
|
---|
609 | if (pix.IsExcluded())
|
---|
610 | return kFALSE;
|
---|
611 | val = pix.IsHiGainSaturation();
|
---|
612 | break;
|
---|
613 | case 26:
|
---|
614 | if (pix.IsExcluded())
|
---|
615 | return kFALSE;
|
---|
616 | val = pix.GetAbsTimeMean();
|
---|
617 | break;
|
---|
618 | case 27:
|
---|
619 | if (pix.IsExcluded())
|
---|
620 | return kFALSE;
|
---|
621 | val = pix.GetAbsTimeRms();
|
---|
622 | break;
|
---|
623 | case 28:
|
---|
624 | if (pix.IsExcluded())
|
---|
625 | return kFALSE;
|
---|
626 | val = pix.GetPed();
|
---|
627 | break;
|
---|
628 | case 29:
|
---|
629 | if (pix.IsExcluded())
|
---|
630 | return kFALSE;
|
---|
631 | val = pix.GetPedErr();
|
---|
632 | break;
|
---|
633 | case 30:
|
---|
634 | if (pix.IsExcluded())
|
---|
635 | return kFALSE;
|
---|
636 | val = pix.GetPedRms();
|
---|
637 | break;
|
---|
638 | case 31:
|
---|
639 | if (pix.IsExcluded())
|
---|
640 | return kFALSE;
|
---|
641 | val = pix.GetPedErr()/2.;
|
---|
642 | break;
|
---|
643 | case 32:
|
---|
644 | if (pix.IsExcluded())
|
---|
645 | return kFALSE;
|
---|
646 | val = pix.GetMean() == 0. ? 0. : pix.GetRms()/pix.GetMean();
|
---|
647 | break;
|
---|
648 | case 33:
|
---|
649 | if (pix.IsExcluded())
|
---|
650 | return kFALSE;
|
---|
651 | if (pix.GetMean() == 0.)
|
---|
652 | val = 0.;
|
---|
653 | else
|
---|
654 | val = pix.GetSigmaErr()/pix.GetMean() + pix.GetRms()/pix.GetMean()/pix.GetMean()*pix.GetMeanErr();
|
---|
655 | break;
|
---|
656 | default:
|
---|
657 | return kFALSE;
|
---|
658 | }
|
---|
659 |
|
---|
660 | return val!=-1.;
|
---|
661 | }
|
---|
662 |
|
---|
663 |
|
---|
664 | Bool_t MCalibrationChargeCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &ffactor)
|
---|
665 | {
|
---|
666 |
|
---|
667 | MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[ipx];
|
---|
668 |
|
---|
669 | Float_t conv = pix.GetMeanConvFADC2Phe();
|
---|
670 |
|
---|
671 | if (conv < 0.)
|
---|
672 | return kFALSE;
|
---|
673 |
|
---|
674 | mean = conv;
|
---|
675 | err = pix.GetMeanConvFADC2PheErr();
|
---|
676 | ffactor = pix.GetMeanFFactorFADC2Phot();
|
---|
677 |
|
---|
678 | return kTRUE;
|
---|
679 | }
|
---|
680 |
|
---|
681 |
|
---|
682 | // --------------------------------------------------------------------------
|
---|
683 | //
|
---|
684 | // Calculates the average conversion factor FADC counts to photons for pixel sizes.
|
---|
685 | // The geometry container is used to get the necessary
|
---|
686 | // geometry information (area index). The MCalibrationQECam container is necessary for
|
---|
687 | // the quantum efficiency information.
|
---|
688 | // If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
|
---|
689 | // in the calculation of the size average.
|
---|
690 | //
|
---|
691 | // Returns a TArrayF of dimension 2:
|
---|
692 | // arr[0]: averaged conversion factors (default: -1.)
|
---|
693 | // arr[1]: Error (rms) of averaged conversion factors (default: 0.)
|
---|
694 | //
|
---|
695 | TArrayF MCalibrationChargeCam::GetAveragedConvFADC2PhotPerArea ( const MGeomCam &geom, const MCalibrationQECam &qecam,
|
---|
696 | const UInt_t ai, MBadPixelsCam *bad)
|
---|
697 | {
|
---|
698 |
|
---|
699 | const Int_t np = GetSize();
|
---|
700 |
|
---|
701 | Double_t mean = 0.;
|
---|
702 | Double_t mean2 = 0.;
|
---|
703 | Int_t nr = 0;
|
---|
704 |
|
---|
705 | MHCamera convcam(geom,"ConvFactors","Conversion Factors;Conv Factor [phot/FADC cnts];channels");
|
---|
706 |
|
---|
707 | for (int i=0; i<np; i++)
|
---|
708 | {
|
---|
709 | if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
710 | continue;
|
---|
711 |
|
---|
712 | if (bad && (*bad)[i].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes))
|
---|
713 | continue;
|
---|
714 |
|
---|
715 | const UInt_t aidx = geom[i].GetAidx();
|
---|
716 |
|
---|
717 | if (ai != aidx)
|
---|
718 | continue;
|
---|
719 |
|
---|
720 | const MCalibrationQEPix &qepix = (MCalibrationQEPix&)qecam[i];
|
---|
721 | if (!qepix.IsAverageQEFFactorAvailable())
|
---|
722 | continue;
|
---|
723 |
|
---|
724 | const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
|
---|
725 | const Float_t conv = pix.GetMeanConvFADC2Phe()/qepix.GetQECascadesFFactor();
|
---|
726 |
|
---|
727 | mean += conv;
|
---|
728 | mean2 += conv*conv;
|
---|
729 | nr ++;
|
---|
730 |
|
---|
731 | convcam.Fill(i,conv);
|
---|
732 | convcam.SetUsed(i);
|
---|
733 | }
|
---|
734 |
|
---|
735 | Float_t mn = nr ? mean/nr : -1.;
|
---|
736 | Float_t sg = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0.;
|
---|
737 |
|
---|
738 | const Int_t aidx = (Int_t)ai;
|
---|
739 |
|
---|
740 | TH1D *h = convcam.ProjectionS(TArrayI(),TArrayI(1,&aidx),"_py",750);
|
---|
741 | h->SetDirectory(NULL);
|
---|
742 |
|
---|
743 | TF1 *fit = NULL;
|
---|
744 |
|
---|
745 | if (geom.InheritsFrom("MGeomCamMagic"))
|
---|
746 | {
|
---|
747 |
|
---|
748 | fit = new TF1("fit","gaus",0.4,5.);
|
---|
749 |
|
---|
750 | // Fix the ranges, as found by Nadia
|
---|
751 | if(aidx == 0)
|
---|
752 | {h->Fit("fit","REQ", "",0.4,1.5);}
|
---|
753 | else
|
---|
754 | {h->Fit("fit","REQ", "",1.,5.);}
|
---|
755 | }
|
---|
756 | else
|
---|
757 | {
|
---|
758 | h->Fit("gaus","Q");
|
---|
759 | fit = h->GetFunction("gaus");
|
---|
760 | }
|
---|
761 |
|
---|
762 | Float_t ci2 = fit->GetChisquare();
|
---|
763 | Float_t sigma = fit->GetParameter(2);
|
---|
764 |
|
---|
765 | if (ci2 > 500. || sigma > sg)
|
---|
766 | {
|
---|
767 | if (geom.InheritsFrom("MGeomCamMagic"))
|
---|
768 | {
|
---|
769 | // Fix the ranges, as found by Nadia
|
---|
770 | if(aidx == 0)
|
---|
771 | {h->Fit("fit","REQ", "",0.4,1.5);}
|
---|
772 | else
|
---|
773 | {h->Fit("fit","REQ", "",1.,5.);}
|
---|
774 | }
|
---|
775 | else
|
---|
776 | {
|
---|
777 | h->Fit("gaus","MREQ");
|
---|
778 | fit = h->GetFunction("gaus");
|
---|
779 | }
|
---|
780 |
|
---|
781 | ci2 = fit->GetChisquare();
|
---|
782 | sigma = fit->GetParameter(2);
|
---|
783 | }
|
---|
784 |
|
---|
785 | const Int_t ndf = fit->GetNDF();
|
---|
786 |
|
---|
787 | if (ci2 < 500. && sigma < sg && ndf > 2)
|
---|
788 | {
|
---|
789 | mn = fit->GetParameter(1);
|
---|
790 | sg = sigma;
|
---|
791 | }
|
---|
792 |
|
---|
793 | *fLog << inf << "Conversion Factors to photons area idx: " << aidx << ":" << endl;
|
---|
794 | *fLog << inf << "Mean: " << Form("%4.3f",mn)
|
---|
795 | << "+-" << Form("%4.3f",fit->GetParError(1))
|
---|
796 | << " Sigma: " << Form("%4.3f",sg) << "+-" << Form("%4.3f",fit->GetParError(2))
|
---|
797 | << " Chisquare: " << Form("%4.3f",fit->GetChisquare()) << " NDF : " << ndf << endl;
|
---|
798 |
|
---|
799 | delete fit;
|
---|
800 | delete h;
|
---|
801 | gROOT->GetListOfFunctions()->Remove(fit);
|
---|
802 |
|
---|
803 | TArrayF arr(2);
|
---|
804 | arr[0] = mn;
|
---|
805 | arr[1] = sg;
|
---|
806 |
|
---|
807 | return arr;
|
---|
808 | }
|
---|
809 |
|
---|
810 | // --------------------------------------------------------------------------
|
---|
811 | //
|
---|
812 | // Calculates the average conversion factor FADC counts to equiv. photo-electrons for pixel sizes.
|
---|
813 | // The geometry container is used to get the necessary
|
---|
814 | // geometry information (area index). The MCalibrationQECam container is necessary for
|
---|
815 | // the quantum efficiency information.
|
---|
816 | // If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
|
---|
817 | // in the calculation of the size average.
|
---|
818 | //
|
---|
819 | // Returns a TArrayF of dimension 2:
|
---|
820 | // arr[0]: averaged conversion factors (default: -1.)
|
---|
821 | // arr[1]: Error (rms) of averaged conversion factors (default: 0.)
|
---|
822 | //
|
---|
823 | TArrayF MCalibrationChargeCam::GetAveragedConvFADC2PhePerArea ( const MGeomCam &geom, const MCalibrationQECam &qecam,
|
---|
824 | const UInt_t ai, MBadPixelsCam *bad)
|
---|
825 | {
|
---|
826 |
|
---|
827 | const Int_t np = GetSize();
|
---|
828 |
|
---|
829 | Double_t mean = 0.;
|
---|
830 | Double_t mean2 = 0.;
|
---|
831 | Int_t nr = 0;
|
---|
832 |
|
---|
833 | MHCamera convcam(geom,"ConvFactors","Conversion Factors;Conv Factor [phe/FADC cnts];channels");
|
---|
834 |
|
---|
835 | for (int i=0; i<np; i++)
|
---|
836 | {
|
---|
837 | if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
838 | continue;
|
---|
839 |
|
---|
840 | if (bad && (*bad)[i].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes))
|
---|
841 | continue;
|
---|
842 |
|
---|
843 | const UInt_t aidx = geom[i].GetAidx();
|
---|
844 |
|
---|
845 | if (ai != aidx)
|
---|
846 | continue;
|
---|
847 |
|
---|
848 | const MCalibrationQEPix &qepix = (MCalibrationQEPix&)qecam[i];
|
---|
849 | if (!qepix.IsAverageQEFFactorAvailable())
|
---|
850 | continue;
|
---|
851 |
|
---|
852 | const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
|
---|
853 | const Float_t conv = pix.GetMeanConvFADC2Phe()/qepix.GetQECascadesFFactor()*MCalibrationQEPix::gkDefaultAverageQE;
|
---|
854 |
|
---|
855 | mean += conv;
|
---|
856 | mean2 += conv*conv;
|
---|
857 | nr ++;
|
---|
858 |
|
---|
859 | convcam.Fill(i,conv);
|
---|
860 | convcam.SetUsed(i);
|
---|
861 | }
|
---|
862 |
|
---|
863 | Float_t mn = nr ? mean/nr : -1.;
|
---|
864 | Float_t sg = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0.;
|
---|
865 |
|
---|
866 | const Int_t aidx = (Int_t)ai;
|
---|
867 |
|
---|
868 | TH1D *h = convcam.ProjectionS(TArrayI(),TArrayI(1,&aidx),"_py",750);
|
---|
869 | h->SetDirectory(NULL);
|
---|
870 |
|
---|
871 | TF1 *fit = NULL;
|
---|
872 |
|
---|
873 | if (geom.InheritsFrom("MGeomCamMagic"))
|
---|
874 | {
|
---|
875 |
|
---|
876 | fit = new TF1("fit","gaus",0.01,1.);
|
---|
877 |
|
---|
878 | // Fix the ranges, as found by Nadia
|
---|
879 | if(aidx == 0)
|
---|
880 | {h->Fit("fit","REQ", "",0.07,0.3);}
|
---|
881 | else
|
---|
882 | {h->Fit("fit","REQ", "",0.15,1.0);}
|
---|
883 | }
|
---|
884 | else
|
---|
885 | {
|
---|
886 | h->Fit("gaus","Q");
|
---|
887 | fit = h->GetFunction("gaus");
|
---|
888 | }
|
---|
889 |
|
---|
890 | Float_t ci2 = fit->GetChisquare();
|
---|
891 | Float_t sigma = fit->GetParameter(2);
|
---|
892 |
|
---|
893 | if (ci2 > 500. || sigma > sg)
|
---|
894 | {
|
---|
895 | if (geom.InheritsFrom("MGeomCamMagic"))
|
---|
896 | {
|
---|
897 | // Fix the ranges, as found by Nadia
|
---|
898 | if(aidx == 0)
|
---|
899 | {h->Fit("fit","REQ", "",0.07,0.3);}
|
---|
900 | else
|
---|
901 | {h->Fit("fit","REQ", "",0.15,1.0);}
|
---|
902 | }
|
---|
903 | else
|
---|
904 | {
|
---|
905 | h->Fit("gaus","MREQ");
|
---|
906 | fit = h->GetFunction("gaus");
|
---|
907 | }
|
---|
908 |
|
---|
909 | ci2 = fit->GetChisquare();
|
---|
910 | sigma = fit->GetParameter(2);
|
---|
911 | }
|
---|
912 |
|
---|
913 | const Int_t ndf = fit->GetNDF();
|
---|
914 |
|
---|
915 | if (ci2 < 500. && sigma < sg && ndf > 2)
|
---|
916 | {
|
---|
917 | mn = fit->GetParameter(1);
|
---|
918 | sg = sigma;
|
---|
919 | }
|
---|
920 |
|
---|
921 | *fLog << inf << "Conversion Factors to equiv. photo-electrons area idx: " << aidx << ":" << endl;
|
---|
922 | *fLog << inf << "Mean: " << Form("%4.3f",mn)
|
---|
923 | << "+-" << Form("%4.3f",fit->GetParError(1))
|
---|
924 | << " Sigma: " << Form("%4.3f",sg) << "+-" << Form("%4.3f",fit->GetParError(2))
|
---|
925 | << " Chisquare: " << Form("%4.3f",fit->GetChisquare()) << " NDF : " << ndf << endl;
|
---|
926 |
|
---|
927 | delete fit;
|
---|
928 | delete h;
|
---|
929 | gROOT->GetListOfFunctions()->Remove(fit);
|
---|
930 |
|
---|
931 | TArrayF arr(2);
|
---|
932 | arr[0] = mn;
|
---|
933 | arr[1] = sg;
|
---|
934 |
|
---|
935 | return arr;
|
---|
936 | }
|
---|
937 |
|
---|
938 | // --------------------------------------------------------------------------
|
---|
939 | //
|
---|
940 | // Calculates the average conversion factor FADC counts to photons for camera sectors.
|
---|
941 | // The geometry container is used to get the necessary
|
---|
942 | // geometry information (area index). The MCalibrationQECam container is necessary for
|
---|
943 | // the quantum efficiency information.
|
---|
944 | // If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
|
---|
945 | // in the calculation of the size average.
|
---|
946 | //
|
---|
947 | // Returns a TArrayF of dimension 2:
|
---|
948 | // arr[0]: averaged conversion factors (default: -1.)
|
---|
949 | // arr[1]: Error (rms) of averaged conversion factors (default: 0.)
|
---|
950 | //
|
---|
951 | TArrayF MCalibrationChargeCam::GetAveragedConvFADC2PhotPerSector( const MGeomCam &geom, const MCalibrationQECam &qecam,
|
---|
952 | const UInt_t sec, MBadPixelsCam *bad)
|
---|
953 | {
|
---|
954 | const Int_t np = GetSize();
|
---|
955 |
|
---|
956 | Double_t mean = 0.;
|
---|
957 | Double_t mean2 = 0.;
|
---|
958 | Int_t nr = 0;
|
---|
959 |
|
---|
960 | for (int i=0; i<np; i++)
|
---|
961 | {
|
---|
962 | if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
963 | continue;
|
---|
964 |
|
---|
965 | const UInt_t sector = geom[i].GetSector();
|
---|
966 |
|
---|
967 | if (sector != sec)
|
---|
968 | continue;
|
---|
969 |
|
---|
970 | const MCalibrationQEPix &qepix = (MCalibrationQEPix&)qecam[i];
|
---|
971 | if (!qepix.IsAverageQEFFactorAvailable())
|
---|
972 | continue;
|
---|
973 |
|
---|
974 | const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
|
---|
975 | const Float_t conv = pix.GetMeanConvFADC2Phe();
|
---|
976 | const Float_t qe = qepix.GetQECascadesFFactor();
|
---|
977 |
|
---|
978 | mean += conv/qe;
|
---|
979 | mean2 += conv*conv/qe/qe;
|
---|
980 | nr ++;
|
---|
981 |
|
---|
982 | }
|
---|
983 |
|
---|
984 | TArrayF arr(2);
|
---|
985 | arr[0] = nr ? mean/nr : -1;
|
---|
986 | arr[1] = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0;
|
---|
987 | return arr;
|
---|
988 | }
|
---|
989 |
|
---|
990 | // --------------------------------------------------------------------------
|
---|
991 | //
|
---|
992 | // Calculates the average mean arrival times for pixel sizes.
|
---|
993 | // The geometry container is used to get the necessary
|
---|
994 | // geometry information (area index).
|
---|
995 | // If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
|
---|
996 | // in the calculation of the size average.
|
---|
997 | //
|
---|
998 | // Returns a TArrayF of dimension 2:
|
---|
999 | // arr[0]: averaged mean arrival times (default: -1.)
|
---|
1000 | // arr[1]: Error (rms) of averaged mean arrival times (default: 0.)
|
---|
1001 | //
|
---|
1002 | TArrayF MCalibrationChargeCam::GetAveragedArrivalTimeMeanPerArea(const MGeomCam &geom,
|
---|
1003 | const UInt_t ai, MBadPixelsCam *bad)
|
---|
1004 | {
|
---|
1005 |
|
---|
1006 | const Int_t np = GetSize();
|
---|
1007 |
|
---|
1008 | Double_t mean = 0.;
|
---|
1009 | Double_t mean2 = 0.;
|
---|
1010 | Int_t nr = 0;
|
---|
1011 |
|
---|
1012 | for (int i=0; i<np; i++)
|
---|
1013 | {
|
---|
1014 | if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
1015 | continue;
|
---|
1016 |
|
---|
1017 | const UInt_t aidx = geom[i].GetAidx();
|
---|
1018 |
|
---|
1019 | if (ai != aidx)
|
---|
1020 | continue;
|
---|
1021 |
|
---|
1022 | const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
|
---|
1023 | const Float_t time = pix.GetAbsTimeMean();
|
---|
1024 |
|
---|
1025 | mean += time ;
|
---|
1026 | mean2 += time*time;
|
---|
1027 | nr ++;
|
---|
1028 |
|
---|
1029 | }
|
---|
1030 |
|
---|
1031 | TArrayF arr(2);
|
---|
1032 | arr[0] = nr ? mean/nr : -1;
|
---|
1033 | arr[1] = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0;
|
---|
1034 | return arr;
|
---|
1035 | }
|
---|
1036 |
|
---|
1037 | // --------------------------------------------------------------------------
|
---|
1038 | //
|
---|
1039 | // Calculates the average mean arrival times for camera sectors.
|
---|
1040 | // The geometry container is used to get the necessary
|
---|
1041 | // geometry information (area index).
|
---|
1042 | // If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
|
---|
1043 | // in the calculation of the size average.
|
---|
1044 | //
|
---|
1045 | // Returns a TArrayF of dimension 2:
|
---|
1046 | // arr[0]: averaged mean arrival times (default: -1.)
|
---|
1047 | // arr[1]: Error (rms) of averaged mean arrival times (default: 0.)
|
---|
1048 | //
|
---|
1049 | TArrayF MCalibrationChargeCam::GetAveragedArrivalTimeMeanPerSector(const MGeomCam &geom,
|
---|
1050 | const UInt_t sec, MBadPixelsCam *bad)
|
---|
1051 | {
|
---|
1052 | const Int_t np = GetSize();
|
---|
1053 |
|
---|
1054 | Double_t mean = 0.;
|
---|
1055 | Double_t mean2 = 0.;
|
---|
1056 | Int_t nr = 0;
|
---|
1057 |
|
---|
1058 | for (int i=0; i<np; i++)
|
---|
1059 | {
|
---|
1060 | if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
1061 | continue;
|
---|
1062 |
|
---|
1063 | const UInt_t sector = geom[i].GetSector();
|
---|
1064 |
|
---|
1065 | if (sector != sec)
|
---|
1066 | continue;
|
---|
1067 |
|
---|
1068 | const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
|
---|
1069 | const Float_t time = pix.GetAbsTimeMean();
|
---|
1070 |
|
---|
1071 | mean += time;
|
---|
1072 | mean2 += time*time;
|
---|
1073 | nr ++;
|
---|
1074 |
|
---|
1075 | }
|
---|
1076 |
|
---|
1077 | TArrayF arr(2);
|
---|
1078 | arr[0] = nr ? mean/nr : -1;
|
---|
1079 | arr[1] = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0;
|
---|
1080 | return arr;
|
---|
1081 | }
|
---|
1082 |
|
---|
1083 | // --------------------------------------------------------------------------
|
---|
1084 | //
|
---|
1085 | // Calculates the average arrival time RMSs for pixel sizes.
|
---|
1086 | // The geometry container is used to get the necessary
|
---|
1087 | // geometry information (area index).
|
---|
1088 | // If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
|
---|
1089 | // in the calculation of the size average.
|
---|
1090 | //
|
---|
1091 | // Returns a TArrayF of dimension 2:
|
---|
1092 | // arr[0]: averaged arrival time RMSs (default: -1.)
|
---|
1093 | // arr[1]: Error (rms) of averaged arrival time RMSs (default: 0.)
|
---|
1094 | //
|
---|
1095 | TArrayF MCalibrationChargeCam::GetAveragedArrivalTimeRmsPerArea ( const MGeomCam &geom,
|
---|
1096 | const UInt_t ai, MBadPixelsCam *bad)
|
---|
1097 | {
|
---|
1098 |
|
---|
1099 | const Int_t np = GetSize();
|
---|
1100 |
|
---|
1101 | Double_t mean = 0.;
|
---|
1102 | Double_t mean2 = 0.;
|
---|
1103 | Int_t nr = 0;
|
---|
1104 |
|
---|
1105 | for (int i=0; i<np; i++)
|
---|
1106 | {
|
---|
1107 | if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
1108 | continue;
|
---|
1109 |
|
---|
1110 | const UInt_t aidx = geom[i].GetAidx();
|
---|
1111 |
|
---|
1112 | if (ai != aidx)
|
---|
1113 | continue;
|
---|
1114 |
|
---|
1115 | const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
|
---|
1116 | const Float_t rms = pix.GetAbsTimeRms();
|
---|
1117 |
|
---|
1118 | mean += rms;
|
---|
1119 | mean2 += rms*rms;
|
---|
1120 | nr ++;
|
---|
1121 |
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 | TArrayF arr(2);
|
---|
1125 | arr[0] = nr ? mean/nr : -1;
|
---|
1126 | arr[1] = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0;
|
---|
1127 | return arr;
|
---|
1128 | }
|
---|
1129 |
|
---|
1130 | // --------------------------------------------------------------------------
|
---|
1131 | //
|
---|
1132 | // Calculates the average arrival time RMSs for camera sectors.
|
---|
1133 | // The geometry container is used to get the necessary
|
---|
1134 | // geometry information (area index).
|
---|
1135 | // If the bad pixel container is given all pixels which have the flag 'kUnsuitableRun' are ignored
|
---|
1136 | // in the calculation of the size average.
|
---|
1137 | //
|
---|
1138 | // Returns a TArrayF of dimension 2:
|
---|
1139 | // arr[0]: averaged arrival time RMSs (default: -1.)
|
---|
1140 | // arr[1]: Error (rms) of averaged arrival time RMSs (default: 0.)
|
---|
1141 | //
|
---|
1142 | TArrayF MCalibrationChargeCam::GetAveragedArrivalTimeRmsPerSector( const MGeomCam &geom, const UInt_t sec, MBadPixelsCam *bad)
|
---|
1143 | {
|
---|
1144 | const Int_t np = GetSize();
|
---|
1145 |
|
---|
1146 | Double_t mean = 0.;
|
---|
1147 | Double_t mean2 = 0.;
|
---|
1148 | Int_t nr = 0;
|
---|
1149 |
|
---|
1150 | for (int i=0; i<np; i++)
|
---|
1151 | {
|
---|
1152 | if (bad && (*bad)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
1153 | continue;
|
---|
1154 |
|
---|
1155 | const UInt_t sector = geom[i].GetSector();
|
---|
1156 |
|
---|
1157 | if (sector != sec)
|
---|
1158 | continue;
|
---|
1159 |
|
---|
1160 | const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*this)[i];
|
---|
1161 | const Float_t rms = pix.GetAbsTimeRms();
|
---|
1162 |
|
---|
1163 | mean += rms;
|
---|
1164 | mean2 += rms*rms;
|
---|
1165 | nr ++;
|
---|
1166 | }
|
---|
1167 |
|
---|
1168 | TArrayF arr(2);
|
---|
1169 | arr[0] = nr ? mean/nr : -1;
|
---|
1170 | arr[1] = nr>1 ? TMath::Sqrt((mean2 - mean*mean/nr)/(nr-1)) : 0;
|
---|
1171 |
|
---|
1172 | return arr;
|
---|
1173 | }
|
---|