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): Thomas Bretz 12/2000 <mailto:tbretz@atsro.uni-wuerzburh.de>
|
---|
19 | ! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | //
|
---|
28 | // MHPedestalCam
|
---|
29 | //
|
---|
30 | // Fills the extracted pedestals of MExtractedSignalCam into
|
---|
31 | // the MHGausEvents-classes MHPedestalPix for every:
|
---|
32 | //
|
---|
33 | // - Pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray
|
---|
34 | // or MHCalibrationCam::fHiGainArray, respectively, depending if
|
---|
35 | // MArrivalTimePix::IsLoGainUsed() is set.
|
---|
36 | //
|
---|
37 | // - Average pixel per AREA index (e.g. inner and outer for the MAGIC camera),
|
---|
38 | // stored in the TObjArray's MHCalibrationCam::fAverageHiGainAreas and
|
---|
39 | // MHCalibrationCam::fAverageHiGainAreas
|
---|
40 | //
|
---|
41 | // - Average pixel per camera SECTOR (e.g. sectors 1-6 for the MAGIC camera),
|
---|
42 | // stored in the TObjArray's MHCalibrationCam::fAverageHiGainSectors
|
---|
43 | // and MHCalibrationCam::fAverageHiGainSectors
|
---|
44 | //
|
---|
45 | // Every pedestal is directly taken from MExtractedSignalCam, filled by the
|
---|
46 | // appropriate extractor.
|
---|
47 | //
|
---|
48 | // The pedestals are filled into a histogram and an array, in order to perform
|
---|
49 | // a Fourier analysis (see MHGausEvents). The signals are moreover averaged on an
|
---|
50 | // event-by-event basis and written into the corresponding average pixels.
|
---|
51 | //
|
---|
52 | // The histograms are fitted to a Gaussian, mean and sigma with its errors
|
---|
53 | // and the fit probability are extracted. If none of these values are NaN's and
|
---|
54 | // if the probability is bigger than MHGausEvents::fProbLimit (default: 0.5%),
|
---|
55 | // the fit is declared valid.
|
---|
56 | // Otherwise, the fit is repeated within ranges of the previous mean
|
---|
57 | // +- MHGausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())
|
---|
58 | // In case this does not make the fit valid, the histogram means and RMS's are
|
---|
59 | // taken directly (see MHGausEvents::BypassFit()).
|
---|
60 | //
|
---|
61 | // Outliers of more than MHGausEvents::fPickupLimit (default: 5) sigmas
|
---|
62 | // from the mean are counted as Pickup events (stored in MHGausEvents::fPickup)
|
---|
63 | //
|
---|
64 | // The number of summed FADC slices is taken to re-normalize
|
---|
65 | // the result to a pedestal per pixel with the formulas (see MHPedestalPix::Renorm()):
|
---|
66 | // - Mean Pedestal / slice = Mean Pedestal / Number slices
|
---|
67 | // - Mean Pedestal Error / slice = Mean Pedestal Error / Number slices
|
---|
68 | // - Sigma Pedestal / slice = Sigma Pedestal / Sqrt (Number slices)
|
---|
69 | // - Sigma Pedestal Error / slice = Sigma Pedestal Error / Sqrt (Number slices)
|
---|
70 | //
|
---|
71 | // The class also fills arrays with the signal vs. event number, creates a fourier
|
---|
72 | // spectrum (see MHGausEvents::CreateFourierSpectrum()) and investigates if the
|
---|
73 | // projected fourier components follow an exponential distribution.
|
---|
74 | //
|
---|
75 | // This same procedure is performed for the average pixels.
|
---|
76 | //
|
---|
77 | // The following results are written into MPedestalCam:
|
---|
78 | //
|
---|
79 | // - MCalibrationPix::SetMean()
|
---|
80 | // - MCalibrationPix::SetMeanErr()
|
---|
81 | // - MCalibrationPix::SetSigma()
|
---|
82 | // - MCalibrationPix::SetSigmaErr()
|
---|
83 | // - MCalibrationPix::SetProb()
|
---|
84 | // - MCalibrationPix::SetNumPickup()
|
---|
85 | //
|
---|
86 | // For all averaged areas, the fitted sigma is multiplied with the square root of
|
---|
87 | // the number involved pixels in order to be able to compare it to the average of
|
---|
88 | // sigmas in the camera.
|
---|
89 | //
|
---|
90 | /////////////////////////////////////////////////////////////////////////////
|
---|
91 | #include "MHPedestalCam.h"
|
---|
92 | #include "MHPedestalPix.h"
|
---|
93 |
|
---|
94 | #include "MBadPixelsCam.h"
|
---|
95 | #include "MBadPixelsPix.h"
|
---|
96 |
|
---|
97 | #include "MLog.h"
|
---|
98 | #include "MLogManip.h"
|
---|
99 |
|
---|
100 | #include "MParList.h"
|
---|
101 |
|
---|
102 | #include "MExtractedSignalCam.h"
|
---|
103 | #include "MExtractedSignalPix.h"
|
---|
104 |
|
---|
105 | #include "MPedestalCam.h"
|
---|
106 | #include "MPedestalPix.h"
|
---|
107 |
|
---|
108 | #include "MGeomCam.h"
|
---|
109 | #include "MGeomPix.h"
|
---|
110 |
|
---|
111 | #include "MCalibrationPedCam.h"
|
---|
112 |
|
---|
113 | #include "TH1.h"
|
---|
114 |
|
---|
115 | ClassImp(MHPedestalCam);
|
---|
116 |
|
---|
117 | using namespace std;
|
---|
118 | // --------------------------------------------------------------------------
|
---|
119 | //
|
---|
120 | // Default constructor.
|
---|
121 | //
|
---|
122 | // Initializes:
|
---|
123 | // - fExtractHiGainSlices to 0.
|
---|
124 | // - fExtractLoGainSlices to 0.
|
---|
125 | // - the event frequency to 1200 Hz.
|
---|
126 | //
|
---|
127 | MHPedestalCam::MHPedestalCam(const char *name, const char *title)
|
---|
128 | : fExtractHiGainSlices(0.), fExtractLoGainSlices(0.)
|
---|
129 | {
|
---|
130 | fName = name ? name : "MHPedestalCam";
|
---|
131 | fTitle = title ? title : "";
|
---|
132 |
|
---|
133 | SetPulserFrequency(1200);
|
---|
134 | }
|
---|
135 |
|
---|
136 |
|
---|
137 |
|
---|
138 | // --------------------------------------------------------------------------
|
---|
139 | //
|
---|
140 | // Searches pointer to:
|
---|
141 | // - MPedestalCam
|
---|
142 | // - MExtractedSignalCam
|
---|
143 | //
|
---|
144 | // Searches or creates:
|
---|
145 | // - MCalibrationPedCam
|
---|
146 | //
|
---|
147 | // Retrieves from MExtractedSignalCam:
|
---|
148 | // - number of used High Gain FADC slices (MExtractedSignalCam::GetNumUsedHiGainFADCSlices())
|
---|
149 | // - number of used Low Gain FADC slices (MExtractedSignalCam::GetNumUsedLoGainFADCSlices())
|
---|
150 | //
|
---|
151 | // Initializes, if empty to MGeomCam::GetNumPixels():
|
---|
152 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
---|
153 | //
|
---|
154 | // Initializes, if empty to MGeomCam::GetNumAreas() for:
|
---|
155 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
156 | //
|
---|
157 | // Initializes, if empty to MGeomCam::GetNumSectors() for:
|
---|
158 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
159 | //
|
---|
160 | // Calls MHCalibrationCam::InitPedHists() for every entry in:
|
---|
161 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
---|
162 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
163 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
164 | //
|
---|
165 | // Sets Titles and Names for the Histograms
|
---|
166 | // - MHCalibrationCam::fAverageHiGainAreas
|
---|
167 | // - MHCalibrationCam::fAverageHiGainSectors
|
---|
168 | //
|
---|
169 | // Sets number of bins to MHCalibrationCam::fAverageNbins for:
|
---|
170 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
171 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
172 | //
|
---|
173 | Bool_t MHPedestalCam::ReInitHists(MParList *pList)
|
---|
174 | {
|
---|
175 |
|
---|
176 | MExtractedSignalCam *signal = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
|
---|
177 | if (!signal)
|
---|
178 | {
|
---|
179 | gLog << err << "Cannot find MExtractedSignalCam... abort." << endl;
|
---|
180 | return kFALSE;
|
---|
181 | }
|
---|
182 |
|
---|
183 |
|
---|
184 | fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
|
---|
185 |
|
---|
186 | if (!fPedestals)
|
---|
187 | {
|
---|
188 | gLog << err << "Cannot find MPedestalCam ... abort." << endl;
|
---|
189 | return kFALSE;
|
---|
190 | }
|
---|
191 |
|
---|
192 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
193 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
194 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
195 |
|
---|
196 | fCam = (MCalibrationCam*)pList->FindObject("MCalibrationPedCam");
|
---|
197 | if (!fCam)
|
---|
198 | {
|
---|
199 | fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationPedCam"));
|
---|
200 | if (!fCam)
|
---|
201 | return kFALSE;
|
---|
202 |
|
---|
203 | fCam->Init(*fGeom);
|
---|
204 | }
|
---|
205 |
|
---|
206 | Float_t sliceshi = signal->GetNumUsedHiGainFADCSlices();
|
---|
207 | Float_t sliceslo = signal->GetNumUsedLoGainFADCSlices();
|
---|
208 |
|
---|
209 | if (sliceshi == 0.)
|
---|
210 | {
|
---|
211 | gLog << err << "Number of used signal slices in MExtractedSignalCam is zero ... abort."
|
---|
212 | << endl;
|
---|
213 | return kFALSE;
|
---|
214 | }
|
---|
215 |
|
---|
216 | if (fExtractHiGainSlices != 0. && sliceshi != fExtractHiGainSlices )
|
---|
217 | {
|
---|
218 | gLog << err << "Number of used High Gain signal slices changed in MExtractedSignalCam ... abort."
|
---|
219 | << endl;
|
---|
220 | return kFALSE;
|
---|
221 | }
|
---|
222 |
|
---|
223 | if (fExtractLoGainSlices != 0. && sliceslo != fExtractLoGainSlices )
|
---|
224 | {
|
---|
225 | gLog << err << "Number of used Low Gain signal slices changed in MExtractedSignalCam ... abort."
|
---|
226 | << endl;
|
---|
227 | return kFALSE;
|
---|
228 | }
|
---|
229 |
|
---|
230 | fExtractHiGainSlices = sliceshi;
|
---|
231 | fExtractLoGainSlices = sliceslo;
|
---|
232 |
|
---|
233 | if (fHiGainArray->GetEntries()==0)
|
---|
234 | {
|
---|
235 | fHiGainArray->Expand(npixels);
|
---|
236 | for (Int_t i=0; i<npixels; i++)
|
---|
237 | {
|
---|
238 | (*fHiGainArray)[i] = new MHPedestalPix;
|
---|
239 | InitPedHists((MHPedestalPix&)(*this)[i],i,fExtractHiGainSlices);
|
---|
240 |
|
---|
241 | if ((*fBadPixels)[i].IsBad())
|
---|
242 | {
|
---|
243 | (*this)[i].SetExcluded();
|
---|
244 | }
|
---|
245 | (*fPedestals)[i].InitUseHists();
|
---|
246 | }
|
---|
247 |
|
---|
248 | }
|
---|
249 |
|
---|
250 | if (fLoGainArray->GetEntries()==0)
|
---|
251 | {
|
---|
252 | fLoGainArray->Expand(npixels);
|
---|
253 | for (Int_t i=0; i<npixels; i++)
|
---|
254 | {
|
---|
255 | (*fLoGainArray)[i] = new MHPedestalPix;
|
---|
256 | InitPedHists((MHPedestalPix&)(*this)(i),i,fExtractLoGainSlices);
|
---|
257 |
|
---|
258 | if ((*fBadPixels)[i].IsBad())
|
---|
259 | (*this)(i).SetExcluded();
|
---|
260 | }
|
---|
261 | }
|
---|
262 |
|
---|
263 | if (fAverageHiGainAreas->GetEntries()==0)
|
---|
264 | {
|
---|
265 | fAverageHiGainAreas->Expand(nareas);
|
---|
266 |
|
---|
267 | for (Int_t j=0; j<nareas; j++)
|
---|
268 | {
|
---|
269 | (*fAverageHiGainAreas)[j] =
|
---|
270 | new MHPedestalPix("AverageHiGainArea",
|
---|
271 | "Average Pedestals area idx ");
|
---|
272 |
|
---|
273 | GetAverageHiGainArea(j).GetHGausHist()->SetTitle("Pedestals average Area Idx ");
|
---|
274 | GetAverageHiGainArea(j).SetNbins(fAverageNbins);
|
---|
275 |
|
---|
276 | InitPedHists((MHPedestalPix&)GetAverageHiGainArea(j),j,fExtractHiGainSlices);
|
---|
277 |
|
---|
278 | }
|
---|
279 | }
|
---|
280 |
|
---|
281 | if (fAverageLoGainAreas->GetEntries()==0)
|
---|
282 | {
|
---|
283 | fAverageLoGainAreas->Expand(nareas);
|
---|
284 |
|
---|
285 | for (Int_t j=0; j<nareas; j++)
|
---|
286 | {
|
---|
287 | (*fAverageLoGainAreas)[j] =
|
---|
288 | new MHPedestalPix("AverageLoGainArea",
|
---|
289 | "Pedestals average Area idx ");
|
---|
290 |
|
---|
291 | GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Pedestals average Area Idx ");
|
---|
292 | GetAverageLoGainArea(j).SetNbins(fAverageNbins);
|
---|
293 |
|
---|
294 | InitPedHists((MHPedestalPix&)GetAverageLoGainArea(j),j,fExtractLoGainSlices);
|
---|
295 |
|
---|
296 | }
|
---|
297 | }
|
---|
298 |
|
---|
299 | if (fAverageHiGainSectors->GetEntries()==0)
|
---|
300 | {
|
---|
301 | fAverageHiGainSectors->Expand(nsectors);
|
---|
302 |
|
---|
303 | for (Int_t j=0; j<nsectors; j++)
|
---|
304 | {
|
---|
305 | (*fAverageHiGainSectors)[j] =
|
---|
306 | new MHPedestalPix("AverageHiGainSector",
|
---|
307 | "Pedestals average sector ");
|
---|
308 |
|
---|
309 | GetAverageHiGainSector(j).GetHGausHist()->SetTitle("Pedestals average Sector ");
|
---|
310 | GetAverageHiGainSector(j).SetNbins(fAverageNbins);
|
---|
311 |
|
---|
312 | InitPedHists((MHPedestalPix&)GetAverageHiGainSector(j),j,fExtractHiGainSlices);
|
---|
313 |
|
---|
314 | }
|
---|
315 | }
|
---|
316 |
|
---|
317 | if (fAverageLoGainSectors->GetEntries()==0)
|
---|
318 | {
|
---|
319 | fAverageLoGainSectors->Expand(nsectors);
|
---|
320 |
|
---|
321 | for (Int_t j=0; j<nsectors; j++)
|
---|
322 | {
|
---|
323 | (*fAverageLoGainSectors)[j] =
|
---|
324 | new MHPedestalPix("AverageLoGainSector",
|
---|
325 | "Pedestals average sector ");
|
---|
326 |
|
---|
327 | GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Pedestals average Sector ");
|
---|
328 | GetAverageLoGainSector(j).SetNbins(fAverageNbins);
|
---|
329 |
|
---|
330 | InitPedHists((MHPedestalPix&)GetAverageLoGainSector(j),j,fExtractLoGainSlices);
|
---|
331 |
|
---|
332 | }
|
---|
333 | }
|
---|
334 |
|
---|
335 | return kTRUE;
|
---|
336 | }
|
---|
337 |
|
---|
338 |
|
---|
339 | // -------------------------------------------------------------
|
---|
340 | //
|
---|
341 | // If MBadPixelsPix::IsBad():
|
---|
342 | // - calls MHGausEvents::SetExcluded()
|
---|
343 | //
|
---|
344 | // Calls:
|
---|
345 | // - MHGausEvents::InitBins()
|
---|
346 | // - MHGausEvents::ChangeHistId(i)
|
---|
347 | // - MHGausEvents::SetEventFrequency(fPulserFrequency)
|
---|
348 | // - MHPedestalPix::SetNSlices(nslices)
|
---|
349 | //
|
---|
350 | void MHPedestalCam::InitPedHists(MHPedestalPix &hist, const Int_t i, const Float_t nslices)
|
---|
351 | {
|
---|
352 | hist.InitBins();
|
---|
353 | hist.ChangeHistId(i);
|
---|
354 | hist.SetEventFrequency(fPulserFrequency);
|
---|
355 | hist.SetNSlices(nslices);
|
---|
356 | hist.SetProbLimit(0.);
|
---|
357 |
|
---|
358 | TH1F *h = hist.GetHGausHist();
|
---|
359 | h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));
|
---|
360 | }
|
---|
361 | // -------------------------------------------------------------------------------
|
---|
362 | //
|
---|
363 | // Retrieves pointer to MExtractedSignalCam:
|
---|
364 | //
|
---|
365 | // Retrieves from MGeomCam:
|
---|
366 | // - number of pixels
|
---|
367 | // - number of pixel areas
|
---|
368 | // - number of sectors
|
---|
369 | //
|
---|
370 | // Fills HiGain or LoGain histograms (MHGausEvents::FillHistAndArray()), respectively
|
---|
371 | // with the signals MExtractedSignalCam::GetExtractedSignalHiGain() and
|
---|
372 | // MExtractedSignalCam::GetExtractedSignalLoGain(), respectively.
|
---|
373 | //
|
---|
374 | Bool_t MHPedestalCam::FillHists(const MParContainer *par, const Stat_t w)
|
---|
375 | {
|
---|
376 |
|
---|
377 | MExtractedSignalCam *signal = (MExtractedSignalCam*)par;
|
---|
378 | if (!signal)
|
---|
379 | {
|
---|
380 | gLog << err << "No argument in MExtractedSignalCam::Fill... abort." << endl;
|
---|
381 | return kFALSE;
|
---|
382 | }
|
---|
383 |
|
---|
384 | const UInt_t npixels = fGeom->GetNumPixels();
|
---|
385 | const UInt_t nareas = fGeom->GetNumAreas();
|
---|
386 | const UInt_t nsectors = fGeom->GetNumSectors();
|
---|
387 |
|
---|
388 | TArrayF sumareahi(nareas);
|
---|
389 | TArrayF sumarealo(nareas);
|
---|
390 | TArrayF sumsectorhi(nsectors);
|
---|
391 | TArrayD sumsectorlo(nsectors);
|
---|
392 | TArrayI numareahi(nareas);
|
---|
393 | TArrayI numarealo(nareas);
|
---|
394 | TArrayI numsectorhi(nsectors);
|
---|
395 | TArrayI numsectorlo(nsectors);
|
---|
396 |
|
---|
397 | for (UInt_t i=0; i<npixels; i++)
|
---|
398 | {
|
---|
399 | MHGausEvents &histhi = (*this)[i];
|
---|
400 | MHGausEvents &histlo = (*this)(i);
|
---|
401 |
|
---|
402 | if (histhi.IsExcluded())
|
---|
403 | continue;
|
---|
404 |
|
---|
405 | const MExtractedSignalPix &pix = (*signal)[i];
|
---|
406 |
|
---|
407 | const Float_t pedhi = pix.GetExtractedSignalHiGain();
|
---|
408 | const Float_t pedlo = pix.GetExtractedSignalLoGain();
|
---|
409 |
|
---|
410 | const Int_t aidx = (*fGeom)[i].GetAidx();
|
---|
411 | const Int_t sector = (*fGeom)[i].GetSector();
|
---|
412 |
|
---|
413 | histhi.FillHistAndArray(pedhi) ;
|
---|
414 | sumareahi [aidx] += pedhi;
|
---|
415 | numareahi [aidx] ++;
|
---|
416 | sumsectorhi[sector] += pedhi;
|
---|
417 | numsectorhi[sector] ++;
|
---|
418 |
|
---|
419 | histlo.FillHistAndArray(pedlo);
|
---|
420 | sumarealo [aidx] += pedlo;
|
---|
421 | numarealo [aidx] ++;
|
---|
422 | sumsectorlo[sector] += pedlo;
|
---|
423 | numsectorlo[sector] ++;
|
---|
424 |
|
---|
425 | }
|
---|
426 |
|
---|
427 | for (UInt_t j=0; j<nareas; j++)
|
---|
428 | {
|
---|
429 | MHGausEvents &histhi = GetAverageHiGainArea(j);
|
---|
430 | histhi.FillHistAndArray(numareahi[j] == 0 ? 0. : sumareahi[j]/numareahi[j]);
|
---|
431 |
|
---|
432 | MHGausEvents &histlo = GetAverageLoGainArea(j);
|
---|
433 | histlo.FillHistAndArray(numarealo[j] == 0 ? 0. : sumarealo[j]/numarealo[j]);
|
---|
434 | }
|
---|
435 |
|
---|
436 | for (UInt_t j=0; j<nsectors; j++)
|
---|
437 | {
|
---|
438 | MHGausEvents &histhi = GetAverageHiGainSector(j);
|
---|
439 | histhi.FillHistAndArray(numsectorhi[j] == 0 ? 0. : sumsectorhi[j]/numsectorhi[j]);
|
---|
440 |
|
---|
441 | MHGausEvents &histlo = GetAverageLoGainSector(j);
|
---|
442 | histlo.FillHistAndArray(numsectorlo[j] == 0 ? 0. : sumsectorlo[j]/numsectorlo[j]);
|
---|
443 | }
|
---|
444 |
|
---|
445 | return kTRUE;
|
---|
446 | }
|
---|
447 |
|
---|
448 | // --------------------------------------------------------------------------
|
---|
449 | //
|
---|
450 | // Calls:
|
---|
451 | // - MHCalibrationCam::FitHiGainArrays() with Bad Pixels flags 0
|
---|
452 | // - MHCalibrationCam::FitLoGainArrays() with Bad Pixels flags 0
|
---|
453 | //
|
---|
454 | Bool_t MHPedestalCam::FinalizeHists()
|
---|
455 | {
|
---|
456 |
|
---|
457 | FitHiGainArrays((*fCam),*fBadPixels,
|
---|
458 | MBadPixelsPix::kHiGainNotFitted,
|
---|
459 | MBadPixelsPix::kHiGainOscillating);
|
---|
460 | FitLoGainArrays((*fCam),*fBadPixels,
|
---|
461 | MBadPixelsPix::kLoGainNotFitted,
|
---|
462 | MBadPixelsPix::kLoGainOscillating);
|
---|
463 |
|
---|
464 |
|
---|
465 | return kTRUE;
|
---|
466 |
|
---|
467 |
|
---|
468 | }
|
---|
469 |
|
---|
470 | // ------------------------------------------------------------------
|
---|
471 | //
|
---|
472 | // The types are as follows:
|
---|
473 | //
|
---|
474 | // Fitted values:
|
---|
475 | // ==============
|
---|
476 | //
|
---|
477 | // 0: Fitted Charge
|
---|
478 | // 1: Error of fitted Charge
|
---|
479 | // 2: Sigma of fitted Charge
|
---|
480 | // 3: Error of Sigma of fitted Charge
|
---|
481 | //
|
---|
482 | //
|
---|
483 | // Useful variables derived from the fit results:
|
---|
484 | // =============================================
|
---|
485 | //
|
---|
486 | // 4: Returned probability of Gauss fit to Charge distribution
|
---|
487 | // 5: Relative differenc of calculated pedestal (per slice) and fitted (per slice)
|
---|
488 | // 6: Error of the Relative differenc of calculated pedestal (per slice) and fitted (per slice)
|
---|
489 | // 7: Relative difference of the error of the mean pedestal (per slice) - calculated and fitted
|
---|
490 | // 8: Relative differenc of calculated pedestal RMS (per slice) and fitted sigma (per slice)
|
---|
491 | // 9: Error of Relative differenc of calculated pedestal RMS (per slice) and fitted sigma (per slice)
|
---|
492 | // 10: Relative difference of the error of the pedestal RMS (per slice) - calculated and fitted
|
---|
493 | //
|
---|
494 | // Localized defects:
|
---|
495 | // ==================
|
---|
496 | //
|
---|
497 | // 11: Gaus fit not OK
|
---|
498 | // 12: Fourier spectrum not OK
|
---|
499 | //
|
---|
500 | Bool_t MHPedestalCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
501 | {
|
---|
502 |
|
---|
503 | if (fHiGainArray->GetSize() <= idx)
|
---|
504 | return kFALSE;
|
---|
505 |
|
---|
506 | if ((*this)[idx].IsExcluded())
|
---|
507 | return kFALSE;
|
---|
508 |
|
---|
509 | const Float_t ped = (*fPedestals)[idx].GetPedestal();
|
---|
510 | const Float_t rms = (*fPedestals)[idx].GetPedestalRms();
|
---|
511 |
|
---|
512 | const Float_t entsqr = TMath::Sqrt((Float_t)fPedestals->GetTotalEntries());
|
---|
513 |
|
---|
514 | const Float_t pederr = rms/entsqr;
|
---|
515 | const Float_t rmserr = rms/entsqr/2.;
|
---|
516 |
|
---|
517 | const Float_t mean = (*this)[idx].GetMean();
|
---|
518 | const Float_t meanerr = (*this)[idx].GetMeanErr();
|
---|
519 | const Float_t sigma = (*this)[idx].GetSigma() ;
|
---|
520 | const Float_t sigmaerr = (*this)[idx].GetSigmaErr();
|
---|
521 |
|
---|
522 | switch (type)
|
---|
523 | {
|
---|
524 | case 0:
|
---|
525 | val = mean;
|
---|
526 | break;
|
---|
527 | case 1:
|
---|
528 | val = meanerr;
|
---|
529 | break;
|
---|
530 | case 2:
|
---|
531 | val = sigma;
|
---|
532 | break;
|
---|
533 | case 3:
|
---|
534 | val = sigmaerr;
|
---|
535 | break;
|
---|
536 | case 4:
|
---|
537 | val = (*this)[idx].GetProb();
|
---|
538 | break;
|
---|
539 | case 5:
|
---|
540 | val = 2.*(mean-ped)/(ped+mean);
|
---|
541 | break;
|
---|
542 | case 6:
|
---|
543 | val = TMath::Sqrt((pederr*pederr + meanerr*meanerr) * (ped*ped + mean*mean))
|
---|
544 | *2./(ped+mean)/(ped+mean);
|
---|
545 | break;
|
---|
546 | case 7:
|
---|
547 | val = 2.*(meanerr-pederr)/(pederr + meanerr);
|
---|
548 | break;
|
---|
549 | case 8:
|
---|
550 | val = 2.*(sigma-rms)/(sigma+rms);
|
---|
551 | break;
|
---|
552 | case 9:
|
---|
553 | val = TMath::Sqrt((rmserr*rmserr + sigmaerr*sigmaerr) * (rms*rms + sigma*sigma))
|
---|
554 | *2./(rms+sigma)/(rms+sigma);
|
---|
555 | break;
|
---|
556 | case 10:
|
---|
557 | val = 2.*(sigmaerr - rmserr)/(sigmaerr + rmserr);
|
---|
558 | break;
|
---|
559 | case 11:
|
---|
560 | if (!(*this)[idx].IsGausFitOK())
|
---|
561 | val = 1.;
|
---|
562 | break;
|
---|
563 | case 12:
|
---|
564 | if (!(*this)[idx].IsFourierSpectrumOK())
|
---|
565 | val = 1.;
|
---|
566 | break;
|
---|
567 | default:
|
---|
568 | return kFALSE;
|
---|
569 | }
|
---|
570 | return kTRUE;
|
---|
571 | }
|
---|
572 |
|
---|
573 | // --------------------------------------------------------------------------
|
---|
574 | //
|
---|
575 | // Calls MHGausEvents::DrawClone() for pixel idx
|
---|
576 | //
|
---|
577 | void MHPedestalCam::DrawPixelContent(Int_t idx) const
|
---|
578 | {
|
---|
579 | (*this)[idx].DrawClone();
|
---|
580 | }
|
---|