00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef DaqEvent_DaqLtbFrame_H
00016 #define DaqEvent_DaqLtbFrame_H 1
00017
00018
00019 #include "Context/TimeStamp.h"
00020 #include "Conventions/Detectors.h"
00021 #include "Conventions/Trigger.h"
00022 #include "LtbReadoutFormat/LtbFrame.h"
00023 #include "GaudiKernel/boost_allocator.h"
00024 #include <ostream>
00025
00026
00027
00028 namespace DayaBay
00029 {
00030
00031
00032
00042 class DaqLtbFrame
00043 {
00044 public:
00045
00047 DaqLtbFrame(const DybDaq::LtbFrame& ltbFrame,
00048 const DayaBay::Detector& detector);
00049
00051 DaqLtbFrame(const unsigned int readoutType,
00052 const DayaBay::Trigger::TriggerType_t& triggerType,
00053 const TimeStamp& triggerTime,
00054 const unsigned int hitSum,
00055 const unsigned int energySum,
00056 const bool totalEsum,
00057 const bool highEsum,
00058 const bool lowEsum,
00059 const unsigned int crossTriggerSource,
00060 const DayaBay::Detector& detector);
00061
00063 DaqLtbFrame() : m_ltbFrame(0),
00064 m_detector(0),
00065 m_triggerTime(0),
00066 m_triggerType(0) {}
00067
00069 virtual ~DaqLtbFrame();
00070
00072 virtual std::ostream& fillStream(std::ostream& s) const;
00073
00075 const TimeStamp& triggerTime() const;
00076
00078 Trigger::TriggerType_t triggerType() const;
00079
00081 unsigned int hitSum() const;
00082
00084 bool totalEsum() const;
00085
00087 bool highEsum() const;
00088
00090 bool lowEsum() const;
00091
00093 unsigned int energySum() const;
00094
00096 DybDaq::LtbFrame* ltbFrame();
00097
00098
00099 #ifndef GOD_NOALLOC
00101 static void* operator new ( size_t size )
00102 {
00103 return ( sizeof(DaqLtbFrame) == size ?
00104 boost::singleton_pool<DaqLtbFrame, sizeof(DaqLtbFrame)>::malloc() :
00105 ::operator new(size) );
00106 }
00107
00111 static void* operator new ( size_t size, void* pObj )
00112 {
00113 return ::operator new (size,pObj);
00114 }
00115
00117 static void operator delete ( void* p )
00118 {
00119 boost::singleton_pool<DaqLtbFrame, sizeof(DaqLtbFrame)>::is_from(p) ?
00120 boost::singleton_pool<DaqLtbFrame, sizeof(DaqLtbFrame)>::free(p) :
00121 ::operator delete(p);
00122 }
00123
00126 static void operator delete ( void* p, void* pObj )
00127 {
00128 ::operator delete (p, pObj);
00129 }
00130 #endif
00131 protected:
00132
00133 private:
00134
00135 DybDaq::LtbFrame* m_ltbFrame;
00136 const DayaBay::Detector* m_detector;
00137 TimeStamp* m_triggerTime;
00138 DayaBay::Trigger::TriggerType_t* m_triggerType;
00139
00140 };
00141
00142 inline std::ostream& operator<< (std::ostream& str, const DaqLtbFrame& obj)
00143 {
00144 return obj.fillStream(str);
00145 }
00146
00147 }
00148
00149
00150
00151
00152
00153
00154
00155 inline std::ostream& DayaBay::DaqLtbFrame::fillStream(std::ostream& s) const
00156 {
00157 s << "{ " << "ltbFrame : " << m_ltbFrame << std::endl
00158 << "detector : " << m_detector << std::endl
00159 << "triggerTime : " << m_triggerTime << std::endl
00160 << "triggerType : " << m_triggerType << std::endl << " }";
00161 return s;
00162 }
00163
00164
00165
00166 #endif