00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef DaqEvent_DaqPmtChannel_H
00016 #define DaqEvent_DaqPmtChannel_H 1
00017
00018
00019 #include "Conventions/Electronics.h"
00020 #include "FeeReadoutFormat/FeeHit.h"
00021 #include "FeeReadoutFormat/FeeReadout.h"
00022 #include "GaudiKernel/boost_allocator.h"
00023 #include <ostream>
00024
00025
00026
00027 namespace DayaBay
00028 {
00029
00030
00031
00041 class DaqPmtChannel
00042 {
00043 public:
00044
00046 DaqPmtChannel(const DybDaq::FeeHit& feeHit,
00047 const DayaBay::FeeChannelId& channelId);
00048
00050 DaqPmtChannel(const DayaBay::FeeChannelId& channelId,
00051 DybDaq::FeeReadout& feeReadout);
00052
00054 DaqPmtChannel() : m_feeHits(0),
00055 m_feeReadout(0),
00056 m_channelId() {}
00057
00059 virtual ~DaqPmtChannel();
00060
00062 virtual std::ostream& fillStream(std::ostream& s) const;
00063
00065 unsigned int hitCount() const;
00066
00068 unsigned int peakCycle(const unsigned int hit) const;
00069
00071 bool isHighGainAdc(const unsigned int hit) const;
00072
00074 unsigned int preAdcRaw(const unsigned int hit) const;
00075
00077 float preAdcAvg(const unsigned int hit) const;
00078
00080 unsigned int adc(const unsigned int hit) const;
00081
00083 float deltaAdc(const unsigned int hit) const;
00084
00086 unsigned int tdc(const unsigned int hit) const;
00087
00089 void addHit(const unsigned int hitNumber,
00090 const unsigned int peakCycle,
00091 const bool isHighGainAdc,
00092 const unsigned int pedestal,
00093 const unsigned int charge,
00094 const unsigned int time);
00095
00097 void addHit(const DybDaq::FeeHit& feeHit);
00098
00101 const DayaBay::FeeChannelId& channelId() const;
00102
00103
00104 #ifndef GOD_NOALLOC
00106 static void* operator new ( size_t size )
00107 {
00108 return ( sizeof(DaqPmtChannel) == size ?
00109 boost::singleton_pool<DaqPmtChannel, sizeof(DaqPmtChannel)>::malloc() :
00110 ::operator new(size) );
00111 }
00112
00116 static void* operator new ( size_t size, void* pObj )
00117 {
00118 return ::operator new (size,pObj);
00119 }
00120
00122 static void operator delete ( void* p )
00123 {
00124 boost::singleton_pool<DaqPmtChannel, sizeof(DaqPmtChannel)>::is_from(p) ?
00125 boost::singleton_pool<DaqPmtChannel, sizeof(DaqPmtChannel)>::free(p) :
00126 ::operator delete(p);
00127 }
00128
00131 static void operator delete ( void* p, void* pObj )
00132 {
00133 ::operator delete (p, pObj);
00134 }
00135 #endif
00136 protected:
00137
00138 private:
00139
00141 typedef std::vector<const DybDaq::FeeHit*> FeeHitPtrList;
00142
00144 const FeeHitPtrList& feeHits() const;
00145
00146 FeeHitPtrList* m_feeHits;
00147 DybDaq::FeeReadout* m_feeReadout;
00148 DayaBay::FeeChannelId m_channelId;
00149
00150 };
00151
00152 inline std::ostream& operator<< (std::ostream& str, const DaqPmtChannel& obj)
00153 {
00154 return obj.fillStream(str);
00155 }
00156
00157 }
00158
00159
00160
00161
00162
00163
00164
00165 inline std::ostream& DayaBay::DaqPmtChannel::fillStream(std::ostream& s) const
00166 {
00167 s << "{ " << "feeHits : " << m_feeHits << std::endl
00168 << "feeReadout : " << m_feeReadout << std::endl
00169 << "channelId : " << m_channelId << std::endl << " }";
00170 return s;
00171 }
00172
00173
00174 inline const DayaBay::FeeChannelId& DayaBay::DaqPmtChannel::channelId() const
00175 {
00176 return m_channelId;
00177 }
00178
00179
00180 #endif