00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef DaqEvent_DaqCrate_H
00016 #define DaqEvent_DaqCrate_H 1
00017
00018
00019 #include "Context/TimeStamp.h"
00020 #include "Conventions/Detectors.h"
00021 #include "EventReadoutFormat/EventReadout.h"
00022 #include "Event/DaqLtb.h"
00023 #include "Event/DaqLtbFrame.h"
00024 #include "GaudiKernel/boost_allocator.h"
00025 #include <ostream>
00026
00027
00028
00029 namespace DayaBay
00030 {
00031
00032
00033 class DaqPmtCrate;
00034
00035
00045 class DaqCrate
00046 {
00047 public:
00048
00050 DaqCrate(const DybDaq::EventReadout* eventReadout);
00051
00053 DaqCrate(const DayaBay::Detector& detector,
00054 const unsigned int run,
00055 const unsigned int event);
00056
00058 DaqCrate(const DayaBay::DaqCrate& crate);
00059
00061 DaqCrate() : m_detector(0),
00062 m_eventReadout(0),
00063 m_ltb(0) {}
00064
00066 virtual ~DaqCrate();
00067
00069 virtual std::ostream& fillStream(std::ostream& s) const;
00070
00072 const DayaBay::DaqPmtCrate* asPmtCrate() const;
00073
00075 const DayaBay::Detector& detector() const;
00076
00078 unsigned int eventNumber() const;
00079
00081 const DybDaq::EventReadout& eventReadout() const;
00082
00084 unsigned int localTriggerNumber() const;
00085
00087 unsigned int runNumber() const;
00088
00090 const TimeStamp& triggerTime() const;
00091
00093 Trigger::TriggerType_t triggerType() const;
00094
00096 bool addLtb(const DaqLtb* ltb,
00097 const unsigned int slot);
00098
00099
00100 #ifndef GOD_NOALLOC
00102 static void* operator new ( size_t size )
00103 {
00104 return ( sizeof(DaqCrate) == size ?
00105 boost::singleton_pool<DaqCrate, sizeof(DaqCrate)>::malloc() :
00106 ::operator new(size) );
00107 }
00108
00112 static void* operator new ( size_t size, void* pObj )
00113 {
00114 return ::operator new (size,pObj);
00115 }
00116
00118 static void operator delete ( void* p )
00119 {
00120 boost::singleton_pool<DaqCrate, sizeof(DaqCrate)>::is_from(p) ?
00121 boost::singleton_pool<DaqCrate, sizeof(DaqCrate)>::free(p) :
00122 ::operator delete(p);
00123 }
00124
00127 static void operator delete ( void* p, void* pObj )
00128 {
00129 ::operator delete (p, pObj);
00130 }
00131 #endif
00132 protected:
00133
00135 DaqCrate& operator=(const DayaBay::DaqCrate& rhs);
00136
00138 const DayaBay::DaqLtbFrame& firstLtbFrame() const;
00139
00141 const DayaBay::DaqLtb& ltb() const;
00142
00144 DybDaq::EventReadout& eventReadout();
00145
00146 private:
00147
00149 void flushCache();
00150
00151 DayaBay::Detector* m_detector;
00152 DybDaq::EventReadout* m_eventReadout;
00153 const DayaBay::DaqLtb* m_ltb;
00154
00155 };
00156
00157 inline std::ostream& operator<< (std::ostream& str, const DaqCrate& obj)
00158 {
00159 return obj.fillStream(str);
00160 }
00161
00162 }
00163
00164
00165
00166
00167
00168
00169 #include "DaqPmtCrate.h"
00170
00171
00172 inline std::ostream& DayaBay::DaqCrate::fillStream(std::ostream& s) const
00173 {
00174 s << "{ " << "detector : " << m_detector << std::endl
00175 << "eventReadout : " << m_eventReadout << std::endl
00176 << "ltb : " << m_ltb << std::endl << " }";
00177 return s;
00178 }
00179
00180
00181
00182 #endif