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 | // MHCalibrationChargeCam
|
---|
27 | //
|
---|
28 | // Fills the extracted signals of MExtractedSignalCam into the MHCalibrationPix-classes
|
---|
29 | // MHCalibrationChargeHiGainPix and MHCalibrationChargeLoGainPix for every:
|
---|
30 | //
|
---|
31 | // - Pixel, stored in the TOrdCollection's MHCalibrationCam::fHiGainArray and
|
---|
32 | // MHCalibrationCam::fLoGainArray
|
---|
33 | //
|
---|
34 | // - Average pixel per AREA index (e.g. inner and outer for the MAGIC camera),
|
---|
35 | // stored in the TOrdCollection's MHCalibrationCam::fAverageHiGainAreas and
|
---|
36 | // MHCalibrationCam::fAverageLoGainAreas
|
---|
37 | //
|
---|
38 | // - Average pixel per camera SECTOR (e.g. sectors 1-6 for the MAGIC camera),
|
---|
39 | // stored in the TOrdCollection's MHCalibrationCam::fAverageHiGainSectors and
|
---|
40 | // MHCalibrationCam::fAverageLoGainSectors
|
---|
41 | //
|
---|
42 | // Every signal is taken from MExtractedSignalCam and filled into a histogram and
|
---|
43 | // an array, in order to perform a Fourier analysis (see MHGausEvents).
|
---|
44 | // The signals are moreover averaged on an event-by-event basis and written into
|
---|
45 | // the corresponding average pixels.
|
---|
46 | //
|
---|
47 | // Additionally, the (FADC slice) position of the maximum is stored in an Absolute
|
---|
48 | // Arrival Time histogram. This histogram serves for a rough cross-check if the
|
---|
49 | // signal does not lie at or outside the edges of the extraction window.
|
---|
50 | //
|
---|
51 | // The Charge histograms are fitted to a Gaussian, mean and sigma with its errors
|
---|
52 | // and the fit probability are extracted. If none of these values are NaN's and
|
---|
53 | // if the probability is bigger than MHGausEvents::fProbLimit (default: 0.5%),
|
---|
54 | // the fit is declared valid.
|
---|
55 | // Otherwise, the fit is repeated within ranges of the previous mean
|
---|
56 | // +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit())
|
---|
57 | // In case this does not make the fit valid, the histogram means and RMS's are
|
---|
58 | // taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set:
|
---|
59 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) or
|
---|
60 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted ) and
|
---|
61 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
62 | //
|
---|
63 | // Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas
|
---|
64 | // from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup)
|
---|
65 | //
|
---|
66 | // Unless more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC
|
---|
67 | // slices show saturation, the following flag is set:
|
---|
68 | // - MCalibrationChargePix::SetHiGainSaturation();
|
---|
69 | // In that case, the calibration constants are derived from the low-gain results.
|
---|
70 | //
|
---|
71 | // If more than fNumLoGainSaturationLimit (default: 1%) of the overall
|
---|
72 | // low-gain FADC slices saturate, the following flags are set:
|
---|
73 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturation ) and
|
---|
74 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnsuitableRun )
|
---|
75 | //
|
---|
76 | // The class also fills arrays with the signal vs. event number, creates a fourier
|
---|
77 | // spectrum and investigates if the projected fourier components follow an exponential
|
---|
78 | // distribution. In case that the probability of the exponential fit is less than
|
---|
79 | // MHGausEvents::fProbLimit (default: 0.5%), the following flags are set:
|
---|
80 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating ) or
|
---|
81 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating ) and
|
---|
82 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
83 | //
|
---|
84 | // This same procedure is performed for the average pixels.
|
---|
85 | //
|
---|
86 | // The following results are written into MCalibrationChargeCam:
|
---|
87 | //
|
---|
88 | // - MCalibrationPix::SetHiGainSaturation()
|
---|
89 | // - MCalibrationPix::SetHiGainMean()
|
---|
90 | // - MCalibrationPix::SetHiGainMeanErr()
|
---|
91 | // - MCalibrationPix::SetHiGainSigma()
|
---|
92 | // - MCalibrationPix::SetHiGainSigmaErr()
|
---|
93 | // - MCalibrationPix::SetHiGainProb()
|
---|
94 | // - MCalibrationPix::SetHiGainNumPickup()
|
---|
95 | //
|
---|
96 | // - MCalibrationPix::SetLoGainMean()
|
---|
97 | // - MCalibrationPix::SetLoGainMeanErr()
|
---|
98 | // - MCalibrationPix::SetLoGainSigma()
|
---|
99 | // - MCalibrationPix::SetLoGainSigmaErr()
|
---|
100 | // - MCalibrationPix::SetLoGainProb()
|
---|
101 | // - MCalibrationPix::SetLoGainNumPickup()
|
---|
102 | //
|
---|
103 | // - MCalibrationChargePix::SetAbsTimeMean()
|
---|
104 | // - MCalibrationChargePix::SetAbsTimeRms()
|
---|
105 | //
|
---|
106 | // For all averaged areas, the fitted sigma is multiplied with the square root of
|
---|
107 | // the number involved pixels in order to be able to compare it to the average of
|
---|
108 | // sigmas in the camera.
|
---|
109 | //
|
---|
110 | /////////////////////////////////////////////////////////////////////////////
|
---|
111 | #include "MHCalibrationChargeCam.h"
|
---|
112 | #include "MHCalibrationCam.h"
|
---|
113 |
|
---|
114 | #include "MLog.h"
|
---|
115 | #include "MLogManip.h"
|
---|
116 |
|
---|
117 | #include "MParList.h"
|
---|
118 |
|
---|
119 | #include "MHCalibrationChargePix.h"
|
---|
120 | #include "MHCalibrationPix.h"
|
---|
121 |
|
---|
122 | #include "MCalibrationIntensityCam.h"
|
---|
123 | #include "MCalibrationChargeCam.h"
|
---|
124 | #include "MCalibrationChargePix.h"
|
---|
125 |
|
---|
126 | #include "MGeomCam.h"
|
---|
127 | #include "MGeomPix.h"
|
---|
128 |
|
---|
129 | #include "MBadPixelsIntensityCam.h"
|
---|
130 | #include "MBadPixelsCam.h"
|
---|
131 | #include "MBadPixelsPix.h"
|
---|
132 |
|
---|
133 | #include "MRawEvtData.h"
|
---|
134 | #include "MRawRunHeader.h"
|
---|
135 | #include "MRawEvtPixelIter.h"
|
---|
136 |
|
---|
137 | #include "MExtractedSignalCam.h"
|
---|
138 | #include "MExtractedSignalPix.h"
|
---|
139 |
|
---|
140 | #include "MArrayI.h"
|
---|
141 | #include "MArrayD.h"
|
---|
142 |
|
---|
143 | #include <TOrdCollection.h>
|
---|
144 | #include <TPad.h>
|
---|
145 | #include <TVirtualPad.h>
|
---|
146 | #include <TCanvas.h>
|
---|
147 | #include <TStyle.h>
|
---|
148 | #include <TF1.h>
|
---|
149 | #include <TLatex.h>
|
---|
150 | #include <TLegend.h>
|
---|
151 | #include <TGraph.h>
|
---|
152 |
|
---|
153 | ClassImp(MHCalibrationChargeCam);
|
---|
154 |
|
---|
155 | using namespace std;
|
---|
156 |
|
---|
157 | const Int_t MHCalibrationChargeCam::fgChargeHiGainNbins = 500;
|
---|
158 | const Axis_t MHCalibrationChargeCam::fgChargeHiGainFirst = -100.5;
|
---|
159 | const Axis_t MHCalibrationChargeCam::fgChargeHiGainLast = 1899.5;
|
---|
160 | const Int_t MHCalibrationChargeCam::fgChargeLoGainNbins = 500;
|
---|
161 | const Axis_t MHCalibrationChargeCam::fgChargeLoGainFirst = -100.5;
|
---|
162 | const Axis_t MHCalibrationChargeCam::fgChargeLoGainLast = 899.5;
|
---|
163 | const Float_t MHCalibrationChargeCam::fgProbLimit = 0.00001;
|
---|
164 | const TString MHCalibrationChargeCam::gsHistName = "Charge";
|
---|
165 | const TString MHCalibrationChargeCam::gsHistTitle = "Signals";
|
---|
166 | const TString MHCalibrationChargeCam::gsHistXTitle = "Signal [FADC counts]";
|
---|
167 | const TString MHCalibrationChargeCam::gsHistYTitle = "Nr. events";
|
---|
168 | const TString MHCalibrationChargeCam::gsAbsHistName = "AbsTime";
|
---|
169 | const TString MHCalibrationChargeCam::gsAbsHistTitle = "Abs. Arr. Times";
|
---|
170 | const TString MHCalibrationChargeCam::gsAbsHistXTitle = "Time [FADC slices]";
|
---|
171 | const TString MHCalibrationChargeCam::gsAbsHistYTitle = "Nr. events";
|
---|
172 | const Float_t MHCalibrationChargeCam::fgNumHiGainSaturationLimit = 0.01;
|
---|
173 | const Float_t MHCalibrationChargeCam::fgNumLoGainSaturationLimit = 0.005;
|
---|
174 | const Float_t MHCalibrationChargeCam::fgTimeLowerLimit = 1.;
|
---|
175 | const Float_t MHCalibrationChargeCam::fgTimeUpperLimit = 2.;
|
---|
176 | // 1Led Green, 1 LED blue, 5 LEDs blue, 10 LEDs blue, 10 LEDs UV, CT1, 5Leds Green
|
---|
177 | const Float_t MHCalibrationChargeCam::gkHiGainInnerRefLines[7] = { 245., 323. , 1065., 1467., 180., 211. , 533.5};
|
---|
178 | const Float_t MHCalibrationChargeCam::gkHiGainOuterRefLines[7] = { 217., 307.5, 932. , 1405., 167., 183.5, 405.5};
|
---|
179 | const Float_t MHCalibrationChargeCam::gkLoGainInnerRefLines[7] = { 20.8, 28.0 , 121. , 200.2, 16.5, 13.5 , 41.7 };
|
---|
180 | const Float_t MHCalibrationChargeCam::gkLoGainOuterRefLines[7] = { 18.9, 26.0 , 108.3, 198. , 14.0, 11. , 42. };
|
---|
181 | // --------------------------------------------------------------------------
|
---|
182 | //
|
---|
183 | // Default Constructor.
|
---|
184 | //
|
---|
185 | // Sets:
|
---|
186 | // - all pointers to NULL
|
---|
187 | //
|
---|
188 | // Initializes:
|
---|
189 | // - fNumHiGainSaturationLimit to fgNumHiGainSaturationLimit
|
---|
190 | // - fNumLoGainSaturationLimit to fgNumLoGainSaturationLimit
|
---|
191 | // - fTimeLowerLimit to fgTimeLowerLimit
|
---|
192 | // - fTimeUpperLimit to fgTimeUpperLimit
|
---|
193 | //
|
---|
194 | // - fNbins to fgChargeHiGainNbins
|
---|
195 | // - fFirst to fgChargeHiGainFirst
|
---|
196 | // - fLast to fgChargeHiGainLast
|
---|
197 | //
|
---|
198 | // - fLoGainNbins to fgChargeLoGainNbins
|
---|
199 | // - fLoGainFirst to fgChargeLoGainFirst
|
---|
200 | // - fLoGainLast to fgChargeLoGainLast
|
---|
201 | //
|
---|
202 | // - fHistName to gsHistName
|
---|
203 | // - fHistTitle to gsHistTitle
|
---|
204 | // - fHistXTitle to gsHistXTitle
|
---|
205 | // - fHistYTitle to gsHistYTitle
|
---|
206 | //
|
---|
207 | // - fAbsHistName to gsAbsHistName
|
---|
208 | // - fAbsHistTitle to gsAbsHistTitle
|
---|
209 | // - fAbsHistXTitle to gsAbsHistXTitle
|
---|
210 | // - fAbsHistYTitle to gsAbsHistYTitle
|
---|
211 | //
|
---|
212 | MHCalibrationChargeCam::MHCalibrationChargeCam(const char *name, const char *title)
|
---|
213 | : fRawEvt(NULL)
|
---|
214 | {
|
---|
215 |
|
---|
216 | fName = name ? name : "MHCalibrationChargeCam";
|
---|
217 | fTitle = title ? title : "Class to fill the calibration histograms ";
|
---|
218 |
|
---|
219 | SetNumHiGainSaturationLimit(fgNumHiGainSaturationLimit);
|
---|
220 | SetNumLoGainSaturationLimit(fgNumLoGainSaturationLimit);
|
---|
221 |
|
---|
222 | SetTimeLowerLimit();
|
---|
223 | SetTimeUpperLimit();
|
---|
224 |
|
---|
225 | SetNbins(fgChargeHiGainNbins);
|
---|
226 | SetFirst(fgChargeHiGainFirst);
|
---|
227 | SetLast (fgChargeHiGainLast );
|
---|
228 |
|
---|
229 | SetProbLimit(fgProbLimit);
|
---|
230 |
|
---|
231 | SetLoGainNbins(fgChargeLoGainNbins);
|
---|
232 | SetLoGainFirst(fgChargeLoGainFirst);
|
---|
233 | SetLoGainLast (fgChargeLoGainLast );
|
---|
234 |
|
---|
235 | SetHistName (gsHistName .Data());
|
---|
236 | SetHistTitle (gsHistTitle .Data());
|
---|
237 | SetHistXTitle(gsHistXTitle.Data());
|
---|
238 | SetHistYTitle(gsHistYTitle.Data());
|
---|
239 |
|
---|
240 | SetAbsHistName (gsAbsHistName .Data());
|
---|
241 | SetAbsHistTitle (gsAbsHistTitle .Data());
|
---|
242 | SetAbsHistXTitle(gsAbsHistXTitle.Data());
|
---|
243 | SetAbsHistYTitle(gsAbsHistYTitle.Data());
|
---|
244 | }
|
---|
245 |
|
---|
246 | // --------------------------------------------------------------------------
|
---|
247 | //
|
---|
248 | // Creates new MHCalibrationChargeCam only with the averaged areas:
|
---|
249 | // the rest has to be retrieved directly, e.g. via:
|
---|
250 | // MHCalibrationChargeCam *cam = MParList::FindObject("MHCalibrationChargeCam");
|
---|
251 | // - cam->GetAverageSector(5).DrawClone();
|
---|
252 | // - (*cam)[100].DrawClone()
|
---|
253 | //
|
---|
254 | TObject *MHCalibrationChargeCam::Clone(const char *) const
|
---|
255 | {
|
---|
256 |
|
---|
257 | MHCalibrationChargeCam *cam = new MHCalibrationChargeCam();
|
---|
258 |
|
---|
259 | //
|
---|
260 | // Copy the data members
|
---|
261 | //
|
---|
262 | cam->fColor = fColor;
|
---|
263 | cam->fRunNumbers = fRunNumbers;
|
---|
264 | cam->fPulserFrequency = fPulserFrequency;
|
---|
265 | cam->fFlags = fFlags;
|
---|
266 | cam->fNbins = fNbins;
|
---|
267 | cam->fFirst = fFirst;
|
---|
268 | cam->fLast = fLast;
|
---|
269 | cam->fLoGainNbins = fLoGainNbins;
|
---|
270 | cam->fLoGainFirst = fLoGainFirst;
|
---|
271 | cam->fLoGainLast = fLoGainLast;
|
---|
272 |
|
---|
273 | //
|
---|
274 | // Copy the MArrays
|
---|
275 | //
|
---|
276 | cam->fAverageAreaRelSigma = fAverageAreaRelSigma;
|
---|
277 | cam->fAverageAreaRelSigmaVar = fAverageAreaRelSigmaVar;
|
---|
278 | cam->fAverageAreaSat = fAverageAreaSat;
|
---|
279 | cam->fAverageAreaSigma = fAverageAreaSigma;
|
---|
280 | cam->fAverageAreaSigmaVar = fAverageAreaSigmaVar;
|
---|
281 | cam->fAverageAreaNum = fAverageAreaNum;
|
---|
282 | cam->fAverageSectorNum = fAverageSectorNum;
|
---|
283 |
|
---|
284 | if (!IsAverageing())
|
---|
285 | return cam;
|
---|
286 |
|
---|
287 | const Int_t navhi = fAverageHiGainAreas->GetSize();
|
---|
288 |
|
---|
289 | for (int i=0; i<navhi; i++)
|
---|
290 | cam->fAverageHiGainAreas->AddAt(GetAverageHiGainArea(i).Clone(),i);
|
---|
291 |
|
---|
292 | if (IsLoGain())
|
---|
293 | {
|
---|
294 |
|
---|
295 | const Int_t navlo = fAverageLoGainAreas->GetSize();
|
---|
296 | for (int i=0; i<navlo; i++)
|
---|
297 | cam->fAverageLoGainAreas->AddAt(GetAverageLoGainArea(i).Clone(),i);
|
---|
298 |
|
---|
299 | }
|
---|
300 |
|
---|
301 | return cam;
|
---|
302 | }
|
---|
303 |
|
---|
304 | // --------------------------------------------------------------------------
|
---|
305 | //
|
---|
306 | // Gets the pointers to:
|
---|
307 | // - MRawEvtData
|
---|
308 | //
|
---|
309 | Bool_t MHCalibrationChargeCam::SetupHists(const MParList *pList)
|
---|
310 | {
|
---|
311 |
|
---|
312 | fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
|
---|
313 | if (!fRawEvt)
|
---|
314 | {
|
---|
315 | *fLog << err << dbginf << "MRawEvtData not found... aborting." << endl;
|
---|
316 | return kFALSE;
|
---|
317 | }
|
---|
318 |
|
---|
319 | return kTRUE;
|
---|
320 | }
|
---|
321 |
|
---|
322 | // --------------------------------------------------------------------------
|
---|
323 | //
|
---|
324 | // Gets or creates the pointers to:
|
---|
325 | // - MExtractedSignalCam
|
---|
326 | // - MCalibrationChargeCam or MCalibrationIntensityChargeCam
|
---|
327 | // - MBadPixelsCam
|
---|
328 | //
|
---|
329 | // Initializes the number of used FADC slices from MExtractedSignalCam
|
---|
330 | // into MCalibrationChargeCam and test for changes in that variable
|
---|
331 | //
|
---|
332 | // Calls:
|
---|
333 | // - InitHiGainArrays()
|
---|
334 | // - InitLoGainArrays()
|
---|
335 | //
|
---|
336 | // Sets:
|
---|
337 | // - fSumhiarea to nareas
|
---|
338 | // - fSumloarea to nareas
|
---|
339 | // - fTimehiarea to nareas
|
---|
340 | // - fTimeloarea to nareas
|
---|
341 | // - fSumhisector to nsectors
|
---|
342 | // - fSumlosector to nsectors
|
---|
343 | // - fTimehisector to nsectors
|
---|
344 | // - fTimelosector to nsectors
|
---|
345 | // - fSathiarea to nareas
|
---|
346 | // - fSatloarea to nareas
|
---|
347 | // - fSathisector to nsectors
|
---|
348 | // - fSatlosector to nsectors
|
---|
349 | //
|
---|
350 | Bool_t MHCalibrationChargeCam::ReInitHists(MParList *pList)
|
---|
351 | {
|
---|
352 |
|
---|
353 | MExtractedSignalCam *signal =
|
---|
354 | (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
|
---|
355 | if (!signal)
|
---|
356 | {
|
---|
357 | *fLog << err << "MExtractedSignalCam not found... abort." << endl;
|
---|
358 | return kFALSE;
|
---|
359 | }
|
---|
360 |
|
---|
361 | if (!InitCams(pList,"Charge"))
|
---|
362 | return kFALSE;
|
---|
363 |
|
---|
364 | fFirstHiGain = signal->GetFirstUsedSliceHiGain();
|
---|
365 | fLastHiGain = signal->GetLastUsedSliceHiGain();
|
---|
366 | fFirstLoGain = signal->GetFirstUsedSliceLoGain();
|
---|
367 | fLastLoGain = signal->GetLastUsedSliceLoGain();
|
---|
368 |
|
---|
369 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
370 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
371 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
372 |
|
---|
373 | //
|
---|
374 | // In case of the intense blue, double the range
|
---|
375 | //
|
---|
376 | if (fGeom->InheritsFrom("MGeomCamMagic"))
|
---|
377 | if ( fColor == MCalibrationCam::kBLUE)
|
---|
378 | SetLoGainLast(2.*fLoGainLast - fLoGainFirst);
|
---|
379 |
|
---|
380 | InitHiGainArrays(npixels,nareas,nsectors);
|
---|
381 | InitLoGainArrays(npixels,nareas,nsectors);
|
---|
382 |
|
---|
383 | fSumhiarea .Set(nareas);
|
---|
384 | fSumloarea .Set(nareas);
|
---|
385 | fTimehiarea .Set(nareas);
|
---|
386 | fTimeloarea .Set(nareas);
|
---|
387 | fSumhisector.Set(nsectors);
|
---|
388 | fSumlosector.Set(nsectors);
|
---|
389 | fTimehisector.Set(nsectors);
|
---|
390 | fTimelosector.Set(nsectors);
|
---|
391 |
|
---|
392 | fSathiarea .Set(nareas);
|
---|
393 | fSatloarea .Set(nareas);
|
---|
394 | fSathisector.Set(nsectors);
|
---|
395 | fSatlosector.Set(nsectors);
|
---|
396 |
|
---|
397 | return kTRUE;
|
---|
398 | }
|
---|
399 |
|
---|
400 | // --------------------------------------------------------------------------
|
---|
401 | //
|
---|
402 | // Retrieve:
|
---|
403 | // - fRunHeader->GetNumSamplesHiGain();
|
---|
404 | //
|
---|
405 | // Initializes the High Gain Arrays:
|
---|
406 | //
|
---|
407 | // - For every entry in the expanded arrays:
|
---|
408 | // * Initialize an MHCalibrationChargePix
|
---|
409 | // * Set Binning from fNbins, fFirst and fLast
|
---|
410 | // * Set Binning of Abs Times histogram from fAbsNbins, fAbsFirst and fAbsLast
|
---|
411 | // * Set Histgram names and titles from fHistName and fHistTitle
|
---|
412 | // * Set Abs Times Histgram names and titles from fAbsHistName and fAbsHistTitle
|
---|
413 | // * Set X-axis and Y-axis titles from fHistXTitle and fHistYTitle
|
---|
414 | // * Set X-axis and Y-axis titles of Abs Times Histogram from fAbsHistXTitle and fAbsHistYTitle
|
---|
415 | // * Call InitHists
|
---|
416 | //
|
---|
417 | //
|
---|
418 | void MHCalibrationChargeCam::InitHiGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors)
|
---|
419 | {
|
---|
420 |
|
---|
421 | TH1F *h;
|
---|
422 |
|
---|
423 | const Int_t higainsamples = fRunHeader->GetNumSamplesHiGain();
|
---|
424 |
|
---|
425 | if (fHiGainArray->GetSize()==0)
|
---|
426 | {
|
---|
427 | for (Int_t i=0; i<npixels; i++)
|
---|
428 | {
|
---|
429 | fHiGainArray->AddAt(new MHCalibrationChargePix(Form("%sHiGainPix%04d",fHistName.Data(),i),
|
---|
430 | Form("%s High Gain Pixel%04d",fHistTitle.Data(),i)),i);
|
---|
431 |
|
---|
432 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)(*this)[i];
|
---|
433 |
|
---|
434 | pix.SetNbins(fNbins);
|
---|
435 | pix.SetFirst(fFirst);
|
---|
436 | pix.SetLast (fLast);
|
---|
437 |
|
---|
438 | pix.SetProbLimit(fProbLimit);
|
---|
439 |
|
---|
440 | pix.SetAbsTimeNbins(higainsamples);
|
---|
441 | pix.SetAbsTimeFirst(-0.5);
|
---|
442 | pix.SetAbsTimeLast(higainsamples-0.5);
|
---|
443 |
|
---|
444 | InitHists(pix,fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i],i);
|
---|
445 |
|
---|
446 | h = pix.GetHAbsTime();
|
---|
447 |
|
---|
448 | h->SetName (Form("H%sHiGainPix%04d",fAbsHistName.Data(),i));
|
---|
449 | h->SetTitle(Form("%s High Gain Pixel %04d",fAbsHistTitle.Data(),i));
|
---|
450 | h->SetXTitle(fAbsHistXTitle.Data());
|
---|
451 | h->SetYTitle(fAbsHistYTitle.Data());
|
---|
452 | }
|
---|
453 | }
|
---|
454 |
|
---|
455 |
|
---|
456 | if (fAverageHiGainAreas->GetSize()==0)
|
---|
457 | {
|
---|
458 | for (Int_t j=0; j<nareas; j++)
|
---|
459 | {
|
---|
460 | fAverageHiGainAreas->AddAt(new MHCalibrationChargePix(Form("%sHiGainArea%d",fHistName.Data(),j),
|
---|
461 | Form("%s High Gain Area Idx %d",fHistTitle.Data(),j)),j);
|
---|
462 |
|
---|
463 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageHiGainArea(j);
|
---|
464 |
|
---|
465 | pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
|
---|
466 | pix.SetFirst(fFirst);
|
---|
467 | pix.SetLast (fLast);
|
---|
468 |
|
---|
469 | pix.SetAbsTimeNbins(higainsamples);
|
---|
470 | pix.SetAbsTimeFirst(-0.5);
|
---|
471 | pix.SetAbsTimeLast(higainsamples-0.5);
|
---|
472 |
|
---|
473 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
|
---|
474 |
|
---|
475 | h = pix.GetHAbsTime();
|
---|
476 |
|
---|
477 | h->SetName (Form("H%sHiGainArea%d",fAbsHistName.Data(),j));
|
---|
478 | h->SetTitle(Form("%s%s%d",fAbsHistTitle.Data(),
|
---|
479 | " averaged on event-by-event basis High Gain Area Idx ",j));
|
---|
480 | h->SetXTitle(fAbsHistXTitle.Data());
|
---|
481 | h->SetYTitle(fAbsHistYTitle.Data());
|
---|
482 | }
|
---|
483 | }
|
---|
484 |
|
---|
485 | if (fAverageHiGainSectors->GetSize()==0)
|
---|
486 | {
|
---|
487 | for (Int_t j=0; j<nsectors; j++)
|
---|
488 | {
|
---|
489 | fAverageHiGainSectors->AddAt(new MHCalibrationChargePix(Form("%sHiGainSector%02d",fHistName.Data(),j),
|
---|
490 | Form("%s High Gain Sector %02d",fHistTitle.Data(),j)),j);
|
---|
491 |
|
---|
492 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageHiGainSector(j);
|
---|
493 |
|
---|
494 | pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
|
---|
495 | pix.SetFirst(fFirst);
|
---|
496 | pix.SetLast (fLast);
|
---|
497 |
|
---|
498 | pix.SetAbsTimeNbins(higainsamples);
|
---|
499 | pix.SetAbsTimeFirst(-0.5);
|
---|
500 | pix.SetAbsTimeLast(higainsamples-0.5);
|
---|
501 |
|
---|
502 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
|
---|
503 |
|
---|
504 | h = pix.GetHAbsTime();
|
---|
505 |
|
---|
506 | h->SetName (Form("H%sHiGainSector%02d",fAbsHistName.Data(),j));
|
---|
507 | h->SetTitle(Form("%s%s%02d",fAbsHistTitle.Data(),
|
---|
508 | " averaged on event-by-event basis High Gain Area Sector ",j));
|
---|
509 | h->SetXTitle(fAbsHistXTitle.Data());
|
---|
510 | h->SetYTitle(fAbsHistYTitle.Data());
|
---|
511 | }
|
---|
512 | }
|
---|
513 | }
|
---|
514 |
|
---|
515 | //--------------------------------------------------------------------------------------
|
---|
516 | //
|
---|
517 | // Return, if IsLoGain() is kFALSE
|
---|
518 | //
|
---|
519 | // Retrieve:
|
---|
520 | // - fRunHeader->GetNumSamplesHiGain();
|
---|
521 | //
|
---|
522 | // Initializes the Low Gain Arrays:
|
---|
523 | //
|
---|
524 | // - For every entry in the expanded arrays:
|
---|
525 | // * Initialize an MHCalibrationChargePix
|
---|
526 | // * Set Binning from fNbins, fFirst and fLast
|
---|
527 | // * Set Binning of Abs Times histogram from fAbsNbins, fAbsFirst and fAbsLast
|
---|
528 | // * Set Histgram names and titles from fHistName and fHistTitle
|
---|
529 | // * Set Abs Times Histgram names and titles from fAbsHistName and fAbsHistTitle
|
---|
530 | // * Set X-axis and Y-axis titles from fHistXTitle and fHistYTitle
|
---|
531 | // * Set X-axis and Y-axis titles of Abs Times Histogram from fAbsHistXTitle and fAbsHistYTitle
|
---|
532 | // * Call InitHists
|
---|
533 | //
|
---|
534 | void MHCalibrationChargeCam::InitLoGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors)
|
---|
535 | {
|
---|
536 |
|
---|
537 | if (!IsLoGain())
|
---|
538 | return;
|
---|
539 |
|
---|
540 | const Int_t logainsamples = fRunHeader->GetNumSamplesLoGain();
|
---|
541 |
|
---|
542 | TH1F *h;
|
---|
543 |
|
---|
544 | if (fLoGainArray->GetSize()==0 )
|
---|
545 | {
|
---|
546 | for (Int_t i=0; i<npixels; i++)
|
---|
547 | {
|
---|
548 | fLoGainArray->AddAt(new MHCalibrationChargePix(Form("%sLoGainPix%04d",fHistName.Data(),i),
|
---|
549 | Form("%s Low Gain Pixel %04d",fHistTitle.Data(),i)),i);
|
---|
550 |
|
---|
551 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)(*this)(i);
|
---|
552 |
|
---|
553 | pix.SetNbins(fLoGainNbins);
|
---|
554 | pix.SetFirst(fLoGainFirst);
|
---|
555 | pix.SetLast (fLoGainLast);
|
---|
556 |
|
---|
557 | pix.SetProbLimit(fProbLimit);
|
---|
558 |
|
---|
559 | pix.SetAbsTimeNbins(logainsamples);
|
---|
560 | pix.SetAbsTimeFirst(-0.5);
|
---|
561 | pix.SetAbsTimeLast(logainsamples-0.5);
|
---|
562 |
|
---|
563 | InitHists(pix,fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i],i);
|
---|
564 |
|
---|
565 | h = pix.GetHAbsTime();
|
---|
566 |
|
---|
567 | h->SetName (Form("H%sLoGainPix%04d",fAbsHistName.Data(),i));
|
---|
568 | h->SetTitle(Form("%s Low Gain Pixel %04d",fAbsHistTitle.Data(),i));
|
---|
569 | h->SetXTitle(fAbsHistXTitle.Data());
|
---|
570 | h->SetYTitle(fAbsHistYTitle.Data());
|
---|
571 | }
|
---|
572 | }
|
---|
573 |
|
---|
574 | if (fAverageLoGainAreas->GetSize()==0)
|
---|
575 | {
|
---|
576 | for (Int_t j=0; j<nareas; j++)
|
---|
577 | {
|
---|
578 | fAverageLoGainAreas->AddAt(new MHCalibrationChargePix(Form("%sLoGainArea%d",fHistName.Data(),j),
|
---|
579 | Form("%s Low Gain Area Idx %d",fHistTitle.Data(),j)),j);
|
---|
580 |
|
---|
581 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageLoGainArea(j);
|
---|
582 |
|
---|
583 | pix.SetNbins(fLoGainNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
|
---|
584 | pix.SetFirst(fLoGainFirst);
|
---|
585 | pix.SetLast (fLoGainLast);
|
---|
586 |
|
---|
587 | pix.SetAbsTimeNbins(logainsamples);
|
---|
588 | pix.SetAbsTimeFirst(-0.5);
|
---|
589 | pix.SetAbsTimeLast(logainsamples-0.5);
|
---|
590 |
|
---|
591 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
|
---|
592 |
|
---|
593 | h = pix.GetHAbsTime();
|
---|
594 |
|
---|
595 | h->SetName (Form("H%sLoGainArea%02d",fAbsHistName.Data(),j));
|
---|
596 | h->SetTitle(Form("%s%s%02d",fAbsHistTitle.Data(),
|
---|
597 | " averaged on event-by-event basis Low Gain Area Idx ",j));
|
---|
598 | h->SetXTitle(fAbsHistXTitle.Data());
|
---|
599 | h->SetYTitle(fAbsHistYTitle.Data());
|
---|
600 | }
|
---|
601 | }
|
---|
602 |
|
---|
603 |
|
---|
604 | if (fAverageLoGainSectors->GetSize()==0 && IsLoGain())
|
---|
605 | {
|
---|
606 | for (Int_t j=0; j<nsectors; j++)
|
---|
607 | {
|
---|
608 | fAverageLoGainSectors->AddAt(new MHCalibrationChargePix(Form("%sLoGainSector%02d",fHistName.Data(),j),
|
---|
609 | Form("%s Low Gain Sector %02d",fHistTitle.Data(),j)),j);
|
---|
610 |
|
---|
611 | MHCalibrationChargePix &pix = (MHCalibrationChargePix&)GetAverageLoGainSector(j);
|
---|
612 |
|
---|
613 | pix.SetNbins(fLoGainNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
|
---|
614 | pix.SetFirst(fLoGainFirst);
|
---|
615 | pix.SetLast (fLoGainLast);
|
---|
616 |
|
---|
617 | pix.SetAbsTimeNbins(logainsamples);
|
---|
618 | pix.SetAbsTimeFirst(-0.5);
|
---|
619 | pix.SetAbsTimeLast(logainsamples-0.5);
|
---|
620 |
|
---|
621 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
|
---|
622 |
|
---|
623 | h = pix.GetHAbsTime();
|
---|
624 |
|
---|
625 | h->SetName (Form("H%sLoGainSector%02d",fAbsHistName.Data(),j));
|
---|
626 | h->SetTitle(Form("%s%s%02d",fAbsHistTitle.Data(),
|
---|
627 | " averaged on event-by-event basis Low Gain Area Sector ",j));
|
---|
628 | h->SetXTitle(fAbsHistXTitle.Data());
|
---|
629 | h->SetYTitle(fAbsHistYTitle.Data());
|
---|
630 | }
|
---|
631 | }
|
---|
632 | }
|
---|
633 |
|
---|
634 |
|
---|
635 | // --------------------------------------------------------------------------
|
---|
636 | //
|
---|
637 | // Retrieves from MExtractedSignalCam:
|
---|
638 | // - first used LoGain FADC slice
|
---|
639 | //
|
---|
640 | // Retrieves from MGeomCam:
|
---|
641 | // - number of pixels
|
---|
642 | // - number of pixel areas
|
---|
643 | // - number of sectors
|
---|
644 | //
|
---|
645 | // For all TOrdCollection's (including the averaged ones), the following steps are performed:
|
---|
646 | //
|
---|
647 | // 1) Fill Charges histograms (MHGausEvents::FillHistAndArray()) with:
|
---|
648 | // - MExtractedSignalPix::GetExtractedSignalHiGain();
|
---|
649 | // - MExtractedSignalPix::GetExtractedSignalLoGain();
|
---|
650 | //
|
---|
651 | // 2) Set number of saturated slices (MHCalibrationChargePix::AddSaturated()) with:
|
---|
652 | // - MExtractedSignalPix::GetNumHiGainSaturated();
|
---|
653 | // - MExtractedSignalPix::GetNumLoGainSaturated();
|
---|
654 | //
|
---|
655 | // 3) Fill AbsTime histograms (MHCalibrationChargePix::FillAbsTime()) with:
|
---|
656 | // - MRawEvtPixelIter::GetIdxMaxHiGainSample();
|
---|
657 | // - MRawEvtPixelIter::GetIdxMaxLoGainSample(first slice);
|
---|
658 | //
|
---|
659 | Bool_t MHCalibrationChargeCam::FillHists(const MParContainer *par, const Stat_t w)
|
---|
660 | {
|
---|
661 |
|
---|
662 | MExtractedSignalCam *signal = (MExtractedSignalCam*)par;
|
---|
663 | if (!signal)
|
---|
664 | {
|
---|
665 | *fLog << err << "No argument in MExtractedSignalCam::Fill... abort." << endl;
|
---|
666 | return kFALSE;
|
---|
667 | }
|
---|
668 |
|
---|
669 | const UInt_t npixels = fGeom->GetNumPixels();
|
---|
670 | const UInt_t nareas = fGeom->GetNumAreas();
|
---|
671 | const UInt_t nsectors = fGeom->GetNumSectors();
|
---|
672 | const UInt_t lofirst = signal->GetFirstUsedSliceLoGain();
|
---|
673 |
|
---|
674 | fSumhiarea .Reset();
|
---|
675 | fSumloarea .Reset();
|
---|
676 | fTimehiarea .Reset();
|
---|
677 | fTimeloarea .Reset();
|
---|
678 | fSumhisector.Reset();
|
---|
679 | fSumlosector.Reset();
|
---|
680 | fTimehisector.Reset();
|
---|
681 | fTimelosector.Reset();
|
---|
682 |
|
---|
683 | fSathiarea .Reset();
|
---|
684 | fSatloarea .Reset();
|
---|
685 | fSathisector.Reset();
|
---|
686 | fSatlosector.Reset();
|
---|
687 |
|
---|
688 | for (UInt_t i=0; i<npixels; i++)
|
---|
689 | {
|
---|
690 |
|
---|
691 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
|
---|
692 |
|
---|
693 | if (histhi.IsExcluded())
|
---|
694 | continue;
|
---|
695 |
|
---|
696 | const MExtractedSignalPix &pix = (*signal)[i];
|
---|
697 |
|
---|
698 | const Float_t sumhi = pix.GetExtractedSignalHiGain();
|
---|
699 | const Int_t sathi = (Int_t)pix.GetNumHiGainSaturated();
|
---|
700 |
|
---|
701 | if (IsOscillations())
|
---|
702 | histhi.FillHistAndArray(sumhi);
|
---|
703 | else
|
---|
704 | histhi.FillHist(sumhi);
|
---|
705 |
|
---|
706 | histhi.AddSaturated(sathi);
|
---|
707 |
|
---|
708 | const Int_t aidx = (*fGeom)[i].GetAidx();
|
---|
709 | const Int_t sector = (*fGeom)[i].GetSector();
|
---|
710 |
|
---|
711 | fSumhiarea[aidx] += sumhi;
|
---|
712 | fSathiarea[aidx] += sathi;
|
---|
713 |
|
---|
714 | fSumhisector[sector] += sumhi;
|
---|
715 | fSathisector[sector] += sathi;
|
---|
716 |
|
---|
717 | if (IsLoGain())
|
---|
718 | {
|
---|
719 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i);
|
---|
720 | const Float_t sumlo = pix.GetExtractedSignalLoGain();
|
---|
721 | const Int_t satlo = (Int_t)pix.GetNumLoGainSaturated();
|
---|
722 |
|
---|
723 | if (IsOscillations())
|
---|
724 | histlo.FillHistAndArray(sumlo);
|
---|
725 | else
|
---|
726 | histlo.FillHist(sumlo);
|
---|
727 |
|
---|
728 | histlo.AddSaturated(satlo);
|
---|
729 |
|
---|
730 | fSumloarea[aidx] += sumlo;
|
---|
731 | fSatloarea[aidx] += satlo;
|
---|
732 | fSumlosector[sector] += sumlo;
|
---|
733 | fSatlosector[sector] += satlo;
|
---|
734 | }
|
---|
735 |
|
---|
736 | }
|
---|
737 |
|
---|
738 | MRawEvtPixelIter pixel(fRawEvt);
|
---|
739 | while (pixel.Next())
|
---|
740 | {
|
---|
741 |
|
---|
742 | const UInt_t pixid = pixel.GetPixelId();
|
---|
743 |
|
---|
744 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[pixid];
|
---|
745 |
|
---|
746 | if (histhi.IsExcluded())
|
---|
747 | continue;
|
---|
748 |
|
---|
749 | const Float_t timehi = (Float_t)pixel.GetIdxMaxHiGainSample();
|
---|
750 |
|
---|
751 | histhi.FillAbsTime(timehi);
|
---|
752 |
|
---|
753 | const Int_t aidx = (*fGeom)[pixid].GetAidx();
|
---|
754 | const Int_t sector = (*fGeom)[pixid].GetSector();
|
---|
755 |
|
---|
756 | fTimehiarea [aidx] += timehi;
|
---|
757 | fTimehisector[sector] += timehi;
|
---|
758 |
|
---|
759 | if (IsLoGain())
|
---|
760 | {
|
---|
761 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(pixid);
|
---|
762 |
|
---|
763 | const Float_t timelo = (Float_t)pixel.GetIdxMaxLoGainSample(lofirst);
|
---|
764 | histlo.FillAbsTime(timelo);
|
---|
765 |
|
---|
766 | fTimeloarea[aidx] += timelo;
|
---|
767 | fTimelosector[sector] += timelo;
|
---|
768 | }
|
---|
769 | }
|
---|
770 |
|
---|
771 | for (UInt_t j=0; j<nareas; j++)
|
---|
772 | {
|
---|
773 |
|
---|
774 | const Int_t npix = fAverageAreaNum[j];
|
---|
775 |
|
---|
776 | if (npix == 0)
|
---|
777 | continue;
|
---|
778 |
|
---|
779 | MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainArea(j);
|
---|
780 |
|
---|
781 |
|
---|
782 | if (IsOscillations())
|
---|
783 | hipix.FillHistAndArray(fSumhiarea [j]/npix);
|
---|
784 | else
|
---|
785 | hipix.FillHist(fSumhiarea[j]/npix);
|
---|
786 |
|
---|
787 | hipix.AddSaturated ((Float_t)fSathiarea [j]/npix > 0.5 ? 1 : 0);
|
---|
788 | hipix.FillAbsTime (fTimehiarea[j]/npix);
|
---|
789 |
|
---|
790 | if (IsLoGain())
|
---|
791 | {
|
---|
792 | MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(j);
|
---|
793 | if (IsOscillations())
|
---|
794 | lopix.FillHistAndArray(fSumloarea [j]/npix);
|
---|
795 | else
|
---|
796 | lopix.FillHist(fSumloarea [j]/npix);
|
---|
797 | lopix.AddSaturated ((Float_t)fSatloarea [j]/npix > 0.5 ? 1 : 0);
|
---|
798 | lopix.FillAbsTime (fTimeloarea[j]/npix);
|
---|
799 | }
|
---|
800 | }
|
---|
801 |
|
---|
802 | for (UInt_t j=0; j<nsectors; j++)
|
---|
803 | {
|
---|
804 |
|
---|
805 | const Int_t npix = fAverageSectorNum[j];
|
---|
806 |
|
---|
807 | if (npix == 0)
|
---|
808 | continue;
|
---|
809 |
|
---|
810 | MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainSector(j);
|
---|
811 |
|
---|
812 | if (IsOscillations())
|
---|
813 | hipix.FillHistAndArray(fSumhisector [j]/npix);
|
---|
814 | else
|
---|
815 | hipix.FillHist(fSumhisector [j]/npix);
|
---|
816 |
|
---|
817 | hipix.AddSaturated ((Float_t)fSathisector[j]/npix > 0.5 ? 1 : 0);
|
---|
818 | hipix.FillAbsTime (fTimehisector[j]/npix);
|
---|
819 |
|
---|
820 | if (IsLoGain())
|
---|
821 | {
|
---|
822 | MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainSector(j);
|
---|
823 |
|
---|
824 | if (IsOscillations())
|
---|
825 | lopix.FillHistAndArray(fSumlosector [j]/npix);
|
---|
826 | else
|
---|
827 | lopix.FillHist(fSumlosector [j]/npix);
|
---|
828 |
|
---|
829 | lopix.AddSaturated ((Float_t)fSatlosector[j]/npix > 0.5 ? 1 : 0);
|
---|
830 | lopix.FillAbsTime (fTimelosector[j]/npix);
|
---|
831 | }
|
---|
832 | }
|
---|
833 |
|
---|
834 | return kTRUE;
|
---|
835 | }
|
---|
836 |
|
---|
837 | // --------------------------------------------------------------------------
|
---|
838 | //
|
---|
839 | // For all TOrdCollection's (including the averaged ones), the following steps are performed:
|
---|
840 | //
|
---|
841 | // 1) Returns if the pixel is excluded.
|
---|
842 | // 2) Tests saturation. In case yes, set the flag: MCalibrationPix::SetHiGainSaturation()
|
---|
843 | // or the flag: MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturated )
|
---|
844 | // 3) Store the absolute arrival times in the MCalibrationChargePix's. If flag
|
---|
845 | // MCalibrationPix::IsHiGainSaturation() is set, the Low-Gain arrival times are stored,
|
---|
846 | // otherwise the Hi-Gain ones.
|
---|
847 | // 4) Calls to MHCalibrationCam::FitHiGainArrays() and MCalibrationCam::FitLoGainArrays()
|
---|
848 | // with the flags:
|
---|
849 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted )
|
---|
850 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted )
|
---|
851 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating )
|
---|
852 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating )
|
---|
853 | //
|
---|
854 | Bool_t MHCalibrationChargeCam::FinalizeHists()
|
---|
855 | {
|
---|
856 |
|
---|
857 | *fLog << endl;
|
---|
858 |
|
---|
859 | TH1F *h = NULL;
|
---|
860 |
|
---|
861 | MCalibrationCam *chargecam = fIntensCam ? fIntensCam->GetCam() : fCam;
|
---|
862 | MBadPixelsCam *badcam = fIntensBad ? fIntensBad->GetCam() : fBadPixels;
|
---|
863 |
|
---|
864 | for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
|
---|
865 | {
|
---|
866 |
|
---|
867 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
|
---|
868 |
|
---|
869 | if (histhi.IsExcluded())
|
---|
870 | continue;
|
---|
871 |
|
---|
872 | MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i] ;
|
---|
873 |
|
---|
874 | if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
|
---|
875 | {
|
---|
876 | pix.SetHiGainSaturation();
|
---|
877 | if (IsOscillations())
|
---|
878 | histhi.CreateFourierSpectrum();
|
---|
879 | continue;
|
---|
880 | }
|
---|
881 |
|
---|
882 | MBadPixelsPix &bad = (*badcam)[i];
|
---|
883 |
|
---|
884 | h = histhi.GetHGausHist();
|
---|
885 |
|
---|
886 | Stat_t overflow = h->GetBinContent(h->GetNbinsX()+1);
|
---|
887 | if (overflow > fOverflowLimit*histhi.GetHGausHist()->GetEntries())
|
---|
888 | {
|
---|
889 | *fLog << warn
|
---|
890 | << "HiGain Hist-overflow " << overflow
|
---|
891 | << " times in: " << histhi.GetName() << " (w/o saturation!) " << endl;
|
---|
892 | bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
|
---|
893 | }
|
---|
894 |
|
---|
895 | overflow = h->GetBinContent(0);
|
---|
896 | if (overflow > fOverflowLimit*histhi.GetHGausHist()->GetEntries())
|
---|
897 | {
|
---|
898 | *fLog << warn
|
---|
899 | << "HiGain Hist-underflow " << overflow
|
---|
900 | << " times in pix: " << histhi.GetName() << " (w/o saturation!) " << endl;
|
---|
901 | bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow );
|
---|
902 | }
|
---|
903 |
|
---|
904 | FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
|
---|
905 | }
|
---|
906 |
|
---|
907 | if (IsLoGain())
|
---|
908 | for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
|
---|
909 | {
|
---|
910 |
|
---|
911 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i);
|
---|
912 | MBadPixelsPix &bad = (*badcam)[i];
|
---|
913 |
|
---|
914 | if (histlo.IsExcluded())
|
---|
915 | continue;
|
---|
916 |
|
---|
917 | if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
|
---|
918 | {
|
---|
919 | *fLog << warn << "Saturated Lo Gain histogram in pixel: " << i << endl;
|
---|
920 | bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation );
|
---|
921 | if (IsOscillations())
|
---|
922 | histlo.CreateFourierSpectrum();
|
---|
923 | continue;
|
---|
924 | }
|
---|
925 |
|
---|
926 | h = histlo.GetHGausHist();
|
---|
927 |
|
---|
928 | Stat_t overflow = h->GetBinContent(h->GetNbinsX()+1);
|
---|
929 | if (overflow > fOverflowLimit*histlo.GetHGausHist()->GetEntries())
|
---|
930 | {
|
---|
931 | *fLog << warn
|
---|
932 | << "LoGain Hist-overflow " << overflow
|
---|
933 | << " times in: " << histlo.GetName() << " (w/o saturation!) " << endl;
|
---|
934 | bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow );
|
---|
935 | }
|
---|
936 |
|
---|
937 | overflow = h->GetBinContent(0);
|
---|
938 | if (overflow > fOverflowLimit*histlo.GetHGausHist()->GetEntries())
|
---|
939 | {
|
---|
940 | *fLog << warn
|
---|
941 | << "LoGain Hist-underflow " << overflow
|
---|
942 | << " times in: " << histlo.GetName() << " (w/o saturation!) " << endl;
|
---|
943 | bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow );
|
---|
944 | }
|
---|
945 |
|
---|
946 | MCalibrationChargePix &pix = (MCalibrationChargePix&)(*chargecam)[i] ;
|
---|
947 |
|
---|
948 | if (pix.IsHiGainSaturation())
|
---|
949 | FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
|
---|
950 | }
|
---|
951 |
|
---|
952 | for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
|
---|
953 | {
|
---|
954 |
|
---|
955 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainArea(j);
|
---|
956 | MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageArea(j);
|
---|
957 |
|
---|
958 | if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
|
---|
959 | {
|
---|
960 | pix.SetHiGainSaturation();
|
---|
961 | if (IsOscillations())
|
---|
962 | histhi.CreateFourierSpectrum();
|
---|
963 | continue;
|
---|
964 | }
|
---|
965 |
|
---|
966 | MBadPixelsPix &bad = chargecam->GetAverageBadArea(j);
|
---|
967 | FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
|
---|
968 | }
|
---|
969 |
|
---|
970 | if (IsLoGain())
|
---|
971 | for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
|
---|
972 | {
|
---|
973 |
|
---|
974 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainArea(j);
|
---|
975 |
|
---|
976 | if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
|
---|
977 | {
|
---|
978 | *fLog << warn << "Saturated Lo Gain histogram in area idx: " << j << endl;
|
---|
979 | histlo.CreateFourierSpectrum();
|
---|
980 | continue;
|
---|
981 | }
|
---|
982 |
|
---|
983 | MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageArea(j);
|
---|
984 |
|
---|
985 | if (pix.IsHiGainSaturation())
|
---|
986 | {
|
---|
987 | MBadPixelsPix &bad = chargecam->GetAverageBadArea(j);
|
---|
988 | FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
|
---|
989 | }
|
---|
990 |
|
---|
991 | }
|
---|
992 |
|
---|
993 | for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
|
---|
994 | {
|
---|
995 |
|
---|
996 | MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainSector(j);
|
---|
997 | MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageSector(j);
|
---|
998 |
|
---|
999 | if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries())
|
---|
1000 | {
|
---|
1001 | pix.SetHiGainSaturation();
|
---|
1002 | if (IsOscillations())
|
---|
1003 | histhi.CreateFourierSpectrum();
|
---|
1004 | continue;
|
---|
1005 | }
|
---|
1006 |
|
---|
1007 | MBadPixelsPix &bad = chargecam->GetAverageBadSector(j);
|
---|
1008 | FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain);
|
---|
1009 | }
|
---|
1010 |
|
---|
1011 | if (IsLoGain())
|
---|
1012 | for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
|
---|
1013 | {
|
---|
1014 |
|
---|
1015 | MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainSector(j);
|
---|
1016 | MBadPixelsPix &bad = chargecam->GetAverageBadSector(j);
|
---|
1017 |
|
---|
1018 | if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries())
|
---|
1019 | {
|
---|
1020 | *fLog << warn << "Saturated Lo Gain histogram in sector: " << j << endl;
|
---|
1021 | bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation );
|
---|
1022 | if (IsOscillations())
|
---|
1023 | histlo.CreateFourierSpectrum();
|
---|
1024 | continue;
|
---|
1025 | }
|
---|
1026 |
|
---|
1027 | MCalibrationChargePix &pix = (MCalibrationChargePix&)chargecam->GetAverageSector(j);
|
---|
1028 |
|
---|
1029 | if (pix.IsHiGainSaturation())
|
---|
1030 | FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain);
|
---|
1031 | }
|
---|
1032 |
|
---|
1033 | //
|
---|
1034 | // Perform the fitting for the High Gain (done in MHCalibrationCam)
|
---|
1035 | //
|
---|
1036 | FitHiGainArrays(*chargecam, *badcam,
|
---|
1037 | MBadPixelsPix::kHiGainNotFitted,
|
---|
1038 | MBadPixelsPix::kHiGainOscillating);
|
---|
1039 |
|
---|
1040 | //
|
---|
1041 | // Perform the fitting for the Low Gain (done in MHCalibrationCam)
|
---|
1042 | //
|
---|
1043 | if (IsLoGain())
|
---|
1044 | FitLoGainArrays(*chargecam, *badcam,
|
---|
1045 | MBadPixelsPix::kLoGainNotFitted,
|
---|
1046 | MBadPixelsPix::kLoGainOscillating);
|
---|
1047 |
|
---|
1048 |
|
---|
1049 | return kTRUE;
|
---|
1050 | }
|
---|
1051 |
|
---|
1052 | // --------------------------------------------------------------------------------
|
---|
1053 | //
|
---|
1054 | // Fill the absolute time results into MCalibrationChargePix
|
---|
1055 | //
|
---|
1056 | // Check absolute time validity:
|
---|
1057 | // - Mean arrival time is at least fTimeLowerLimit slices from the lower edge
|
---|
1058 | // - Mean arrival time is at least fUpperLimit slices from the upper edge
|
---|
1059 | //
|
---|
1060 | void MHCalibrationChargeCam::FinalizeAbsTimes(MHCalibrationChargePix &hist, MCalibrationChargePix &pix, MBadPixelsPix &bad,
|
---|
1061 | Byte_t first, Byte_t last)
|
---|
1062 | {
|
---|
1063 |
|
---|
1064 | const Float_t mean = hist.GetAbsTimeMean();
|
---|
1065 | const Float_t rms = hist.GetAbsTimeRms();
|
---|
1066 |
|
---|
1067 | pix.SetAbsTimeMean ( mean );
|
---|
1068 | pix.SetAbsTimeRms ( rms );
|
---|
1069 |
|
---|
1070 | const Float_t lowerlimit = (Float_t)first + fTimeLowerLimit;
|
---|
1071 | const Float_t upperlimit = (Float_t)last - fTimeUpperLimit;
|
---|
1072 |
|
---|
1073 | if ( mean < lowerlimit)
|
---|
1074 | {
|
---|
1075 | *fLog << warn
|
---|
1076 | << Form("Mean ArrivalTime: %3.1f < %2.1f slices from lower edge: %2i in pixel %s",
|
---|
1077 | mean,fTimeLowerLimit,(Int_t)first,hist.GetName()) << endl;
|
---|
1078 | bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin );
|
---|
1079 | }
|
---|
1080 |
|
---|
1081 | if ( mean > upperlimit )
|
---|
1082 | {
|
---|
1083 | *fLog << warn
|
---|
1084 | << Form("Mean ArrivalTime: %3.1f > %2.1f slices from upper edge: %2i in pixel %s",
|
---|
1085 | mean,fTimeUpperLimit,(Int_t)last,hist.GetName()) << endl;
|
---|
1086 | bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins );
|
---|
1087 | }
|
---|
1088 | }
|
---|
1089 |
|
---|
1090 | // --------------------------------------------------------------------------
|
---|
1091 | //
|
---|
1092 | // Sets all pixels to MBadPixelsPix::kUnsuitableRun, if following flags are set:
|
---|
1093 | // - MBadPixelsPix::kLoGainSaturation
|
---|
1094 | //
|
---|
1095 | // Sets all pixels to MBadPixelsPix::kUnreliableRun, if following flags are set:
|
---|
1096 | // - if MBadPixelsPix::kHiGainNotFitted and !MCalibrationPix::IsHiGainSaturation()
|
---|
1097 | // - if MBadPixelsPix::kHiGainOscillating and !MCalibrationPix::IsHiGainSaturation()
|
---|
1098 | // - if MBadPixelsPix::kLoGainNotFitted and MCalibrationPix::IsLoGainSaturation()
|
---|
1099 | // - if MBadPixelsPix::kLoGainOscillating and MCalibrationPix::IsLoGainSaturation()
|
---|
1100 | //
|
---|
1101 | void MHCalibrationChargeCam::FinalizeBadPixels()
|
---|
1102 | {
|
---|
1103 |
|
---|
1104 | MBadPixelsCam *badcam = fIntensBad ? fIntensBad->GetCam() : fBadPixels;
|
---|
1105 | MCalibrationCam *chargecam = fIntensCam ? fIntensCam->GetCam() : fCam;
|
---|
1106 |
|
---|
1107 | for (Int_t i=0; i<badcam->GetSize(); i++)
|
---|
1108 | {
|
---|
1109 |
|
---|
1110 | MBadPixelsPix &bad = (*badcam)[i];
|
---|
1111 | MCalibrationPix &pix = (*chargecam)[i];
|
---|
1112 |
|
---|
1113 | if (bad.IsUncalibrated( MBadPixelsPix::kHiGainNotFitted ))
|
---|
1114 | if (!pix.IsHiGainSaturation())
|
---|
1115 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
---|
1116 |
|
---|
1117 | if (bad.IsUncalibrated( MBadPixelsPix::kLoGainNotFitted ))
|
---|
1118 | if (pix.IsHiGainSaturation())
|
---|
1119 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
---|
1120 |
|
---|
1121 | if (bad.IsUncalibrated( MBadPixelsPix::kLoGainSaturation ))
|
---|
1122 | bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );
|
---|
1123 |
|
---|
1124 | if (IsOscillations())
|
---|
1125 | {
|
---|
1126 | if (bad.IsUncalibrated( MBadPixelsPix::kHiGainOscillating ))
|
---|
1127 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
---|
1128 |
|
---|
1129 | if (bad.IsUncalibrated( MBadPixelsPix::kLoGainOscillating ))
|
---|
1130 | if (pix.IsHiGainSaturation())
|
---|
1131 | bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
|
---|
1132 | }
|
---|
1133 | }
|
---|
1134 |
|
---|
1135 |
|
---|
1136 |
|
---|
1137 | }
|
---|
1138 |
|
---|
1139 | // --------------------------------------------------------------------------
|
---|
1140 | //
|
---|
1141 | // Calls MHCalibrationPix::DrawClone() for pixel idx
|
---|
1142 | //
|
---|
1143 | void MHCalibrationChargeCam::DrawPixelContent(Int_t idx) const
|
---|
1144 | {
|
---|
1145 | (*this)[idx].DrawClone();
|
---|
1146 | }
|
---|
1147 |
|
---|
1148 |
|
---|
1149 | // -----------------------------------------------------------------------------
|
---|
1150 | //
|
---|
1151 | // Default draw:
|
---|
1152 | //
|
---|
1153 | // Displays the averaged areas, both High Gain and Low Gain
|
---|
1154 | //
|
---|
1155 | // Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
|
---|
1156 | //
|
---|
1157 | void MHCalibrationChargeCam::Draw(const Option_t *opt)
|
---|
1158 | {
|
---|
1159 |
|
---|
1160 | const Int_t nareas = fAverageHiGainAreas->GetSize();
|
---|
1161 | if (nareas == 0)
|
---|
1162 | return;
|
---|
1163 |
|
---|
1164 | TString option(opt);
|
---|
1165 | option.ToLower();
|
---|
1166 |
|
---|
1167 | if (!option.Contains("datacheck"))
|
---|
1168 | {
|
---|
1169 | MHCalibrationCam::Draw(opt);
|
---|
1170 | return;
|
---|
1171 | }
|
---|
1172 |
|
---|
1173 | //
|
---|
1174 | // From here on , the datacheck - Draw
|
---|
1175 | //
|
---|
1176 | TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
|
---|
1177 | pad->SetBorderMode(0);
|
---|
1178 | pad->Divide(1,nareas);
|
---|
1179 |
|
---|
1180 | //
|
---|
1181 | // Loop over inner and outer pixels
|
---|
1182 | //
|
---|
1183 | for (Int_t i=0; i<nareas;i++)
|
---|
1184 | {
|
---|
1185 |
|
---|
1186 | pad->cd(i+1);
|
---|
1187 |
|
---|
1188 | MHCalibrationChargePix &hipix = (MHCalibrationChargePix&)GetAverageHiGainArea(i);
|
---|
1189 | //
|
---|
1190 | // Ask for Hi-Gain saturation
|
---|
1191 | //
|
---|
1192 | if (hipix.GetSaturated() > fNumHiGainSaturationLimit*hipix.GetHGausHist()->GetEntries() && IsLoGain())
|
---|
1193 | {
|
---|
1194 | MHCalibrationChargePix &lopix = (MHCalibrationChargePix&)GetAverageLoGainArea(i);
|
---|
1195 | DrawDataCheckPixel(lopix,i ? gkLoGainOuterRefLines : gkLoGainInnerRefLines);
|
---|
1196 | }
|
---|
1197 | else
|
---|
1198 | DrawDataCheckPixel(hipix,i ? gkHiGainOuterRefLines : gkHiGainInnerRefLines);
|
---|
1199 |
|
---|
1200 | }
|
---|
1201 | }
|
---|
1202 |
|
---|
1203 | // -----------------------------------------------------------------------------
|
---|
1204 | //
|
---|
1205 | // Draw the average pixel for the datacheck:
|
---|
1206 | //
|
---|
1207 | // Displays the averaged areas, both High Gain and Low Gain
|
---|
1208 | //
|
---|
1209 | // Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
|
---|
1210 | //
|
---|
1211 | void MHCalibrationChargeCam::DrawDataCheckPixel(MHCalibrationChargePix &pix, const Float_t refline[])
|
---|
1212 | {
|
---|
1213 |
|
---|
1214 | TVirtualPad *newpad = gPad;
|
---|
1215 | newpad->Divide(1,2);
|
---|
1216 | newpad->cd(1);
|
---|
1217 |
|
---|
1218 | gPad->SetTicks();
|
---|
1219 | if (!pix.IsEmpty() && !pix.IsOnlyOverflow() && !pix.IsOnlyUnderflow())
|
---|
1220 | gPad->SetLogy();
|
---|
1221 |
|
---|
1222 | TH1F *hist = pix.GetHGausHist();
|
---|
1223 |
|
---|
1224 | TH1F *null = new TH1F("Null",hist->GetTitle(),100,
|
---|
1225 | pix.GetFirst() > 0. ? pix.GetFirst() : 0.,
|
---|
1226 | pix.GetLast() > pix.GetFirst()
|
---|
1227 | ? ( pix.GetLast() > 450.
|
---|
1228 | ? ( fColor == MCalibrationCam::kBLUE ? 800. : 450. )
|
---|
1229 | : pix.GetLast() )
|
---|
1230 | : pix.GetFirst()*2.);
|
---|
1231 |
|
---|
1232 | null->SetMaximum(1.1*hist->GetMaximum());
|
---|
1233 | null->SetDirectory(NULL);
|
---|
1234 | null->SetBit(kCanDelete);
|
---|
1235 | null->SetStats(kFALSE);
|
---|
1236 | //
|
---|
1237 | // set the labels bigger
|
---|
1238 | //
|
---|
1239 | TAxis *xaxe = null->GetXaxis();
|
---|
1240 | TAxis *yaxe = null->GetYaxis();
|
---|
1241 | xaxe->CenterTitle();
|
---|
1242 | yaxe->CenterTitle();
|
---|
1243 | xaxe->SetTitleSize(0.07);
|
---|
1244 | yaxe->SetTitleSize(0.07);
|
---|
1245 | xaxe->SetTitleOffset(0.7);
|
---|
1246 | yaxe->SetTitleOffset(0.55);
|
---|
1247 | xaxe->SetLabelSize(0.06);
|
---|
1248 | yaxe->SetLabelSize(0.06);
|
---|
1249 | xaxe->SetTitle(hist->GetXaxis()->GetTitle());
|
---|
1250 | yaxe->SetTitle(hist->GetYaxis()->GetTitle());
|
---|
1251 |
|
---|
1252 | null->Draw();
|
---|
1253 | hist->Draw("same");
|
---|
1254 |
|
---|
1255 | gStyle->SetOptFit();
|
---|
1256 |
|
---|
1257 | TF1 *fit = pix.GetFGausFit();
|
---|
1258 |
|
---|
1259 | if (fit)
|
---|
1260 | {
|
---|
1261 | switch ( fColor )
|
---|
1262 | {
|
---|
1263 | case MCalibrationCam::kGREEN:
|
---|
1264 | fit->SetLineColor(kGreen);
|
---|
1265 | break;
|
---|
1266 | case MCalibrationCam::kBLUE:
|
---|
1267 | fit->SetLineColor(kBlue);
|
---|
1268 | break;
|
---|
1269 | case MCalibrationCam::kUV:
|
---|
1270 | fit->SetLineColor(106);
|
---|
1271 | break;
|
---|
1272 | case MCalibrationCam::kCT1:
|
---|
1273 | fit->SetLineColor(006);
|
---|
1274 | break;
|
---|
1275 | default:
|
---|
1276 | fit->SetLineColor(kRed);
|
---|
1277 | }
|
---|
1278 | fit->Draw("same");
|
---|
1279 | }
|
---|
1280 |
|
---|
1281 | DisplayRefLines(null,refline);
|
---|
1282 |
|
---|
1283 | newpad->cd(2);
|
---|
1284 | gPad->SetTicks();
|
---|
1285 |
|
---|
1286 | TH1F *null2 = new TH1F("Null2",hist->GetTitle(),100,0.,pix.GetEvents()->GetSize()/pix.GetEventFrequency());
|
---|
1287 |
|
---|
1288 | null2->SetMinimum(pix.GetMean()-10.*pix.GetSigma());
|
---|
1289 | null2->SetMaximum(pix.GetMean()+10.*pix.GetSigma());
|
---|
1290 | null2->SetDirectory(NULL);
|
---|
1291 | null2->SetBit(kCanDelete);
|
---|
1292 | null2->SetStats(kFALSE);
|
---|
1293 | //
|
---|
1294 | // set the labels bigger
|
---|
1295 | //
|
---|
1296 | TAxis *xaxe2 = null2->GetXaxis();
|
---|
1297 | TAxis *yaxe2 = null2->GetYaxis();
|
---|
1298 | xaxe2->CenterTitle();
|
---|
1299 | yaxe2->CenterTitle();
|
---|
1300 | xaxe2->SetTitleSize(0.07);
|
---|
1301 | yaxe2->SetTitleSize(0.07);
|
---|
1302 | xaxe2->SetTitleOffset(0.7);
|
---|
1303 | yaxe2->SetTitleOffset(0.55);
|
---|
1304 | xaxe2->SetLabelSize(0.06);
|
---|
1305 | yaxe2->SetLabelSize(0.06);
|
---|
1306 |
|
---|
1307 | pix.CreateGraphEvents();
|
---|
1308 | TGraph *gr = pix.GetGraphEvents();
|
---|
1309 |
|
---|
1310 | xaxe2->SetTitle(gr->GetXaxis()->GetTitle());
|
---|
1311 | yaxe2->SetTitle(gr->GetYaxis()->GetTitle());
|
---|
1312 |
|
---|
1313 | null2->Draw();
|
---|
1314 |
|
---|
1315 | pix.DrawEvents("same");
|
---|
1316 |
|
---|
1317 | // newpad->cd(3);
|
---|
1318 | // pix.DrawPowerSpectrum(*newpad,4);
|
---|
1319 |
|
---|
1320 | return;
|
---|
1321 |
|
---|
1322 | }
|
---|
1323 |
|
---|
1324 |
|
---|
1325 | void MHCalibrationChargeCam::DisplayRefLines(const TH1F *hist, const Float_t refline[]) const
|
---|
1326 | {
|
---|
1327 |
|
---|
1328 | TGraph *green1 = new TGraph(2);
|
---|
1329 | green1->SetPoint(0,refline[0],0.1);
|
---|
1330 | green1->SetPoint(1,refline[0],hist->GetMaximum());
|
---|
1331 | green1->SetBit(kCanDelete);
|
---|
1332 | green1->SetLineColor(kGreen);
|
---|
1333 | green1->SetLineStyle(2);
|
---|
1334 | green1->SetLineWidth(3);
|
---|
1335 | green1->Draw("L");
|
---|
1336 |
|
---|
1337 | TGraph *green5 = new TGraph(2);
|
---|
1338 | green5->SetPoint(0,refline[6],0.1);
|
---|
1339 | green5->SetPoint(1,refline[6],hist->GetMaximum());
|
---|
1340 | green5->SetBit(kCanDelete);
|
---|
1341 | green5->SetLineColor(8);
|
---|
1342 | green5->SetLineStyle(2);
|
---|
1343 | green5->SetLineWidth(3);
|
---|
1344 | green5->Draw("L");
|
---|
1345 |
|
---|
1346 | TGraph *blue1 = new TGraph(2);
|
---|
1347 | blue1->SetPoint(0,refline[1],0.1);
|
---|
1348 | blue1->SetPoint(1,refline[1],hist->GetMaximum());
|
---|
1349 | blue1->SetBit(kCanDelete);
|
---|
1350 | blue1->SetLineColor(227);
|
---|
1351 | blue1->SetLineStyle(2);
|
---|
1352 | blue1->SetLineWidth(3);
|
---|
1353 | blue1->Draw("L");
|
---|
1354 |
|
---|
1355 | TGraph *blue5 = new TGraph(2);
|
---|
1356 | blue5->SetPoint(0,refline[2],0.1);
|
---|
1357 | blue5->SetPoint(1,refline[2],hist->GetMaximum());
|
---|
1358 | blue5->SetBit(kCanDelete);
|
---|
1359 | blue5->SetLineColor(68);
|
---|
1360 | blue5->SetLineStyle(2);
|
---|
1361 | blue5->SetLineWidth(3);
|
---|
1362 | blue5->Draw("L");
|
---|
1363 |
|
---|
1364 | TGraph *blue10 = new TGraph(2);
|
---|
1365 | blue10->SetPoint(0,refline[3],0.1);
|
---|
1366 | blue10->SetPoint(1,refline[3],hist->GetMaximum());
|
---|
1367 | blue10->SetBit(kCanDelete);
|
---|
1368 | blue10->SetLineColor(4);
|
---|
1369 | blue10->SetLineStyle(2);
|
---|
1370 | blue10->SetLineWidth(3);
|
---|
1371 | blue10->Draw("L");
|
---|
1372 |
|
---|
1373 | TGraph *uv10 = new TGraph(2);
|
---|
1374 | uv10->SetPoint(0,refline[4],0.1);
|
---|
1375 | uv10->SetPoint(1,refline[4],hist->GetMaximum());
|
---|
1376 | uv10->SetBit(kCanDelete);
|
---|
1377 | uv10->SetLineColor(106);
|
---|
1378 | uv10->SetLineStyle(2);
|
---|
1379 | uv10->SetLineWidth(3);
|
---|
1380 | uv10->Draw("L");
|
---|
1381 |
|
---|
1382 | TGraph *ct1 = new TGraph(2);
|
---|
1383 | ct1->SetPoint(0,refline[5],0.1);
|
---|
1384 | ct1->SetPoint(1,refline[5],hist->GetMaximum());
|
---|
1385 | ct1->SetBit(kCanDelete);
|
---|
1386 | ct1->SetLineColor(6);
|
---|
1387 | ct1->SetLineStyle(2);
|
---|
1388 | ct1->SetLineWidth(3);
|
---|
1389 | ct1->Draw("L");
|
---|
1390 |
|
---|
1391 | TLegend *leg = new TLegend(0.8,0.35,0.99,0.99);
|
---|
1392 | leg->SetBit(kCanDelete);
|
---|
1393 | leg->AddEntry(green1,"1 Led GREEN","l");
|
---|
1394 | leg->AddEntry(green5,"5 Leds GREEN","l");
|
---|
1395 | leg->AddEntry(blue1,"1 Led BLUE","l");
|
---|
1396 | leg->AddEntry(blue5,"5 Leds BLUE","l");
|
---|
1397 | leg->AddEntry(blue10,"10 Leds BLUE","l");
|
---|
1398 | leg->AddEntry(uv10,"10 Leds UV","l");
|
---|
1399 | leg->AddEntry(ct1,"CT1-Pulser","l");
|
---|
1400 |
|
---|
1401 | leg->Draw();
|
---|
1402 | }
|
---|
1403 |
|
---|
1404 | Int_t MHCalibrationChargeCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
|
---|
1405 | {
|
---|
1406 |
|
---|
1407 | Bool_t rc = kFALSE;
|
---|
1408 |
|
---|
1409 | if (MHCalibrationCam::ReadEnv(env,prefix,print))
|
---|
1410 | rc = kTRUE;
|
---|
1411 |
|
---|
1412 | if (IsEnvDefined(env, prefix, "LoGainNbins", print))
|
---|
1413 | {
|
---|
1414 | SetLoGainNbins(GetEnvValue(env, prefix, "LoGainNbins", fLoGainNbins));
|
---|
1415 | rc = kTRUE;
|
---|
1416 | }
|
---|
1417 |
|
---|
1418 | if (IsEnvDefined(env, prefix, "LoGainFirst", print))
|
---|
1419 | {
|
---|
1420 | SetLoGainFirst(GetEnvValue(env, prefix, "LoGainFirst", fLoGainFirst));
|
---|
1421 | rc = kTRUE;
|
---|
1422 | }
|
---|
1423 |
|
---|
1424 | if (IsEnvDefined(env, prefix, "LoGainLast", print))
|
---|
1425 | {
|
---|
1426 | SetLoGainLast(GetEnvValue(env, prefix, "LoGainLast", fLoGainLast));
|
---|
1427 | rc = kTRUE;
|
---|
1428 | }
|
---|
1429 |
|
---|
1430 | if (IsEnvDefined(env, prefix, "TimeLowerLimit", print))
|
---|
1431 | {
|
---|
1432 | SetTimeLowerLimit(GetEnvValue(env, prefix, "TimeLowerLimit", fTimeLowerLimit));
|
---|
1433 | rc = kTRUE;
|
---|
1434 | }
|
---|
1435 |
|
---|
1436 | if (IsEnvDefined(env, prefix, "TimeUpperLimit", print))
|
---|
1437 | {
|
---|
1438 | SetTimeUpperLimit(GetEnvValue(env, prefix, "TimeUpperLimit", fTimeUpperLimit));
|
---|
1439 | rc = kTRUE;
|
---|
1440 | }
|
---|
1441 |
|
---|
1442 |
|
---|
1443 | return rc;
|
---|
1444 | }
|
---|