/* ======================================================================== *\ ! ! * ! * 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 ! ! \* ======================================================================== */ ///////////////////////////////////////////////////////////////////////////// // // MBadPixelsCam // // // Storage container to store bad pixel of the camera... // ///////////////////////////////////////////////////////////////////////////// #include "MBadPixelsCam.h" #include #include #include "MLog.h" #include "MLogManip.h" #include "MBadPixelsPix.h" ClassImp(MBadPixelsCam); using namespace std; // -------------------------------------------------------------------------- // // Default constructor. // MBadPixelsCam::MBadPixelsCam(const char *name, const char *title) { fName = name ? name : "MBadPixelsCam"; fTitle = title ? title : "Storage container to store bad pixel information"; fArray = new TClonesArray("MBadPixelsPix", 1); } MBadPixelsCam::MBadPixelsCam(const MBadPixelsCam &cam) { fName = "MBadPixelsCam"; fTitle = "Storage container to store bad pixel information"; fArray = new TClonesArray("MBadPixelsPix", 1); cam.Copy(*fArray); } // -------------------------------------------------------------------------- // // Delete the array conatining the bad pixel information // MBadPixelsCam::~MBadPixelsCam() { delete fArray; } // -------------------------------------------------------------------------- // // Set the size of the camera // void MBadPixelsCam::InitSize(const UInt_t i) { fArray->ExpandCreate(i); } // -------------------------------------------------------------------------- // // Get the size of the MBadPixelsCam // Int_t MBadPixelsCam::GetSize() const { return fArray->GetEntriesFast(); } // -------------------------------------------------------------------------- // // Copy 'constructor' // void MBadPixelsCam::Copy(TObject &object) const { MBadPixelsCam &cam = (MBadPixelsCam&)object; const Int_t n = GetSize(); if (n==0) return; cam.InitSize(n); for (int i=0; i(fArray->UncheckedAt(i)); } // -------------------------------------------------------------------------- // // Get i-th pixel (pixel number) // const MBadPixelsPix &MBadPixelsCam::operator[](Int_t i) const { return *static_cast(fArray->UncheckedAt(i)); } // -------------------------------------------------------------------------- // // Merge two MBadPixelsCam together, see also MBadPixelsPix::Merge // void MBadPixelsCam::Merge(const MBadPixelsCam &cam) { const Int_t n = cam.GetSize(); if (n==0) { *fLog << warn << "MBadPixelsCam::Merge: Container empty." << endl; return; } if (GetSize()==0) InitSize(n); if (n!=GetSize()) { *fLog << warn << "MBadPixelsCam::Merge: Size mismatch... ignored." << endl; return; } for (int i=0; iForEach(TObject, Clear)(); } // -------------------------------------------------------------------------- // // Print the contents of all bad pixels // void MBadPixelsCam::Print(Option_t *o) const { *fLog << all << GetDescriptor() << ":" << endl; *fLog << "Pixels without problems:" << endl; *fLog << endl; Int_t count = 0; for (Int_t i=0; i=GetSize()) InitSize(idx+1); (*this)[idx].SetUnsuitable(MBadPixelsPix::kUnsuitableRun); } } // -------------------------------------------------------------------------- // // Write the information into an ascii file. If a run-number is given the // run-number will lead the line. // Bool_t MBadPixelsCam::AsciiWrite(ostream &fout, UInt_t run=0) const { if (run) fout << run << ":"; for (int i=0; i= GetSize()) return kFALSE; switch (type) { case 0: return (*this)[idx].GetInfo()[0]; case 1: return (*this)[idx].IsUnsuitable(MBadPixelsPix::kUnsuitableRun); case 2: return (*this)[idx].IsUnsuitable(MBadPixelsPix::kUnsuitableEvt); case 3: return (*this)[idx].IsUnsuitable(MBadPixelsPix::kUnreliableRun); case 4: return (*this)[idx].IsHiGainBad(); case 5: return (*this)[idx].IsLoGainBad(); case 6: return !(*this)[idx].IsCalibrationSignalOK(); case 7: return !(*this)[idx].IsCalibrationResultOK(); case 8: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainNotFitted); case 9: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainNotFitted); case 10: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainOscillating); case 11: return(*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainOscillating); case 12: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainSaturation ); case 13: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeIsPedestal ); case 14: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeErrNotValid); case 15: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeRelErrNotValid); case 16: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid ); case 17: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin ); case 18: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins ); case 19: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes ); case 20: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kRelTimeNotFitted ); case 21: return (*this)[idx].IsUncalibrated(MBadPixelsPix::kRelTimeOscillating ); default: return kFALSE; } return kFALSE; } void MBadPixelsCam::DrawPixelContent(Int_t num) const { *fLog << warn << "MBadPixelsCam::DrawPixelContent - not available." << endl; }