Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4INCLXXInterfaceStore Class Reference

Singleton class for configuring the INCL++ Geant4 interface. More...

#include <G4INCLXXInterfaceStore.hh>

Public Member Functions

G4INCL::INCLGetINCLModel ()
 Get the cached INCL model engine. More...
 
void constructINCLXXVersionName ()
 
const std::string & getINCLXXVersionName ()
 
void SetAccurateProjectile (const G4bool b)
 Setter for accurateProjectile. More...
 
void SetMaxClusterMass (const G4int aMass)
 Setter for the maximum cluster mass. More...
 
void SetCascadeMinEnergyPerNucleon (const G4double anEnergy)
 Setter for cascadeMinEnergyPerNucleon. More...
 
void SetConservationTolerance (const G4double aTolerance)
 Setter for conservationTolerance. More...
 
G4bool GetAccurateProjectile () const
 Getter for accurateProjectile. More...
 
G4double GetCascadeMinEnergyPerNucleon () const
 Getter for cascadeMinEnergyPerNucleon. More...
 
G4INCL::ConfigGetINCLConfig ()
 Getter for theConfig. More...
 
G4int GetMaxProjMassINCL () const
 Getter for theMaxProjMassINCL. More...
 
G4double GetConservationTolerance () const
 Getter for conservationTolerance. More...
 
void EmitWarning (const G4String &message)
 Emit a warning to G4cout. More...
 
void EmitBigWarning (const G4String &message) const
 Emit a BIG warning to G4cout. More...
 

Static Public Member Functions

static G4INCLXXInterfaceStoreGetInstance ()
 Get the singleton instance. More...
 
static void DeleteInstance ()
 Delete the singleton instance. More...
 

Detailed Description

Singleton class for configuring the INCL++ Geant4 interface.

This class also contains a single cached instance of the INCL model (

See also
{G4INCL::INCL}).

Definition at line 62 of file G4INCLXXInterfaceStore.hh.

Member Function Documentation

void G4INCLXXInterfaceStore::constructINCLXXVersionName ( )

Definition at line 91 of file G4INCLXXInterfaceStore.cc.

References G4INCL_VERSION_ID.

91  {
92  const std::string versionID = G4INCL_VERSION_ID;
93  const size_t lastDash = versionID.find_last_of("-");
94  versionName = "INCL++ " + versionID.substr(0,lastDash);
95 }
#define G4INCL_VERSION_ID
void G4INCLXXInterfaceStore::DeleteInstance ( )
static

Delete the singleton instance.

Definition at line 77 of file G4INCLXXInterfaceStore.cc.

77  {
78  delete theInstance;
79  theInstance = NULL;
80 }
void G4INCLXXInterfaceStore::EmitBigWarning ( const G4String message) const

Emit a BIG warning to G4cout.

There is no limit on the number of BIG warnings emitted.

Definition at line 167 of file G4INCLXXInterfaceStore.cc.

References G4cout, and G4endl.

Referenced by G4INCLXXInterface::ApplyYourself(), SetAccurateProjectile(), SetCascadeMinEnergyPerNucleon(), and SetMaxClusterMass().

