emcDataObject.h

Go to the documentation of this file.
00001 #ifndef __EMCDATAOBJECT_H__
00002 #define __EMCDATAOBJECT_H__
00003 
00004 // Purpose: Base object for RawDataObject, MixedDataObject and
00005 // CalibratedDataObject
00006 //
00007 // Description: Implements a few methods common to all data objects
00008 //
00009 // To be deprecated as soon as online code does not need it anylonger.
00010 //
00011 // Author: Yves Schutz (schutz@in2p3.fr)
00012 
00013 #include "TObject.h"
00014 
00021 class emcDataObject : public TObject
00022 {
00023 
00024 protected:
00025 
00027   emcDataObject();
00028   virtual ~emcDataObject();
00029 
00030 public:
00031 
00033   void Reset();
00034 
00035   void SetDataDescriptionPointers(Int_t * datamap,
00036                                   long * softwareKey,
00037                                   Int_t * dataerrors);
00038   void GetDataDescriptionPointers(Int_t * &datamap,
00039                                   long * &softwareKey,
00040                                   Int_t * &dataerrors) const;
00041 
00042   void SetDataDescriptionPointers(Int_t * datamap,
00043                                   long * softwareKey,
00044                                   Int_t * dataerrors,
00045                                   Int_t * deadmap);
00046   void GetDataDescriptionPointers(Int_t * &datamap,
00047                                   long * &softwareKey,
00048                                   Int_t * &dataerrors,
00049                                   Int_t * &deadmap) const;
00050 
00051   // MV 2001/12/08
00052   void SetDataDescriptionPointers(Int_t * datamap,
00053                                   long * softwareKey,
00054                                   Int_t * dataerrors,
00055                                   Int_t * deadmap,
00056                                   Int_t * warnmap);
00057   void GetDataDescriptionPointers(Int_t * &datamap,
00058                                   long * &softwareKey,
00059                                   Int_t * &dataerrors,
00060                                   Int_t * &deadmap,
00061                                   Int_t * &warnmap) const;
00062 
00064   void DecodeKey(long key, Int_t& arm, Int_t& sector, Int_t& yrow, Int_t& zrow) const;
00065 
00069   Int_t GetDead(Int_t index) const;
00070   Int_t GetWarn(Int_t index) const;
00071 
00073   Int_t GetMaxSize(void) const
00074   {
00075     return fMaxSize;
00076   }
00077 
00079   Int_t GetDataError(Int_t index) const
00080   {
00081     return (ValidIndex(index) && (fDataErrors != 0)) ?
00082       fDataErrors[index] : -9999;
00083   }
00085   void AddDataError(Int_t index, int flag)
00086   {
00087     fDataErrors[index] |= flag;
00088   }
00090   Int_t* GetDataErrorPointer(void) const
00091   {
00092     return fDataErrors;
00093   }
00094 
00096   Int_t GetSize(void) const
00097   {
00098     return fSize;
00099   }
00100 
00102   Int_t GetItemId(Int_t index) const
00103   {
00104     return ((fDataMap) ? fDataMap[index] : -1);
00105   }
00106 
00108   long GenerateSoftwareKey(Int_t ItemId) const;
00109 
00111   long GetSoftwareKey(Int_t index) const
00112   {
00113     return ((fSoftKey) ? fSoftKey[index] : -1);
00114   }
00115 
00117   long GetErrorFlag(Int_t index) const
00118   {
00119     return ((fDataErrors) ? fDataErrors[index] : -1);
00120   }
00121 
00123   bool HasErrors(void) const;
00124 
00126   Bool_t ValidIndex(Int_t index) const
00127   {
00128     return ( index >= 0 && index < GetMaxSize() );
00129   }
00130 
00131 protected:
00132 
00134   Int_t fMaxSize; 
00135 
00136     Int_t fSize;
00138     Int_t * fDataErrors; //[fSize]
00140     Int_t * fDataMap; //[fSize]
00142     long * fSoftKey; 
00143 
00144     Int_t * fDeadMap; //[fSize]
00146     bool fOwnDeadMap;
00147     bool fReadOnly;
00148 
00149     // MV 2001/12/08
00151     Int_t * fWarnMap; //[fSize]
00153     bool fOwnWarnMap;
00154 
00155   public:
00156 
00157     // MV 2001/12/12 Incremented class version 1 -> 2
00158     ClassDef(emcDataObject, 2)
00159   };
00160 
00161 #endif // #ifndef __emcDataObject_h__