00001 #ifndef TMuonEvent_hh_ 00002 #define TMuonEvent_hh_ 00003 00004 #include "definitions.h" 00005 #include "TDetectorPulse.h" 00006 #include "TSiliconEvent.h" 00007 #include <set> 00008 #include <vector> 00009 #include <TObject.h> 00010 00023 class TMuonEvent:public TObject{ 00024 public: 00025 enum LeftRight_t{kLeft, kRight}; 00026 00028 TMuonEvent(const TDetectorPulse* central_mu, double window): 00029 fCentralMuon(central_mu),fWindowWidth(window) {}; 00031 TMuonEvent(): 00032 fCentralMuon(NULL),fWindowWidth(0){}; 00033 00036 ~TMuonEvent(){} 00037 00039 void Reset(){ 00040 fPulseLists.clear(); 00041 fExhaustedChannels.clear(); 00042 } 00043 00045 void AddPulse(const IDs::source& source, TDetectorPulse* pulse); 00046 void AddPulses(const IDs::source& source, 00047 DetectorPulseList::const_iterator start, 00048 DetectorPulseList::const_iterator stop); 00049 00051 const IDs::source& GetSource(int n)const; 00053 int GetNumSources()const{return fPulseLists.size();}; 00059 int GetSourceIndex(const IDs::channel& ch, int start=0)const; 00060 int GetFirstSourceIndex(const IDs::channel& ch)const; 00061 int GetLastSourceIndex(const IDs::channel& ch)const; 00062 00065 const TDetectorPulse* GetPulse(const IDs::source& detector, int index)const; 00066 00069 DetectorPulseList::const_iterator BeginPulses(const IDs::source& detector)const; 00072 DetectorPulseList::const_iterator EndPulses(const IDs::source& detector)const; 00073 00075 int TotalNumPulses()const; 00081 int NumPulses(const IDs::channel& channel)const; 00084 int NumPulses(const IDs::source& source)const; 00085 00087 bool HasMuonHit()const; 00089 bool HasMuonPileup()const; 00090 00092 bool WasEarlyInEvent()const; 00094 bool WasLateInEvent(double event_length, double event_uncertainty)const; 00095 00097 void AllPulsesUsed(const IDs::source& so){fExhaustedChannels.insert(so);}; 00099 bool WereNoPulsesLeft()const{return fExhaustedChannels.size()!=0;}; 00101 bool WereNoPulsesLeft(const IDs::source& so)const{ 00102 return fExhaustedChannels.find(so)!=fExhaustedChannels.end();}; 00103 00105 double GetTime()const {return fCentralMuon->GetTime(TDetectorPulse::kFast);} 00106 double GetAmplitude()const {return fCentralMuon->GetAmplitude(TDetectorPulse::kFast);} 00107 const TDetectorPulse* GetCentralMuon()const {return fCentralMuon;} 00108 00109 void InsertSiliconEvent(LeftRight_t lr, const TSiliconEvent& si_evt){ 00110 fSiliconHits[lr].push_back(si_evt); 00111 } 00112 SiliconHitList::const_iterator BeginSiEvents(LeftRight_t lr)const{ return fSiliconHits[lr].begin();} 00113 SiliconHitList::const_iterator EndSiEvents(LeftRight_t lr)const{ return fSiliconHits[lr].end();} 00114 int NumSiHits(LeftRight_t lr)const{ return fSiliconHits[lr].size();} 00115 00116 private: 00117 SourceDetPulseMap fPulseLists; 00118 SiliconHitList fSiliconHits[2]; 00119 const TDetectorPulse* fCentralMuon; 00120 double fWindowWidth; 00121 typedef std::set<IDs::source> SourceSet; 00122 SourceSet fExhaustedChannels; 00123 00124 ClassDef(TMuonEvent, 1); 00125 }; 00126 #endif // TMuonEvent_hh_