| 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 with 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::GetNumUnsuitable(MBadPixelsPix::UnsuitableType_t type, const MGeomCam *geom, Int_t aidx) const
|
|---|
| 190 | {
|
|---|
| 191 | const UInt_t n = GetSize();
|
|---|
| 192 |
|
|---|
| 193 | if (aidx>=0 && 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)[i].GetAidx()!=aidx)
|
|---|
| 203 | continue;
|
|---|
| 204 |
|
|---|
| 205 | if ((*this)[i].IsUnsuitable(type))
|
|---|
| 206 | rc++;
|
|---|
| 207 | }
|
|---|
| 208 | return rc;
|
|---|
| 209 | }
|
|---|
| 210 |
|
|---|
| 211 | // --------------------------------------------------------------------------
|
|---|
| 212 | //
|
|---|
| 213 | // Counts the number of neighbors matching NOT UnsuitableType type
|
|---|
| 214 | //
|
|---|
| 215 | Short_t MBadPixelsCam::GetNumSuitableNeighbors(MBadPixelsPix::UnsuitableType_t type, const MGeomPix &pix) const
|
|---|
| 216 | {
|
|---|
| 217 | const Int_t n2 = pix.GetNumNeighbors();
|
|---|
| 218 |
|
|---|
| 219 | Int_t cnt=0;
|
|---|
| 220 | for (int j=0; j<n2; j++)
|
|---|
| 221 | {
|
|---|
| 222 | const Int_t id2 = pix.GetNeighbor(j);
|
|---|
| 223 | if (!(*this)[id2].IsUnsuitable(type))
|
|---|
| 224 | cnt++;
|
|---|
| 225 | }
|
|---|
| 226 |
|
|---|
| 227 | return cnt;
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| 230 | // --------------------------------------------------------------------------
|
|---|
| 231 | //
|
|---|
| 232 | // Calculate the number of pixels which are - under no circumstances -
|
|---|
| 233 | // interpolatable, called isolated. This means that a pixel (its own status
|
|---|
| 234 | // doesn't matter) has less than two reliable neighbor pixels.
|
|---|
| 235 | //
|
|---|
| 236 | // The second argument aidx is the area index (see MGeomCam, MGeomPix)
|
|---|
| 237 | // The default (or any value less than 0) means: all
|
|---|
| 238 | //
|
|---|
| 239 | // Returns -1 if the geometry doesn't match.
|
|---|
| 240 | //
|
|---|
| 241 | Short_t MBadPixelsCam::GetNumIsolated(MBadPixelsPix::UnsuitableType_t type, const MGeomCam &geom, Int_t aidx) const
|
|---|
| 242 | {
|
|---|
| 243 | const Int_t n = geom.GetNumPixels();
|
|---|
| 244 |
|
|---|
| 245 | if (n!=GetSize())
|
|---|
| 246 | {
|
|---|
| 247 | *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom.ClassName() << ") size mismatch!" << endl;
|
|---|
| 248 | return -1;
|
|---|
| 249 | }
|
|---|
| 250 |
|
|---|
| 251 | Short_t rc = 0;
|
|---|
| 252 | for (int i=0; i<n; i++)
|
|---|
| 253 | {
|
|---|
| 254 | const MGeomPix &pix = geom[i];
|
|---|
| 255 | if (aidx>=0 && pix.GetAidx()!=aidx)
|
|---|
| 256 | continue;
|
|---|
| 257 |
|
|---|
| 258 | if (GetNumSuitableNeighbors(type, pix)<2)
|
|---|
| 259 | rc++;
|
|---|
| 260 | }
|
|---|
| 261 | return rc;
|
|---|
| 262 | }
|
|---|
| 263 |
|
|---|
| 264 | // --------------------------------------------------------------------------
|
|---|
| 265 | //
|
|---|
| 266 | // This is a helper function which calculates the size of a single cluster
|
|---|
| 267 | // by iterative calling.
|
|---|
| 268 | //
|
|---|
| 269 | // If a pixel matches the criterias the counter is increased by 1 and
|
|---|
| 270 | // the function is called for all its neighbors. If
|
|---|
| 271 | //
|
|---|
| 272 | // The second argument aidx is the area index (see MGeomCam, MGeomPix)
|
|---|
| 273 | // The default (or any value less than 0) means: all
|
|---|
| 274 | //
|
|---|
| 275 | // Returns -1 if the geometry doesn't match.
|
|---|
| 276 | //
|
|---|
| 277 | Short_t MBadPixelsCam::GetNumMaxCluster(MBadPixelsPix::UnsuitableType_t type, TObjArray &list, Int_t idx, Int_t aidx) const
|
|---|
| 278 | {
|
|---|
| 279 | const MGeomPix *pix = (MGeomPix*)list[idx];
|
|---|
| 280 | if (!pix)
|
|---|
| 281 | return 0;
|
|---|
| 282 |
|
|---|
| 283 | if (GetNumSuitableNeighbors(type, *pix)>1)
|
|---|
| 284 | return 0;
|
|---|
| 285 |
|
|---|
| 286 | if (aidx>=0 && pix->GetAidx()!=aidx)
|
|---|
| 287 | return 1;
|
|---|
| 288 |
|
|---|
| 289 | list.RemoveAt(idx);
|
|---|
| 290 |
|
|---|
| 291 | Short_t cnt = 1;
|
|---|
| 292 | const Int_t n = pix->GetNumNeighbors();
|
|---|
| 293 | for (int i=0; i<n; i++)
|
|---|
| 294 | cnt += GetNumMaxCluster(type, list, pix->GetNeighbor(i), aidx);
|
|---|
| 295 |
|
|---|
| 296 | return cnt;
|
|---|
| 297 | }
|
|---|
| 298 |
|
|---|
| 299 | // --------------------------------------------------------------------------
|
|---|
| 300 | //
|
|---|
| 301 | // Returns the size of the biggest cluster with the given USuitableType
|
|---|
| 302 | // type and the given area index.
|
|---|
| 303 | //
|
|---|
| 304 | // The second argument aidx is the area index (see MGeomCam, MGeomPix)
|
|---|
| 305 | // The default (or any value less than 0) means: all
|
|---|
| 306 | //
|
|---|
| 307 | // Returns -1 if the geometry doesn't match.
|
|---|
| 308 | //
|
|---|
| 309 | Short_t MBadPixelsCam::GetNumMaxCluster(MBadPixelsPix::UnsuitableType_t type, const MGeomCam &geom, Int_t aidx) const
|
|---|
| 310 | {
|
|---|
| 311 | const Int_t n = geom.GetNumPixels();
|
|---|
| 312 |
|
|---|
| 313 | if (n!=GetSize())
|
|---|
| 314 | {
|
|---|
| 315 | *fLog << err << GetDescriptor() << "ERROR - Geometry (" << geom.ClassName() << ") size mismatch!" << endl;
|
|---|
| 316 | return -1;
|
|---|
| 317 | }
|
|---|
| 318 |
|
|---|
| 319 | TObjArray list(n);
|
|---|
| 320 | for (int i=0; i<n; i++)
|
|---|
| 321 | list.AddAt(&geom[i], i);
|
|---|
| 322 |
|
|---|
| 323 | Short_t max = 0;
|
|---|
| 324 | for (int i=0; i<n; i++)
|
|---|
| 325 | max = TMath::Max(GetNumMaxCluster(type, list, i, aidx), max);
|
|---|
| 326 |
|
|---|
| 327 | return max;
|
|---|
| 328 | }
|
|---|
| 329 |
|
|---|
| 330 | // --------------------------------------------------------------------------
|
|---|
| 331 | //
|
|---|
| 332 | // Print the contents of all bad pixels
|
|---|
| 333 | //
|
|---|
| 334 | void MBadPixelsCam::Print(Option_t *o) const
|
|---|
| 335 | {
|
|---|
| 336 |
|
|---|
| 337 | *fLog << all << GetDescriptor() << ":" << endl;
|
|---|
| 338 | *fLog << "Pixels without problems:" << endl;
|
|---|
| 339 |
|
|---|
| 340 | Int_t count = 0;
|
|---|
| 341 | Int_t full = 0;
|
|---|
| 342 |
|
|---|
| 343 | for (Int_t i=0; i<GetSize(); i++)
|
|---|
| 344 | {
|
|---|
| 345 | if (!(*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
|---|
| 346 | {
|
|---|
| 347 | *fLog << i << " ";
|
|---|
| 348 | full++;
|
|---|
| 349 | count ++;
|
|---|
| 350 | }
|
|---|
| 351 |
|
|---|
| 352 | if (count == 0)
|
|---|
| 353 | continue;
|
|---|
| 354 |
|
|---|
| 355 | if (!(full % 25))
|
|---|
| 356 | {
|
|---|
| 357 | full = 0;
|
|---|
| 358 | *fLog << endl;
|
|---|
| 359 | }
|
|---|
| 360 | }
|
|---|
| 361 | *fLog << endl;
|
|---|
| 362 | *fLog << count << " normal pixels" << endl;
|
|---|
| 363 | *fLog << endl;
|
|---|
| 364 |
|
|---|
| 365 | *fLog << "Pixels unsuited for the whole run:" << endl;
|
|---|
| 366 |
|
|---|
| 367 | full = 0;
|
|---|
| 368 | count = 0;
|
|---|
| 369 | for (Int_t i=0; i<GetSize(); i++)
|
|---|
| 370 | {
|
|---|
| 371 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
|---|
| 372 | {
|
|---|
| 373 | *fLog << i << " ";
|
|---|
| 374 | full++;
|
|---|
| 375 | count ++;
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | if (count == 0)
|
|---|
| 379 | continue;
|
|---|
| 380 |
|
|---|
| 381 | if (!(full % 25))
|
|---|
| 382 | {
|
|---|
| 383 | full = 0;
|
|---|
| 384 | *fLog << endl;
|
|---|
| 385 | }
|
|---|
| 386 | }
|
|---|
| 387 |
|
|---|
| 388 | *fLog << endl;
|
|---|
| 389 | *fLog << count << " unsuited pixels per run :-(" << endl;
|
|---|
| 390 | *fLog << endl;
|
|---|
| 391 |
|
|---|
| 392 | *fLog << "Pixels unsuited for this event:" << endl;
|
|---|
| 393 |
|
|---|
| 394 | full = 0;
|
|---|
| 395 | count = 0;
|
|---|
| 396 | for (Int_t i=0; i<GetSize(); i++)
|
|---|
| 397 | {
|
|---|
| 398 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableEvt))
|
|---|
| 399 | {
|
|---|
| 400 | *fLog << i << " ";
|
|---|
| 401 | full++;
|
|---|
| 402 | count ++;
|
|---|
| 403 | }
|
|---|
| 404 |
|
|---|
| 405 | if (count == 0)
|
|---|
| 406 | continue;
|
|---|
| 407 |
|
|---|
| 408 | if (!(full % 25))
|
|---|
| 409 | {
|
|---|
| 410 | full = 0;
|
|---|
| 411 | *fLog << endl;
|
|---|
| 412 | }
|
|---|
| 413 | }
|
|---|
| 414 |
|
|---|
| 415 | *fLog << endl;
|
|---|
| 416 | *fLog << count << " unsuited pixels per event :-(" << endl;
|
|---|
| 417 | *fLog << endl;
|
|---|
| 418 |
|
|---|
| 419 | full = 0;
|
|---|
| 420 | count = 0;
|
|---|
| 421 |
|
|---|
| 422 | *fLog << all << "Pixels unreliable for the whole run:" << endl;
|
|---|
| 423 |
|
|---|
| 424 | for (Int_t i=0; i<GetSize(); i++)
|
|---|
| 425 | {
|
|---|
| 426 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnreliableRun))
|
|---|
| 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 << " unreliable pixels :-(" << endl;
|
|---|
| 445 | *fLog << endl;
|
|---|
| 446 | *fLog << endl;
|
|---|
| 447 | *fLog << all << "Unsuited pixels statistics:" << endl;
|
|---|
| 448 | *fLog << endl;
|
|---|
| 449 |
|
|---|
| 450 | PrintBadPixels(MBadPixelsPix::kChargeIsPedestal,"Signal smaller 3 Pedestal RMS");
|
|---|
| 451 | PrintBadPixels(MBadPixelsPix::kChargeSigmaNotValid,"Signal smaller 3 Pedestal RMS");
|
|---|
| 452 | PrintBadPixels(MBadPixelsPix::kChargeRelErrNotValid,"Signal Rel. error too large");
|
|---|
| 453 | PrintBadPixels(MBadPixelsPix::kLoGainSaturation,"Low Gain Saturation");
|
|---|
| 454 | PrintBadPixels(MBadPixelsPix::kMeanTimeInFirstBin,"Mean Arr. Time In First Extraction Bin");
|
|---|
| 455 | PrintBadPixels(MBadPixelsPix::kMeanTimeInLast2Bins,"Mean Arr. Time In Last 2 Extraction Bins");
|
|---|
| 456 | PrintBadPixels(MBadPixelsPix::kDeviatingNumPhes,"Deviating Number of Photo-electrons");
|
|---|
| 457 | PrintBadPixels(MBadPixelsPix::kDeviatingNumPhots,"Deviating Number of Photons");
|
|---|
| 458 | PrintBadPixels(MBadPixelsPix::kHiGainOverFlow,"High-Gain Histogram Overflow");
|
|---|
| 459 | PrintBadPixels(MBadPixelsPix::kLoGainOverFlow,"Low-Gain Histogram Overflow");
|
|---|
| 460 |
|
|---|
| 461 | *fLog << endl;
|
|---|
| 462 | *fLog << all << "Unreliable pixels statistics:" << endl;
|
|---|
| 463 | *fLog << endl;
|
|---|
| 464 |
|
|---|
| 465 | PrintBadPixels(MBadPixelsPix::kChargeSigmaNotValid,"Signal Sigma smaller Pedestal RMS");
|
|---|
| 466 | PrintBadPixels(MBadPixelsPix::kHiGainNotFitted ,"High Gain Signals could not be fitted");
|
|---|
| 467 | PrintBadPixels(MBadPixelsPix::kLoGainNotFitted ,"Low Gain Signals could not be fitted");
|
|---|
| 468 | PrintBadPixels(MBadPixelsPix::kRelTimeNotFitted ,"Relative Arr. Times could not be fitted");
|
|---|
| 469 | PrintBadPixels(MBadPixelsPix::kHiGainOscillating ,"High Gain Signals Oscillation");
|
|---|
| 470 | PrintBadPixels(MBadPixelsPix::kLoGainOscillating ,"Low Gain Signals Oscillation");
|
|---|
| 471 | PrintBadPixels(MBadPixelsPix::kRelTimeOscillating ,"Relative Arr. Times Oscillation");
|
|---|
| 472 | PrintBadPixels(MBadPixelsPix::kDeviatingFFactor ,"Deviating global F-Factor");
|
|---|
| 473 | }
|
|---|
| 474 |
|
|---|
| 475 | void MBadPixelsCam::PrintBadPixels( MBadPixelsPix::UncalibratedType_t typ, const char *text) const
|
|---|
| 476 | {
|
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 | *fLog << "Pixels with " << text << ": " << endl;
|
|---|
| 480 | UInt_t count = 0;
|
|---|
| 481 | UInt_t full = 0;
|
|---|
| 482 |
|
|---|
| 483 | for (Int_t i=0; i<GetSize(); i++)
|
|---|
| 484 | {
|
|---|
| 485 | if ((*this)[i].IsUncalibrated(typ))
|
|---|
| 486 | {
|
|---|
| 487 | *fLog << i << " ";
|
|---|
| 488 | full++;
|
|---|
| 489 | count++;
|
|---|
| 490 | }
|
|---|
| 491 |
|
|---|
| 492 | if (count == 0)
|
|---|
| 493 | continue;
|
|---|
| 494 |
|
|---|
| 495 | if (!(full % 25))
|
|---|
| 496 | {
|
|---|
| 497 | full = 0;
|
|---|
| 498 | *fLog << endl;
|
|---|
| 499 | }
|
|---|
| 500 | }
|
|---|
| 501 |
|
|---|
| 502 | *fLog << endl;
|
|---|
| 503 | *fLog << Form("%3i",count) << " pixels in total " << endl;
|
|---|
| 504 | }
|
|---|
| 505 |
|
|---|
| 506 | // --------------------------------------------------------------------------
|
|---|
| 507 | //
|
|---|
| 508 | // Read from an ascii file of the format:
|
|---|
| 509 | // pixel1 pixel2 pixel3 pixel4
|
|---|
| 510 | // while pixel1,2,3,4 are the pixel indices used in the software.
|
|---|
| 511 | //
|
|---|
| 512 | // To read the pixels corresponding to a given run you can give run!=0
|
|---|
| 513 | // and a file of the format:
|
|---|
| 514 | // 1234: 17 193 292
|
|---|
| 515 | // 1235: 17 193 292 293
|
|---|
| 516 | //
|
|---|
| 517 | void MBadPixelsCam::AsciiRead(istream &fin, UInt_t run=0)
|
|---|
| 518 | {
|
|---|
| 519 | Int_t len;
|
|---|
| 520 | TString str;
|
|---|
| 521 |
|
|---|
| 522 | while (1)
|
|---|
| 523 | {
|
|---|
| 524 | str.ReadLine(fin);
|
|---|
| 525 | if (!fin)
|
|---|
| 526 | return;
|
|---|
| 527 |
|
|---|
| 528 | Int_t r;
|
|---|
| 529 |
|
|---|
| 530 | const Int_t n = sscanf(str.Data(), " %d : %n", &r, &len);
|
|---|
| 531 | if (n!=1)
|
|---|
| 532 | return;
|
|---|
| 533 |
|
|---|
| 534 | if (run==0 || run && (UInt_t)r==run)
|
|---|
| 535 | break;
|
|---|
| 536 | }
|
|---|
| 537 |
|
|---|
| 538 | str.Remove(0, len);
|
|---|
| 539 |
|
|---|
| 540 | while (1)
|
|---|
| 541 | {
|
|---|
| 542 | Int_t idx;
|
|---|
| 543 | const Int_t n = sscanf(str.Data(), " %d %n", &idx, &len);
|
|---|
| 544 |
|
|---|
| 545 | if (n!=1)
|
|---|
| 546 | break;
|
|---|
| 547 |
|
|---|
| 548 | str.Remove(0, len);
|
|---|
| 549 |
|
|---|
| 550 | if (idx>=GetSize())
|
|---|
| 551 | InitSize(idx+1);
|
|---|
| 552 |
|
|---|
| 553 | (*this)[idx].SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
|
|---|
| 554 | }
|
|---|
| 555 | }
|
|---|
| 556 |
|
|---|
| 557 | // --------------------------------------------------------------------------
|
|---|
| 558 | //
|
|---|
| 559 | // Write the information into an ascii file. If a run-number is given the
|
|---|
| 560 | // run-number will lead the line.
|
|---|
| 561 | //
|
|---|
| 562 | Bool_t MBadPixelsCam::AsciiWrite(ostream &fout, UInt_t run=0) const
|
|---|
| 563 | {
|
|---|
| 564 | if (run)
|
|---|
| 565 | fout << run << ":";
|
|---|
| 566 |
|
|---|
| 567 | for (int i=0; i<GetSize(); i++)
|
|---|
| 568 | if ((*this)[i].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
|---|
| 569 | fout << " " << i;
|
|---|
| 570 |
|
|---|
| 571 | if (run && GetSize())
|
|---|
| 572 | fout << endl;
|
|---|
| 573 |
|
|---|
| 574 | return kTRUE;
|
|---|
| 575 | }
|
|---|
| 576 |
|
|---|
| 577 | // --------------------------------------------------------------------------
|
|---|
| 578 | //
|
|---|
| 579 | // The types are the following:
|
|---|
| 580 | // 0: MBadPixelsPix::GetInfo()[0]
|
|---|
| 581 | // 1: MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
|---|
| 582 | // 2: MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableEvt)
|
|---|
| 583 | // 3: MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnreliableRun)
|
|---|
| 584 | // 4: MBadPixelsPix::IsHiGainBad()
|
|---|
| 585 | // 5: MBadPixelsPix::IsLoGainBad()
|
|---|
| 586 | // 6: MBadPixelsPix::GetUnsuitableCalLevel()
|
|---|
| 587 | // 7: MBadPixelsPix::GetUnreliableCalLevel()
|
|---|
| 588 | // 8: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainNotFitted)
|
|---|
| 589 | // 9: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainNotFitted)
|
|---|
| 590 | // 10: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOscillating)
|
|---|
| 591 | // 11: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOscillating)
|
|---|
| 592 | // 12: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainSaturation )
|
|---|
| 593 | // 13: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeIsPedestal )
|
|---|
| 594 | // 14: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeErrNotValid)
|
|---|
| 595 | // 15: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeRelErrNotValid)
|
|---|
| 596 | // 16: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid )
|
|---|
| 597 | // 17: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin )
|
|---|
| 598 | // 18: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins )
|
|---|
| 599 | // 19: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes )
|
|---|
| 600 | // 20: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kRelTimeNotFitted )
|
|---|
| 601 | // 21: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kRelTimeOscillating )
|
|---|
| 602 | // 22: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kDeviatingNumPhots )
|
|---|
| 603 | // 23: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOverFlow )
|
|---|
| 604 | // 24: MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOverFlow )
|
|---|
| 605 | //
|
|---|
| 606 | Bool_t MBadPixelsCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
|---|
| 607 | {
|
|---|
| 608 |
|
|---|
| 609 | if (idx >= GetSize())
|
|---|
| 610 | return kFALSE;
|
|---|
| 611 |
|
|---|
| 612 | switch (type)
|
|---|
| 613 | {
|
|---|
| 614 | case 0:
|
|---|
| 615 | return (*this)[idx].GetInfo()[0];
|
|---|
| 616 | case 1:
|
|---|
| 617 | if (!(*this)[idx].IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
|
|---|
| 618 | return kFALSE;
|
|---|
| 619 | val = 1;
|
|---|
| 620 | break;
|
|---|
| 621 | case 2:
|
|---|
| 622 | if (!(*this)[idx].IsUnsuitable(MBadPixelsPix::kUnsuitableEvt))
|
|---|
| 623 | return kFALSE;
|
|---|
| 624 | val = 1;
|
|---|
| 625 | break;
|
|---|
| 626 | case 3:
|
|---|
| 627 | if (!(*this)[idx].IsUnsuitable(MBadPixelsPix::kUnreliableRun))
|
|---|
| 628 | return kFALSE;
|
|---|
| 629 | val = 1;
|
|---|
| 630 | break;
|
|---|
| 631 | case 4:
|
|---|
| 632 | if (!(*this)[idx].IsHiGainBad())
|
|---|
| 633 | return kFALSE;
|
|---|
| 634 | val = 1;
|
|---|
| 635 | break;
|
|---|
| 636 | case 5:
|
|---|
| 637 | if (!(*this)[idx].IsLoGainBad())
|
|---|
| 638 | return kFALSE;
|
|---|
| 639 | val = 1;
|
|---|
| 640 | break;
|
|---|
| 641 | case 6:
|
|---|
| 642 | if ((*this)[idx].GetUnsuitableCalLevel())
|
|---|
| 643 | val = (*this)[idx].GetUnsuitableCalLevel();
|
|---|
| 644 | else
|
|---|
| 645 | return kFALSE;
|
|---|
| 646 | break;
|
|---|
| 647 | case 7:
|
|---|
| 648 | if ((*this)[idx].GetUnreliableCalLevel())
|
|---|
| 649 | val = (*this)[idx].GetUnreliableCalLevel();
|
|---|
| 650 | else
|
|---|
| 651 | return kFALSE;
|
|---|
| 652 | break;
|
|---|
| 653 | case 8:
|
|---|
| 654 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainNotFitted))
|
|---|
| 655 | return kFALSE;
|
|---|
| 656 | val = 1;
|
|---|
| 657 | break;
|
|---|
| 658 | case 9:
|
|---|
| 659 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainNotFitted))
|
|---|
| 660 | return kFALSE;
|
|---|
| 661 | val = 1;
|
|---|
| 662 | break;
|
|---|
| 663 | case 10:
|
|---|
| 664 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainOscillating))
|
|---|
| 665 | return kFALSE;
|
|---|
| 666 | val = 1;
|
|---|
| 667 | break;
|
|---|
| 668 | case 11:
|
|---|
| 669 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainOscillating))
|
|---|
| 670 | return kFALSE;
|
|---|
| 671 | val = 1;
|
|---|
| 672 | break;
|
|---|
| 673 | case 12:
|
|---|
| 674 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainSaturation ))
|
|---|
| 675 | return kFALSE;
|
|---|
| 676 | val = 1;
|
|---|
| 677 | break;
|
|---|
| 678 | case 13:
|
|---|
| 679 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeIsPedestal ))
|
|---|
| 680 | return kFALSE;
|
|---|
| 681 | val = 1;
|
|---|
| 682 | break;
|
|---|
| 683 | case 14:
|
|---|
| 684 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeErrNotValid))
|
|---|
| 685 | return kFALSE;
|
|---|
| 686 | val = 1;
|
|---|
| 687 | break;
|
|---|
| 688 | case 15:
|
|---|
| 689 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeRelErrNotValid))
|
|---|
| 690 | return kFALSE;
|
|---|
| 691 | val = 1;
|
|---|
| 692 | break;
|
|---|
| 693 | case 16:
|
|---|
| 694 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid ))
|
|---|
| 695 | return kFALSE;
|
|---|
| 696 | val = 1;
|
|---|
| 697 | break;
|
|---|
| 698 | case 17:
|
|---|
| 699 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin ))
|
|---|
| 700 | return kFALSE;
|
|---|
| 701 | val = 1;
|
|---|
| 702 | break;
|
|---|
| 703 | case 18:
|
|---|
| 704 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins ))
|
|---|
| 705 | return kFALSE;
|
|---|
| 706 | val = 1;
|
|---|
| 707 | break;
|
|---|
| 708 | case 19:
|
|---|
| 709 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes ))
|
|---|
| 710 | return kFALSE;
|
|---|
| 711 | val = 1;
|
|---|
| 712 | break;
|
|---|
| 713 | case 20:
|
|---|
| 714 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kRelTimeNotFitted ))
|
|---|
| 715 | return kFALSE;
|
|---|
| 716 | val = 1;
|
|---|
| 717 | break;
|
|---|
| 718 | case 21:
|
|---|
| 719 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kRelTimeOscillating))
|
|---|
| 720 | return kFALSE;
|
|---|
| 721 | val = 1;
|
|---|
| 722 | break;
|
|---|
| 723 | case 22:
|
|---|
| 724 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhots))
|
|---|
| 725 | return kFALSE;
|
|---|
| 726 | val = 1;
|
|---|
| 727 | break;
|
|---|
| 728 | case 23:
|
|---|
| 729 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainOverFlow ))
|
|---|
| 730 | return kFALSE;
|
|---|
| 731 | val = 1;
|
|---|
| 732 | break;
|
|---|
| 733 | case 24:
|
|---|
| 734 | if (!(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainOverFlow ))
|
|---|
| 735 | return kFALSE;
|
|---|
| 736 | val = 1;
|
|---|
| 737 | break;
|
|---|
| 738 | default:
|
|---|
| 739 | return kFALSE;
|
|---|
| 740 | }
|
|---|
| 741 |
|
|---|
| 742 | return kTRUE;
|
|---|
| 743 | }
|
|---|
| 744 |
|
|---|
| 745 | void MBadPixelsCam::DrawPixelContent(Int_t num) const
|
|---|
| 746 | {
|
|---|
| 747 | *fLog << warn << "MBadPixelsCam::DrawPixelContent - not available." << endl;
|
|---|
| 748 | }
|
|---|