00001
00002 #ifndef EVENT_HH
00003 #define EVENT_HH
00004
00005 // //
00006
00007
00008
00009 #include "event/ChannelHit.hh"
00010 #include "slowControl/BoardSlowControl.hh"
00011 #include "mTypes.h"
00012 #include <set>
00013 #include <map>
00014
00015
00016
00017 class SlowControlEntry;
00018 class Chamber;
00019 class Channel;
00020 class Run;
00021
00022 struct sorter
00023 {
00024 bool operator() (const ChannelHit * lhs, const ChannelHit * rhs) const
00025 {
00026 return lhs->getAnalogValue() > rhs->getAnalogValue();
00027 }
00028 };
00029
00030
00031 class Chamber;
00032
00033
00034 ;
00035
00036
00037
00038
00039 class Event {
00040 friend std::ostream& operator <<(std::ostream &out, const Event &x);
00041
00042 public:
00043 Event(Run &aRun);
00044 Event(Run&, i64 aTimestamp, i32 aId);
00045
00046 ~Event();
00047 std::ostream& operator <<(std::ostream &out) const;
00048
00049 inline const Run& getRun(void) const { return run; }
00050 inline i32 getId(void) const { return id; }
00051 void setId(i32 aId) { id = aId; }
00052 inline const i64 getTimeStamp(void) const { return timestamp; }
00053 inline const i32 getDifSynchro(void) const { return difSynchro; }
00054 void setTimeStamp(i64 aTimestamp) { timestamp = aTimestamp; }
00055 void setDifSyncrho(i32 aDifSynchro) { difSynchro = aDifSynchro; }
00056
00057 inline ui64 getChannelHitSize(ui32 chamberId) const{ return channelHits.find(chamberId)->second->size(); }
00058 ui64 getChannelHitSize() const;
00059 std::map<ui16, std::multiset<ChannelHit*,sorter>* >& getChannelHits() { return channelHits; } ;
00060
00061 const ChannelHit& getChannelHitByOrder( ui64 order ,const Chamber& aChamber) ;
00062 const ChannelHit& getChannelHitByOrder( ui64 order ,const Chamber& aChamber, i16 aThreshold) ;
00063
00064 void insertHit( Chamber&, ChannelHit *);
00065
00066 const std::multiset<ChannelHit*,sorter>& getChannelHitVector(const Chamber& aChamber) const ;
00067 void print(void) const;
00068
00069 void setSlowControlParam(const SlowControlEntry* params);
00070
00071 const float getPressure() const ;
00072 const float getTemperature() const ;
00073 inline const SlowControlEntry* getSlowControlEntry() { return slowControlEntry;};
00074 const float getBoardDriftVolt(const ui32 chamberId,const ui32 difId, const ui32 boardId) const ;
00075 const float getBoardMeshVolt(const ui32 chamberId,const ui32 difId, const ui32 boardId) const;
00076 const BoardSlowControl& getBoardSlowControl(const ui32 chamberId,const ui32 difId, const ui32 boardId) const;
00077
00078
00079 void setGlobalTriggerCounter(ui32 value) { globalTriggerCounter = value; };
00080 void setDifTriggerCounter(ui32 value) { difTriggerCounter = value; };
00081 ui32 getGlobalTriggerCounter(void) const { return globalTriggerCounter; };
00082 ui32 getDifTriggerCounter(void) const { return difTriggerCounter; };
00083 bool getCrcIsCorrect(void) const { return crcIsCorrect;} ;
00084 void setCrcIsCorrect(bool value) { crcIsCorrect = value; };
00085 ui16 getValidFlag(void) const { return valid;} ;
00086 std::string getValidFlagString(void ) const;
00087
00088 void setValidFlag(ui16 value,bool valid=true);
00089 bool isValid(void);
00090
00091 void setTemperature(ui16 difId, float asu1, float asu2, float dif);
00092 float getTemperatureAsu1( ui16 difId ) const ;
00093 float getTemperatureAsu2( ui16 difId ) const ;
00094 float getTemperatureDif( ui16 difId ) const ;
00095
00096
00097 std::map<unsigned int,float>getTemperatureAsu1(void) const { return temperatureAsu1; } ;
00098 std::map<unsigned int,float>getTemperatureAsu2(void) const{ return temperatureAsu2; } ;
00099 std::map<unsigned int,float>getTemperatureDif(void) const { return temperatureDif; } ;
00100
00101
00102
00103
00104
00105 private:
00106 void initChannelHitVector(void);
00107
00108 private:
00109 i32 id;
00110 const Run &run;
00111 i64 timestamp;
00112 i32 difSynchro;
00113 std::map<ui16, std::multiset<ChannelHit*,sorter>* > channelHits;
00114 const SlowControlEntry *slowControlEntry;
00115 ui32 globalTriggerCounter;
00116 ui32 difTriggerCounter;
00117 bool crcIsCorrect;
00118 ui16 valid;
00119
00120 std::map<unsigned int,float> temperatureAsu1;
00121 std::map<unsigned int,float> temperatureAsu2;
00122 std::map<unsigned int,float> temperatureDif;
00123
00124
00125 };
00126
00127 #endif
00128