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 02/2004 <mailto:markus@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 | /////////////////////////////////////////////////////////////////////////////
|
---|
25 | //
|
---|
26 | // MHCalibrationTestCam
|
---|
27 | //
|
---|
28 | // Fills the calibrated signal from an MCerPhotEvt into
|
---|
29 | // MHCalibrationPix for every:
|
---|
30 | //
|
---|
31 | // - Pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray
|
---|
32 | // or MHCalibrationCam::fHiGainArray, respectively.
|
---|
33 | //
|
---|
34 | // - Average pixel per AREA index (e.g. inner and outer for the MAGIC camera),
|
---|
35 | // stored in the TObjArray's MHCalibrationCam::fAverageHiGainAreas and
|
---|
36 | // MHCalibrationCam::fAverageHiGainAreas
|
---|
37 | //
|
---|
38 | // - Average pixel per camera SECTOR (e.g. sectors 1-6 for the MAGIC camera),
|
---|
39 | // stored in the TObjArray's MHCalibrationCam::fAverageHiGainSectors
|
---|
40 | // and MHCalibrationCam::fAverageHiGainSectors
|
---|
41 | //
|
---|
42 | // The signals are filled into a histogram and an array, in order to perform
|
---|
43 | // a Fourier analysis (see MHGausEvents). The signals are moreover averaged on an
|
---|
44 | // event-by-event basis and written into the corresponding average pixels.
|
---|
45 | //
|
---|
46 | // The histograms are fitted to a Gaussian, mean and sigma with its errors
|
---|
47 | // and the fit probability are extracted. If none of these values are NaN's and
|
---|
48 | // if the probability is bigger than MHGausEvents::fProbLimit (default: 0.5%),
|
---|
49 | // the fit is declared valid.
|
---|
50 | // Otherwise, the fit is repeated within ranges of the previous mean
|
---|
51 | // +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit())
|
---|
52 | // In case this does not make the fit valid, the histogram means and RMS's are
|
---|
53 | // taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set:
|
---|
54 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) and
|
---|
55 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
56 | //
|
---|
57 | // Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas
|
---|
58 | // from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup)
|
---|
59 | //
|
---|
60 | // The class also fills arrays with the signal vs. event number, creates a fourier
|
---|
61 | // spectrum (see MHGausEvents::CreateFourierSpectrum()) and investigates if the
|
---|
62 | // projected fourier components follow an exponential distribution.
|
---|
63 | // In case that the probability of the exponential fit is less than
|
---|
64 | // MHGausEvents::fProbLimit (default: 0.5%), the following flags are set:
|
---|
65 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating ) and
|
---|
66 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
67 | //
|
---|
68 | // This same procedure is performed for the average pixels.
|
---|
69 | //
|
---|
70 | // The following results are written into an MCalibrationCam:
|
---|
71 | //
|
---|
72 | // - MCalibrationPix::SetMean()
|
---|
73 | // - MCalibrationPix::SetMeanErr()
|
---|
74 | // - MCalibrationPix::SetSigma()
|
---|
75 | // - MCalibrationPix::SetSigmaErr()
|
---|
76 | // - MCalibrationPix::SetProb()
|
---|
77 | // - MCalibrationPix::SetNumPickup()
|
---|
78 | //
|
---|
79 | // For all averaged areas, the fitted sigma is multiplied with the square root of
|
---|
80 | // the number involved pixels in order to be able to compare it to the average of
|
---|
81 | // sigmas in the camera.
|
---|
82 | //
|
---|
83 | /////////////////////////////////////////////////////////////////////////////
|
---|
84 | #include "MHCalibrationTestCam.h"
|
---|
85 |
|
---|
86 | #include "MHCalibrationPix.h"
|
---|
87 |
|
---|
88 | #include "MLog.h"
|
---|
89 | #include "MLogManip.h"
|
---|
90 |
|
---|
91 | #include "MParList.h"
|
---|
92 |
|
---|
93 | #include "MCalibrationTestCam.h"
|
---|
94 |
|
---|
95 | #include "MCalibrationCam.h"
|
---|
96 | #include "MCalibrationPix.h"
|
---|
97 |
|
---|
98 | #include "MCerPhotEvt.h"
|
---|
99 | #include "MCerPhotPix.h"
|
---|
100 |
|
---|
101 | #include "MGeomCam.h"
|
---|
102 | #include "MGeomPix.h"
|
---|
103 |
|
---|
104 | #include "MBadPixelsCam.h"
|
---|
105 | #include "MBadPixelsPix.h"
|
---|
106 |
|
---|
107 | ClassImp(MHCalibrationTestCam);
|
---|
108 |
|
---|
109 | using namespace std;
|
---|
110 |
|
---|
111 | const Int_t MHCalibrationTestCam::fgTestNbins = 900;
|
---|
112 | const Axis_t MHCalibrationTestCam::fgTestFirst = -5.;
|
---|
113 | const Axis_t MHCalibrationTestCam::fgTestLast = 5.;
|
---|
114 | // --------------------------------------------------------------------------
|
---|
115 | //
|
---|
116 | // Default Constructor.
|
---|
117 | //
|
---|
118 | // Sets:
|
---|
119 | // - fTestNbins to fgTestNbins
|
---|
120 | // - fTestFirst to fgTestFirst
|
---|
121 | // - fTestLast to fgTestLast
|
---|
122 | //
|
---|
123 | MHCalibrationTestCam::MHCalibrationTestCam(const char *name, const char *title)
|
---|
124 | {
|
---|
125 |
|
---|
126 | fName = name ? name : "MHCalibrationTestCam";
|
---|
127 | fTitle = title ? title : "Histogram class for testing the calibration";
|
---|
128 |
|
---|
129 | SetTestNbins();
|
---|
130 | SetTestFirst();
|
---|
131 | SetTestLast ();
|
---|
132 | }
|
---|
133 |
|
---|
134 | // --------------------------------------------------------------------------
|
---|
135 | //
|
---|
136 | // Gets or creates the pointers to:
|
---|
137 | // - MCalibrationTestCam
|
---|
138 | //
|
---|
139 | // Searches pointer to:
|
---|
140 | // - MCerPhotEvt
|
---|
141 | //
|
---|
142 | // Initializes, if empty to MGeomCam::GetNumAreas() for:
|
---|
143 | // - MHCalibrationCam::fAverageHiGainAreas
|
---|
144 | //
|
---|
145 | // Initializes, if empty to MGeomCam::GetNumSectors() for:
|
---|
146 | // - MHCalibrationCam::fAverageHiGainSectors
|
---|
147 | //
|
---|
148 | // Calls MHCalibrationCam::InitHists() for every entry in:
|
---|
149 | // - MHCalibrationCam::fHiGainArray
|
---|
150 | // - MHCalibrationCam::fAverageHiGainAreas
|
---|
151 | // - MHCalibrationCam::fAverageHiGainSectors
|
---|
152 | //
|
---|
153 | // Sets Titles and Names for the Histograms
|
---|
154 | // - MHCalibrationCam::fAverageHiGainAreas
|
---|
155 | // - MHCalibrationCam::fAverageHiGainSectors
|
---|
156 | //
|
---|
157 | Bool_t MHCalibrationTestCam::ReInitHists(MParList *pList)
|
---|
158 | {
|
---|
159 |
|
---|
160 | MCerPhotEvt *signal = (MCerPhotEvt*)pList->FindObject("MCerPhotEvt");
|
---|
161 | if (!signal)
|
---|
162 | {
|
---|
163 | *fLog << err << "MCerPhotEvt not found... abort." << endl;
|
---|
164 | return kFALSE;
|
---|
165 | }
|
---|
166 |
|
---|
167 |
|
---|
168 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
169 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
170 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
171 |
|
---|
172 | if (fHiGainArray->GetEntries()==0)
|
---|
173 | {
|
---|
174 | fHiGainArray->Expand(npixels);
|
---|
175 | for (Int_t i=0; i<npixels; i++)
|
---|
176 | {
|
---|
177 | (*fHiGainArray)[i] = new MHCalibrationPix("Calibrated Events",
|
---|
178 | "Test Calibration Pixel");
|
---|
179 |
|
---|
180 | MHCalibrationPix &pix = (*this)[i];
|
---|
181 |
|
---|
182 | pix.SetNbins(fTestNbins);
|
---|
183 | pix.SetFirst(fTestFirst);
|
---|
184 | pix.SetLast (fTestLast);
|
---|
185 |
|
---|
186 | TH1F *h = pix.GetHGausHist();
|
---|
187 |
|
---|
188 | h->SetName ("HTestHiGainPix");
|
---|
189 | h->SetTitle("Distribution of calibrated Photons Pixel ");
|
---|
190 | h->SetXTitle("Nr. Photons");
|
---|
191 | h->SetYTitle("Nr. of events");
|
---|
192 |
|
---|
193 | InitHists((*this)[i],(*fBadPixels)[i],i);
|
---|
194 | }
|
---|
195 | }
|
---|
196 |
|
---|
197 |
|
---|
198 | if (fAverageHiGainAreas->GetEntries()==0)
|
---|
199 | {
|
---|
200 | fAverageHiGainAreas->Expand(nareas);
|
---|
201 |
|
---|
202 | for (Int_t j=0; j<nareas; j++)
|
---|
203 | {
|
---|
204 | (*fAverageHiGainAreas)[j] =
|
---|
205 | new MHCalibrationPix("MHCalibrationTestAverageArea",
|
---|
206 | "Average Test Calibrations Area Idx ");
|
---|
207 |
|
---|
208 | MHCalibrationPix &pix = GetAverageHiGainArea(j);
|
---|
209 |
|
---|
210 | pix.SetNbins(fTestNbins*3);
|
---|
211 | pix.SetFirst(fTestFirst);
|
---|
212 | pix.SetLast (fTestLast);
|
---|
213 |
|
---|
214 | TH1F *h = pix.GetHGausHist();
|
---|
215 |
|
---|
216 | h->SetName ("HTestPix");
|
---|
217 | h->SetTitle("Test Calibrations Area Idx ");
|
---|
218 | h->SetXTitle("Nr. Photons");
|
---|
219 | h->SetYTitle("Nr. of events");
|
---|
220 |
|
---|
221 | pix.InitBins();
|
---|
222 | pix.ChangeHistId(j);
|
---|
223 | pix.SetEventFrequency(fPulserFrequency);
|
---|
224 |
|
---|
225 | h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));
|
---|
226 | }
|
---|
227 | }
|
---|
228 |
|
---|
229 |
|
---|
230 | if (fAverageHiGainSectors->GetEntries()==0)
|
---|
231 | {
|
---|
232 | fAverageHiGainSectors->Expand(nsectors);
|
---|
233 |
|
---|
234 | for (Int_t j=0; j<nsectors; j++)
|
---|
235 | {
|
---|
236 | (*fAverageHiGainSectors)[j] =
|
---|
237 | new MHCalibrationPix("MHCalibrationTestAverageSector",
|
---|
238 | "Average Test Calibrations Sector ");
|
---|
239 |
|
---|
240 | MHCalibrationPix &pix = GetAverageHiGainSector(j);
|
---|
241 |
|
---|
242 | pix.SetNbins(fTestNbins*3);
|
---|
243 | pix.SetFirst(fTestFirst);
|
---|
244 | pix.SetLast (fTestLast);
|
---|
245 |
|
---|
246 | TH1F *h = pix.GetHGausHist();
|
---|
247 |
|
---|
248 | h->SetName ("HTestPix");
|
---|
249 | h->SetTitle("Test Calibrations Sector ");
|
---|
250 | h->SetXTitle("Nr. Photons");
|
---|
251 | h->SetYTitle("Nr. of events");
|
---|
252 |
|
---|
253 | pix.InitBins();
|
---|
254 | pix.ChangeHistId(j);
|
---|
255 | pix.SetEventFrequency(fPulserFrequency);
|
---|
256 |
|
---|
257 | h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));
|
---|
258 | }
|
---|
259 | }
|
---|
260 |
|
---|
261 |
|
---|
262 | fMeanMeanPhotPerArea.Set(nareas);
|
---|
263 | fRmsMeanPhotPerArea .Set(nareas);
|
---|
264 | fMeanSigmaPhotPerArea.Set(nareas);
|
---|
265 | fRmsSigmaPhotPerArea.Set(nareas);
|
---|
266 |
|
---|
267 | SetLoGain(kFALSE);
|
---|
268 |
|
---|
269 | return kTRUE;
|
---|
270 | }
|
---|
271 |
|
---|
272 |
|
---|
273 | // -------------------------------------------------------------------------------
|
---|
274 | //
|
---|
275 | // Retrieves pointer to MCerPhotEvt:
|
---|
276 | //
|
---|
277 | // Retrieves from MGeomCam:
|
---|
278 | // - number of pixels
|
---|
279 | // - number of pixel areas
|
---|
280 | // - number of sectors
|
---|
281 | //
|
---|
282 | // Fills HiGain histograms (MHGausEvents::FillHistAndArray())
|
---|
283 | // with:
|
---|
284 | // - MCerPhotPix::GetNumPhotons(pixid);
|
---|
285 | //
|
---|
286 | Bool_t MHCalibrationTestCam::FillHists(const MParContainer *par, const Stat_t w)
|
---|
287 | {
|
---|
288 |
|
---|
289 | MCerPhotEvt *calibration = (MCerPhotEvt*)par;
|
---|
290 | if (!calibration)
|
---|
291 | {
|
---|
292 | gLog << err << "No argument in MHCalibrationTestCam::Fill... abort." << endl;
|
---|
293 | return kFALSE;
|
---|
294 | }
|
---|
295 |
|
---|
296 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
297 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
298 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
299 |
|
---|
300 | TArrayF sumareahi (nareas);
|
---|
301 | TArrayF sumsectorhi(nsectors);
|
---|
302 | TArrayI numareahi (nareas);
|
---|
303 | TArrayI numsectorhi(nsectors);
|
---|
304 |
|
---|
305 | for (Int_t i=0; i<npixels; i++)
|
---|
306 | {
|
---|
307 |
|
---|
308 | MHCalibrationPix &histhi = (*this)[i];
|
---|
309 |
|
---|
310 | const MCerPhotPix *pix = calibration->GetPixById(i);
|
---|
311 | if (!pix)
|
---|
312 | continue;
|
---|
313 |
|
---|
314 |
|
---|
315 | const Float_t signal = pix->GetNumPhotons();
|
---|
316 |
|
---|
317 | if (signal < 0.0001)
|
---|
318 | continue;
|
---|
319 |
|
---|
320 | const Int_t aidx = (*fGeom)[i].GetAidx();
|
---|
321 | const Int_t sector = (*fGeom)[i].GetSector();
|
---|
322 |
|
---|
323 | histhi.FillHistAndArray(signal) ;
|
---|
324 |
|
---|
325 | sumareahi [aidx] += signal;
|
---|
326 | numareahi [aidx] ++;
|
---|
327 | sumsectorhi[sector] += signal;
|
---|
328 | numsectorhi[sector] ++;
|
---|
329 | }
|
---|
330 |
|
---|
331 | for (Int_t j=0; j<nareas; j++)
|
---|
332 | {
|
---|
333 | MHCalibrationPix &histhi = GetAverageHiGainArea(j);
|
---|
334 | histhi.FillHistAndArray(numareahi[j] == 0 ? 0. : sumareahi[j]/numareahi[j]);
|
---|
335 | }
|
---|
336 |
|
---|
337 | for (Int_t j=0; j<nsectors; j++)
|
---|
338 | {
|
---|
339 | MHCalibrationPix &histhi = GetAverageHiGainSector(j);
|
---|
340 | histhi.FillHistAndArray(numsectorhi[j] == 0 ? 0. : sumsectorhi[j]/numsectorhi[j]);
|
---|
341 |
|
---|
342 | }
|
---|
343 |
|
---|
344 | return kTRUE;
|
---|
345 | }
|
---|
346 |
|
---|
347 | // --------------------------------------------------------------------------
|
---|
348 | //
|
---|
349 | // Calls:
|
---|
350 | // - MHCalibrationCam::FitHiGainArrays() with flags:
|
---|
351 | // MBadPixelsPix::kTestNotFitted and MBadPixelsPix::kTestOscillating
|
---|
352 | //
|
---|
353 | Bool_t MHCalibrationTestCam::FinalizeHists()
|
---|
354 | {
|
---|
355 |
|
---|
356 | *fLog << endl;
|
---|
357 |
|
---|
358 | TArrayI numaidx;
|
---|
359 | numaidx.Set(fGeom->GetNumAreas());
|
---|
360 |
|
---|
361 | for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
|
---|
362 | {
|
---|
363 |
|
---|
364 | MHCalibrationPix &hist = (*this)[i];
|
---|
365 |
|
---|
366 | if (hist.IsEmpty())
|
---|
367 | continue;
|
---|
368 |
|
---|
369 | if (!hist.FitGaus())
|
---|
370 | if (!hist.RepeatFit())
|
---|
371 | hist.BypassFit();
|
---|
372 |
|
---|
373 | hist.CreateFourierSpectrum();
|
---|
374 |
|
---|
375 | const Float_t area = (*fGeom)[i].GetA();
|
---|
376 | const Int_t aidx = (*fGeom)[i].GetAidx();
|
---|
377 |
|
---|
378 | fMeanMeanPhotPerArea[aidx] += hist.GetMean() / area;
|
---|
379 | fRmsMeanPhotPerArea [aidx] += hist.GetMean() / area * hist.GetMean() / area;
|
---|
380 | fMeanSigmaPhotPerArea[aidx] += hist.GetSigma()/ area;
|
---|
381 | fRmsSigmaPhotPerArea [aidx] += hist.GetSigma()/ area * hist.GetSigma() / area;
|
---|
382 | numaidx[aidx]++;
|
---|
383 | }
|
---|
384 |
|
---|
385 |
|
---|
386 | for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
|
---|
387 | {
|
---|
388 |
|
---|
389 | MHCalibrationPix &hist = GetAverageHiGainArea(j);
|
---|
390 | if (hist.IsEmpty())
|
---|
391 | continue;
|
---|
392 |
|
---|
393 | if (!hist.FitGaus())
|
---|
394 | if (!hist.RepeatFit())
|
---|
395 | hist.BypassFit();
|
---|
396 |
|
---|
397 | hist.CreateFourierSpectrum();
|
---|
398 |
|
---|
399 | fRmsMeanPhotPerArea [j] -= fMeanMeanPhotPerArea [j]*fMeanMeanPhotPerArea [j]/numaidx[j];
|
---|
400 | fRmsSigmaPhotPerArea[j] -= fMeanSigmaPhotPerArea[j]*fMeanSigmaPhotPerArea[j]/numaidx[j];
|
---|
401 |
|
---|
402 | fMeanMeanPhotPerArea [j] /= numaidx[j];
|
---|
403 | fMeanSigmaPhotPerArea[j] /= numaidx[j];
|
---|
404 | fRmsMeanPhotPerArea [j] /= numaidx[j]-1.;
|
---|
405 | fRmsSigmaPhotPerArea [j] /= numaidx[j]-1.;
|
---|
406 |
|
---|
407 | if (fRmsMeanPhotPerArea [j] > 0.)
|
---|
408 | fRmsMeanPhotPerArea [j] = TMath::Sqrt(fRmsMeanPhotPerArea [j]);
|
---|
409 | if (fRmsSigmaPhotPerArea [j] > 0.)
|
---|
410 | fRmsSigmaPhotPerArea [j] = TMath::Sqrt(fRmsSigmaPhotPerArea [j]);
|
---|
411 | }
|
---|
412 |
|
---|
413 | for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
|
---|
414 | {
|
---|
415 |
|
---|
416 | MHCalibrationPix &hist = GetAverageHiGainSector(j);
|
---|
417 | if (hist.IsEmpty())
|
---|
418 | continue;
|
---|
419 |
|
---|
420 | if (!hist.FitGaus())
|
---|
421 | if (!hist.RepeatFit())
|
---|
422 | hist.BypassFit();
|
---|
423 |
|
---|
424 | hist.CreateFourierSpectrum();
|
---|
425 | }
|
---|
426 |
|
---|
427 | return kTRUE;
|
---|
428 | }
|
---|
429 |
|
---|
430 |
|
---|
431 | // --------------------------------------------------------------------------
|
---|
432 | //
|
---|
433 | // The types are as follows:
|
---|
434 | //
|
---|
435 | // Fitted values:
|
---|
436 | // ==============
|
---|
437 | //
|
---|
438 | // 0: Fitted Mean Test Calibration (MHGausEvents::GetMean())
|
---|
439 | // 1: Error Mean Test Calibration (MHGausEvents::GetMeanErr())
|
---|
440 | // 2: Sigma fitted Test Calibration (MHGausEvents::GetSigma())
|
---|
441 | // 3: Error Sigma Test Calibration (MHGausEvents::GetSigmaErr())
|
---|
442 | //
|
---|
443 | // Useful variables derived from the fit results:
|
---|
444 | // =============================================
|
---|
445 | //
|
---|
446 | // 4: Returned probability of Gauss fit (calls: MHGausEvents::GetProb())
|
---|
447 | //
|
---|
448 | // Localized defects:
|
---|
449 | // ==================
|
---|
450 | //
|
---|
451 | // 5: Gaus fit not OK (calls: MHGausEvents::IsGausFitOK())
|
---|
452 | // 6: Fourier spectrum not OK (calls: MHGausEvents::IsFourierSpectrumOK())
|
---|
453 | //
|
---|
454 | // Converted values:
|
---|
455 | // =================
|
---|
456 | //
|
---|
457 | // 7: Fitted Mean Test Calibration (MHGausEvents::GetMean()) by MGeomPix::GetA()
|
---|
458 | // 8: Fitted Mean Error Calibration (MHGausEvents::GetMeanErr()) by MGeomPix::GetA()
|
---|
459 | // 9: Fitted Sigma Test Calibration (MHGausEvents::GetSigma()) by MGeomPix::GetA()
|
---|
460 | // 10: Fitted Sigma Error Calibration (MHGausEvents::GetSigmaErr()) by MGeomPix::GetA()
|
---|
461 | //
|
---|
462 | Bool_t MHCalibrationTestCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
463 | {
|
---|
464 |
|
---|
465 | if (fHiGainArray->GetSize() <= idx)
|
---|
466 | return kFALSE;
|
---|
467 |
|
---|
468 | const MHCalibrationPix &pix = (*this)[idx];
|
---|
469 |
|
---|
470 | if (pix.IsEmpty())
|
---|
471 | return kFALSE;
|
---|
472 |
|
---|
473 | switch (type)
|
---|
474 | {
|
---|
475 | case 0:
|
---|
476 | val = pix.GetMean();
|
---|
477 | break;
|
---|
478 | case 1:
|
---|
479 | val = pix.GetMeanErr();
|
---|
480 | break;
|
---|
481 | case 2:
|
---|
482 | val = pix.GetSigma();
|
---|
483 | break;
|
---|
484 | case 3:
|
---|
485 | val = pix.GetSigmaErr();
|
---|
486 | break;
|
---|
487 | case 4:
|
---|
488 | val = pix.GetProb();
|
---|
489 | break;
|
---|
490 | case 5:
|
---|
491 | if (!pix.IsGausFitOK())
|
---|
492 | val = 1.;
|
---|
493 | break;
|
---|
494 | case 6:
|
---|
495 | if (!pix.IsFourierSpectrumOK())
|
---|
496 | val = 1.;
|
---|
497 | break;
|
---|
498 | case 7:
|
---|
499 | val = pix.GetMean()/cam[idx].GetA();
|
---|
500 | break;
|
---|
501 | case 8:
|
---|
502 | val = pix.GetMeanErr()/cam[idx].GetA();
|
---|
503 | break;
|
---|
504 | case 9:
|
---|
505 | val = pix.GetSigma()/cam[idx].GetA();
|
---|
506 | break;
|
---|
507 | case 10:
|
---|
508 | val = pix.GetSigmaErr()/cam[idx].GetA();
|
---|
509 | break;
|
---|
510 | default:
|
---|
511 | return kFALSE;
|
---|
512 | }
|
---|
513 | return kTRUE;
|
---|
514 | }
|
---|
515 |
|
---|
516 | // --------------------------------------------------------------------------
|
---|
517 | //
|
---|
518 | // Calls MHCalibrationPix::DrawClone() for pixel idx
|
---|
519 | //
|
---|
520 | void MHCalibrationTestCam::DrawPixelContent(Int_t idx) const
|
---|
521 | {
|
---|
522 | (*this)[idx].DrawClone();
|
---|
523 | }
|
---|
524 |
|
---|
525 |
|
---|
526 | //------------------------------------------------------------
|
---|
527 | //
|
---|
528 | // For all averaged areas, the fitted sigma is multiplied with the square root of
|
---|
529 | // the number involved pixels
|
---|
530 | //
|
---|
531 | void MHCalibrationTestCam::CalcAverageSigma()
|
---|
532 | {
|
---|
533 |
|
---|
534 | for (UInt_t j=0; j<fGeom->GetNumAreas(); j++)
|
---|
535 | {
|
---|
536 |
|
---|
537 | MHCalibrationPix &hist = GetAverageHiGainArea(j);
|
---|
538 |
|
---|
539 | const Float_t numsqr = TMath::Sqrt((Float_t)fAverageAreaNum[j]);
|
---|
540 | fAverageAreaSigma[j] = hist.GetSigma () * numsqr;
|
---|
541 | fAverageAreaSigmaVar[j] = hist.GetSigmaErr () * hist.GetSigmaErr() * numsqr;
|
---|
542 |
|
---|
543 | fAverageAreaRelSigma [j] = fAverageAreaSigma[j] / hist.GetMean();
|
---|
544 | fAverageAreaRelSigmaVar[j] = fAverageAreaSigmaVar[j] / (fAverageAreaSigma[j]*fAverageAreaSigma[j]);
|
---|
545 | fAverageAreaRelSigmaVar[j] += hist.GetMeanErr()*hist.GetMeanErr()/hist.GetMean()/hist.GetMean();
|
---|
546 | fAverageAreaRelSigmaVar[j] *= fAverageAreaRelSigma[j];
|
---|
547 | }
|
---|
548 | }
|
---|