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 | // MHCalibrationRelTimeCam
|
---|
27 | //
|
---|
28 | // Fills the extracted relative arrival times of MArrivalTimeCam into
|
---|
29 | // the MHCalibrationPix-classes MHCalibrationPix for every:
|
---|
30 | //
|
---|
31 | // - Pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray
|
---|
32 | // or MHCalibrationCam::fHiGainArray, respectively, depending if
|
---|
33 | // MArrivalTimePix::IsLoGainUsed() is set.
|
---|
34 | //
|
---|
35 | // - Average pixel per AREA index (e.g. inner and outer for the MAGIC camera),
|
---|
36 | // stored in the TObjArray's MHCalibrationCam::fAverageHiGainAreas and
|
---|
37 | // MHCalibrationCam::fAverageHiGainAreas
|
---|
38 | //
|
---|
39 | // - Average pixel per camera SECTOR (e.g. sectors 1-6 for the MAGIC camera),
|
---|
40 | // stored in the TObjArray's MHCalibrationCam::fAverageHiGainSectors
|
---|
41 | // and MHCalibrationCam::fAverageHiGainSectors
|
---|
42 | //
|
---|
43 | // Every relative time is calculated as the difference between the individual
|
---|
44 | // pixel arrival time and the one of pixel 1 (hardware number: 2).
|
---|
45 | // The relative times are filled into a histogram and an array, in order to perform
|
---|
46 | // a Fourier analysis (see MHGausEvents). The signals are moreover averaged on an
|
---|
47 | // event-by-event basis and written into the corresponding average pixels.
|
---|
48 | //
|
---|
49 | // The histograms are fitted to a Gaussian, mean and sigma with its errors
|
---|
50 | // and the fit probability are extracted. If none of these values are NaN's and
|
---|
51 | // if the probability is bigger than MHGausEvents::fProbLimit (default: 0.5%),
|
---|
52 | // the fit is declared valid.
|
---|
53 | // Otherwise, the fit is repeated within ranges of the previous mean
|
---|
54 | // +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit())
|
---|
55 | // In case this does not make the fit valid, the histogram means and RMS's are
|
---|
56 | // taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set:
|
---|
57 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kRelTimeNotFitted ) and
|
---|
58 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
59 | //
|
---|
60 | // Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas
|
---|
61 | // from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup)
|
---|
62 | //
|
---|
63 | // The class also fills arrays with the signal vs. event number, creates a fourier
|
---|
64 | // spectrum (see MHGausEvents::CreateFourierSpectrum()) and investigates if the
|
---|
65 | // projected fourier components follow an exponential distribution.
|
---|
66 | // In case that the probability of the exponential fit is less than
|
---|
67 | // MHGausEvents::fProbLimit (default: 0.5%), the following flags are set:
|
---|
68 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kRelTimeOscillating ) and
|
---|
69 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
70 | //
|
---|
71 | // This same procedure is performed for the average pixels.
|
---|
72 | //
|
---|
73 | // The following results are written into MCalibrationRelTimeCam:
|
---|
74 | //
|
---|
75 | // - MCalibrationPix::SetMean()
|
---|
76 | // - MCalibrationPix::SetMeanErr()
|
---|
77 | // - MCalibrationPix::SetSigma()
|
---|
78 | // - MCalibrationPix::SetSigmaErr()
|
---|
79 | // - MCalibrationPix::SetProb()
|
---|
80 | // - MCalibrationPix::SetNumPickup()
|
---|
81 | //
|
---|
82 | // For all averaged areas, the fitted sigma is multiplied with the square root of
|
---|
83 | // the number involved pixels in order to be able to compare it to the average of
|
---|
84 | // sigmas in the camera.
|
---|
85 | //
|
---|
86 | /////////////////////////////////////////////////////////////////////////////
|
---|
87 | #include "MHCalibrationRelTimeCam.h"
|
---|
88 | #include "MHCalibrationPix.h"
|
---|
89 |
|
---|
90 | #include "MLog.h"
|
---|
91 | #include "MLogManip.h"
|
---|
92 |
|
---|
93 | #include "MParList.h"
|
---|
94 |
|
---|
95 | #include "MCalibrationIntensityRelTimeCam.h"
|
---|
96 |
|
---|
97 | #include "MCalibrationRelTimeCam.h"
|
---|
98 | #include "MCalibrationRelTimePix.h"
|
---|
99 | #include "MCalibrationPix.h"
|
---|
100 |
|
---|
101 | #include "MArrivalTimeCam.h"
|
---|
102 | #include "MArrivalTimePix.h"
|
---|
103 |
|
---|
104 | #include "MGeomCam.h"
|
---|
105 | #include "MGeomPix.h"
|
---|
106 |
|
---|
107 | #include "MBadPixelsCam.h"
|
---|
108 | #include "MBadPixelsPix.h"
|
---|
109 |
|
---|
110 | ClassImp(MHCalibrationRelTimeCam);
|
---|
111 |
|
---|
112 | using namespace std;
|
---|
113 |
|
---|
114 | const Float_t MHCalibrationRelTimeCam::fgNumHiGainSaturationLimit = 0.25;
|
---|
115 | const UInt_t MHCalibrationRelTimeCam::fgReferencePixel = 1;
|
---|
116 | const Int_t MHCalibrationRelTimeCam::fgNbins = 900;
|
---|
117 | const Axis_t MHCalibrationRelTimeCam::fgFirst = -5.;
|
---|
118 | const Axis_t MHCalibrationRelTimeCam::fgLast = 5.;
|
---|
119 | const TString MHCalibrationRelTimeCam::gsHistName = "RelTime";
|
---|
120 | const TString MHCalibrationRelTimeCam::gsHistTitle = "Rel. Arr. Times";
|
---|
121 | const TString MHCalibrationRelTimeCam::gsHistXTitle = "Rel. Arr. Time [FADC slices]";
|
---|
122 | const TString MHCalibrationRelTimeCam::gsHistYTitle = "Nr. events";
|
---|
123 | // --------------------------------------------------------------------------
|
---|
124 | //
|
---|
125 | // Default Constructor.
|
---|
126 | //
|
---|
127 | // Sets:
|
---|
128 | // - fReferencePixel to fgReferencePixel
|
---|
129 | // - fNbins to fgNbins
|
---|
130 | // - fFirst to fgFirst
|
---|
131 | // - fLast to fgLast
|
---|
132 | //
|
---|
133 | // - fHistName to gsHistName
|
---|
134 | // - fHistTitle to gsHistTitle
|
---|
135 | // - fHistXTitle to gsHistXTitle
|
---|
136 | // - fHistYTitle to gsHistYTitle
|
---|
137 | //
|
---|
138 | MHCalibrationRelTimeCam::MHCalibrationRelTimeCam(const char *name, const char *title)
|
---|
139 | {
|
---|
140 |
|
---|
141 | fName = name ? name : "MHCalibrationRelTimeCam";
|
---|
142 | fTitle = title ? title : "Histogram class for the relative time calibration of the camera";
|
---|
143 |
|
---|
144 | SetNumHiGainSaturationLimit(fgNumHiGainSaturationLimit);
|
---|
145 |
|
---|
146 | SetReferencePixel();
|
---|
147 |
|
---|
148 | SetNbins(fgNbins);
|
---|
149 | SetFirst(fgFirst);
|
---|
150 | SetLast (fgLast );
|
---|
151 |
|
---|
152 | SetHistName (gsHistName .Data());
|
---|
153 | SetHistTitle (gsHistTitle .Data());
|
---|
154 | SetHistXTitle(gsHistXTitle.Data());
|
---|
155 | SetHistYTitle(gsHistYTitle.Data());
|
---|
156 |
|
---|
157 | }
|
---|
158 |
|
---|
159 | // --------------------------------------------------------------------------
|
---|
160 | //
|
---|
161 | // Gets or creates the pointers to:
|
---|
162 | // - MCalibrationRelTimeCam
|
---|
163 | //
|
---|
164 | // Searches pointer to:
|
---|
165 | // - MArrivalTimeCam
|
---|
166 | //
|
---|
167 | // Calls:
|
---|
168 | // - MHCalibrationCam::InitHiGainArrays()
|
---|
169 | // - MHCalibrationCam::InitLoGainArrays()
|
---|
170 | //
|
---|
171 | // Sets:
|
---|
172 | // - fSumareahi to nareas
|
---|
173 | // - fSumarealo to nareas
|
---|
174 | // - fSumsectorhi to nareas
|
---|
175 | // - fSumsectorlo to nareas
|
---|
176 | // - fNumareahi to nareas
|
---|
177 | // - fNumarealo to nareas
|
---|
178 | // - fNumsectorhi to nareas
|
---|
179 | // - fNumsectorlo to nareas
|
---|
180 | //
|
---|
181 | Bool_t MHCalibrationRelTimeCam::ReInitHists(MParList *pList)
|
---|
182 | {
|
---|
183 |
|
---|
184 | fIntensCam = (MCalibrationIntensityCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityRelTimeCam"));
|
---|
185 | if (fIntensCam)
|
---|
186 | *fLog << inf << "Found MCalibrationIntensityRelTimeCam ... " << endl;
|
---|
187 | else
|
---|
188 | {
|
---|
189 | fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam"));
|
---|
190 | if (!fCam)
|
---|
191 | {
|
---|
192 | fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationRelTimeCam"));
|
---|
193 | if (!fCam)
|
---|
194 | {
|
---|
195 | *fLog << err << "Cannot find nor create MCalibrationRelTimeCam ... abort." << endl;
|
---|
196 | return kFALSE;
|
---|
197 | }
|
---|
198 | fCam->Init(*fGeom);
|
---|
199 | }
|
---|
200 | }
|
---|
201 |
|
---|
202 | MArrivalTimeCam *signal = (MArrivalTimeCam*)pList->FindObject("MArrivalTimeCam");
|
---|
203 | if (!signal)
|
---|
204 | {
|
---|
205 | *fLog << err << "MArrivalTimeCam not found... abort." << endl;
|
---|
206 | return kFALSE;
|
---|
207 | }
|
---|
208 |
|
---|
209 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
210 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
211 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
212 |
|
---|
213 | InitHiGainArrays(npixels,nareas,nsectors);
|
---|
214 | InitLoGainArrays(npixels,nareas,nsectors);
|
---|
215 |
|
---|
216 | fSumareahi .Set(nareas);
|
---|
217 | fSumarealo .Set(nareas);
|
---|
218 | fSumsectorhi.Set(nsectors);
|
---|
219 | fSumsectorlo.Set(nsectors);
|
---|
220 | fNumareahi .Set(nareas);
|
---|
221 | fNumarealo .Set(nareas);
|
---|
222 | fNumsectorhi.Set(nsectors);
|
---|
223 | fNumsectorlo.Set(nsectors);
|
---|
224 |
|
---|
225 | return kTRUE;
|
---|
226 | }
|
---|
227 |
|
---|
228 |
|
---|
229 | // -------------------------------------------------------------------------------
|
---|
230 | //
|
---|
231 | // Retrieves pointer to MArrivalTimeCam:
|
---|
232 | //
|
---|
233 | // Retrieves from MGeomCam:
|
---|
234 | // - number of pixels
|
---|
235 | // - number of pixel areas
|
---|
236 | // - number of sectors
|
---|
237 | //
|
---|
238 | // Fills HiGain or LoGain histograms (MHGausEvents::FillHistAndArray()), respectively
|
---|
239 | // depending on MArrivalTimePix::IsLoGainUsed(), with:
|
---|
240 | // - MArrivalTimePix::GetArrivalTime(pixid) - MArrivalTimePix::GetArrivalTime(1);
|
---|
241 | // (i.e. the time difference between pixel i and pixel 1 (hardware number: 2) )
|
---|
242 | //
|
---|
243 | Bool_t MHCalibrationRelTimeCam::FillHists(const MParContainer *par, const Stat_t w)
|
---|
244 | {
|
---|
245 |
|
---|
246 | MArrivalTimeCam *arrtime = (MArrivalTimeCam*)par;
|
---|
247 | if (!arrtime)
|
---|
248 | {
|
---|
249 | gLog << err << "No argument in MArrivalTime::Fill... abort." << endl;
|
---|
250 | return kFALSE;
|
---|
251 | }
|
---|
252 |
|
---|
253 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
254 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
255 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
256 |
|
---|
257 | fSumareahi .Reset();
|
---|
258 | fSumarealo .Reset();
|
---|
259 | fSumsectorhi.Reset();
|
---|
260 | fSumsectorlo.Reset();
|
---|
261 | fNumareahi .Reset();
|
---|
262 | fNumarealo .Reset();
|
---|
263 | fNumsectorhi.Reset();
|
---|
264 | fNumsectorlo.Reset();
|
---|
265 |
|
---|
266 | const MArrivalTimePix &refpix = (*arrtime)[fReferencePixel];
|
---|
267 | const Float_t reftime = refpix.IsLoGainUsed()
|
---|
268 | ? refpix.GetArrivalTimeLoGain() : refpix.GetArrivalTimeHiGain();
|
---|
269 |
|
---|
270 | for (Int_t i=0; i<npixels; i++)
|
---|
271 | {
|
---|
272 |
|
---|
273 | MHCalibrationPix &histhi = (*this)[i];
|
---|
274 | MHCalibrationPix &histlo = (*this)(i);
|
---|
275 |
|
---|
276 | if (histhi.IsExcluded())
|
---|
277 | continue;
|
---|
278 |
|
---|
279 | const MArrivalTimePix &pix = (*arrtime)[i];
|
---|
280 | const Int_t aidx = (*fGeom)[i].GetAidx();
|
---|
281 | const Int_t sector = (*fGeom)[i].GetSector();
|
---|
282 |
|
---|
283 | if (pix.IsLoGainUsed() && IsLoGain())
|
---|
284 | {
|
---|
285 | const Float_t reltime = pix.GetArrivalTimeLoGain() - reftime;
|
---|
286 | histhi.SetSaturated(1);
|
---|
287 | histlo.FillHistAndArray(reltime);
|
---|
288 | fSumarealo [aidx] += reltime;
|
---|
289 | fNumarealo [aidx] ++;
|
---|
290 | fSumsectorlo[sector] += reltime;
|
---|
291 | fNumsectorlo[sector] ++;
|
---|
292 | }
|
---|
293 | else
|
---|
294 | {
|
---|
295 | const Float_t reltime = pix.GetArrivalTimeHiGain() - reftime;
|
---|
296 |
|
---|
297 | histhi.FillHistAndArray(reltime) ;
|
---|
298 | fSumareahi [aidx] += reltime;
|
---|
299 | fNumareahi [aidx] ++;
|
---|
300 | fSumsectorhi[sector] += reltime;
|
---|
301 | fNumsectorhi[sector] ++;
|
---|
302 | }
|
---|
303 | }
|
---|
304 |
|
---|
305 | for (Int_t j=0; j<nareas; j++)
|
---|
306 | {
|
---|
307 | MHCalibrationPix &histhi = GetAverageHiGainArea(j);
|
---|
308 | histhi.FillHistAndArray(fNumareahi[j] == 0 ? 0. : fSumareahi[j]/fNumareahi[j]);
|
---|
309 |
|
---|
310 | if (IsLoGain())
|
---|
311 | {
|
---|
312 | MHCalibrationPix &histlo = GetAverageLoGainArea(j);
|
---|
313 | histlo.FillHistAndArray(fNumarealo[j] == 0 ? 0. : fSumarealo[j]/fNumarealo[j]);
|
---|
314 | }
|
---|
315 | }
|
---|
316 |
|
---|
317 | for (Int_t j=0; j<nsectors; j++)
|
---|
318 | {
|
---|
319 | MHCalibrationPix &histhi = GetAverageHiGainSector(j);
|
---|
320 | histhi.FillHistAndArray(fNumsectorhi[j] == 0 ? 0. : fSumsectorhi[j]/fNumsectorhi[j]);
|
---|
321 |
|
---|
322 | if (IsLoGain())
|
---|
323 | {
|
---|
324 | MHCalibrationPix &histlo = GetAverageLoGainSector(j);
|
---|
325 | histlo.FillHistAndArray(fNumsectorlo[j] == 0 ? 0. : fSumsectorlo[j]/fNumsectorlo[j]);
|
---|
326 | }
|
---|
327 | }
|
---|
328 |
|
---|
329 | return kTRUE;
|
---|
330 | }
|
---|
331 |
|
---|
332 | // --------------------------------------------------------------------------
|
---|
333 | //
|
---|
334 | // Calls:
|
---|
335 | // - MHCalibrationCam::FitHiGainArrays() with flags:
|
---|
336 | // MBadPixelsPix::kRelTimeNotFitted and MBadPixelsPix::kRelTimeOscillating
|
---|
337 | // - MHCalibrationCam::FitLoGainArrays() with flags:
|
---|
338 | // MBadPixelsPix::kRelTimeNotFitted and MBadPixelsPix::kRelTimeOscillating
|
---|
339 | //
|
---|
340 | Bool_t MHCalibrationRelTimeCam::FinalizeHists()
|
---|
341 | {
|
---|
342 | for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
|
---|
343 | {
|
---|
344 |
|
---|
345 | MHCalibrationPix &histhi = (*this)[i];
|
---|
346 |
|
---|
347 | if (histhi.IsExcluded())
|
---|
348 | continue;
|
---|
349 |
|
---|
350 | MCalibrationRelTimePix &pix = fIntensCam
|
---|
351 | ? (MCalibrationRelTimePix&)(*fIntensCam)[i]
|
---|
352 | : (MCalibrationRelTimePix&)(*fCam)[i];
|
---|
353 |
|
---|
354 | if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
|
---|
355 | {
|
---|
356 | pix.SetHiGainSaturation();
|
---|
357 | histhi.SetExcluded();
|
---|
358 | }
|
---|
359 | else
|
---|
360 | if (IsLoGain())
|
---|
361 | (*this)(i).SetExcluded();
|
---|
362 |
|
---|
363 | Stat_t overflow = histhi.GetHGausHist()->GetBinContent(histhi.GetHGausHist()->GetNbinsX()+1);
|
---|
364 | if (overflow > 0.1)
|
---|
365 | {
|
---|
366 | *fLog << warn << GetDescriptor()
|
---|
367 | << ": HiGain Histogram Overflow occurred " << overflow
|
---|
368 | << " times in pixel: " << i << " (without saturation!) " << endl;
|
---|
369 | // bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
|
---|
370 | }
|
---|
371 |
|
---|
372 | overflow = histhi.GetHGausHist()->GetBinContent(0);
|
---|
373 | if (overflow > 0.1)
|
---|
374 | {
|
---|
375 | *fLog << warn << GetDescriptor()
|
---|
376 | << ": HiGain Histogram Underflow occurred " << overflow
|
---|
377 | << " times in pixel: " << i << " (without saturation!) " << endl;
|
---|
378 | // bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
|
---|
379 | }
|
---|
380 | }
|
---|
381 |
|
---|
382 | for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
|
---|
383 | {
|
---|
384 |
|
---|
385 | MHCalibrationPix &histhi = GetAverageHiGainArea(j);
|
---|
386 |
|
---|
387 | if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
|
---|
388 | {
|
---|
389 | MCalibrationRelTimePix &pix = fIntensCam
|
---|
390 | ? (MCalibrationRelTimePix&)fIntensCam->GetAverageArea(j)
|
---|
391 | : (MCalibrationRelTimePix&)fCam->GetAverageArea(j);
|
---|
392 | pix.SetHiGainSaturation();
|
---|
393 | histhi.SetExcluded();
|
---|
394 | }
|
---|
395 | else
|
---|
396 | if (IsLoGain())
|
---|
397 | GetAverageLoGainArea(j).SetExcluded();
|
---|
398 |
|
---|
399 | }
|
---|
400 |
|
---|
401 | for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
|
---|
402 | {
|
---|
403 |
|
---|
404 | MHCalibrationPix &histhi = GetAverageHiGainSector(j);
|
---|
405 | MCalibrationRelTimePix &pix = fIntensCam
|
---|
406 | ? (MCalibrationRelTimePix&)fIntensCam->GetAverageSector(j)
|
---|
407 | : (MCalibrationRelTimePix&)fCam->GetAverageSector(j);
|
---|
408 |
|
---|
409 | if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
|
---|
410 | {
|
---|
411 | pix.SetHiGainSaturation();
|
---|
412 | histhi.SetExcluded();
|
---|
413 | }
|
---|
414 | else
|
---|
415 | if (IsLoGain())
|
---|
416 | GetAverageLoGainSector(j).SetExcluded();
|
---|
417 | }
|
---|
418 |
|
---|
419 | FitHiGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam),
|
---|
420 | *fBadPixels,
|
---|
421 | MBadPixelsPix::kRelTimeNotFitted,
|
---|
422 | MBadPixelsPix::kRelTimeOscillating);
|
---|
423 |
|
---|
424 | if (IsLoGain())
|
---|
425 | FitLoGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam),
|
---|
426 | *fBadPixels,
|
---|
427 | MBadPixelsPix::kRelTimeNotFitted,
|
---|
428 | MBadPixelsPix::kRelTimeOscillating);
|
---|
429 |
|
---|
430 | return kTRUE;
|
---|
431 | }
|
---|
432 |
|
---|
433 | // --------------------------------------------------------------------------
|
---|
434 | //
|
---|
435 | // Sets all pixels to MBadPixelsPix::kUnreliableRun, if following flags are set:
|
---|
436 | // - MBadPixelsPix::kRelTimeNotFitted
|
---|
437 | // - MBadPixelsPix::kRelTimeOscillating
|
---|
438 | //
|
---|
439 | void MHCalibrationRelTimeCam::FinalizeBadPixels()
|
---|
440 | {
|
---|
441 |
|
---|
442 | for (Int_t i=0; i<fBadPixels->GetSize(); i++)
|
---|
443 | {
|
---|
444 |
|
---|
445 | MBadPixelsPix &bad = (*fBadPixels)[i];
|
---|
446 |
|
---|
447 | if (bad.IsUncalibrated( MBadPixelsPix::kRelTimeNotFitted ))
|
---|
448 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
---|
449 |
|
---|
450 | if (bad.IsUncalibrated( MBadPixelsPix::kRelTimeOscillating))
|
---|
451 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
---|
452 |
|
---|
453 | }
|
---|
454 | }
|
---|
455 |
|
---|
456 | // --------------------------------------------------------------------------
|
---|
457 | //
|
---|
458 | // The types are as follows:
|
---|
459 | //
|
---|
460 | // Fitted values:
|
---|
461 | // ==============
|
---|
462 | //
|
---|
463 | // 0: Fitted Mean Relative Arrival Time in FADC slices (MHGausEvents::GetMean()
|
---|
464 | // 1: Error Mean Relative Arrival Time in FADC slices (MHGausEvents::GetMeanErr()
|
---|
465 | // 2: Sigma fitted Relative Arrival Time in FADC slices (MHGausEvents::GetSigma()
|
---|
466 | // 3: Error Sigma Relative Arrival Time in FADC slices (MHGausEvents::GetSigmaErr()
|
---|
467 | //
|
---|
468 | // Useful variables derived from the fit results:
|
---|
469 | // =============================================
|
---|
470 | //
|
---|
471 | // 4: Returned probability of Gauss fit (calls: MHGausEvents::GetProb())
|
---|
472 | //
|
---|
473 | // Localized defects:
|
---|
474 | // ==================
|
---|
475 | //
|
---|
476 | // 5: Gaus fit not OK (calls: MHGausEvents::IsGausFitOK())
|
---|
477 | // 6: Fourier spectrum not OK (calls: MHGausEvents::IsFourierSpectrumOK())
|
---|
478 | //
|
---|
479 | Bool_t MHCalibrationRelTimeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
480 | {
|
---|
481 |
|
---|
482 | if (fHiGainArray->GetSize() <= idx)
|
---|
483 | return kFALSE;
|
---|
484 |
|
---|
485 | const MHCalibrationPix &pix = (*this)[idx];
|
---|
486 |
|
---|
487 | switch (type)
|
---|
488 | {
|
---|
489 | case 0:
|
---|
490 | val = pix.GetMean();
|
---|
491 | break;
|
---|
492 | case 1:
|
---|
493 | val = pix.GetMeanErr();
|
---|
494 | break;
|
---|
495 | case 2:
|
---|
496 | val = pix.GetSigma();
|
---|
497 | break;
|
---|
498 | case 3:
|
---|
499 | val = pix.GetSigmaErr();
|
---|
500 | break;
|
---|
501 | case 4:
|
---|
502 | val = pix.GetProb();
|
---|
503 | break;
|
---|
504 | case 5:
|
---|
505 | if (!pix.IsGausFitOK())
|
---|
506 | val = 1.;
|
---|
507 | break;
|
---|
508 | case 6:
|
---|
509 | if (!pix.IsFourierSpectrumOK())
|
---|
510 | val = 1.;
|
---|
511 | break;
|
---|
512 | default:
|
---|
513 | return kFALSE;
|
---|
514 | }
|
---|
515 | return kTRUE;
|
---|
516 | }
|
---|
517 |
|
---|
518 | // --------------------------------------------------------------------------
|
---|
519 | //
|
---|
520 | // Calls MHCalibrationPix::DrawClone() for pixel idx
|
---|
521 | //
|
---|
522 | void MHCalibrationRelTimeCam::DrawPixelContent(Int_t idx) const
|
---|
523 | {
|
---|
524 | (*this)[idx].DrawClone();
|
---|
525 | }
|
---|