00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ReadoutEvent_ReadoutPmtCrate_H
00016 #define ReadoutEvent_ReadoutPmtCrate_H 1
00017
00018
00019 #include "Event/Readout.h"
00020 #include "Conventions/Electronics.h"
00021 #include "Event/ReadoutPmtChannel.h"
00022 #include "Event/DaqPmtCrate.h"
00023 #include "GaudiKernel/boost_allocator.h"
00024 #include <ostream>
00025
00026
00027
00028 namespace DayaBay
00029 {
00030
00031
00032 class ReadoutTriggerDataPkg;
00033
00034
00044 class ReadoutPmtCrate: public Readout
00045 {
00046 public:
00047
00049 typedef std::map<DayaBay::FeeChannelId,DayaBay::ReadoutPmtChannel> PmtChannelReadouts;
00051 typedef std::map<DayaBay::FadcChannelId,DayaBay::DigitalSignal> FadcReadouts;
00052
00054 ReadoutPmtCrate(const DayaBay::Detector& detector,
00055 unsigned int triggerNumber,
00056 const TimeStamp& triggerTime,
00057 const DayaBay::Trigger::TriggerType_t& triggerType) : Readout(detector,
00058 triggerNumber,
00059 triggerTime,
00060 triggerType),
00061 m_triggerDataPkg(0) {}
00062
00064 ReadoutPmtCrate(const DayaBay::ReadoutPmtCrate& rhs);
00065
00067 ReadoutPmtCrate() : m_channelReadout(),
00068 m_fadcReadout(),
00069 m_triggerDataPkg(0) {}
00070
00072 ~ReadoutPmtCrate();
00073
00075 ReadoutPmtCrate& operator=(const DayaBay::ReadoutPmtCrate& rhs);
00076
00078 void addChannel(const DayaBay::FeeChannelId& channelId);
00079
00081 ReadoutPmtChannel& channel(const DayaBay::FeeChannelId& channelId);
00082
00084 std::vector<DayaBay::FeeChannelId> channels();
00085
00087 const DayaBay::DaqCrate* daqCrate(const unsigned int run,
00088 const unsigned int event,
00089 const unsigned int ltbSlot) const;
00090
00092 const DayaBay::DaqLtb* dummyLtb() const;
00093
00095 std::ostream& fillStream(std::ostream& s) const;
00096
00099 const PmtChannelReadouts& channelReadout() const;
00100
00103 void setChannelReadout(const PmtChannelReadouts& value);
00104
00107 const FadcReadouts& fadcReadout() const;
00108
00111 FadcReadouts& fadcReadout();
00112
00115 void setFadcReadout(const FadcReadouts& value);
00116
00119 const DayaBay::ReadoutTriggerDataPkg* triggerDataPkg() const;
00120
00123 void setTriggerDataPkg(DayaBay::ReadoutTriggerDataPkg* value);
00124
00125
00126 #ifndef GOD_NOALLOC
00128 static void* operator new ( size_t size )
00129 {
00130 return ( sizeof(ReadoutPmtCrate) == size ?
00131 boost::singleton_pool<ReadoutPmtCrate, sizeof(ReadoutPmtCrate)>::malloc() :
00132 ::operator new(size) );
00133 }
00134
00138 static void* operator new ( size_t size, void* pObj )
00139 {
00140 return ::operator new (size,pObj);
00141 }
00142
00144 static void operator delete ( void* p )
00145 {
00146 boost::singleton_pool<ReadoutPmtCrate, sizeof(ReadoutPmtCrate)>::is_from(p) ?
00147 boost::singleton_pool<ReadoutPmtCrate, sizeof(ReadoutPmtCrate)>::free(p) :
00148 ::operator delete(p);
00149 }
00150
00153 static void operator delete ( void* p, void* pObj )
00154 {
00155 ::operator delete (p, pObj);
00156 }
00157 #endif
00158 protected:
00159
00160 private:
00161
00162 PmtChannelReadouts m_channelReadout;
00163 FadcReadouts m_fadcReadout;
00164 DayaBay::ReadoutTriggerDataPkg* m_triggerDataPkg;
00165
00166 };
00167
00168 inline std::ostream& operator<< (std::ostream& str, const ReadoutPmtCrate& obj)
00169 {
00170 return obj.fillStream(str);
00171 }
00172
00173 }
00174
00175
00176
00177
00178
00179
00180 #include "ReadoutTriggerDataPkg.h"
00181
00182
00183 inline const DayaBay::ReadoutPmtCrate::PmtChannelReadouts& DayaBay::ReadoutPmtCrate::channelReadout() const
00184 {
00185 return m_channelReadout;
00186 }
00187
00188 inline void DayaBay::ReadoutPmtCrate::setChannelReadout(const PmtChannelReadouts& value)
00189 {
00190 m_channelReadout = value;
00191 }
00192
00193 inline const DayaBay::ReadoutPmtCrate::FadcReadouts& DayaBay::ReadoutPmtCrate::fadcReadout() const
00194 {
00195 return m_fadcReadout;
00196 }
00197
00198 inline DayaBay::ReadoutPmtCrate::FadcReadouts& DayaBay::ReadoutPmtCrate::fadcReadout()
00199 {
00200 return m_fadcReadout;
00201 }
00202
00203 inline void DayaBay::ReadoutPmtCrate::setFadcReadout(const FadcReadouts& value)
00204 {
00205 m_fadcReadout = value;
00206 }
00207
00208 inline const DayaBay::ReadoutTriggerDataPkg* DayaBay::ReadoutPmtCrate::triggerDataPkg() const
00209 {
00210 return m_triggerDataPkg;
00211 }
00212
00213 inline void DayaBay::ReadoutPmtCrate::setTriggerDataPkg(DayaBay::ReadoutTriggerDataPkg* value)
00214 {
00215 m_triggerDataPkg = value;
00216 }
00217
00218 inline void DayaBay::ReadoutPmtCrate::addChannel(const DayaBay::FeeChannelId& channelId)
00219 {
00220
00221 m_channelReadout[channelId] = DayaBay::ReadoutPmtChannel(channelId,
00222 this);
00223
00224 }
00225
00226 inline DayaBay::ReadoutPmtChannel& DayaBay::ReadoutPmtCrate::channel(const DayaBay::FeeChannelId& channelId)
00227 {
00228 return m_channelReadout[channelId];
00229 }
00230
00231 inline std::vector<DayaBay::FeeChannelId> DayaBay::ReadoutPmtCrate::channels()
00232 {
00233
00234 DayaBay::ReadoutPmtCrate::PmtChannelReadouts::iterator crIter = m_channelReadout.begin();
00235 std::vector<DayaBay::FeeChannelId> channels;
00236 for(;crIter != m_channelReadout.end(); crIter++)
00237 channels.push_back(crIter->first);
00238 return channels;
00239
00240 }
00241
00242
00243 #endif