Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HadronicParameters.cc
Go to the documentation of this file.
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// ClassName: G4HadronicParameters
30//
31// Author: 2018 Alberto Ribon
32//
33// Description: Singleton to keep global hadronic parameters.
34//
35// Modified:
36//
37//----------------------------------------------------------------------------
38
41#include "G4ApplicationState.hh"
42#include "G4StateManager.hh"
44#include "G4Threading.hh"
45#include "G4AutoLock.hh"
46
47G4HadronicParameters* G4HadronicParameters::sInstance = nullptr;
48
49namespace
50{
51 G4Mutex paramMutex = G4MUTEX_INITIALIZER;
52}
53
55 if ( sInstance == nullptr ) {
56 G4AutoLock l(&paramMutex);
57 if ( sInstance == nullptr ) {
58 static G4HadronicParameters theHadronicParametersObject;
59 sInstance = &theHadronicParametersObject;
60 }
61 l.unlock();
62 }
63 return sInstance;
64}
65
66
68 delete fMessenger;
69}
70
71
72G4HadronicParameters::G4HadronicParameters() {
73 fMaxEnergy = 100.0*CLHEP::TeV;
74 fMinEnergyTransitionFTF_Cascade = 3.0*CLHEP::GeV;
75 fMaxEnergyTransitionFTF_Cascade = 6.0*CLHEP::GeV;
76 fMinEnergyTransitionQGS_FTF = 12.0*CLHEP::GeV;
77 fMaxEnergyTransitionQGS_FTF = 25.0*CLHEP::GeV;
78 fEnergyThresholdForHeavyHadrons = 1.1*CLHEP::GeV;
79 fMessenger = new G4HadronicParametersMessenger( this );
80}
81
82
83G4bool G4HadronicParameters::IsLocked() const {
84 return ( ! G4Threading::IsMasterThread() ||
85 G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit );
86}
87
88
90 if ( ! IsLocked() && val > 0.0 ) {
91 fMaxEnergy = val;
92 }
93}
94
95
97 if ( ! IsLocked() && val > 0.0 ) {
98 fMinEnergyTransitionFTF_Cascade = val;
99 }
100}
101
102
104 if ( ! IsLocked() && val > fMinEnergyTransitionFTF_Cascade ) {
105 fMaxEnergyTransitionFTF_Cascade = val;
106 }
107}
108
109
111 if ( ! IsLocked() && val > 0.0 ) {
112 fMinEnergyTransitionQGS_FTF = val;
113 }
114}
115
117 if ( ! IsLocked() && val > fMinEnergyTransitionQGS_FTF ) {
118 fMaxEnergyTransitionQGS_FTF = val;
119 }
120}
121
123 if ( ! IsLocked() ) fEnableBC = val;
124}
125
126
128 if ( ! IsLocked() ) fEnableHyperNuclei = val;
129}
130
131
133 if ( ! IsLocked() && val >= 0 ) fVerboseLevel = val;
134}
135
136
138 if ( ! IsLocked() && val >= 0 && val < 5*CLHEP::GeV ) {
139 fEnergyThresholdForHeavyHadrons = val;
140 }
141}
142
143
145 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
146 fXSFactorNucleonInelastic = val;
147 }
148}
149
150
152 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
153 fXSFactorNucleonElastic = val;
154 }
155}
156
157
159 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
160 fXSFactorPionInelastic = val;
161 }
162}
163
164
166 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
167 fXSFactorPionElastic = val;
168 }
169}
170
171
173 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
174 fXSFactorHadronInelastic = val;
175 }
176}
177
178
180 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
181 fXSFactorHadronElastic = val;
182 }
183}
184
185
187 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
188 fXSFactorEM = val;
189 }
190}
191
192
194 if ( ! IsLocked() ) fApplyFactorXS = val;
195}
196
197
199 if ( ! IsLocked() ) fEnableCRCoalescence = val;
200}
201
202
204 if ( ! IsLocked() ) fEnableIntegralInelasticXS = val;
205}
206
207
209 if ( ! IsLocked() ) fEnableIntegralElasticXS = val;
210}
211
212
214 if ( ! IsLocked() ) fEnableDiffDissociationForBGreater10 = val;
215}
216
217
219 if ( ! IsLocked() ) fNeutronGeneral = val;
220}
@ G4State_PreInit
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:85
std::mutex G4Mutex
Definition: G4Threading.hh:81
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void SetEnableIntegralElasticXS(G4bool val)
void SetEnableDiffDissociationForBGreater10(G4bool val)
static G4HadronicParameters * Instance()
void SetXSFactorNucleonInelastic(G4double val)
void SetEnableIntegralInelasticXS(G4bool val)
void SetXSFactorPionInelastic(G4double val)
void SetVerboseLevel(const G4int val)
void SetXSFactorPionElastic(G4double val)
void SetEnableHyperNuclei(G4bool val)
void SetMaxEnergy(const G4double val)
void SetApplyFactorXS(G4bool val)
void SetEnergyThresholdForHeavyHadrons(G4double val)
void SetMinEnergyTransitionQGS_FTF(const G4double val)
void SetMinEnergyTransitionFTF_Cascade(const G4double val)
void SetEnableBCParticles(G4bool val)
void SetXSFactorHadronElastic(G4double val)
void SetXSFactorEM(G4double val)
void SetEnableCRCoalescence(G4bool val)
void SetMaxEnergyTransitionQGS_FTF(const G4double val)
void SetXSFactorHadronInelastic(G4double val)
void SetEnableNeutronGeneralProcess(G4bool val)
void SetXSFactorNucleonElastic(G4double val)
void SetMaxEnergyTransitionFTF_Cascade(const G4double val)
static G4StateManager * GetStateManager()
G4bool IsMasterThread()
Definition: G4Threading.cc:124