00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef DaqEvent_DaqFadcChannel_H
00016 #define DaqEvent_DaqFadcChannel_H 1
00017
00018
00019 #include "Conventions/Electronics.h"
00020 #include "FadcReadoutFormat/FadcReadout.h"
00021 #include "GaudiKernel/boost_allocator.h"
00022 #include <ostream>
00023
00024
00025
00026 namespace DayaBay
00027 {
00028
00029
00030
00040 class DaqFadcChannel
00041 {
00042 public:
00043
00045 typedef std::vector<unsigned int> FadcSamples;
00046
00048 DaqFadcChannel(const DybDaq::FadcData& fadcData,
00049 const DayaBay::FadcChannelId& channelId);
00050
00052 DaqFadcChannel(const DayaBay::FadcChannelId& channelId,
00053 DybDaq::FadcReadout& fadcReadout);
00054
00056 DaqFadcChannel() : m_samples(0),
00057 m_fadcReadout(0),
00058 m_channelId() {}
00059
00061 virtual ~DaqFadcChannel();
00062
00064 virtual std::ostream& fillStream(std::ostream& s) const;
00065
00067 const FadcSamples& samples() const;
00068
00070 void addData(const DybDaq::FadcData& fadcData);
00071
00074 const DayaBay::FadcChannelId& channelId() const;
00075
00076
00077 #ifndef GOD_NOALLOC
00079 static void* operator new ( size_t size )
00080 {
00081 return ( sizeof(DaqFadcChannel) == size ?
00082 boost::singleton_pool<DaqFadcChannel, sizeof(DaqFadcChannel)>::malloc() :
00083 ::operator new(size) );
00084 }
00085
00089 static void* operator new ( size_t size, void* pObj )
00090 {
00091 return ::operator new (size,pObj);
00092 }
00093
00095 static void operator delete ( void* p )
00096 {
00097 boost::singleton_pool<DaqFadcChannel, sizeof(DaqFadcChannel)>::is_from(p) ?
00098 boost::singleton_pool<DaqFadcChannel, sizeof(DaqFadcChannel)>::free(p) :
00099 ::operator delete(p);
00100 }
00101
00104 static void operator delete ( void* p, void* pObj )
00105 {
00106 ::operator delete (p, pObj);
00107 }
00108 #endif
00109 protected:
00110
00111 private:
00112
00113 FadcSamples* m_samples;
00114 DybDaq::FadcReadout* m_fadcReadout;
00115 DayaBay::FadcChannelId m_channelId;
00116
00117 };
00118
00119 inline std::ostream& operator<< (std::ostream& str, const DaqFadcChannel& obj)
00120 {
00121 return obj.fillStream(str);
00122 }
00123
00124 }
00125
00126
00127
00128
00129
00130
00131
00132 inline std::ostream& DayaBay::DaqFadcChannel::fillStream(std::ostream& s) const
00133 {
00134 s << "{ " << "samples : " << m_samples << std::endl
00135 << "fadcReadout : " << m_fadcReadout << std::endl
00136 << "channelId : " << m_channelId << std::endl << " }";
00137 return s;
00138 }
00139
00140
00141 inline const DayaBay::FadcChannelId& DayaBay::DaqFadcChannel::channelId() const
00142 {
00143 return m_channelId;
00144 }
00145
00146
00147 #endif