Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// $Id$
//==========================================================================
// AIDA Detector description implementation for LCD
//--------------------------------------------------------------------------
// 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"
#include "G4Version.hh"
using namespace DD4hep::Simulation;
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();
#else
#if G4VERSION_NUMBER >= 1000
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
100
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 */) {
}