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 | //
|
---|
27 | // MCalibrationChargeCam
|
---|
28 | //
|
---|
29 | // Hold the whole Calibration results of the camera:
|
---|
30 | //
|
---|
31 | // 1) MCalibrationChargeCam initializes a TClonesArray whose elements are
|
---|
32 | // pointers to MCalibrationChargePix Containers
|
---|
33 | // 2) It initializes a pointer to an MCalibrationBlindPix container
|
---|
34 | // 3) It initializes a pointer to an MCalibrationPINDiode container
|
---|
35 | //
|
---|
36 | //
|
---|
37 | // The calculated values (types of GetPixelContent) are:
|
---|
38 | //
|
---|
39 | // --------------------------------------------------------------------------
|
---|
40 | //
|
---|
41 | // The types are as follows:
|
---|
42 | //
|
---|
43 | // Fitted values:
|
---|
44 | // ==============
|
---|
45 | //
|
---|
46 | // 0: Fitted Charge
|
---|
47 | // 1: Error of fitted Charge
|
---|
48 | // 2: Sigma of fitted Charge
|
---|
49 | // 3: Error of Sigma of fitted Charge
|
---|
50 | //
|
---|
51 | // Useful variables derived from the fit results:
|
---|
52 | // =============================================
|
---|
53 | //
|
---|
54 | // 4: Returned probability of Gauss fit to Charge distribution
|
---|
55 | // 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2)
|
---|
56 | // 6: Error Reduced Sigma of fitted Charge
|
---|
57 | // 7: Reduced Sigma per Charge
|
---|
58 | // 8: Error of Reduced Sigma per Charge
|
---|
59 | //
|
---|
60 | // Results of the different calibration methods:
|
---|
61 | // =============================================
|
---|
62 | //
|
---|
63 | // 9: Number of Photo-electrons obtained with the F-Factor method
|
---|
64 | // 10: Error on Number of Photo-electrons obtained with the F-Factor method
|
---|
65 | // 11: Mean conversion factor obtained with the F-Factor method
|
---|
66 | // 12: Error on the mean conversion factor obtained with the F-Factor method
|
---|
67 | // 13: Overall F-Factor of the readout obtained with the F-Factor method
|
---|
68 | // 14: Error on Overall F-Factor of the readout obtained with the F-Factor method
|
---|
69 | // 15: Pixels with valid calibration by the F-Factor-Method
|
---|
70 | // 16: Mean conversion factor obtained with the Blind Pixel method
|
---|
71 | // 17: Error on the mean conversion factor obtained with the Blind Pixel method
|
---|
72 | // 18: Overall F-Factor of the readout obtained with the Blind Pixel method
|
---|
73 | // 19: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
|
---|
74 | // 20: Pixels with valid calibration by the Blind Pixel-Method
|
---|
75 | // 21: Mean conversion factor obtained with the PIN Diode method
|
---|
76 | // 22: Error on the mean conversion factor obtained with the PIN Diode method
|
---|
77 | // 23: Overall F-Factor of the readout obtained with the PIN Diode method
|
---|
78 | // 24: Error on Overall F-Factor of the readout obtained with the PIN Diode method
|
---|
79 | // 25: Pixels with valid calibration by the PIN Diode-Method
|
---|
80 | //
|
---|
81 | // Localized defects:
|
---|
82 | // ==================
|
---|
83 | //
|
---|
84 | // 26: Excluded Pixels
|
---|
85 | // 27: Number of probable pickup events in the Hi Gain
|
---|
86 | // 28: Number of probable pickup events in the Lo Gain
|
---|
87 | //
|
---|
88 | // Other classifications of pixels:
|
---|
89 | // ================================
|
---|
90 | //
|
---|
91 | // 29: Pixels with saturated Hi-Gain
|
---|
92 | //
|
---|
93 | // Used Pedestals:
|
---|
94 | // ===============
|
---|
95 | //
|
---|
96 | // 30: Mean Pedestal over the entire range of signal extraction
|
---|
97 | // 31: Error on the Mean Pedestal over the entire range of signal extraction
|
---|
98 | // 32: Pedestal RMS over the entire range of signal extraction
|
---|
99 | // 33: Error on the Pedestal RMS over the entire range of signal extraction
|
---|
100 | //
|
---|
101 | // Calculated absolute arrival times (very low precision!):
|
---|
102 | // ========================================================
|
---|
103 | //
|
---|
104 | // 34: Absolute Arrival time of the signal
|
---|
105 | // 35: RMS of the Absolute Arrival time of the signal
|
---|
106 | //
|
---|
107 | /////////////////////////////////////////////////////////////////////////////
|
---|
108 | #include "MCalibrationChargeCam.h"
|
---|
109 |
|
---|
110 | #include <TH2.h>
|
---|
111 | #include <TCanvas.h>
|
---|
112 | #include <TClonesArray.h>
|
---|
113 |
|
---|
114 | #include "MLog.h"
|
---|
115 | #include "MLogManip.h"
|
---|
116 |
|
---|
117 | #include "MGeomCam.h"
|
---|
118 | #include "MGeomPix.h"
|
---|
119 |
|
---|
120 | #include "MBadPixelsCam.h"
|
---|
121 | #include "MBadPixelsPix.h"
|
---|
122 |
|
---|
123 | #include "MCalibrationChargePix.h"
|
---|
124 | #include "MCalibrationChargeBlindPix.h"
|
---|
125 | #include "MCalibrationChargePINDiode.h"
|
---|
126 |
|
---|
127 | ClassImp(MCalibrationChargeCam);
|
---|
128 |
|
---|
129 | using namespace std;
|
---|
130 |
|
---|
131 | const Float_t MCalibrationChargeCam::gkAverageQE = 0.18;
|
---|
132 | const Float_t MCalibrationChargeCam::gkAverageQEErr = 0.02;
|
---|
133 | const Float_t MCalibrationChargeCam::fgConvFFactorRelErrLimit = 0.35;
|
---|
134 | const Float_t MCalibrationChargeCam::fgPheFFactorRelErrLimit = 5.;
|
---|
135 | // --------------------------------------------------------------------------
|
---|
136 | //
|
---|
137 | // Default constructor.
|
---|
138 | //
|
---|
139 | // Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry
|
---|
140 | // Later, a call to MCalibrationChargeCam::InitSize(Int_t size) has to be performed
|
---|
141 | //
|
---|
142 | // Creates an MCalibrationBlindPix container
|
---|
143 | //
|
---|
144 | MCalibrationChargeCam::MCalibrationChargeCam(const char *name, const char *title)
|
---|
145 | : fOffsets(NULL),
|
---|
146 | fSlopes(NULL),
|
---|
147 | fOffvsSlope(NULL)
|
---|
148 | {
|
---|
149 | fName = name ? name : "MCalibrationChargeCam";
|
---|
150 | fTitle = title ? title : "Storage container for the Calibration Information in the camera";
|
---|
151 |
|
---|
152 | fPixels = new TClonesArray("MCalibrationChargePix",1);
|
---|
153 | fAverageInnerPix = new MCalibrationChargePix("AverageInnerPix","Container of the fit results of the camera average inner pixels");
|
---|
154 | fAverageOuterPix = new MCalibrationChargePix("AverageOuterPix","Container of the fit results of the camera average outer pixels");
|
---|
155 | fAverageInnerBadPix = new MBadPixelsPix("AverageInnerBadPix","Bad Pixel Container of the camera average inner pixels");
|
---|
156 | fAverageOuterBadPix = new MBadPixelsPix("AverageOuterBadPix","Bad Pixel Container of the camera average outer pixels");
|
---|
157 |
|
---|
158 | Clear();
|
---|
159 |
|
---|
160 | SetAverageQE();
|
---|
161 | SetConvFFactorRelErrLimit();
|
---|
162 | SetPheFFactorRelErrLimit();
|
---|
163 | }
|
---|
164 |
|
---|
165 | // --------------------------------------------------------------------------
|
---|
166 | //
|
---|
167 | // Delete the TClonesArray of MCalibrationPix containers
|
---|
168 | // Delete the MCalibrationPINDiode and the MCalibrationBlindPix
|
---|
169 | //
|
---|
170 | // Delete the histograms if they exist
|
---|
171 | //
|
---|
172 | MCalibrationChargeCam::~MCalibrationChargeCam()
|
---|
173 | {
|
---|
174 |
|
---|
175 | //
|
---|
176 | // delete fPixels should delete all Objects stored inside
|
---|
177 | //
|
---|
178 | delete fPixels;
|
---|
179 | delete fAverageInnerPix;
|
---|
180 | delete fAverageOuterPix;
|
---|
181 |
|
---|
182 | delete fAverageInnerBadPix;
|
---|
183 | delete fAverageOuterBadPix;
|
---|
184 |
|
---|
185 | if (fOffsets)
|
---|
186 | delete fOffsets;
|
---|
187 | if (fSlopes)
|
---|
188 | delete fSlopes;
|
---|
189 | if (fOffvsSlope)
|
---|
190 | delete fOffvsSlope;
|
---|
191 |
|
---|
192 | }
|
---|
193 |
|
---|
194 | // -------------------------------------------------------------------
|
---|
195 | //
|
---|
196 | // This function simply allocates memory via the ROOT command:
|
---|
197 | // (TObject**) TStorage::ReAlloc(fCont, newSize * sizeof(TObject*),
|
---|
198 | // fSize * sizeof(TObject*));
|
---|
199 | // newSize corresponds to size in our case
|
---|
200 | // fSize is the old size (in most cases: 1)
|
---|
201 | //
|
---|
202 | void MCalibrationChargeCam::InitSize(const UInt_t i)
|
---|
203 | {
|
---|
204 |
|
---|
205 | fPixels->ExpandCreate(i);
|
---|
206 |
|
---|
207 | }
|
---|
208 |
|
---|
209 | // --------------------------------------------------------------------------
|
---|
210 | //
|
---|
211 | // This function returns the current size of the TClonesArray
|
---|
212 | // independently if the MCalibrationPix is filled with values or not.
|
---|
213 | //
|
---|
214 | // It is the size of the array fPixels.
|
---|
215 | //
|
---|
216 | Int_t MCalibrationChargeCam::GetSize() const
|
---|
217 | {
|
---|
218 | return fPixels->GetEntriesFast();
|
---|
219 | }
|
---|
220 |
|
---|
221 |
|
---|
222 | // --------------------------------------------------------------------------
|
---|
223 | //
|
---|
224 | // Get i-th pixel (pixel number)
|
---|
225 | //
|
---|
226 | MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i)
|
---|
227 | {
|
---|
228 | return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i));
|
---|
229 | }
|
---|
230 |
|
---|
231 | // --------------------------------------------------------------------------
|
---|
232 | //
|
---|
233 | // Get i-th pixel (pixel number)
|
---|
234 | //
|
---|
235 | const MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i) const
|
---|
236 | {
|
---|
237 | return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i));
|
---|
238 | }
|
---|
239 |
|
---|
240 |
|
---|
241 | // --------------------------------------
|
---|
242 | //
|
---|
243 | void MCalibrationChargeCam::Clear(Option_t *o)
|
---|
244 | {
|
---|
245 |
|
---|
246 | fPixels->ForEach(TObject, Clear)();
|
---|
247 | fAverageInnerPix->Clear();
|
---|
248 | fAverageOuterPix->Clear();
|
---|
249 |
|
---|
250 | fAverageInnerBadPix->Clear();
|
---|
251 | fAverageOuterBadPix->Clear();
|
---|
252 |
|
---|
253 | fNumExcludedPixels = 0;
|
---|
254 | fMeanFluxPhesInnerPixel = 0.;
|
---|
255 | fMeanFluxPhesInnerPixelVar = 0.;
|
---|
256 | fMeanFluxPhesOuterPixel = 0.;
|
---|
257 | fMeanFluxPhesOuterPixelVar = 0.;
|
---|
258 |
|
---|
259 | CLRBIT(fFlags,kBlindPixelMethodValid);
|
---|
260 | CLRBIT(fFlags,kFFactorMethodValid);
|
---|
261 | CLRBIT(fFlags,kPINDiodeMethodValid);
|
---|
262 |
|
---|
263 | return;
|
---|
264 | }
|
---|
265 |
|
---|
266 | void MCalibrationChargeCam::SetFFactorMethodValid(const Bool_t b)
|
---|
267 | {
|
---|
268 | b ? SETBIT(fFlags, kFFactorMethodValid) : CLRBIT(fFlags, kFFactorMethodValid);
|
---|
269 | }
|
---|
270 |
|
---|
271 | void MCalibrationChargeCam::SetBlindPixelMethodValid(const Bool_t b)
|
---|
272 | {
|
---|
273 | b ? SETBIT(fFlags, kBlindPixelMethodValid) : CLRBIT(fFlags, kBlindPixelMethodValid);
|
---|
274 | }
|
---|
275 |
|
---|
276 | void MCalibrationChargeCam::SetPINDiodeMethodValid(const Bool_t b)
|
---|
277 | {
|
---|
278 | b ? SETBIT(fFlags, kPINDiodeMethodValid) : CLRBIT(fFlags, kPINDiodeMethodValid);
|
---|
279 | }
|
---|
280 |
|
---|
281 | Float_t MCalibrationChargeCam::GetMeanFluxPhesInnerPixelErr() const
|
---|
282 | {
|
---|
283 | if (fMeanFluxPhesInnerPixelVar <= 0.)
|
---|
284 | return -1.;
|
---|
285 | return TMath::Sqrt(fMeanFluxPhesInnerPixelVar);
|
---|
286 | }
|
---|
287 |
|
---|
288 | Float_t MCalibrationChargeCam::GetMeanFluxPhesOuterPixelErr() const
|
---|
289 | {
|
---|
290 | if (fMeanFluxPhesOuterPixelVar <= 0.)
|
---|
291 | return -1.;
|
---|
292 | return TMath::Sqrt(fMeanFluxPhesOuterPixelVar);
|
---|
293 | }
|
---|
294 |
|
---|
295 | Float_t MCalibrationChargeCam::GetMeanFluxPhotonsInnerPixelErr() const
|
---|
296 | {
|
---|
297 | if (fMeanFluxPhotonsInnerPixelVar <= 0.)
|
---|
298 | return -1.;
|
---|
299 | return TMath::Sqrt(fMeanFluxPhotonsInnerPixelVar);
|
---|
300 | }
|
---|
301 |
|
---|
302 | Float_t MCalibrationChargeCam::GetMeanFluxPhotonsOuterPixelErr() const
|
---|
303 | {
|
---|
304 | if (fMeanFluxPhotonsOuterPixelVar <= 0.)
|
---|
305 | return -1.;
|
---|
306 | return TMath::Sqrt(fMeanFluxPhotonsOuterPixelVar);
|
---|
307 | }
|
---|
308 |
|
---|
309 | Bool_t MCalibrationChargeCam::IsBlindPixelMethodValid() const
|
---|
310 | {
|
---|
311 | return TESTBIT(fFlags,kBlindPixelMethodValid);
|
---|
312 | }
|
---|
313 |
|
---|
314 | Bool_t MCalibrationChargeCam::IsPINDiodeMethodValid() const
|
---|
315 | {
|
---|
316 | return TESTBIT(fFlags,kPINDiodeMethodValid);
|
---|
317 | }
|
---|
318 |
|
---|
319 |
|
---|
320 | // --------------------------------------------------------------------------
|
---|
321 | //
|
---|
322 | // Print first the well fitted pixels
|
---|
323 | // and then the ones which are not FitValid
|
---|
324 | //
|
---|
325 | void MCalibrationChargeCam::Print(Option_t *o) const
|
---|
326 | {
|
---|
327 |
|
---|
328 | *fLog << all << GetDescriptor() << ":" << endl;
|
---|
329 | int id = 0;
|
---|
330 |
|
---|
331 | *fLog << all << "Calibrated pixels:" << endl;
|
---|
332 | *fLog << all << endl;
|
---|
333 |
|
---|
334 | TIter Next(fPixels);
|
---|
335 | MCalibrationChargePix *pix;
|
---|
336 | while ((pix=(MCalibrationChargePix*)Next()))
|
---|
337 | {
|
---|
338 |
|
---|
339 | if (!pix->IsExcluded())
|
---|
340 | {
|
---|
341 |
|
---|
342 | *fLog << all << "Pix " << pix->GetPixId()
|
---|
343 | << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr()
|
---|
344 | << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge()
|
---|
345 | << " Reduced Sigma: " << pix->GetRSigmaCharge()
|
---|
346 | << " Nr Phe's: " << pix->GetPheFFactorMethod()
|
---|
347 | << " Saturated? :" << pix->IsHiGainSaturation()
|
---|
348 | << endl;
|
---|
349 | id++;
|
---|
350 | }
|
---|
351 | }
|
---|
352 |
|
---|
353 | *fLog << all << id << " pixels" << endl;
|
---|
354 | id = 0;
|
---|
355 |
|
---|
356 |
|
---|
357 | *fLog << all << endl;
|
---|
358 | *fLog << all << "Excluded pixels:" << endl;
|
---|
359 | *fLog << all << endl;
|
---|
360 |
|
---|
361 | id = 0;
|
---|
362 |
|
---|
363 | TIter Next4(fPixels);
|
---|
364 | while ((pix=(MCalibrationChargePix*)Next4()))
|
---|
365 | {
|
---|
366 | if (pix->IsExcluded())
|
---|
367 | {
|
---|
368 | *fLog << all << pix->GetPixId() << endl;
|
---|
369 | id++;
|
---|
370 | }
|
---|
371 | }
|
---|
372 | *fLog << all << id << " Excluded pixels " << endl;
|
---|
373 | *fLog << endl;
|
---|
374 |
|
---|
375 | *fLog << all << "Average Inner Pix:"
|
---|
376 | << " Ped. Rms: " << fAverageInnerPix->GetPedRms() << " +- " << fAverageInnerPix->GetPedRmsErr()
|
---|
377 | << " Mean signal: " << fAverageInnerPix->GetMeanCharge() << " +- " << fAverageInnerPix->GetMeanChargeErr()
|
---|
378 | << " Sigma signal: " << fAverageInnerPix->GetSigmaCharge() << " +- "<< fAverageInnerPix->GetSigmaChargeErr()
|
---|
379 | << " Reduced Sigma: " << fAverageInnerPix->GetRSigmaCharge()
|
---|
380 | << " Nr Phe's: " << fAverageInnerPix->GetPheFFactorMethod()
|
---|
381 | << endl;
|
---|
382 | *fLog << all << "Average Outer Pix:"
|
---|
383 | << " Ped. Rms: " << fAverageOuterPix->GetPedRms() << " +- " << fAverageOuterPix->GetPedRmsErr()
|
---|
384 | << " Mean signal: " << fAverageOuterPix->GetMeanCharge() << " +- " << fAverageOuterPix->GetMeanChargeErr()
|
---|
385 | << " Sigma signal: " << fAverageOuterPix->GetSigmaCharge() << " +- "<< fAverageOuterPix->GetSigmaChargeErr()
|
---|
386 | << " Reduced Sigma: " << fAverageOuterPix->GetRSigmaCharge()
|
---|
387 | << " Nr Phe's: " << fAverageOuterPix->GetPheFFactorMethod()
|
---|
388 | << endl;
|
---|
389 |
|
---|
390 | }
|
---|
391 |
|
---|
392 |
|
---|
393 | // --------------------------------------------------------------------------
|
---|
394 | //
|
---|
395 | // The types are as follows:
|
---|
396 | //
|
---|
397 | // Fitted values:
|
---|
398 | // ==============
|
---|
399 | //
|
---|
400 | // 0: Fitted Charge
|
---|
401 | // 1: Error of fitted Charge
|
---|
402 | // 2: Sigma of fitted Charge
|
---|
403 | // 3: Error of Sigma of fitted Charge
|
---|
404 | //
|
---|
405 | // Useful variables derived from the fit results:
|
---|
406 | // =============================================
|
---|
407 | //
|
---|
408 | // 4: Returned probability of Gauss fit to Charge distribution
|
---|
409 | // 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2)
|
---|
410 | // 6: Error Reduced Sigma of fitted Charge
|
---|
411 | // 7: Reduced Sigma per Charge
|
---|
412 | // 8: Error of Reduced Sigma per Charge
|
---|
413 | //
|
---|
414 | // Useful variables derived from the fit results:
|
---|
415 | // =============================================
|
---|
416 | //
|
---|
417 | // 4: Returned probability of Gauss fit to Charge distribution
|
---|
418 | // 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2)
|
---|
419 | // 6: Error Reduced Sigma of fitted Charge
|
---|
420 | // 7: Reduced Sigma per Charge
|
---|
421 | // 8: Error of Reduced Sigma per Charge
|
---|
422 | //
|
---|
423 | // Results of the different calibration methods:
|
---|
424 | // =============================================
|
---|
425 | //
|
---|
426 | // 9: Number of Photo-electrons obtained with the F-Factor method
|
---|
427 | // 10: Error on Number of Photo-electrons obtained with the F-Factor method
|
---|
428 | // 11: Mean conversion factor obtained with the F-Factor method
|
---|
429 | // 12: Error on the mean conversion factor obtained with the F-Factor method
|
---|
430 | // 13: Overall F-Factor of the readout obtained with the F-Factor method
|
---|
431 | // 14: Error on Overall F-Factor of the readout obtained with the F-Factor method
|
---|
432 | // 15: Pixels with valid calibration by the F-Factor-Method
|
---|
433 | // 16: Mean conversion factor obtained with the Blind Pixel method
|
---|
434 | // 17: Error on the mean conversion factor obtained with the Blind Pixel method
|
---|
435 | // 18: Overall F-Factor of the readout obtained with the Blind Pixel method
|
---|
436 | // 19: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
|
---|
437 | // 20: Pixels with valid calibration by the Blind Pixel-Method
|
---|
438 | // 21: Mean conversion factor obtained with the PIN Diode method
|
---|
439 | // 22: Error on the mean conversion factor obtained with the PIN Diode method
|
---|
440 | // 23: Overall F-Factor of the readout obtained with the PIN Diode method
|
---|
441 | // 24: Error on Overall F-Factor of the readout obtained with the PIN Diode method
|
---|
442 | // 25: Pixels with valid calibration by the PIN Diode-Method
|
---|
443 | //
|
---|
444 | // Localized defects:
|
---|
445 | // ==================
|
---|
446 | //
|
---|
447 | // 26: Excluded Pixels
|
---|
448 | // 27: Number of probable pickup events in the Hi Gain
|
---|
449 | // 28: Number of probable pickup events in the Lo Gain
|
---|
450 | //
|
---|
451 | // Other classifications of pixels:
|
---|
452 | // ================================
|
---|
453 | //
|
---|
454 | // 29: Pixels with saturated Hi-Gain
|
---|
455 | //
|
---|
456 | // Used Pedestals:
|
---|
457 | // ===============
|
---|
458 | //
|
---|
459 | // 30: Mean Pedestal over the entire range of signal extraction
|
---|
460 | // 31: Error on the Mean Pedestal over the entire range of signal extraction
|
---|
461 | // 32: Pedestal RMS over the entire range of signal extraction
|
---|
462 | // 33: Error on the Pedestal RMS over the entire range of signal extraction
|
---|
463 | //
|
---|
464 | // Calculated absolute arrival times (very low precision!):
|
---|
465 | // ========================================================
|
---|
466 | //
|
---|
467 | // 34: Absolute Arrival time of the signal
|
---|
468 | // 35: RMS of the Absolute Arrival time of the signal
|
---|
469 | //
|
---|
470 | Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
471 | {
|
---|
472 |
|
---|
473 | if (idx > GetSize())
|
---|
474 | return kFALSE;
|
---|
475 |
|
---|
476 | Float_t area = cam[idx].GetA();
|
---|
477 |
|
---|
478 | if (area == 0)
|
---|
479 | return kFALSE;
|
---|
480 |
|
---|
481 | switch (type)
|
---|
482 | {
|
---|
483 | case 0:
|
---|
484 | if ((*this)[idx].IsExcluded())
|
---|
485 | return kFALSE;
|
---|
486 | val = (*this)[idx].GetMeanCharge();
|
---|
487 | break;
|
---|
488 | case 1:
|
---|
489 | if ((*this)[idx].IsExcluded())
|
---|
490 | return kFALSE;
|
---|
491 | val = (*this)[idx].GetMeanChargeErr();
|
---|
492 | break;
|
---|
493 | case 2:
|
---|
494 | if ((*this)[idx].IsExcluded())
|
---|
495 | return kFALSE;
|
---|
496 | val = (*this)[idx].GetSigmaCharge();
|
---|
497 | break;
|
---|
498 | case 3:
|
---|
499 | if ((*this)[idx].IsExcluded())
|
---|
500 | return kFALSE;
|
---|
501 | val = (*this)[idx].GetSigmaChargeErr();
|
---|
502 | break;
|
---|
503 | case 4:
|
---|
504 | if ((*this)[idx].IsExcluded())
|
---|
505 | return kFALSE;
|
---|
506 | val = (*this)[idx].GetChargeProb();
|
---|
507 | break;
|
---|
508 | case 5:
|
---|
509 | if ((*this)[idx].IsExcluded())
|
---|
510 | return kFALSE;
|
---|
511 | if ((*this)[idx].GetRSigmaCharge() == -1.)
|
---|
512 | return kFALSE;
|
---|
513 | val = (*this)[idx].GetRSigmaCharge();
|
---|
514 | break;
|
---|
515 | case 6:
|
---|
516 | if ((*this)[idx].IsExcluded())
|
---|
517 | return kFALSE;
|
---|
518 | if ((*this)[idx].GetRSigmaCharge() == -1.)
|
---|
519 | return kFALSE;
|
---|
520 | val = (*this)[idx].GetRSigmaChargeErr();
|
---|
521 | break;
|
---|
522 | case 7:
|
---|
523 | if ((*this)[idx].IsExcluded())
|
---|
524 | return kFALSE;
|
---|
525 | if ((*this)[idx].GetRSigmaCharge() == -1.)
|
---|
526 | return kFALSE;
|
---|
527 | if ((*this)[idx].GetMeanCharge() == 0.)
|
---|
528 | return kFALSE;
|
---|
529 | val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge();
|
---|
530 | break;
|
---|
531 | case 8:
|
---|
532 | if ((*this)[idx].IsExcluded())
|
---|
533 | return kFALSE;
|
---|
534 | if ((*this)[idx].GetRSigmaCharge() <= 0.)
|
---|
535 | return kFALSE;
|
---|
536 | if ((*this)[idx].GetMeanCharge() <= 0.)
|
---|
537 | return kFALSE;
|
---|
538 | if ((*this)[idx].GetRSigmaChargeErr() <= 0.)
|
---|
539 | return kFALSE;
|
---|
540 | if ((*this)[idx].GetMeanChargeErr() <= 0.)
|
---|
541 | return kFALSE;
|
---|
542 | // relative error RsigmaCharge square
|
---|
543 | val = (*this)[idx].GetRSigmaChargeErr()* (*this)[idx].GetRSigmaChargeErr()
|
---|
544 | / ((*this)[idx].GetRSigmaCharge() * (*this)[idx].GetRSigmaCharge() );
|
---|
545 | // relative error Charge square
|
---|
546 | val += (*this)[idx].GetMeanChargeErr() * (*this)[idx].GetMeanChargeErr()
|
---|
547 | / ((*this)[idx].GetMeanCharge() * (*this)[idx].GetMeanCharge() );
|
---|
548 | // calculate relative error out of squares
|
---|
549 | val = TMath::Sqrt(val) ;
|
---|
550 | // multiply with value to get absolute error
|
---|
551 | val *= (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge();
|
---|
552 | break;
|
---|
553 | case 9:
|
---|
554 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
|
---|
555 | return kFALSE;
|
---|
556 | val = (*this)[idx].GetPheFFactorMethod();
|
---|
557 | break;
|
---|
558 | case 10:
|
---|
559 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
|
---|
560 | return kFALSE;
|
---|
561 | val = (*this)[idx].GetPheFFactorMethodErr();
|
---|
562 | break;
|
---|
563 | case 11:
|
---|
564 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
|
---|
565 | return kFALSE;
|
---|
566 | val = (*this)[idx].GetMeanConversionFFactorMethod();
|
---|
567 | break;
|
---|
568 | case 12:
|
---|
569 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
|
---|
570 | return kFALSE;
|
---|
571 | val = (*this)[idx].GetConversionFFactorMethodErr();
|
---|
572 | break;
|
---|
573 | case 13:
|
---|
574 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
|
---|
575 | return kFALSE;
|
---|
576 | val = (*this)[idx].GetTotalFFactorFFactorMethod();
|
---|
577 | break;
|
---|
578 | case 14:
|
---|
579 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsFFactorMethodValid())
|
---|
580 | return kFALSE;
|
---|
581 | val = (*this)[idx].GetTotalFFactorFFactorMethodErr();
|
---|
582 | break;
|
---|
583 | case 15:
|
---|
584 | if ((*this)[idx].IsExcluded())
|
---|
585 | return kFALSE;
|
---|
586 | if ((*this)[idx].IsFFactorMethodValid())
|
---|
587 | val = 1;
|
---|
588 | else
|
---|
589 | return kFALSE;
|
---|
590 | break;
|
---|
591 | case 16:
|
---|
592 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
|
---|
593 | return kFALSE;
|
---|
594 | val = (*this)[idx].GetMeanConversionBlindPixelMethod();
|
---|
595 | break;
|
---|
596 | case 17:
|
---|
597 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
|
---|
598 | return kFALSE;
|
---|
599 | val = (*this)[idx].GetConversionBlindPixelMethodErr();
|
---|
600 | break;
|
---|
601 | case 18:
|
---|
602 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
|
---|
603 | return kFALSE;
|
---|
604 | val = (*this)[idx].GetTotalFFactorBlindPixelMethod();
|
---|
605 | break;
|
---|
606 | case 19:
|
---|
607 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsBlindPixelMethodValid())
|
---|
608 | return kFALSE;
|
---|
609 | val = (*this)[idx].GetTotalFFactorBlindPixelMethodErr();
|
---|
610 | break;
|
---|
611 | case 20:
|
---|
612 | if ((*this)[idx].IsExcluded())
|
---|
613 | return kFALSE;
|
---|
614 | if ((*this)[idx].IsBlindPixelMethodValid())
|
---|
615 | val = 1;
|
---|
616 | else
|
---|
617 | return kFALSE;
|
---|
618 | break;
|
---|
619 | case 21:
|
---|
620 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
|
---|
621 | return kFALSE;
|
---|
622 | val = (*this)[idx].GetMeanConversionPINDiodeMethod();
|
---|
623 | break;
|
---|
624 | case 22:
|
---|
625 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
|
---|
626 | return kFALSE;
|
---|
627 | val = (*this)[idx].GetConversionPINDiodeMethodErr();
|
---|
628 | break;
|
---|
629 | case 23:
|
---|
630 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
|
---|
631 | return kFALSE;
|
---|
632 | val = (*this)[idx].GetTotalFFactorPINDiodeMethod();
|
---|
633 | break;
|
---|
634 | case 24:
|
---|
635 | if ((*this)[idx].IsExcluded() || !(*this)[idx].IsPINDiodeMethodValid())
|
---|
636 | return kFALSE;
|
---|
637 | val = (*this)[idx].GetTotalFFactorPINDiodeMethodErr();
|
---|
638 | break;
|
---|
639 | case 25:
|
---|
640 | if ((*this)[idx].IsExcluded())
|
---|
641 | return kFALSE;
|
---|
642 | if ((*this)[idx].IsPINDiodeMethodValid())
|
---|
643 | val = 1;
|
---|
644 | else
|
---|
645 | return kFALSE;
|
---|
646 | break;
|
---|
647 | case 26:
|
---|
648 | if ((*this)[idx].IsExcluded())
|
---|
649 | val = 1.;
|
---|
650 | else
|
---|
651 | return kFALSE;
|
---|
652 | break;
|
---|
653 | case 27:
|
---|
654 | if ((*this)[idx].IsExcluded())
|
---|
655 | return kFALSE;
|
---|
656 | val = (*this)[idx].GetHiGainNumPickup();
|
---|
657 | break;
|
---|
658 | case 28:
|
---|
659 | if ((*this)[idx].IsExcluded())
|
---|
660 | return kFALSE;
|
---|
661 | val = (*this)[idx].GetLoGainNumPickup();
|
---|
662 | break;
|
---|
663 | case 29:
|
---|
664 | if ((*this)[idx].IsExcluded())
|
---|
665 | return kFALSE;
|
---|
666 | val = (*this)[idx].IsHiGainSaturation();
|
---|
667 | break;
|
---|
668 | case 30:
|
---|
669 | if ((*this)[idx].IsExcluded())
|
---|
670 | return kFALSE;
|
---|
671 | val = (*this)[idx].GetPed();
|
---|
672 | break;
|
---|
673 | case 31:
|
---|
674 | if ((*this)[idx].IsExcluded())
|
---|
675 | return kFALSE;
|
---|
676 | val = (*this)[idx].GetPedErr();
|
---|
677 | break;
|
---|
678 | case 32:
|
---|
679 | if ((*this)[idx].IsExcluded())
|
---|
680 | return kFALSE;
|
---|
681 | val = (*this)[idx].GetPedRms();
|
---|
682 | break;
|
---|
683 | case 33:
|
---|
684 | if ((*this)[idx].IsExcluded())
|
---|
685 | return kFALSE;
|
---|
686 | val = (*this)[idx].GetPedErr()/2.;
|
---|
687 | break;
|
---|
688 | case 34:
|
---|
689 | if ((*this)[idx].IsExcluded())
|
---|
690 | return kFALSE;
|
---|
691 | val = (*this)[idx].GetAbsTimeMean();
|
---|
692 | break;
|
---|
693 | case 35:
|
---|
694 | if ((*this)[idx].IsExcluded())
|
---|
695 | return kFALSE;
|
---|
696 | val = (*this)[idx].GetAbsTimeRms();
|
---|
697 | break;
|
---|
698 | default:
|
---|
699 | return kFALSE;
|
---|
700 | }
|
---|
701 |
|
---|
702 | return val!=-1.;
|
---|
703 |
|
---|
704 | }
|
---|
705 |
|
---|
706 | // --------------------------------------------------------------------------
|
---|
707 | //
|
---|
708 | // What MHCamera needs in order to draw an individual pixel in the camera
|
---|
709 | //
|
---|
710 | void MCalibrationChargeCam::DrawPixelContent(Int_t idx) const
|
---|
711 | {
|
---|
712 | if (idx == -1)
|
---|
713 | fAverageInnerPix->DrawClone();
|
---|
714 | if (idx == -2)
|
---|
715 | fAverageOuterPix->DrawClone();
|
---|
716 |
|
---|
717 | (*this)[idx].DrawClone();
|
---|
718 | }
|
---|
719 |
|
---|
720 | //
|
---|
721 | // Calculate the weighted mean of the phe's of all inner and outer pixels, respectively.
|
---|
722 | // Bad pixels are excluded from the calculation. Two loops are performed to exclude pixels
|
---|
723 | // which are fPheFFactorRelLimit sigmas from the mean.
|
---|
724 | //
|
---|
725 | Bool_t MCalibrationChargeCam::CalcMeanFluxPhotonsFFactorMethod(const MGeomCam &geom, MBadPixelsCam &bad)
|
---|
726 | {
|
---|
727 |
|
---|
728 | const Float_t avQERelVar = fAverageQEVar / (fAverageQE * fAverageQE );
|
---|
729 |
|
---|
730 | Float_t sumweightsinner = 0.;
|
---|
731 | Float_t sumphesinner = 0.;
|
---|
732 | Float_t sumweightsouter = 0.;
|
---|
733 | Float_t sumphesouter = 0.;
|
---|
734 | Int_t validinner = 0;
|
---|
735 | Int_t validouter = 0;
|
---|
736 |
|
---|
737 | TIter Next(fPixels);
|
---|
738 | MCalibrationChargePix *pix;
|
---|
739 | while ((pix=(MCalibrationChargePix*)Next()))
|
---|
740 | {
|
---|
741 |
|
---|
742 | if (!pix->IsFFactorMethodValid())
|
---|
743 | continue;
|
---|
744 |
|
---|
745 | const Int_t idx = pix->GetPixId();
|
---|
746 |
|
---|
747 | if(!bad[idx].IsCalibrationResultOK())
|
---|
748 | continue;
|
---|
749 |
|
---|
750 | const Float_t nphe = pix->GetPheFFactorMethod();
|
---|
751 | const Float_t npheerr = pix->GetPheFFactorMethodErr();
|
---|
752 | const Float_t ratio = geom.GetPixRatio(idx);
|
---|
753 |
|
---|
754 | if (npheerr > 0.)
|
---|
755 | {
|
---|
756 | const Float_t weight = nphe*nphe/npheerr/npheerr;
|
---|
757 | //
|
---|
758 | // first the inner pixels:
|
---|
759 | //
|
---|
760 | if (ratio == 1.)
|
---|
761 | {
|
---|
762 | sumweightsinner += weight;
|
---|
763 | sumphesinner += weight*nphe;
|
---|
764 | validinner++;
|
---|
765 | }
|
---|
766 | else
|
---|
767 | {
|
---|
768 | //
|
---|
769 | // now the outers
|
---|
770 | //
|
---|
771 | sumweightsouter += weight;
|
---|
772 | sumphesouter += weight*nphe;
|
---|
773 | validouter++;
|
---|
774 | }
|
---|
775 | } /* if npheerr != 0 */
|
---|
776 | } /* while ((pix=(MCalibrationChargePix*)Next())) */
|
---|
777 |
|
---|
778 | if (sumweightsinner <= 0. || sumphesinner <= 0.)
|
---|
779 | {
|
---|
780 | *fLog << warn << " Mean number of phe's from inner pixels cannot be calculated: "
|
---|
781 | << " Sum of weights: " << sumweightsinner
|
---|
782 | << " Sum of weighted phes: " << sumphesinner << endl;
|
---|
783 | return kFALSE;
|
---|
784 | }
|
---|
785 | else
|
---|
786 | {
|
---|
787 | fMeanFluxPhesInnerPixel = sumphesinner/sumweightsinner;
|
---|
788 | fMeanFluxPhesInnerPixelVar = (1./sumweightsinner)*fMeanFluxPhesInnerPixel*fMeanFluxPhesInnerPixel;
|
---|
789 | }
|
---|
790 |
|
---|
791 | if (sumweightsouter <= 0. || sumphesouter <= 0.)
|
---|
792 | {
|
---|
793 | *fLog << warn << " Mean number of phe's from outer pixels cannot be calculated: "
|
---|
794 | << " Sum of weights or sum of weighted phes is 0. " << endl;
|
---|
795 | }
|
---|
796 | else
|
---|
797 | {
|
---|
798 | fMeanFluxPhesOuterPixel = sumphesouter/sumweightsouter;
|
---|
799 | fMeanFluxPhesOuterPixelVar = (1./sumweightsouter)*fMeanFluxPhesOuterPixel*fMeanFluxPhesOuterPixel;
|
---|
800 | }
|
---|
801 |
|
---|
802 | Float_t meanFluxPhotonsRelVar = fMeanFluxPhesInnerPixelVar
|
---|
803 | / (fMeanFluxPhesInnerPixel * fMeanFluxPhesInnerPixel);
|
---|
804 |
|
---|
805 | fMeanFluxPhotonsInnerPixel = fMeanFluxPhesInnerPixel/fAverageQE;
|
---|
806 | fMeanFluxPhotonsInnerPixelVar = (meanFluxPhotonsRelVar + avQERelVar)
|
---|
807 | * fMeanFluxPhotonsInnerPixel * fMeanFluxPhotonsInnerPixel;
|
---|
808 |
|
---|
809 | fMeanFluxPhotonsOuterPixel = 4. *fMeanFluxPhotonsInnerPixel;
|
---|
810 | fMeanFluxPhotonsOuterPixelVar = 16.*fMeanFluxPhotonsInnerPixelVar;
|
---|
811 |
|
---|
812 | *fLog << inf << " Mean number of photo-electrons from inner pixels (F-Factor Method): "
|
---|
813 | << fMeanFluxPhesInnerPixel << " +- " << GetMeanFluxPhesInnerPixelErr() << endl;
|
---|
814 |
|
---|
815 | *fLog << inf << " Mean number of photons from inner pixels (F-Factor Method): "
|
---|
816 | << fMeanFluxPhotonsInnerPixel << " +- " << GetMeanFluxPhotonsInnerPixelErr() << endl;
|
---|
817 |
|
---|
818 | //
|
---|
819 | // Here starts the second loop discarting pixels out of the range:
|
---|
820 | //
|
---|
821 | const Float_t innervar = (Float_t)validinner*fPheFFactorRelVarLimit*fMeanFluxPhesInnerPixelVar;
|
---|
822 | const Float_t outervar = (Float_t)validouter*fPheFFactorRelVarLimit*fMeanFluxPhesOuterPixelVar;
|
---|
823 |
|
---|
824 | Float_t innererr;
|
---|
825 | Float_t outererr;
|
---|
826 |
|
---|
827 | if (innervar > 0.)
|
---|
828 | innererr = TMath::Sqrt(innervar);
|
---|
829 | else
|
---|
830 | {
|
---|
831 | *fLog << warn << GetDescriptor() << ": Variance of mean number of photo-electrons for inner pixels "
|
---|
832 | << " is smaller than 0. " << endl;
|
---|
833 | SetFFactorMethodValid(kFALSE);
|
---|
834 | return kFALSE;
|
---|
835 | }
|
---|
836 |
|
---|
837 | if (outervar > 0.)
|
---|
838 | outererr = TMath::Sqrt(outervar);
|
---|
839 | else
|
---|
840 | {
|
---|
841 | *fLog << warn << GetDescriptor() << ": Variance of mean number of photo-electrons for outer pixels "
|
---|
842 | << " is smaller than 0. " << endl;
|
---|
843 | SetFFactorMethodValid(kFALSE);
|
---|
844 | return kFALSE;
|
---|
845 | }
|
---|
846 |
|
---|
847 | const Float_t lowerpheinnerlimit = fMeanFluxPhesInnerPixel - innererr;
|
---|
848 | const Float_t upperpheinnerlimit = fMeanFluxPhesInnerPixel + innererr;
|
---|
849 |
|
---|
850 | const Float_t lowerpheouterlimit = fMeanFluxPhesOuterPixel - outererr;
|
---|
851 | const Float_t upperpheouterlimit = fMeanFluxPhesOuterPixel + outererr;
|
---|
852 |
|
---|
853 | sumweightsinner = 0.;
|
---|
854 | sumphesinner = 0.;
|
---|
855 | sumweightsouter = 0.;
|
---|
856 | sumphesouter = 0.;
|
---|
857 |
|
---|
858 | TIter Next2(fPixels);
|
---|
859 | MCalibrationChargePix *pix2;
|
---|
860 | while ((pix2=(MCalibrationChargePix*)Next2()))
|
---|
861 | {
|
---|
862 |
|
---|
863 | if (!pix2->IsFFactorMethodValid())
|
---|
864 | continue;
|
---|
865 |
|
---|
866 | const Int_t idx = pix2->GetPixId();
|
---|
867 |
|
---|
868 | if(!bad[idx].IsCalibrationResultOK())
|
---|
869 | continue;
|
---|
870 |
|
---|
871 | const Float_t nphe = pix2->GetPheFFactorMethod();
|
---|
872 | const Float_t npheerr = pix2->GetPheFFactorMethodErr();
|
---|
873 | const Float_t ratio = geom.GetPixRatio(idx);
|
---|
874 |
|
---|
875 | if (npheerr > 0.)
|
---|
876 | {
|
---|
877 | const Float_t weight = nphe*nphe/npheerr/npheerr;
|
---|
878 | //
|
---|
879 | // first the inner pixels:
|
---|
880 | //
|
---|
881 | if (ratio == 1.)
|
---|
882 | {
|
---|
883 |
|
---|
884 | if (nphe < lowerpheinnerlimit || nphe > upperpheinnerlimit)
|
---|
885 | {
|
---|
886 | bad[idx].SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
|
---|
887 | bad[idx].SetUnsuitable( MBadPixelsPix::kUnreliableRun);
|
---|
888 | continue;
|
---|
889 | }
|
---|
890 |
|
---|
891 | sumweightsinner += weight;
|
---|
892 | sumphesinner += weight*nphe;
|
---|
893 | }
|
---|
894 | else
|
---|
895 | {
|
---|
896 | //
|
---|
897 | // now the outers
|
---|
898 | //
|
---|
899 | if (nphe < lowerpheouterlimit || nphe > upperpheouterlimit)
|
---|
900 | {
|
---|
901 | bad[idx].SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
|
---|
902 | bad[idx].SetUnsuitable( MBadPixelsPix::kUnreliableRun);
|
---|
903 | continue;
|
---|
904 | }
|
---|
905 |
|
---|
906 | sumweightsouter += weight;
|
---|
907 | sumphesouter += weight*nphe;
|
---|
908 | }
|
---|
909 | } /* if npheerr != 0 */
|
---|
910 | } /* while ((pix2=(MCalibrationChargePix*)Next2())) */
|
---|
911 |
|
---|
912 | if (sumweightsinner <= 0. || sumphesinner <= 0.)
|
---|
913 | {
|
---|
914 | *fLog << warn << " Mean number of phe's from inner pixels cannot be calculated: "
|
---|
915 | << " Sum of weights: " << sumweightsinner
|
---|
916 | << " Sum of weighted phes: " << sumphesinner << endl;
|
---|
917 | return kFALSE;
|
---|
918 | }
|
---|
919 | else
|
---|
920 | {
|
---|
921 | fMeanFluxPhesInnerPixel = sumphesinner/sumweightsinner;
|
---|
922 | fMeanFluxPhesInnerPixelVar = (1./sumweightsinner)*fMeanFluxPhesInnerPixel*fMeanFluxPhesInnerPixel;
|
---|
923 |
|
---|
924 | }
|
---|
925 |
|
---|
926 | if (sumweightsouter <= 0. || sumphesouter <= 0.)
|
---|
927 | {
|
---|
928 | *fLog << warn << " Mean number of phe's from outer pixels cannot be calculated: "
|
---|
929 | << " Sum of weights or sum of weighted phes is 0. " << endl;
|
---|
930 | }
|
---|
931 | else
|
---|
932 | {
|
---|
933 | fMeanFluxPhesOuterPixel = sumphesouter/sumweightsouter;
|
---|
934 | fMeanFluxPhesOuterPixelVar = (1./sumweightsouter)*fMeanFluxPhesOuterPixel*fMeanFluxPhesOuterPixel;
|
---|
935 | }
|
---|
936 |
|
---|
937 | meanFluxPhotonsRelVar = fMeanFluxPhesInnerPixelVar
|
---|
938 | / (fMeanFluxPhesInnerPixel * fMeanFluxPhesInnerPixel);
|
---|
939 |
|
---|
940 | fMeanFluxPhotonsInnerPixel = fMeanFluxPhesInnerPixel/fAverageQE;
|
---|
941 | fMeanFluxPhotonsInnerPixelVar = (meanFluxPhotonsRelVar + avQERelVar)
|
---|
942 | * fMeanFluxPhotonsInnerPixel * fMeanFluxPhotonsInnerPixel;
|
---|
943 |
|
---|
944 | fMeanFluxPhotonsOuterPixel = 4. *fMeanFluxPhotonsInnerPixel;
|
---|
945 | fMeanFluxPhotonsOuterPixelVar = 16.*fMeanFluxPhotonsInnerPixelVar;
|
---|
946 |
|
---|
947 | *fLog << inf << " Mean number of photo-electrons from inner pixels (F-Factor Method): "
|
---|
948 | << fMeanFluxPhesInnerPixel << " +- " << GetMeanFluxPhesInnerPixelErr() << endl;
|
---|
949 |
|
---|
950 | *fLog << inf << " Mean number of photons from inner pixels (F-Factor Method): "
|
---|
951 | << fMeanFluxPhotonsInnerPixel << " +- " << GetMeanFluxPhotonsInnerPixelErr() << endl;
|
---|
952 |
|
---|
953 | return kTRUE;
|
---|
954 | }
|
---|
955 |
|
---|
956 | void MCalibrationChargeCam::ApplyFFactorCalibration(const MGeomCam &geom, const MBadPixelsCam &bad)
|
---|
957 | {
|
---|
958 |
|
---|
959 | const Float_t meanphotRelVar = fMeanFluxPhotonsInnerPixelVar
|
---|
960 | /( fMeanFluxPhotonsInnerPixel * fMeanFluxPhotonsInnerPixel );
|
---|
961 |
|
---|
962 | TIter Next(fPixels);
|
---|
963 | MCalibrationChargePix *pix;
|
---|
964 | while ((pix=(MCalibrationChargePix*)Next()))
|
---|
965 | {
|
---|
966 |
|
---|
967 | const Int_t idx = pix->GetPixId();
|
---|
968 |
|
---|
969 | if (!(bad[idx].IsCalibrationResultOK()))
|
---|
970 | {
|
---|
971 | pix->SetFFactorMethodValid(kFALSE);
|
---|
972 | continue;
|
---|
973 | }
|
---|
974 |
|
---|
975 | if (!(pix->IsFFactorMethodValid()))
|
---|
976 | continue;
|
---|
977 |
|
---|
978 | const Float_t ratio = geom.GetPixRatio(idx);
|
---|
979 | //
|
---|
980 | // Calculate the conversion factor between PHOTONS and FADC counts
|
---|
981 | //
|
---|
982 | // Nphot = Nphe / avQE
|
---|
983 | // conv = Nphot / FADC counts
|
---|
984 | //
|
---|
985 | Float_t conv;
|
---|
986 |
|
---|
987 | if (ratio == 1.)
|
---|
988 | conv = fMeanFluxPhotonsInnerPixel / pix->GetMeanCharge();
|
---|
989 | else
|
---|
990 | conv = fMeanFluxPhotonsOuterPixel / pix->GetMeanCharge();
|
---|
991 |
|
---|
992 | if (conv <= 0.)
|
---|
993 | {
|
---|
994 | pix->SetFFactorMethodValid(kFALSE);
|
---|
995 | continue;
|
---|
996 | }
|
---|
997 |
|
---|
998 | const Float_t chargeRelVar = pix->GetMeanChargeErr() * pix->GetMeanChargeErr()
|
---|
999 | / ( pix->GetMeanCharge() * pix->GetMeanCharge());
|
---|
1000 | const Float_t rsigmaChargeRelVar = pix->GetRSigmaChargeErr() * pix->GetRSigmaChargeErr()
|
---|
1001 | / (pix->GetRSigmaCharge() * pix->GetRSigmaCharge()) ;
|
---|
1002 |
|
---|
1003 | const Float_t convrelvar = meanphotRelVar + chargeRelVar;
|
---|
1004 |
|
---|
1005 | if (convrelvar > fConvFFactorRelVarLimit)
|
---|
1006 | {
|
---|
1007 | *fLog << warn << GetDescriptor() << ": Conversion Factor F-Factor Method Rel. Variance: "
|
---|
1008 | << convrelvar << " above limit of: " << fConvFFactorRelVarLimit
|
---|
1009 | << " in pixel: " << idx << endl;
|
---|
1010 | pix->SetFFactorMethodValid(kFALSE);
|
---|
1011 | continue;
|
---|
1012 | }
|
---|
1013 |
|
---|
1014 | //
|
---|
1015 | // Calculate the Total F-Factor of the camera (in photons)
|
---|
1016 | //
|
---|
1017 | const Float_t totalFFactor = (pix->GetRSigmaCharge()/pix->GetMeanCharge())
|
---|
1018 | *TMath::Sqrt(fMeanFluxPhotonsInnerPixel);
|
---|
1019 |
|
---|
1020 | //
|
---|
1021 | // Calculate the error of the Total F-Factor of the camera ( in photons )
|
---|
1022 | //
|
---|
1023 | const Float_t totalFFactorVar = rsigmaChargeRelVar + chargeRelVar + meanphotRelVar;
|
---|
1024 |
|
---|
1025 | if (convrelvar > 0. && conv > 0.)
|
---|
1026 | pix->SetConversionFFactorMethod(conv,
|
---|
1027 | TMath::Sqrt(convrelvar)*conv,
|
---|
1028 | totalFFactor*TMath::Sqrt(conv));
|
---|
1029 |
|
---|
1030 | pix->SetTotalFFactorFFactorMethod( totalFFactor );
|
---|
1031 |
|
---|
1032 | if (totalFFactorVar > 0.)
|
---|
1033 | pix->SetTotalFFactorFFactorMethodErr(TMath::Sqrt(totalFFactorVar));
|
---|
1034 |
|
---|
1035 | pix->SetFFactorMethodValid();
|
---|
1036 | }
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 |
|
---|
1040 |
|
---|
1041 | void MCalibrationChargeCam::ApplyBlindPixelCalibration(const MGeomCam &geom, const MBadPixelsCam &bad, const MCalibrationChargeBlindPix &blindpix)
|
---|
1042 | {
|
---|
1043 |
|
---|
1044 | Float_t flux = blindpix.GetMeanFluxInsidePlexiglass();
|
---|
1045 | Float_t fluxerr = blindpix.GetMeanFluxErrInsidePlexiglass();
|
---|
1046 |
|
---|
1047 | TIter Next(fPixels);
|
---|
1048 | MCalibrationChargePix *pix;
|
---|
1049 | while ((pix=(MCalibrationChargePix*)Next()))
|
---|
1050 | {
|
---|
1051 |
|
---|
1052 | const Int_t idx = pix->GetPixId();
|
---|
1053 |
|
---|
1054 | if (!(bad[idx].IsCalibrationResultOK()))
|
---|
1055 | {
|
---|
1056 | pix->SetBlindPixelMethodValid(kFALSE);
|
---|
1057 | continue;
|
---|
1058 | }
|
---|
1059 |
|
---|
1060 | const Float_t charge = pix->GetMeanCharge();
|
---|
1061 | const Float_t area = geom[idx].GetA();
|
---|
1062 | const Float_t chargeerr = pix->GetMeanChargeErr();
|
---|
1063 |
|
---|
1064 | const Float_t nphot = flux * area;
|
---|
1065 | const Float_t nphoterr = fluxerr * area;
|
---|
1066 | const Float_t conversion = nphot/charge;
|
---|
1067 | Float_t conversionerr;
|
---|
1068 |
|
---|
1069 | conversionerr = nphoterr/charge
|
---|
1070 | * nphoterr/charge ;
|
---|
1071 | conversionerr += chargeerr/charge
|
---|
1072 | * chargeerr/charge
|
---|
1073 | * conversion*conversion;
|
---|
1074 | conversionerr = TMath::Sqrt(conversionerr);
|
---|
1075 |
|
---|
1076 | const Float_t conversionsigma = 0.;
|
---|
1077 |
|
---|
1078 | pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma);
|
---|
1079 |
|
---|
1080 | if (conversionerr/conversion < 0.1)
|
---|
1081 | pix->SetBlindPixelMethodValid();
|
---|
1082 | }
|
---|
1083 | }
|
---|
1084 |
|
---|
1085 | void MCalibrationChargeCam::ApplyPINDiodeCalibration(const MGeomCam &geom, const MBadPixelsCam &bad, const MCalibrationChargePINDiode &pindiode)
|
---|
1086 | {
|
---|
1087 |
|
---|
1088 | Float_t flux = pindiode.GetMeanFluxOutsidePlexiglass();
|
---|
1089 | Float_t fluxerr = pindiode.GetMeanFluxErrOutsidePlexiglass();
|
---|
1090 |
|
---|
1091 | TIter Next(fPixels);
|
---|
1092 | MCalibrationChargePix *pix;
|
---|
1093 | while ((pix=(MCalibrationChargePix*)Next()))
|
---|
1094 | {
|
---|
1095 |
|
---|
1096 | const Int_t idx = pix->GetPixId();
|
---|
1097 |
|
---|
1098 | if (!(bad[idx].IsCalibrationResultOK()))
|
---|
1099 | {
|
---|
1100 | pix->SetPINDiodeMethodValid(kFALSE);
|
---|
1101 | continue;
|
---|
1102 | }
|
---|
1103 |
|
---|
1104 | const Float_t charge = pix->GetMeanCharge();
|
---|
1105 | const Float_t area = geom[idx].GetA();
|
---|
1106 | const Float_t chargeerr = pix->GetMeanChargeErr();
|
---|
1107 |
|
---|
1108 | const Float_t nphot = flux * area;
|
---|
1109 | const Float_t nphoterr = fluxerr * area;
|
---|
1110 | const Float_t conversion = nphot/charge;
|
---|
1111 |
|
---|
1112 | Float_t conversionerr;
|
---|
1113 |
|
---|
1114 | conversionerr = nphoterr/charge
|
---|
1115 | * nphoterr/charge ;
|
---|
1116 | conversionerr += chargeerr/charge
|
---|
1117 | * chargeerr/charge
|
---|
1118 | * conversion*conversion;
|
---|
1119 | if (conversionerr > 0.)
|
---|
1120 | conversionerr = TMath::Sqrt(conversionerr);
|
---|
1121 |
|
---|
1122 | const Float_t conversionsigma = 0.;
|
---|
1123 |
|
---|
1124 | pix->SetConversionPINDiodeMethod(conversion, conversionerr, conversionsigma);
|
---|
1125 |
|
---|
1126 | if (conversionerr/conversion < 0.1)
|
---|
1127 | pix->SetPINDiodeMethodValid();
|
---|
1128 |
|
---|
1129 | }
|
---|
1130 | }
|
---|
1131 |
|
---|
1132 |
|
---|
1133 | Bool_t MCalibrationChargeCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
1134 | {
|
---|
1135 |
|
---|
1136 | mean = (*this)[ipx].GetMeanConversionBlindPixelMethod();
|
---|
1137 | err = (*this)[ipx].GetConversionBlindPixelMethodErr();
|
---|
1138 | sigma = (*this)[ipx].GetSigmaConversionBlindPixelMethod();
|
---|
1139 |
|
---|
1140 | return kTRUE;
|
---|
1141 | }
|
---|
1142 |
|
---|
1143 |
|
---|
1144 | Bool_t MCalibrationChargeCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
1145 | {
|
---|
1146 |
|
---|
1147 | Float_t conv = (*this)[ipx].GetMeanConversionFFactorMethod();
|
---|
1148 |
|
---|
1149 | if (conv < 0.)
|
---|
1150 | return kFALSE;
|
---|
1151 |
|
---|
1152 | mean = conv;
|
---|
1153 | err = (*this)[ipx].GetConversionFFactorMethodErr();
|
---|
1154 | sigma = (*this)[ipx].GetSigmaConversionFFactorMethod();
|
---|
1155 |
|
---|
1156 | return kTRUE;
|
---|
1157 | }
|
---|
1158 |
|
---|
1159 |
|
---|
1160 | //-----------------------------------------------------------------------------------
|
---|
1161 | //
|
---|
1162 | // Calculates the conversion factor between the integral of FADCs slices
|
---|
1163 | // (as defined in the signal extractor MExtractSignal.cc)
|
---|
1164 | // and the number of photons reaching the plexiglass for one Inner Pixel
|
---|
1165 | //
|
---|
1166 | Bool_t MCalibrationChargeCam::GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
1167 | {
|
---|
1168 |
|
---|
1169 | mean = (*this)[ipx].GetMeanConversionPINDiodeMethod();
|
---|
1170 | err = (*this)[ipx].GetConversionPINDiodeMethodErr();
|
---|
1171 | sigma = (*this)[ipx].GetSigmaConversionPINDiodeMethod();
|
---|
1172 |
|
---|
1173 | return kFALSE;
|
---|
1174 |
|
---|
1175 | }
|
---|
1176 |
|
---|
1177 | //-----------------------------------------------------------------------------------
|
---|
1178 | //
|
---|
1179 | // Calculates the best combination of the three used methods possible
|
---|
1180 | // between the integral of FADCs slices
|
---|
1181 | // (as defined in the signal extractor MExtractSignal.cc)
|
---|
1182 | // and the number of photons reaching one Inner Pixel.
|
---|
1183 | // The procedure is not yet defined.
|
---|
1184 | //
|
---|
1185 | Bool_t MCalibrationChargeCam::GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
1186 | {
|
---|
1187 | return kFALSE;
|
---|
1188 |
|
---|
1189 | }
|
---|
1190 |
|
---|
1191 | /*
|
---|
1192 | void MCalibrationChargeCam::DrawHiLoFits()
|
---|
1193 | {
|
---|
1194 |
|
---|
1195 | if (!fOffsets)
|
---|
1196 | fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.);
|
---|
1197 | if (!fSlopes)
|
---|
1198 | fSlopes = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.);
|
---|
1199 | if (!fOffvsSlope)
|
---|
1200 | fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.);
|
---|
1201 |
|
---|
1202 | TIter Next(fPixels);
|
---|
1203 | MCalibrationPix *pix;
|
---|
1204 | MHCalibrationPixel *hist;
|
---|
1205 | while ((pix=(MCalibrationPix*)Next()))
|
---|
1206 | {
|
---|
1207 | hist = pix->GetHist();
|
---|
1208 | hist->FitHiGainvsLoGain();
|
---|
1209 | fOffsets->Fill(hist->GetOffset(),1.);
|
---|
1210 | fSlopes->Fill(hist->GetSlope(),1.);
|
---|
1211 | fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.);
|
---|
1212 | }
|
---|
1213 |
|
---|
1214 | TCanvas *c1 = new TCanvas();
|
---|
1215 |
|
---|
1216 | c1->Divide(1,3);
|
---|
1217 | c1->cd(1);
|
---|
1218 | fOffsets->Draw();
|
---|
1219 | gPad->Modified();
|
---|
1220 | gPad->Update();
|
---|
1221 |
|
---|
1222 | c1->cd(2);
|
---|
1223 | fSlopes->Draw();
|
---|
1224 | gPad->Modified();
|
---|
1225 | gPad->Update();
|
---|
1226 |
|
---|
1227 | c1->cd(3);
|
---|
1228 | fOffvsSlope->Draw("col1");
|
---|
1229 | gPad->Modified();
|
---|
1230 | gPad->Update();
|
---|
1231 | }
|
---|
1232 |
|
---|
1233 | */
|
---|