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 | !
|
---|
19 | ! Author(s): Markus Gaug 11/2003 <mailto:markus@ifae.es>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | //
|
---|
28 | // MCalibrationChargeCam
|
---|
29 | //
|
---|
30 | // Hold the whole Calibration results of the camera:
|
---|
31 | //
|
---|
32 | // 1) MCalibrationChargeCam initializes a TClonesArray whose elements are
|
---|
33 | // pointers to MCalibrationPix Containers
|
---|
34 | // 2) It initializes a pointer to an MCalibrationBlindPix container
|
---|
35 | // 3) It initializes a pointer to an MCalibrationPINDiode container
|
---|
36 | //
|
---|
37 | //
|
---|
38 | // The calculated values (types of GetPixelContent) are:
|
---|
39 | //
|
---|
40 | // --------------------------------------------------------------------------
|
---|
41 | //
|
---|
42 | // The types are as follows:
|
---|
43 | //
|
---|
44 | // Fitted values:
|
---|
45 | // ==============
|
---|
46 | //
|
---|
47 | // 0: Fitted Charge
|
---|
48 | // 1: Error of fitted Charge
|
---|
49 | // 2: Sigma of fitted Charge
|
---|
50 | // 3: Error of Sigma of fitted Charge
|
---|
51 | //
|
---|
52 | // Useful variables derived from the fit results:
|
---|
53 | // =============================================
|
---|
54 | //
|
---|
55 | // 4: Returned probability of Gauss fit to Charge distribution
|
---|
56 | // 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2)
|
---|
57 | // 6: Error Reduced Sigma of fitted Charge
|
---|
58 | // 7: Reduced Sigma per Charge
|
---|
59 | // 8: Error of Reduced Sigma per Charge
|
---|
60 | //
|
---|
61 | // Results of the different calibration methods:
|
---|
62 | // =============================================
|
---|
63 | //
|
---|
64 | // 9: Number of Photo-electrons obtained with the F-Factor method
|
---|
65 | // 10: Error on Number of Photo-electrons obtained with the F-Factor method
|
---|
66 | // 11: Mean conversion factor obtained with the F-Factor method
|
---|
67 | // 12: Error on the mean conversion factor obtained with the F-Factor method
|
---|
68 | // 13: Overall F-Factor of the readout obtained with the F-Factor method
|
---|
69 | // 14: Error on Overall F-Factor of the readout obtained with the F-Factor method
|
---|
70 | // 15: Number of Photons inside Plexiglass obtained with the Blind Pixel method
|
---|
71 | // 16: Error on Number of Photons inside Plexiglass obtained with the Blind Pixel method
|
---|
72 | // 17: Mean conversion factor obtained with the Blind Pixel method
|
---|
73 | // 18: Error on the mean conversion factor obtained with the Blind Pixel method
|
---|
74 | // 19: Overall F-Factor of the readout obtained with the Blind Pixel method
|
---|
75 | // 20: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
|
---|
76 | // 21: Number of Photons outside Plexiglass obtained with the PIN Diode method
|
---|
77 | // 22: Error on Number of Photons outside Plexiglass obtained with the PIN Diode method
|
---|
78 | // 23: Mean conversion factor obtained with the PIN Diode method
|
---|
79 | // 24: Error on the mean conversion factor obtained with the PIN Diode method
|
---|
80 | // 25: Overall F-Factor of the readout obtained with the PIN Diode method
|
---|
81 | // 26: Error on Overall F-Factor of the readout obtained with the PIN Diode method
|
---|
82 | //
|
---|
83 | // Localized defects:
|
---|
84 | // ==================
|
---|
85 | //
|
---|
86 | // 27: Excluded Pixels
|
---|
87 | // 28: Pixels where the fit did not succeed --> results obtained only from the histograms
|
---|
88 | // 29: Pixels with apparently wrong results
|
---|
89 | // 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations)
|
---|
90 | // 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a
|
---|
91 | // 32: Number of probable pickup events in the Hi Gain
|
---|
92 | // 33: Number of probable pickup events in the Lo Gain
|
---|
93 | //
|
---|
94 | // Other classifications of pixels:
|
---|
95 | // ================================
|
---|
96 | //
|
---|
97 | // 34: Pixels with saturated Hi-Gain
|
---|
98 | //
|
---|
99 | // Classification of validity of the calibrations:
|
---|
100 | // ===============================================
|
---|
101 | //
|
---|
102 | // 35: Pixels with valid calibration by the F-Factor-Method
|
---|
103 | // 36: Pixels with valid calibration by the Blind Pixel-Method
|
---|
104 | // 37: Pixels with valid calibration by the PIN Diode-Method
|
---|
105 | //
|
---|
106 | // Used Pedestals:
|
---|
107 | // ===============
|
---|
108 | //
|
---|
109 | // 38: Mean Pedestal over the entire range of signal extraction
|
---|
110 | // 39: Error on the Mean Pedestal over the entire range of signal extraction
|
---|
111 | // 40: Pedestal RMS over the entire range of signal extraction
|
---|
112 | // 41: Error on the Pedestal RMS over the entire range of signal extraction
|
---|
113 | //
|
---|
114 | // Calculated absolute arrival times (very low precision!):
|
---|
115 | // ========================================================
|
---|
116 | //
|
---|
117 | // 42: Absolute Arrival time of the signal
|
---|
118 | // 43: RMS of the Absolute Arrival time of the signal
|
---|
119 | //
|
---|
120 | /////////////////////////////////////////////////////////////////////////////
|
---|
121 | #include "MCalibrationChargeCam.h"
|
---|
122 |
|
---|
123 | #include <TH2.h>
|
---|
124 | #include <TCanvas.h>
|
---|
125 | #include <TClonesArray.h>
|
---|
126 |
|
---|
127 | #include "MLog.h"
|
---|
128 | #include "MLogManip.h"
|
---|
129 |
|
---|
130 | #include "MGeomCam.h"
|
---|
131 | #include "MGeomPix.h"
|
---|
132 |
|
---|
133 | #include "MCalibrationChargePix.h"
|
---|
134 | #include "MCalibrationChargeBlindPix.h"
|
---|
135 | #include "MCalibrationChargePINDiode.h"
|
---|
136 |
|
---|
137 |
|
---|
138 | ClassImp(MCalibrationChargeCam);
|
---|
139 |
|
---|
140 | using namespace std;
|
---|
141 |
|
---|
142 | const Int_t MCalibrationChargeCam::gkBlindPixelId = 559;
|
---|
143 | const Int_t MCalibrationChargeCam::gkPINDiodeId = 9999;
|
---|
144 |
|
---|
145 | // --------------------------------------------------------------------------
|
---|
146 | //
|
---|
147 | // Default constructor.
|
---|
148 | //
|
---|
149 | // Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry
|
---|
150 | // Later, a call to MCalibrationChargeCam::InitSize(Int_t size) has to be performed
|
---|
151 | //
|
---|
152 | // Creates an MCalibrationBlindPix container
|
---|
153 | //
|
---|
154 | MCalibrationChargeCam::MCalibrationChargeCam(const char *name, const char *title)
|
---|
155 | : fBlindPixel(NULL),
|
---|
156 | fPINDiode(NULL),
|
---|
157 | fOffsets(NULL),
|
---|
158 | fSlopes(NULL),
|
---|
159 | fOffvsSlope(NULL)
|
---|
160 | {
|
---|
161 | fName = name ? name : "MCalibrationChargeCam";
|
---|
162 | fTitle = title ? title : "Storage container for the Calibration Information in the camera";
|
---|
163 |
|
---|
164 | fPixels = new TClonesArray("MCalibrationChargePix",1);
|
---|
165 |
|
---|
166 | Clear();
|
---|
167 | }
|
---|
168 |
|
---|
169 | // --------------------------------------------------------------------------
|
---|
170 | //
|
---|
171 | // Delete the TClonesArray of MCalibrationPix containers
|
---|
172 | // Delete the MCalibrationPINDiode and the MCalibrationBlindPix
|
---|
173 | //
|
---|
174 | // Delete the histograms if they exist
|
---|
175 | //
|
---|
176 | MCalibrationChargeCam::~MCalibrationChargeCam()
|
---|
177 | {
|
---|
178 |
|
---|
179 | //
|
---|
180 | // delete fPixels should delete all Objects stored inside
|
---|
181 | //
|
---|
182 | delete fPixels;
|
---|
183 |
|
---|
184 | if (fOffsets)
|
---|
185 | delete fOffsets;
|
---|
186 | if (fSlopes)
|
---|
187 | delete fSlopes;
|
---|
188 | if (fOffvsSlope)
|
---|
189 | delete fOffvsSlope;
|
---|
190 |
|
---|
191 | }
|
---|
192 |
|
---|
193 | // -------------------------------------------------------------------
|
---|
194 | //
|
---|
195 | // This function simply allocates memory via the ROOT command:
|
---|
196 | // (TObject**) TStorage::ReAlloc(fCont, newSize * sizeof(TObject*),
|
---|
197 | // fSize * sizeof(TObject*));
|
---|
198 | // newSize corresponds to size in our case
|
---|
199 | // fSize is the old size (in most cases: 1)
|
---|
200 | //
|
---|
201 | void MCalibrationChargeCam::InitSize(const UInt_t i)
|
---|
202 | {
|
---|
203 |
|
---|
204 | //
|
---|
205 | // check if we have already initialized to size
|
---|
206 | //
|
---|
207 | if (CheckBounds(i))
|
---|
208 | return;
|
---|
209 |
|
---|
210 | fPixels->ExpandCreate(i);
|
---|
211 |
|
---|
212 | }
|
---|
213 |
|
---|
214 | // --------------------------------------------------------------------------
|
---|
215 | //
|
---|
216 | // This function returns the current size of the TClonesArray
|
---|
217 | // independently if the MCalibrationPix is filled with values or not.
|
---|
218 | //
|
---|
219 | // It is the size of the array fPixels.
|
---|
220 | //
|
---|
221 | Int_t MCalibrationChargeCam::GetSize() const
|
---|
222 | {
|
---|
223 | return fPixels->GetEntriesFast();
|
---|
224 | }
|
---|
225 |
|
---|
226 | // --------------------------------------------------------------------------
|
---|
227 | //
|
---|
228 | // Check if position i is inside the current bounds of the TClonesArray
|
---|
229 | //
|
---|
230 | Bool_t MCalibrationChargeCam::CheckBounds(Int_t i) const
|
---|
231 | {
|
---|
232 | return i < GetSize();
|
---|
233 | }
|
---|
234 |
|
---|
235 |
|
---|
236 | // --------------------------------------------------------------------------
|
---|
237 | //
|
---|
238 | // Get i-th pixel (pixel number)
|
---|
239 | //
|
---|
240 | MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i)
|
---|
241 | {
|
---|
242 | return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i));
|
---|
243 | }
|
---|
244 |
|
---|
245 | // --------------------------------------------------------------------------
|
---|
246 | //
|
---|
247 | // Get i-th pixel (pixel number)
|
---|
248 | //
|
---|
249 | const MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i) const
|
---|
250 | {
|
---|
251 | return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i));
|
---|
252 | }
|
---|
253 |
|
---|
254 |
|
---|
255 | // --------------------------------------
|
---|
256 | //
|
---|
257 | void MCalibrationChargeCam::Clear(Option_t *o)
|
---|
258 | {
|
---|
259 |
|
---|
260 | fPixels->ForEach(TObject, Clear)();
|
---|
261 |
|
---|
262 | fNumExcludedPixels = 0;
|
---|
263 |
|
---|
264 | CLRBIT(fFlags,kBlindPixelMethodValid);
|
---|
265 | CLRBIT(fFlags,kPINDiodeMethodValid);
|
---|
266 |
|
---|
267 | return;
|
---|
268 | }
|
---|
269 |
|
---|
270 | void MCalibrationChargeCam::SetBlindPixelMethodValid(const Bool_t b)
|
---|
271 | {
|
---|
272 | b ? SETBIT(fFlags, kBlindPixelMethodValid) : CLRBIT(fFlags, kBlindPixelMethodValid);
|
---|
273 | }
|
---|
274 |
|
---|
275 | void MCalibrationChargeCam::SetPINDiodeMethodValid(const Bool_t b)
|
---|
276 | {
|
---|
277 | b ? SETBIT(fFlags, kPINDiodeMethodValid) : CLRBIT(fFlags, kPINDiodeMethodValid);
|
---|
278 | }
|
---|
279 |
|
---|
280 | Bool_t MCalibrationChargeCam::IsBlindPixelMethodValid() const
|
---|
281 | {
|
---|
282 | return TESTBIT(fFlags,kBlindPixelMethodValid);
|
---|
283 | }
|
---|
284 |
|
---|
285 | Bool_t MCalibrationChargeCam::IsPINDiodeMethodValid() const
|
---|
286 | {
|
---|
287 | return TESTBIT(fFlags,kPINDiodeMethodValid);
|
---|
288 | }
|
---|
289 |
|
---|
290 |
|
---|
291 | // --------------------------------------------------------------------------
|
---|
292 | //
|
---|
293 | // Print first the well fitted pixels
|
---|
294 | // and then the ones which are not FitValid
|
---|
295 | //
|
---|
296 | void MCalibrationChargeCam::Print(Option_t *o) const
|
---|
297 | {
|
---|
298 |
|
---|
299 | *fLog << all << GetDescriptor() << ":" << endl;
|
---|
300 | int id = 0;
|
---|
301 |
|
---|
302 | *fLog << all << "Succesfully calibrated pixels:" << endl;
|
---|
303 | *fLog << all << endl;
|
---|
304 |
|
---|
305 | TIter Next(fPixels);
|
---|
306 | MCalibrationChargePix *pix;
|
---|
307 | while ((pix=(MCalibrationChargePix*)Next()))
|
---|
308 | {
|
---|
309 |
|
---|
310 | if (pix->IsChargeValid() && !pix->IsExcluded() && !pix->IsOscillating())
|
---|
311 | {
|
---|
312 |
|
---|
313 | *fLog << all << "Pix " << pix->GetPixId()
|
---|
314 | << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr()
|
---|
315 | << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge()
|
---|
316 | << " Reduced Sigma: " << pix->GetRSigmaCharge()
|
---|
317 | << " Nr Phe's: " << pix->GetPheFFactorMethod()
|
---|
318 | << endl;
|
---|
319 | id++;
|
---|
320 | }
|
---|
321 | }
|
---|
322 |
|
---|
323 | *fLog << all << id << " succesful pixels :-))" << endl;
|
---|
324 | id = 0;
|
---|
325 |
|
---|
326 | *fLog << all << endl;
|
---|
327 | *fLog << all << "Pixels with errors:" << endl;
|
---|
328 | *fLog << all << endl;
|
---|
329 |
|
---|
330 | TIter Next2(fPixels);
|
---|
331 | while ((pix=(MCalibrationChargePix*)Next2()))
|
---|
332 | {
|
---|
333 |
|
---|
334 | if (!pix->IsExcluded() && !pix->IsChargeValid())
|
---|
335 | {
|
---|
336 |
|
---|
337 |
|
---|
338 | *fLog << all << "Pix " << pix->GetPixId()
|
---|
339 | << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr()
|
---|
340 | << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge()
|
---|
341 | << " Reduced Sigma: " << pix->GetRSigmaCharge()
|
---|
342 | << " Nr Phe's: " << pix->GetPheFFactorMethod()
|
---|
343 | << endl;
|
---|
344 | id++;
|
---|
345 | }
|
---|
346 | }
|
---|
347 | *fLog << all << id << " pixels with errors :-((" << endl;
|
---|
348 |
|
---|
349 | *fLog << all << endl;
|
---|
350 | *fLog << all << "Pixels with oscillations:" << endl;
|
---|
351 | *fLog << all << endl;
|
---|
352 |
|
---|
353 | id = 0;
|
---|
354 |
|
---|
355 | TIter Next3(fPixels);
|
---|
356 | while ((pix=(MCalibrationChargePix*)Next3()))
|
---|
357 | {
|
---|
358 |
|
---|
359 | if ( pix->IsOscillating() && !pix->IsExcluded())
|
---|
360 | {
|
---|
361 |
|
---|
362 | *fLog << all << "Pix " << pix->GetPixId()
|
---|
363 | << ": Ped. Rms: " << pix->GetPedRms() << " +- " << pix->GetPedRmsErr()
|
---|
364 | << " Mean signal: " << pix->GetMeanCharge() << " +- " << pix->GetSigmaCharge()
|
---|
365 | << " Reduced Sigma: " << pix->GetRSigmaCharge()
|
---|
366 | << " Nr Phe's: " << pix->GetPheFFactorMethod()
|
---|
367 | << endl;
|
---|
368 | id++;
|
---|
369 | }
|
---|
370 | }
|
---|
371 | *fLog << all << id << " Oscillating pixels :-((" << endl;
|
---|
372 |
|
---|
373 |
|
---|
374 | *fLog << all << endl;
|
---|
375 | *fLog << all << "Excluded pixels:" << endl;
|
---|
376 | *fLog << all << endl;
|
---|
377 |
|
---|
378 | id = 0;
|
---|
379 |
|
---|
380 | TIter Next4(fPixels);
|
---|
381 | while ((pix=(MCalibrationChargePix*)Next4()))
|
---|
382 | {
|
---|
383 | if (pix->IsExcluded())
|
---|
384 | {
|
---|
385 | *fLog << all << pix->GetPixId() << endl;
|
---|
386 | id++;
|
---|
387 | }
|
---|
388 | }
|
---|
389 | *fLog << all << id << " Excluded pixels " << endl;
|
---|
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 | // Results of the different calibration methods:
|
---|
415 | // =============================================
|
---|
416 | //
|
---|
417 | // 9: Number of Photo-electrons obtained with the F-Factor method
|
---|
418 | // 10: Error on Number of Photo-electrons obtained with the F-Factor method
|
---|
419 | // 11: Mean conversion factor obtained with the F-Factor method
|
---|
420 | // 12: Error on the mean conversion factor obtained with the F-Factor method
|
---|
421 | // 13: Overall F-Factor of the readout obtained with the F-Factor method
|
---|
422 | // 14: Error on Overall F-Factor of the readout obtained with the F-Factor method
|
---|
423 | // 15: Number of Photons inside Plexiglass obtained with the Blind Pixel method
|
---|
424 | // 16: Error on Number of Photons inside Plexiglass obtained with the Blind Pixel method
|
---|
425 | // 17: Mean conversion factor obtained with the Blind Pixel method
|
---|
426 | // 18: Error on the mean conversion factor obtained with the Blind Pixel method
|
---|
427 | // 19: Overall F-Factor of the readout obtained with the Blind Pixel method
|
---|
428 | // 20: Error on Overall F-Factor of the readout obtained with the Blind Pixel method
|
---|
429 | // 21: Number of Photons outside Plexiglass obtained with the PIN Diode method
|
---|
430 | // 22: Error on Number of Photons outside Plexiglass obtained with the PIN Diode method
|
---|
431 | // 23: Mean conversion factor obtained with the PIN Diode method
|
---|
432 | // 24: Error on the mean conversion factor obtained with the PIN Diode method
|
---|
433 | // 25: Overall F-Factor of the readout obtained with the PIN Diode method
|
---|
434 | // 26: Error on Overall F-Factor of the readout obtained with the PIN Diode method
|
---|
435 | //
|
---|
436 | // Localized defects:
|
---|
437 | // ==================
|
---|
438 | //
|
---|
439 | // 27: Excluded Pixels
|
---|
440 | // 28: Pixels where the fit did not succeed --> results obtained only from the histograms
|
---|
441 | // 29: Pixels with apparently wrong results
|
---|
442 | // 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations)
|
---|
443 | // 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a
|
---|
444 | // 32: Number of probable pickup events in the Hi Gain
|
---|
445 | // 33: Number of probable pickup events in the Lo Gain
|
---|
446 | //
|
---|
447 | // Other classifications of pixels:
|
---|
448 | // ================================
|
---|
449 | //
|
---|
450 | // 34: Pixels with saturated Hi-Gain
|
---|
451 | //
|
---|
452 | // Classification of validity of the calibrations:
|
---|
453 | // ===============================================
|
---|
454 | //
|
---|
455 | // 35: Pixels with valid calibration by the F-Factor-Method
|
---|
456 | // 36: Pixels with valid calibration by the Blind Pixel-Method
|
---|
457 | // 37: Pixels with valid calibration by the PIN Diode-Method
|
---|
458 | //
|
---|
459 | // Used Pedestals:
|
---|
460 | // ===============
|
---|
461 | //
|
---|
462 | // 38: Mean Pedestal over the entire range of signal extraction
|
---|
463 | // 39: Error on the Mean Pedestal over the entire range of signal extraction
|
---|
464 | // 40: Pedestal RMS over the entire range of signal extraction
|
---|
465 | // 41: Error on the Pedestal RMS over the entire range of signal extraction
|
---|
466 | //
|
---|
467 | // Calculated absolute arrival times (very low precision!):
|
---|
468 | // ========================================================
|
---|
469 | //
|
---|
470 | // 42: Absolute Arrival time of the signal
|
---|
471 | // 43: RMS of the Absolute Arrival time of the signal
|
---|
472 | //
|
---|
473 | Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
474 | {
|
---|
475 |
|
---|
476 | if (idx > GetSize())
|
---|
477 | return kFALSE;
|
---|
478 |
|
---|
479 | Float_t area = cam[idx].GetA();
|
---|
480 |
|
---|
481 | if (area == 0)
|
---|
482 | return kFALSE;
|
---|
483 |
|
---|
484 | switch (type)
|
---|
485 | {
|
---|
486 | case 0:
|
---|
487 | if ((*this)[idx].IsExcluded())
|
---|
488 | return kFALSE;
|
---|
489 | val = (*this)[idx].GetMeanCharge();
|
---|
490 | break;
|
---|
491 | case 1:
|
---|
492 | if ((*this)[idx].IsExcluded())
|
---|
493 | return kFALSE;
|
---|
494 | val = (*this)[idx].GetMeanChargeErr();
|
---|
495 | break;
|
---|
496 | case 2:
|
---|
497 | if ((*this)[idx].IsExcluded())
|
---|
498 | return kFALSE;
|
---|
499 | val = (*this)[idx].GetSigmaCharge();
|
---|
500 | break;
|
---|
501 | case 3:
|
---|
502 | if ((*this)[idx].IsExcluded())
|
---|
503 | return kFALSE;
|
---|
504 | val = (*this)[idx].GetSigmaChargeErr();
|
---|
505 | break;
|
---|
506 | case 4:
|
---|
507 | if ((*this)[idx].IsExcluded())
|
---|
508 | return kFALSE;
|
---|
509 | val = (*this)[idx].GetChargeProb();
|
---|
510 | break;
|
---|
511 | case 5:
|
---|
512 | if ((*this)[idx].IsExcluded())
|
---|
513 | return kFALSE;
|
---|
514 | val = (*this)[idx].GetRSigmaCharge();
|
---|
515 | break;
|
---|
516 | case 6:
|
---|
517 | if ((*this)[idx].IsExcluded())
|
---|
518 | return kFALSE;
|
---|
519 | val = (*this)[idx].GetRSigmaChargeErr();
|
---|
520 | break;
|
---|
521 | case 7:
|
---|
522 | if ((*this)[idx].IsExcluded())
|
---|
523 | return kFALSE;
|
---|
524 | val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge();
|
---|
525 | break;
|
---|
526 | case 8:
|
---|
527 | if ((*this)[idx].IsExcluded())
|
---|
528 | return kFALSE;
|
---|
529 | // relative error RsigmaCharge square
|
---|
530 | val = (*this)[idx].GetRSigmaChargeErr()* (*this)[idx].GetRSigmaChargeErr()
|
---|
531 | / ((*this)[idx].GetRSigmaCharge() * (*this)[idx].GetRSigmaCharge() );
|
---|
532 | // relative error Charge square
|
---|
533 | val += (*this)[idx].GetMeanChargeErr() * (*this)[idx].GetMeanChargeErr()
|
---|
534 | / ((*this)[idx].GetMeanCharge() * (*this)[idx].GetMeanCharge() );
|
---|
535 | // calculate relative error out of squares
|
---|
536 | val = TMath::Sqrt(val) ;
|
---|
537 | // multiply with value to get absolute error
|
---|
538 | val *= (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge();
|
---|
539 | break;
|
---|
540 | case 9:
|
---|
541 | if ((*this)[idx].IsExcluded())
|
---|
542 | return kFALSE;
|
---|
543 | val = (*this)[idx].GetPheFFactorMethod();
|
---|
544 | break;
|
---|
545 | case 10:
|
---|
546 | if ((*this)[idx].IsExcluded())
|
---|
547 | return kFALSE;
|
---|
548 | val = (*this)[idx].GetPheFFactorMethodErr();
|
---|
549 | break;
|
---|
550 | case 11:
|
---|
551 | if ((*this)[idx].IsExcluded())
|
---|
552 | return kFALSE;
|
---|
553 | val = (*this)[idx].GetMeanConversionFFactorMethod();
|
---|
554 | break;
|
---|
555 | case 12:
|
---|
556 | if ((*this)[idx].IsExcluded())
|
---|
557 | return kFALSE;
|
---|
558 | val = (*this)[idx].GetConversionFFactorMethodErr();
|
---|
559 | break;
|
---|
560 | case 13:
|
---|
561 | if ((*this)[idx].IsExcluded())
|
---|
562 | return kFALSE;
|
---|
563 | val = (*this)[idx].GetTotalFFactorFFactorMethod();
|
---|
564 | break;
|
---|
565 | case 14:
|
---|
566 | if ((*this)[idx].IsExcluded())
|
---|
567 | return kFALSE;
|
---|
568 | val = (*this)[idx].GetTotalFFactorErrFFactorMethod();
|
---|
569 | break;
|
---|
570 | case 15:
|
---|
571 | if ((*this)[idx].IsExcluded())
|
---|
572 | return kFALSE;
|
---|
573 | val = fBlindPixel->GetMeanFluxInsidePlexiglass()*area;
|
---|
574 | break;
|
---|
575 | case 16:
|
---|
576 | if ((*this)[idx].IsExcluded())
|
---|
577 | return kFALSE;
|
---|
578 | val = fBlindPixel->GetMeanFluxErrInsidePlexiglass()*area;
|
---|
579 | break;
|
---|
580 | case 17:
|
---|
581 | if ((*this)[idx].IsExcluded())
|
---|
582 | return kFALSE;
|
---|
583 | val = (*this)[idx].GetMeanConversionBlindPixelMethod();
|
---|
584 | break;
|
---|
585 | case 18:
|
---|
586 | if ((*this)[idx].IsExcluded())
|
---|
587 | return kFALSE;
|
---|
588 | val = (*this)[idx].GetConversionBlindPixelMethodErr();
|
---|
589 | break;
|
---|
590 | case 19:
|
---|
591 | if ((*this)[idx].IsExcluded())
|
---|
592 | return kFALSE;
|
---|
593 | val = (*this)[idx].GetTotalFFactorBlindPixelMethod();
|
---|
594 | break;
|
---|
595 | case 20:
|
---|
596 | if ((*this)[idx].IsExcluded())
|
---|
597 | return kFALSE;
|
---|
598 | val = (*this)[idx].GetTotalFFactorErrBlindPixelMethod();
|
---|
599 | break;
|
---|
600 | case 21:
|
---|
601 | if ((*this)[idx].IsExcluded())
|
---|
602 | return kFALSE;
|
---|
603 | val = fPINDiode->GetMeanFluxOutsidePlexiglass()*area;
|
---|
604 | break;
|
---|
605 | case 22:
|
---|
606 | if ((*this)[idx].IsExcluded())
|
---|
607 | return kFALSE;
|
---|
608 | val = fPINDiode->GetMeanFluxErrOutsidePlexiglass()*area;
|
---|
609 | break;
|
---|
610 | case 23:
|
---|
611 | if ((*this)[idx].IsExcluded())
|
---|
612 | return kFALSE;
|
---|
613 | val = (*this)[idx].GetMeanConversionPINDiodeMethod();
|
---|
614 | break;
|
---|
615 | case 24:
|
---|
616 | if ((*this)[idx].IsExcluded())
|
---|
617 | return kFALSE;
|
---|
618 | val = (*this)[idx].GetConversionPINDiodeMethodErr();
|
---|
619 | break;
|
---|
620 | case 25:
|
---|
621 | if ((*this)[idx].IsExcluded())
|
---|
622 | return kFALSE;
|
---|
623 | val = (*this)[idx].GetTotalFFactorBlindPixelMethod();
|
---|
624 | break;
|
---|
625 | case 26:
|
---|
626 | if ((*this)[idx].IsExcluded())
|
---|
627 | return kFALSE;
|
---|
628 | val = (*this)[idx].GetTotalFFactorErrBlindPixelMethod();
|
---|
629 | break;
|
---|
630 | case 27:
|
---|
631 | if ((*this)[idx].IsExcluded())
|
---|
632 | val = 1.;
|
---|
633 | else
|
---|
634 | return kFALSE;
|
---|
635 | break;
|
---|
636 | case 28:
|
---|
637 | if ((*this)[idx].IsExcluded())
|
---|
638 | return kFALSE;
|
---|
639 | if (!(*this)[idx].IsFitted())
|
---|
640 | val = 1;
|
---|
641 | else
|
---|
642 | return kFALSE;
|
---|
643 | break;
|
---|
644 | case 29:
|
---|
645 | if ((*this)[idx].IsExcluded())
|
---|
646 | return kFALSE;
|
---|
647 | if (!(*this)[idx].IsChargeValid())
|
---|
648 | val = 1;
|
---|
649 | else
|
---|
650 | return kFALSE;
|
---|
651 | break;
|
---|
652 | case 30:
|
---|
653 | if ((*this)[idx].IsExcluded())
|
---|
654 | return kFALSE;
|
---|
655 | if ((*this)[idx].IsHiGainOscillating())
|
---|
656 | val = 1;
|
---|
657 | else
|
---|
658 | return kFALSE;
|
---|
659 | break;
|
---|
660 | case 31:
|
---|
661 | if ((*this)[idx].IsExcluded())
|
---|
662 | return kFALSE;
|
---|
663 | if ((*this)[idx].IsLoGainOscillating())
|
---|
664 | val = 1;
|
---|
665 | else
|
---|
666 | return kFALSE;
|
---|
667 | break;
|
---|
668 | case 32:
|
---|
669 | if ((*this)[idx].IsExcluded())
|
---|
670 | return kFALSE;
|
---|
671 | val = (*this)[idx].GetHiGainNumPickup();
|
---|
672 | break;
|
---|
673 | case 33:
|
---|
674 | if ((*this)[idx].IsExcluded())
|
---|
675 | return kFALSE;
|
---|
676 | val = (*this)[idx].GetLoGainNumPickup();
|
---|
677 | break;
|
---|
678 | case 34:
|
---|
679 | if ((*this)[idx].IsExcluded())
|
---|
680 | return kFALSE;
|
---|
681 | if ((*this)[idx].IsHiGainSaturation())
|
---|
682 | val = 1;
|
---|
683 | else
|
---|
684 | return kFALSE;
|
---|
685 | break;
|
---|
686 | case 35:
|
---|
687 | if ((*this)[idx].IsExcluded())
|
---|
688 | return kFALSE;
|
---|
689 | if ((*this)[idx].IsFFactorMethodValid())
|
---|
690 | val = 1;
|
---|
691 | else
|
---|
692 | return kFALSE;
|
---|
693 | break;
|
---|
694 | case 36:
|
---|
695 | if ((*this)[idx].IsExcluded())
|
---|
696 | return kFALSE;
|
---|
697 | if ((*this)[idx].IsBlindPixelMethodValid())
|
---|
698 | val = 1;
|
---|
699 | else
|
---|
700 | return kFALSE;
|
---|
701 | break;
|
---|
702 | case 37:
|
---|
703 | if ((*this)[idx].IsExcluded())
|
---|
704 | return kFALSE;
|
---|
705 | if ((*this)[idx].IsPINDiodeMethodValid())
|
---|
706 | val = 1;
|
---|
707 | else
|
---|
708 | return kFALSE;
|
---|
709 | break;
|
---|
710 | case 38:
|
---|
711 | if ((*this)[idx].IsExcluded())
|
---|
712 | return kFALSE;
|
---|
713 | val = (*this)[idx].GetPed();
|
---|
714 | break;
|
---|
715 | case 39:
|
---|
716 | if ((*this)[idx].IsExcluded())
|
---|
717 | return kFALSE;
|
---|
718 | val = (*this)[idx].GetPedErr();
|
---|
719 | break;
|
---|
720 | case 40:
|
---|
721 | if ((*this)[idx].IsExcluded())
|
---|
722 | return kFALSE;
|
---|
723 | val = (*this)[idx].GetPedRms();
|
---|
724 | break;
|
---|
725 | case 41:
|
---|
726 | if ((*this)[idx].IsExcluded())
|
---|
727 | return kFALSE;
|
---|
728 | val = (*this)[idx].GetPedErr()/2.;
|
---|
729 | break;
|
---|
730 | case 42:
|
---|
731 | if ((*this)[idx].IsExcluded())
|
---|
732 | return kFALSE;
|
---|
733 | val = (*this)[idx].GetAbsTimeMean();
|
---|
734 | break;
|
---|
735 | case 43:
|
---|
736 | if ((*this)[idx].IsExcluded())
|
---|
737 | return kFALSE;
|
---|
738 | val = (*this)[idx].GetAbsTimeRms();
|
---|
739 | break;
|
---|
740 | default:
|
---|
741 | return kFALSE;
|
---|
742 | }
|
---|
743 | return val!=-1.;
|
---|
744 | }
|
---|
745 |
|
---|
746 | // --------------------------------------------------------------------------
|
---|
747 | //
|
---|
748 | // What MHCamera needs in order to draw an individual pixel in the camera
|
---|
749 | //
|
---|
750 | void MCalibrationChargeCam::DrawPixelContent(Int_t idx) const
|
---|
751 | {
|
---|
752 | (*this)[idx].DrawClone();
|
---|
753 | }
|
---|
754 |
|
---|
755 | void MCalibrationChargeCam::ApplyBlindPixelCalibration()
|
---|
756 | {
|
---|
757 |
|
---|
758 | Float_t flux = fBlindPixel->GetMeanFluxInsidePlexiglass();
|
---|
759 | Float_t fluxerr = fBlindPixel->GetMeanFluxErrInsidePlexiglass();
|
---|
760 |
|
---|
761 | TIter Next(fPixels);
|
---|
762 | MCalibrationChargePix *pix;
|
---|
763 | while ((pix=(MCalibrationChargePix*)Next()))
|
---|
764 | {
|
---|
765 |
|
---|
766 | if(pix->IsChargeValid())
|
---|
767 | {
|
---|
768 |
|
---|
769 | const Int_t idx = pix->GetPixId();
|
---|
770 |
|
---|
771 | const Float_t charge = pix->GetMeanCharge();
|
---|
772 | const Float_t area = (*fGeomCam)[idx].GetA();
|
---|
773 | const Float_t chargeerr = pix->GetMeanChargeErr();
|
---|
774 |
|
---|
775 | const Float_t nphot = flux * area;
|
---|
776 | const Float_t nphoterr = fluxerr * area;
|
---|
777 | const Float_t conversion = nphot/charge;
|
---|
778 | Float_t conversionerr;
|
---|
779 |
|
---|
780 | conversionerr = nphoterr/charge
|
---|
781 | * nphoterr/charge ;
|
---|
782 | conversionerr += chargeerr/charge
|
---|
783 | * chargeerr/charge
|
---|
784 | * conversion*conversion;
|
---|
785 | conversionerr = TMath::Sqrt(conversionerr);
|
---|
786 |
|
---|
787 | const Float_t conversionsigma = 0.;
|
---|
788 |
|
---|
789 | pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma);
|
---|
790 |
|
---|
791 | if (conversionerr/conversion < 0.1)
|
---|
792 | pix->SetBlindPixelMethodValid();
|
---|
793 | }
|
---|
794 | }
|
---|
795 | }
|
---|
796 |
|
---|
797 |
|
---|
798 | void MCalibrationChargeCam::ApplyPINDiodeCalibration()
|
---|
799 | {
|
---|
800 |
|
---|
801 | Float_t flux = fPINDiode->GetMeanFluxOutsidePlexiglass();
|
---|
802 | Float_t fluxerr = fPINDiode->GetMeanFluxErrOutsidePlexiglass();
|
---|
803 |
|
---|
804 | TIter Next(fPixels);
|
---|
805 | MCalibrationChargePix *pix;
|
---|
806 | while ((pix=(MCalibrationChargePix*)Next()))
|
---|
807 | {
|
---|
808 |
|
---|
809 | if (pix->IsChargeValid())
|
---|
810 | {
|
---|
811 |
|
---|
812 | const Int_t idx = pix->GetPixId();
|
---|
813 |
|
---|
814 | const Float_t charge = pix->GetMeanCharge();
|
---|
815 | const Float_t area = (*fGeomCam)[idx].GetA();
|
---|
816 | const Float_t chargeerr = pix->GetMeanChargeErr();
|
---|
817 |
|
---|
818 | const Float_t nphot = flux * area;
|
---|
819 | const Float_t nphoterr = fluxerr * area;
|
---|
820 | const Float_t conversion = nphot/charge;
|
---|
821 |
|
---|
822 | Float_t conversionerr;
|
---|
823 |
|
---|
824 | conversionerr = nphoterr/charge
|
---|
825 | * nphoterr/charge ;
|
---|
826 | conversionerr += chargeerr/charge
|
---|
827 | * chargeerr/charge
|
---|
828 | * conversion*conversion;
|
---|
829 | if (conversionerr > 0.)
|
---|
830 | conversionerr = TMath::Sqrt(conversionerr);
|
---|
831 |
|
---|
832 | const Float_t conversionsigma = 0.;
|
---|
833 |
|
---|
834 | pix->SetConversionPINDiodeMethod(conversion, conversionerr, conversionsigma);
|
---|
835 |
|
---|
836 | if (conversionerr/conversion < 0.1)
|
---|
837 | pix->SetPINDiodeMethodValid();
|
---|
838 |
|
---|
839 | }
|
---|
840 | }
|
---|
841 | }
|
---|
842 |
|
---|
843 |
|
---|
844 |
|
---|
845 | Bool_t MCalibrationChargeCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
846 | {
|
---|
847 |
|
---|
848 | mean = (*this)[ipx].GetMeanConversionBlindPixelMethod();
|
---|
849 | err = (*this)[ipx].GetConversionBlindPixelMethodErr();
|
---|
850 | sigma = (*this)[ipx].GetSigmaConversionBlindPixelMethod();
|
---|
851 |
|
---|
852 | return kTRUE;
|
---|
853 | }
|
---|
854 |
|
---|
855 |
|
---|
856 | Bool_t MCalibrationChargeCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
857 | {
|
---|
858 |
|
---|
859 | Float_t conv = (*this)[ipx].GetMeanConversionFFactorMethod();
|
---|
860 |
|
---|
861 | if (conv < 0.)
|
---|
862 | return kFALSE;
|
---|
863 |
|
---|
864 | mean = conv;
|
---|
865 | err = (*this)[ipx].GetConversionFFactorMethodErr();
|
---|
866 | sigma = (*this)[ipx].GetSigmaConversionFFactorMethod();
|
---|
867 |
|
---|
868 | return kTRUE;
|
---|
869 | }
|
---|
870 |
|
---|
871 |
|
---|
872 | //-----------------------------------------------------------------------------------
|
---|
873 | //
|
---|
874 | // Calculates the conversion factor between the integral of FADCs slices
|
---|
875 | // (as defined in the signal extractor MExtractSignal.cc)
|
---|
876 | // and the number of photons reaching the plexiglass for one Inner Pixel
|
---|
877 | //
|
---|
878 | // FIXME: The PINDiode is still not working and so is the code
|
---|
879 | //
|
---|
880 | Bool_t MCalibrationChargeCam::GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
881 | {
|
---|
882 |
|
---|
883 | mean = (*this)[ipx].GetMeanConversionPINDiodeMethod();
|
---|
884 | err = (*this)[ipx].GetConversionPINDiodeMethodErr();
|
---|
885 | sigma = (*this)[ipx].GetSigmaConversionPINDiodeMethod();
|
---|
886 |
|
---|
887 | return kFALSE;
|
---|
888 |
|
---|
889 | }
|
---|
890 |
|
---|
891 | //-----------------------------------------------------------------------------------
|
---|
892 | //
|
---|
893 | // Calculates the best combination of the three used methods possible
|
---|
894 | // between the integral of FADCs slices
|
---|
895 | // (as defined in the signal extractor MExtractSignal.cc)
|
---|
896 | // and the number of photons reaching one Inner Pixel.
|
---|
897 | // The procedure is not yet defined.
|
---|
898 | //
|
---|
899 | // FIXME: The PINDiode is still not working and so is the code
|
---|
900 | //
|
---|
901 | Bool_t MCalibrationChargeCam::GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
902 | {
|
---|
903 | return kFALSE;
|
---|
904 |
|
---|
905 | }
|
---|
906 |
|
---|
907 | /*
|
---|
908 | void MCalibrationChargeCam::DrawHiLoFits()
|
---|
909 | {
|
---|
910 |
|
---|
911 | if (!fOffsets)
|
---|
912 | fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.);
|
---|
913 | if (!fSlopes)
|
---|
914 | fSlopes = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.);
|
---|
915 | if (!fOffvsSlope)
|
---|
916 | fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.);
|
---|
917 |
|
---|
918 | TIter Next(fPixels);
|
---|
919 | MCalibrationPix *pix;
|
---|
920 | MHCalibrationPixel *hist;
|
---|
921 | while ((pix=(MCalibrationPix*)Next()))
|
---|
922 | {
|
---|
923 | hist = pix->GetHist();
|
---|
924 | hist->FitHiGainvsLoGain();
|
---|
925 | fOffsets->Fill(hist->GetOffset(),1.);
|
---|
926 | fSlopes->Fill(hist->GetSlope(),1.);
|
---|
927 | fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.);
|
---|
928 | }
|
---|
929 |
|
---|
930 | TCanvas *c1 = new TCanvas();
|
---|
931 |
|
---|
932 | c1->Divide(1,3);
|
---|
933 | c1->cd(1);
|
---|
934 | fOffsets->Draw();
|
---|
935 | gPad->Modified();
|
---|
936 | gPad->Update();
|
---|
937 |
|
---|
938 | c1->cd(2);
|
---|
939 | fSlopes->Draw();
|
---|
940 | gPad->Modified();
|
---|
941 | gPad->Update();
|
---|
942 |
|
---|
943 | c1->cd(3);
|
---|
944 | fOffvsSlope->Draw("col1");
|
---|
945 | gPad->Modified();
|
---|
946 | gPad->Update();
|
---|
947 | }
|
---|
948 |
|
---|
949 | */
|
---|