Geant4 10.7.0
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
45
46G4HadronicParameters* G4HadronicParameters::sInstance = nullptr;
47
48#ifdef G4MULTITHREADED
49G4Mutex G4HadronicParameters::paramMutex = G4MUTEX_INITIALIZER;
50#endif
51
53 if ( sInstance == nullptr ) {
54 #ifdef G4MULTITHREADED
55 G4MUTEXLOCK( &paramMutex );
56 if ( sInstance == nullptr ) {
57 #endif
58 static G4HadronicParameters theHadronicParametersObject;
59 sInstance = &theHadronicParametersObject;
60 #ifdef G4MULTITHREADED
61 }
62 G4MUTEXUNLOCK(&paramMutex);
63 #endif
64 }
65 return sInstance;
66}
67
68
70 delete fMessenger;
71}
72
73
74G4HadronicParameters::G4HadronicParameters() {
75 fMaxEnergy = 100.0*CLHEP::TeV;
76 fMinEnergyTransitionFTF_Cascade = 3.0*CLHEP::GeV;
77 fMaxEnergyTransitionFTF_Cascade = 6.0*CLHEP::GeV;
78 fMinEnergyTransitionQGS_FTF = 12.0*CLHEP::GeV;
79 fMaxEnergyTransitionQGS_FTF = 25.0*CLHEP::GeV;
80 fEnergyThresholdForHeavyHadrons = 1.1*CLHEP::GeV;
81 fMessenger = new G4HadronicParametersMessenger( this );
82}
83
84
85G4bool G4HadronicParameters::IsLocked() const {
86 return ( ! G4Threading::IsMasterThread() ||
87 G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit );
88}
89
90
92 if ( ! IsLocked() && val > 0.0 ) {
93 fMaxEnergy = val;
94 }
95}
96
97
99 if ( ! IsLocked() && val > 0.0 ) {
100 fMinEnergyTransitionFTF_Cascade = val;
101 }
102}
103
105 if ( ! IsLocked() && val > fMinEnergyTransitionFTF_Cascade ) {
106 fMaxEnergyTransitionFTF_Cascade = val;
107 }
108}
109
110
112 if ( ! IsLocked() && val > 0.0 ) {
113 fMinEnergyTransitionQGS_FTF = val;
114 }
115}
116
118 if ( ! IsLocked() && val > fMinEnergyTransitionQGS_FTF ) {
119 fMaxEnergyTransitionQGS_FTF = val;
120 }
121}
122
123
125 if ( ! IsLocked() ) fEnableBC = val;
126}
127
128
130 if ( ! IsLocked() && val >= 0 ) fVerboseLevel = val;
131}
132
133
135 if ( ! IsLocked() && val >= 0 && val < 5*CLHEP::GeV ) {
136 fEnergyThresholdForHeavyHadrons = val;
137 }
138}
139
140
142 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
143 fXSFactorNucleonInelastic = val;
144 }
145}
146
147
149 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
150 fXSFactorNucleonElastic = val;
151 }
152}
153
154
156 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
157 fXSFactorPionInelastic = val;
158 }
159}
160
161
163 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
164 fXSFactorPionElastic = val;
165 }
166}
167
168
170 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
171 fXSFactorHadronInelastic = val;
172 }
173}
174
175
177 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
178 fXSFactorHadronElastic = val;
179 }
180}
181
182
184 if ( ! IsLocked() && std::abs(val - 1.0) < fXSFactorLimit ) {
185 fXSFactorEM = val;
186 }
187}
188
189
191 if ( ! IsLocked() ) fApplyFactorXS = val;
192}
193
194
196 if ( ! IsLocked() ) fEnableCRCoalescence = val;
197}
@ G4State_PreInit
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:85
#define G4MUTEXLOCK(mutex)
Definition: G4Threading.hh:251
#define G4MUTEXUNLOCK(mutex)
Definition: G4Threading.hh:254
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
static G4HadronicParameters * Instance()
void SetXSFactorNucleonInelastic(G4double val)
void SetXSFactorPionInelastic(G4double val)
void SetVerboseLevel(const G4int val)
void SetXSFactorPionElastic(G4double 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 SetXSFactorNucleonElastic(G4double val)
void SetMaxEnergyTransitionFTF_Cascade(const G4double val)
static G4StateManager * GetStateManager()
G4bool IsMasterThread()
Definition: G4Threading.cc:124