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