00001 #ifndef ROOT_MTEvent 00002 #define ROOT_MTEvent 00003 00004 ////////////////////////////////////////////////////////////////////////// 00005 // // 00006 // MTEvent for MICROMEGAS GASSIPLEX READOUT // 00007 // // 00008 // Description of the event and channel parameters // 00009 // // 00010 ////////////////////////////////////////////////////////////////////////// 00011 00012 #include "TObject.h" 00013 #include "TClonesArray.h" 00014 #include "TRefArray.h" 00015 #include "TRef.h" 00016 #include "TH1.h" 00017 #include "TMath.h" 00018 00019 class TDirectory; 00020 class Event; 00021 class ChannelHit; 00022 00023 //////////////////////////////////////////////////////////////////////////////////////// 00024 /// CLASS CHANNEL 00025 /////////////////////////////////////////////////////////////////////////////////////// 00026 class MTChannel : public TObject { 00027 00028 private: 00029 Int_t fValue; // Value of MTChannel 00030 UInt_t fSoftId; // unique Id of MTChannel for all Chambers a // softId = 10 000 * chamberID + 100 * column + Row 00031 UInt_t fHardId; // Id of MTChannel for its chamber 00032 Int_t fx; // X coordinate of channel 00033 Int_t fY; // Y coordinate of channel 00034 Int_t fZ; // Z coordinate of channel 00035 UInt_t fOrder; // Order of MTChannel for its chamber 00036 Float_t fMeshVoltage; // Mesh voltage for corresponding chamber 00037 Float_t fDriftVoltage;// Drift voltage for corresponding chamber 00038 // hardroc-specific data 00039 ULong64_t timestamp; // common unix timestamp 00040 UInt_t bcId_Abs; // t1: absolute BCID (BCID_abs) 00041 UInt_t bcId_Dif; // t2: BCID of the DIF (BCID_dif) 00042 UInt_t bcId_Hit; // t3: BCID of the hit (BCID_hit) 00043 00044 00045 public: 00046 MTChannel(){;} 00047 MTChannel(const MTChannel& orig); // copy constructor 00048 // MTChannel(Int_t value, UInt_t softId, UInt_t hardId, Int_t valueX, Int_t valueY, Int_t valueZ, UInt_t order); 00049 // MTChannel(Int_t value, UInt_t softId, UInt_t hardId, Int_t valueX, Int_t valueY, Int_t valueZ, UInt_t order, 00050 // ULong64_t timestamp, UInt_t bcId_Abs, UInt_t bcId_Dif, UInt_t bcId_Hit); 00051 MTChannel(const ChannelHit& hit, UInt_t order); 00052 virtual ~MTChannel() {Clear();} 00053 Int_t GetValue(void) const { return fValue; } 00054 UInt_t GetSoftId(void) const { return fSoftId; } 00055 UInt_t GetHardId(void) const { return fHardId; } 00056 Int_t GetX(void) const { return fx; } 00057 Int_t GetY(void) const { return fY; } 00058 Int_t GetZ(void) const { return fZ; } 00059 UInt_t GetOrder(void) const { return fOrder; } 00060 UInt_t GetChamberId(void) const; 00061 UInt_t GetChb(void) const { return GetChamberId();} 00062 UInt_t GetDifId(void) const { return((fSoftId / 1000000) % 100); }; 00063 ULong64_t GetTimestamp(void) const { return(timestamp); }; 00064 UInt_t GetBcId_Abs(void) const { return(bcId_Abs); }; 00065 UInt_t GetBcId_Dif(void) const { return(bcId_Dif); }; 00066 UInt_t GetBcId_Hit(void) const { return(bcId_Hit); }; 00067 00068 void SetDriftVoltage(Float_t aValue) { fDriftVoltage = aValue;} ; 00069 void SetMeshVoltage(Float_t aValue) { fMeshVoltage = aValue;} ; 00070 00071 00072 ClassDef(MTChannel, 3) 00073 00074 }; 00075 00076 00077 00078 //////////////////////////////////////////////////////////////////////////////////////// 00079 /// CLASS EVENT (containing Header and MTChannel) 00080 /////////////////////////////////////////////////////////////////////////////////////// 00081 class MTEvent : public TObject { 00082 00083 private: 00084 UInt_t fEventId; 00085 UInt_t fRunId; 00086 Double32_t fTemperature; 00087 Double32_t fPressure; 00088 ULong64_t fTimestamp; 00089 00090 Int_t fNchannel; //Number of channels hit for this event 00091 TClonesArray *fChannels; //->array with all channels 00092 // Les channels sont trier par ordre de reponse avant d'etre insere dans le TClonesArray. Ainsi fChannels[0] contiendra le channel ayant repondu le plus fort et fChannels[fChannels.GetSize()-1] contiendra le channel ayant repondu le moins fort` 00093 00094 // std::map<UInt_t, Float_t> meshVoltage; // mesh voltage for each Chambers 00095 // std::map<UInt_t, Float_t> DriftVoltage; // mesh voltage for each Chambers 00096 00097 static TClonesArray *fgChannels; 00098 00099 public: 00100 MTEvent(); 00101 virtual ~MTEvent(); 00102 MTEvent& operator=( const Event& rhs) ; 00103 void Build(UInt_t evtId, UInt_t runId, Double32_t temperature, Double32_t pressure , ULong64_t timestamp); 00104 void Clear(Option_t *option =""); 00105 static void Reset(Option_t *option =""); 00106 00107 void SetTemperature(Double32_t t) { fTemperature = t; } 00108 void SetPressure(Double32_t t) { fPressure = t; } 00109 void SetTimestamp(ULong64_t t) { fTimestamp = t; } 00110 // MTChannel* AddChannel(Int_t value, UInt_t softId, UInt_t hardId, Int_t valueX, Int_t valueY, Int_t valueZ, UInt_t order); 00111 // MTChannel* AddChannel(Int_t value, UInt_t softId, UInt_t hardId, Int_t valueX, Int_t valueY, Int_t valueZ); 00112 MTChannel* AddChannel(const ChannelHit& hit, UInt_t order); 00113 00114 UInt_t GetEventId() const { return fEventId; } 00115 UInt_t GetRunId() const { return fRunId; } 00116 UInt_t GetNchannel() const { return fNchannel; } 00117 void SetNchannel(Int_t n) { fNchannel = n; } 00118 00119 UInt_t GetNchannel(UInt_t chamberId) const ; 00120 Double32_t GetTemperature() const { return fTemperature; } 00121 Double32_t GetPressure() const { return fPressure; } 00122 TClonesArray* GetChannels() const {return fChannels;} 00123 MTChannel* GetChannelByOrder(UInt_t order,UInt_t chamberId) const; 00124 MTChannel* GetChannelBySoftId(UInt_t aSoftId) const ; 00125 00126 private: 00127 00128 ClassDef(MTEvent, 3) //MTEvent structure 00129 }; 00130 00131 #endif 00132