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 | // MHCalibrationCam
|
---|
27 | //
|
---|
28 | // Base class for camera calibration classes. Incorporates the TOrdCollection's:
|
---|
29 | // - fHiGainArray (for calibrated High Gains per pixel)
|
---|
30 | // - fLoGainArray (for calibrated Low Gains per pixel)
|
---|
31 | // - fAverageHiGainAreas (for averaged High Gains events per camera area index)
|
---|
32 | // - fAverageLoGainAreas (for averaged High Gains events per camera area index)
|
---|
33 | // - fAverageHiGainSectors (for averaged High Gains events per camera sector )
|
---|
34 | // - fAverageLoGainSectors (for averaged High Gains events per camera sector )
|
---|
35 | // These TOrdCollection's are called by their default constructors, thus no objects
|
---|
36 | // are created, until the derived class does so.
|
---|
37 | //
|
---|
38 | // The corresponding operators: [],() and the operators GetAverageHiGainArea(),
|
---|
39 | // GetAverageLoGainArea(), GetAverageHiGainSector() and GetAverageLoGainSector()
|
---|
40 | // have to be cast to the corresponding class. It is assumed that all classes
|
---|
41 | // dealing with calibration pixels derive from MHCalibrationPix.
|
---|
42 | //
|
---|
43 | // The following flag can be set:
|
---|
44 | // - SetAverageing() for calculating the event-by-event averages.
|
---|
45 | // - SetDebug() for debug output.
|
---|
46 | // - SetLoGain() for the case that low-gain slices are available, but
|
---|
47 | // MRawRunHeader::GetNumLoGainSlices() gives still 0.
|
---|
48 | // - SetCheckSize() for testing the sizes of the f*Arrays in ReInit() if they
|
---|
49 | // are coinciding with the equiv. sizes in MGeomCam
|
---|
50 | //
|
---|
51 | // The flag kLoGain steers if the low-gain signal is treated at all or not.
|
---|
52 | // The flag kAverageing steers if the event-by-event averages are treated at all.
|
---|
53 | //
|
---|
54 | /////////////////////////////////////////////////////////////////////////////
|
---|
55 | #include "MHCalibrationCam.h"
|
---|
56 | #include "MHCalibrationPix.h"
|
---|
57 |
|
---|
58 | #include <TVirtualPad.h>
|
---|
59 | #include <TCanvas.h>
|
---|
60 | #include <TPad.h>
|
---|
61 | #include <TText.h>
|
---|
62 | #include <TPaveText.h>
|
---|
63 | #include <TOrdCollection.h>
|
---|
64 | #include <TROOT.h>
|
---|
65 |
|
---|
66 | #include "MLog.h"
|
---|
67 | #include "MLogManip.h"
|
---|
68 |
|
---|
69 | #include "MCalibrationIntensityCam.h"
|
---|
70 | #include "MCalibrationCam.h"
|
---|
71 | #include "MCalibrationPix.h"
|
---|
72 |
|
---|
73 | #include "MBadPixelsIntensityCam.h"
|
---|
74 | #include "MBadPixelsCam.h"
|
---|
75 | #include "MBadPixelsPix.h"
|
---|
76 |
|
---|
77 | #include "MGeomCam.h"
|
---|
78 | #include "MGeomPix.h"
|
---|
79 |
|
---|
80 | #include "MParList.h"
|
---|
81 |
|
---|
82 | #include "MRawRunHeader.h"
|
---|
83 |
|
---|
84 | ClassImp(MHCalibrationCam);
|
---|
85 |
|
---|
86 | using namespace std;
|
---|
87 |
|
---|
88 | const Int_t MHCalibrationCam::fgPulserFrequency = 500;
|
---|
89 | const Float_t MHCalibrationCam::fgProbLimit = 0.0001;
|
---|
90 | const Float_t MHCalibrationCam::fgOverflowLimit = 0.005;
|
---|
91 | const TString MHCalibrationCam::gsHistName = "Hist";
|
---|
92 | const TString MHCalibrationCam::gsHistTitle = "";
|
---|
93 | const TString MHCalibrationCam::gsHistXTitle = "";
|
---|
94 | const TString MHCalibrationCam::gsHistYTitle = "Nr. events";
|
---|
95 | // --------------------------------------------------------------------------
|
---|
96 | //
|
---|
97 | // Default Constructor.
|
---|
98 | //
|
---|
99 | // Sets:
|
---|
100 | // - all pointers to NULL
|
---|
101 | //
|
---|
102 | // Initializes and sets owner of:
|
---|
103 | // - fHiGainArray, fLoGainArray
|
---|
104 | // - fAverageHiGainAreas, fAverageLoGainAreas
|
---|
105 | // - fAverageHiGainSectors, fAverageLoGainSectors
|
---|
106 | //
|
---|
107 | // Initializes:
|
---|
108 | // - fPulserFrequency to fgPulserFrequency
|
---|
109 | // - fProbLimit to fgProbLimit
|
---|
110 | // - fOverflowLimit to fgOverflowLimit
|
---|
111 | //
|
---|
112 | // - SetAveregeing (kTRUE);
|
---|
113 | // - SetDebug (kFALSE);
|
---|
114 | // - SetLoGain (kTRUE);
|
---|
115 | //- SetOscillations(kTRUE);
|
---|
116 | //- SetSizeCheck (kTRUE);
|
---|
117 | //- SetInterlaced (kFALSE);
|
---|
118 | //
|
---|
119 | MHCalibrationCam::MHCalibrationCam(const char *name, const char *title)
|
---|
120 | : fHistName(gsHistName),fHistTitle(gsHistTitle),
|
---|
121 | fHistXTitle(gsHistXTitle),fHistYTitle(gsHistYTitle),
|
---|
122 | fColor(MCalibrationCam::kNONE), fIntensBad(NULL),
|
---|
123 | fBadPixels(NULL), fIntensCam(NULL), fCam(NULL), fGeom(NULL),
|
---|
124 | fRunHeader(NULL)
|
---|
125 | {
|
---|
126 |
|
---|
127 | fHiGainArray = new TOrdCollection;
|
---|
128 | fHiGainArray->SetOwner();
|
---|
129 |
|
---|
130 | fLoGainArray = new TOrdCollection;
|
---|
131 | fLoGainArray->SetOwner();
|
---|
132 |
|
---|
133 | fAverageHiGainAreas = new TOrdCollection;
|
---|
134 | fAverageHiGainAreas->SetOwner();
|
---|
135 |
|
---|
136 | fAverageLoGainAreas = new TOrdCollection;
|
---|
137 | fAverageLoGainAreas->SetOwner();
|
---|
138 |
|
---|
139 | fAverageHiGainSectors = new TOrdCollection;
|
---|
140 | fAverageHiGainSectors->SetOwner();
|
---|
141 |
|
---|
142 | fAverageLoGainSectors = new TOrdCollection;
|
---|
143 | fAverageLoGainSectors->SetOwner();
|
---|
144 |
|
---|
145 | SetPulserFrequency();
|
---|
146 | SetProbLimit();
|
---|
147 | SetOverflowLimit();
|
---|
148 |
|
---|
149 | SetAverageing (kTRUE);
|
---|
150 | SetDebug (kFALSE);
|
---|
151 | SetLoGain (kTRUE);
|
---|
152 | SetOscillations(kTRUE);
|
---|
153 | SetSizeCheck (kTRUE);
|
---|
154 | }
|
---|
155 |
|
---|
156 | // --------------------------------------------------------------------------
|
---|
157 | //
|
---|
158 | // Deletes the TOrdCollection of:
|
---|
159 | // - fHiGainArray, fLoGainArray
|
---|
160 | // - fAverageHiGainAreas, fAverageLoGainAreas
|
---|
161 | // - fAverageHiGainSectors, fAverageLoGainSectors
|
---|
162 | //
|
---|
163 | MHCalibrationCam::~MHCalibrationCam()
|
---|
164 | {
|
---|
165 |
|
---|
166 | delete fHiGainArray;
|
---|
167 | delete fLoGainArray;
|
---|
168 |
|
---|
169 | delete fAverageHiGainAreas;
|
---|
170 | delete fAverageLoGainAreas;
|
---|
171 |
|
---|
172 | delete fAverageHiGainSectors;
|
---|
173 | delete fAverageLoGainSectors;
|
---|
174 | /*
|
---|
175 |
|
---|
176 | Remove ( fHiGainArray );
|
---|
177 | Remove ( fLoGainArray );
|
---|
178 |
|
---|
179 | Remove ( fAverageHiGainAreas );
|
---|
180 | Remove ( fAverageLoGainAreas );
|
---|
181 |
|
---|
182 | Remove ( fAverageHiGainSectors );
|
---|
183 | Remove ( fAverageLoGainSectors );
|
---|
184 | */
|
---|
185 |
|
---|
186 | }
|
---|
187 |
|
---|
188 | void MHCalibrationCam::Remove(TOrdCollection *col)
|
---|
189 | {
|
---|
190 |
|
---|
191 | if (!col)
|
---|
192 | return;
|
---|
193 |
|
---|
194 | TOrdCollectionIter Next(col);
|
---|
195 |
|
---|
196 | Int_t count = 0;
|
---|
197 |
|
---|
198 | while (MHCalibrationPix *obj = (MHCalibrationPix*)Next())
|
---|
199 | {
|
---|
200 | *fLog << ++count << " " << obj << flush;
|
---|
201 | if (obj && obj->IsOnHeap())
|
---|
202 | {
|
---|
203 | obj->Draw();
|
---|
204 | delete obj;
|
---|
205 | }
|
---|
206 | }
|
---|
207 |
|
---|
208 | delete col;
|
---|
209 | }
|
---|
210 |
|
---|
211 | // --------------------------------------------------------------------------
|
---|
212 | //
|
---|
213 | // Returns size of fHiGainArray
|
---|
214 | //
|
---|
215 | const Int_t MHCalibrationCam::GetSize() const
|
---|
216 | {
|
---|
217 | return fHiGainArray->GetSize();
|
---|
218 | }
|
---|
219 |
|
---|
220 | // --------------------------------------------------------------------------
|
---|
221 | //
|
---|
222 | // Get i-th High Gain pixel (pixel number)
|
---|
223 | //
|
---|
224 | MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i)
|
---|
225 | {
|
---|
226 | return *static_cast<MHCalibrationPix*>(fHiGainArray->At(i));
|
---|
227 | }
|
---|
228 |
|
---|
229 | // --------------------------------------------------------------------------
|
---|
230 | //
|
---|
231 | // Get i-th High Gain pixel (pixel number)
|
---|
232 | //
|
---|
233 | const MHCalibrationPix &MHCalibrationCam::operator[](UInt_t i) const
|
---|
234 | {
|
---|
235 | return *static_cast<MHCalibrationPix*>(fHiGainArray->At(i));
|
---|
236 | }
|
---|
237 |
|
---|
238 | // --------------------------------------------------------------------------
|
---|
239 | //
|
---|
240 | // Get i-th Low Gain pixel (pixel number)
|
---|
241 | //
|
---|
242 | MHCalibrationPix &MHCalibrationCam::operator()(UInt_t i)
|
---|
243 | {
|
---|
244 | return *static_cast<MHCalibrationPix*>(fLoGainArray->At(i));
|
---|
245 | }
|
---|
246 |
|
---|
247 | // --------------------------------------------------------------------------
|
---|
248 | //
|
---|
249 | // Get i-th Low Gain pixel (pixel number)
|
---|
250 | //
|
---|
251 | const MHCalibrationPix &MHCalibrationCam::operator()(UInt_t i) const
|
---|
252 | {
|
---|
253 | return *static_cast<MHCalibrationPix*>(fLoGainArray->At(i));
|
---|
254 | }
|
---|
255 |
|
---|
256 | // --------------------------------------------------------------------------
|
---|
257 | //
|
---|
258 | // Returns the current size of the TOrdCollection fAverageHiGainAreas
|
---|
259 | // independently if the MHCalibrationPix is filled with values or not.
|
---|
260 | //
|
---|
261 | const Int_t MHCalibrationCam::GetAverageAreas() const
|
---|
262 | {
|
---|
263 | return fAverageHiGainAreas->GetSize();
|
---|
264 | }
|
---|
265 |
|
---|
266 | // --------------------------------------------------------------------------
|
---|
267 | //
|
---|
268 | // Get i-th High Gain pixel Area (area number)
|
---|
269 | //
|
---|
270 | MHCalibrationPix &MHCalibrationCam::GetAverageHiGainArea(UInt_t i)
|
---|
271 | {
|
---|
272 | return *static_cast<MHCalibrationPix*>(fAverageHiGainAreas->At(i));
|
---|
273 | }
|
---|
274 |
|
---|
275 | // --------------------------------------------------------------------------
|
---|
276 | //
|
---|
277 | // Get i-th High Gain pixel Area (area number)
|
---|
278 | //
|
---|
279 | const MHCalibrationPix &MHCalibrationCam::GetAverageHiGainArea(UInt_t i) const
|
---|
280 | {
|
---|
281 | return *static_cast<MHCalibrationPix *>(fAverageHiGainAreas->At(i));
|
---|
282 | }
|
---|
283 |
|
---|
284 | // --------------------------------------------------------------------------
|
---|
285 | //
|
---|
286 | // Get i-th Low Gain pixel Area (area number)
|
---|
287 | //
|
---|
288 | MHCalibrationPix &MHCalibrationCam::GetAverageLoGainArea(UInt_t i)
|
---|
289 | {
|
---|
290 | return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->At(i));
|
---|
291 | }
|
---|
292 |
|
---|
293 | // --------------------------------------------------------------------------
|
---|
294 | //
|
---|
295 | // Get i-th Low Gain pixel Area (area number)
|
---|
296 | //
|
---|
297 | const MHCalibrationPix &MHCalibrationCam::GetAverageLoGainArea(UInt_t i) const
|
---|
298 | {
|
---|
299 | return *static_cast<MHCalibrationPix*>(fAverageLoGainAreas->At(i));
|
---|
300 | }
|
---|
301 |
|
---|
302 | // --------------------------------------------------------------------------
|
---|
303 | //
|
---|
304 | // Returns the current size of the TOrdCollection fAverageHiGainSectors
|
---|
305 | // independently if the MHCalibrationPix is filled with values or not.
|
---|
306 | //
|
---|
307 | const Int_t MHCalibrationCam::GetAverageSectors() const
|
---|
308 | {
|
---|
309 | return fAverageHiGainSectors->GetSize();
|
---|
310 | }
|
---|
311 |
|
---|
312 | // --------------------------------------------------------------------------
|
---|
313 | //
|
---|
314 | // Get i-th High Gain Sector (sector number)
|
---|
315 | //
|
---|
316 | MHCalibrationPix &MHCalibrationCam::GetAverageHiGainSector(UInt_t i)
|
---|
317 | {
|
---|
318 | return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->At(i));
|
---|
319 | }
|
---|
320 |
|
---|
321 | // --------------------------------------------------------------------------
|
---|
322 | //
|
---|
323 | // Get i-th High Gain Sector (sector number)
|
---|
324 | //
|
---|
325 | const MHCalibrationPix &MHCalibrationCam::GetAverageHiGainSector(UInt_t i) const
|
---|
326 | {
|
---|
327 | return *static_cast<MHCalibrationPix*>(fAverageHiGainSectors->At(i));
|
---|
328 | }
|
---|
329 |
|
---|
330 | // --------------------------------------------------------------------------
|
---|
331 | //
|
---|
332 | // Get i-th Low Gain Sector (sector number)
|
---|
333 | //
|
---|
334 | MHCalibrationPix &MHCalibrationCam::GetAverageLoGainSector(UInt_t i)
|
---|
335 | {
|
---|
336 | return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->At(i));
|
---|
337 | }
|
---|
338 |
|
---|
339 | // --------------------------------------------------------------------------
|
---|
340 | //
|
---|
341 | // Get i-th Low Gain Sector (sector number)
|
---|
342 | //
|
---|
343 | const MHCalibrationPix &MHCalibrationCam::GetAverageLoGainSector(UInt_t i) const
|
---|
344 | {
|
---|
345 | return *static_cast<MHCalibrationPix*>(fAverageLoGainSectors->At(i));
|
---|
346 | }
|
---|
347 |
|
---|
348 | // --------------------------------------------------------------------------
|
---|
349 | //
|
---|
350 | // Calls ResetHistTitles()
|
---|
351 | //
|
---|
352 | // Calls Reset() for each entry in:
|
---|
353 | // - fHiGainArray, fLoGainArray
|
---|
354 | // - fAverageHiGainAreas, fAverageLoGainAreas
|
---|
355 | // - fAverageHiGainSectors, fAverageLoGainSectors
|
---|
356 | //
|
---|
357 | void MHCalibrationCam::ResetHists()
|
---|
358 | {
|
---|
359 |
|
---|
360 | ResetHistTitles();
|
---|
361 |
|
---|
362 | if (fHiGainArray)
|
---|
363 | { fHiGainArray->ForEach(MHCalibrationPix,Reset)(); }
|
---|
364 |
|
---|
365 | if (IsAverageing())
|
---|
366 | {
|
---|
367 | if (fAverageHiGainAreas)
|
---|
368 | { fAverageHiGainAreas->ForEach(MHCalibrationPix,Reset)(); }
|
---|
369 | if (fAverageHiGainSectors)
|
---|
370 | { fAverageHiGainSectors->ForEach(MHCalibrationPix,Reset)(); }
|
---|
371 | }
|
---|
372 |
|
---|
373 | if (!IsLoGain())
|
---|
374 | return;
|
---|
375 |
|
---|
376 | if (fLoGainArray)
|
---|
377 | { fLoGainArray->ForEach(MHCalibrationPix,Reset)(); }
|
---|
378 | if (IsAverageing())
|
---|
379 | {
|
---|
380 | if (fAverageLoGainAreas)
|
---|
381 | { fAverageLoGainAreas->ForEach(MHCalibrationPix,Reset)(); }
|
---|
382 | if (fAverageLoGainSectors)
|
---|
383 | { fAverageLoGainSectors->ForEach(MHCalibrationPix,Reset)(); }
|
---|
384 | }
|
---|
385 | }
|
---|
386 |
|
---|
387 | // --------------------------------------------------------------------------
|
---|
388 | //
|
---|
389 | // Resets the histogram titles for each entry in:
|
---|
390 | // - fHiGainArray, fLoGainArray
|
---|
391 | // - fAverageHiGainAreas, fAverageLoGainAreas
|
---|
392 | // - fAverageHiGainSectors, fAverageLoGainSectors
|
---|
393 | //
|
---|
394 | void MHCalibrationCam::ResetHistTitles()
|
---|
395 | {
|
---|
396 |
|
---|
397 | TH1F *h;
|
---|
398 |
|
---|
399 | if (fHiGainArray)
|
---|
400 | for (Int_t i=0;i<fHiGainArray->GetSize(); i++)
|
---|
401 | {
|
---|
402 | MHCalibrationPix &pix = (*this)[i];
|
---|
403 | h = pix.GetHGausHist();
|
---|
404 | h->SetName (Form("%s%s%s%4i","H",fHistName.Data(),"HiGainPix",i));
|
---|
405 | h->SetTitle(Form("%s%s%4i%s",fHistTitle.Data()," High Gain Pixel ",i," Runs: "));
|
---|
406 | h->SetXTitle(fHistXTitle.Data());
|
---|
407 | h->SetYTitle(fHistYTitle.Data());
|
---|
408 | }
|
---|
409 |
|
---|
410 | if (IsAverageing())
|
---|
411 | {
|
---|
412 | if (fAverageHiGainAreas)
|
---|
413 | for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
|
---|
414 | {
|
---|
415 | MHCalibrationPix &pix = GetAverageHiGainArea(j);
|
---|
416 | h = pix.GetHGausHist();
|
---|
417 | h->SetName (Form("%s%s%s%d","H",fHistName.Data(),"HiGainArea",j));
|
---|
418 | h->SetXTitle(fHistXTitle.Data());
|
---|
419 | h->SetYTitle(fHistYTitle.Data());
|
---|
420 | if (fGeom->InheritsFrom("MGeomCamMagic"))
|
---|
421 | h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",
|
---|
422 | j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: "));
|
---|
423 | else
|
---|
424 | h->SetTitle(Form("%s%s%d%s",fHistTitle.Data(),
|
---|
425 | " averaged on event-by-event basis High Gain Area Idx ",j," Runs: "));
|
---|
426 | }
|
---|
427 |
|
---|
428 | if (fAverageHiGainSectors)
|
---|
429 | for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
|
---|
430 | {
|
---|
431 | MHCalibrationPix &pix = GetAverageHiGainSector(j);
|
---|
432 | h = pix.GetHGausHist();
|
---|
433 | h->SetName (Form("%s%s%s%2i","H",fHistName.Data(),"HiGainSector",j));
|
---|
434 | h->SetTitle(Form("%s%s%2i%s",fHistTitle.Data(),
|
---|
435 | " averaged on event-by-event basis High Gain Sector ",j," Runs: "));
|
---|
436 | h->SetXTitle(fHistXTitle.Data());
|
---|
437 | h->SetYTitle(fHistYTitle.Data());
|
---|
438 | }
|
---|
439 | }
|
---|
440 |
|
---|
441 | if (!IsLoGain())
|
---|
442 | return;
|
---|
443 |
|
---|
444 | if (fLoGainArray)
|
---|
445 | for (Int_t i=0;i<fLoGainArray->GetSize(); i++)
|
---|
446 | {
|
---|
447 | MHCalibrationPix &pix = (*this)(i);
|
---|
448 | h = pix.GetHGausHist();
|
---|
449 | h->SetName (Form("%s%s%s%4i","H",fHistName.Data(),"LoGainPix",i));
|
---|
450 | h->SetTitle(Form("%s%s%4i%s",fHistTitle.Data()," Low Gain Pixel ",i," Runs: "));
|
---|
451 | h->SetXTitle(fHistXTitle.Data());
|
---|
452 | h->SetYTitle(fHistYTitle.Data());
|
---|
453 | }
|
---|
454 |
|
---|
455 | if (IsAverageing())
|
---|
456 | {
|
---|
457 | if (fAverageLoGainAreas)
|
---|
458 | for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
|
---|
459 | {
|
---|
460 | MHCalibrationPix &pix = GetAverageLoGainArea(j);
|
---|
461 | h = pix.GetHGausHist();
|
---|
462 | h->SetName (Form("%s%s%s%d","H",fHistName.Data(),"LoGainArea",j));
|
---|
463 | h->SetXTitle(fHistXTitle.Data());
|
---|
464 | h->SetYTitle(fHistYTitle.Data());
|
---|
465 | if (fGeom->InheritsFrom("MGeomCamMagic"))
|
---|
466 | h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ",
|
---|
467 | j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: "));
|
---|
468 | else
|
---|
469 | h->SetTitle(Form("%s%s%d%s",fHistTitle.Data(),
|
---|
470 | " averaged on event-by-event basis Low Gain Area Idx ",j," Runs: "));
|
---|
471 | }
|
---|
472 |
|
---|
473 | if (fAverageLoGainSectors)
|
---|
474 | for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
|
---|
475 | {
|
---|
476 | MHCalibrationPix &pix = GetAverageLoGainSector(j);
|
---|
477 | h = pix.GetHGausHist();
|
---|
478 | h->SetName (Form("%s%s%s%2i","H",fHistName.Data(),"LoGainSector",j));
|
---|
479 | h->SetTitle(Form("%s%s%2i%s",fHistTitle.Data(),
|
---|
480 | " averaged on event-by-event basis Low Gain Sector ",j," Runs: "));
|
---|
481 | h->SetXTitle(fHistXTitle.Data());
|
---|
482 | h->SetYTitle(fHistYTitle.Data());
|
---|
483 | }
|
---|
484 | }
|
---|
485 | }
|
---|
486 |
|
---|
487 | // --------------------------------------------------------------------------
|
---|
488 | //
|
---|
489 | // Gets the pointers to:
|
---|
490 | // - MGeomCam
|
---|
491 | //
|
---|
492 | // Calls SetupHists(const MParList *pList)
|
---|
493 | //
|
---|
494 | // Calls Delete-Function of:
|
---|
495 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
---|
496 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
497 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
498 | //
|
---|
499 | Bool_t MHCalibrationCam::SetupFill(const MParList *pList)
|
---|
500 | {
|
---|
501 |
|
---|
502 | fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
503 | if (!fGeom)
|
---|
504 | {
|
---|
505 | *fLog << err << GetDescriptor()
|
---|
506 | << ": MGeomCam not found... aborting." << endl;
|
---|
507 | return kFALSE;
|
---|
508 | }
|
---|
509 |
|
---|
510 | fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
|
---|
511 | if (!fRunHeader)
|
---|
512 | {
|
---|
513 | *fLog << warn << GetDescriptor()
|
---|
514 | << ": MRawRunHeader not found... will not store run numbers." << endl;
|
---|
515 | }
|
---|
516 |
|
---|
517 | return SetupHists(pList);
|
---|
518 | }
|
---|
519 |
|
---|
520 |
|
---|
521 | // --------------------------------------------------------------------------
|
---|
522 | //
|
---|
523 | // Searches MRawEvtHeader to find the correct pulser colour
|
---|
524 | //
|
---|
525 | // Gets or creates the pointers to:
|
---|
526 | // - MBadPixelsIntensityCam
|
---|
527 | // - MBadPixelsCam
|
---|
528 | //
|
---|
529 | // Searches pointer to:
|
---|
530 | // - MArrivalTimeCam
|
---|
531 | //
|
---|
532 | // Initializes, if empty to MArrivalTimeCam::GetSize() for:
|
---|
533 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
---|
534 | //
|
---|
535 | // Initializes, if empty to MGeomCam::GetNumAreas() for:
|
---|
536 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
537 | //
|
---|
538 | // Initializes, if empty to MGeomCam::GetNumSectors() for:
|
---|
539 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
540 | //
|
---|
541 | // Initializes TArray's to MGeomCam::GetNumAreas and MGeomCam::GetNumSectors, respectively
|
---|
542 | // Fills with number of valid pixels (if !MBadPixelsPix::IsBad()):
|
---|
543 | // - MHCalibrationCam::fAverageAreaNum[area index]
|
---|
544 | // - MHCalibrationCam::fAverageSectorNum[area index]
|
---|
545 | //
|
---|
546 | // Calls InitializeHists() for every entry in:
|
---|
547 | // - MHCalibrationCam::fHiGainArray
|
---|
548 | // - MHCalibrationCam::fAverageHiGainAreas
|
---|
549 | // - MHCalibrationCam::fAverageHiGainSectors
|
---|
550 | //
|
---|
551 | // Sets Titles and Names for the Histograms
|
---|
552 | // - MHCalibrationCam::fAverageHiGainAreas
|
---|
553 | // - MHCalibrationCam::fAverageHiGainSectors
|
---|
554 | //
|
---|
555 | // Retrieves the run numbers from MRawRunHeader and stores them in fRunNumbers
|
---|
556 | //
|
---|
557 | Bool_t MHCalibrationCam::ReInit(MParList *pList)
|
---|
558 | {
|
---|
559 |
|
---|
560 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
561 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
562 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
563 |
|
---|
564 | fIntensBad = (MBadPixelsIntensityCam*)pList->FindObject(AddSerialNumber("MBadPixelsIntensityCam"));
|
---|
565 | if (fIntensBad)
|
---|
566 | *fLog << inf << "Found MBadPixelsIntensityCam ... " << endl;
|
---|
567 | else
|
---|
568 | {
|
---|
569 | fBadPixels = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam");
|
---|
570 | if (!fBadPixels)
|
---|
571 | {
|
---|
572 |
|
---|
573 | fBadPixels = (MBadPixelsCam*)pList->FindCreateObj(AddSerialNumber("MBadPixelsCam"));
|
---|
574 | if (!fBadPixels)
|
---|
575 | {
|
---|
576 | *fLog << err << "Cannot find nor create MBadPixelsCam ... abort." << endl;
|
---|
577 | return kFALSE;
|
---|
578 | }
|
---|
579 | else
|
---|
580 | fBadPixels->InitSize(npixels);
|
---|
581 | }
|
---|
582 | }
|
---|
583 |
|
---|
584 | if (IsAverageing())
|
---|
585 | {
|
---|
586 | //
|
---|
587 | // The function TArrayF::Set() already sets all entries to 0.
|
---|
588 | //
|
---|
589 | fAverageAreaNum. Set(nareas);
|
---|
590 | fAverageAreaSat. Set(nareas);
|
---|
591 | fAverageAreaSigma. Set(nareas);
|
---|
592 | fAverageAreaSigmaVar. Set(nareas);
|
---|
593 | fAverageAreaRelSigma. Set(nareas);
|
---|
594 | fAverageAreaRelSigmaVar.Set(nareas);
|
---|
595 | fAverageSectorNum. Set(nsectors);
|
---|
596 |
|
---|
597 | for (Int_t aidx=0; aidx<nareas; aidx++)
|
---|
598 | fAverageAreaNum[aidx] = 0;
|
---|
599 |
|
---|
600 | for (Int_t sector=0; sector<nsectors; sector++)
|
---|
601 | fAverageSectorNum[sector] = 0;
|
---|
602 |
|
---|
603 | for (Int_t i=0; i<npixels; i++)
|
---|
604 | {
|
---|
605 |
|
---|
606 | MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i];
|
---|
607 | if (bad.IsBad())
|
---|
608 | continue;
|
---|
609 |
|
---|
610 | fAverageAreaNum [(*fGeom)[i].GetAidx() ]++;
|
---|
611 | fAverageSectorNum[(*fGeom)[i].GetSector()]++;
|
---|
612 | }
|
---|
613 | }
|
---|
614 |
|
---|
615 | //
|
---|
616 | // Because ReInit has been called, a new run number is added
|
---|
617 | //
|
---|
618 | fRunNumbers.Set(fRunNumbers.GetSize()+1);
|
---|
619 |
|
---|
620 | if (fRunHeader)
|
---|
621 | {
|
---|
622 | fRunNumbers[fRunNumbers.GetSize()-1] = fRunHeader->GetRunNumber();
|
---|
623 | if (IsLoGain())
|
---|
624 | SetLoGain(fRunHeader->GetNumSamplesLoGain());
|
---|
625 | }
|
---|
626 |
|
---|
627 | if (!ReInitHists(pList))
|
---|
628 | return kFALSE;
|
---|
629 |
|
---|
630 | ResetHistTitles();
|
---|
631 |
|
---|
632 | if (!fRunHeader)
|
---|
633 | return kTRUE;
|
---|
634 |
|
---|
635 | for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
|
---|
636 | {
|
---|
637 | TH1F *h = (*this)[i].GetHGausHist();
|
---|
638 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
639 | }
|
---|
640 |
|
---|
641 | if (IsLoGain())
|
---|
642 | for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
|
---|
643 | {
|
---|
644 | TH1F *h = (*this)(i).GetHGausHist();
|
---|
645 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
646 | }
|
---|
647 |
|
---|
648 | if (!IsAverageing())
|
---|
649 | return kTRUE;
|
---|
650 |
|
---|
651 | for (Int_t j=0; j<nareas; j++)
|
---|
652 | {
|
---|
653 | TH1F *h = GetAverageHiGainArea(j).GetHGausHist();
|
---|
654 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
655 | }
|
---|
656 |
|
---|
657 | if (IsLoGain())
|
---|
658 | for (Int_t j=0; j<nareas; j++)
|
---|
659 | {
|
---|
660 | TH1F *h = GetAverageLoGainArea(j).GetHGausHist();
|
---|
661 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
662 | }
|
---|
663 |
|
---|
664 | for (Int_t j=0; j<nsectors; j++)
|
---|
665 | {
|
---|
666 | TH1F *h = GetAverageHiGainSector(j).GetHGausHist();
|
---|
667 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
668 | }
|
---|
669 |
|
---|
670 | if (IsLoGain())
|
---|
671 | for (Int_t j=0; j<nsectors; j++)
|
---|
672 | {
|
---|
673 | TH1F *h = GetAverageLoGainSector(j).GetHGausHist();
|
---|
674 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
675 | }
|
---|
676 |
|
---|
677 | return kTRUE;
|
---|
678 | }
|
---|
679 |
|
---|
680 | //--------------------------------------------------------------------------------------
|
---|
681 | //
|
---|
682 | // Initializes the High Gain Arrays:
|
---|
683 | //
|
---|
684 | // - For every entry in the expanded arrays:
|
---|
685 | // * Initialize an MHCalibrationPix
|
---|
686 | // * Set Binning from fNbins, fFirst and fLast
|
---|
687 | // * Set Histgram names and titles from fHistName and fHistTitle
|
---|
688 | // * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle
|
---|
689 | // * Call InitHists
|
---|
690 | //
|
---|
691 | void MHCalibrationCam::InitHiGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors)
|
---|
692 | {
|
---|
693 |
|
---|
694 | if (fHiGainArray->GetSize()==0)
|
---|
695 | {
|
---|
696 | for (Int_t i=0; i<npixels; i++)
|
---|
697 | {
|
---|
698 | fHiGainArray->AddAt(new MHCalibrationPix(Form("%sHiGainPix%04d",fHistName.Data(),i),
|
---|
699 | Form("%s High Gain Pixel %4d",fHistTitle.Data(),i)),i);
|
---|
700 |
|
---|
701 | MHCalibrationPix &pix = (*this)[i];
|
---|
702 | pix.SetNbins(fNbins);
|
---|
703 | pix.SetFirst(fFirst);
|
---|
704 | pix.SetLast (fLast);
|
---|
705 | pix.SetProbLimit(fProbLimit);
|
---|
706 |
|
---|
707 | MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i];
|
---|
708 | InitHists(pix,bad,i);
|
---|
709 | }
|
---|
710 | }
|
---|
711 |
|
---|
712 | if (!IsAverageing())
|
---|
713 | return;
|
---|
714 |
|
---|
715 | if (fAverageHiGainAreas->GetSize()==0)
|
---|
716 | {
|
---|
717 | for (Int_t j=0; j<nareas; j++)
|
---|
718 | {
|
---|
719 | fAverageHiGainAreas->AddAt(new MHCalibrationPix(Form("%sHiGainArea%d",fHistName.Data(),j),
|
---|
720 | Form("%s High Gain Area Idx %d",fHistTitle.Data(),j)),j);
|
---|
721 |
|
---|
722 | MHCalibrationPix &pix = GetAverageHiGainArea(j);
|
---|
723 |
|
---|
724 | pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
|
---|
725 | pix.SetFirst(fFirst);
|
---|
726 | pix.SetLast (fLast);
|
---|
727 |
|
---|
728 | if (fGeom && fGeom->InheritsFrom("MGeomCamMagic"))
|
---|
729 | {
|
---|
730 | pix.InitBins();
|
---|
731 | pix.SetEventFrequency(fPulserFrequency);
|
---|
732 | }
|
---|
733 | else
|
---|
734 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
|
---|
735 | }
|
---|
736 | }
|
---|
737 |
|
---|
738 | if (fAverageHiGainSectors->GetSize()==0)
|
---|
739 | {
|
---|
740 | for (Int_t j=0; j<nsectors; j++)
|
---|
741 | {
|
---|
742 | fAverageHiGainSectors->AddAt(new MHCalibrationPix(Form("%sHiGainSector%02d",fHistName.Data(),j),
|
---|
743 | Form("%s High Gain Sector %02d",fHistTitle.Data(),j)),j);
|
---|
744 | MHCalibrationPix &pix = GetAverageHiGainSector(j);
|
---|
745 |
|
---|
746 | pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors));
|
---|
747 | pix.SetFirst(fFirst);
|
---|
748 | pix.SetLast (fLast);
|
---|
749 |
|
---|
750 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
|
---|
751 | }
|
---|
752 | }
|
---|
753 | }
|
---|
754 |
|
---|
755 | //--------------------------------------------------------------------------------------
|
---|
756 | //
|
---|
757 | // Return, if IsLoGain() is kFALSE
|
---|
758 | //
|
---|
759 | // Initializes the Low Gain Arrays:
|
---|
760 | //
|
---|
761 | // - For every entry in the expanded arrays:
|
---|
762 | // * Initialize an MHCalibrationPix
|
---|
763 | // * Set Binning from fNbins, fFirst and fLast
|
---|
764 | // * Set Histgram names and titles from fHistName and fHistTitle
|
---|
765 | // * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle
|
---|
766 | // * Call InitHists
|
---|
767 | //
|
---|
768 | void MHCalibrationCam::InitLoGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors)
|
---|
769 | {
|
---|
770 |
|
---|
771 | if (!IsLoGain())
|
---|
772 | return;
|
---|
773 |
|
---|
774 | if (fLoGainArray->GetSize()==0)
|
---|
775 | {
|
---|
776 | for (Int_t i=0; i<npixels; i++)
|
---|
777 | {
|
---|
778 | fLoGainArray->AddAt(new MHCalibrationPix(Form("%sLoGainPix%04d",fHistName.Data(),i),
|
---|
779 | Form("%s Low Gain Pixel%04d",fHistTitle.Data(),i)),i);
|
---|
780 |
|
---|
781 | MHCalibrationPix &pix = (*this)(i);
|
---|
782 | pix.SetNbins(fNbins);
|
---|
783 | pix.SetFirst(fFirst);
|
---|
784 | pix.SetLast (fLast);
|
---|
785 | pix.SetProbLimit(fProbLimit);
|
---|
786 |
|
---|
787 | MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i];
|
---|
788 | InitHists(pix,bad,i);
|
---|
789 | }
|
---|
790 | }
|
---|
791 |
|
---|
792 | if (!IsAverageing())
|
---|
793 | return;
|
---|
794 |
|
---|
795 | if (fAverageLoGainAreas->GetSize()==0)
|
---|
796 | {
|
---|
797 | for (Int_t j=0; j<nareas; j++)
|
---|
798 | {
|
---|
799 | fAverageLoGainAreas->AddAt(new MHCalibrationPix(Form("%sLoGainArea%d",fHistName.Data(),j),
|
---|
800 | Form("%s Low Gain Area Idx %d",fHistTitle.Data(),j)),j);
|
---|
801 |
|
---|
802 | MHCalibrationPix &pix = GetAverageLoGainArea(j);
|
---|
803 |
|
---|
804 | pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas));
|
---|
805 | pix.SetFirst(fFirst);
|
---|
806 | pix.SetLast (fLast);
|
---|
807 |
|
---|
808 | if (fGeom && fGeom->InheritsFrom("MGeomCamMagic"))
|
---|
809 | {
|
---|
810 | pix.InitBins();
|
---|
811 | pix.SetEventFrequency(fPulserFrequency);
|
---|
812 | }
|
---|
813 | else
|
---|
814 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
|
---|
815 | }
|
---|
816 | }
|
---|
817 |
|
---|
818 | if (fAverageLoGainSectors->GetSize()==0)
|
---|
819 | {
|
---|
820 | for (Int_t j=0; j<nsectors; j++)
|
---|
821 | {
|
---|
822 | fAverageLoGainSectors->AddAt(new MHCalibrationPix(Form("%sLoGainSector%02d",fHistName.Data(),j),
|
---|
823 | Form("%s Low Gain Sector %02d",fHistTitle.Data(),j)),j);
|
---|
824 | MHCalibrationPix &pix = GetAverageLoGainSector(j);
|
---|
825 |
|
---|
826 | pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors));
|
---|
827 | pix.SetFirst(fFirst);
|
---|
828 | pix.SetLast (fLast);
|
---|
829 |
|
---|
830 | InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
|
---|
831 | }
|
---|
832 | }
|
---|
833 | }
|
---|
834 |
|
---|
835 | //--------------------------------------------------------------------------------
|
---|
836 | //
|
---|
837 | // Retrieves from MGeomCam:
|
---|
838 | // - number of pixels
|
---|
839 | // - number of pixel areas
|
---|
840 | // - number of sectors
|
---|
841 | //
|
---|
842 | // Return kFALSE, if sizes of the TOrdCollections do not match npixels, nareas or nsectors
|
---|
843 | //
|
---|
844 | // Call FillHists()
|
---|
845 | //
|
---|
846 | Bool_t MHCalibrationCam::Fill(const MParContainer *par, const Stat_t w)
|
---|
847 | {
|
---|
848 |
|
---|
849 | if (!IsSizeCheck())
|
---|
850 | return FillHists(par,w);
|
---|
851 |
|
---|
852 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
853 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
854 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
855 |
|
---|
856 | //
|
---|
857 | // Hi-Gain OrdCollections
|
---|
858 | //
|
---|
859 | if (fHiGainArray->GetSize() != npixels)
|
---|
860 | {
|
---|
861 | *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl;
|
---|
862 | return kFALSE;
|
---|
863 | }
|
---|
864 |
|
---|
865 | if (IsLoGain())
|
---|
866 | {
|
---|
867 | if (fLoGainArray->GetSize() != npixels)
|
---|
868 | {
|
---|
869 | *fLog << err << "ERROR - Size mismatch in number of pixels... abort." << endl;
|
---|
870 | return kFALSE;
|
---|
871 | }
|
---|
872 | }
|
---|
873 |
|
---|
874 | if (!IsAverageing())
|
---|
875 | return FillHists(par,w);
|
---|
876 |
|
---|
877 | if (fAverageHiGainAreas->GetSize() != nareas)
|
---|
878 | {
|
---|
879 | *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
|
---|
880 | return kFALSE;
|
---|
881 | }
|
---|
882 |
|
---|
883 | if (fAverageHiGainSectors->GetSize() != nsectors)
|
---|
884 | {
|
---|
885 | *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
|
---|
886 | return kFALSE;
|
---|
887 | }
|
---|
888 |
|
---|
889 | if (IsLoGain())
|
---|
890 | {
|
---|
891 |
|
---|
892 | if (fAverageLoGainAreas->GetSize() != nareas)
|
---|
893 | {
|
---|
894 | *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
|
---|
895 | return kFALSE;
|
---|
896 | }
|
---|
897 |
|
---|
898 | if (fAverageLoGainSectors->GetSize() != nsectors)
|
---|
899 | {
|
---|
900 | *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
|
---|
901 | return kFALSE;
|
---|
902 | }
|
---|
903 | }
|
---|
904 |
|
---|
905 | return FillHists(par, w);
|
---|
906 | }
|
---|
907 |
|
---|
908 | // --------------------------------------------------------------------------
|
---|
909 | //
|
---|
910 | // 0) Ask if fHiGainArray and fLoGainArray have been initialized,
|
---|
911 | // otherwise return kFALSE.
|
---|
912 | // 1) FinalizeHists()
|
---|
913 | // 2) FinalizeBadPixels()
|
---|
914 | // 3) CalcAverageSigma()
|
---|
915 | //
|
---|
916 | Bool_t MHCalibrationCam::Finalize()
|
---|
917 | {
|
---|
918 |
|
---|
919 | if (fHiGainArray->GetSize() == 0 && fLoGainArray->GetSize() == 0)
|
---|
920 | {
|
---|
921 | *fLog << err << GetDescriptor()
|
---|
922 | << ": ERROR: Both (HiGain and LoGain) histogram arrays have not been initialized... abort." << endl;
|
---|
923 | return kFALSE;
|
---|
924 | }
|
---|
925 |
|
---|
926 | for (Int_t i=0; i<fAverageHiGainAreas->GetSize(); i++)
|
---|
927 | {
|
---|
928 | TH1F *h = GetAverageHiGainArea(i).GetHGausHist();
|
---|
929 | switch (fColor)
|
---|
930 | {
|
---|
931 | case MCalibrationCam::kNONE:
|
---|
932 | break;
|
---|
933 | case MCalibrationCam::kBLUE:
|
---|
934 | h->SetTitle( Form("%s%s", h->GetTitle(),"BLUE "));
|
---|
935 | break;
|
---|
936 | case MCalibrationCam::kGREEN:
|
---|
937 | h->SetTitle( Form("%s%s", h->GetTitle(),"GREEN "));
|
---|
938 | break;
|
---|
939 | case MCalibrationCam::kUV:
|
---|
940 | h->SetTitle( Form("%s%s", h->GetTitle(),"UV "));
|
---|
941 | break;
|
---|
942 | case MCalibrationCam::kCT1:
|
---|
943 | h->SetTitle( Form("%s%s", h->GetTitle(),"CT1-Pulser "));
|
---|
944 | break;
|
---|
945 | }
|
---|
946 | }
|
---|
947 |
|
---|
948 | for (Int_t i=0; i<fAverageLoGainAreas->GetSize(); i++)
|
---|
949 | {
|
---|
950 | TH1F *h = GetAverageLoGainArea(i).GetHGausHist();
|
---|
951 | switch (fColor)
|
---|
952 | {
|
---|
953 | case MCalibrationCam::kNONE:
|
---|
954 | break;
|
---|
955 | case MCalibrationCam::kBLUE:
|
---|
956 | h->SetTitle( Form("%s%s", h->GetTitle(),"BLUE "));
|
---|
957 | break;
|
---|
958 | case MCalibrationCam::kGREEN:
|
---|
959 | h->SetTitle( Form("%s%s", h->GetTitle(),"GREEN "));
|
---|
960 | break;
|
---|
961 | case MCalibrationCam::kUV:
|
---|
962 | h->SetTitle( Form("%s%s", h->GetTitle(),"UV "));
|
---|
963 | break;
|
---|
964 | case MCalibrationCam::kCT1:
|
---|
965 | h->SetTitle( Form("%s%s", h->GetTitle(),"CT1-Pulser "));
|
---|
966 | break;
|
---|
967 | }
|
---|
968 | }
|
---|
969 |
|
---|
970 | if (!FinalizeHists())
|
---|
971 | return kFALSE;
|
---|
972 |
|
---|
973 |
|
---|
974 | FinalizeBadPixels();
|
---|
975 | CalcAverageSigma();
|
---|
976 |
|
---|
977 | return kTRUE;
|
---|
978 | }
|
---|
979 |
|
---|
980 | // -------------------------------------------------------------
|
---|
981 | //
|
---|
982 | // If MBadPixelsPix::IsBad():
|
---|
983 | // - calls MHCalibrationPix::SetExcluded()
|
---|
984 | //
|
---|
985 | // Calls:
|
---|
986 | // - MHGausEvents::InitBins()
|
---|
987 | // - MHCalibrationPix::ChangeHistId(i)
|
---|
988 | // - MHCalibrationPix::SetEventFrequency(fPulserFrequency)
|
---|
989 | //
|
---|
990 | void MHCalibrationCam::InitHists(MHCalibrationPix &hist, MBadPixelsPix &bad, const Int_t i)
|
---|
991 | {
|
---|
992 |
|
---|
993 | if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
994 | hist.SetExcluded();
|
---|
995 |
|
---|
996 | hist.InitBins();
|
---|
997 | hist.SetEventFrequency(fPulserFrequency);
|
---|
998 | }
|
---|
999 |
|
---|
1000 | // -------------------------------------------------------------
|
---|
1001 | //
|
---|
1002 | // - Searches for the CalibrationIntensity*Cam corresponding to 'name'.
|
---|
1003 | // - In case, it does not exist in the parameter list, it searches
|
---|
1004 | // for the corresponding MCalibration*Cam.
|
---|
1005 | // - Initializes the MCalibration*Cam, if not yet done.
|
---|
1006 | //
|
---|
1007 | Bool_t MHCalibrationCam::InitCams( MParList *plist, const TString name )
|
---|
1008 | {
|
---|
1009 |
|
---|
1010 | TString intensname = "MCalibrationIntensity";
|
---|
1011 | intensname += name;
|
---|
1012 | intensname += "Cam";
|
---|
1013 |
|
---|
1014 | TString ordname = "MCalibration";
|
---|
1015 | ordname += name;
|
---|
1016 | ordname += "Cam";
|
---|
1017 |
|
---|
1018 | fIntensCam = (MCalibrationIntensityCam*)plist->FindObject(AddSerialNumber(intensname));
|
---|
1019 | if (fIntensCam)
|
---|
1020 | *fLog << inf << "Found " << intensname << "... " << endl;
|
---|
1021 | else
|
---|
1022 | {
|
---|
1023 | fCam = (MCalibrationCam*)plist->FindObject(AddSerialNumber(ordname));
|
---|
1024 | if (!fCam)
|
---|
1025 | {
|
---|
1026 | fCam = (MCalibrationCam*)plist->FindCreateObj(AddSerialNumber(ordname));
|
---|
1027 | if (!fCam)
|
---|
1028 | {
|
---|
1029 | *fLog << err << "Cannot find nor create " << ordname << " ... abort." << endl;
|
---|
1030 | return kFALSE;
|
---|
1031 | }
|
---|
1032 | fCam->Init(*fGeom);
|
---|
1033 | }
|
---|
1034 | }
|
---|
1035 | return kTRUE;
|
---|
1036 | }
|
---|
1037 |
|
---|
1038 | // --------------------------------------------------------------------------
|
---|
1039 | //
|
---|
1040 | // Calls FitHiGainHists for every entry in:
|
---|
1041 | // - fHiGainArray
|
---|
1042 | // - fAverageHiGainAreas
|
---|
1043 | // - fAverageHiGainSectors
|
---|
1044 | //
|
---|
1045 | void MHCalibrationCam::FitHiGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
|
---|
1046 | MBadPixelsPix::UncalibratedType_t fittyp,
|
---|
1047 | MBadPixelsPix::UncalibratedType_t osctyp)
|
---|
1048 | {
|
---|
1049 |
|
---|
1050 | for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
|
---|
1051 | {
|
---|
1052 |
|
---|
1053 | MHCalibrationPix &hist = (*this)[i];
|
---|
1054 |
|
---|
1055 | if (hist.IsExcluded())
|
---|
1056 | continue;
|
---|
1057 |
|
---|
1058 | MCalibrationPix &pix = calcam[i];
|
---|
1059 | MBadPixelsPix &bad = badcam[i];
|
---|
1060 |
|
---|
1061 | FitHiGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
1062 | }
|
---|
1063 |
|
---|
1064 | if (!IsAverageing())
|
---|
1065 | return;
|
---|
1066 |
|
---|
1067 | for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
|
---|
1068 | {
|
---|
1069 |
|
---|
1070 | MHCalibrationPix &hist = GetAverageHiGainArea(j);
|
---|
1071 | MCalibrationPix &pix = calcam.GetAverageArea(j);
|
---|
1072 | MBadPixelsPix &bad = calcam.GetAverageBadArea(j);
|
---|
1073 |
|
---|
1074 | FitHiGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
1075 | }
|
---|
1076 |
|
---|
1077 | for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
|
---|
1078 | {
|
---|
1079 | MHCalibrationPix &hist = GetAverageHiGainSector(j);
|
---|
1080 | MCalibrationPix &pix = calcam.GetAverageSector(j);
|
---|
1081 | MBadPixelsPix &bad = calcam.GetAverageBadSector(j);
|
---|
1082 |
|
---|
1083 | FitHiGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
1084 | }
|
---|
1085 | }
|
---|
1086 |
|
---|
1087 | // --------------------------------------------------------------------------
|
---|
1088 | //
|
---|
1089 | // Calls FitLoGainHists for every entry in:
|
---|
1090 | // - fLoGainArray
|
---|
1091 | // - fAverageLoGainAreas
|
---|
1092 | // - fAverageLoGainSectors
|
---|
1093 | //
|
---|
1094 | void MHCalibrationCam::FitLoGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
|
---|
1095 | MBadPixelsPix::UncalibratedType_t fittyp,
|
---|
1096 | MBadPixelsPix::UncalibratedType_t osctyp)
|
---|
1097 | {
|
---|
1098 |
|
---|
1099 | if (!IsLoGain())
|
---|
1100 | return;
|
---|
1101 |
|
---|
1102 | for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
|
---|
1103 | {
|
---|
1104 |
|
---|
1105 | MHCalibrationPix &hist = (*this)(i);
|
---|
1106 |
|
---|
1107 | if (hist.IsExcluded())
|
---|
1108 | continue;
|
---|
1109 |
|
---|
1110 | MCalibrationPix &pix = calcam[i];
|
---|
1111 | MBadPixelsPix &bad = badcam[i];
|
---|
1112 |
|
---|
1113 | FitLoGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
1114 |
|
---|
1115 | }
|
---|
1116 |
|
---|
1117 | if (!IsAverageing())
|
---|
1118 | return;
|
---|
1119 |
|
---|
1120 | for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
|
---|
1121 | {
|
---|
1122 |
|
---|
1123 | MHCalibrationPix &hist = GetAverageLoGainArea(j);
|
---|
1124 | MCalibrationPix &pix = calcam.GetAverageArea(j);
|
---|
1125 | MBadPixelsPix &bad = calcam.GetAverageBadArea(j);
|
---|
1126 |
|
---|
1127 | FitLoGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
1128 | }
|
---|
1129 |
|
---|
1130 | for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
|
---|
1131 | {
|
---|
1132 |
|
---|
1133 | MHCalibrationPix &hist = GetAverageLoGainSector(j);
|
---|
1134 | MCalibrationPix &pix = calcam.GetAverageSector(j);
|
---|
1135 | MBadPixelsPix &bad = calcam.GetAverageBadSector(j);
|
---|
1136 |
|
---|
1137 | FitLoGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
1138 | }
|
---|
1139 | }
|
---|
1140 |
|
---|
1141 | //------------------------------------------------------------
|
---|
1142 | //
|
---|
1143 | // For all averaged areas, the fitted sigma is multiplied with the square root of
|
---|
1144 | // the number involved pixels
|
---|
1145 | //
|
---|
1146 | void MHCalibrationCam::CalcAverageSigma()
|
---|
1147 | {
|
---|
1148 |
|
---|
1149 | if (!fCam)
|
---|
1150 | return;
|
---|
1151 |
|
---|
1152 | if (!IsAverageing())
|
---|
1153 | return;
|
---|
1154 |
|
---|
1155 | for (UInt_t j=0; j<fGeom->GetNumAreas(); j++)
|
---|
1156 | {
|
---|
1157 |
|
---|
1158 | MCalibrationPix &pix = fCam->GetAverageArea(j);
|
---|
1159 |
|
---|
1160 | const Float_t numsqr = TMath::Sqrt((Float_t)fAverageAreaNum[j]);
|
---|
1161 | fAverageAreaSigma[j] = pix.GetSigma () * numsqr;
|
---|
1162 | fAverageAreaSigmaVar[j] = pix.GetSigmaErr () * pix.GetSigmaErr() * numsqr;
|
---|
1163 |
|
---|
1164 | pix.SetSigma (fAverageAreaSigma[j]);
|
---|
1165 | pix.SetSigmaVar(fAverageAreaSigmaVar[j]);
|
---|
1166 |
|
---|
1167 | fAverageAreaRelSigma [j] = fAverageAreaSigma[j] / pix.GetMean();
|
---|
1168 | fAverageAreaRelSigmaVar[j] = fAverageAreaSigmaVar[j] / (fAverageAreaSigma[j]*fAverageAreaSigma[j]);
|
---|
1169 | fAverageAreaRelSigmaVar[j] += pix.GetMeanRelVar();
|
---|
1170 | fAverageAreaRelSigmaVar[j] *= fAverageAreaRelSigma[j];
|
---|
1171 | }
|
---|
1172 | }
|
---|
1173 |
|
---|
1174 | // ---------------------------------------------------------------------------
|
---|
1175 | //
|
---|
1176 | // Returns if the histogram is empty and sets the following flag:
|
---|
1177 | // - MBadPixelsPix::SetUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
---|
1178 | //
|
---|
1179 | // Fits the histograms with a Gaussian, in case of failure
|
---|
1180 | // calls MHCalibrationPix::RepeatFit(), in case of repeated failure
|
---|
1181 | // calls MHCalibrationPix::BypassFit() and sets the following flags:
|
---|
1182 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::UncalibratedType_t fittyp )
|
---|
1183 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
1184 | //
|
---|
1185 | // Creates the fourier spectrum and tests MHGausEvents::IsFourierSpectrumOK().
|
---|
1186 | // In case no, sets the following flags:
|
---|
1187 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::UncalibratedType_t osctyp )
|
---|
1188 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
1189 | //
|
---|
1190 | // Retrieves the results and store them in MCalibrationPix
|
---|
1191 | //
|
---|
1192 | void MHCalibrationCam::FitHiGainHists(MHCalibrationPix &hist,
|
---|
1193 | MCalibrationPix &pix,
|
---|
1194 | MBadPixelsPix &bad,
|
---|
1195 | MBadPixelsPix::UncalibratedType_t fittyp,
|
---|
1196 | MBadPixelsPix::UncalibratedType_t osctyp)
|
---|
1197 | {
|
---|
1198 |
|
---|
1199 | if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow())
|
---|
1200 | return;
|
---|
1201 |
|
---|
1202 | //
|
---|
1203 | // 2) Fit the Hi Gain histograms with a Gaussian
|
---|
1204 | //
|
---|
1205 | if (!hist.FitGaus())
|
---|
1206 | //
|
---|
1207 | // 3) In case of failure set the bit Fitted to false and take histogram means and RMS
|
---|
1208 | //
|
---|
1209 | if (!hist.RepeatFit())
|
---|
1210 | {
|
---|
1211 | hist.BypassFit();
|
---|
1212 | bad.SetUncalibrated( fittyp );
|
---|
1213 | }
|
---|
1214 |
|
---|
1215 | //
|
---|
1216 | // 4) Check for oscillations
|
---|
1217 | //
|
---|
1218 | if (IsOscillations())
|
---|
1219 | {
|
---|
1220 | hist.CreateFourierSpectrum();
|
---|
1221 |
|
---|
1222 | if (!hist.IsFourierSpectrumOK())
|
---|
1223 | bad.SetUncalibrated( osctyp );
|
---|
1224 | }
|
---|
1225 |
|
---|
1226 | //
|
---|
1227 | // 5) Retrieve the results and store them in this class
|
---|
1228 | //
|
---|
1229 | pix.SetHiGainMean ( hist.GetMean() );
|
---|
1230 | pix.SetHiGainMeanVar ( hist.GetMeanErr() * hist.GetMeanErr() );
|
---|
1231 | pix.SetHiGainRms ( hist.GetHistRms() );
|
---|
1232 | pix.SetHiGainSigma ( hist.GetSigma() );
|
---|
1233 | pix.SetHiGainSigmaVar ( hist.GetSigmaErr()* hist.GetSigmaErr() );
|
---|
1234 | pix.SetHiGainProb ( hist.GetProb() );
|
---|
1235 | pix.SetHiGainNumBlackout( hist.GetBlackout() );
|
---|
1236 | pix.SetHiGainNumPickup ( hist.GetPickup() );
|
---|
1237 |
|
---|
1238 | if (IsDebug())
|
---|
1239 | {
|
---|
1240 | *fLog << dbginf << GetDescriptor() << ": ID " << GetName()
|
---|
1241 | << " HiGainSaturation: " << pix.IsHiGainSaturation()
|
---|
1242 | << " HiGainMean: " << hist.GetMean ()
|
---|
1243 | << " HiGainMeanErr: " << hist.GetMeanErr ()
|
---|
1244 | << " HiGainMeanSigma: " << hist.GetSigma ()
|
---|
1245 | << " HiGainMeanSigmaErr: " << hist.GetSigmaErr()
|
---|
1246 | << " HiGainMeanProb: " << hist.GetProb ()
|
---|
1247 | << " HiGainNumBlackout: " << hist.GetBlackout()
|
---|
1248 | << " HiGainNumPickup : " << hist.GetPickup ()
|
---|
1249 | << endl;
|
---|
1250 | }
|
---|
1251 |
|
---|
1252 | }
|
---|
1253 |
|
---|
1254 |
|
---|
1255 | // ---------------------------------------------------------------------------
|
---|
1256 | //
|
---|
1257 | // Returns if the histogram is empty and sets the following flag:
|
---|
1258 | // - MBadPixelsPix::SetUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
---|
1259 | //
|
---|
1260 | // Fits the histograms with a Gaussian, in case of failure
|
---|
1261 | // calls MHCalibrationPix::RepeatFit(), in case of repeated failure
|
---|
1262 | // calls MHCalibrationPix::BypassFit() and sets the following flags:
|
---|
1263 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::UncalibratedType_t fittyp )
|
---|
1264 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
1265 | //
|
---|
1266 | // Creates the fourier spectrum and tests MHGausEvents::IsFourierSpectrumOK().
|
---|
1267 | // In case no, sets the following flags:
|
---|
1268 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::UncalibratedType_t osctyp )
|
---|
1269 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
1270 | //
|
---|
1271 | // Retrieves the results and store them in MCalibrationPix
|
---|
1272 | //
|
---|
1273 | void MHCalibrationCam::FitLoGainHists(MHCalibrationPix &hist,
|
---|
1274 | MCalibrationPix &pix,
|
---|
1275 | MBadPixelsPix &bad,
|
---|
1276 | MBadPixelsPix::UncalibratedType_t fittyp,
|
---|
1277 | MBadPixelsPix::UncalibratedType_t osctyp)
|
---|
1278 | {
|
---|
1279 |
|
---|
1280 | if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow())
|
---|
1281 | return;
|
---|
1282 |
|
---|
1283 |
|
---|
1284 | //
|
---|
1285 | // 2) Fit the Hi Gain histograms with a Gaussian
|
---|
1286 | //
|
---|
1287 | if (!hist.FitGaus())
|
---|
1288 | //
|
---|
1289 | // 3) In case of failure set the bit Fitted to false and take histogram means and RMS
|
---|
1290 | //
|
---|
1291 | if (!hist.RepeatFit())
|
---|
1292 | {
|
---|
1293 | hist.BypassFit();
|
---|
1294 | if (pix.IsHiGainSaturation())
|
---|
1295 | bad.SetUncalibrated( fittyp );
|
---|
1296 | }
|
---|
1297 |
|
---|
1298 | //
|
---|
1299 | // 4) Check for oscillations
|
---|
1300 | //
|
---|
1301 | if (IsOscillations())
|
---|
1302 | {
|
---|
1303 | hist.CreateFourierSpectrum();
|
---|
1304 |
|
---|
1305 | if (!hist.IsFourierSpectrumOK())
|
---|
1306 | bad.SetUncalibrated( osctyp );
|
---|
1307 | }
|
---|
1308 |
|
---|
1309 | //
|
---|
1310 | // 5) Retrieve the results and store them in this class
|
---|
1311 | //
|
---|
1312 | pix.SetLoGainMean ( hist.GetMean() );
|
---|
1313 | pix.SetLoGainMeanVar ( hist.GetMeanErr() * hist.GetMeanErr() );
|
---|
1314 | pix.SetLoGainRms ( hist.GetHistRms() );
|
---|
1315 | pix.SetLoGainSigma ( hist.GetSigma() );
|
---|
1316 | pix.SetLoGainSigmaVar ( hist.GetSigmaErr() * hist.GetSigmaErr() );
|
---|
1317 | pix.SetLoGainProb ( hist.GetProb() );
|
---|
1318 | pix.SetLoGainNumBlackout( hist.GetBlackout() );
|
---|
1319 | pix.SetLoGainNumPickup ( hist.GetPickup() );
|
---|
1320 |
|
---|
1321 | if (IsDebug())
|
---|
1322 | {
|
---|
1323 | *fLog << dbginf << GetDescriptor() << "ID: " << hist.GetName()
|
---|
1324 | << " HiGainSaturation: " << pix.IsHiGainSaturation()
|
---|
1325 | << " LoGainMean: " << hist.GetMean ()
|
---|
1326 | << " LoGainMeanErr: " << hist.GetMeanErr ()
|
---|
1327 | << " LoGainMeanSigma: " << hist.GetSigma ()
|
---|
1328 | << " LoGainMeanSigmaErr: " << hist.GetSigmaErr()
|
---|
1329 | << " LoGainMeanProb: " << hist.GetProb ()
|
---|
1330 | << " LoGainNumBlackout: " << hist.GetBlackout()
|
---|
1331 | << " LoGainNumPickup : " << hist.GetPickup ()
|
---|
1332 | << endl;
|
---|
1333 | }
|
---|
1334 |
|
---|
1335 | }
|
---|
1336 |
|
---|
1337 |
|
---|
1338 |
|
---|
1339 | // -----------------------------------------------------------------------------
|
---|
1340 | //
|
---|
1341 | // Default draw:
|
---|
1342 | //
|
---|
1343 | // Displays the averaged areas, both High Gain and Low Gain
|
---|
1344 | //
|
---|
1345 | // Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
|
---|
1346 | //
|
---|
1347 | void MHCalibrationCam::Draw(const Option_t *opt)
|
---|
1348 | {
|
---|
1349 |
|
---|
1350 | if (!IsAverageing())
|
---|
1351 | return;
|
---|
1352 |
|
---|
1353 | const Int_t nareas = fAverageHiGainAreas->GetSize();
|
---|
1354 | if (nareas == 0)
|
---|
1355 | return;
|
---|
1356 |
|
---|
1357 | TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
|
---|
1358 | pad->SetBorderMode(0);
|
---|
1359 |
|
---|
1360 | pad->Divide(IsLoGain() ? 2 : 1,nareas);
|
---|
1361 |
|
---|
1362 | for (Int_t i=0; i<nareas;i++)
|
---|
1363 | {
|
---|
1364 |
|
---|
1365 | pad->cd(IsLoGain() ? 2*(i+1)-1 : i+1);
|
---|
1366 | GetAverageHiGainArea(i).Draw(opt);
|
---|
1367 |
|
---|
1368 | if (!fAverageAreaSat[i])
|
---|
1369 | DrawAverageSigma(fAverageAreaSat[i], i,
|
---|
1370 | fAverageAreaSigma[i], fAverageAreaSigmaVar[i],
|
---|
1371 | fAverageAreaRelSigma[i], fAverageAreaRelSigmaVar[i]);
|
---|
1372 |
|
---|
1373 | if (IsLoGain())
|
---|
1374 | {
|
---|
1375 | pad->cd(2*(i+1));
|
---|
1376 | GetAverageLoGainArea(i).Draw(opt);
|
---|
1377 | }
|
---|
1378 |
|
---|
1379 | if (fAverageAreaSat[i])
|
---|
1380 | DrawAverageSigma(fAverageAreaSat[i], i,
|
---|
1381 | fAverageAreaSigma[i], fAverageAreaSigmaVar[i],
|
---|
1382 | fAverageAreaRelSigma[i], fAverageAreaRelSigmaVar[i]);
|
---|
1383 | }
|
---|
1384 |
|
---|
1385 | }
|
---|
1386 |
|
---|
1387 | // -----------------------------------------------------------------------------
|
---|
1388 | //
|
---|
1389 | // Default draw:
|
---|
1390 | //
|
---|
1391 | // Displays a TPaveText with the re-normalized sigmas of the average area
|
---|
1392 | //
|
---|
1393 | void MHCalibrationCam::DrawAverageSigma(Bool_t sat, Bool_t inner,
|
---|
1394 | Float_t sigma, Float_t sigmavar,
|
---|
1395 | Float_t relsigma, Float_t relsigmavar) const
|
---|
1396 | {
|
---|
1397 |
|
---|
1398 | if (sigma != 0 && sigmavar >= 0 && relsigmavar >= 0.)
|
---|
1399 | {
|
---|
1400 |
|
---|
1401 | TPad *newpad = new TPad("newpad","transparent",0,0,1,1);
|
---|
1402 | newpad->SetFillStyle(4000);
|
---|
1403 | newpad->Draw();
|
---|
1404 | newpad->cd();
|
---|
1405 |
|
---|
1406 | TPaveText *text = new TPaveText(sat? 0.1 : 0.35,0.7,sat ? 0.4 : 0.7,1.0);
|
---|
1407 | text->SetTextSize(0.07);
|
---|
1408 | const TString line1 = Form("%s%s%s",inner ? "Outer" : "Inner",
|
---|
1409 | " Pixels ", sat ? "Low Gain" : "High Gain");
|
---|
1410 | TText *txt1 = text->AddText(line1.Data());
|
---|
1411 | const TString line2 = Form("#sigma per pix: %2.2f #pm %2.2f",sigma,TMath::Sqrt(sigmavar));
|
---|
1412 | TText *txt2 = text->AddText(line2.Data());
|
---|
1413 | const TString line3 = Form("Rel. #sigma per pix: %2.2f #pm %2.2f",relsigma,TMath::Sqrt(relsigmavar));
|
---|
1414 | TText *txt3 = text->AddText(line3.Data());
|
---|
1415 | text->Draw("");
|
---|
1416 |
|
---|
1417 | text->SetBit(kCanDelete);
|
---|
1418 | txt1->SetBit(kCanDelete);
|
---|
1419 | txt2->SetBit(kCanDelete);
|
---|
1420 | txt3->SetBit(kCanDelete);
|
---|
1421 | newpad->SetBit(kCanDelete);
|
---|
1422 | }
|
---|
1423 | }
|
---|
1424 |
|
---|
1425 | Int_t MHCalibrationCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
|
---|
1426 | {
|
---|
1427 |
|
---|
1428 | Bool_t rc = kFALSE;
|
---|
1429 | if (IsEnvDefined(env, prefix, "Debug", print))
|
---|
1430 | {
|
---|
1431 | SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug()));
|
---|
1432 | rc = kTRUE;
|
---|
1433 | }
|
---|
1434 | if (IsEnvDefined(env, prefix, "LoGain", print))
|
---|
1435 | {
|
---|
1436 | SetDebug(GetEnvValue(env, prefix, "LoGain", IsLoGain()));
|
---|
1437 | rc = kTRUE;
|
---|
1438 | }
|
---|
1439 | if (IsEnvDefined(env, prefix, "Oscillations", print))
|
---|
1440 | {
|
---|
1441 | SetOscillations(GetEnvValue(env, prefix, "Oscillations", IsOscillations()));
|
---|
1442 | rc = kTRUE;
|
---|
1443 | }
|
---|
1444 | if (IsEnvDefined(env, prefix, "SizeCheck", print))
|
---|
1445 | {
|
---|
1446 | SetSizeCheck(GetEnvValue(env, prefix, "SizeCheck", IsSizeCheck()));
|
---|
1447 | rc = kTRUE;
|
---|
1448 | }
|
---|
1449 | if (IsEnvDefined(env, prefix, "Averageing", print))
|
---|
1450 | {
|
---|
1451 | SetAverageing(GetEnvValue(env, prefix, "Averageing", IsAverageing()));
|
---|
1452 | rc = kTRUE;
|
---|
1453 | }
|
---|
1454 |
|
---|
1455 | if (IsEnvDefined(env, prefix, "Nbins", print))
|
---|
1456 | {
|
---|
1457 | SetNbins(GetEnvValue(env, prefix, "Nbins", fNbins));
|
---|
1458 | rc = kTRUE;
|
---|
1459 | }
|
---|
1460 | if (IsEnvDefined(env, prefix, "First", print))
|
---|
1461 | {
|
---|
1462 | SetFirst(GetEnvValue(env, prefix, "First", fFirst));
|
---|
1463 | rc = kTRUE;
|
---|
1464 | }
|
---|
1465 | if (IsEnvDefined(env, prefix, "Last", print))
|
---|
1466 | {
|
---|
1467 | SetLast(GetEnvValue(env, prefix, "Last", fLast));
|
---|
1468 | rc = kTRUE;
|
---|
1469 | }
|
---|
1470 |
|
---|
1471 | return rc;
|
---|
1472 | }
|
---|
1473 |
|
---|