Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4INCLXXInterfaceStore Class Reference

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

#include <G4INCLXXInterfaceStore.hh>

Public Member Functions

void constructINCLXXVersionName ()
 
void EmitBigWarning (const G4String &message) const
 Emit a BIG warning to G4cout. More...
 
void EmitWarning (const G4String &message)
 Emit a warning to G4cout. More...
 
G4bool GetAccurateProjectile () const
 Getter for accurateProjectile. More...
 
G4double GetCascadeMinEnergyPerNucleon () const
 Getter for cascadeMinEnergyPerNucleon. More...
 
G4double GetConservationTolerance () const
 Getter for conservationTolerance. More...
 
G4INCL::ConfigGetINCLConfig ()
 Getter for theConfig. More...
 
G4INCL::INCLGetINCLModel ()
 Get the cached INCL model engine. More...
 
const std::string & getINCLXXVersionName ()
 
G4int GetMaxProjMassINCL () const
 Getter for theMaxProjMassINCL. More...
 
G4INCLXXVInterfaceTallyGetTally () const
 Getter for the interface tally. More...
 
void SetAccurateProjectile (const G4bool b)
 Setter for accurateProjectile. More...
 
void SetCascadeMinEnergyPerNucleon (const G4double anEnergy)
 Setter for cascadeMinEnergyPerNucleon. More...
 
void SetConservationTolerance (const G4double aTolerance)
 Setter for conservationTolerance. More...
 
void SetINCLPhysics (const G4String &option)
 Set the INCL physics. More...
 
void SetMaxClusterMass (const G4int aMass)
 Setter for the maximum cluster mass. More...
 
void SetTally (G4INCLXXVInterfaceTally *const aTally)
 Setter for the interface tally. More...
 
void UseAblaDeExcitation ()
 Set ABLA V3 to be the de-excitation model to be used with INCL++. More...
 

Static Public Member Functions

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

Private Member Functions

void DeleteModel ()
 Delete the INCL model engine. More...
 
 G4INCLXXInterfaceStore ()
 Private constructor. More...
 
 ~G4INCLXXInterfaceStore ()
 Private destructor. More...
 

Private Attributes

G4bool accurateProjectile
 
G4double cascadeMinEnergyPerNucleon
 
G4double conservationTolerance
 
const G4int maxWarnings
 Maximum number of warnings. More...
 
G4int nWarnings
 Static warning counter. More...
 
G4INCL::Config theConfig
 
G4INCL::INCLtheINCLModel
 
G4INCLXXInterfaceMessengertheINCLXXInterfaceMessenger
 
const G4int theMaxProjMassINCL
 
G4INCLXXVInterfaceTallytheTally
 
std::string versionName
 

Static Private Attributes

static G4ThreadLocal G4INCLXXInterfaceStoretheInstance = NULL
 

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 64 of file G4INCLXXInterfaceStore.hh.

Constructor & Destructor Documentation

◆ G4INCLXXInterfaceStore()

G4INCLXXInterfaceStore::G4INCLXXInterfaceStore ( )
private

Private constructor.

This class is a singleton. It must be instantiated using the GetInstance static method.

Definition at line 59 of file G4INCLXXInterfaceStore.cc.

59 :
64 theINCLModel(NULL),
65 theTally(NULL),
66 nWarnings(0),
67 maxWarnings(50)
68{
71}
static constexpr double MeV
Definition: G4SIunits.hh:200
G4INCLXXVInterfaceTally * theTally
const G4int maxWarnings
Maximum number of warnings.
G4int nWarnings
Static warning counter.
G4INCLXXInterfaceMessenger * theINCLXXInterfaceMessenger

References constructINCLXXVersionName(), and theINCLXXInterfaceMessenger.

Referenced by GetInstance().

◆ ~G4INCLXXInterfaceStore()

G4INCLXXInterfaceStore::~G4INCLXXInterfaceStore ( )
private

Private destructor.

This class is a singleton. Its instance must be deleted using the DeleteInstance static method.

Definition at line 73 of file G4INCLXXInterfaceStore.cc.

73 {
75 delete theINCLModel;
76}

References theINCLModel, and theINCLXXInterfaceMessenger.

Member Function Documentation

◆ constructINCLXXVersionName()

