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