1 | /* ======================================================================== *\
|
---|
2 | ! $Name: not supported by cvs2svn $:$Id: MBadPixelsCam.cc,v 1.54 2009-03-02 14:32:49 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 "MGeom.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)(o);
|
---|
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, MGeom)
|
---|
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, MGeom)
|
---|
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 MGeom &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, MGeom)
|
---|
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 MGeom &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, MGeom)
|
---|
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 MGeom *pix = (MGeom*)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, MGeom)
|
---|
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 |
|
---|
397 | for (Int_t i=0; i<GetSize(); i++)
|
---|
398 | {
|
---|
399 | if (!(*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
400 | {
|
---|
401 | *fLog << i << " ";
|
---|
402 | count ++;
|
---|
403 | }
|
---|
404 | }
|
---|
405 | *fLog << count << " normal pixels" << endl;
|
---|
406 | *fLog << endl;
|
---|
407 |
|
---|
408 | *fLog << "Pixels unsuited for the whole run:" << endl;
|
---|
409 |
|
---|
410 | count = 0;
|
---|
411 | for (Int_t i=0; i<GetSize(); i++)
|
---|
412 | {
|
---|
413 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
414 | {
|
---|
415 | *fLog << i << " ";
|
---|
416 | count ++;
|
---|
417 | }
|
---|
418 | }
|
---|
419 |
|
---|
420 | *fLog << count << " unsuited pixels per run :-(" << endl;
|
---|
421 | *fLog << endl;
|
---|
422 |
|
---|
423 | *fLog << "Pixels unsuited for this event:" << endl;
|
---|
424 |
|
---|
425 | count = 0;
|
---|
426 | for (Int_t i=0; i<GetSize(); i++)
|
---|
427 | {
|
---|
428 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableEvt))
|
---|
429 | {
|
---|
430 | *fLog << i << " ";
|
---|
431 | count ++;
|
---|
432 | }
|
---|
433 | }
|
---|
434 |
|
---|
435 | *fLog << count << " unsuited pixels per event :-(" << endl;
|
---|
436 | *fLog << endl;
|
---|
437 |
|
---|
438 | count = 0;
|
---|
439 |
|
---|
440 | *fLog << all << "Pixels unreliable for the whole run:" << endl;
|
---|
441 |
|
---|
442 | for (Int_t i=0; i<GetSize(); i++)
|
---|
443 | {
|
---|
444 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnreliableRun))
|
---|
445 | {
|
---|
446 | *fLog << i << " ";
|
---|
447 | count ++;
|
---|
448 | }
|
---|
449 | }
|
---|
450 |
|
---|
451 | *fLog << count << " unreliable pixels :-(" << endl;
|
---|
452 | *fLog << endl;
|
---|
453 | *fLog << endl;
|
---|
454 | *fLog << all << "Unsuited pixels statistics:" << endl;
|
---|
455 | *fLog << endl;
|
---|
456 |
|
---|
457 | PrintBadPixels(MBadPixelsPix::kPreviouslyExcluded,"Previously excluded");
|
---|
458 | PrintBadPixels(MBadPixelsPix::kChargeIsPedestal,"Signal smaller 3 Pedestal RMS");
|
---|
459 | PrintBadPixels(MBadPixelsPix::kChargeRelErrNotValid,"Signal Rel. error too large");
|
---|
460 | PrintBadPixels(MBadPixelsPix::kLoGainSaturation,"Low Gain Saturation");
|
---|
461 | PrintBadPixels(MBadPixelsPix::kMeanTimeInFirstBin,"Mean Arr. Time In First Extraction Bin");
|
---|
462 | PrintBadPixels(MBadPixelsPix::kMeanTimeInLast2Bins,"Mean Arr. Time In Last 2 Extraction Bins");
|
---|
463 | PrintBadPixels(MBadPixelsPix::kDeviatingNumPhes,"Deviating Number of Photo-electrons");
|
---|
464 | PrintBadPixels(MBadPixelsPix::kDeviatingNumPhots,"Deviating Number of Photons");
|
---|
465 | PrintBadPixels(MBadPixelsPix::kHiGainOverFlow,"High-Gain Histogram Overflow");
|
---|
466 | PrintBadPixels(MBadPixelsPix::kLoGainOverFlow,"Low-Gain Histogram Overflow");
|
---|
467 | PrintBadPixels(MBadPixelsPix::kDeadPedestalRms,"Presumably dead from Ped. Rms");
|
---|
468 | PrintBadPixels(MBadPixelsPix::kDeviatingAbsTimeResolution,"Deviating abs. time resolution");
|
---|
469 | PrintBadPixels(MBadPixelsPix::kDeviatingRelTimeResolution,"Deviating rel. time resolution");
|
---|
470 | // PrintBadPixels(MBadPixelsPix::kFluctuatingArrivalTimes,"Fluctuating Pulse Arrival Times");
|
---|
471 |
|
---|
472 | *fLog << endl;
|
---|
473 | *fLog << all << "Unreliable pixels statistics:" << endl;
|
---|
474 | *fLog << endl;
|
---|
475 |
|
---|
476 | PrintBadPixels(MBadPixelsPix::kChargeSigmaNotValid,"Signal Sigma smaller Pedestal RMS");
|
---|
477 | PrintBadPixels(MBadPixelsPix::kHiGainNotFitted ,"High Gain Signals could not be fitted");
|
---|
478 | PrintBadPixels(MBadPixelsPix::kLoGainNotFitted ,"Low Gain Signals could not be fitted");
|
---|
479 | PrintBadPixels(MBadPixelsPix::kRelTimeNotFitted ,"Relative Arr. Times could not be fitted");
|
---|
480 | PrintBadPixels(MBadPixelsPix::kHiGainOscillating ,"High Gain Signals Oscillation");
|
---|
481 | PrintBadPixels(MBadPixelsPix::kLoGainOscillating ,"Low Gain Signals Oscillation");
|
---|
482 | PrintBadPixels(MBadPixelsPix::kRelTimeOscillating ,"Relative Arr. Times Oscillation");
|
---|
483 | PrintBadPixels(MBadPixelsPix::kDeviatingFFactor ,"Deviating global F-Factor");
|
---|
484 | }
|
---|
485 |
|
---|
486 | TArrayC MBadPixelsCam::GetUnsuitable(MBadPixelsPix::UnsuitableType_t typ) const
|
---|
487 | {
|
---|
488 | TArrayC rc(GetSize());
|
---|
489 |
|
---|
490 | for (Int_t i=0; i<rc.GetSize(); i++)
|
---|
491 | rc[i] = (*this)[i].IsUnsuitable(typ) ? 0 : 1;
|
---|
492 |
|
---|
493 | return rc;
|
---|
494 | }
|
---|
495 |
|
---|
496 | TArrayC MBadPixelsCam::GetUncalibrated(MBadPixelsPix::UncalibratedType_t typ) const
|
---|
497 | {
|
---|
498 | TArrayC rc(GetSize());
|
---|
499 |
|
---|
500 | for (Int_t i=0; i<rc.GetSize(); i++)
|
---|
501 | rc[i] = (*this)[i].IsUncalibrated(typ) ? 0 : 1;
|
---|
502 |
|
---|
503 | return rc;
|
---|
504 | }
|
---|
505 |
|
---|
506 | void MBadPixelsCam::PrintBadPixels( MBadPixelsPix::UncalibratedType_t typ, const char *text) const
|
---|
507 | {
|
---|
508 | *fLog << "Pixels with " << text << ": " << endl;
|
---|
509 | UInt_t count = 0;
|
---|
510 |
|
---|
511 | for (Int_t i=0; i<GetSize(); i++)
|
---|
512 | {
|
---|
513 | if ((*this)[i].IsUncalibrated(typ))
|
---|
514 | {
|
---|
515 | *fLog << i << " ";
|
---|
516 | count++;
|
---|
517 | }
|
---|
518 | }
|
---|
519 |
|
---|
520 | *fLog << Form("%3i",count) << " pixels in total " << endl;
|
---|
521 | }
|
---|
522 |
|
---|
523 | // --------------------------------------------------------------------------
|
---|
524 | //
|
---|
525 | // Read from an ascii file of the format:
|
---|
526 | // pixel1
|
---|
527 | // pixel2
|
---|
528 | // pixel3
|
---|
529 | // pixel4
|
---|
530 | // while pixel1,2,3,4 are the pixel indices used in the software.
|
---|
531 | //
|
---|
532 | void MBadPixelsCam::AsciiRead(istream &fin)
|
---|
533 | {
|
---|
534 | TString str;
|
---|
535 |
|
---|
536 | while (1)
|
---|
537 | {
|
---|
538 | str.ReadLine(fin);
|
---|
539 | if (!fin)
|
---|
540 | break;
|
---|
541 |
|
---|
542 | if (str[0]=='#')
|
---|
543 | continue;
|
---|
544 |
|
---|
545 | const Int_t idx = str.Atoi();
|
---|
546 |
|
---|
547 | if (idx>=GetSize())
|
---|
548 | InitSize(idx+1);
|
---|
549 |
|
---|
550 | (*this)[idx].SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
---|
551 | (*this)[idx].SetUncalibrated(MBadPixelsPix::kPreviouslyExcluded);
|
---|
552 | }
|
---|
553 | }
|
---|
554 |
|
---|
555 | // --------------------------------------------------------------------------
|
---|
556 | //
|
---|
557 | // Write the information into an ascii file.
|
---|
558 | //
|
---|
559 | Bool_t MBadPixelsCam::AsciiWrite(ostream &fout) const
|
---|
560 | {
|
---|
561 | for (int i=0; i<GetSize(); i++)
|
---|
562 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
563 | fout << i << endl;
|
---|
564 |
|
---|
565 | return kTRUE;
|
---|
566 | }
|
---|
567 |
|
---|
568 | // --------------------------------------------------------------------------
|
---|
569 | //
|
---|
570 | // The types are the following:
|
---|
571 | // 0: MBadPixelsPix::GetInfo()[0]
|
---|
572 | // 1: MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
---|
573 | // 2: MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableEvt)
|
---|
574 | // 3: MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnreliableRun)
|
---|
575 | // 4: MBadPixelsPix::IsHiGainBad()
|
---|
576 | // 5: MBadPixelsPix::IsLoGainBad()
|
---|
577 | // 6: MBadPixelsPix::GetUnsuitableCalLevel()
|
---|
578 | // 7: MBadPixelsPix::GetUnreliableCalLevel()
|
---|
579 | // 8: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainNotFitted)
|
---|
580 | // 9: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainNotFitted)
|
---|
581 | // 10: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOscillating)
|
---|
582 | // 11: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOscillating)
|
---|
583 | // 12: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainSaturation )
|
---|
584 | // 13: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeIsPedestal )
|
---|
585 | // 14: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeErrNotValid)
|
---|
586 | // 15: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeRelErrNotValid)
|
---|
587 | // 16: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid )
|
---|
588 | // 17: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin )
|
---|
589 | // 18: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins )
|
---|
590 | // 19: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes )
|
---|
591 | // 20: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kRelTimeNotFitted )
|
---|
592 | // 21: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kRelTimeOscillating )
|
---|
593 | // 22: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kDeviatingNumPhots )
|
---|
594 | // 23: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOverFlow )
|
---|
595 | // 24: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOverFlow )
|
---|
596 | // 102: MBadPixelsPix::IsUnsuitable()
|
---|
597 | //
|
---|
598 | Bool_t MBadPixelsCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
---|
599 | {
|
---|
600 |
|
---|
601 | if (idx >= GetSize())
|
---|
602 | return kFALSE;
|
---|
603 |
|
---|
604 | switch (type)
|
---|
605 | {
|
---|
606 | case 0:
|
---|
607 | return (*this)[idx].GetInfo()[0];
|
---|
608 | case 1:
|
---|
609 | if (!(*this)[idx].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
---|
610 | return kFALSE;
|
---|
611 | val = 1;
|
---|
612 | break;
|
---|
613 | case 2:
|
---|
614 | if (!(*this)[idx].IsUnsuitable(MBadPixelsPix::kUnsuitableEvt))
|
---|
615 | return kFALSE;
|
---|
616 | val = 1;
|
---|
617 | break;
|
---|
618 | case 3:
|
---|
619 | if (!(*this)[idx].IsUnsuitable(MBadPixelsPix::kUnreliableRun))
|
---|
620 | return kFALSE;
|
---|
621 | val = 1;
|
---|
622 | break;
|
---|
623 | case 4:
|
---|
624 | if (!(*this)[idx].IsHiGainBad())
|
---|
625 | return kFALSE;
|
---|
626 | val = 1;
|
---|
627 | break;
|
---|
628 | case 5:
|
---|
629 | if (!(*this)[idx].IsLoGainBad())
|
---|
630 | return kFALSE;
|
---|
631 | val = 1;
|
---|
632 | break;
|
---|
633 | case 6:
|
---|
634 | val = (*this)[idx].GetUnsuitableCalLevel();
|
---|
635 | return val>0;
|
---|
636 | case 7:
|
---|
637 | val = (*this)[idx].GetUnreliableCalLevel();
|
---|
638 | return val>0;
|
---|
639 | case 8:
|
---|
640 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainNotFitted))
|
---|
641 | return kFALSE;
|
---|
642 | val = 1;
|
---|
643 | break;
|
---|
644 | case 9:
|
---|
645 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainNotFitted))
|
---|
646 | return kFALSE;
|
---|
647 | val = 1;
|
---|
648 | break;
|
---|
649 | case 10:
|
---|
650 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainOscillating))
|
---|
651 | return kFALSE;
|
---|
652 | val = 1;
|
---|
653 | break;
|
---|
654 | case 11:
|
---|
655 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainOscillating))
|
---|
656 | return kFALSE;
|
---|
657 | val = 1;
|
---|
658 | break;
|
---|
659 | case 12:
|
---|
660 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainSaturation ))
|
---|
661 | return kFALSE;
|
---|
662 | val = 1;
|
---|
663 | break;
|
---|
664 | case 13:
|
---|
665 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeIsPedestal ))
|
---|
666 | return kFALSE;
|
---|
667 | val = 1;
|
---|
668 | break;
|
---|
669 | case 14:
|
---|
670 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeErrNotValid))
|
---|
671 | return kFALSE;
|
---|
672 | val = 1;
|
---|
673 | break;
|
---|
674 | case 15:
|
---|
675 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeRelErrNotValid))
|
---|
676 | return kFALSE;
|
---|
677 | val = 1;
|
---|
678 | break;
|
---|
679 | case 16:
|
---|
680 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid ))
|
---|
681 | return kFALSE;
|
---|
682 | val = 1;
|
---|
683 | break;
|
---|
684 | case 17:
|
---|
685 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin ))
|
---|
686 | return kFALSE;
|
---|
687 | val = 1;
|
---|
688 | break;
|
---|
689 | case 18:
|
---|
690 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins ))
|
---|
691 | return kFALSE;
|
---|
692 | val = 1;
|
---|
693 | break;
|
---|
694 | case 19:
|
---|
695 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes ))
|
---|
696 | return kFALSE;
|
---|
697 | val = 1;
|
---|
698 | break;
|
---|
699 | case 20:
|
---|
700 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kRelTimeNotFitted ))
|
---|
701 | return kFALSE;
|
---|
702 | val = 1;
|
---|
703 | break;
|
---|
704 | case 21:
|
---|
705 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kRelTimeOscillating))
|
---|
706 | return kFALSE;
|
---|
707 | val = 1;
|
---|
708 | break;
|
---|
709 | case 22:
|
---|
710 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhots))
|
---|
711 | return kFALSE;
|
---|
712 | val = 1;
|
---|
713 | break;
|
---|
714 | case 23:
|
---|
715 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainOverFlow ))
|
---|
716 | return kFALSE;
|
---|
717 | val = 1;
|
---|
718 | break;
|
---|
719 | case 24:
|
---|
720 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainOverFlow ))
|
---|
721 | return kFALSE;
|
---|
722 | val = 1;
|
---|
723 | break;
|
---|
724 | case 102:
|
---|
725 | if (!(*this)[idx].IsUnsuitable())
|
---|
726 | return kFALSE;
|
---|
727 | val = 1;
|
---|
728 | break;
|
---|
729 | default:
|
---|
730 | return kFALSE;
|
---|
731 | }
|
---|
732 |
|
---|
733 | return kTRUE;
|
---|
734 | }
|
---|
735 |
|
---|
736 | void MBadPixelsCam::DrawPixelContent(Int_t num) const
|
---|
737 | {
|
---|
738 | *fLog << warn << "MBadPixelsCam::DrawPixelContent - not available." << endl;
|
---|
739 | }
|
---|