00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ElecEvent_ElecFecCrate_H
00016 #define ElecEvent_ElecFecCrate_H 1
00017
00018
00019 #include "Event/ElecCrate.h"
00020 #include "Conventions/Electronics.h"
00021 #include "GaudiKernel/boost_allocator.h"
00022 #include <ostream>
00023
00024
00025
00026 namespace DayaBay
00027 {
00028
00029
00030
00040 class ElecFecCrate: public ElecCrate
00041 {
00042 public:
00043
00045 typedef std::map<DayaBay::FecChannelId,DayaBay::DigitalSignal> ChannelData;
00046
00048 ElecFecCrate(const DayaBay::Detector& detector,
00049 DayaBay::ElecCrateHeader* header);
00050
00052 ElecFecCrate(const Site::Site_t& site,
00053 const DetectorId::DetectorId_t& detectorId,
00054 DayaBay::ElecCrateHeader* header);
00055
00057 ElecFecCrate() : m_channelData() {}
00058
00060 virtual ~ElecFecCrate() {}
00061
00063 virtual std::ostream& fillStream(std::ostream& s) const;
00064
00066 void addChannel(const DayaBay::FecChannelId& channelId);
00067
00069 DigitalSignal& channel(const DayaBay::FecChannelId& channelId);
00070
00073 const ChannelData& channelData() const;
00074
00077 void setChannelData(const ChannelData& value);
00078
00079
00080 #ifndef GOD_NOALLOC
00082 static void* operator new ( size_t size )
00083 {
00084 return ( sizeof(ElecFecCrate) == size ?
00085 boost::singleton_pool<ElecFecCrate, sizeof(ElecFecCrate)>::malloc() :
00086 ::operator new(size) );
00087 }
00088
00092 static void* operator new ( size_t size, void* pObj )
00093 {
00094 return ::operator new (size,pObj);
00095 }
00096
00098 static void operator delete ( void* p )
00099 {
00100 boost::singleton_pool<ElecFecCrate, sizeof(ElecFecCrate)>::is_from(p) ?
00101 boost::singleton_pool<ElecFecCrate, sizeof(ElecFecCrate)>::free(p) :
00102 ::operator delete(p);
00103 }
00104
00107 static void operator delete ( void* p, void* pObj )
00108 {
00109 ::operator delete (p, pObj);
00110 }
00111 #endif
00112 protected:
00113
00114 private:
00115
00116 ChannelData m_channelData;
00117
00118 };
00119
00120 inline std::ostream& operator<< (std::ostream& str, const ElecFecCrate& obj)
00121 {
00122 return obj.fillStream(str);
00123 }
00124
00125 }
00126
00127
00128
00129
00130
00131
00132
00133 inline DayaBay::ElecFecCrate::ElecFecCrate(const DayaBay::Detector& detector,
00134 DayaBay::ElecCrateHeader* header)
00135 {
00136
00137 setDetector(detector);
00138 setHeader(header);
00139
00140 }
00141
00142 inline DayaBay::ElecFecCrate::ElecFecCrate(const Site::Site_t& site,
00143 const DetectorId::DetectorId_t& detectorId,
00144 DayaBay::ElecCrateHeader* header)
00145 {
00146
00147 setDetector(DayaBay::Detector(site,
00148 detectorId));
00149 setHeader(header);
00150
00151 }
00152
00153 inline std::ostream& DayaBay::ElecFecCrate::fillStream(std::ostream& s) const
00154 {
00155 ElecCrate::fillStream(s);
00156 s << "{ " << "channelData : " << m_channelData << std::endl << " }";
00157 return s;
00158 }
00159
00160
00161 inline const DayaBay::ElecFecCrate::ChannelData& DayaBay::ElecFecCrate::channelData() const
00162 {
00163 return m_channelData;
00164 }
00165
00166 inline void DayaBay::ElecFecCrate::setChannelData(const ChannelData& value)
00167 {
00168 m_channelData = value;
00169 }
00170
00171 inline void DayaBay::ElecFecCrate::addChannel(const DayaBay::FecChannelId& channelId)
00172 {
00173
00174 m_channelData[channelId];
00175
00176 }
00177
00178 inline DayaBay::DigitalSignal& DayaBay::ElecFecCrate::channel(const DayaBay::FecChannelId& channelId)
00179 {
00180 return m_channelData[channelId];
00181 }
00182
00183
00184 #endif