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
G4INCLXXInterfaceStore.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4INCLXXInterfaceStore.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
// INCL++ intra-nuclear cascade model
27
// Alain Boudard, CEA-Saclay, France
28
// Joseph Cugnon, University of Liege, Belgium
29
// Jean-Christophe David, CEA-Saclay, France
30
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31
// Sylvie Leray, CEA-Saclay, France
32
// Davide Mancusi, CEA-Saclay, France
33
//
34
#define INCLXX_IN_GEANT4_MODE 1
35
36
#include "
globals.hh
"
37
45
#include "
G4INCLXXInterfaceStore.hh
"
46
#include "
G4INCLXXInterfaceMessenger.hh
"
47
#include "
G4INCLConfigEnums.hh
"
48
#include "
G4SystemOfUnits.hh
"
49
#include "
G4HadronicInteraction.hh
"
50
#include "
G4HadronicInteractionRegistry.hh
"
51
#include "
G4INCLXXInterface.hh
"
52
#include "
G4INCLConfig.hh
"
53
#include "
G4AblaInterface.hh
"
54
#include <vector>
55
56
G4ThreadLocal
G4INCLXXInterfaceStore
*
G4INCLXXInterfaceStore::theInstance
= NULL;
57
58
G4INCLXXInterfaceStore::G4INCLXXInterfaceStore
() :
59
accurateProjectile(
true
),
60
theMaxProjMassINCL(18),
61
cascadeMinEnergyPerNucleon(1.*
MeV
),
62
conservationTolerance(5*
MeV
),
63
theINCLModel(NULL),
64
theTally(NULL),
65
nWarnings(0),
66
maxWarnings
(50)
67
{
68
constructINCLXXVersionName
();
69
theINCLXXInterfaceMessenger
=
new
G4INCLXXInterfaceMessenger
(
this
);
70
}
71
72
G4INCLXXInterfaceStore::~G4INCLXXInterfaceStore
() {
73
delete
theINCLXXInterfaceMessenger
;
74
delete
theINCLModel
;
75
}
76
77
void
G4INCLXXInterfaceStore::DeleteModel
() {
78
delete
theINCLModel
;
theINCLModel
=NULL;
79
}
80
81
G4INCLXXInterfaceStore
*
G4INCLXXInterfaceStore::GetInstance
() {
82
if
(!
theInstance
)
83
theInstance
=
new
G4INCLXXInterfaceStore
;
84
return
theInstance
;
85
}
86
87
void
G4INCLXXInterfaceStore::DeleteInstance
() {
88
delete
theInstance
;
89
theInstance
= NULL;
90
}
91
92
G4INCL::INCL
*
G4INCLXXInterfaceStore::GetINCLModel
() {
93
if
(!
theINCLModel
) {
94
G4INCL::Config
*aConfig =
new
G4INCL::Config
(
theConfig
);
95
theINCLModel
=
new
G4INCL::INCL
(aConfig);
96
// ownership of the aConfig object is taken over by the INCL model engine
97
}
98
return
theINCLModel
;
99
}
100
101
void
G4INCLXXInterfaceStore::constructINCLXXVersionName
() {
102
const
std::string versionID =
G4INCL_VERSION_ID
;
103
const
size_t
lastDash = versionID.find_last_of(
"-"
);
104
versionName
=
"INCL++ "
+ versionID.substr(0,lastDash);
105
}
106
107
const
std::string &
G4INCLXXInterfaceStore::getINCLXXVersionName
() {
108
return
versionName
;
109
}
110
111
112
113
void
G4INCLXXInterfaceStore::SetAccurateProjectile
(
const
G4bool
b
) {
114
if
(
accurateProjectile
!=b) {
115
// Parameter is changed, emit a big warning message
116
std::stringstream ss;
117
ss <<
"Switching from "
118
<< (
accurateProjectile
?
"\"accurate projectile\" mode to \"accurate target\""
:
"\"accurate target\" mode to \"accurate projectile\""
)
119
<<
" mode."
120
<<
G4endl
121
<<
"Do this ONLY if you fully understand what it does!"
;
122
EmitBigWarning
(ss.str());
123
}
124
125
// No need to delete the model for this parameter
126
127
accurateProjectile
=
b
;
128
}
129
130
void
G4INCLXXInterfaceStore::SetMaxClusterMass
(
const
G4int
aMass) {
131
const
G4int
theMaxClusterMass =
theConfig
.
getClusterMaxMass
();
132
if
(theMaxClusterMass!=aMass) {
133
// Parameter is changed, emit a big warning message
134
std::stringstream ss;
135
ss <<
"Changing maximum cluster mass from "
136
<< theMaxClusterMass
137
<<
" to "
138
<< aMass
139
<<
"."
140
<<
G4endl
141
<<
"Do this ONLY if you fully understand what this setting does!"
;
142
EmitBigWarning
(ss.str());
143
144
// We must delete the model object to make sure that we use the new
145
// parameter
146
DeleteModel
();
147
148
theConfig
.
setClusterMaxMass
(aMass);
149
}
150
}
151
152
153
154
155
G4bool
G4INCLXXInterfaceStore::GetAccurateProjectile
()
const
{
return
accurateProjectile
; }
156
157
G4double
G4INCLXXInterfaceStore::GetCascadeMinEnergyPerNucleon
()
const
{
return
cascadeMinEnergyPerNucleon
; }
158
159
G4INCL::Config
&
G4INCLXXInterfaceStore::GetINCLConfig
() {
160
DeleteModel
();
// in case the Config is modified
161
return
theConfig
;
162
}
163
164
G4double
G4INCLXXInterfaceStore::GetConservationTolerance
()
const
{
return
conservationTolerance
; }
165
166
167
168
169
G4int
G4INCLXXInterfaceStore::GetMaxProjMassINCL
()
const
{
return
theMaxProjMassINCL
; }
170
171
void
G4INCLXXInterfaceStore::EmitWarning
(
const
G4String
&
message
) {
172
if
(++
nWarnings
<=
maxWarnings
) {
173
G4cout
<<
"[INCL++] Warning: "
<< message <<
G4endl
;
174
if
(
nWarnings
==
maxWarnings
) {
175
G4cout
<<
"[INCL++] INCL++ has already emitted "
<<
maxWarnings
<<
" warnings and will emit no more."
<<
G4endl
;
176
}
177
}
178
}
179
180
void
G4INCLXXInterfaceStore::EmitBigWarning
(
const
G4String
&
message
)
const
{
181
G4cout
182
<<
G4endl
183
<<
"================================================================================"
184
<<
G4endl
185
<<
" INCL++ WARNING "
186
<<
G4endl
187
<< message
188
<<
G4endl
189
<<
"================================================================================"
190
<<
G4endl
191
<<
G4endl
;
192
}
193
194
void
G4INCLXXInterfaceStore::SetCascadeMinEnergyPerNucleon
(
const
G4double
anEnergy) {
195
if
(
cascadeMinEnergyPerNucleon
!=anEnergy) {
196
// Parameter is changed, emit a big warning message
197
std::stringstream ss;
198
ss <<
"Changing minimim cascade energy from "
199
<<
cascadeMinEnergyPerNucleon
/
MeV
200
<<
" to "
201
<< anEnergy /
MeV
202
<<
" MeV."
203
<<
G4endl
204
<<
"Do this ONLY if you fully understand what this setting does!"
;
205
EmitBigWarning
(ss.str());
206
}
207
208
// No need to delete the model object
209
210
cascadeMinEnergyPerNucleon
=anEnergy;
211
}
212
213
void
G4INCLXXInterfaceStore::SetConservationTolerance
(
const
G4double
aTolerance) {
214
conservationTolerance
= aTolerance;
215
}
216
217
G4INCLXXVInterfaceTally
*
G4INCLXXInterfaceStore::GetTally
()
const
{
return
theTally
; }
218
219
void
G4INCLXXInterfaceStore::SetTally
(
G4INCLXXVInterfaceTally
*
const
aTally) {
theTally
= aTally; }
220
221
void
G4INCLXXInterfaceStore::SetINCLPhysics
(
const
G4String
&option) {
222
if
(option ==
"default"
) {
223
theConfig
.
init
();
224
}
else
if
(option ==
"incl42"
) {
225
const
G4String
message
=
"Changing INCL++ physics to mimic INCL4.2. Do this ONLY if you fully understand the implications!"
;
226
EmitBigWarning
(message);
227
228
theConfig
.
setPotentialType
(
G4INCL::ConstantPotential
);
229
theConfig
.
setPionPotential
(
false
);
230
theConfig
.
setLocalEnergyBBType
(
G4INCL::NeverLocalEnergy
);
231
theConfig
.
setLocalEnergyPiType
(
G4INCL::NeverLocalEnergy
);
232
theConfig
.
setBackToSpectator
(
false
);
233
theConfig
.
setClusterAlgorithm
(
G4INCL::NoClusterAlgorithm
);
234
theConfig
.
setCoulombType
(
G4INCL::NoCoulomb
);
235
// UseRealMasses intentionally left out because it creates problems with
236
// energy conservation
237
// theConfig.setUseRealMasses(false);
238
theConfig
.
setCrossSectionsType
(
G4INCL::INCL46CrossSections
);
239
}
else
{
240
G4Exception
(
"G4INCLXXInterfaceStore::SetINCLPhysics"
,
"INCLXX0001"
,
FatalErrorInArgument
,
241
"SetINCLPhysics argument must be one of: default, incl42"
242
);
243
}
244
}
245
246
void
G4INCLXXInterfaceStore::UseAblaDeExcitation
() {
247
// Get hold of pointers to the INCL++ model interfaces
248
std::vector<G4HadronicInteraction *>
const
&interactions =
G4HadronicInteractionRegistry::Instance
()
249
->
FindAllModels
(
G4INCLXXInterfaceStore::GetInstance
()->
getINCLXXVersionName
());
250
for
(std::vector<G4HadronicInteraction *>::const_iterator iInter=interactions.begin(),
e
=interactions.end();
251
iInter!=
e
; ++iInter) {
252
G4INCLXXInterface
*theINCLInterface =
dynamic_cast<
G4INCLXXInterface
*
>
(*iInter);
253
if
(theINCLInterface) {
254
// Instantiate the ABLA model
255
G4HadronicInteraction
*interaction =
G4HadronicInteractionRegistry::Instance
()->
FindModel
(
"ABLA"
);
256
G4AblaInterface
*theAblaInterface =
dynamic_cast<
G4AblaInterface
*
>
(interaction);
257
if
(!theAblaInterface)
258
theAblaInterface =
new
G4AblaInterface
;
259
// Couple INCL++ to ABLA
260
G4cout
<<
"Coupling INCLXX to ABLA"
<<
G4endl
;
261
theINCLInterface->
SetDeExcitation
(theAblaInterface);
262
}
263
}
264
}
geant4
tree
geant4-10.6-release
source
processes
hadronic
models
inclxx
interface
src
G4INCLXXInterfaceStore.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:45
using
1.8.2 with
ECCE GitHub integration