/* ======================================================================== *\ ! ! * ! * This file is part of MARS, the MAGIC Analysis and Reconstruction ! * Software. It is distributed to you in the hope that it can be a useful ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. ! * It is distributed WITHOUT ANY WARRANTY. ! * ! * Permission to use, copy, modify and distribute this software and its ! * documentation for any purpose is hereby granted without fee, ! * provided that the above copyright notice appear in all copies and ! * that both that copyright notice and this permission notice appear ! * in supporting documentation. It is provided "as is" without express ! * or implied warranty. ! * ! ! ! Author(s): Thomas Bretz, 1/2004 ! Markus Gaug, 3/2004 ! ! Copyright: MAGIC Software Development, 2000-2004 ! ! \* ======================================================================== */ ///////////////////////////////////////////////////////////////////////////// // // MBadPixelsPix // // The bits of an integer array fInfo are used to declare and inform about // possible defects in a pixel. Default and absence of defects create an array // of zeros. // // The first index (fInfo[0]) holds general information which is coded as follows: // * BIT(1): Unsuitable Run: The pixel is not suited for analysis for the entire run // * BIT(2): Unsuitable Evt: The pixel is not suited for analysis for the current event // * BIT(3): Unreliable Run: The pixel can in principle be used for analysis, although // previous analysis steps have yielded certain inconsistencies // // These bits can be called with the enum MBadPixelsPix::UnsuitableTupe_t in combination // with the function IsUnsuitable(MBadPixelsPix::UnsuitableTupe_t), e.g. // MBadPixelsPix::IsUnsuitalbe(MBadPixelsPix::kUnsuitableRun) asks if the first bit is set. // // The second index (fInfo[1]) hold information acquired during the calibration. The bits // are coded in the following form: // BIT(1 ): kHiGainNotCalibrated : Any High Gain signal is not calibrated and cannot be used // BIT(2 ): kLoGainNotCalibrated : Any Low Gain signal is not calibrated and cannot be used // BIT(3 ): kHiGainNotFitted : Any High Gain signal is calibrated without a Gauss Fit to the signal distribution // BIT(4 ): kLoGainNotFitted : Any Low Gain signal is calibrated without a Gauss Fit to the signal distribution // BIT(5 ): kHiGainOscillating : The High Gain signals fourier transform showed abnormal behavior // BIT(6 ): kLoGainOscillating : The Low Gain signals fourier transform showed abnormal behavior // BIT(7 ): kLoGainSaturation : The Low Gain signals were saturated during calibration // BIT(8 ): kChargeIsPedestal : The calibration signal contained only pedestals - presumably dead pixel // BIT(10): kChargeRelErrNotValid: The relative error of the derived charge was too large or too small // BIT(11): kChargeSigmaNotValid : The sigma of the pedestal distribution smaller than the pedestal RMS - presumably a pixel with a star in its FOV only during the pedestal taking // BIT(12): kMeanTimeInFirstBin : The signal has its mean maximum in the first used FADC slice - signal extractor bad // BIT(13): kMeanTimeInLast2Bins : The signal has its mean maximum in the last two used FADC slice - signal extractor bad // BIT(14): kDeviatingNumPhes : The calculated number of photo-electrons deviates too much from the mean - inconsistency // BIT(15): kDeviatingFFactor : The calculated overall F-Factor deviates too much from the mean - inconsistency // BIT(16): kConversionHiLoNotValid: The calibrated Conversion between Hi-Gain and Low Gain gives absurd results // // These bits can be called with the enum MBadPixelsPix::UncalibratedType_t in combination // with the function IsUncalibrated(MBadPixelsPix::UncalibratedTupe_t), e.g. // MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainNotCalibrated) asks if the Hi Gain signal // could be calibrated. // // Two additional functions yield specific calibration information: // * IsCalibrationSignalOK() asks if the extracted calibration signal showed any inconsistency // * IsCalibrationResultOK() asks if the applied calibration can be used at all. // ///////////////////////////////////////////////////////////////////////////// #include "MBadPixelsPix.h" #include "MLog.h" #include "MLogManip.h" ClassImp(MBadPixelsPix); using namespace std; const Int_t MBadPixelsPix::fgRunMask = MBadPixelsPix::kUnsuitableRun | MBadPixelsPix::kUnreliableRun; // ------------------------------------------------------------------------ // // Initialize Pixel to be Ok. // MBadPixelsPix::MBadPixelsPix(const char* name, const char* title) : fInfo(5) { fName = name ? name : "MBadPixelsPix"; fTitle = title ? title : "Container storing bad pixel information for a single pixel"; fInfo[1] = 0; } // ------------------------------------------------------------------------ // // Invalidate all bits which are not run-wise. This will be called for // all entries in the parameter list, just before each time the task-list // is executed. // void MBadPixelsPix::Reset() { fInfo[0] &= fgRunMask; } // ------------------------------------------------------------------------ // // Invalidate values (set=0 which mean Pixel OK) // void MBadPixelsPix::Clear(Option_t *o) { fInfo.Reset(0); } // ------------------------------------------------------------------------ // // Merge (bitwise or) the information in pix into this pixel. // void MBadPixelsPix::Merge(const MBadPixelsPix &pix) { const Int_t n = pix.fInfo.GetSize(); if (n>fInfo.GetSize()) fInfo.Set(n); for (int i=0; i