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