DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4PhysicsConstructor.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
15 #include <DD4hep/InstanceCount.h>
17 #include <G4VModularPhysicsList.hh>
18 
19 // Geant4 include files
20 #include <G4Version.hh>
21 
22 using namespace dd4hep::sim;
23 
24 namespace {
25 
27  class ConstructorImp : virtual public Geant4PhysicsConstructor::Constructor {
28  public:
31  ConstructorImp(Geant4PhysicsConstructor* ct, int typ)
32  : G4VPhysicsConstructor(ct->name(),typ), Geant4PhysicsConstructor::Constructor(), ctor(ct)
33  {}
35  virtual ~ConstructorImp() {}
37  G4ParticleTable::G4PTblDicIterator* particleIterator() const {
38  G4ParticleTable::G4PTblDicIterator* iter;
39 
40 #if G4VERSION_NUMBER >= 1030
41  iter = GetParticleIterator();
42 #elif G4VERSION_NUMBER >= 1000
43  iter = aParticleIterator;
44 #else
45  iter = theParticleIterator;
46 #endif
47 
48  iter->reset();
49  return iter;
50  }
52  virtual void ConstructParticle() {
53  ctor->constructParticle(*this);
54  }
56  virtual void ConstructProcess() {
57  ctor->constructProcess(*this);
58  }
59  };
60 }
61 
62 
66 {
67 }
68 
71 }
72 
75  : Geant4PhysicsList(ctxt, nam)
76 {
78  declareProperty("PhysicsType", m_type = 0);
79 }
80 
84  // Do NOT delete the constructor !
85 }
86 
88 void Geant4PhysicsConstructor::constructPhysics(G4VModularPhysicsList* physics_list) {
89  // Register try constructor providing the callbacks
90  physics_list->RegisterPhysics(new ConstructorImp(this, m_type));
91 }
92 
95 }
96 
99 }
dd4hep::sim::Geant4PhysicsConstructor::Constructor
Helper class to be used by cleints, by NOT overloaded!
Definition: Geant4PhysicsConstructor.h:61
Geant4PhysicsConstructor.h
dd4hep::InstanceCount::increment
static void increment(T *)
Increment count according to type information.
Definition: InstanceCount.h:98
dd4hep::sim::Geant4PhysicsConstructor::Constructor::~Constructor
virtual ~Constructor()
Default destructor.
Definition: Geant4PhysicsConstructor.cpp:70
dd4hep::sim::Geant4PhysicsConstructor::~Geant4PhysicsConstructor
virtual ~Geant4PhysicsConstructor()
Default destructor.
Definition: Geant4PhysicsConstructor.cpp:82
dd4hep::sim::Geant4Action::declareProperty
Geant4Action & declareProperty(const std::string &nam, T &val)
Declare property.
Definition: Geant4Action.h:366
dd4hep::InstanceCount::decrement
static void decrement(T *)
Decrement count according to type information.
Definition: InstanceCount.h:102
dd4hep::sim::Geant4PhysicsConstructor::Constructor::Constructor
Constructor()
Initializing constructor dealing with the callbacks.
Definition: Geant4PhysicsConstructor.cpp:64
dd4hep::sim::Geant4PhysicsConstructor::m_type
int m_type
Physics type (Default: 0)
Definition: Geant4PhysicsConstructor.h:74
dd4hep::sim::Geant4PhysicsConstructor::constructParticle
virtual void constructParticle(Constructor &ctor)
Callback to construct particles.
Definition: Geant4PhysicsConstructor.cpp:98
dd4hep::sim::Geant4PhysicsConstructor::constructProcess
virtual void constructProcess(Constructor &ctor)
Callback to construct processes (uses the G4 particle table)
Definition: Geant4PhysicsConstructor.cpp:94
G4VPhysicsConstructor
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Definition: Geant4Classes.h:51
dd4hep::sim::Geant4PhysicsList
Concrete basic implementation of a Geant4 physics list action.
Definition: Geant4PhysicsList.h:41
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition: Geant4Output2EDM4hep.cpp:49
dd4hep::sim::Geant4PhysicsConstructor::Geant4PhysicsConstructor
Geant4PhysicsConstructor(Geant4Context *context, const std::string &nam)
Standard constructor with initailization parameters.
Definition: Geant4PhysicsConstructor.cpp:74
dd4hep::sim::Geant4PhysicsConstructor
Implementation base of a Geant4 physics constructor.
Definition: Geant4PhysicsConstructor.h:49
InstanceCount.h
dd4hep::sim::Geant4PhysicsConstructor::constructPhysics
virtual void constructPhysics(G4VModularPhysicsList *physics) override
constructPhysics callback
Definition: Geant4PhysicsConstructor.cpp:88
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201