ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4VPhysicsConstructor.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4VPhysicsConstructor.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
//
28
//
29
// ------------------------------------------------------------
30
// GEANT 4 class header file
31
//
32
// ------------------------------------------------------------
33
34
#include "
G4VPhysicsConstructor.hh
"
35
#include "
G4PhysicsBuilderInterface.hh
"
36
#include <algorithm>
37
// This field helps to use the class G4VPCManager
38
//
39
G4VPCManager
G4VPhysicsConstructor::subInstanceManager
;
40
41
void
G4VPCData::initialize
()
42
{
43
_aParticleIterator
=
G4ParticleTable::GetParticleTable
()->
GetIterator
();
44
_builders
=
new
PhysicsBuilders_V
;
45
}
46
47
48
G4VPhysicsConstructor::G4VPhysicsConstructor
(
const
G4String
&
name
)
49
: verboseLevel(0), namePhysics(name), typePhysics(0)
50
{
51
g4vpcInstanceID
=
subInstanceManager
.
CreateSubInstance
();
52
// pointer to the particle table
53
theParticleTable
=
G4ParticleTable::GetParticleTable
();
54
//aParticleIterator = theParticleTable->GetIterator();
55
56
// PhysicsListHelper
57
//aPLHelper = G4PhysicsListHelper::GetPhysicsListHelper();
58
}
59
60
G4VPhysicsConstructor::G4VPhysicsConstructor
(
const
G4String
&
name
,
G4int
type)
61
: verboseLevel(0), namePhysics(name), typePhysics(type)
62
{
63
g4vpcInstanceID
=
subInstanceManager
.
CreateSubInstance
();
64
// pointer to the particle table
65
theParticleTable
=
G4ParticleTable::GetParticleTable
();
66
//aParticleIterator = theParticleTable->GetIterator();
67
68
if
(type<0)
typePhysics
= 0;
69
70
// PhysicsListHelper
71
//aPLHelper = G4PhysicsListHelper::GetPhysicsListHelper();
72
}
73
74
G4VPhysicsConstructor::~G4VPhysicsConstructor
()
75
{
76
//Master/Sequential needs to cleanup too
77
G4VPhysicsConstructor::TerminateWorker
();
78
}
79
80
G4ParticleTable::G4PTblDicIterator
*
G4VPhysicsConstructor::GetParticleIterator
()
const
81
{
82
return
(
subInstanceManager
.
offset
[
g4vpcInstanceID
])._aParticleIterator;
83
}
84
85
G4VPhysicsConstructor::PhysicsBuilder_V
G4VPhysicsConstructor::GetBuilders
()
const
86
{
87
const
auto
& tls = *((
subInstanceManager
.
offset
[
g4vpcInstanceID
])._builders);
88
PhysicsBuilder_V
copy
(tls.size());
89
int
i = 0;
90
for
(
const
auto
& el : tls ) {
copy
[i++] = el; }
91
return
copy
;
92
}
93
94
void
G4VPhysicsConstructor::AddBuilder
(
G4PhysicsBuilderInterface
* bld)
95
{
96
(
subInstanceManager
.
offset
[
g4vpcInstanceID
])._builders->push_back(bld);
97
}
98
99
void
G4VPhysicsConstructor::TerminateWorker
()
100
{
101
if
(
subInstanceManager
.
offset
[
g4vpcInstanceID
]._builders !=
nullptr
) {
102
std::for_each(
subInstanceManager
.
offset
[
g4vpcInstanceID
]._builders->begin() ,
103
subInstanceManager
.
offset
[
g4vpcInstanceID
]._builders->end() ,
104
[](PhysicsBuilder_V::value_type bld) {
delete
bld;});
105
subInstanceManager
.
offset
[
g4vpcInstanceID
]._builders->clear();
106
}
107
108
}
geant4
tree
geant4-10.6-release
source
run
src
G4VPhysicsConstructor.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:53
using
1.8.2 with
ECCE GitHub integration