Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TransportationParameters.hh
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// Class Description:
28//
29// A utility static class, responsable for keeping common parameters
30// for all transportation processes. These parameters can be relevant only
31// to some types of particles, e.g. only charged particles.
32//
33// It must initialized only by the master thread.
34// It can be updated before the transportation processes have been instantiated or
35// after their instantiation.
36// Note: It can be updated only if the state of the simulation is PreInit, Init or Idle.
37// Parameters may be used in run time or at initialisation
38//
39// Author: J. Apostolakis Nov 2022
40// -------------------------------------------------------------------
41//
42
43#ifndef G4TransportationParameters_hh
44#define G4TransportationParameters_hh
45
46#include "globals.hh"
47
49{
50public:
52
54
58
59 G4int GetNumberOfTrials() const { return fNumberOfTrials; }
60 G4double GetWarningEnergy() const { return fWarningEnergy; }
61 G4double GetImportantEnergy() const { return fImportantEnergy; }
62 G4bool IsMagneticMomentEnabled() const { return fUseMagneticMoment; }
63
65 // Whether to deflect particles with force due to magnetic moment
66
67 G4bool SetHighLooperThresholds(); // Shortcut method - old values (meant for HEP)
68 G4bool SetIntermediateLooperThresholds(); // Intermediate values - also used as default
69 G4bool SetLowLooperThresholds(); // Set low thresholds - for low-E applications
71 // return value = success or failure of setting the parameter
72
73 G4bool GetSilenceAllLooperWarnings(){ return fSilenceLooperWarnings; }
74
75 // Probe whether the 'default' instance exists, without creating it
76 static G4bool Exists() { return theInstance != nullptr; }
77
78 // printing
79 void StreamInfo(std::ostream& os) const;
80 void Dump() const;
81 friend std::ostream& operator<< (std::ostream& os, const G4TransportationParameters&);
82
83private:
85 // Currently private - but potentially will open it up, to allow per-particle specialisation
86
87 // void Initialise();
88
89 G4bool IsLocked() const;
90
91 void PrintWarning(G4ExceptionDescription& ed) const;
92
93private:
94 static G4TransportationParameters* theInstance;
95
96 // STATE
97 // Values for initialising 'loopers' parameters of Transport process
98 G4double fWarningEnergy = -1.0; // Warn above this energy
99 G4double fImportantEnergy = -1.0; // Give a few trials above this E
100 G4int fNumberOfTrials = 10; // Number of trials an important looper survives
101
102 // Flags for use of gravity field(s) or fields which interact with the magnetic moment
103 G4bool fUseMagneticMoment = false;
104 G4bool fUseGravity = false;
105
106 // Flag to *Supress* all 'looper' warnings
107 G4bool fSilenceLooperWarnings= false;
108};
109
110#endif
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
~G4TransportationParameters()=default
G4bool SetSilenceAllLooperWarnings(G4bool val=true)
friend std::ostream & operator<<(std::ostream &os, const G4TransportationParameters &)
static G4TransportationParameters * Instance()
G4bool EnableUseOfMagneticMoment(G4bool useMoment=true)
void StreamInfo(std::ostream &os) const