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 TObjArray'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 TObjArray'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 MHGausEvents.
|
---|
42 | //
|
---|
43 | // The following flag can be set:
|
---|
44 | // - SetDebug() for debug output.
|
---|
45 | // - SetLoGain() for the case that low-gain slices are available, but
|
---|
46 | // MRawRunHeader::GetNumLoGainSlices() gives still 0.
|
---|
47 | //
|
---|
48 | // The flag fLoGain steers if low-gain signal is treated at all or not.
|
---|
49 | //
|
---|
50 | /////////////////////////////////////////////////////////////////////////////
|
---|
51 | #include "MHCalibrationCam.h"
|
---|
52 |
|
---|
53 | #include <TVirtualPad.h>
|
---|
54 | #include <TCanvas.h>
|
---|
55 | #include <TPad.h>
|
---|
56 | #include <TText.h>
|
---|
57 | #include <TPaveText.h>
|
---|
58 |
|
---|
59 | #include "MLog.h"
|
---|
60 | #include "MLogManip.h"
|
---|
61 |
|
---|
62 | #include "MCalibrationPix.h"
|
---|
63 | #include "MCalibrationCam.h"
|
---|
64 |
|
---|
65 | #include "MHGausEvents.h"
|
---|
66 |
|
---|
67 | #include "MBadPixelsPix.h"
|
---|
68 | #include "MBadPixelsCam.h"
|
---|
69 |
|
---|
70 | #include "MGeomCam.h"
|
---|
71 | #include "MGeomPix.h"
|
---|
72 |
|
---|
73 | #include "MParList.h"
|
---|
74 |
|
---|
75 | #include "MRawRunHeader.h"
|
---|
76 |
|
---|
77 | ClassImp(MHCalibrationCam);
|
---|
78 |
|
---|
79 | using namespace std;
|
---|
80 |
|
---|
81 | const Int_t MHCalibrationCam::fgAverageNbins = 2000;
|
---|
82 | const Int_t MHCalibrationCam::fgPulserFrequency = 500;
|
---|
83 |
|
---|
84 | // --------------------------------------------------------------------------
|
---|
85 | //
|
---|
86 | // Default Constructor.
|
---|
87 | //
|
---|
88 | // Sets:
|
---|
89 | // - all pointers to NULL
|
---|
90 | //
|
---|
91 | // Initializes and sets owner of:
|
---|
92 | // - fHiGainArray, fLoGainArray
|
---|
93 | // - fAverageHiGainAreas, fAverageLoGainAreas
|
---|
94 | // - fAverageHiGainSectors, fAverageLoGainSectors
|
---|
95 | //
|
---|
96 | // Initializes:
|
---|
97 | // - fPulserFrequency to fgPulserFrequency
|
---|
98 | //
|
---|
99 | MHCalibrationCam::MHCalibrationCam(const char *name, const char *title)
|
---|
100 | : fColor(MCalibrationCam::kNONE),
|
---|
101 | fBadPixels(NULL), fCam(NULL), fGeom(NULL), fRunHeader(NULL),
|
---|
102 | fDebug(kFALSE), fLoGain(kFALSE)
|
---|
103 | {
|
---|
104 |
|
---|
105 | fHiGainArray = new TObjArray;
|
---|
106 | fHiGainArray->SetOwner();
|
---|
107 |
|
---|
108 | fLoGainArray = new TObjArray;
|
---|
109 | fLoGainArray->SetOwner();
|
---|
110 |
|
---|
111 | fAverageHiGainAreas = new TObjArray;
|
---|
112 | fAverageHiGainAreas->SetOwner();
|
---|
113 |
|
---|
114 | fAverageLoGainAreas = new TObjArray;
|
---|
115 | fAverageLoGainAreas->SetOwner();
|
---|
116 |
|
---|
117 | fAverageHiGainSectors = new TObjArray;
|
---|
118 | fAverageHiGainSectors->SetOwner();
|
---|
119 |
|
---|
120 | fAverageLoGainSectors = new TObjArray;
|
---|
121 | fAverageLoGainSectors->SetOwner();
|
---|
122 |
|
---|
123 | SetAverageNbins();
|
---|
124 | SetPulserFrequency();
|
---|
125 |
|
---|
126 | }
|
---|
127 |
|
---|
128 | const Int_t MHCalibrationCam::GetSize() const
|
---|
129 | {
|
---|
130 | return fHiGainArray->GetSize();
|
---|
131 | }
|
---|
132 |
|
---|
133 | // --------------------------------------------------------------------------
|
---|
134 | //
|
---|
135 | // Deletes the TClonesArray of:
|
---|
136 | // - fHiGainArray, fLoGainArray
|
---|
137 | // - fAverageHiGainAreas, fAverageLoGainAreas
|
---|
138 | // - fAverageHiGainSectors, fAverageLoGainSectors
|
---|
139 | //
|
---|
140 | MHCalibrationCam::~MHCalibrationCam()
|
---|
141 | {
|
---|
142 |
|
---|
143 | delete fHiGainArray;
|
---|
144 | delete fLoGainArray;
|
---|
145 |
|
---|
146 | delete fAverageHiGainAreas;
|
---|
147 | delete fAverageLoGainAreas;
|
---|
148 |
|
---|
149 | delete fAverageHiGainSectors;
|
---|
150 | delete fAverageLoGainSectors;
|
---|
151 | }
|
---|
152 |
|
---|
153 | // --------------------------------------------------------------------------
|
---|
154 | //
|
---|
155 | // Get i-th High Gain pixel (pixel number)
|
---|
156 | //
|
---|
157 | MHGausEvents &MHCalibrationCam::operator[](UInt_t i)
|
---|
158 | {
|
---|
159 | return *static_cast<MHGausEvents*>(fHiGainArray->UncheckedAt(i));
|
---|
160 | }
|
---|
161 |
|
---|
162 | // --------------------------------------------------------------------------
|
---|
163 | //
|
---|
164 | // Get i-th High Gain pixel (pixel number)
|
---|
165 | //
|
---|
166 | const MHGausEvents &MHCalibrationCam::operator[](UInt_t i) const
|
---|
167 | {
|
---|
168 | return *static_cast<MHGausEvents*>(fHiGainArray->UncheckedAt(i));
|
---|
169 | }
|
---|
170 |
|
---|
171 | // --------------------------------------------------------------------------
|
---|
172 | //
|
---|
173 | // Get i-th Low Gain pixel (pixel number)
|
---|
174 | //
|
---|
175 | MHGausEvents &MHCalibrationCam::operator()(UInt_t i)
|
---|
176 | {
|
---|
177 | return *static_cast<MHGausEvents*>(fLoGainArray->UncheckedAt(i));
|
---|
178 | }
|
---|
179 |
|
---|
180 | // --------------------------------------------------------------------------
|
---|
181 | //
|
---|
182 | // Get i-th Low Gain pixel (pixel number)
|
---|
183 | //
|
---|
184 | const MHGausEvents &MHCalibrationCam::operator()(UInt_t i) const
|
---|
185 | {
|
---|
186 | return *static_cast<MHGausEvents*>(fLoGainArray->UncheckedAt(i));
|
---|
187 | }
|
---|
188 |
|
---|
189 | // --------------------------------------------------------------------------
|
---|
190 | //
|
---|
191 | // Returns the current size of the TObjArray fAverageHiGainAreas
|
---|
192 | // independently if the MHGausEvents is filled with values or not.
|
---|
193 | //
|
---|
194 | const Int_t MHCalibrationCam::GetAverageAreas() const
|
---|
195 | {
|
---|
196 | return fAverageHiGainAreas->GetEntries();
|
---|
197 | }
|
---|
198 |
|
---|
199 | // --------------------------------------------------------------------------
|
---|
200 | //
|
---|
201 | // Get i-th High Gain pixel Area (area number)
|
---|
202 | //
|
---|
203 | MHGausEvents &MHCalibrationCam::GetAverageHiGainArea(UInt_t i)
|
---|
204 | {
|
---|
205 | return *static_cast<MHGausEvents*>(fAverageHiGainAreas->UncheckedAt(i));
|
---|
206 | }
|
---|
207 |
|
---|
208 | // --------------------------------------------------------------------------
|
---|
209 | //
|
---|
210 | // Get i-th High Gain pixel Area (area number)
|
---|
211 | //
|
---|
212 | const MHGausEvents &MHCalibrationCam::GetAverageHiGainArea(UInt_t i) const
|
---|
213 | {
|
---|
214 | return *static_cast<MHGausEvents *>(fAverageHiGainAreas->UncheckedAt(i));
|
---|
215 | }
|
---|
216 |
|
---|
217 | // --------------------------------------------------------------------------
|
---|
218 | //
|
---|
219 | // Get i-th Low Gain pixel Area (area number)
|
---|
220 | //
|
---|
221 | MHGausEvents &MHCalibrationCam::GetAverageLoGainArea(UInt_t i)
|
---|
222 | {
|
---|
223 | return *static_cast<MHGausEvents*>(fAverageLoGainAreas->UncheckedAt(i));
|
---|
224 | }
|
---|
225 |
|
---|
226 | // --------------------------------------------------------------------------
|
---|
227 | //
|
---|
228 | // Get i-th Low Gain pixel Area (area number)
|
---|
229 | //
|
---|
230 | const MHGausEvents &MHCalibrationCam::GetAverageLoGainArea(UInt_t i) const
|
---|
231 | {
|
---|
232 | return *static_cast<MHGausEvents*>(fAverageLoGainAreas->UncheckedAt(i));
|
---|
233 | }
|
---|
234 |
|
---|
235 | // --------------------------------------------------------------------------
|
---|
236 | //
|
---|
237 | // Returns the current size of the TObjArray fAverageHiGainSectors
|
---|
238 | // independently if the MHGausEvents is filled with values or not.
|
---|
239 | //
|
---|
240 | const Int_t MHCalibrationCam::GetAverageSectors() const
|
---|
241 | {
|
---|
242 | return fAverageHiGainSectors->GetEntries();
|
---|
243 | }
|
---|
244 |
|
---|
245 | // --------------------------------------------------------------------------
|
---|
246 | //
|
---|
247 | // Get i-th High Gain Sector (sector number)
|
---|
248 | //
|
---|
249 | MHGausEvents &MHCalibrationCam::GetAverageHiGainSector(UInt_t i)
|
---|
250 | {
|
---|
251 | return *static_cast<MHGausEvents*>(fAverageHiGainSectors->UncheckedAt(i));
|
---|
252 | }
|
---|
253 |
|
---|
254 | // --------------------------------------------------------------------------
|
---|
255 | //
|
---|
256 | // Get i-th High Gain Sector (sector number)
|
---|
257 | //
|
---|
258 | const MHGausEvents &MHCalibrationCam::GetAverageHiGainSector(UInt_t i) const
|
---|
259 | {
|
---|
260 | return *static_cast<MHGausEvents*>(fAverageHiGainSectors->UncheckedAt(i));
|
---|
261 | }
|
---|
262 |
|
---|
263 | // --------------------------------------------------------------------------
|
---|
264 | //
|
---|
265 | // Get i-th Low Gain Sector (sector number)
|
---|
266 | //
|
---|
267 | MHGausEvents &MHCalibrationCam::GetAverageLoGainSector(UInt_t i)
|
---|
268 | {
|
---|
269 | return *static_cast<MHGausEvents*>(fAverageLoGainSectors->UncheckedAt(i));
|
---|
270 | }
|
---|
271 |
|
---|
272 | // --------------------------------------------------------------------------
|
---|
273 | //
|
---|
274 | // Get i-th Low Gain Sector (sector number)
|
---|
275 | //
|
---|
276 | const MHGausEvents &MHCalibrationCam::GetAverageLoGainSector(UInt_t i) const
|
---|
277 | {
|
---|
278 | return *static_cast<MHGausEvents*>(fAverageLoGainSectors->UncheckedAt(i));
|
---|
279 | }
|
---|
280 |
|
---|
281 |
|
---|
282 | const TArrayI &MHCalibrationCam::GetRunNumbers() const
|
---|
283 | {
|
---|
284 | return fRunNumbers;
|
---|
285 | }
|
---|
286 |
|
---|
287 | // --------------------------------------------------------------------------
|
---|
288 | //
|
---|
289 | // Our own clone function is necessary since root 3.01/06 or Mars 0.4
|
---|
290 | // I don't know the reason.
|
---|
291 | //
|
---|
292 | // Creates new MHCalibrationCam
|
---|
293 | // Deletes the TObjArray's and Clones them individually
|
---|
294 | // Copies the TArray's
|
---|
295 | // Copies the fPulserFrequency
|
---|
296 | //
|
---|
297 | TObject *MHCalibrationCam::Clone(const char *) const
|
---|
298 | {
|
---|
299 |
|
---|
300 | // const Int_t nhi = fHiGainArray->GetEntries();
|
---|
301 | // const Int_t nlo = fLoGainArray->GetEntries();
|
---|
302 | const Int_t navhi = fAverageHiGainAreas->GetEntries();
|
---|
303 | const Int_t navlo = fAverageLoGainAreas->GetEntries();
|
---|
304 | const Int_t nsehi = fAverageHiGainSectors->GetEntries();
|
---|
305 | const Int_t nselo = fAverageLoGainSectors->GetEntries();
|
---|
306 |
|
---|
307 | //
|
---|
308 | // FIXME, this might be done faster and more elegant, by direct copy.
|
---|
309 | //
|
---|
310 | MHCalibrationCam *cam = new MHCalibrationCam();
|
---|
311 |
|
---|
312 | // cam->fHiGainArray->Expand(nhi);
|
---|
313 | // cam->fLoGainArray->Expand(nlo);
|
---|
314 | cam->fAverageHiGainAreas->Expand(navhi);
|
---|
315 | cam->fAverageLoGainAreas->Expand(navlo);
|
---|
316 | cam->fAverageHiGainSectors->Expand(nsehi);
|
---|
317 | cam->fAverageLoGainSectors->Expand(nselo);
|
---|
318 |
|
---|
319 | /*
|
---|
320 | for (int i=0; i<nhi; i++)
|
---|
321 | {
|
---|
322 | delete (*cam->fHiGainArray)[i];
|
---|
323 | (*cam->fHiGainArray)[i] = (*fHiGainArray)[i]->Clone();
|
---|
324 | }
|
---|
325 | for (int i=0; i<nlo; i++)
|
---|
326 | {
|
---|
327 | delete (*cam->fLoGainArray)[i];
|
---|
328 | (*cam->fLoGainArray)[i] = (*fLoGainArray)[i]->Clone();
|
---|
329 | }
|
---|
330 | */
|
---|
331 |
|
---|
332 | for (int i=0; i<navhi; i++)
|
---|
333 | {
|
---|
334 | // delete (*cam->fAverageHiGainAreas)[i];
|
---|
335 | (*cam->fAverageHiGainAreas)[i] = (*fAverageHiGainAreas)[i]->Clone();
|
---|
336 | }
|
---|
337 | for (int i=0; i<navlo; i++)
|
---|
338 | {
|
---|
339 | // delete (*cam->fAverageLoGainAreas)[i];
|
---|
340 | (*cam->fAverageLoGainAreas)[i] = (*fAverageLoGainAreas)[i]->Clone();
|
---|
341 | }
|
---|
342 | for (int i=0; i<nsehi; i++)
|
---|
343 | {
|
---|
344 | // delete (*cam->fAverageHiGainSectors)[i];
|
---|
345 | (*cam->fAverageHiGainSectors)[i] = (*fAverageHiGainSectors)[i]->Clone();
|
---|
346 | }
|
---|
347 | for (int i=0; i<nselo; i++)
|
---|
348 | {
|
---|
349 | // delete (*cam->fAverageLoGainSectors)[i];
|
---|
350 | (*cam->fAverageLoGainSectors)[i] = (*fAverageLoGainSectors)[i]->Clone();
|
---|
351 | }
|
---|
352 |
|
---|
353 | cam->fAverageAreaNum = fAverageAreaNum;
|
---|
354 | cam->fAverageAreaSat = fAverageAreaSat;
|
---|
355 | cam->fAverageAreaSigma = fAverageAreaSigma;
|
---|
356 | cam->fAverageAreaSigmaVar = fAverageAreaSigmaVar;
|
---|
357 | cam->fAverageAreaRelSigma = fAverageAreaRelSigma;
|
---|
358 | cam->fAverageAreaRelSigmaVar = fAverageAreaRelSigmaVar;
|
---|
359 | cam->fAverageSectorNum = fAverageSectorNum;
|
---|
360 | cam->fRunNumbers = fRunNumbers;
|
---|
361 |
|
---|
362 | cam->fPulserFrequency = fPulserFrequency;
|
---|
363 | cam->fAverageNbins = fAverageNbins;
|
---|
364 |
|
---|
365 | return cam;
|
---|
366 | }
|
---|
367 |
|
---|
368 | // --------------------------------------------------------------------------
|
---|
369 | //
|
---|
370 | // Gets the pointers to:
|
---|
371 | // - MGeomCam
|
---|
372 | //
|
---|
373 | // Calls SetupHists(const MParList *pList)
|
---|
374 | //
|
---|
375 | // Calls Delete-Function of:
|
---|
376 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
---|
377 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
378 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
379 | //
|
---|
380 | Bool_t MHCalibrationCam::SetupFill(const MParList *pList)
|
---|
381 | {
|
---|
382 |
|
---|
383 | fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
|
---|
384 | if (!fGeom)
|
---|
385 | {
|
---|
386 | *fLog << err << GetDescriptor()
|
---|
387 | << ": MGeomCam not found... aborting." << endl;
|
---|
388 | return kFALSE;
|
---|
389 | }
|
---|
390 |
|
---|
391 | fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
|
---|
392 | if (!fRunHeader)
|
---|
393 | {
|
---|
394 | *fLog << warn << GetDescriptor()
|
---|
395 | << ": MRawRunHeader not found... will not store run numbers." << endl;
|
---|
396 | }
|
---|
397 |
|
---|
398 | fHiGainArray->Delete();
|
---|
399 | fLoGainArray->Delete();
|
---|
400 |
|
---|
401 | fAverageHiGainAreas->Delete();
|
---|
402 | fAverageLoGainAreas->Delete();
|
---|
403 |
|
---|
404 | fAverageHiGainSectors->Delete();
|
---|
405 | fAverageLoGainSectors->Delete();
|
---|
406 |
|
---|
407 | return SetupHists(pList);
|
---|
408 | }
|
---|
409 |
|
---|
410 |
|
---|
411 | Bool_t MHCalibrationCam::SetupHists(const MParList *pList)
|
---|
412 | {
|
---|
413 | return kTRUE;
|
---|
414 | }
|
---|
415 |
|
---|
416 | // --------------------------------------------------------------------------
|
---|
417 | //
|
---|
418 | // Gets or creates the pointers to:
|
---|
419 | // - MBadPixelsCam
|
---|
420 | //
|
---|
421 | // Searches pointer to:
|
---|
422 | // - MArrivalTimeCam
|
---|
423 | //
|
---|
424 | // Initializes, if empty to MArrivalTimeCam::GetSize() for:
|
---|
425 | // - MHCalibrationCam::fHiGainArray, MHCalibrationCam::fLoGainArray
|
---|
426 | //
|
---|
427 | // Initializes, if empty to MGeomCam::GetNumAreas() for:
|
---|
428 | // - MHCalibrationCam::fAverageHiGainAreas, MHCalibrationCam::fAverageLoGainAreas
|
---|
429 | //
|
---|
430 | // Initializes, if empty to MGeomCam::GetNumSectors() for:
|
---|
431 | // - MHCalibrationCam::fAverageHiGainSectors, MHCalibrationCam::fAverageLoGainSectors
|
---|
432 | //
|
---|
433 | // Initializes TArray's to MGeomCam::GetNumAreas and MGeomCam::GetNumSectors, respectively
|
---|
434 | // Fills with number of valid pixels (if !MBadPixelsPix::IsBad()):
|
---|
435 | // - MHCalibrationCam::fAverageAreaNum[area index]
|
---|
436 | // - MHCalibrationCam::fAverageSectorNum[area index]
|
---|
437 | //
|
---|
438 | // Calls InitializeHists() for every entry in:
|
---|
439 | // - MHCalibrationCam::fHiGainArray
|
---|
440 | // - MHCalibrationCam::fAverageHiGainAreas
|
---|
441 | // - MHCalibrationCam::fAverageHiGainSectors
|
---|
442 | //
|
---|
443 | // Sets Titles and Names for the Histograms
|
---|
444 | // - MHCalibrationCam::fAverageHiGainAreas
|
---|
445 | // - MHCalibrationCam::fAverageHiGainSectors
|
---|
446 | //
|
---|
447 | // Retrieves the run numbers from MRawRunHeader and stores them in fRunNumbers
|
---|
448 | //
|
---|
449 | Bool_t MHCalibrationCam::ReInit(MParList *pList)
|
---|
450 | {
|
---|
451 |
|
---|
452 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
453 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
454 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
455 |
|
---|
456 | fBadPixels = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam");
|
---|
457 | if (!fBadPixels)
|
---|
458 | {
|
---|
459 |
|
---|
460 | fBadPixels = (MBadPixelsCam*)pList->FindCreateObj(AddSerialNumber("MBadPixelsCam"));
|
---|
461 | if (!fBadPixels)
|
---|
462 | {
|
---|
463 | *fLog << err << "Cannot find nor create MBadPixelsCam ... abort." << endl;
|
---|
464 | return kFALSE;
|
---|
465 | }
|
---|
466 | else
|
---|
467 | fBadPixels->InitSize(npixels);
|
---|
468 | }
|
---|
469 |
|
---|
470 | //
|
---|
471 | // The function TArrayF::Set() already sets all entries to 0.
|
---|
472 | //
|
---|
473 | fAverageAreaNum. Set(nareas);
|
---|
474 | fAverageAreaSat. Set(nareas);
|
---|
475 | fAverageAreaSigma. Set(nareas);
|
---|
476 | fAverageAreaSigmaVar. Set(nareas);
|
---|
477 | fAverageAreaRelSigma. Set(nareas);
|
---|
478 | fAverageAreaRelSigmaVar.Set(nareas);
|
---|
479 | fAverageSectorNum. Set(nsectors);
|
---|
480 | fRunNumbers. Set(fRunNumbers.GetSize()+1);
|
---|
481 |
|
---|
482 | for (Int_t aidx=0; aidx<nareas; aidx++)
|
---|
483 | fAverageAreaNum[aidx] = 0;
|
---|
484 |
|
---|
485 | for (Int_t sector=0; sector<nsectors; sector++)
|
---|
486 | fAverageSectorNum[sector] = 0;
|
---|
487 |
|
---|
488 | for (Int_t i=0; i<npixels; i++)
|
---|
489 | {
|
---|
490 |
|
---|
491 | if ((*fBadPixels)[i].IsBad())
|
---|
492 | continue;
|
---|
493 |
|
---|
494 | fAverageAreaNum [(*fGeom)[i].GetAidx() ]++;
|
---|
495 | fAverageSectorNum[(*fGeom)[i].GetSector()]++;
|
---|
496 | }
|
---|
497 |
|
---|
498 | if (fRunHeader)
|
---|
499 | {
|
---|
500 | fRunNumbers[fRunNumbers.GetSize()-1] = fRunHeader->GetRunNumber();
|
---|
501 | fLoGain = fRunHeader->GetNumSamplesLoGain();
|
---|
502 | }
|
---|
503 |
|
---|
504 | if (!ReInitHists(pList))
|
---|
505 | return kFALSE;
|
---|
506 |
|
---|
507 | if (!fRunHeader)
|
---|
508 | return kTRUE;
|
---|
509 |
|
---|
510 | for (Int_t i=0; i<fHiGainArray->GetEntries(); i++)
|
---|
511 | {
|
---|
512 | TH1F *h = (*this)[i].GetHGausHist();
|
---|
513 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
514 | }
|
---|
515 |
|
---|
516 | if (fLoGain)
|
---|
517 | for (Int_t i=0; i<fLoGainArray->GetEntries(); i++)
|
---|
518 | {
|
---|
519 | TH1F *h = (*this)(i).GetHGausHist();
|
---|
520 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
521 | }
|
---|
522 |
|
---|
523 | for (Int_t j=0; j<nareas; j++)
|
---|
524 | {
|
---|
525 | TH1F *h = GetAverageHiGainArea(j).GetHGausHist();
|
---|
526 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
527 | }
|
---|
528 |
|
---|
529 | if (fLoGain)
|
---|
530 | for (Int_t j=0; j<nareas; j++)
|
---|
531 | {
|
---|
532 | TH1F *h = GetAverageLoGainArea(j).GetHGausHist();
|
---|
533 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
534 | }
|
---|
535 |
|
---|
536 | for (Int_t j=0; j<nsectors; j++)
|
---|
537 | {
|
---|
538 | TH1F *h = GetAverageHiGainSector(j).GetHGausHist();
|
---|
539 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
540 | }
|
---|
541 |
|
---|
542 | if (fLoGain)
|
---|
543 | for (Int_t j=0; j<nsectors; j++)
|
---|
544 | {
|
---|
545 | TH1F *h = GetAverageLoGainSector(j).GetHGausHist();
|
---|
546 | h->SetTitle( Form("%s%i%s", h->GetTitle(),fRunNumbers[fRunNumbers.GetSize()-1]," "));
|
---|
547 | }
|
---|
548 |
|
---|
549 | return kTRUE;
|
---|
550 | }
|
---|
551 |
|
---|
552 |
|
---|
553 |
|
---|
554 | Bool_t MHCalibrationCam::ReInitHists(MParList *pList)
|
---|
555 | {
|
---|
556 | return kTRUE;
|
---|
557 | }
|
---|
558 |
|
---|
559 |
|
---|
560 |
|
---|
561 | //--------------------------------------------------------------------------------
|
---|
562 | //
|
---|
563 | // Retrieves from MGeomCam:
|
---|
564 | // - number of pixels
|
---|
565 | // - number of pixel areas
|
---|
566 | // - number of sectors
|
---|
567 | //
|
---|
568 | // For all TObjArray's (including the averaged ones), the following steps are performed:
|
---|
569 | //
|
---|
570 | // 1) Test size and return kFALSE if not matching
|
---|
571 | // 2)
|
---|
572 | //
|
---|
573 | Bool_t MHCalibrationCam::Fill(const MParContainer *par, const Stat_t w)
|
---|
574 | {
|
---|
575 |
|
---|
576 | const Int_t npixels = fGeom->GetNumPixels();
|
---|
577 | const Int_t nareas = fGeom->GetNumAreas();
|
---|
578 | const Int_t nsectors = fGeom->GetNumSectors();
|
---|
579 |
|
---|
580 | if (fHiGainArray->GetEntries() != npixels)
|
---|
581 | {
|
---|
582 | *fLog << err << "ERROR - Size mismatch... abort." << endl;
|
---|
583 | return kFALSE;
|
---|
584 | }
|
---|
585 |
|
---|
586 | if (fLoGain)
|
---|
587 | if (fLoGainArray->GetEntries() != npixels)
|
---|
588 | {
|
---|
589 | *fLog << err << "ERROR - Size mismatch... abort." << endl;
|
---|
590 | return kFALSE;
|
---|
591 | }
|
---|
592 |
|
---|
593 | if (fAverageHiGainAreas->GetEntries() != nareas)
|
---|
594 | {
|
---|
595 | *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
|
---|
596 | return kFALSE;
|
---|
597 | }
|
---|
598 |
|
---|
599 | if (fLoGain)
|
---|
600 | if (fAverageLoGainAreas->GetEntries() != nareas)
|
---|
601 | {
|
---|
602 | *fLog << err << "ERROR - Size mismatch in number of areas ... abort." << endl;
|
---|
603 | return kFALSE;
|
---|
604 | }
|
---|
605 |
|
---|
606 | if (fAverageHiGainSectors->GetEntries() != nsectors)
|
---|
607 | {
|
---|
608 | *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
|
---|
609 | return kFALSE;
|
---|
610 | }
|
---|
611 |
|
---|
612 | if (fLoGain)
|
---|
613 | if (fAverageLoGainSectors->GetEntries() != nsectors)
|
---|
614 | {
|
---|
615 | *fLog << err << "ERROR - Size mismatch in number of sectors ... abort." << endl;
|
---|
616 | return kFALSE;
|
---|
617 | }
|
---|
618 |
|
---|
619 | return FillHists(par, w);
|
---|
620 | }
|
---|
621 |
|
---|
622 | Bool_t MHCalibrationCam::FillHists(const MParContainer *par, const Stat_t w)
|
---|
623 | {
|
---|
624 | *fLog << warn << GetDescriptor() << "FillHists not overloaded! Can't be used!" << endl;
|
---|
625 | return kFALSE;
|
---|
626 | }
|
---|
627 |
|
---|
628 | // --------------------------------------------------------------------------
|
---|
629 | //
|
---|
630 | // 0) Ask if fHiGainArray and fLoGainArray have been initialized,
|
---|
631 | // otherwise return kFALSE.
|
---|
632 | // 1) FinalizeHists()
|
---|
633 | // 2) FinalizeBadPixels()
|
---|
634 | // 3) CalcAverageSigma()
|
---|
635 | //
|
---|
636 | Bool_t MHCalibrationCam::Finalize()
|
---|
637 | {
|
---|
638 |
|
---|
639 | if (fHiGainArray->GetEntries() == 0 && fLoGainArray->GetEntries() == 0)
|
---|
640 | {
|
---|
641 | *fLog << err << GetDescriptor()
|
---|
642 | << ": ERROR: Both (HiGain and LoGain) histogram arrays have not been initialized... abort." << endl;
|
---|
643 | return kFALSE;
|
---|
644 | }
|
---|
645 |
|
---|
646 | if (!FinalizeHists())
|
---|
647 | return kFALSE;
|
---|
648 |
|
---|
649 | FinalizeBadPixels();
|
---|
650 | CalcAverageSigma();
|
---|
651 |
|
---|
652 | return kTRUE;
|
---|
653 | }
|
---|
654 |
|
---|
655 | Bool_t MHCalibrationCam::FinalizeHists()
|
---|
656 | {
|
---|
657 | return kTRUE;
|
---|
658 | }
|
---|
659 |
|
---|
660 | void MHCalibrationCam::FinalizeBadPixels()
|
---|
661 | {
|
---|
662 | }
|
---|
663 |
|
---|
664 |
|
---|
665 | // -------------------------------------------------------------
|
---|
666 | //
|
---|
667 | // If MBadPixelsPix::IsBad():
|
---|
668 | // - calls MHGausEvents::SetExcluded()
|
---|
669 | //
|
---|
670 | // Calls:
|
---|
671 | // - MHGausEvents::InitBins()
|
---|
672 | // - MHGausEvents::ChangeHistId(i)
|
---|
673 | // - MHGausEvents::SetEventFrequency(fPulserFrequency)
|
---|
674 | //
|
---|
675 | void MHCalibrationCam::InitHists(MHGausEvents &hist, MBadPixelsPix &bad, const Int_t i)
|
---|
676 | {
|
---|
677 |
|
---|
678 | if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
679 | hist.SetExcluded();
|
---|
680 |
|
---|
681 | hist.InitBins();
|
---|
682 | hist.ChangeHistId(i);
|
---|
683 | hist.SetEventFrequency(fPulserFrequency);
|
---|
684 |
|
---|
685 | TH1F *h = hist.GetHGausHist();
|
---|
686 | h->SetTitle( Form("%s%s", h->GetTitle()," Runs: "));
|
---|
687 | }
|
---|
688 |
|
---|
689 | void MHCalibrationCam::FitHiGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
|
---|
690 | MBadPixelsPix::UncalibratedType_t fittyp,
|
---|
691 | MBadPixelsPix::UncalibratedType_t osctyp)
|
---|
692 | {
|
---|
693 |
|
---|
694 | for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
|
---|
695 | {
|
---|
696 |
|
---|
697 | MHGausEvents &hist = (*this)[i];
|
---|
698 |
|
---|
699 | if (hist.IsExcluded())
|
---|
700 | continue;
|
---|
701 |
|
---|
702 | MCalibrationPix &pix = calcam[i];
|
---|
703 | MBadPixelsPix &bad = badcam[i];
|
---|
704 |
|
---|
705 | FitHiGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
706 |
|
---|
707 | }
|
---|
708 |
|
---|
709 | for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
|
---|
710 | {
|
---|
711 |
|
---|
712 | MHGausEvents &hist = GetAverageHiGainArea(j);
|
---|
713 | MCalibrationPix &pix = calcam.GetAverageArea(j);
|
---|
714 | MBadPixelsPix &bad = calcam.GetAverageBadArea(j);
|
---|
715 |
|
---|
716 | FitHiGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
717 | }
|
---|
718 |
|
---|
719 |
|
---|
720 | for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
|
---|
721 | {
|
---|
722 |
|
---|
723 | MHGausEvents &hist = GetAverageHiGainSector(j);
|
---|
724 | MCalibrationPix &pix = calcam.GetAverageSector(j);
|
---|
725 | MBadPixelsPix &bad = calcam.GetAverageBadSector(j);
|
---|
726 |
|
---|
727 | FitHiGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
728 | }
|
---|
729 |
|
---|
730 | }
|
---|
731 |
|
---|
732 | void MHCalibrationCam::FitLoGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
|
---|
733 | MBadPixelsPix::UncalibratedType_t fittyp,
|
---|
734 | MBadPixelsPix::UncalibratedType_t osctyp)
|
---|
735 | {
|
---|
736 |
|
---|
737 | for (Int_t i=0; i<fLoGainArray->GetSize(); i++)
|
---|
738 | {
|
---|
739 |
|
---|
740 | MHGausEvents &hist = (*this)(i);
|
---|
741 |
|
---|
742 | if (hist.IsExcluded())
|
---|
743 | continue;
|
---|
744 |
|
---|
745 | MCalibrationPix &pix = calcam[i];
|
---|
746 | MBadPixelsPix &bad = badcam[i];
|
---|
747 |
|
---|
748 | FitLoGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
749 |
|
---|
750 | }
|
---|
751 |
|
---|
752 | for (Int_t j=0; j<fAverageLoGainAreas->GetSize(); j++)
|
---|
753 | {
|
---|
754 |
|
---|
755 | MHGausEvents &hist = GetAverageLoGainArea(j);
|
---|
756 | MCalibrationPix &pix = calcam.GetAverageArea(j);
|
---|
757 | MBadPixelsPix &bad = calcam.GetAverageBadArea(j);
|
---|
758 |
|
---|
759 | FitLoGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
760 | }
|
---|
761 |
|
---|
762 |
|
---|
763 | for (Int_t j=0; j<fAverageLoGainSectors->GetSize(); j++)
|
---|
764 | {
|
---|
765 |
|
---|
766 | MHGausEvents &hist = GetAverageLoGainSector(j);
|
---|
767 | MCalibrationPix &pix = calcam.GetAverageSector(j);
|
---|
768 | MBadPixelsPix &bad = calcam.GetAverageBadSector(j);
|
---|
769 |
|
---|
770 | FitLoGainHists(hist,pix,bad,fittyp,osctyp);
|
---|
771 | }
|
---|
772 | }
|
---|
773 |
|
---|
774 | //------------------------------------------------------------
|
---|
775 | //
|
---|
776 | // For all averaged areas, the fitted sigma is multiplied with the square root of
|
---|
777 | // the number involved pixels
|
---|
778 | //
|
---|
779 | void MHCalibrationCam::CalcAverageSigma()
|
---|
780 | {
|
---|
781 |
|
---|
782 | for (UInt_t j=0; j<fGeom->GetNumAreas(); j++)
|
---|
783 | {
|
---|
784 |
|
---|
785 | MCalibrationPix &pix = fCam->GetAverageArea(j);
|
---|
786 |
|
---|
787 | const Float_t numsqr = TMath::Sqrt((Float_t)fAverageAreaNum[j]);
|
---|
788 | fAverageAreaSigma[j] = pix.GetSigma () * numsqr;
|
---|
789 | fAverageAreaSigmaVar[j] = pix.GetSigmaErr () * pix.GetSigmaErr() * numsqr;
|
---|
790 |
|
---|
791 | pix.SetSigma (fAverageAreaSigma[j]);
|
---|
792 | pix.SetSigmaVar(fAverageAreaSigmaVar[j]);
|
---|
793 |
|
---|
794 | fAverageAreaRelSigma [j] = fAverageAreaSigma[j] / pix.GetMean();
|
---|
795 | fAverageAreaRelSigmaVar[j] = fAverageAreaSigmaVar[j] / (fAverageAreaSigma[j]*fAverageAreaSigma[j]);
|
---|
796 | fAverageAreaRelSigmaVar[j] += pix.GetMeanRelVar();
|
---|
797 | fAverageAreaRelSigmaVar[j] *= fAverageAreaRelSigma[j];
|
---|
798 | }
|
---|
799 | }
|
---|
800 |
|
---|
801 | // ---------------------------------------------------------------------------
|
---|
802 | //
|
---|
803 | // Returns if the histogram is empty and sets the following flag:
|
---|
804 | // - MBadPixelsPix::SetUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
---|
805 | //
|
---|
806 | // Fits the histograms with a Gaussian, in case of failure
|
---|
807 | // calls MHGausEvents::RepeatFit(), in case of repeated failure
|
---|
808 | // calls MHGausEvents::BypassFit() and sets the following flags:
|
---|
809 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::UncalibratedType_t fittyp )
|
---|
810 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
811 | //
|
---|
812 | // Creates the fourier spectrum and tests MHGausEvents::IsFourierSpectrumOK().
|
---|
813 | // In case no, sets the following flags:
|
---|
814 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::UncalibratedType_t osctyp )
|
---|
815 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
816 | //
|
---|
817 | // Retrieves the results and store them in MCalibrationPix
|
---|
818 | //
|
---|
819 | void MHCalibrationCam::FitHiGainHists(MHGausEvents &hist,
|
---|
820 | MCalibrationPix &pix,
|
---|
821 | MBadPixelsPix &bad,
|
---|
822 | MBadPixelsPix::UncalibratedType_t fittyp,
|
---|
823 | MBadPixelsPix::UncalibratedType_t osctyp)
|
---|
824 | {
|
---|
825 |
|
---|
826 |
|
---|
827 | if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow())
|
---|
828 | return;
|
---|
829 |
|
---|
830 | //
|
---|
831 | // 2) Fit the Hi Gain histograms with a Gaussian
|
---|
832 | //
|
---|
833 | if (!hist.FitGaus())
|
---|
834 | //
|
---|
835 | // 3) In case of failure set the bit Fitted to false and take histogram means and RMS
|
---|
836 | //
|
---|
837 | if (!hist.RepeatFit())
|
---|
838 | {
|
---|
839 | hist.BypassFit();
|
---|
840 | bad.SetUncalibrated( fittyp );
|
---|
841 | }
|
---|
842 |
|
---|
843 | hist.Renorm();
|
---|
844 | //
|
---|
845 | // 4) Check for oscillations
|
---|
846 | //
|
---|
847 | hist.CreateFourierSpectrum();
|
---|
848 |
|
---|
849 |
|
---|
850 | if (!hist.IsFourierSpectrumOK())
|
---|
851 | bad.SetUncalibrated( osctyp );
|
---|
852 |
|
---|
853 | //
|
---|
854 | // 5) Retrieve the results and store them in this class
|
---|
855 | //
|
---|
856 | pix.SetHiGainMean ( hist.GetMean() );
|
---|
857 | pix.SetHiGainMeanVar ( hist.GetMeanErr() * hist.GetMeanErr() );
|
---|
858 | pix.SetHiGainSigma ( hist.GetSigma() );
|
---|
859 | pix.SetHiGainSigmaVar ( hist.GetSigmaErr()* hist.GetSigmaErr() );
|
---|
860 | pix.SetHiGainProb ( hist.GetProb() );
|
---|
861 | pix.SetHiGainNumBlackout( hist.GetBlackout() );
|
---|
862 | pix.SetHiGainNumPickup ( hist.GetPickup() );
|
---|
863 |
|
---|
864 | if (IsDebug())
|
---|
865 | {
|
---|
866 | *fLog << dbginf << GetDescriptor() << ": ID " << hist.GetPixId()
|
---|
867 | << " HiGainSaturation: " << pix.IsHiGainSaturation()
|
---|
868 | << " HiGainMean: " << hist.GetMean()
|
---|
869 | << " HiGainMeanErr: " << hist.GetMeanErr()
|
---|
870 | << " HiGainMeanSigma: " << hist.GetSigma()
|
---|
871 | << " HiGainMeanSigmaErr: " << hist.GetSigmaErr()
|
---|
872 | << " HiGainMeanProb: " << hist.GetProb()
|
---|
873 | << " HiGainNumBlackout: " << hist.GetBlackout()
|
---|
874 | << " HiGainNumPickup : " << hist.GetPickup ()
|
---|
875 | << endl;
|
---|
876 | }
|
---|
877 |
|
---|
878 | }
|
---|
879 |
|
---|
880 |
|
---|
881 | // ---------------------------------------------------------------------------
|
---|
882 | //
|
---|
883 | // Returns if the histogram is empty and sets the following flag:
|
---|
884 | // - MBadPixelsPix::SetUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
---|
885 | //
|
---|
886 | // Fits the histograms with a Gaussian, in case of failure
|
---|
887 | // calls MHGausEvents::RepeatFit(), in case of repeated failure
|
---|
888 | // calls MHGausEvents::BypassFit() and sets the following flags:
|
---|
889 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::UncalibratedType_t fittyp )
|
---|
890 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
891 | //
|
---|
892 | // Creates the fourier spectrum and tests MHGausEvents::IsFourierSpectrumOK().
|
---|
893 | // In case no, sets the following flags:
|
---|
894 | // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::UncalibratedType_t osctyp )
|
---|
895 | // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
|
---|
896 | //
|
---|
897 | // Retrieves the results and store them in MCalibrationPix
|
---|
898 | //
|
---|
899 | void MHCalibrationCam::FitLoGainHists(MHGausEvents &hist,
|
---|
900 | MCalibrationPix &pix,
|
---|
901 | MBadPixelsPix &bad,
|
---|
902 | MBadPixelsPix::UncalibratedType_t fittyp,
|
---|
903 | MBadPixelsPix::UncalibratedType_t osctyp)
|
---|
904 | {
|
---|
905 |
|
---|
906 | if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow())
|
---|
907 | return;
|
---|
908 |
|
---|
909 |
|
---|
910 | //
|
---|
911 | // 2) Fit the Hi Gain histograms with a Gaussian
|
---|
912 | //
|
---|
913 | if (!hist.FitGaus())
|
---|
914 | //
|
---|
915 | // 3) In case of failure set the bit Fitted to false and take histogram means and RMS
|
---|
916 | //
|
---|
917 | if (!hist.RepeatFit())
|
---|
918 | {
|
---|
919 | hist.BypassFit();
|
---|
920 | bad.SetUncalibrated( fittyp );
|
---|
921 | }
|
---|
922 |
|
---|
923 | //
|
---|
924 | // 4) Check for oscillations
|
---|
925 | //
|
---|
926 | hist.CreateFourierSpectrum();
|
---|
927 |
|
---|
928 | if (!hist.IsFourierSpectrumOK())
|
---|
929 | bad.SetUncalibrated( osctyp );
|
---|
930 |
|
---|
931 | //
|
---|
932 | // 5) Retrieve the results and store them in this class
|
---|
933 | //
|
---|
934 | pix.SetLoGainMean ( hist.GetMean() );
|
---|
935 | pix.SetLoGainMeanVar ( hist.GetMeanErr() * hist.GetMeanErr() );
|
---|
936 | pix.SetLoGainSigma ( hist.GetSigma() );
|
---|
937 | pix.SetLoGainSigmaVar ( hist.GetSigmaErr() * hist.GetSigmaErr() );
|
---|
938 | pix.SetLoGainProb ( hist.GetProb() );
|
---|
939 | pix.SetLoGainNumBlackout( hist.GetBlackout() );
|
---|
940 | pix.SetLoGainNumPickup ( hist.GetPickup() );
|
---|
941 |
|
---|
942 | if (IsDebug())
|
---|
943 | {
|
---|
944 | *fLog << dbginf << GetDescriptor() << "ID: " << hist.GetPixId()
|
---|
945 | << " HiGainSaturation: " << pix.IsHiGainSaturation()
|
---|
946 | << " LoGainMean: " << hist.GetMean()
|
---|
947 | << " LoGainMeanErr: " << hist.GetMeanErr()
|
---|
948 | << " LoGainMeanSigma: " << hist.GetSigma()
|
---|
949 | << " LoGainMeanSigmaErr: " << hist.GetSigmaErr()
|
---|
950 | << " LoGainMeanProb: " << hist.GetProb()
|
---|
951 | << " LoGainNumBlackout: " << hist.GetBlackout()
|
---|
952 | << " LoGainNumPickup : " << hist.GetPickup ()
|
---|
953 | << endl;
|
---|
954 | }
|
---|
955 |
|
---|
956 | }
|
---|
957 |
|
---|
958 |
|
---|
959 |
|
---|
960 | // --------------------------------------------------------------------------
|
---|
961 | //
|
---|
962 | // Dummy, needed by MCamEvent
|
---|
963 | //
|
---|
964 | Bool_t MHCalibrationCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
965 | {
|
---|
966 | return kTRUE;
|
---|
967 | }
|
---|
968 |
|
---|
969 | // --------------------------------------------------------------------------
|
---|
970 | //
|
---|
971 | // What MHCamera needs in order to draw an individual pixel in the camera
|
---|
972 | //
|
---|
973 | void MHCalibrationCam::DrawPixelContent(Int_t idx) const
|
---|
974 | {
|
---|
975 | }
|
---|
976 |
|
---|
977 | // -----------------------------------------------------------------------------
|
---|
978 | //
|
---|
979 | // Default draw:
|
---|
980 | //
|
---|
981 | // Displays the averaged areas, both High Gain and Low Gain
|
---|
982 | //
|
---|
983 | // Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
|
---|
984 | //
|
---|
985 | void MHCalibrationCam::Draw(const Option_t *opt)
|
---|
986 | {
|
---|
987 |
|
---|
988 | const Int_t nareas = fAverageHiGainAreas->GetEntries();
|
---|
989 | if (nareas == 0)
|
---|
990 | return;
|
---|
991 |
|
---|
992 | TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
|
---|
993 | pad->SetBorderMode(0);
|
---|
994 |
|
---|
995 | pad->Divide(fLoGain ? 2 : 1,nareas);
|
---|
996 |
|
---|
997 | for (Int_t i=0; i<nareas;i++)
|
---|
998 | {
|
---|
999 |
|
---|
1000 | pad->cd(fLoGain ? 2*(i+1)-1 : i+1);
|
---|
1001 | GetAverageHiGainArea(i).Draw(opt);
|
---|
1002 |
|
---|
1003 | if (!fAverageAreaSat[i])
|
---|
1004 | DrawAverageSigma(fAverageAreaSat[i], i,
|
---|
1005 | fAverageAreaSigma[i], fAverageAreaSigmaVar[i],
|
---|
1006 | fAverageAreaRelSigma[i], fAverageAreaRelSigmaVar[i]);
|
---|
1007 |
|
---|
1008 | if (fLoGain)
|
---|
1009 | {
|
---|
1010 | pad->cd(2*(i+1));
|
---|
1011 | GetAverageLoGainArea(i).Draw(opt);
|
---|
1012 | }
|
---|
1013 |
|
---|
1014 | if (fAverageAreaSat[i])
|
---|
1015 | DrawAverageSigma(fAverageAreaSat[i], i,
|
---|
1016 | fAverageAreaSigma[i], fAverageAreaSigmaVar[i],
|
---|
1017 | fAverageAreaRelSigma[i], fAverageAreaRelSigmaVar[i]);
|
---|
1018 | }
|
---|
1019 |
|
---|
1020 | }
|
---|
1021 |
|
---|
1022 | // -----------------------------------------------------------------------------
|
---|
1023 | //
|
---|
1024 | // Default draw:
|
---|
1025 | //
|
---|
1026 | // Displays a TPaveText with the re-normalized sigmas of the average area
|
---|
1027 | //
|
---|
1028 | void MHCalibrationCam::DrawAverageSigma(Bool_t sat, Bool_t inner,
|
---|
1029 | Float_t sigma, Float_t sigmavar,
|
---|
1030 | Float_t relsigma, Float_t relsigmavar) const
|
---|
1031 | {
|
---|
1032 |
|
---|
1033 | if (sigma != 0 && sigmavar >= 0 && relsigmavar >= 0.)
|
---|
1034 | {
|
---|
1035 |
|
---|
1036 | TPad *newpad = new TPad("newpad","transparent",0,0,1,1);
|
---|
1037 | newpad->SetFillStyle(4000);
|
---|
1038 | newpad->Draw();
|
---|
1039 | newpad->cd();
|
---|
1040 |
|
---|
1041 | TPaveText *text = new TPaveText(sat? 0.1 : 0.35,0.7,sat ? 0.4 : 0.7,1.0);
|
---|
1042 | text->SetTextSize(0.07);
|
---|
1043 | const TString line1 = Form("%s%s%s",inner ? "Outer" : "Inner",
|
---|
1044 | " Pixels ", sat ? "Low Gain" : "High Gain");
|
---|
1045 | TText *txt1 = text->AddText(line1.Data());
|
---|
1046 | const TString line2 = Form("#sigma per pix: %2.2f #pm %2.2f",sigma,TMath::Sqrt(sigmavar));
|
---|
1047 | TText *txt2 = text->AddText(line2.Data());
|
---|
1048 | const TString line3 = Form("Rel. #sigma per pix: %2.2f #pm %2.2f",relsigma,TMath::Sqrt(relsigmavar));
|
---|
1049 | TText *txt3 = text->AddText(line3.Data());
|
---|
1050 | text->Draw("");
|
---|
1051 |
|
---|
1052 | text->SetBit(kCanDelete);
|
---|
1053 | txt1->SetBit(kCanDelete);
|
---|
1054 | txt2->SetBit(kCanDelete);
|
---|
1055 | txt3->SetBit(kCanDelete);
|
---|
1056 | newpad->SetBit(kCanDelete);
|
---|
1057 | }
|
---|
1058 | }
|
---|
1059 |
|
---|
1060 | Int_t MHCalibrationCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
|
---|
1061 | {
|
---|
1062 | Bool_t rc = kFALSE;
|
---|
1063 | if (IsEnvDefined(env, prefix, "Debug", print))
|
---|
1064 | {
|
---|
1065 | SetDebug(GetEnvValue(env, prefix, "Debug", IsDebug()));
|
---|
1066 | rc = kTRUE;
|
---|
1067 | }
|
---|
1068 |
|
---|
1069 | return rc;
|
---|
1070 | }
|
---|