48G4TransportationParameters::G4TransportationParameters()
57 if(theInstance ==
nullptr) {
59 if(theInstance ==
nullptr) {
61 theInstance = &manager;
70G4bool G4TransportationParameters::IsLocked()
const
74 auto state = stateManager->GetCurrentState();
86 fNumberOfTrials = val;
98 if( fWarningEnergy > fImportantEnergy ) {
99 G4cerr <<
"G4TransportationParameters::GetWarningEnergy enforcing warning-E <= important-E "
100 <<
" resetting important energy from " << fImportantEnergy
101 <<
" to " << val <<
G4endl;
103 fImportantEnergy = fWarningEnergy;
113 fImportantEnergy = val;
116 if( fImportantEnergy < fWarningEnergy ) {
119 ed<<
"enforcing hierarchy (warning-E <= important-E): resetting important"
120 <<
" energy from " << fImportantEnergy <<
" to " << val <<
G4endl;
121 G4Exception( mthd,
"Enforcing Warning Energy <= Important Energy",
124 fWarningEnergy = fImportantEnergy;
139 if( warnE <= importE )
141 fWarningEnergy = warnE;
142 fImportantEnergy = importE;
146 fWarningEnergy = importE;
147 fImportantEnergy = warnE;
151 ed <<
"To enforce hierarchy (warning-E <= important-E): "
152 <<
" using smaller value= " << importE <<
" as Warning Energy "
153 <<
" and larger value= " << warnE <<
" as Important Energy." <<
G4endl;
154 G4Exception( mthd,
"Enforcing Warning Energy <= Important Energy",
165 G4String namesMethodClass=
G4String(
"G4TransportationParameters") + methodName;
168 auto state = stateManager->GetCurrentState();
171 ed <<
"Cannot change values of G4TransportationParameters when G4State is "
172 << stateManager->GetStateString(state) <<
G4endl;
173 ed <<
"Only the following Geant4 state are compatible: Pre_Init, Init and Idle." <<
G4endl;
179 "Locked, due to incompatible G4state: it not possible to change its parameters.",
187 auto prec = os.precision(5);
189 os <<
"Transport Parameters: " <<
G4endl;
209 if(IsLocked()) {
return false; }
217 G4int maxTrials = 10;
227 if(IsLocked()) {
return false; }
230 fWarningEnergy= 1.0 * CLHEP::MeV;
231 fImportantEnergy= 10.0 * CLHEP::MeV;
240 if(IsLocked()) {
return false; }
246 G4int maxTrials = 30;
256 if(IsLocked()) {
return false; }
257 fUseMagneticMoment= useMoment;
266 if(IsLocked()) {
return false; }
267 fSilenceLooperWarnings= val;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
#define G4MUTEX_INITIALIZER
#define G4MUTEXLOCK(mutex)
#define G4MUTEXUNLOCK(mutex)
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
static G4StateManager * GetStateManager()
G4bool SetLowLooperThresholds()
G4bool SetImportantEnergy(G4double val)
G4bool SetSilenceAllLooperWarnings(G4bool val=true)
G4int GetNumberOfTrials() const
G4double GetWarningEnergy() const
G4bool SetWarningEnergy(G4double val)
G4bool SetIntermediateLooperThresholds()
static G4TransportationParameters * Instance()
G4bool SetHighLooperThresholds()
G4bool EnableUseOfMagneticMoment(G4bool useMoment=true)
void ReportLockError(G4String methodName, G4bool verbose=false) const
G4bool SetNumberOfTrials(G4int val)
G4double GetImportantEnergy() const
void StreamInfo(std::ostream &os) const
G4bool SetWarningAndImportantEnergies(G4double warnE, G4double imprtE)