void G4INCLXXInterfaceStore::constructINCLXXVersionName ( )

Definition at line 102 of file G4INCLXXInterfaceStore.cc.

102 {
103 const std::string versionID = G4INCL_VERSION_ID;
104 const size_t lastDash = versionID.find_last_of("-");
105 versionName = "INCL++ " + versionID.substr(0,lastDash);
106}
#define G4INCL_VERSION_ID

References G4INCL_VERSION_ID, and versionName.

Referenced by G4INCLXXInterfaceStore().

◆ DeleteInstance()

void G4INCLXXInterfaceStore::DeleteInstance ( )
static

Delete the singleton instance.

Definition at line 88 of file G4INCLXXInterfaceStore.cc.

88 {
89 delete theInstance;
90 theInstance = NULL;
91}
static G4ThreadLocal G4INCLXXInterfaceStore * theInstance

References theInstance.

◆ DeleteModel()

void G4INCLXXInterfaceStore::DeleteModel ( )
private

Delete the INCL model engine.

Definition at line 78 of file G4INCLXXInterfaceStore.cc.

78 {
79 delete theINCLModel; theINCLModel=NULL;
80}

References theINCLModel.

Referenced by GetINCLConfig(), and SetMaxClusterMass().

◆ EmitBigWarning()

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 181 of file G4INCLXXInterfaceStore.cc.

181 {
182 // Disable the printing when global hadronic verbosity is zero
183 // (which can be issued via the UI command "/process/had/verbose 0" )
184 if ( G4HadronicParameters::Instance()->GetVerboseLevel() == 0 ) return;
185 G4cout
186 << G4endl
187 << "================================================================================"
188 << G4endl
189 << " INCL++ WARNING "
190 << G4endl
191 << message
192 << G4endl
193 << "================================================================================"
194 << G4endl
195 << G4endl;
196}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4HadronicParameters * Instance()

References G4cout, G4endl, and G4HadronicParameters::Instance().

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

◆ EmitWarning()

void G4INCLXXInterfaceStore::EmitWarning ( const G4String message)

Emit a warning to G4cout.

The InterfaceStore will not emit more than maxWarnings warnings.

Definition at line 172 of file G4INCLXXInterfaceStore.cc.

172 {
173 if(++nWarnings<=maxWarnings) {
174 G4cout << "[INCL++] Warning: " << message << G4endl;
176 G4cout << "[INCL++] INCL++ has already emitted " << maxWarnings << " warnings and will emit no more." << G4endl;
177 }
178 }
179}

References G4cout, G4endl, maxWarnings, and nWarnings.

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

◆ GetAccurateProjectile()

G4bool G4INCLXXInterfaceStore::GetAccurateProjectile ( ) const

Getter for accurateProjectile.

The

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

Definition at line 156 of file G4INCLXXInterfaceStore.cc.

156{ return accurateProjectile; }

References accurateProjectile.

Referenced by G4INCLXXInterface::AccurateProjectile().

◆ GetCascadeMinEnergyPerNucleon()

G4double G4INCLXXInterfaceStore::GetCascadeMinEnergyPerNucleon ( ) const

Getter for cascadeMinEnergyPerNucleon.

The

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

Definition at line 158 of file G4INCLXXInterfaceStore.cc.

References cascadeMinEnergyPerNucleon.

Referenced by G4INCLXXInterface::ApplyYourself().

◆ GetConservationTolerance()

G4double G4INCLXXInterfaceStore::GetConservationTolerance ( ) const

Getter for conservationTolerance.

Definition at line 165 of file G4INCLXXInterfaceStore.cc.

165{ return conservationTolerance; }

References conservationTolerance.

Referenced by G4INCLXXInterface::ApplyYourself().

◆ GetINCLConfig()

G4INCL::Config & G4INCLXXInterfaceStore::GetINCLConfig ( )

Getter for theConfig.

Definition at line 160 of file G4INCLXXInterfaceStore.cc.

160 {
161 DeleteModel(); // in case the Config is modified
162 return theConfig;
163}
void DeleteModel()
Delete the INCL model engine.

References DeleteModel(), and theConfig.

◆ GetINCLModel()

G4INCL::INCL * G4INCLXXInterfaceStore::GetINCLModel ( )

