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-2001
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | //
|
---|
28 | // MCalibrationCam
|
---|
29 | //
|
---|
30 | // Hold the whole Calibration results of the camera:
|
---|
31 | //
|
---|
32 | // 1) MCalibrationCam 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 | // 4)
|
---|
38 | //
|
---|
39 | /////////////////////////////////////////////////////////////////////////////
|
---|
40 | #include "MCalibrationCam.h"
|
---|
41 |
|
---|
42 | #include <TH2.h>
|
---|
43 | #include <TCanvas.h>
|
---|
44 | #include <TClonesArray.h>
|
---|
45 |
|
---|
46 | #include "MLog.h"
|
---|
47 | #include "MLogManip.h"
|
---|
48 |
|
---|
49 | #include "MGeomCam.h"
|
---|
50 |
|
---|
51 | #include "MCalibrationPix.h"
|
---|
52 | #include "MCalibrationConfig.h"
|
---|
53 | #include "MCalibrationBlindPix.h"
|
---|
54 | #include "MCalibrationPINDiode.h"
|
---|
55 |
|
---|
56 | #include "MHCalibrationPixel.h"
|
---|
57 |
|
---|
58 | ClassImp(MCalibrationCam);
|
---|
59 |
|
---|
60 | using namespace std;
|
---|
61 |
|
---|
62 | const Int_t MCalibrationCam::gkBlindPixelId = 559;
|
---|
63 | const Int_t MCalibrationCam::gkPINDiodeId = 9999;
|
---|
64 | const Float_t MCalibrationCam::gkTimeSliceWidth = 3.3;
|
---|
65 |
|
---|
66 | // --------------------------------------------------------------------------
|
---|
67 | //
|
---|
68 | // Default constructor.
|
---|
69 | //
|
---|
70 | // Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry
|
---|
71 | // Later, a call to MCalibrationCam::InitSize(Int_t size) has to be performed
|
---|
72 | //
|
---|
73 | // Creates an MCalibrationBlindPix container
|
---|
74 | // Creates an MCalibrationPINDiode container
|
---|
75 | //
|
---|
76 | MCalibrationCam::MCalibrationCam(const char *name, const char *title)
|
---|
77 | : fOffsets(NULL),
|
---|
78 | fSlopes(NULL),
|
---|
79 | fOffvsSlope(NULL)
|
---|
80 | {
|
---|
81 | fName = name ? name : "MCalibrationCam";
|
---|
82 | fTitle = title ? title : "Storage container for the Calibration Information in the camera";
|
---|
83 |
|
---|
84 | fPixels = new TClonesArray("MCalibrationPix",1);
|
---|
85 | fBlindPixel = new MCalibrationBlindPix();
|
---|
86 | fPINDiode = new MCalibrationPINDiode();
|
---|
87 |
|
---|
88 | Clear();
|
---|
89 | }
|
---|
90 |
|
---|
91 | // --------------------------------------------------------------------------
|
---|
92 | //
|
---|
93 | // Delete the TClonesArray of MCalibrationPix containers
|
---|
94 | // Delete the MCalibrationPINDiode and the MCalibrationBlindPix
|
---|
95 | //
|
---|
96 | // Delete the histograms if they exist
|
---|
97 | //
|
---|
98 | MCalibrationCam::~MCalibrationCam()
|
---|
99 | {
|
---|
100 |
|
---|
101 | //
|
---|
102 | // delete fPixels should delete all Objects stored inside
|
---|
103 | //
|
---|
104 | delete fPixels;
|
---|
105 | delete fBlindPixel;
|
---|
106 | delete fPINDiode;
|
---|
107 |
|
---|
108 | if (fOffsets)
|
---|
109 | delete fOffsets;
|
---|
110 | if (fSlopes)
|
---|
111 | delete fSlopes;
|
---|
112 | if (fOffvsSlope)
|
---|
113 | delete fOffvsSlope;
|
---|
114 |
|
---|
115 | }
|
---|
116 |
|
---|
117 | // -------------------------------------------------------------------
|
---|
118 | //
|
---|
119 | // This function simply allocates memory via the ROOT command:
|
---|
120 | // (TObject**) TStorage::ReAlloc(fCont, newSize * sizeof(TObject*),
|
---|
121 | // fSize * sizeof(TObject*));
|
---|
122 | // newSize corresponds to size in our case
|
---|
123 | // fSize is the old size (in most cases: 1)
|
---|
124 | //
|
---|
125 | void MCalibrationCam::InitSize(const UInt_t i)
|
---|
126 | {
|
---|
127 |
|
---|
128 | //
|
---|
129 | // check if we have already initialized to size
|
---|
130 | //
|
---|
131 | if (CheckBounds(i))
|
---|
132 | return;
|
---|
133 |
|
---|
134 | fPixels->ExpandCreate(i);
|
---|
135 |
|
---|
136 | }
|
---|
137 |
|
---|
138 | // --------------------------------------------------------------------------
|
---|
139 | //
|
---|
140 | // This function returns the current size of the TClonesArray
|
---|
141 | // independently if the MCalibrationPix is filled with values or not.
|
---|
142 | //
|
---|
143 | // It is the size of the array fPixels.
|
---|
144 | //
|
---|
145 | Int_t MCalibrationCam::GetSize() const
|
---|
146 | {
|
---|
147 | return fPixels->GetEntriesFast();
|
---|
148 | }
|
---|
149 |
|
---|
150 | // --------------------------------------------------------------------------
|
---|
151 | //
|
---|
152 | // Check if position i is inside the current bounds of the TClonesArray
|
---|
153 | //
|
---|
154 | Bool_t MCalibrationCam::CheckBounds(Int_t i) const
|
---|
155 | {
|
---|
156 | return i < GetSize();
|
---|
157 | }
|
---|
158 |
|
---|
159 |
|
---|
160 | // --------------------------------------------------------------------------
|
---|
161 | //
|
---|
162 | // Get i-th pixel (pixel number)
|
---|
163 | //
|
---|
164 | MCalibrationPix &MCalibrationCam::operator[](Int_t i)
|
---|
165 | {
|
---|
166 | return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
|
---|
167 | }
|
---|
168 |
|
---|
169 | // --------------------------------------------------------------------------
|
---|
170 | //
|
---|
171 | // Get i-th pixel (pixel number)
|
---|
172 | //
|
---|
173 | MCalibrationPix &MCalibrationCam::operator[](Int_t i) const
|
---|
174 | {
|
---|
175 | return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
|
---|
176 | }
|
---|
177 |
|
---|
178 |
|
---|
179 | // --------------------------------------
|
---|
180 | //
|
---|
181 | void MCalibrationCam::Clear(Option_t *o)
|
---|
182 | {
|
---|
183 |
|
---|
184 | fPixels->ForEach(TObject, Clear)();
|
---|
185 | fBlindPixel->Clear();
|
---|
186 | fPINDiode->Clear();
|
---|
187 |
|
---|
188 | fMeanPhotInsidePlexiglass = -1.;
|
---|
189 | fMeanPhotErrInsidePlexiglass = -1.;
|
---|
190 | fMeanPhotOutsidePlexiglass = -1.;
|
---|
191 | fMeanPhotErrOutsidePlexiglass = -1.;
|
---|
192 |
|
---|
193 | fNumExcludedPixels = 0;
|
---|
194 |
|
---|
195 | CLRBIT(fFlags,kBlindPixelMethodValid);
|
---|
196 | CLRBIT(fFlags,kPINDiodeMethodValid);
|
---|
197 | CLRBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
|
---|
198 | CLRBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);
|
---|
199 |
|
---|
200 | return;
|
---|
201 | }
|
---|
202 |
|
---|
203 | void MCalibrationCam::SetBlindPixelMethodValid(const Bool_t b)
|
---|
204 | {
|
---|
205 |
|
---|
206 | if (b)
|
---|
207 | SETBIT(fFlags, kBlindPixelMethodValid);
|
---|
208 | else
|
---|
209 | CLRBIT(fFlags, kBlindPixelMethodValid);
|
---|
210 |
|
---|
211 | }
|
---|
212 |
|
---|
213 | void MCalibrationCam::SetPINDiodeMethodValid(const Bool_t b)
|
---|
214 | {
|
---|
215 |
|
---|
216 | if (b)
|
---|
217 | SETBIT(fFlags, kPINDiodeMethodValid);
|
---|
218 | else
|
---|
219 | CLRBIT(fFlags, kPINDiodeMethodValid);
|
---|
220 |
|
---|
221 |
|
---|
222 | }
|
---|
223 |
|
---|
224 | Bool_t MCalibrationCam::IsBlindPixelMethodValid() const
|
---|
225 | {
|
---|
226 | return TESTBIT(fFlags,kBlindPixelMethodValid);
|
---|
227 | }
|
---|
228 |
|
---|
229 | Bool_t MCalibrationCam::IsPINDiodeMethodValid() const
|
---|
230 | {
|
---|
231 | return TESTBIT(fFlags,kPINDiodeMethodValid);
|
---|
232 | }
|
---|
233 |
|
---|
234 |
|
---|
235 | Bool_t MCalibrationCam::IsNumPhotInsidePlexiglassAvailable() const
|
---|
236 | {
|
---|
237 | return TESTBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
|
---|
238 | }
|
---|
239 |
|
---|
240 | Bool_t MCalibrationCam::IsNumPhotOutsidePlexiglassAvailable() const
|
---|
241 | {
|
---|
242 | return TESTBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);
|
---|
243 | }
|
---|
244 |
|
---|
245 |
|
---|
246 |
|
---|
247 | // --------------------------------------------------------------------------
|
---|
248 | //
|
---|
249 | // Print first the well fitted pixels
|
---|
250 | // and then the ones which are not FitValid
|
---|
251 | //
|
---|
252 | void MCalibrationCam::Print(Option_t *o) const
|
---|
253 | {
|
---|
254 |
|
---|
255 | *fLog << all << GetDescriptor() << ":" << endl;
|
---|
256 | int id = 0;
|
---|
257 |
|
---|
258 | *fLog << all << "Succesfully calibrated pixels:" << endl;
|
---|
259 | *fLog << all << endl;
|
---|
260 |
|
---|
261 | TIter Next(fPixels);
|
---|
262 | MCalibrationPix *pix;
|
---|
263 | while ((pix=(MCalibrationPix*)Next()))
|
---|
264 | {
|
---|
265 |
|
---|
266 | if (pix->IsChargeFitValid() && !pix->IsExcluded())
|
---|
267 | {
|
---|
268 |
|
---|
269 | Float_t rsigma = pix->GetRSigmaSquare();
|
---|
270 | if (rsigma > 0.)
|
---|
271 | rsigma = TMath::Sqrt(rsigma);
|
---|
272 |
|
---|
273 | *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- "
|
---|
274 | << pix->GetPedRms() << " Reduced Charge: " << pix->GetCharge() << " +- "
|
---|
275 | << pix->GetSigmaCharge() << " Reduced Sigma: " << rsigma
|
---|
276 | << " Nr Phe's: " << pix->GetPheFFactorMethod() << endl;
|
---|
277 | id++;
|
---|
278 | }
|
---|
279 | }
|
---|
280 |
|
---|
281 | *fLog << all << id << " succesful pixels :-))" << endl;
|
---|
282 | id = 0;
|
---|
283 |
|
---|
284 | *fLog << all << endl;
|
---|
285 | *fLog << all << "Pixels with errors:" << endl;
|
---|
286 | *fLog << all << endl;
|
---|
287 |
|
---|
288 | TIter Next2(fPixels);
|
---|
289 | while ((pix=(MCalibrationPix*)Next2()))
|
---|
290 | {
|
---|
291 |
|
---|
292 | if (!pix->IsChargeFitValid() && !pix->IsExcluded())
|
---|
293 | {
|
---|
294 |
|
---|
295 | Float_t rsigma = pix->GetRSigmaSquare();
|
---|
296 | if (rsigma > 0.)
|
---|
297 | rsigma = TMath::Sqrt(rsigma);
|
---|
298 |
|
---|
299 | *fLog << all << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- "
|
---|
300 | << pix->GetPedRms() << " Reduced Charge: " << pix->GetCharge() << " +- "
|
---|
301 | << pix->GetSigmaCharge() << " Reduced Sigma: " << rsigma << endl;
|
---|
302 | id++;
|
---|
303 | }
|
---|
304 | }
|
---|
305 | *fLog << all << id << " pixels with errors :-((" << endl;
|
---|
306 |
|
---|
307 | *fLog << all << endl;
|
---|
308 | *fLog << all << "Excluded pixels:" << endl;
|
---|
309 | *fLog << all << endl;
|
---|
310 |
|
---|
311 | TIter Next3(fPixels);
|
---|
312 | while ((pix=(MCalibrationPix*)Next3()))
|
---|
313 | if (pix->IsExcluded())
|
---|
314 | *fLog << all << pix->GetPixId() << endl;
|
---|
315 |
|
---|
316 | *fLog << all << fNumExcludedPixels << " excluded pixels " << endl;
|
---|
317 | }
|
---|
318 |
|
---|
319 | // --------------------------------------------------------------------------
|
---|
320 | //
|
---|
321 | // Return true if pixel is inside bounds of the TClonesArray fPixels
|
---|
322 | //
|
---|
323 | Bool_t MCalibrationCam::IsPixelUsed(Int_t idx) const
|
---|
324 | {
|
---|
325 | if (!CheckBounds(idx))
|
---|
326 | return kFALSE;
|
---|
327 |
|
---|
328 | return kTRUE;
|
---|
329 | }
|
---|
330 |
|
---|
331 | // --------------------------------------------------------------------------
|
---|
332 | //
|
---|
333 | // Return true if pixel has already been fitted once (independent of the result)
|
---|
334 | //
|
---|
335 | Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const
|
---|
336 | {
|
---|
337 |
|
---|
338 | if (!CheckBounds(idx))
|
---|
339 | return kFALSE;
|
---|
340 |
|
---|
341 | return (*this)[idx].IsFitted();
|
---|
342 | }
|
---|
343 |
|
---|
344 | // --------------------------------------------------------------------------
|
---|
345 | //
|
---|
346 | // Sets the user ranges of all histograms such that
|
---|
347 | // empty bins at the edges are not used. Additionally, it rebins the
|
---|
348 | // histograms such that in total, 50 bins are used.
|
---|
349 | //
|
---|
350 | void MCalibrationCam::CutEdges()
|
---|
351 | {
|
---|
352 |
|
---|
353 | fBlindPixel->GetHist()->CutAllEdges();
|
---|
354 | fPINDiode->GetHist()->CutAllEdges();
|
---|
355 |
|
---|
356 | TIter Next(fPixels);
|
---|
357 | MCalibrationPix *pix;
|
---|
358 | while ((pix=(MCalibrationPix*)Next()))
|
---|
359 | {
|
---|
360 | pix->GetHist()->CutAllEdges();
|
---|
361 | }
|
---|
362 |
|
---|
363 | return;
|
---|
364 | }
|
---|
365 |
|
---|
366 |
|
---|
367 | // The types are as follows:
|
---|
368 | //
|
---|
369 | // 0: Fitted Charge
|
---|
370 | // 1: Error of fitted Charge
|
---|
371 | // 2: Sigma of fitted Charge
|
---|
372 | // 3: Error of Sigma of fitted Charge
|
---|
373 | // 4: Returned probability of Gauss fit to Charge distribution
|
---|
374 | // 5: Mean arrival time
|
---|
375 | // 6: Sigma of the arrival time
|
---|
376 | // 7: Chi-square of the Gauss fit to the arrival times
|
---|
377 | // 8: Pedestal
|
---|
378 | // 9: Pedestal RMS
|
---|
379 | // 10: Reduced Sigma Square
|
---|
380 | // 11: Number of Photo-electrons after the F-Factor method
|
---|
381 | // 12: Error on the Number of Photo-electrons after the F-Factor method
|
---|
382 | // 13: Mean conversion factor after the F-Factor method
|
---|
383 | // 14: Error on the conversion factor after the F-Factor method
|
---|
384 | // 15: Number of Photons after the Blind Pixel method
|
---|
385 | // 16: Mean conversion factor after the Blind Pixel method
|
---|
386 | //
|
---|
387 | Bool_t MCalibrationCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
388 | {
|
---|
389 |
|
---|
390 | if (idx > GetSize())
|
---|
391 | return kFALSE;
|
---|
392 |
|
---|
393 | if ( (!(*this)[idx].IsChargeFitValid()) || (*this)[idx].IsExcluded())
|
---|
394 | return kFALSE;
|
---|
395 |
|
---|
396 | if (idx == gkBlindPixelId)
|
---|
397 | return kFALSE;
|
---|
398 |
|
---|
399 | if (idx == gkPINDiodeId)
|
---|
400 | return kFALSE;
|
---|
401 |
|
---|
402 | switch (type)
|
---|
403 | {
|
---|
404 | case 0:
|
---|
405 | val = (*this)[idx].GetCharge();
|
---|
406 | break;
|
---|
407 | case 1:
|
---|
408 | val = (*this)[idx].GetErrCharge();
|
---|
409 | break;
|
---|
410 | case 2:
|
---|
411 | val = (*this)[idx].GetSigmaCharge();
|
---|
412 | break;
|
---|
413 | case 3:
|
---|
414 | val = (*this)[idx].GetErrSigmaCharge();
|
---|
415 | break;
|
---|
416 | case 4:
|
---|
417 | val = (*this)[idx].GetChargeProb();
|
---|
418 | break;
|
---|
419 | case 5:
|
---|
420 | if (!(*this)[idx].IsTimeFitValid())
|
---|
421 | return kFALSE;
|
---|
422 | val = (*this)[idx].GetTime() * gkTimeSliceWidth;
|
---|
423 | break;
|
---|
424 | case 6:
|
---|
425 | if (!(*this)[idx].IsTimeFitValid())
|
---|
426 | return kFALSE;
|
---|
427 | val = (*this)[idx].GetSigmaTime() * gkTimeSliceWidth;
|
---|
428 | break;
|
---|
429 | case 7:
|
---|
430 | if (!(*this)[idx].IsTimeFitValid())
|
---|
431 | return kFALSE;
|
---|
432 | val = (*this)[idx].GetTimeProb();
|
---|
433 | break;
|
---|
434 | case 8:
|
---|
435 | val = (*this)[idx].GetPed();
|
---|
436 | break;
|
---|
437 | case 9:
|
---|
438 | val = (*this)[idx].GetPedRms();
|
---|
439 | break;
|
---|
440 | case 10:
|
---|
441 | if ((*this)[idx].GetRSigmaSquare() > 0.)
|
---|
442 | val = TMath::Sqrt((*this)[idx].GetRSigmaSquare());
|
---|
443 | else
|
---|
444 | val = -1.;
|
---|
445 | break;
|
---|
446 | case 11:
|
---|
447 | val = (*this)[idx].GetPheFFactorMethod();
|
---|
448 | break;
|
---|
449 | case 12:
|
---|
450 | val = (*this)[idx].GetPheFFactorMethodError();
|
---|
451 | break;
|
---|
452 | case 13:
|
---|
453 | val = (*this)[idx].GetMeanConversionFFactorMethod();
|
---|
454 | break;
|
---|
455 | case 14:
|
---|
456 | val = (*this)[idx].GetErrorConversionFFactorMethod();
|
---|
457 | break;
|
---|
458 | case 15:
|
---|
459 | if (idx < 397)
|
---|
460 | val = (double)fMeanPhotInsidePlexiglass;
|
---|
461 | else
|
---|
462 | val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
|
---|
463 | break;
|
---|
464 | case 16:
|
---|
465 | if (idx < 397)
|
---|
466 | val = (*this)[idx].GetMeanConversionBlindPixelMethod();
|
---|
467 | else
|
---|
468 | val = (*this)[idx].GetMeanConversionBlindPixelMethod()*gkCalibrationOutervsInnerPixelArea;
|
---|
469 | break;
|
---|
470 | case 17:
|
---|
471 | if ( (*this)[idx].GetRSigmaSquare() > 0. && (*this)[idx].GetCharge() > 0. )
|
---|
472 | val = TMath::Sqrt((*this)[idx].GetRSigmaSquare()) / (*this)[idx].GetCharge();
|
---|
473 | else
|
---|
474 | val = -1.;
|
---|
475 | break;
|
---|
476 | case 18:
|
---|
477 | if (!(*this)[idx].IsTimeFitValid())
|
---|
478 | return kFALSE;
|
---|
479 | val = (*this)[idx].GetAbsTimeMean();
|
---|
480 | break;
|
---|
481 | case 19:
|
---|
482 | if (!(*this)[idx].IsTimeFitValid())
|
---|
483 | return kFALSE;
|
---|
484 | val = (*this)[idx].GetAbsTimeMeanErr();
|
---|
485 | break;
|
---|
486 | case 20:
|
---|
487 | if (!(*this)[idx].IsTimeFitValid())
|
---|
488 | return kFALSE;
|
---|
489 | val = (*this)[idx].GetAbsTimeRms();
|
---|
490 | break;
|
---|
491 | case 21:
|
---|
492 | if (!(*this)[idx].IsTimeFitValid())
|
---|
493 | return kFALSE;
|
---|
494 | val = (*this)[idx].GetAbsTimeMeanErr()/TMath::Sqrt(2.);
|
---|
495 | break;
|
---|
496 | default:
|
---|
497 | return kFALSE;
|
---|
498 | }
|
---|
499 | return val!=-1.;
|
---|
500 | }
|
---|
501 |
|
---|
502 | // --------------------------------------------------------------------------
|
---|
503 | //
|
---|
504 | // What MHCamera needs in order to draw an individual pixel in the camera
|
---|
505 | //
|
---|
506 | void MCalibrationCam::DrawPixelContent(Int_t idx) const
|
---|
507 | {
|
---|
508 | (*this)[idx].Draw();
|
---|
509 | }
|
---|
510 |
|
---|
511 |
|
---|
512 | // --------------------------------------------------------------------------
|
---|
513 | //
|
---|
514 | //
|
---|
515 | //
|
---|
516 | Bool_t MCalibrationCam::CalcNumPhotInsidePlexiglass()
|
---|
517 | {
|
---|
518 |
|
---|
519 | if (!fBlindPixel->IsFitOK())
|
---|
520 | return kFALSE;
|
---|
521 |
|
---|
522 | const Float_t mean = fBlindPixel->GetLambda();
|
---|
523 | const Float_t merr = fBlindPixel->GetErrLambda();
|
---|
524 |
|
---|
525 | switch (fColor)
|
---|
526 | {
|
---|
527 | case kECGreen:
|
---|
528 | fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEGreen) // real photons
|
---|
529 | *TMath::Power(10,gkCalibrationBlindPixelAttGreen) // correct for absorption
|
---|
530 | * gkCalibrationInnerPixelArea; // correct for area
|
---|
531 |
|
---|
532 |
|
---|
533 | break;
|
---|
534 | case kECBlue:
|
---|
535 | fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEBlue )
|
---|
536 | *TMath::Power(10,gkCalibrationBlindPixelAttBlue)
|
---|
537 | * gkCalibrationInnerPixelArea;
|
---|
538 | break;
|
---|
539 | case kECUV:
|
---|
540 | fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEUV )
|
---|
541 | *TMath::Power(10,gkCalibrationBlindPixelAttUV)
|
---|
542 | * gkCalibrationInnerPixelArea;
|
---|
543 | break;
|
---|
544 | case kECCT1:
|
---|
545 | default:
|
---|
546 | fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQECT1 )
|
---|
547 | *TMath::Power(10,gkCalibrationBlindPixelAttCT1)
|
---|
548 | * gkCalibrationInnerPixelArea;
|
---|
549 | break;
|
---|
550 | }
|
---|
551 |
|
---|
552 | SETBIT(fFlags,kNumPhotInsidePlexiglassAvailable);
|
---|
553 |
|
---|
554 | *fLog << inf << endl;
|
---|
555 | *fLog << inf << "Mean number of Photons for an Inner Pixel (inside Plexiglass): "
|
---|
556 | << fMeanPhotInsidePlexiglass << endl;
|
---|
557 |
|
---|
558 | TIter Next(fPixels);
|
---|
559 | MCalibrationPix *pix;
|
---|
560 | while ((pix=(MCalibrationPix*)Next()))
|
---|
561 | {
|
---|
562 | if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.))
|
---|
563 | {
|
---|
564 |
|
---|
565 | Float_t conversion = fMeanPhotInsidePlexiglass/pix->GetCharge();
|
---|
566 | Float_t conversionerr = 0.;
|
---|
567 | Float_t conversionsigma = 0.;
|
---|
568 | pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma);
|
---|
569 |
|
---|
570 | if (conversionerr/conversion < 0.1)
|
---|
571 | pix->SetBlindPixelMethodValid();
|
---|
572 | }
|
---|
573 | }
|
---|
574 | return kTRUE;
|
---|
575 | }
|
---|
576 |
|
---|
577 |
|
---|
578 | Bool_t MCalibrationCam::CalcNumPhotOutsidePlexiglass()
|
---|
579 | {
|
---|
580 |
|
---|
581 | if (!fPINDiode->IsChargeFitValid())
|
---|
582 | return kFALSE;
|
---|
583 |
|
---|
584 | const Float_t mean = fPINDiode->GetCharge();
|
---|
585 | const Float_t merr = fPINDiode->GetErrCharge();
|
---|
586 |
|
---|
587 | switch (fColor)
|
---|
588 | {
|
---|
589 | case kECGreen:
|
---|
590 | fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEGreen) // real photons
|
---|
591 | * gkCalibrationInnerPixelvsPINDiodeArea; // correct for area
|
---|
592 | break;
|
---|
593 | case kECBlue:
|
---|
594 | fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEBlue )
|
---|
595 | * gkCalibrationInnerPixelvsPINDiodeArea;
|
---|
596 | break;
|
---|
597 | case kECUV:
|
---|
598 | fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEUV )
|
---|
599 | * gkCalibrationInnerPixelvsPINDiodeArea;
|
---|
600 | break;
|
---|
601 | case kECCT1:
|
---|
602 | default:
|
---|
603 | fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQECT1 )
|
---|
604 | * gkCalibrationInnerPixelvsPINDiodeArea;
|
---|
605 | break;
|
---|
606 | }
|
---|
607 |
|
---|
608 | SETBIT(fFlags,kNumPhotOutsidePlexiglassAvailable);
|
---|
609 |
|
---|
610 | *fLog << inf << endl;
|
---|
611 | *fLog << inf << mean << " Mean number of Photons for an Inner Pixel (outside Plexiglass): "
|
---|
612 | << fMeanPhotOutsidePlexiglass << endl;
|
---|
613 | *fLog << inf << endl;
|
---|
614 |
|
---|
615 | TIter Next(fPixels);
|
---|
616 | MCalibrationPix *pix;
|
---|
617 | while ((pix=(MCalibrationPix*)Next()))
|
---|
618 | {
|
---|
619 |
|
---|
620 | if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.))
|
---|
621 | pix->SetConversionPINDiodeMethod(fMeanPhotOutsidePlexiglass/pix->GetCharge(), 0., 0.);
|
---|
622 | }
|
---|
623 | return kTRUE;
|
---|
624 | }
|
---|
625 |
|
---|
626 |
|
---|
627 |
|
---|
628 | Bool_t MCalibrationCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
629 | {
|
---|
630 |
|
---|
631 | if (ipx < 0 || !IsPixelFitted(ipx))
|
---|
632 | return kFALSE;
|
---|
633 |
|
---|
634 | if (!IsNumPhotInsidePlexiglassAvailable())
|
---|
635 | if (!CalcNumPhotInsidePlexiglass())
|
---|
636 | return kFALSE;
|
---|
637 |
|
---|
638 | mean = (*this)[ipx].GetMeanConversionBlindPixelMethod();
|
---|
639 | err = (*this)[ipx].GetErrorConversionBlindPixelMethod();
|
---|
640 | sigma = (*this)[ipx].GetSigmaConversionBlindPixelMethod();
|
---|
641 |
|
---|
642 | return kTRUE;
|
---|
643 | }
|
---|
644 |
|
---|
645 |
|
---|
646 | Bool_t MCalibrationCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
647 | {
|
---|
648 |
|
---|
649 | if (ipx < 0 || !IsPixelFitted(ipx))
|
---|
650 | return kFALSE;
|
---|
651 |
|
---|
652 | Float_t conv = (*this)[ipx].GetMeanConversionFFactorMethod();
|
---|
653 |
|
---|
654 | if (conv < 0.)
|
---|
655 | return kFALSE;
|
---|
656 |
|
---|
657 | mean = conv;
|
---|
658 | err = (*this)[ipx].GetErrorConversionFFactorMethod();
|
---|
659 | sigma = (*this)[ipx].GetSigmaConversionFFactorMethod();
|
---|
660 |
|
---|
661 | return kTRUE;
|
---|
662 | }
|
---|
663 |
|
---|
664 |
|
---|
665 | //-----------------------------------------------------------------------------------
|
---|
666 | //
|
---|
667 | // Calculates the conversion factor between the integral of FADCs slices
|
---|
668 | // (as defined in the signal extractor MExtractSignal.cc)
|
---|
669 | // and the number of photons reaching the plexiglass for one Inner Pixel
|
---|
670 | //
|
---|
671 | // FIXME: The PINDiode is still not working and so is the code
|
---|
672 | //
|
---|
673 | Bool_t MCalibrationCam::GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
674 | {
|
---|
675 |
|
---|
676 | if (ipx < 0 || !IsPixelFitted(ipx))
|
---|
677 | return kFALSE;
|
---|
678 |
|
---|
679 | if (!IsNumPhotOutsidePlexiglassAvailable())
|
---|
680 | if (!CalcNumPhotOutsidePlexiglass())
|
---|
681 | return kFALSE;
|
---|
682 |
|
---|
683 | mean = (*this)[ipx].GetMeanConversionPINDiodeMethod();
|
---|
684 | err = (*this)[ipx].GetErrorConversionPINDiodeMethod();
|
---|
685 | sigma = (*this)[ipx].GetSigmaConversionPINDiodeMethod();
|
---|
686 |
|
---|
687 | return kFALSE;
|
---|
688 |
|
---|
689 | }
|
---|
690 |
|
---|
691 | //-----------------------------------------------------------------------------------
|
---|
692 | //
|
---|
693 | // Calculates the best combination of the three used methods possible
|
---|
694 | // between the integral of FADCs slices
|
---|
695 | // (as defined in the signal extractor MExtractSignal.cc)
|
---|
696 | // and the number of photons reaching one Inner Pixel.
|
---|
697 | // The procedure is not yet defined.
|
---|
698 | //
|
---|
699 | // FIXME: The PINDiode is still not working and so is the code
|
---|
700 | //
|
---|
701 | Bool_t MCalibrationCam::GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
---|
702 | {
|
---|
703 |
|
---|
704 | if (ipx < 0 || !IsPixelFitted(ipx))
|
---|
705 | return kFALSE;
|
---|
706 |
|
---|
707 | return kFALSE;
|
---|
708 |
|
---|
709 | }
|
---|
710 |
|
---|
711 |
|
---|
712 | void MCalibrationCam::DrawHiLoFits()
|
---|
713 | {
|
---|
714 |
|
---|
715 | if (!fOffsets)
|
---|
716 | fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.);
|
---|
717 | if (!fSlopes)
|
---|
718 | fSlopes = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.);
|
---|
719 | if (!fOffvsSlope)
|
---|
720 | fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.);
|
---|
721 |
|
---|
722 | TIter Next(fPixels);
|
---|
723 | MCalibrationPix *pix;
|
---|
724 | MHCalibrationPixel *hist;
|
---|
725 | while ((pix=(MCalibrationPix*)Next()))
|
---|
726 | {
|
---|
727 | hist = pix->GetHist();
|
---|
728 | hist->FitHiGainvsLoGain();
|
---|
729 | fOffsets->Fill(hist->GetOffset(),1.);
|
---|
730 | fSlopes->Fill(hist->GetSlope(),1.);
|
---|
731 | fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.);
|
---|
732 | }
|
---|
733 |
|
---|
734 | TCanvas *c1 = new TCanvas();
|
---|
735 |
|
---|
736 | c1->Divide(1,3);
|
---|
737 | c1->cd(1);
|
---|
738 | fOffsets->Draw();
|
---|
739 | gPad->Modified();
|
---|
740 | gPad->Update();
|
---|
741 |
|
---|
742 | c1->cd(2);
|
---|
743 | fSlopes->Draw();
|
---|
744 | gPad->Modified();
|
---|
745 | gPad->Update();
|
---|
746 |
|
---|
747 | c1->cd(3);
|
---|
748 | fOffvsSlope->Draw("col1");
|
---|
749 | gPad->Modified();
|
---|
750 | gPad->Update();
|
---|
751 | }
|
---|
752 |
|
---|