00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SimEvent_SimHitCollection_H
00016 #define SimEvent_SimHitCollection_H 1
00017
00018
00019 #include "Event/SimHit.h"
00020 #include "Conventions/Detectors.h"
00021 #include "GaudiKernel/boost_allocator.h"
00022 #include <vector>
00023 #include <ostream>
00024
00025
00026
00027 namespace DayaBay
00028 {
00029
00030
00031 class SimHitHeader;
00032
00033
00043 class SimHitCollection
00044 {
00045 public:
00046
00048 typedef std::vector<DayaBay::SimHit*> hit_container;
00049
00051 SimHitCollection(DayaBay::SimHitHeader* header,
00052 const DayaBay::Detector& det,
00053 const hit_container& hits) : m_header(header),
00054 m_detector(det),
00055 m_collection(hits) {}
00056
00058 SimHitCollection() : m_header(0),
00059 m_detector(),
00060 m_collection() {}
00061
00063 ~SimHitCollection();
00064
00066 hit_container& collection();
00067
00069 std::ostream& fillStream(std::ostream& s) const;
00070
00073 const DayaBay::SimHitHeader* header() const;
00074
00077 void setHeader(DayaBay::SimHitHeader* value);
00078
00081 const DayaBay::Detector& detector() const;
00082
00085 void setDetector(const DayaBay::Detector& value);
00086
00089 const hit_container& collection() const;
00090
00093 void setCollection(const hit_container& value);
00094
00095
00096 #ifndef GOD_NOALLOC
00098 static void* operator new ( size_t size )
00099 {
00100 return ( sizeof(SimHitCollection) == size ?
00101 boost::singleton_pool<SimHitCollection, sizeof(SimHitCollection)>::malloc() :
00102 ::operator new(size) );
00103 }
00104
00108 static void* operator new ( size_t size, void* pObj )
00109 {
00110 return ::operator new (size,pObj);
00111 }
00112
00114 static void operator delete ( void* p )
00115 {
00116 boost::singleton_pool<SimHitCollection, sizeof(SimHitCollection)>::is_from(p) ?
00117 boost::singleton_pool<SimHitCollection, sizeof(SimHitCollection)>::free(p) :
00118 ::operator delete(p);
00119 }
00120
00123 static void operator delete ( void* p, void* pObj )
00124 {
00125 ::operator delete (p, pObj);
00126 }
00127 #endif
00128 protected:
00129
00130 private:
00131
00132 DayaBay::SimHitHeader* m_header;
00133 DayaBay::Detector m_detector;
00134 hit_container m_collection;
00135
00136 };
00137
00138 inline std::ostream& operator<< (std::ostream& str, const SimHitCollection& obj)
00139 {
00140 return obj.fillStream(str);
00141 }
00142
00143 }
00144
00145
00146
00147
00148
00149
00150 #include "SimHitHeader.h"
00151
00152
00153 inline const DayaBay::SimHitHeader* DayaBay::SimHitCollection::header() const
00154 {
00155 return m_header;
00156 }
00157
00158 inline void DayaBay::SimHitCollection::setHeader(DayaBay::SimHitHeader* value)
00159 {
00160 m_header = value;
00161 }
00162
00163 inline const DayaBay::Detector& DayaBay::SimHitCollection::detector() const
00164 {
00165 return m_detector;
00166 }
00167
00168 inline void DayaBay::SimHitCollection::setDetector(const DayaBay::Detector& value)
00169 {
00170 m_detector = value;
00171 }
00172
00173 inline const DayaBay::SimHitCollection::hit_container& DayaBay::SimHitCollection::collection() const
00174 {
00175 return m_collection;
00176 }
00177
00178 inline void DayaBay::SimHitCollection::setCollection(const hit_container& value)
00179 {
00180 m_collection = value;
00181 }
00182
00183
00184 #endif