File indexing completed on 2025-01-30 09:17:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include <DD4hep/InstanceCount.h>
0016 #include <DDG4/Geant4PhysicsConstructor.h>
0017 #include <G4VModularPhysicsList.hh>
0018
0019
0020 #include <G4Version.hh>
0021
0022 using namespace dd4hep::sim;
0023
0024 namespace {
0025
0026
0027 class ConstructorImp : virtual public Geant4PhysicsConstructor::Constructor {
0028 public:
0029 Geant4PhysicsConstructor* ctor;
0030
0031 ConstructorImp(Geant4PhysicsConstructor* ct, int typ)
0032 : G4VPhysicsConstructor(ct->name(),typ), Geant4PhysicsConstructor::Constructor(), ctor(ct)
0033 {}
0034
0035 virtual ~ConstructorImp() {}
0036
0037 G4ParticleTable::G4PTblDicIterator* particleIterator() const {
0038 G4ParticleTable::G4PTblDicIterator* iter;
0039
0040 #if G4VERSION_NUMBER >= 1030
0041 iter = GetParticleIterator();
0042 #elif G4VERSION_NUMBER >= 1000
0043 iter = aParticleIterator;
0044 #else
0045 iter = theParticleIterator;
0046 #endif
0047
0048 iter->reset();
0049 return iter;
0050 }
0051
0052 virtual void ConstructParticle() {
0053 ctor->constructParticle(*this);
0054 }
0055
0056 virtual void ConstructProcess() {
0057 ctor->constructProcess(*this);
0058 }
0059 };
0060 }
0061
0062
0063
0064 Geant4PhysicsConstructor::Constructor::Constructor()
0065 : G4VPhysicsConstructor()
0066 {
0067 }
0068
0069
0070 Geant4PhysicsConstructor::Constructor::~Constructor() {
0071 }
0072
0073
0074 Geant4PhysicsConstructor::Geant4PhysicsConstructor(Geant4Context* ctxt, const std::string& nam)
0075 : Geant4PhysicsList(ctxt, nam)
0076 {
0077 InstanceCount::increment(this);
0078 declareProperty("PhysicsType", m_type = 0);
0079 }
0080
0081
0082 Geant4PhysicsConstructor::~Geant4PhysicsConstructor() {
0083 InstanceCount::decrement(this);
0084
0085 }
0086
0087
0088 void Geant4PhysicsConstructor::constructPhysics(G4VModularPhysicsList* physics_list) {
0089
0090 physics_list->RegisterPhysics(new ConstructorImp(this, m_type));
0091 }
0092
0093
0094 void Geant4PhysicsConstructor::constructProcess(Constructor& ) {
0095 }
0096
0097
0098 void Geant4PhysicsConstructor::constructParticle(Constructor& ) {
0099 }