Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4INCLXXInterfaceStore.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// INCL++ intra-nuclear cascade model
27// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28// Davide Mancusi, CEA
29// Alain Boudard, CEA
30// Sylvie Leray, CEA
31// Joseph Cugnon, University of Liege
32//
33// INCL++ revision: v5.1.8
34//
35#define INCLXX_IN_GEANT4_MODE 1
36
37#include "globals.hh"
38
39/** \file G4INCLXXInterfaceStore.hh
40 * \brief Header file for the G4INCLXXInterfaceStore class
41 *
42 * \date 24 May 2012
43 * \author Davide Mancusi
44 */
45
46#ifndef G4INCLXXINTERFACESTORE_HH_
47#define G4INCLXXINTERFACESTORE_HH_
48
49#include "G4INCLXXInterface.hh"
50#include "G4INCLCascade.hh"
51#include "G4INCLConfig.hh"
52#include <list>
53#include <sstream>
54
56
57/** \class G4INCLXXInterfaceStore
58 * \brief Singleton class for configuring the INCL++ Geant4 interface.
59 *
60 * This class also contains a single cached instance of the INCL model
61 * (\see{G4INCL::INCL}).
62 */
64 public:
65
66 /// \brief Get the singleton instance
68 if(!theInstance)
69 theInstance = new G4INCLXXInterfaceStore;
70 return theInstance;
71 }
72
73 /// \brief Delete the singleton instance
74 static void DeleteInstance() {
75 delete theInstance;
76 theInstance = NULL;
77 }
78
79 /// \brief Get the cached INCL model engine
81 if(!theINCLModel) {
82 G4INCL::Config *theConfig = new G4INCL::Config;
83 theConfig->setClusterMaxMass(theMaxClusterMass);
84 theINCLModel = new G4INCL::INCL(theConfig);
85 // ownership of the Config object is taken over by the INCL model engine
86 }
87 return theINCLModel;
88 }
89
90
91
92
93 /// \brief Setter for accurateProjectile
95 if(accurateProjectile!=b) {
96 // Parameter is changed, emit a big warning message
97 std::stringstream ss;
98 ss << "Switching from "
99 << (accurateProjectile ? "\"accurate projectile\" mode to \"accurate target\"" : "\"accurate target\" mode to \"accurate projectile\"")
100 << " mode."
101 << G4endl
102 << "Do this ONLY if you fully understand what it does!";
103 EmitBigWarning(ss.str());
104 }
105
106 // No need to delete the model for this parameter
107
108 accurateProjectile=b;
109 }
110
111 /// \brief Setter for theMaxClusterMass
112 void SetMaxClusterMass(const G4int aMass) {
113 if(theMaxClusterMass!=aMass) {
114 // Parameter is changed, emit a big warning message
115 std::stringstream ss;
116 ss << "Changing maximum cluster mass from "
117 << theMaxClusterMass
118 << " to "
119 << aMass
120 << "."
121 << G4endl
122 << "Do this ONLY if you fully understand what this setting does!";
123 EmitBigWarning(ss.str());
124 }
125
126 // We must delete the model object to make sure that we use the new
127 // parameter
128 DeleteModel();
129
130 theMaxClusterMass=aMass;
131 }
132
133
134
135
136 /** \brief Getter for accurateProjectile
137 *
138 * The \see{G4INCLXXInterfaceMessenger} class provides a UI command to set
139 * this parameter.
140 */
141 G4bool GetAccurateProjectile() const { return accurateProjectile; }
142
143 /** \brief Getter for ClusterMaxMass
144 *
145 * The \see{G4INCLXXInterfaceMessenger} class provides a UI command to set
146 * this parameter.
147 */
148 G4int GetMaxClusterMass() const { return theMaxClusterMass; }
149
150
151
152
153 /// \brief Getter for theMaxProjMassINCL
154 G4int GetMaxProjMassINCL() const { return theMaxProjMassINCL; }
155
156 /// \brief Getter for dumpInput
157 G4bool GetDumpInput() const { return dumpInput; }
158
159
160
161
162
163 /** \brief Emit a warning to G4cout
164 *
165 * The InterfaceStore will not emit more than maxWarnings warnings.
166 */
167 void EmitWarning(const G4String &message);
168
169 /** \brief Emit a BIG warning to G4cout
170 *
171 * There is no limit on the number of BIG warnings emitted.
172 */
173 void EmitBigWarning(const G4String &message) const;
174
175 private:
176
177 /** \brief Private constructor
178 *
179 * This class is a singleton. It must be instantiated using the GetInstance
180 * static method.
181 */
183
184 /** \brief Private destructor
185 *
186 * This class is a singleton. Its instance must be deleted using the
187 * DeleteInstance static method.
188 */
190
191 /// \brief Delete the INCL model engine
192 void DeleteModel() { delete theINCLModel; theINCLModel=NULL; }
193
194 /// \brief Create a new Config object from the current options
195
196 static G4INCLXXInterfaceStore *theInstance;
197
198 G4bool dumpInput;
199 G4bool accurateProjectile;
200 const G4int theMaxClusterMassDefault;
201 G4int theMaxClusterMass;
202 const G4int theMaxProjMassINCL;
203
204 G4INCLXXInterfaceMessenger *theINCLXXInterfaceMessenger;
205
206 G4INCL::INCL *theINCLModel;
207
208 /// \brief Static warning counter
209 G4int nWarnings;
210
211 /// \brief Maximum number of warnings
212 const G4int maxWarnings;
213};
214
215#endif // G4INCLXXINTERFACESTORE_HH_
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
Singleton class for configuring the INCL++ Geant4 interface.
void EmitWarning(const G4String &message)
Emit a warning to G4cout.
void SetAccurateProjectile(const G4bool b)
Setter for accurateProjectile.
G4int GetMaxProjMassINCL() const
Getter for theMaxProjMassINCL.
G4INCL::INCL * GetINCLModel()
Get the cached INCL model engine.
static G4INCLXXInterfaceStore * GetInstance()
Get the singleton instance.
G4int GetMaxClusterMass() const
Getter for ClusterMaxMass.
static void DeleteInstance()
Delete the singleton instance.
void EmitBigWarning(const G4String &message) const
Emit a BIG warning to G4cout.
G4bool GetDumpInput() const
Getter for dumpInput.
void SetMaxClusterMass(const G4int aMass)
Setter for theMaxClusterMass.
G4bool GetAccurateProjectile() const
Getter for accurateProjectile.
void setClusterMaxMass(const G4int m)
Set the maximum mass for production of clusters.