1 | /* ======================================================================== *\
|
---|
2 | ! $Name: not supported by cvs2svn $:$Id: MBadPixelsCam.cc,v 1.48 2007-01-30 14:16:44 tbretz Exp $
|
---|
3 | ! --------------------------------------------------------------------------
|
---|
4 | !
|
---|
5 | ! *
|
---|
6 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
7 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
8 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
9 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
10 | ! *
|
---|
11 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
12 | ! * documentation for any purpose is hereby granted without fee,
|
---|
13 | ! * provided that the above copyright notice appear in all copies and
|
---|
14 | ! * that both that copyright notice and this permission notice appear
|
---|
15 | ! * in supporting documentation. It is provided "as is" without express
|
---|
16 | ! * or implied warranty.
|
---|
17 | ! *
|
---|
18 | !
|
---|
19 | !
|
---|
20 | ! Author(s): Thomas Bretz 1/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
21 | ! Author(s): Markus Gaug 3/2004 <mailto:markus@ifae.es>
|
---|
22 | !
|
---|
23 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
24 | !
|
---|
25 | !
|
---|
26 | \* ======================================================================== */
|
---|
27 |
|
---|
28 | /////////////////////////////////////////////////////////////////////////////
|
---|
29 | //
|
---|
30 | // MBadPixelsCam
|
---|
31 | //
|
---|
32 | //
|
---|
33 | // Storage container to store bad pixel of the camera...
|
---|
34 | //
|
---|
35 | /////////////////////////////////////////////////////////////////////////////
|
---|
36 | #include "MBadPixelsCam.h"
|
---|
37 |
|
---|
38 | #include <iostream>
|
---|
39 |
|
---|
40 | #include <TArrayC.h>
|
---|
41 | #include <TClonesArray.h>
|
---|
42 |
|
---|
43 | #include "MLog.h"
|
---|
44 | #include "MLogManip.h"
|
---|
45 |
|
---|
46 | #include "MBadPixelsPix.h"
|
---|
47 |
|
---|
48 | #include "MGeomCam.h"
|
---|
49 | #include "MGeomPix.h"
|
---|
50 |
|
---|
51 | ClassImp(MBadPixelsCam);
|
---|
52 |
|
---|
53 | using namespace std;
|
---|
54 |
|
---|
55 | // --------------------------------------------------------------------------
|
---|
56 | //
|
---|
57 | // Default constructor.
|
---|
58 | //
|
---|
59 | MBadPixelsCam::MBadPixelsCam(const char *name, const char *title)
|
---|
60 | {
|
---|
61 | fName = name ? name : "MBadPixelsCam";
|
---|
62 | fTitle = title ? title : "Storage container to store bad pixel information";
|
---|
63 |
|
---|
64 | fArray = new TClonesArray("MBadPixelsPix", 1);
|
---|
65 | }
|
---|
66 |
|
---|
67 | MBadPixelsCam::MBadPixelsCam(const MBadPixelsCam &cam)
|
---|
68 | {
|
---|
69 | fName = "MBadPixelsCam";
|
---|
70 | fTitle = "Storage container to store bad pixel information";
|
---|
71 |
|
---|
72 | fArray = new TClonesArray("MBadPixelsPix", 1);
|
---|
73 | cam.Copy(*this);
|
---|
74 | }
|
---|
75 |
|
---|
76 | // --------------------------------------------------------------------------
|
---|
77 | //
|
---|
78 | // Delete the array conatining the bad pixel information
|
---|
79 | //
|
---|
80 | MBadPixelsCam::~MBadPixelsCam()
|
---|
81 | {
|
---|
82 | delete fArray;
|
---|
83 | }
|
---|
84 |
|
---|
85 | // --------------------------------------------------------------------------
|
---|
86 | //
|
---|
87 | // Set the size of the camera
|
---|
88 | //
|
---|
89 | void MBadPixelsCam::InitSize(const UInt_t i)
|
---|
90 | {
|
---|
91 | fArray->ExpandCreate(i);
|
---|
92 | }
|
---|
93 |
|
---|
94 | // --------------------------------------------------------------------------
|
---|
95 | //
|
---|
96 | // Get the size of the MBadPixelsCam
|
---|
97 | //
|
---|
98 | Int_t MBadPixelsCam::GetSize() const
|
---|
99 | {
|
---|
100 | return fArray->GetEntriesFast();
|
---|
101 | }
|
---|
102 |
|
---|
103 | // --------------------------------------------------------------------------
|
---|
104 | //
|
---|
105 | // Copy 'constructor'
|
---|
106 | //
|
---|
107 | void MBadPixelsCam::Copy(TObject &object) const
|
---|
108 | {
|
---|
109 | MBadPixelsCam &cam = (MBadPixelsCam&)object;
|
---|
110 |
|
---|
111 | const Int_t n = GetSize();
|
---|
112 |
|
---|
113 | if (n==0)
|
---|
114 | return;
|
---|
115 |
|
---|
116 | cam.InitSize(n);
|
---|
117 | for (int i=0; i<n; i++)
|
---|
118 | (*this)[i].Copy(cam[i]);
|
---|
119 | }
|
---|
120 |
|
---|
121 | // --------------------------------------------------------------------------
|
---|
122 | //
|
---|
123 | // Get i-th pixel (pixel number)
|
---|
124 | //
|
---|
125 | MBadPixelsPix &MBadPixelsCam::operator[](Int_t i)
|
---|
126 | {
|
---|
127 | return *static_cast<MBadPixelsPix*>(fArray->UncheckedAt(i));
|
---|
128 | }
|
---|
129 |
|
---|
130 | // --------------------------------------------------------------------------
|
---|
131 | //
|
---|
132 | // Get i-th pixel (pixel number)
|
---|
133 | //
|
---|
134 | const MBadPixelsPix &MBadPixelsCam::operator[](Int_t i) const
|
---|
135 | {
|
---|
136 | return *static_cast<MBadPixelsPix*>(fArray->UncheckedAt(i));
|
---|
137 | }
|
---|
138 |
|
---|
139 | // --------------------------------------------------------------------------
|
---|
140 | //
|
---|
141 | // Merge MBadPixelsCam cam into this, see also MBadPixelsPix::Merge
|
---|
142 | //
|
---|
143 | void MBadPixelsCam::Merge(const MBadPixelsCam &cam)
|
---|
144 | {
|
---|
145 | const Int_t n = cam.GetSize();
|
---|
146 | if (n==0)
|
---|
147 | {
|
---|
148 | *fLog << inf << "MBadPixelsCam::Merge: Container empty." << endl;
|
---|
149 | return;
|
---|
150 | }
|
---|
151 |
|
---|
152 | if (GetSize()==0)
|
---|
153 | InitSize(n);
|
---|
154 |
|
---|
155 | if (GetSize()<n)
|
---|
156 | {
|
---|
157 | *fLog << warn << "MBadPixelsCam::Merge: Size mismatch (" << n << "," << GetSize() << ")... ignored." << endl;
|
---|
158 | return;
|
---|
159 | }
|
---|
160 |
|
---|
161 | for (int i=0; i<n; i++)
|
---|
162 | (*this)[i].Merge(cam[i]);
|
---|
163 | }
|
---|
164 |
|
---|
165 | // --------------------------------------------------------------------------
|
---|
166 | //
|
---|
167 | // Clear the contents of all bad pixels (set=0 means Ok)
|
---|
168 | //
|
---|
169 | void MBadPixelsCam::Clear(Option_t *o)
|
---|
170 | {
|
---|
171 | fArray->R__FOR_EACH(TObject, Clear)();
|
---|
172 | }
|
---|
173 |
|
---|
174 | // --------------------------------------------------------------------------
|
---|
175 | //
|
---|
176 | // Reset event depending bits
|
---|
177 | //
|
---|
178 | void MBadPixelsCam::Reset()
|
---|
179 | {
|
---|
180 | fArray->R__FOR_EACH(MParContainer, Reset)();
|
---|
181 | }
|
---|
182 |
|
---|
183 | // --------------------------------------------------------------------------
|
---|
184 | //
|
---|
185 | // Calculate the number of pixels without the given type-flags.
|
---|
186 | //
|
---|
187 | // The second argument aidx is the area index (see MGeomCam, MGeomPix)
|
---|
188 | // The default (or any value less than 0) means: all
|
---|
189 | //
|
---|
190 | // Returns -1 if the geometry doesn't match.
|
---|
191 | //
|
---|
192 | Short_t MBadPixelsCam::GetNumSuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx) const
|
---|
193 | {
|
---|
194 | const UInt_t n = GetSize();
|
---|
195 |
|
---|
196 | if (aidx>=0 && (!geom || geom->GetNumPixels()!=n))
|
---|
197 | {
|
---|
198 | *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom->ClassName() << ") size mismatch!" << endl;
|
---|
199 | return -1;
|
---|
200 | }
|
---|
201 |
|
---|
202 | Short_t rc = 0;
|
---|
203 | for (UInt_t i=0; i<n; i++)
|
---|
204 | {
|
---|
205 | if (aidx>=0 && geom && (*geom)[i].GetAidx()!=aidx)
|
---|
206 | continue;
|
---|
207 |
|
---|
208 | if (!(*this)[i].IsUnsuitable(type))
|
---|
209 | rc++;
|
---|
210 | }
|
---|
211 | return rc;
|
---|
212 | }
|
---|
213 |
|
---|
214 | // --------------------------------------------------------------------------
|
---|
215 | //
|
---|
216 | // Calculate the number of pixels with the given type-flags.
|
---|
217 | //
|
---|
218 | // The second argument aidx is the area index (see MGeomCam, MGeomPix)
|
---|
219 | // The default (or any value less than 0) means: all
|
---|
220 | //
|
---|
221 | // Returns -1 if the geometry doesn't match.
|
---|
222 | //
|
---|
223 | Short_t MBadPixelsCam::GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx) const
|
---|
224 | {
|
---|
225 | const UInt_t n = GetSize();
|
---|
226 |
|
---|
227 | if (aidx>=0 && geom && geom->GetNumPixels()!=n)
|
---|
228 | {
|
---|
229 | *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom->ClassName() << ") size mismatch!" << endl;
|
---|
230 | return -1;
|
---|
231 | }
|
---|
232 |
|
---|
233 | Short_t rc = 0;
|
---|
234 | for (UInt_t i=0; i<n; i++)
|
---|
235 | {
|
---|
236 | if (aidx>=0 && geom && (*geom)[i].GetAidx()!=aidx)
|
---|
237 | continue;
|
---|
238 |
|
---|
239 | if ((*this)[i].IsUnsuitable(type))
|
---|
240 | rc++;
|
---|
241 | }
|
---|
242 | return rc;
|
---|
243 | }
|
---|
244 |
|
---|
245 | // --------------------------------------------------------------------------
|
---|
246 | //
|
---|
247 | // Count the number of unsuitable pixels.
|
---|
248 | //
|
---|
249 | Short_t MBadPixelsCam::GetNumUnsuitable() const
|
---|
250 | {
|
---|
251 | const UInt_t n = GetSize();
|
---|
252 |
|
---|
253 | Short_t rc = 0;
|
---|
254 | for (UInt_t i=0; i<n; i++)
|
---|
255 | if ((*this)[i].IsUnsuitable())
|
---|
256 | rc++;
|
---|
257 |
|
---|
258 | return rc;
|
---|
259 | }
|
---|
260 |
|
---|
261 | // --------------------------------------------------------------------------
|
---|
262 | //
|
---|
263 | // Counts the number of neighbors matching NOT UnsuitableType type
|
---|
264 | //
|
---|
265 | Short_t MBadPixelsCam::GetNumSuitableNeighbors(MBadPixelsPix::UnsuitableType_t type, const MGeomPix &pix) const
|
---|
266 | {
|
---|
267 | const Int_t n2 = pix.GetNumNeighbors();
|
---|
268 |
|
---|
269 | Int_t cnt=0;
|
---|
270 | for (int j=0; j<n2; j++)
|
---|
271 | {
|
---|
272 | const Int_t id2 = pix.GetNeighbor(j);
|
---|
273 | if (!(*this)[id2].IsUnsuitable(type))
|
---|
274 | cnt++;
|
---|
275 | }
|
---|
276 |
|
---|
277 | return cnt;
|
---|
278 | }
|
---|
279 |
|
---|
280 | // --------------------------------------------------------------------------
|
---|
281 | //
|
---|
282 | // Calculate the number of pixels which are - under no circumstances -
|
---|
283 | // interpolatable, called isolated. This means that a pixel (its own status
|
---|
284 | // doesn't matter) has less than two reliable neighbor pixels.
|
---|
285 | //
|
---|
286 | // The second argument aidx is the area index (see MGeomCam, MGeomPix)
|
---|
287 | // The default (or any value less than 0) means: all
|
---|
288 | //
|
---|
289 | // Returns -1 if the geometry doesn't match.
|
---|
290 | //
|
---|
291 | Short_t MBadPixelsCam::GetNumIsolated(MBadPixelsPix::UnsuitableType_t type, const MGeomCam &geom, Int_t aidx) const
|
---|
292 | {
|
---|
293 | const Int_t n = geom.GetNumPixels();
|
---|
294 |
|
---|
295 | if (n!=GetSize())
|
---|
296 | {
|
---|
297 | *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom.ClassName() << ") size mismatch!" << endl;
|
---|
298 | return -1;
|
---|
299 | }
|
---|
300 |
|
---|
301 | Short_t rc = 0;
|
---|
302 | for (int i=0; i<n; i++)
|
---|
303 | {
|
---|
304 | const MGeomPix &pix = geom[i];
|
---|
305 | if (aidx>=0 && pix.GetAidx()!=aidx)
|
---|
306 | continue;
|
---|
307 |
|
---|
308 | if (GetNumSuitableNeighbors(type, pix)<2)
|
---|
309 | rc++;
|
---|
310 | }
|
---|
311 | return rc;
|
---|
312 | }
|
---|
313 |
|
---|
314 | // --------------------------------------------------------------------------
|
---|
315 | //
|
---|
316 | // This is a helper function which calculates the size of a single cluster
|
---|
317 | // by iterative calling.
|
---|
318 | //
|
---|
319 | // If a pixel matches the criterias the counter is increased by 1 and
|
---|
320 | // the function is called for all its neighbors. If
|
---|
321 | //
|
---|
322 | // The second argument aidx is the area index (see MGeomCam, MGeomPix)
|
---|
323 | // The default (or any value less than 0) means: all
|
---|
324 | //
|
---|
325 | // Returns -1 if the geometry doesn't match.
|
---|
326 | //
|
---|
327 | Short_t MBadPixelsCam::GetNumMaxCluster(MBadPixelsPix::UnsuitableType_t type, TObjArray &list, Int_t idx, Int_t aidx) const
|
---|
328 | {
|
---|
329 | const MGeomPix *pix = (MGeomPix*)list[idx];
|
---|
330 | if (!pix)
|
---|
331 | return 0;
|
---|
332 |
|
---|
333 | // Check whether more than one neighbor contains useful information,
|
---|
334 | // which mean it can later be interpolated
|
---|
335 | if (GetNumSuitableNeighbors(type, *pix)>1)
|
---|
336 | return 0;
|
---|
337 |
|
---|
338 | // If the requested area-index is valid check whether it is the requested one
|
---|
339 | if (aidx>=0 && pix->GetAidx()!=aidx)
|
---|
340 | return 1;
|
---|
341 |
|
---|
342 | // Remove the pixel from the list of pixels to be checked
|
---|
343 | list.RemoveAt(idx);
|
---|
344 |
|
---|
345 | // Do the same for the neighbor pixels recursively and count the 1-results
|
---|
346 | Short_t cnt = 1;
|
---|
347 | const Int_t n = pix->GetNumNeighbors();
|
---|
348 | for (int i=0; i<n; i++)
|
---|
349 | cnt += GetNumMaxCluster(type, list, pix->GetNeighbor(i), aidx);
|
---|
350 |
|
---|
351 | // return the number of neighbor pixels/clusters which have unsuitable-type type
|
---|
352 | return cnt;
|
---|
353 | }
|
---|
354 |
|
---|
355 | // --------------------------------------------------------------------------
|
---|
356 | //
|
---|
357 | // Returns the size of the biggest cluster with the given UnsuitableType
|
---|
358 | // type and the given area index.
|
---|
359 | //
|
---|
360 | // The second argument aidx is the area index (see MGeomCam, MGeomPix)
|
---|
361 | // The default (or any value less than 0) means: all
|
---|
362 | //
|
---|
363 | // Returns -1 if the geometry doesn't match.
|
---|
364 | //
|
---|
365 | Short_t MBadPixelsCam::GetNumMaxCluster(MBadPixelsPix::UnsuitableType_t type, const MGeomCam &geom, Int_t aidx) const
|
---|
366 | {
|
---|
367 | const Int_t n = geom.GetNumPixels();
|
---|
368 |
|
---|
369 | if (n!=GetSize())
|
---|
370 | {
|
---|
371 | *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom.ClassName() << ") size mismatch!" << endl;
|
---|
372 | return -1;
|
---|
373 | }
|
---|
374 |
|
---|
375 | TObjArray list(n);
|
---|
376 | for (int i=0; i<n; i++)
|
---|
377 | list.AddAt(&geom[i], i);
|
---|
378 |
|
---|
379 | Short_t max = 0;
|
---|
380 | for (int i=0; i<n; i++)
|
---|
381 | max = TMath::Max(GetNumMaxCluster(type, list, i, aidx), max);
|
---|
382 |
|
---|
383 | return max;
|
---|
384 | }
|
---|
385 |
|
---|
386 | // --------------------------------------------------------------------------
|
---|
387 | //
|
---|
388 | // Print the contents of all bad pixels
|
---|
389 | //
|
---|
390 | void MBadPixelsCam::Print(Option_t *o) const
|
---|
391 | {
|
---|
392 | *fLog << all << GetDescriptor() << ":" << endl;
|
---|
393 | *fLog << "Pixels without problems:" << endl;
|
---|
394 |
|
---|
395 | Int_t count = 0;
|
---|
396 | Int_t full = 0;
|
---|
397 |
|
---|
398 | for (Int_t i=0; i<GetSize(); i++)
|
---|
399 | {
|
---|
400 | if (!(*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
401 | {
|
---|
402 | *fLog << i << " ";
|
---|
403 | full++;
|
---|
404 | count ++;
|
---|
405 | }
|
---|
406 |
|
---|
407 | if (count == 0)
|
---|
408 | continue;
|
---|
409 |
|
---|
410 | if (!(full % 25))
|
---|
411 | {
|
---|
412 | full = 0;
|
---|
413 | *fLog << endl;
|
---|
414 | }
|
---|
415 | }
|
---|
416 | *fLog << endl;
|
---|
417 | *fLog << count << " normal pixels" << endl;
|
---|
418 | *fLog << endl;
|
---|
419 |
|
---|
420 | *fLog << "Pixels unsuited for the whole run:" << endl;
|
---|
421 |
|
---|
422 | full = 0;
|
---|
423 | count = 0;
|
---|
424 | for (Int_t i=0; i<GetSize(); i++)
|
---|
425 | {
|
---|
426 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
427 | {
|
---|
428 | *fLog << i << " ";
|
---|
429 | full++;
|
---|
430 | count ++;
|
---|
431 | }
|
---|
432 |
|
---|
433 | if (count == 0)
|
---|
434 | continue;
|
---|
435 |
|
---|
436 | if (!(full % 25))
|
---|
437 | {
|
---|
438 | full = 0;
|
---|
439 | *fLog << endl;
|
---|
440 | }
|
---|
441 | }
|
---|
442 |
|
---|
443 | *fLog << endl;
|
---|
444 | *fLog << count << " unsuited pixels per run :-(" << endl;
|
---|
445 | *fLog << endl;
|
---|
446 |
|
---|
447 | *fLog << "Pixels unsuited for this event:" << endl;
|
---|
448 |
|
---|
449 | full = 0;
|
---|
450 | count = 0;
|
---|
451 | for (Int_t i=0; i<GetSize(); i++)
|
---|
452 | {
|
---|
453 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableEvt))
|
---|
454 | {
|
---|
455 | *fLog << i << " ";
|
---|
456 | full++;
|
---|
457 | count ++;
|
---|
458 | }
|
---|
459 |
|
---|
460 | if (count == 0)
|
---|
461 | continue;
|
---|
462 |
|
---|
463 | if (!(full % 25))
|
---|
464 | {
|
---|
465 | full = 0;
|
---|
466 | *fLog << endl;
|
---|
467 | }
|
---|
468 | }
|
---|
469 |
|
---|
470 | *fLog << endl;
|
---|
471 | *fLog << count << " unsuited pixels per event :-(" << endl;
|
---|
472 | *fLog << endl;
|
---|
473 |
|
---|
474 | full = 0;
|
---|
475 | count = 0;
|
---|
476 |
|
---|
477 | *fLog << all << "Pixels unreliable for the whole run:" << endl;
|
---|
478 |
|
---|
479 | for (Int_t i=0; i<GetSize(); i++)
|
---|
480 | {
|
---|
481 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnreliableRun))
|
---|
482 | {
|
---|
483 | *fLog << i << " ";
|
---|
484 | full++;
|
---|
485 | count ++;
|
---|
486 | }
|
---|
487 |
|
---|
488 | if (count == 0)
|
---|
489 | continue;
|
---|
490 |
|
---|
491 | if (!(full % 25))
|
---|
492 | {
|
---|
493 | full = 0;
|
---|
494 | *fLog << endl;
|
---|
495 | }
|
---|
496 | }
|
---|
497 |
|
---|
498 | *fLog << endl;
|
---|
499 | *fLog << count << " unreliable pixels :-(" << endl;
|
---|
500 | *fLog << endl;
|
---|
501 | *fLog << endl;
|
---|
502 | *fLog << all << "Unsuited pixels statistics:" << endl;
|
---|
503 | *fLog << endl;
|
---|
504 |
|
---|
505 | PrintBadPixels(MBadPixelsPix::kPreviouslyExcluded,"Previously excluded");
|
---|
506 | PrintBadPixels(MBadPixelsPix::kChargeIsPedestal,"Signal smaller 3 Pedestal RMS");
|
---|
507 | PrintBadPixels(MBadPixelsPix::kChargeRelErrNotValid,"Signal Rel. error too large");
|
---|
508 | PrintBadPixels(MBadPixelsPix::kLoGainSaturation,"Low Gain Saturation");
|
---|
509 | PrintBadPixels(MBadPixelsPix::kMeanTimeInFirstBin,"Mean Arr. Time In First Extraction Bin");
|
---|
510 | PrintBadPixels(MBadPixelsPix::kMeanTimeInLast2Bins,"Mean Arr. Time In Last 2 Extraction Bins");
|
---|
511 | PrintBadPixels(MBadPixelsPix::kDeviatingNumPhes,"Deviating Number of Photo-electrons");
|
---|
512 | PrintBadPixels(MBadPixelsPix::kDeviatingNumPhots,"Deviating Number of Photons");
|
---|
513 | PrintBadPixels(MBadPixelsPix::kHiGainOverFlow,"High-Gain Histogram Overflow");
|
---|
514 | PrintBadPixels(MBadPixelsPix::kLoGainOverFlow,"Low-Gain Histogram Overflow");
|
---|
515 | PrintBadPixels(MBadPixelsPix::kDeadPedestalRms,"Presumably dead from Ped. Rms");
|
---|
516 | PrintBadPixels(MBadPixelsPix::kFluctuatingArrivalTimes,"Fluctuating Pulse Arrival Times");
|
---|
517 |
|
---|
518 | *fLog << endl;
|
---|
519 | *fLog << all << "Unreliable pixels statistics:" << endl;
|
---|
520 | *fLog << endl;
|
---|
521 |
|
---|
522 | PrintBadPixels(MBadPixelsPix::kChargeSigmaNotValid,"Signal Sigma smaller Pedestal RMS");
|
---|
523 | PrintBadPixels(MBadPixelsPix::kHiGainNotFitted ,"High Gain Signals could not be fitted");
|
---|
524 | PrintBadPixels(MBadPixelsPix::kLoGainNotFitted ,"Low Gain Signals could not be fitted");
|
---|
525 | PrintBadPixels(MBadPixelsPix::kRelTimeNotFitted ,"Relative Arr. Times could not be fitted");
|
---|
526 | PrintBadPixels(MBadPixelsPix::kHiGainOscillating ,"High Gain Signals Oscillation");
|
---|
527 | PrintBadPixels(MBadPixelsPix::kLoGainOscillating ,"Low Gain Signals Oscillation");
|
---|
528 | PrintBadPixels(MBadPixelsPix::kRelTimeOscillating ,"Relative Arr. Times Oscillation");
|
---|
529 | PrintBadPixels(MBadPixelsPix::kDeviatingFFactor ,"Deviating global F-Factor");
|
---|
530 | }
|
---|
531 |
|
---|
532 | TArrayC MBadPixelsCam::GetUnsuitable(MBadPixelsPix::UnsuitableType_t typ) const
|
---|
533 | {
|
---|
534 | TArrayC rc(GetSize());
|
---|
535 |
|
---|
536 | for (Int_t i=0; i<rc.GetSize(); i++)
|
---|
537 | rc[i] = (*this)[i].IsUnsuitable(typ) ? 0 : 1;
|
---|
538 |
|
---|
539 | return rc;
|
---|
540 | }
|
---|
541 |
|
---|
542 | TArrayC MBadPixelsCam::GetUncalibrated(MBadPixelsPix::UncalibratedType_t typ) const
|
---|
543 | {
|
---|
544 | TArrayC rc(GetSize());
|
---|
545 |
|
---|
546 | for (Int_t i=0; i<rc.GetSize(); i++)
|
---|
547 | rc[i] = (*this)[i].IsUncalibrated(typ) ? 0 : 1;
|
---|
548 |
|
---|
549 | return rc;
|
---|
550 | }
|
---|
551 |
|
---|
552 | void MBadPixelsCam::PrintBadPixels( MBadPixelsPix::UncalibratedType_t typ, const char *text) const
|
---|
553 | {
|
---|
554 | *fLog << "Pixels with " << text << ": " << endl;
|
---|
555 | UInt_t count = 0;
|
---|
556 | UInt_t full = 0;
|
---|
557 |
|
---|
558 | for (Int_t i=0; i<GetSize(); i++)
|
---|
559 | {
|
---|
560 | if ((*this)[i].IsUncalibrated(typ))
|
---|
561 | {
|
---|
562 | *fLog << i << " ";
|
---|
563 | full++;
|
---|
564 | count++;
|
---|
565 | }
|
---|
566 |
|
---|
567 | if (count == 0)
|
---|
568 | continue;
|
---|
569 |
|
---|
570 | if (!(full % 25))
|
---|
571 | {
|
---|
572 | full = 0;
|
---|
573 | *fLog << endl;
|
---|
574 | }
|
---|
575 | }
|
---|
576 |
|
---|
577 | *fLog << endl;
|
---|
578 | *fLog << Form("%3i",count) << " pixels in total " << endl;
|
---|
579 | }
|
---|
580 |
|
---|
581 | // --------------------------------------------------------------------------
|
---|
582 | //
|
---|
583 | // Read from an ascii file of the format:
|
---|
584 | // pixel1
|
---|
585 | // pixel2
|
---|
586 | // pixel3
|
---|
587 | // pixel4
|
---|
588 | // while pixel1,2,3,4 are the pixel indices used in the software.
|
---|
589 | //
|
---|
590 | void MBadPixelsCam::AsciiRead(istream &fin)
|
---|
591 | {
|
---|
592 | TString str;
|
---|
593 |
|
---|
594 | while (1)
|
---|
595 | {
|
---|
596 | str.ReadLine(fin);
|
---|
597 | if (!fin)
|
---|
598 | break;
|
---|
599 |
|
---|
600 | if (str[0]=='#')
|
---|
601 | continue;
|
---|
602 |
|
---|
603 | const Int_t idx = str.Atoi();
|
---|
604 |
|
---|
605 | if (idx>=GetSize())
|
---|
606 | InitSize(idx+1);
|
---|
607 |
|
---|
608 | (*this)[idx].SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
---|
609 | (*this)[idx].SetUncalibrated(MBadPixelsPix::kPreviouslyExcluded);
|
---|
610 | }
|
---|
611 | }
|
---|
612 |
|
---|
613 | // --------------------------------------------------------------------------
|
---|
614 | //
|
---|
615 | // Write the information into an ascii file.
|
---|
616 | //
|
---|
617 | Bool_t MBadPixelsCam::AsciiWrite(ostream &fout) const
|
---|
618 | {
|
---|
619 | for (int i=0; i<GetSize(); i++)
|
---|
620 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
621 | fout << i << endl;
|
---|
622 |
|
---|
623 | return kTRUE;
|
---|
624 | }
|
---|
625 |
|
---|
626 | // --------------------------------------------------------------------------
|
---|
627 | //
|
---|
628 | // The types are the following:
|
---|
629 | // 0: MBadPixelsPix::GetInfo()[0]
|
---|
630 | // 1: MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
---|
631 | // 2: MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableEvt)
|
---|
632 | // 3: MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnreliableRun)
|
---|
633 | // 4: MBadPixelsPix::IsHiGainBad()
|
---|
634 | // 5: MBadPixelsPix::IsLoGainBad()
|
---|
635 | // 6: MBadPixelsPix::GetUnsuitableCalLevel()
|
---|
636 | // 7: MBadPixelsPix::GetUnreliableCalLevel()
|
---|
637 | // 8: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainNotFitted)
|
---|
638 | // 9: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainNotFitted)
|
---|
639 | // 10: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOscillating)
|
---|
640 | // 11: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOscillating)
|
---|
641 | // 12: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainSaturation )
|
---|
642 | // 13: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeIsPedestal )
|
---|
643 | // 14: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeErrNotValid)
|
---|
644 | // 15: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeRelErrNotValid)
|
---|
645 | // 16: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid )
|
---|
646 | // 17: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin )
|
---|
647 | // 18: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins )
|
---|
648 | // 19: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes )
|
---|
649 | // 20: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kRelTimeNotFitted )
|
---|
650 | // 21: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kRelTimeOscillating )
|
---|
651 | // 22: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kDeviatingNumPhots )
|
---|
652 | // 23: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOverFlow )
|
---|
653 | // 24: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOverFlow )
|
---|
654 | // 102: MBadPixelsPix::IsUnsuitable()
|
---|
655 | //
|
---|
656 | Bool_t MBadPixelsCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
657 | {
|
---|
658 |
|
---|
659 | if (idx >= GetSize())
|
---|
660 | return kFALSE;
|
---|
661 |
|
---|
662 | switch (type)
|
---|
663 | {
|
---|
664 | case 0:
|
---|
665 | return (*this)[idx].GetInfo()[0];
|
---|
666 | case 1:
|
---|
667 | if (!(*this)[idx].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
668 | return kFALSE;
|
---|
669 | val = 1;
|
---|
670 | break;
|
---|
671 | case 2:
|
---|
672 | if (!(*this)[idx].IsUnsuitable(MBadPixelsPix::kUnsuitableEvt))
|
---|
673 | return kFALSE;
|
---|
674 | val = 1;
|
---|
675 | break;
|
---|
676 | case 3:
|
---|
677 | if (!(*this)[idx].IsUnsuitable(MBadPixelsPix::kUnreliableRun))
|
---|
678 | return kFALSE;
|
---|
679 | val = 1;
|
---|
680 | break;
|
---|
681 | case 4:
|
---|
682 | if (!(*this)[idx].IsHiGainBad())
|
---|
683 | return kFALSE;
|
---|
684 | val = 1;
|
---|
685 | break;
|
---|
686 | case 5:
|
---|
687 | if (!(*this)[idx].IsLoGainBad())
|
---|
688 | return kFALSE;
|
---|
689 | val = 1;
|
---|
690 | break;
|
---|
691 | case 6:
|
---|
692 | if (!(*this)[idx].GetUnsuitableCalLevel())
|
---|
693 | return kFALSE;
|
---|
694 | val = (*this)[idx].GetUnsuitableCalLevel();
|
---|
695 | break;
|
---|
696 | case 7:
|
---|
697 | if (!(*this)[idx].GetUnreliableCalLevel())
|
---|
698 | return kFALSE;
|
---|
699 | val = (*this)[idx].GetUnreliableCalLevel();
|
---|
700 | break;
|
---|
701 | case 8:
|
---|
702 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainNotFitted))
|
---|
703 | return kFALSE;
|
---|
704 | val = 1;
|
---|
705 | break;
|
---|
706 | case 9:
|
---|
707 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainNotFitted))
|
---|
708 | return kFALSE;
|
---|
709 | val = 1;
|
---|
710 | break;
|
---|
711 | case 10:
|
---|
712 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainOscillating))
|
---|
713 | return kFALSE;
|
---|
714 | val = 1;
|
---|
715 | break;
|
---|
716 | case 11:
|
---|
717 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainOscillating))
|
---|
718 | return kFALSE;
|
---|
719 | val = 1;
|
---|
720 | break;
|
---|
721 | case 12:
|
---|
722 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainSaturation ))
|
---|
723 | return kFALSE;
|
---|
724 | val = 1;
|
---|
725 | break;
|
---|
726 | case 13:
|
---|
727 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeIsPedestal ))
|
---|
728 | return kFALSE;
|
---|
729 | val = 1;
|
---|
730 | break;
|
---|
731 | case 14:
|
---|
732 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeErrNotValid))
|
---|
733 | return kFALSE;
|
---|
734 | val = 1;
|
---|
735 | break;
|
---|
736 | case 15:
|
---|
737 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeRelErrNotValid))
|
---|
738 | return kFALSE;
|
---|
739 | val = 1;
|
---|
740 | break;
|
---|
741 | case 16:
|
---|
742 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid ))
|
---|
743 | return kFALSE;
|
---|
744 | val = 1;
|
---|
745 | break;
|
---|
746 | case 17:
|
---|
747 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin ))
|
---|
748 | return kFALSE;
|
---|
749 | val = 1;
|
---|
750 | break;
|
---|
751 | case 18:
|
---|
752 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins ))
|
---|
753 | return kFALSE;
|
---|
754 | val = 1;
|
---|
755 | break;
|
---|
756 | case 19:
|
---|
757 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes ))
|
---|
758 | return kFALSE;
|
---|
759 | val = 1;
|
---|
760 | break;
|
---|
761 | case 20:
|
---|
762 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kRelTimeNotFitted ))
|
---|
763 | return kFALSE;
|
---|
764 | val = 1;
|
---|
765 | break;
|
---|
766 | case 21:
|
---|
767 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kRelTimeOscillating))
|
---|
768 | return kFALSE;
|
---|
769 | val = 1;
|
---|
770 | break;
|
---|
771 | case 22:
|
---|
772 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhots))
|
---|
773 | return kFALSE;
|
---|
774 | val = 1;
|
---|
775 | break;
|
---|
776 | case 23:
|
---|
777 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainOverFlow ))
|
---|
778 | return kFALSE;
|
---|
779 | val = 1;
|
---|
780 | break;
|
---|
781 | case 24:
|
---|
782 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainOverFlow ))
|
---|
783 | return kFALSE;
|
---|
784 | val = 1;
|
---|
785 | break;
|
---|
786 | case 102:
|
---|
787 | if (!(*this)[idx].IsUnsuitable())
|
---|
788 | return kFALSE;
|
---|
789 | val = 1;
|
---|
790 | break;
|
---|
791 | default:
|
---|
792 | return kFALSE;
|
---|
793 | }
|
---|
794 |
|
---|
795 | return kTRUE;
|
---|
796 | }
|
---|
797 |
|
---|
798 | void MBadPixelsCam::DrawPixelContent(Int_t num) const
|
---|
799 | {
|
---|
800 | *fLog << warn << "MBadPixelsCam::DrawPixelContent - not available." << endl;
|
---|
801 | }
|
---|