Get the cached INCL model engine.

Definition at line 93 of file G4INCLXXInterfaceStore.cc.

93 {
94 if(!theINCLModel) {
96 theINCLModel = new G4INCL::INCL(aConfig);
97 // ownership of the aConfig object is taken over by the INCL model engine
98 }
99 return theINCLModel;
100}

References theConfig, and theINCLModel.

Referenced by G4INCLXXInterface::ApplyYourself().

◆ getINCLXXVersionName()

const std::string & G4INCLXXInterfaceStore::getINCLXXVersionName ( )

Definition at line 108 of file G4INCLXXInterfaceStore.cc.

108 {
109 return versionName;
110}

References versionName.

Referenced by UseAblaDeExcitation().

◆ GetInstance()

G4INCLXXInterfaceStore * G4INCLXXInterfaceStore::GetInstance ( )
static

Get the singleton instance.

Definition at line 82 of file G4INCLXXInterfaceStore.cc.

82 {
83 if(!theInstance)
85 return theInstance;
86}
G4INCLXXInterfaceStore()
Private constructor.

References G4INCLXXInterfaceStore(), and theInstance.

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

◆ GetMaxProjMassINCL()

G4int G4INCLXXInterfaceStore::GetMaxProjMassINCL ( ) const

Getter for theMaxProjMassINCL.

Definition at line 170 of file G4INCLXXInterfaceStore.cc.

170{ return theMaxProjMassINCL; }

References theMaxProjMassINCL.

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

◆ GetTally()

G4INCLXXVInterfaceTally * G4INCLXXInterfaceStore::GetTally ( ) const

Getter for the interface tally.

Definition at line 221 of file G4INCLXXInterfaceStore.cc.

221{ return theTally; }

References theTally.

Referenced by G4INCLXXInterface::ApplyYourself().

◆ SetAccurateProjectile()

void G4INCLXXInterfaceStore::SetAccurateProjectile ( const G4bool  b)

Setter for accurateProjectile.

Definition at line 114 of file G4INCLXXInterfaceStore.cc.

114 {
115 if(accurateProjectile!=b) {
116 // Parameter is changed, emit a big warning message
117 std::stringstream ss;
118 ss << "Switching from "
119 << (accurateProjectile ? "\"accurate projectile\" mode to \"accurate target\"" : "\"accurate target\" mode to \"accurate projectile\"")
120 << " mode."
121 << G4endl
122 << "Do this ONLY if you fully understand what it does!";
123 EmitBigWarning(ss.str());
124 }
125
126 // No need to delete the model for this parameter
127
129}
void EmitBigWarning(const G4String &message) const
Emit a BIG warning to G4cout.

References accurateProjectile, EmitBigWarning(), and G4endl.

Referenced by G4INCLXXInterfaceMessenger::SetNewValue().

◆ SetCascadeMinEnergyPerNucleon()

void G4INCLXXInterfaceStore::SetCascadeMinEnergyPerNucleon ( const G4double  anEnergy)

Setter for cascadeMinEnergyPerNucleon.

Definition at line 198 of file G4INCLXXInterfaceStore.cc.

198 {
199 if(cascadeMinEnergyPerNucleon!=anEnergy) {
200 // Parameter is changed, emit a big warning message
201 std::stringstream ss;
202 ss << "Changing minimim cascade energy from "
204 << " to "
205 << anEnergy / MeV
206 << " MeV."
207 << G4endl
208 << "Do this ONLY if you fully understand what this setting does!";
209 EmitBigWarning(ss.str());
210 }
211
212 // No need to delete the model object
213
215}

References cascadeMinEnergyPerNucleon, EmitBigWarning(), G4endl, and MeV.

Referenced by G4INCLXXInterfaceMessenger::SetNewValue().

◆ SetConservationTolerance()

void G4INCLXXInterfaceStore::SetConservationTolerance ( const G4double  aTolerance)

Setter for conservationTolerance.

Definition at line 217 of file G4INCLXXInterfaceStore.cc.

217 {
218 conservationTolerance = aTolerance;
219}

References conservationTolerance.

◆ SetINCLPhysics()

void G4INCLXXInterfaceStore::SetINCLPhysics ( const G4String option)

