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