emcCalibratedDataObject.h

Go to the documentation of this file.
00001 #ifndef __EMCCALIBRATIONDATAOBJECT_H__
00002 #define __EMCCALIBRATIONDATAOBJECT_H__
00003 
00004 #ifndef __PHOBJECT_H__
00005 #include "PHObject.h"
00006 #endif
00007 #include "TString.h"
00008 #include <map>
00009 
00010 
00022 class emcCalibratedDataObject : public PHObject
00023 {
00024 
00025 public:
00026 
00027   // ctor
00028   emcCalibratedDataObject();
00029   // cctor
00030   emcCalibratedDataObject(const emcCalibratedDataObject& obj);
00031 
00032   emcCalibratedDataObject& operator = (const emcCalibratedDataObject& obj);
00033 
00034   // dtor
00035   virtual ~emcCalibratedDataObject();
00036 
00039 
00040   emcCalibratedDataObject& operator +=(const emcCalibratedDataObject& obj);
00042   emcCalibratedDataObject operator + (const emcCalibratedDataObject& obj) const
00043   {
00044     return emcCalibratedDataObject(*this) += obj;
00045   }
00047 
00049   Float_t ComputeTotalEnergy();
00050 
00052   Int_t CountHits(Float_t thres) const;
00053 
00055   void DecodeKey(long key, Int_t& arm, Int_t& sector, Int_t& yrow,
00056                  Int_t& zrow) const;
00057 
00060   long GenerateSoftwareKey(Int_t ItemId) const;
00061 
00063   void Get(Int_t index, Float_t& energy, Float_t& time) const;
00064 
00066   void Get(Int_t index, Int_t& TowerId, long & softwareKey,
00067            Int_t & errorFlag, Float_t& energy, Float_t& time) const;
00068 
00070   void GetByTowerId(Int_t towerId, Float_t& energy, Float_t& time) const;
00071 
00075   Int_t GetDead(Int_t index) const;
00076 
00078   Int_t GetDeadByTowerId(Int_t TowerId) const;
00079 
00080   // MV 2001/12/08 added warning map
00081   Int_t GetWarn(Int_t index) const;
00082 
00084   Int_t GetWarnByTowerId(Int_t TowerId) const;
00085 
00087   Float_t GetEnergy(Int_t index) const;
00088 
00090   Float_t GetEnergyByTowerId(Int_t towerId) const;
00091 
00093   Int_t GetIndexFromTowerId(Int_t TowerId) const;
00094 
00104   Int_t GetItemId(Int_t index) const
00105   {
00106     return GetTowerId(index);
00107   }
00108 
00110   Int_t GetMaxSize(void) const
00111   {
00112     return fMaxSize;
00113   }
00114 
00120   void GetPointers(float*& ENERGY, float*& TOF);
00121 
00125   void GetSectorEnergies(Float_t * e);
00126 
00128   Int_t GetSize(void) const
00129   {
00130     return fSize;
00131   }
00132 
00137   void GetSMEnergies(Float_t* e);
00138 
00140   long GetSoftwareKey(Int_t index) const;
00141 
00143   Float_t GetTime(Int_t index) const;
00144 
00146   Float_t GetTimeByTowerId(Int_t towerId) const;
00147 
00149   Int_t GetTowerId(Int_t index) const;
00150 
00153   Float_t GetTotalEnergy()
00154   {
00155     return fETotal;
00156   }
00157 
00159   void identify(ostream& out) const;
00160 
00162   Bool_t IsCalibrated(TString what) const;
00163 
00165   Bool_t IsZeroSuppressed(void) const
00166   {
00167     return fZeroSuppressed;
00168   }
00169 
00171   void Reset(void);
00172 
00174   void resetByIndex(int index);
00175 
00177   void resetByTowerId(int TowerId);
00178 
00180   void Set(int index, Int_t TowerId, long softwareKey, Int_t dummy = 0,
00181            float energy = 0., float time = 0., Int_t deadNeighbours = 0, Int_t warnNeighbours = 0);
00182 
00184   void SetEnergyCalibratedFlag(bool energycalibrated)
00185   {
00186     fEnergyCalibrated = energycalibrated;
00187   }
00188 
00190   void SetMaxSize(Int_t thesize);
00191 
00193   void SetTimeCalibratedFlag(bool timecalibrated)
00194   {
00195     fTimeCalibrated = timecalibrated;
00196   }
00197 
00199   void SetTotalEnergy(Float_t E)
00200   {
00201     fETotal = E;
00202   }
00203 
00205   void SetZeroSuppressedFlag(Bool_t flag = true)
00206   {
00207     fZeroSuppressed = flag;
00208   }
00209 
00211   TString Status(void);
00212 
00214   void Update(void);
00215 
00217   friend ostream& operator << (ostream&, const emcCalibratedDataObject&);
00218 
00219 private:
00220 
00221   // Copy obj into this
00222   void copyTo(emcCalibratedDataObject& obj) const;
00223 
00224   bool ValidIndex(Int_t index) const
00225   {
00226     return ( index >= 0 && index < fSize );
00227   }
00228 
00229   //==========================================================================
00230   //============================== Data members below ========================
00231 
00232 private:
00233 
00235   Int_t fSize;
00237   Int_t fMaxSize; 
00238 
00239   Float_t fETotal; 
00240 
00241   Float_t* fEnergy; //[fSize]
00243   Float_t* fTime; //[fSize]
00245   Int_t * fTowerId; //[fSize]
00247   Int_t * fDeadNeighbours; //[fSize]
00249   long * fSoftwareKey; 
00250 
00252   Bool_t fEnergyCalibrated;
00254   Bool_t fTimeCalibrated;
00256     Bool_t fZeroSuppressed;
00257 
00258     Bool_t fReadOnly; 
00259 
00260     // MV 2001/12/08
00262     Int_t *fWarnNeighbours; //[fSize]
00263 
00266     std::map<int, int> fIndexMap; 
00267 
00268   public:
00269 
00270     // MV 2001/12/12 Incremented version number 2 -> 3
00271     ClassDef(emcCalibratedDataObject, 3)
00272   };
00273 
00274 #endif // #ifndef __emcCalibratedDataObject_h__