emcRawDataObject.h

Go to the documentation of this file.
00001 #ifndef __EMCRAWDATAOBJECT_H__
00002 #define __EMCRAWDATAOBJECT_H__
00003 
00004 // Purpose: Storage object for EmCal Raw Data
00005 //
00006 // Description: This object is meant to be commonly used in on- and off-line
00007 //              codes.
00008 // Should be deprecated as soon as online code does not need it anylonger,
00009 // as it's now deprecated in offline.
00010 //
00011 // Author: Laurent Aphecetche (aphecetc@in2p3.fr)
00012 
00013 #ifndef __EMCDATAOBJECT_H__
00014 #include "emcDataObject.h"
00015 #endif
00016 #ifndef __EMCFEM_H__
00017 #include "EmcFEM.h"
00018 #endif
00019 #include <map>
00020 
00046   class emcRawDataObject : public emcDataObject
00047   {
00048 
00049   public:
00050 
00051     emcRawDataObject();
00052 
00053     emcRawDataObject(Int_t thesize,
00054                      Int_t * datamap,
00055                      Float_t* tac,
00056                      Float_t* hgpost, Float_t* lgpost,
00057                      Float_t* hgpre, Float_t* lgpre,
00058                      const cells* amucells,
00059                      int* dataerrors = 0);
00060 
00061     virtual ~emcRawDataObject();
00062     void SetCells(int iSM, int ctac, int cpre, int cpost);
00063     void GetCells(int index, int &ctac, int &cpre, int &cpost) const;
00064     int GetTACCell(int index) const;
00066     void Set(const int index,
00067              const int & tac,
00068              const int & hgpost, const int & lgpost,
00069              const int & hgpre, const int & lgpre, const int & dataerror);
00070 
00073     void Get(Int_t index,
00074              Float_t& tac,
00075              Float_t& hgpost, Float_t& lgpost,
00076              Float_t& hgpre, Float_t& lgpre,
00077              int& amupre, int& amupost, int& amutac,
00078              int& dataerror) const;
00079     void Get(Int_t index,
00080              Float_t& tac,
00081              Float_t& hgpost, Float_t& lgpost,
00082              Float_t& hgpre, Float_t& lgpre,
00083              int& dataerror) const;
00084 
00087     Float_t GetHGPost(Int_t index) const
00088     {
00089       return ValidIndex(index) ? fHGPost[index] : -9999;
00090     }
00091 
00094     Float_t GetHGPre(Int_t index) const
00095     {
00096       return ValidIndex(index) ? fHGPre[index] : -9999;
00097     }
00098 
00100     int GetIndexByTowerId(int towerid) const;
00101 
00104     Float_t GetLGPost(Int_t index) const
00105     {
00106       return ValidIndex(index) ? fLGPost[index] : -9999;
00107     }
00108 
00111     Float_t GetLGPre(Int_t index) const
00112     {
00113       return ValidIndex(index) ? fLGPre[index] : -9999;
00114     }
00115 
00118     Float_t GetTAC(Int_t index) const
00119     {
00120       return ValidIndex(index) ? fTAC[index] : -9999;
00121     }
00122 
00124     void resetAMUAddresses(const int fem) const;
00125 
00128     Int_t GetAMUPost(Int_t index) const
00129     {
00130       return ValidIndex(index) ? fAMUcells[index / fNumberOfWordsPerFEM].post : 255;
00131     }
00132 
00135     Int_t GetAMUPre(Int_t index) const
00136     {
00137       return ValidIndex(index) ? fAMUcells[index / fNumberOfWordsPerFEM].pre : 255;
00138     }
00139 
00143     Int_t GetAMUTAC(Int_t index) const
00144     {
00145       return ValidIndex(index) ? fAMUcells[index / fNumberOfWordsPerFEM].tac : 255;
00146     }
00147 
00150     Int_t GetNumberOfWordsPerFEM(void) const
00151     {
00152       return fNumberOfWordsPerFEM;
00153     }
00154 
00156     bool IsZero(Int_t index) const;
00157 
00158     friend ostream& operator << (ostream&, const emcRawDataObject&);
00159 
00160   private:
00162     Float_t * fTAC;
00164     Float_t * fHGPost;
00166     Float_t * fLGPost;
00168     Float_t * fHGPre;
00170     Float_t * fLGPre;
00172     cells * fAMUcells;
00174     bool fOwnAllocation;
00176     Int_t fNumberOfWordsPerFEM;
00178     std::map<int, int> fIndexMap;
00179 
00180   private:
00181     // Copy constructor and assignation (disabled by default).
00182     emcRawDataObject(const emcRawDataObject& obj);
00183     // Assignment operator (disabled).
00184     emcRawDataObject& operator = (const emcRawDataObject& obj);
00185 
00186   public:
00187     ClassDef(emcRawDataObject, 1)
00188   };
00189 
00190 #endif // #ifndef __emcRawDataObject_h__