Set the INCL physics.

Definition at line 225 of file G4INCLXXInterfaceStore.cc.

225 {
226 if(option == "default") {
227 theConfig.init();
228 } else if(option == "incl42") {
229 const G4String message = "Changing INCL++ physics to mimic INCL4.2. Do this ONLY if you fully understand the implications!";
230 EmitBigWarning(message);
231
239 // UseRealMasses intentionally left out because it creates problems with
240 // energy conservation
241 // theConfig.setUseRealMasses(false);
243 } else {
244 G4Exception("G4INCLXXInterfaceStore::SetINCLPhysics", "INCLXX0001", FatalErrorInArgument,
245 "SetINCLPhysics argument must be one of: default, incl42"
246 );
247 }
248}
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
void setClusterAlgorithm(ClusterAlgorithmType const c)
Set the clustering algorithm.
void setLocalEnergyPiType(const LocalEnergyType t)
Set the type of local energy for N-N avatars.
void setBackToSpectator(const G4bool b)
Set back-to-spectator.
void setCoulombType(CoulombType const c)
Set the Coulomb-distortion algorithm.
void setPionPotential(const G4bool pionPot)
Set the type of the potential for nucleons.
void setPotentialType(PotentialType type)
Set the type of the potential for nucleons.
void setCrossSectionsType(CrossSectionsType const c)
Set the Cross Section type.
void init()
Initialise the members.
Definition: G4INCLConfig.cc:51
void setLocalEnergyBBType(const LocalEnergyType t)
Set the type of local energy for N-N avatars.

References G4INCL::ConstantPotential, EmitBigWarning(), FatalErrorInArgument, G4Exception(), G4INCL::INCL46CrossSections, G4INCL::Config::init(), G4INCL::NeverLocalEnergy, G4INCL::NoClusterAlgorithm, G4INCL::NoCoulomb, G4INCL::Config::setBackToSpectator(), G4INCL::Config::setClusterAlgorithm(), G4INCL::Config::setCoulombType(), G4INCL::Config::setCrossSectionsType(), G4INCL::Config::setLocalEnergyBBType(), G4INCL::Config::setLocalEnergyPiType(), G4INCL::Config::setPionPotential(), G4INCL::Config::setPotentialType(), and theConfig.

Referenced by G4INCLXXInterfaceMessenger::SetNewValue().

◆ SetMaxClusterMass()

void G4INCLXXInterfaceStore::SetMaxClusterMass ( const G4int  aMass)

Setter for the maximum cluster mass.

Definition at line 131 of file G4INCLXXInterfaceStore.cc.

131 {
132 const G4int theMaxClusterMass = theConfig.getClusterMaxMass();
133 if(theMaxClusterMass!=aMass) {
134 // Parameter is changed, emit a big warning message
135 std::stringstream ss;
136 ss << "Changing maximum cluster mass from "
137 << theMaxClusterMass
138 << " to "
139 << aMass
140 << "."
141 << G4endl
142 << "Do this ONLY if you fully understand what this setting does!";
143 EmitBigWarning(ss.str());
144
145 // We must delete the model object to make sure that we use the new
146 // parameter
147 DeleteModel();
148
150 }
151}
int G4int
Definition: G4Types.hh:85
void setClusterMaxMass(const G4int clm)
Set the maximum mass for production of clusters.
G4int getClusterMaxMass() const
Get the maximum mass for production of clusters.

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

Referenced by G4INCLXXInterfaceMessenger::SetNewValue().

◆ SetTally()

void G4INCLXXInterfaceStore::SetTally ( G4INCLXXVInterfaceTally *const  aTally)

Setter for the interface tally.

Definition at line 223 of file G4INCLXXInterfaceStore.cc.

223{ theTally = aTally; }

References theTally.

◆ UseAblaDeExcitation()

void G4INCLXXInterfaceStore::UseAblaDeExcitation ( )

Set ABLA V3 to be the de-excitation model to be used with INCL++.

Definition at line 250 of file G4INCLXXInterfaceStore.cc.

