Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4INCLXXInterfaceStore.cc
이 파일의 문서화 페이지로 가기
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 // Alain Boudard, CEA-Saclay, France
28 // Joseph Cugnon, University of Liege, Belgium
29 // Jean-Christophe David, CEA-Saclay, France
30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31 // Sylvie Leray, CEA-Saclay, France
32 // Davide Mancusi, CEA-Saclay, France
33 //
34 #define INCLXX_IN_GEANT4_MODE 1
35 
36 #include "globals.hh"
37 
47 #include "G4INCLConfigEnums.hh"
48 #include "G4SystemOfUnits.hh"
49 #include "G4HadronicInteraction.hh"
51 #include "G4INCLXXInterface.hh"
52 #include "G4INCLConfig.hh"
53 #include "G4AblaInterface.hh"
54 #include <vector>
55 
57 
59  accurateProjectile(true),
60  theMaxProjMassINCL(18),
61  cascadeMinEnergyPerNucleon(1.*MeV),
62  conservationTolerance(5*MeV),
63  theINCLModel(NULL),
64  theTally(NULL),
65  nWarnings(0),
66  maxWarnings(50)
67 {
70 }
71 
74  delete theINCLModel;
75 }
76 
78  delete theINCLModel; theINCLModel=NULL;
79 }
80 
82  if(!theInstance)
84  return theInstance;
85 }
86 
88  delete theInstance;
89  theInstance = NULL;
90 }
91 
93  if(!theINCLModel) {
94  G4INCL::Config *aConfig = new G4INCL::Config(theConfig);
95  theINCLModel = new G4INCL::INCL(aConfig);
96  // ownership of the aConfig object is taken over by the INCL model engine
97  }
98  return theINCLModel;
99 }
100 
102  const std::string versionID = G4INCL_VERSION_ID;
103  const size_t lastDash = versionID.find_last_of("-");
104  versionName = "INCL++ " + versionID.substr(0,lastDash);
105 }
106 
108  return versionName;
109 }
110 
111 
112 
114  if(accurateProjectile!=b) {
115  // Parameter is changed, emit a big warning message
116  std::stringstream ss;
117  ss << "Switching from "
118  << (accurateProjectile ? "\"accurate projectile\" mode to \"accurate target\"" : "\"accurate target\" mode to \"accurate projectile\"")
119  << " mode."
120  << G4endl
121  << "Do this ONLY if you fully understand what it does!";
122  EmitBigWarning(ss.str());
123  }
124 
125  // No need to delete the model for this parameter
126 
128 }
129 
131  const G4int theMaxClusterMass = theConfig.getClusterMaxMass();
132  if(theMaxClusterMass!=aMass) {
133  // Parameter is changed, emit a big warning message
134  std::stringstream ss;
135  ss << "Changing maximum cluster mass from "
136  << theMaxClusterMass
137  << " to "
138  << aMass
139  << "."
140  << G4endl
141  << "Do this ONLY if you fully understand what this setting does!";
142  EmitBigWarning(ss.str());
143 
144  // We must delete the model object to make sure that we use the new
145  // parameter
146  DeleteModel();
147 
149  }
150 }
151 
152 
153 
154 
156 
158 
160  DeleteModel(); // in case the Config is modified
161  return theConfig;
162 }
163 
165 
166 
167 
168 
170 
172  if(++nWarnings<=maxWarnings) {
173  G4cout << "[INCL++] Warning: " << message << G4endl;
174  if(nWarnings==maxWarnings) {
175  G4cout << "[INCL++] INCL++ has already emitted " << maxWarnings << " warnings and will emit no more." << G4endl;
176  }
177  }
178 }
179 
181  G4cout
182  << G4endl
183  << "================================================================================"
184  << G4endl
185  << " INCL++ WARNING "
186  << G4endl
187  << message
188  << G4endl
189  << "================================================================================"
190  << G4endl
191  << G4endl;
192 }
193 
195  if(cascadeMinEnergyPerNucleon!=anEnergy) {
196  // Parameter is changed, emit a big warning message
197  std::stringstream ss;
198  ss << "Changing minimim cascade energy from "
200  << " to "
201  << anEnergy / MeV
202  << " MeV."
203  << G4endl
204  << "Do this ONLY if you fully understand what this setting does!";
205  EmitBigWarning(ss.str());
206  }
207 
208  // No need to delete the model object
209 
211 }
212 
214  conservationTolerance = aTolerance;
215 }
216 
218 
220 
222  if(option == "default") {
223  theConfig.init();
224  } else if(option == "incl42") {
225  const G4String message = "Changing INCL++ physics to mimick INCL4.2. Do this ONLY if you fully understand the implications!";
226  EmitBigWarning(message);
227 
235  // UseRealMasses intentionally left out because it creates problems with
236  // energy conservation
237  // theConfig.setUseRealMasses(false);
239  } else {
240  G4Exception("G4INCLXXInterfaceStore::SetINCLPhysics", "INCLXX0001", FatalErrorInArgument,
241  "SetINCLPhysics argument must be one of: default, incl42"
242  );
243  }
244 }
245 
247  // Get hold of pointers to the INCL++ model interfaces
248  std::vector<G4HadronicInteraction *> const &interactions = G4HadronicInteractionRegistry::Instance()
250  for(std::vector<G4HadronicInteraction *>::const_iterator iInter=interactions.begin(), e=interactions.end();
251  iInter!=e; ++iInter) {
252  G4INCLXXInterface *theINCLInterface = dynamic_cast<G4INCLXXInterface*>(*iInter);
253  if(theINCLInterface) {
254  // Instantiate the ABLA model
256  G4AblaInterface *theAblaInterface = dynamic_cast<G4AblaInterface*>(interaction);
257  if(!theAblaInterface)
258  theAblaInterface = new G4AblaInterface;
259  // Couple INCL++ to ABLA
260  G4cout << "Coupling INCLXX to ABLA" << G4endl;
261  theINCLInterface->SetDeExcitation(theAblaInterface);
262  }
263  }
264 }
G4INCLXXInterfaceStore()
Private constructor.
Header file for the G4INCLXXInterfaceStore class.
static constexpr double MeV
Definition: G4SIunits.hh:214
void init()
Initialise the members.
Definition: G4INCLConfig.cc:51
static void DeleteInstance()
Delete the singleton instance.
void setLocalEnergyBBType(const LocalEnergyType t)
Set the type of local energy for N-N avatars.
#define G4endl
Definition: G4ios.hh:61
G4bool GetAccurateProjectile() const
Getter for accurateProjectile.
G4double GetConservationTolerance() const
Getter for conservationTolerance.
void message(RunManager *runmanager)
Definition: ts_scorers.cc:72
Messenger class for the Geant4 INCL++ interface.
std::vector< G4HadronicInteraction * > FindAllModels(const G4String &name)
void SetMaxClusterMass(const G4int aMass)
Setter for the maximum cluster mass.
G4INCLXXVInterfaceTally * GetTally() const
Getter for the interface tally.
#define G4ThreadLocal
Definition: tls.hh:69
void DeleteModel()
Delete the INCL model engine.
void EmitWarning(const G4String &message)
Emit a warning to G4cout.
void setCrossSectionsType(CrossSectionsType const c)
Set the Cross Section type.
void SetTally(G4INCLXXVInterfaceTally *const aTally)
Setter for the interface tally.
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
static G4ThreadLocal G4INCLXXInterfaceStore * theInstance
void SetDeExcitation(G4VPreCompoundModel *ptr)
void setClusterMaxMass(const G4int m)
Set the maximum mass for production of clusters.
static G4HadronicInteractionRegistry * Instance()
const G4int maxWarnings
Maximum number of warnings.
static G4INCLXXInterfaceStore * GetInstance()
Get the singleton instance.
void setBackToSpectator(const G4bool b)
Set back-to-spectator.
void SetConservationTolerance(const G4double aTolerance)
Setter for conservationTolerance.
INCL++ intra-nuclear cascade.
G4INCL::INCL * GetINCLModel()
Get the cached INCL model engine.
G4int GetMaxProjMassINCL() const
Getter for theMaxProjMassINCL.
G4INCLXXVInterfaceTally * theTally
G4int nWarnings
Static warning counter.
void setClusterAlgorithm(ClusterAlgorithmType const c)
Set the clustering algorithm.
void EmitBigWarning(const G4String &message) const
Emit a BIG warning to G4cout.
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
void SetCascadeMinEnergyPerNucleon(const G4double anEnergy)
Setter for cascadeMinEnergyPerNucleon.
G4int getClusterMaxMass() const
Get the maximum mass for production of clusters.
void setLocalEnergyPiType(const LocalEnergyType t)
Set the type of local energy for N-N avatars.
void SetINCLPhysics(const G4String &option)
Set the INCL physics.
int G4int
Definition: G4Types.hh:78
const std::string & getINCLXXVersionName()
void setCoulombType(CoulombType const c)
Set the Coulomb-distortion algorithm.
G4GLOB_DLL std::ostream G4cout
void SetAccurateProjectile(const G4bool b)
Setter for accurateProjectile.
void UseAblaDeExcitation()
Set ABLA V3 to be the de-excitation model to be used with INCL++.
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.
~G4INCLXXInterfaceStore()
Private destructor.
G4HadronicInteraction * FindModel(const G4String &name)
G4INCLXXInterfaceMessenger * theINCLXXInterfaceMessenger
Singleton class for configuring the INCL++ Geant4 interface.
G4double GetCascadeMinEnergyPerNucleon() const
Getter for cascadeMinEnergyPerNucleon.
G4INCL::Config & GetINCLConfig()
Getter for theConfig.
#define G4INCL_VERSION_ID