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@uni-sw.gwdg.de>
|
---|
19 | ! 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 |
|
---|
93 | #include "MLog.h"
|
---|
94 | #include "MLogManip.h"
|
---|
95 |
|
---|
96 | #include "MParList.h"
|
---|
97 |
|
---|
98 | #include "MHPedestalPix.h"
|
---|
99 |
|
---|
100 | #include "MExtractedSignalCam.h"
|
---|
101 | #include "MExtractedSignalPix.h"
|
---|
102 |
|
---|
103 | #include "MPedestalCam.h"
|
---|
104 | #include "MPedestalPix.h"
|
---|
105 |
|
---|
106 | #include "MGeomCam.h"
|
---|
107 | #include "MGeomPix.h"
|
---|
108 |
|
---|
109 | ClassImp(MHPedestalCam);
|
---|
110 |
|
---|
111 | using namespace std;
|
---|
112 | // --------------------------------------------------------------------------
|
---|
113 | //
|
---|
114 | // Default constructor.
|
---|
115 | //
|
---|
116 | // Initializes:
|
---|
117 | // - fExtractHiGainSlices to 1.
|
---|
118 | // - fExtractLoGainSlices to 1.
|
---|
119 | //
|
---|
120 | MHPedestalCam::MHPedestalCam(const char *name, const char *title)
|
---|
121 | : fExtractHiGainSlices(1.), fExtractLoGainSlices(1.)
|
---|
122 | {
|
---|
123 | fName = name ? name : "MHPedestalCam";
|
---|
124 | fTitle = title ? title : "";
|
---|
125 |
|
---|
126 | }
|
---|
127 |
|
---|
128 |
|
---|
129 |
|
---|
130 | // --------------------------------------------------------------------------
|
---|
131 | //
|
---|
132 | // Searches pointer to:
|
---|
133 | // - MPedestalCam
|
---|
134 | // - MExtractedSignalCam
|
---|
135 | //
|
---|
136 | // Retrieves from MExtractedSignalCam:
|
---|
137 | // - number of used High Gain FADC slices (MExtractedSignalCam::GetNumUsedHiGainFADCSlices())
|
---|
138 | // - number of used Low Gain FADC slices (MExtractedSignalCam::GetNumUsedLoGainFADCSlices())
|
---|
139 | //
|
---|
140 | // Initializes, if empty to MGeomCam::GetNumPixels():
|
---|
141 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
---|
142 | //
|
---|
143 | // Initializes, if empty to MGeomCam::GetNumAreas() for:
|
---|
144 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
145 | //
|
---|
146 | // Initializes, if empty to MGeomCam::GetNumSectors() for:
|
---|
147 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
148 | //
|
---|
149 | // Calls MHCalibrationCam::InitPedHists() for every entry in:
|
---|
150 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
---|
151 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
152 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
153 | //
|
---|
154 | // Sets Titles and Names for the Histograms
|
---|
155 | // - MHCalibrationCam::fAverageHiGainAreas
|
---|
156 | // - MHCalibrationCam::fAverageHiGainSectors
|
---|
157 | //
|
---|
158 | // Sets number of bins to MHCalibrationCam::fAverageNbins for:
|
---|
159 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
160 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
161 | //
|
---|
162 | Bool_t MHPedestalCam::ReInitHists(MParList *pList)
|
---|
163 | {
|
---|
164 |
|
---|
165 | MExtractedSignalCam *signal = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
|
---|
166 | if (!signal)
|
---|
167 | {
|
---|
168 | gLog << err << "Cannot find MExtractedSignalCam... abort." << endl;
|
---|
169 | return kFALSE;
|
---|
170 | }
|
---|
171 |
|
---|
172 |
|
---|
173 | fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
|
---|
174 |
|
---|
175 | if (!fPedestals)
|
---|
176 | {
|
---|
177 | gLog << err << "Cannot find MPedestalCam ... abort." << endl;
|
---|
178 | return kFALSE;
|
---|
179 | }
|
---|
180 |
|
---|
181 | Float_t sliceshi = signal->GetNumUsedHiGainFADCSlices();
|
---|
182 | Float_t sliceslo = signal->GetNumUsedLoGainFADCSlices();
|
---|
183 |
|
---|
184 | if (sliceshi == 0.)
|
---|
185 | {
|
---|
186 | gLog << err << "Number of used signal slices in MExtractedSignalCam is zero ... abort."
|
---|
187 | << endl;
|
---|
188 | return kFALSE;
|
---|
189 | }
|
---|
190 |
|
---|
191 | if (fExtractHiGainSlices != 0. && sliceshi != fExtractHiGainSlices )
|
---|
192 | {
|
---|
193 | gLog << err << "Number of used High Gain signal slices changed in MExtractedSignalCam ... abort."
|
---|
194 | << endl;
|
---|
195 | return kFALSE;
|
---|
196 | }
|
---|
197 |
|
---|
198 | if (fExtractLoGainSlices != 0. && sliceslo != fExtractLoGainSlices )
|
---|
199 | {
|
---|
200 | gLog << err << "Number of used Low Gain signal slices changed in MExtractedSignalCam ... abort."
|
---|
201 | << endl;
|
---|
202 | return kFALSE;
|
---|
203 | }
|
---|
204 |
|
---|
205 | fExtractHiGainSlices = sliceshi;
|
---|
206 | fExtractLoGainSlices = sliceslo;
|
---|
207 |
|
---|
208 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
209 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
210 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
211 |
|
---|
212 | if (fHiGainArray->GetEntries()==0)
|
---|
213 | {
|
---|
214 | fHiGainArray->Expand(npixels);
|
---|
215 | for (Int_t i=0; i<npixels; i++)
|
---|
216 | {
|
---|
217 | (*fHiGainArray)[i] = new MHPedestalPix;
|
---|
218 | InitPedHists((MHPedestalPix&)(*this)[i],i,fExtractHiGainSlices);
|
---|
219 | }
|
---|
220 | }
|
---|
221 |
|
---|
222 | if (fLoGainArray->GetEntries()==0)
|
---|
223 | {
|
---|
224 | fLoGainArray->Expand(npixels);
|
---|
225 | for (Int_t i=0; i<npixels; i++)
|
---|
226 | {
|
---|
227 | (*fLoGainArray)[i] = new MHPedestalPix;
|
---|
228 | InitPedHists((MHPedestalPix&)(*this)(i),i,fExtractLoGainSlices);
|
---|
229 | }
|
---|
230 | }
|
---|
231 |
|
---|
232 | if (fAverageHiGainAreas->GetEntries()==0)
|
---|
233 | {
|
---|
234 | fAverageHiGainAreas->Expand(nareas);
|
---|
235 |
|
---|
236 | for (Int_t j=0; j<nareas; j++)
|
---|
237 | {
|
---|
238 | (*fAverageHiGainAreas)[j] =
|
---|
239 | new MHPedestalPix("AverageHiGainArea",
|
---|
240 | "Average Pedestals area idx ");
|
---|
241 |
|
---|
242 | InitPedHists((MHPedestalPix&)GetAverageHiGainArea(j),j,fExtractHiGainSlices);
|
---|
243 |
|
---|
244 | GetAverageHiGainArea(j).GetHGausHist()->SetTitle("Pedestals average Area Idx ");
|
---|
245 | GetAverageHiGainArea(j).SetNbins(fAverageNbins);
|
---|
246 | }
|
---|
247 | }
|
---|
248 |
|
---|
249 | if (fAverageLoGainAreas->GetEntries()==0)
|
---|
250 | {
|
---|
251 | fAverageLoGainAreas->Expand(nareas);
|
---|
252 |
|
---|
253 | for (Int_t j=0; j<nareas; j++)
|
---|
254 | {
|
---|
255 | (*fAverageLoGainAreas)[j] =
|
---|
256 | new MHPedestalPix("AverageLoGainArea",
|
---|
257 | "Pedestals average Area idx ");
|
---|
258 |
|
---|
259 | InitPedHists((MHPedestalPix&)GetAverageLoGainArea(j),j,fExtractLoGainSlices);
|
---|
260 |
|
---|
261 | GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Pedestals average Area Idx ");
|
---|
262 | GetAverageLoGainArea(j).SetNbins(fAverageNbins);
|
---|
263 | }
|
---|
264 | }
|
---|
265 |
|
---|
266 | if (fAverageHiGainSectors->GetEntries()==0)
|
---|
267 | {
|
---|
268 | fAverageHiGainSectors->Expand(nsectors);
|
---|
269 |
|
---|
270 | for (Int_t j=0; j<nsectors; j++)
|
---|
271 | {
|
---|
272 | (*fAverageHiGainSectors)[j] =
|
---|
273 | new MHPedestalPix("AverageHiGainSector",
|
---|
274 | "Pedestals average sector ");
|
---|
275 |
|
---|
276 | InitPedHists((MHPedestalPix&)GetAverageHiGainSector(j),j,fExtractHiGainSlices);
|
---|
277 |
|
---|
278 | GetAverageHiGainSector(j).GetHGausHist()->SetTitle("Pedestals average Sector ");
|
---|
279 | GetAverageHiGainSector(j).SetNbins(fAverageNbins);
|
---|
280 | }
|
---|
281 | }
|
---|
282 |
|
---|
283 | if (fAverageLoGainSectors->GetEntries()==0)
|
---|
284 | {
|
---|
285 | fAverageLoGainSectors->Expand(nsectors);
|
---|
286 |
|
---|
287 | for (Int_t j=0; j<nsectors; j++)
|
---|
288 | {
|
---|
289 | (*fAverageLoGainSectors)[j] =
|
---|
290 | new MHPedestalPix("AverageLoGainSector",
|
---|
291 | "Pedestals average sector ");
|
---|
292 |
|
---|
293 | InitPedHists((MHPedestalPix&)GetAverageLoGainSector(j),j,fExtractLoGainSlices);
|
---|
294 |
|
---|
295 | GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Pedestals average Sector ");
|
---|
296 | GetAverageLoGainSector(j).SetNbins(fAverageNbins);
|
---|
297 | }
|
---|
298 | }
|
---|
299 |
|
---|
300 | return kTRUE;
|
---|
301 |
|
---|
302 | }
|
---|
303 |
|
---|
304 |
|
---|
305 | // -------------------------------------------------------------
|
---|
306 | //
|
---|
307 | // If MBadPixelsPix::IsBad():
|
---|
308 | // - calls MHGausEvents::SetExcluded()
|
---|
309 | //
|
---|
310 | // Calls:
|
---|
311 | // - MHGausEvents::InitBins()
|
---|
312 | // - MHGausEvents::ChangeHistId(i)
|
---|
313 | // - MHGausEvents::SetEventFrequency(fPulserFrequency)
|
---|
314 | // - MHPedestalPix::SetNSlices(nslices)
|
---|
315 | //
|
---|
316 | void MHPedestalCam::InitPedHists(MHPedestalPix &hist, const Int_t i, const Float_t nslices)
|
---|
317 | {
|
---|
318 |
|
---|
319 | hist.InitBins();
|
---|
320 | hist.ChangeHistId(i);
|
---|
321 | hist.SetEventFrequency(fPulserFrequency);
|
---|
322 | hist.SetNSlices(nslices);
|
---|
323 | }
|
---|
324 |
|
---|
325 |
|
---|
326 |
|
---|
327 | // -------------------------------------------------------------------------------
|
---|
328 | //
|
---|
329 | // Retrieves pointer to MExtractedSignalCam:
|
---|
330 | //
|
---|
331 | // Retrieves from MGeomCam:
|
---|
332 | // - number of pixels
|
---|
333 | // - number of pixel areas
|
---|
334 | // - number of sectors
|
---|
335 | //
|
---|
336 | // Fills HiGain or LoGain histograms (MHGausEvents::FillHistAndArray()), respectively
|
---|
337 | // with the signals MExtractedSignalCam::GetExtractedSignalHiGain() and
|
---|
338 | // MExtractedSignalCam::GetExtractedSignalLoGain(), respectively.
|
---|
339 | //
|
---|
340 | Bool_t MHPedestalCam::FillHists(const MParContainer *par, const Stat_t w)
|
---|
341 | {
|
---|
342 |
|
---|
343 | MExtractedSignalCam *signal = (MExtractedSignalCam*)par;
|
---|
344 | if (!signal)
|
---|
345 | {
|
---|
346 | gLog << err << "No argument in MExtractedSignalCam::Fill... abort." << endl;
|
---|
347 | return kFALSE;
|
---|
348 | }
|
---|
349 |
|
---|
350 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
351 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
352 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
353 |
|
---|
354 | Float_t sumareahi [nareas], sumarealo [nareas];
|
---|
355 | Float_t sumsectorhi[nsectors], sumsectorlo[nsectors];
|
---|
356 | Int_t numareahi [nareas], numarealo [nareas];
|
---|
357 | Int_t numsectorhi[nsectors], numsectorlo[nsectors];
|
---|
358 |
|
---|
359 | for (UInt_t j=0; j<nareas; j++)
|
---|
360 | {
|
---|
361 | sumareahi[j] = sumarealo[j] = 0.;
|
---|
362 | numareahi[j] = numarealo[j] = 0;
|
---|
363 | }
|
---|
364 |
|
---|
365 | for (UInt_t j=0; j<nsectors; j++)
|
---|
366 | {
|
---|
367 | sumsectorhi[j] = sumsectorlo[j] = 0.;
|
---|
368 | numsectorhi[j] = numsectorlo[j] = 0;
|
---|
369 | }
|
---|
370 |
|
---|
371 |
|
---|
372 | for (Int_t i=0; i<npixels; i++)
|
---|
373 | {
|
---|
374 |
|
---|
375 | MHGausEvents &histhi = (*this)[i];
|
---|
376 | MHGausEvents &histlo = (*this)(i);
|
---|
377 |
|
---|
378 | if (histhi.IsExcluded())
|
---|
379 | continue;
|
---|
380 |
|
---|
381 | const MExtractedSignalPix &pix = (*signal)[i];
|
---|
382 |
|
---|
383 | const Float_t pedhi = pix.GetExtractedSignalHiGain();
|
---|
384 | const Float_t pedlo = pix.GetExtractedSignalLoGain();
|
---|
385 |
|
---|
386 | const Int_t aidx = (*fGeom)[i].GetAidx();
|
---|
387 | const Int_t sector = (*fGeom)[i].GetSector();
|
---|
388 |
|
---|
389 | histhi.FillHistAndArray(pedhi) ;
|
---|
390 | sumareahi [aidx] += pedhi;
|
---|
391 | numareahi [aidx] ++;
|
---|
392 | sumsectorhi[sector] += pedhi;
|
---|
393 | numsectorhi[sector] ++;
|
---|
394 |
|
---|
395 | histlo.FillHistAndArray(pedlo);
|
---|
396 | sumarealo [aidx] += pedlo;
|
---|
397 | numarealo [aidx] ++;
|
---|
398 | sumsectorlo[sector] += pedlo;
|
---|
399 | numsectorlo[sector] ++;
|
---|
400 |
|
---|
401 | }
|
---|
402 |
|
---|
403 | for (UInt_t j=0; j<nareas; j++)
|
---|
404 | {
|
---|
405 | MHGausEvents &histhi = GetAverageHiGainArea(j);
|
---|
406 | histhi.FillHistAndArray(numareahi[j] == 0 ? 0. : sumareahi[j]/numareahi[j]);
|
---|
407 |
|
---|
408 | MHGausEvents &histlo = GetAverageLoGainArea(j);
|
---|
409 | histlo.FillHistAndArray(numarealo[j] == 0 ? 0. : sumarealo[j]/numarealo[j]);
|
---|
410 | }
|
---|
411 |
|
---|
412 | for (UInt_t j=0; j<nsectors; j++)
|
---|
413 | {
|
---|
414 | MHGausEvents &histhi = GetAverageHiGainSector(j);
|
---|
415 | histhi.FillHistAndArray(numsectorhi[j] == 0 ? 0. : sumsectorhi[j]/numsectorhi[j]);
|
---|
416 |
|
---|
417 | MHGausEvents &histlo = GetAverageLoGainSector(j);
|
---|
418 | histlo.FillHistAndArray(numsectorlo[j] == 0 ? 0. : sumsectorlo[j]/numsectorlo[j]);
|
---|
419 | }
|
---|
420 |
|
---|
421 | return kTRUE;
|
---|
422 | }
|
---|
423 |
|
---|
424 | // --------------------------------------------------------------------------
|
---|
425 | //
|
---|
426 | // Calls:
|
---|
427 | // - MHCalibrationCam::FitHiGainArrays() with Bad Pixels flags 0
|
---|
428 | // - MHCalibrationCam::FitLoGainArrays() with Bad Pixels flags 0
|
---|
429 | //
|
---|
430 | Bool_t MHPedestalCam::FinalizeHists()
|
---|
431 | {
|
---|
432 |
|
---|
433 | FitHiGainArrays((MCalibrationCam&)(*fCam),*fBadPixels,
|
---|
434 | MBadPixelsPix::kHiGainNotFitted,
|
---|
435 | MBadPixelsPix::kHiGainOscillating);
|
---|
436 | FitLoGainArrays((MCalibrationCam&)(*fCam),*fBadPixels,
|
---|
437 | MBadPixelsPix::kLoGainNotFitted,
|
---|
438 | MBadPixelsPix::kLoGainOscillating);
|
---|
439 |
|
---|
440 | return kTRUE;
|
---|
441 |
|
---|
442 | }
|
---|
443 |
|
---|
444 | // ------------------------------------------------------------------
|
---|
445 | //
|
---|
446 | // The types are as follows:
|
---|
447 | //
|
---|
448 | // Fitted values:
|
---|
449 | // ==============
|
---|
450 | //
|
---|
451 | // 0: Fitted Charge
|
---|
452 | // 1: Error of fitted Charge
|
---|
453 | // 2: Sigma of fitted Charge
|
---|
454 | // 3: Error of Sigma of fitted Charge
|
---|
455 | //
|
---|
456 | //
|
---|
457 | // Useful variables derived from the fit results:
|
---|
458 | // =============================================
|
---|
459 | //
|
---|
460 | // 4: Returned probability of Gauss fit to Charge distribution
|
---|
461 | // 5: Relative differenc of calculated pedestal (per slice) and fitted (per slice)
|
---|
462 | // 6: Error of the Relative differenc of calculated pedestal (per slice) and fitted (per slice)
|
---|
463 | // 7: Relative difference of the error of the mean pedestal (per slice) - calculated and fitted
|
---|
464 | // 8: Relative differenc of calculated pedestal RMS (per slice) and fitted sigma (per slice)
|
---|
465 | // 9: Error of Relative differenc of calculated pedestal RMS (per slice) and fitted sigma (per slice)
|
---|
466 | // 10: Relative difference of the error of the pedestal RMS (per slice) - calculated and fitted
|
---|
467 | //
|
---|
468 | // Localized defects:
|
---|
469 | // ==================
|
---|
470 | //
|
---|
471 | // 11: Gaus fit not OK
|
---|
472 | // 12: Fourier spectrum not OK
|
---|
473 | //
|
---|
474 | Bool_t MHPedestalCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
475 | {
|
---|
476 |
|
---|
477 | if (fHiGainArray->GetSize() <= idx)
|
---|
478 | return kFALSE;
|
---|
479 |
|
---|
480 | const Float_t ped = (*fPedestals)[idx].GetPedestal();
|
---|
481 | const Float_t rms = (*fPedestals)[idx].GetPedestalRms();
|
---|
482 |
|
---|
483 | const Float_t entsqr = TMath::Sqrt((Float_t)fPedestals->GetTotalEntries());
|
---|
484 |
|
---|
485 | const Float_t pederr = rms/entsqr;
|
---|
486 | const Float_t rmserr = rms/entsqr/2.;
|
---|
487 |
|
---|
488 | const Float_t mean = (*this)[idx].GetMean();
|
---|
489 | const Float_t meanerr = (*this)[idx].GetMeanErr();
|
---|
490 | const Float_t sigma = (*this)[idx].GetSigma() ;
|
---|
491 | const Float_t sigmaerr = (*this)[idx].GetSigmaErr();
|
---|
492 |
|
---|
493 | switch (type)
|
---|
494 | {
|
---|
495 | case 0:
|
---|
496 | val = mean;
|
---|
497 | break;
|
---|
498 | case 1:
|
---|
499 | val = meanerr;
|
---|
500 | break;
|
---|
501 | case 2:
|
---|
502 | val = sigma;
|
---|
503 | break;
|
---|
504 | case 3:
|
---|
505 | val = sigmaerr;
|
---|
506 | break;
|
---|
507 | case 4:
|
---|
508 | val = (*this)[idx].GetProb();
|
---|
509 | break;
|
---|
510 | case 5:
|
---|
511 | val = 2.*(ped-mean)/(ped+mean);
|
---|
512 | break;
|
---|
513 | case 6:
|
---|
514 | val = TMath::Sqrt((pederr*pederr + meanerr*meanerr) * (ped*ped + mean*mean))
|
---|
515 | *2./(ped+mean)/(ped+mean);
|
---|
516 | break;
|
---|
517 | case 7:
|
---|
518 | val = 2.*(pederr - meanerr)/(pederr + meanerr);
|
---|
519 | break;
|
---|
520 | case 8:
|
---|
521 | val = 2.*(sigma-rms)/(sigma+rms);
|
---|
522 | break;
|
---|
523 | case 9:
|
---|
524 | val = TMath::Sqrt((rmserr*rmserr + sigmaerr*sigmaerr) * (rms*rms + sigma*sigma))
|
---|
525 | *2./(rms+sigma)/(rms+sigma);
|
---|
526 | break;
|
---|
527 | case 10:
|
---|
528 | val = 2.*(sigmaerr - rmserr)/(sigmaerr + rmserr);
|
---|
529 | break;
|
---|
530 | case 11:
|
---|
531 | if (!(*this)[idx].IsGausFitOK())
|
---|
532 | val = 1.;
|
---|
533 | break;
|
---|
534 | case 12:
|
---|
535 | if (!(*this)[idx].IsFourierSpectrumOK())
|
---|
536 | val = 1.;
|
---|
537 | break;
|
---|
538 | default:
|
---|
539 | return kFALSE;
|
---|
540 | }
|
---|
541 | return kTRUE;
|
---|
542 | }
|
---|
543 |
|
---|
544 | // --------------------------------------------------------------------------
|
---|
545 | //
|
---|
546 | // Calls MHGausEvents::DrawClone() for pixel idx
|
---|
547 | //
|
---|
548 | void MHPedestalCam::DrawPixelContent(Int_t idx) const
|
---|
549 | {
|
---|
550 | (*this)[idx].DrawClone();
|
---|
551 | }
|
---|