00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SimEvent_SimProcess_H
00016 #define SimEvent_SimProcess_H 1
00017
00018
00019 #include "GaudiKernel/boost_allocator.h"
00020 #include "GaudiKernel/SerializeSTL.h"
00021 #include <string>
00022 #include <ostream>
00023
00024
00025
00026 namespace DayaBay
00027 {
00028
00029
00030 using GaudiUtils::operator<<;
00031
00032
00042 class SimProcess
00043 {
00044 public:
00045
00047 enum Type{ kUnknown = 0,
00048 kPrimaryVertex,
00049 kWorldBoundary,
00050 kGeomBoundary,
00051 kParticleStart,
00052 kTransportation,
00053 kElectromagnetic,
00054 kOptical,
00055 kHadronic,
00056 kPhotolepton_hadron,
00057 kDecay,
00058 kGeneral,
00059 kParameterisation,
00060 kUserDefined
00061 };
00062
00064 SimProcess(const Type& t,
00065 const std::string& name) : m_type(t),
00066 m_name(name) {}
00067
00069 SimProcess() : m_type(kUnknown),
00070 m_name("") {}
00071
00073 virtual ~SimProcess() {}
00074
00076 virtual std::ostream& fillStream(std::ostream& s) const;
00077
00079 bool isValid() const;
00080
00083 const Type& type() const;
00084
00087 const std::string& name() const;
00088
00089
00090 #ifndef GOD_NOALLOC
00092 static void* operator new ( size_t size )
00093 {
00094 return ( sizeof(SimProcess) == size ?
00095 boost::singleton_pool<SimProcess, sizeof(SimProcess)>::malloc() :
00096 ::operator new(size) );
00097 }
00098
00102 static void* operator new ( size_t size, void* pObj )
00103 {
00104 return ::operator new (size,pObj);
00105 }
00106
00108 static void operator delete ( void* p )
00109 {
00110 boost::singleton_pool<SimProcess, sizeof(SimProcess)>::is_from(p) ?
00111 boost::singleton_pool<SimProcess, sizeof(SimProcess)>::free(p) :
00112 ::operator delete(p);
00113 }
00114
00117 static void operator delete ( void* p, void* pObj )
00118 {
00119 ::operator delete (p, pObj);
00120 }
00121 #endif
00122 protected:
00123
00124 private:
00125
00126 Type m_type;
00127 std::string m_name;
00128
00129 };
00130
00131 inline std::ostream& operator<< (std::ostream& str, const SimProcess& obj)
00132 {
00133 return obj.fillStream(str);
00134 }
00135
00136 inline std::ostream & operator << (std::ostream & s, DayaBay::SimProcess::Type e) {
00137 switch (e) {
00138 case DayaBay::SimProcess::kUnknown : return s << "kUnknown";
00139 case DayaBay::SimProcess::kPrimaryVertex : return s << "kPrimaryVertex";
00140 case DayaBay::SimProcess::kWorldBoundary : return s << "kWorldBoundary";
00141 case DayaBay::SimProcess::kGeomBoundary : return s << "kGeomBoundary";
00142 case DayaBay::SimProcess::kParticleStart : return s << "kParticleStart";
00143 case DayaBay::SimProcess::kTransportation : return s << "kTransportation";
00144 case DayaBay::SimProcess::kElectromagnetic : return s << "kElectromagnetic";
00145 case DayaBay::SimProcess::kOptical : return s << "kOptical";
00146 case DayaBay::SimProcess::kHadronic : return s << "kHadronic";
00147 case DayaBay::SimProcess::kPhotolepton_hadron : return s << "kPhotolepton_hadron";
00148 case DayaBay::SimProcess::kDecay : return s << "kDecay";
00149 case DayaBay::SimProcess::kGeneral : return s << "kGeneral";
00150 case DayaBay::SimProcess::kParameterisation : return s << "kParameterisation";
00151 case DayaBay::SimProcess::kUserDefined : return s << "kUserDefined";
00152 default : return s << "ERROR wrong value for enum DayaBay::SimProcess::Type";
00153 }
00154 }
00155
00156
00157 }
00158
00159
00160
00161
00162
00163
00164
00165 inline std::ostream& DayaBay::SimProcess::fillStream(std::ostream& s) const
00166 {
00167 s << "{ " << "type : " << m_type << std::endl
00168 << "name : " << m_name << std::endl << " }";
00169 return s;
00170 }
00171
00172
00173 inline const DayaBay::SimProcess::Type& DayaBay::SimProcess::type() const
00174 {
00175 return m_type;
00176 }
00177
00178 inline const std::string& DayaBay::SimProcess::name() const
00179 {
00180 return m_name;
00181 }
00182
00183 inline bool DayaBay::SimProcess::isValid() const
00184 {
00185 return m_type != kUnknown;
00186 }
00187
00188
00189 #endif