167  {
168  G4cout
169  << G4endl
170  << "================================================================================"
171  << G4endl
172  << " INCL++ WARNING "
173  << G4endl
174  << message
175  << G4endl
176  << "================================================================================"
177  << G4endl
178  << G4endl;
179 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4INCLXXInterfaceStore::EmitWarning ( const G4String message)

Emit a warning to G4cout.

The InterfaceStore will not emit more than maxWarnings warnings.

Definition at line 158 of file G4INCLXXInterfaceStore.cc.

References G4cout, and G4endl.

Referenced by G4INCLXXInterface::ApplyYourself(), and G4INCLXXInterface::G4INCLXXInterface().

158  {
159  if(++nWarnings<=maxWarnings) {
160  G4cout << "[INCL++] Warning: " << message << G4endl;
161  if(nWarnings==maxWarnings) {
162  G4cout << "[INCL++] INCL++ has already emitted " << maxWarnings << " warnings and will emit no more." << G4endl;
163  }
164  }
165 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4bool G4INCLXXInterfaceStore::GetAccurateProjectile ( ) const

Getter for accurateProjectile.

The

See also
{G4INCLXXInterfaceMessenger} class provides a UI command to set this parameter.

Definition at line 145 of file G4INCLXXInterfaceStore.cc.

145 { return accurateProjectile; }
G4double G4INCLXXInterfaceStore::GetCascadeMinEnergyPerNucleon ( ) const

Getter for cascadeMinEnergyPerNucleon.

The

See also
{G4INCLXXInterfaceMessenger} class provides a UI command to set this parameter.

Definition at line 147 of file G4INCLXXInterfaceStore.cc.

Referenced by G4INCLXXInterface::ApplyYourself().

147 { return cascadeMinEnergyPerNucleon; }
G4double G4INCLXXInterfaceStore::GetConservationTolerance ( ) const

Getter for conservationTolerance.

Definition at line 151 of file G4INCLXXInterfaceStore.cc.

151 { return conservationTolerance; }
G4INCL::Config & G4INCLXXInterfaceStore::GetINCLConfig ( )

Getter for theConfig.

Definition at line 149 of file G4INCLXXInterfaceStore.cc.

149 { return theConfig; }
G4INCL::INCL * G4INCLXXInterfaceStore::GetINCLModel ( )

Get the cached INCL model engine.

Definition at line 82 of file G4INCLXXInterfaceStore.cc.

Referenced by G4INCLXXInterface::ApplyYourself().

82  {
83  if(!theINCLModel) {
84  G4INCL::Config *aConfig = new G4INCL::Config(theConfig);
85  theINCLModel = new G4INCL::INCL(aConfig);
86  // ownership of the aConfig object is taken over by the INCL model engine
87  }
88  return theINCLModel;
89 }
const std::string & G4INCLXXInterfaceStore::getINCLXXVersionName ( )

Definition at line 97 of file G4INCLXXInterfaceStore.cc.

97  {
98  return versionName;
99 }
G4INCLXXInterfaceStore * G4INCLXXInterfaceStore::GetInstance ( void  )
static

Get the singleton instance.

Definition at line 71 of file G4INCLXXInterfaceStore.cc.

Referenced by G4INCLXXInterface::ApplyYourself().

71  {
72  if(!theInstance)
73  theInstance = new G4INCLXXInterfaceStore;
74  return theInstance;
75 }
Singleton class for configuring the INCL++ Geant4 interface.
G4int G4INCLXXInterfaceStore::GetMaxProjMassINCL ( ) const

Getter for theMaxProjMassINCL.

Definition at line 156 of file G4INCLXXInterfaceStore.cc.

Referenced by G4INCLXXInterface::ApplyYourself().

156 { return theMaxProjMassINCL; }
void G4INCLXXInterfaceStore::SetAccurateProjectile ( const G4bool  b)

Setter for accurateProjectile.

Definition at line 103 of file G4INCLXXInterfaceStore.cc.

References test::b, EmitBigWarning(), and G4endl.

Referenced by G4INCLXXInterfaceMessenger::SetNewValue().

103  {
104  if(accurateProjectile!=b) {
105  // Parameter is changed, emit a big warning message
106  std::stringstream ss;
107  ss << "Switching from "
108  << (accurateProjectile ? "\"accurate projectile\" mode to \"accurate target\"" : "\"accurate target\" mode to \"accurate projectile\"")
109  << " mode."
110  << G4endl
111  << "Do this ONLY if you fully understand what it does!";
112  EmitBigWarning(ss.str());
113  }
114 
115  // No need to delete the model for this parameter
116 
117  accurateProjectile=b;
118 }
void EmitBigWarning(const G4String &message) const
Emit a BIG warning to G4cout.
#define G4endl
Definition: G4ios.hh:61
void G4INCLXXInterfaceStore::SetCascadeMinEnergyPerNucleon ( const G4double  anEnergy)

Setter for cascadeMinEnergyPerNucleon.

Definition at line 181 of file G4INCLXXInterfaceStore.cc.

References EmitBigWarning(), G4endl, and python.hepunit::MeV.

Referenced by G4INCLXXInterfaceMessenger::SetNewValue().

181  {
182  if(cascadeMinEnergyPerNucleon!=anEnergy) {
183  // Parameter is changed, emit a big warning message
184  std::stringstream ss;
185  ss << "Changing minimim cascade energy from "
186  << cascadeMinEnergyPerNucleon / MeV
187  << " to "
188  << anEnergy / MeV
189  << " MeV."
190  << G4endl
191  << "Do this ONLY if you fully understand what this setting does!";
192  EmitBigWarning(ss.str());
193  }
194 
195  // No need to delete the model object
196 
197  cascadeMinEnergyPerNucleon=anEnergy;
198 }
void EmitBigWarning(const G4String &message) const
Emit a BIG warning to G4cout.
#define G4endl
Definition: G4ios.hh:61
void G4INCLXXInterfaceStore::SetConservationTolerance ( const G4double  aTolerance)

Setter for conservationTolerance.

Definition at line 200 of file G4INCLXXInterfaceStore.cc.

200  {
201  conservationTolerance = aTolerance;
202 }
void G4INCLXXInterfaceStore::SetMaxClusterMass ( const G4int  aMass)

Setter for the maximum cluster mass.

Definition at line 120 of file G4INCLXXInterfaceStore.cc.

References EmitBigWarning(), G4endl, G4INCL::Config::getClusterMaxMass(), and G4INCL::Config::setClusterMaxMass().

Referenced by G4INCLXXInterfaceMessenger::SetNewValue().

120  {
121  const G4int theMaxClusterMass = theConfig.getClusterMaxMass();
122  if(theMaxClusterMass!=aMass) {
123  // Parameter is changed, emit a big warning message
124  std::stringstream ss;
125  ss << "Changing maximum cluster mass from "
126  << theMaxClusterMass
127  << " to "
128  << aMass
129  << "."
130  << G4endl
131  << "Do this ONLY if you fully understand what this setting does!";
132  EmitBigWarning(ss.str());
133 
134  // We must delete the model object to make sure that we use the new
135  // parameter
136  DeleteModel();
137 
138  theConfig.setClusterMaxMass(aMass);
139  }
140 }
G4int getClusterMaxMass() const
Get the maximum mass for production of clusters.
void EmitBigWarning(const G4String &message) const
Emit a BIG warning to G4cout.
int G4int
Definition: G4Types.hh:78
#define G4endl
Definition: G4ios.hh:61
void setClusterMaxMass(const G4int m)
Set the maximum mass for production of clusters.

The documentation for this class was generated from the following files: