00001 #ifndef EVENT_HH
00002 #define EVENT_HH
00003
00004 // //
00005
00006
00007
00008 #include "ChannelHit.hh"
00009 #include "mTypes.h"
00010 #include <set>
00011 #include <map>
00012
00013 class SlowControlEntry;
00014 class Chamber;
00015 class Channel;
00016 class Run;
00017 struct sorter
00018 {
00019 bool operator() (const ChannelHit * lhs, const ChannelHit * rhs) const
00020 {
00021 return lhs->getValue() > rhs->getValue();
00022 }
00023 };
00024
00025
00026 class Chamber;
00027
00028
00029
00030 class Event {
00031 friend std::ostream& operator <<(std::ostream &out, const Event &x);
00032
00033 public:
00034 Event(Run &aRun);
00035 Event(Run&, i64 aTimestamp, i32 aId);
00036
00037 ~Event();
00038 std::ostream& Event::operator <<(std::ostream &out) const;
00039
00040 inline const Run& getRun(void) const { return run; }
00041 inline i32 getId(void) const { return id; }
00042 void setId(i32 aId) { id = aId; }
00043 inline const i64 getTimeStamp(void) const { return timestamp; }
00044 void setTimeStamp(i64 aTimestamp) { timestamp = aTimestamp; }
00045
00046 inline ui64 getChannelHitSize(ui32 chamberId) const{ return channelHits.find(chamberId)->second.size(); }
00047
00048 const ChannelHit& getChannelHitByOrder( ui64 order ,const Chamber& aChamber) ;
00049 const ChannelHit& getChannelHitByOrder( ui64 order ,const Chamber& aChamber, i16 aThreshold) ;
00050
00051 ui64 getChannelHitOrder(const Channel& achannel ,const Chamber& aChamber) ;
00052 ui64 getChannelHitOrder(const ChannelHit& aChannelHit ,const Chamber& aChamber, bool sort);
00053 void insertHit( Chamber&, ChannelHit *);
00054
00055 const std::multiset<ChannelHit*,sorter>& getChannelHitVector(const Chamber& aChamber) const ;
00056 void print(void) const;
00057
00058 void setSlowControlParam(const SlowControlEntry* params);
00059
00060 const float getPressure() const ;
00061 const float getTemperature() const ;
00062 const float getDriftVolt(i32 chamberId) const ;
00063 const float getMeshVolt(i32 chamberId) const;
00064 inline const SlowControlEntry* getSlowControlEntry() { return slowControlEntry;};
00065
00066 private:
00067 void initChannelHitVector(void);
00068
00069 private:
00070 i32 id;
00071 const Run &run;
00072 i64 timestamp;
00073
00074
00075 std::map<ui16, std::multiset<ChannelHit*,sorter> > channelHits;
00076 const SlowControlEntry *slowControlEntry;
00077 };
00078
00079 #endif
00080