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
G4ImportanceConfigurator.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4ImportanceConfigurator.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
// Class G4ImportanceConfigurator
30
//
31
// Author: Michael Dressel (Michael.Dressel@cern.ch)
32
// ----------------------------------------------------------------------
33
34
#include "
G4ImportanceConfigurator.hh
"
35
36
#include "
G4ImportanceProcess.hh
"
37
#include "
G4ProcessPlacer.hh
"
38
#include "
G4ImportanceAlgorithm.hh
"
39
40
#include "
G4TransportationManager.hh
"
41
#include "
G4AutoLock.hh
"
42
43
#ifdef G4MULTITHREADED
44
namespace
{
45
G4Mutex
BiasConfigMutex =
G4MUTEX_INITIALIZER
;
46
}
47
#endif
48
49
G4ImportanceConfigurator::
50
G4ImportanceConfigurator
(
const
G4VPhysicalVolume
* worldvolume,
51
const
G4String
&particlename,
52
G4VIStore
&istore,
53
const
G4VImportanceAlgorithm
*ialg,
G4bool
para)
54
: fWorld(worldvolume),
55
fWorldName(worldvolume->GetName()),
56
fPlacer(particlename),
57
fIStore(istore),
58
fDeleteIalg( ( ! ialg) ),
59
fIalgorithm(( (fDeleteIalg) ?
60
new
G4ImportanceAlgorithm
: ialg)),
61
fImportanceProcess(0),
62
paraflag(para)
63
{;}
64
65
G4ImportanceConfigurator::
66
G4ImportanceConfigurator
(
const
G4String
&worldvolumeName,
67
const
G4String
&particlename,
68
G4VIStore
&istore,
69
const
G4VImportanceAlgorithm
*ialg,
G4bool
para)
70
: fWorldName(worldvolumeName),
71
fPlacer(particlename),
72
fIStore(istore),
73
fDeleteIalg( ( ! ialg) ),
74
fIalgorithm(( (fDeleteIalg) ?
75
new
G4ImportanceAlgorithm
: ialg)),
76
fImportanceProcess(0),
77
paraflag(para)
78
{
79
fWorld
=
G4TransportationManager::GetTransportationManager
()->
GetNavigatorForTracking
()->
GetWorldVolume
();
80
if
(
paraflag
)
fWorld
=
G4TransportationManager::GetTransportationManager
()->
GetParallelWorld
(
fWorldName
);
81
}
82
83
G4ImportanceConfigurator::~G4ImportanceConfigurator
()
84
{
85
if
(
fImportanceProcess
)
86
{
87
fPlacer
.
RemoveProcess
(
fImportanceProcess
);
88
delete
fImportanceProcess
;
89
}
90
if
(
fDeleteIalg
)
91
{
92
delete
fIalgorithm
;
93
}
94
}
95
96
void
97
G4ImportanceConfigurator::Configure
(
G4VSamplerConfigurator
*preConf)
98
{
99
G4cout
<<
"G4ImportanceConfigurator:: entering importance configure, paraflag "
<<
paraflag
<<
G4endl
;
100
const
G4VTrackTerminator
*terminator = 0;
101
if
(preConf)
102
{
103
terminator = preConf->
GetTrackTerminator
();
104
};
105
106
107
#ifdef G4MULTITHREADED
108
G4AutoLock
l(&BiasConfigMutex);
109
#endif
110
fImportanceProcess
=
111
new
G4ImportanceProcess
(*
fIalgorithm
,
112
fIStore
,
113
terminator,
"ImportanceProcess"
,
paraflag
);
114
115
if
(!
fImportanceProcess
)
116
{
117
G4Exception
(
"G4ImportanceConfigurator::Configure()"
,
118
"FatalError"
,
FatalException
,
119
"Failed allocation of G4ImportanceProcess !"
);
120
}
121
122
// G4cout << "G4ImportanceConfigurator:: setting parallel World " << paraflag << G4endl;
123
if
(
paraflag
)
fImportanceProcess
->
SetParallelWorld
(
fWorld
->
GetName
());
124
#ifdef G4MULTITHREADED
125
l.
unlock
();
126
// G4MUTEXUNLOCK(&G4ImportanceConfigurator::BiasConfigMutex);
127
#endif
128
// if(paraflag) fImportanceProcess->SetParallelWorld(fWorldName);
129
// G4cout << "G4ImportanceConfigurator:: set " << paraflag << " name: " << fWorld->GetName() << G4endl;
130
// getchar();
131
fPlacer
.
AddProcessAsSecondDoIt
(
fImportanceProcess
);
132
}
133
134
const
G4VTrackTerminator
*
G4ImportanceConfigurator::
135
GetTrackTerminator
()
const
136
{
137
return
fImportanceProcess
;
138
}
139
140
void
G4ImportanceConfigurator::SetWorldName
(
const
G4String
&
name
)
141
{
142
G4cout
<<
" G4ImportanceConfigurator:: setting world name: "
<< name <<
G4endl
;
143
fWorldName
=
name
;
144
}
geant4
tree
geant4-10.6-release
source
processes
biasing
importance
src
G4ImportanceConfigurator.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:27
using
1.8.2 with
ECCE GitHub integration