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