"README.md" did not exist on "0cc623afe69333fffc45f83b9ed9c5bbd14c2677"
Newer
Older
//==========================================================================
//--------------------------------------------------------------------------
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
// All rights reserved.
//
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
//
// Author : M.Frank
//
//==========================================================================
// Framework include files
#include <DD4hep/InstanceCount.h>
#include <DDG4/Geant4PhysicsConstructor.h>
#include <G4VModularPhysicsList.hh>
// Geant4 include files
#include <G4Version.hh>
namespace {
/// Concrete implementation
class ConstructorImp : virtual public Geant4PhysicsConstructor::Constructor {
public:
Geant4PhysicsConstructor* ctor;
/// Initializing constructor dealing with the callbacks
ConstructorImp(Geant4PhysicsConstructor* ct, int typ)
: G4VPhysicsConstructor(ct->name(),typ), Geant4PhysicsConstructor::Constructor(), ctor(ct)
{}
/// Default destructor
virtual ~ConstructorImp() {}
/// Access to a fresh (resetted) instance of the particle table iterator
G4ParticleTable::G4PTblDicIterator* particleIterator() const {
G4ParticleTable::G4PTblDicIterator* iter;
#if G4VERSION_NUMBER >= 1030
iter = GetParticleIterator();
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
iter->reset();
return iter;
}
/// G4VPhysicsConstructor overload: This method will be invoked in the Construct() method.
virtual void ConstructParticle() {
ctor->constructParticle(*this);
}
/// G4VPhysicsConstructor overload: This method will be invoked in the Construct() method.
virtual void ConstructProcess() {
ctor->constructProcess(*this);
}
};
}
/// Standard action constructor
Geant4PhysicsConstructor::Constructor::Constructor()
: G4VPhysicsConstructor()
{
}
/// Default destructor
Geant4PhysicsConstructor::Constructor::~Constructor() {
}
/// Standard action constructor
Geant4PhysicsConstructor::Geant4PhysicsConstructor(Geant4Context* ctxt, const std::string& nam)
: Geant4PhysicsList(ctxt, nam)
{
InstanceCount::increment(this);
declareProperty("PhysicsType", m_type = 0);
}
/// Default destructor
Geant4PhysicsConstructor::~Geant4PhysicsConstructor() {
InstanceCount::decrement(this);
// Do NOT delete the constructor !
}
/// constructPhysics callback
void Geant4PhysicsConstructor::constructPhysics(G4VModularPhysicsList* physics_list) {
// Register try constructor providing the callbacks
physics_list->RegisterPhysics(new ConstructorImp(this, m_type));
}
/// Callback to construct processes (uses the G4 particle table)
void Geant4PhysicsConstructor::constructProcess(Constructor& /* ctor */) {
}
/// Callback to construct particles
void Geant4PhysicsConstructor::constructParticle(Constructor& /* ctor */) {
}