250 {
251 // Get hold of pointers to the INCL++ model interfaces
252 std::vector<G4HadronicInteraction *> const &interactions = G4HadronicInteractionRegistry::Instance()
254 for(std::vector<G4HadronicInteraction *>::const_iterator iInter=interactions.begin(), e=interactions.end();
255 iInter!=e; ++iInter) {
256 G4INCLXXInterface *theINCLInterface = dynamic_cast<G4INCLXXInterface*>(*iInter);
257 if(theINCLInterface) {
258 // Instantiate the ABLA model
260 G4AblaInterface *theAblaInterface = dynamic_cast<G4AblaInterface*>(interaction);
261 if(!theAblaInterface)
262 theAblaInterface = new G4AblaInterface;
263 // Couple INCL++ to ABLA
264 G4cout << "Coupling INCLXX to ABLA" << G4endl;
265 theINCLInterface->SetDeExcitation(theAblaInterface);
266 }
267 }
268}
std::vector< G4HadronicInteraction * > FindAllModels(const G4String &name)
G4HadronicInteraction * FindModel(const G4String &name)
static G4HadronicInteractionRegistry * Instance()
static G4INCLXXInterfaceStore * GetInstance()
Get the singleton instance.
const std::string & getINCLXXVersionName()
INCL++ intra-nuclear cascade.
void SetDeExcitation(G4VPreCompoundModel *ptr)

References G4HadronicInteractionRegistry::FindAllModels(), G4HadronicInteractionRegistry::FindModel(), G4cout, G4endl, getINCLXXVersionName(), GetInstance(), G4HadronicInteractionRegistry::Instance(), and G4INCLXXInterface::SetDeExcitation().

Referenced by G4INCLXXInterfaceMessenger::SetNewValue().

Field Documentation

◆ accurateProjectile

G4bool G4INCLXXInterfaceStore::accurateProjectile
private

Definition at line 176 of file G4INCLXXInterfaceStore.hh.

Referenced by GetAccurateProjectile(), and SetAccurateProjectile().

◆ cascadeMinEnergyPerNucleon

G4double G4INCLXXInterfaceStore::cascadeMinEnergyPerNucleon
private

◆ conservationTolerance

G4double G4INCLXXInterfaceStore::conservationTolerance
private

◆ maxWarnings

const G4int G4INCLXXInterfaceStore::maxWarnings
private

Maximum number of warnings.

Definition at line 191 of file G4INCLXXInterfaceStore.hh.

Referenced by EmitWarning().

◆ nWarnings

G4int G4INCLXXInterfaceStore::nWarnings
private

Static warning counter.

Definition at line 188 of file G4INCLXXInterfaceStore.hh.

Referenced by EmitWarning().

◆ theConfig

G4INCL::Config G4INCLXXInterfaceStore::theConfig
private

◆ theINCLModel

G4INCL::INCL* G4INCLXXInterfaceStore::theINCLModel
private

Definition at line 183 of file G4INCLXXInterfaceStore.hh.

Referenced by DeleteModel(), GetINCLModel(), and ~G4INCLXXInterfaceStore().

◆ theINCLXXInterfaceMessenger

G4INCLXXInterfaceMessenger* G4INCLXXInterfaceStore::theINCLXXInterfaceMessenger
private

Definition at line 181 of file G4INCLXXInterfaceStore.hh.

Referenced by G4INCLXXInterfaceStore(), and ~G4INCLXXInterfaceStore().

◆ theInstance

G4ThreadLocal G4INCLXXInterfaceStore * G4INCLXXInterfaceStore::theInstance = NULL
staticprivate

Definition at line 172 of file G4INCLXXInterfaceStore.hh.

Referenced by DeleteInstance(), and GetInstance().

◆ theMaxProjMassINCL

const G4int G4INCLXXInterfaceStore::theMaxProjMassINCL
private

Definition at line 177 of file G4INCLXXInterfaceStore.hh.

Referenced by GetMaxProjMassINCL().

◆ theTally

G4INCLXXVInterfaceTally* G4INCLXXInterfaceStore::theTally
private

Definition at line 185 of file G4INCLXXInterfaceStore.hh.

Referenced by GetTally(), and SetTally().

◆ versionName

std::string G4INCLXXInterfaceStore::versionName
private

Definition at line 193 of file G4INCLXXInterfaceStore.hh.

Referenced by constructINCLXXVersionName(), and getINCLXXVersionName().


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