Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 #define INCLXX_IN_GEANT4_MODE 1
34 
35 #include "globals.hh"
36 
44 #ifndef G4INCLXXINTERFACESTORE_HH_
45 #define G4INCLXXINTERFACESTORE_HH_
46 
47 #include "G4INCLXXInterface.hh"
48 #include "G4INCLCascade.hh"
49 #include "G4INCLConfig.hh"
50 #include <list>
51 #include <sstream>
52 
54 
62  public:
63 
66  if(!theInstance)
67  theInstance = new G4INCLXXInterfaceStore;
68  return theInstance;
69  }
70 
72  static void DeleteInstance() {
73  delete theInstance;
74  theInstance = NULL;
75  }
76 
79  if(!theINCLModel) {
80  G4INCL::Config *theConfig = new G4INCL::Config;
81  theConfig->setClusterMaxMass(theMaxClusterMass);
82  theINCLModel = new G4INCL::INCL(theConfig);
83  // ownership of the Config object is taken over by the INCL model engine
84  }
85  return theINCLModel;
86  }
87 
88 
89 
90 
93  if(accurateProjectile!=b) {
94  // Parameter is changed, emit a big warning message
95  std::stringstream ss;
96  ss << "Switching from "
97  << (accurateProjectile ? "\"accurate projectile\" mode to \"accurate target\"" : "\"accurate target\" mode to \"accurate projectile\"")
98  << " mode."
99  << G4endl
100  << "Do this ONLY if you fully understand what it does!";
101  EmitBigWarning(ss.str());
102  }
103 
104  // No need to delete the model for this parameter
105 
106  accurateProjectile=b;
107  }
108 
110  void SetMaxClusterMass(const G4int aMass) {
111  if(theMaxClusterMass!=aMass) {
112  // Parameter is changed, emit a big warning message
113  std::stringstream ss;
114  ss << "Changing maximum cluster mass from "
115  << theMaxClusterMass
116  << " to "
117  << aMass
118  << "."
119  << G4endl
120  << "Do this ONLY if you fully understand what this setting does!";
121  EmitBigWarning(ss.str());
122  }
123 
124  // We must delete the model object to make sure that we use the new
125  // parameter
126  DeleteModel();
127 
128  theMaxClusterMass=aMass;
129  }
130 
131 
132 
133 
139  G4bool GetAccurateProjectile() const { return accurateProjectile; }
140 
146  G4int GetMaxClusterMass() const { return theMaxClusterMass; }
147 
148 
149 
150 
152  G4int GetMaxProjMassINCL() const { return theMaxProjMassINCL; }
153 
155  G4bool GetDumpInput() const { return dumpInput; }
156 
157 
158 
159 
160 
165  void EmitWarning(const G4String &message);
166 
171  void EmitBigWarning(const G4String &message) const;
172 
173  private:
174 
181 
188 
190  void DeleteModel() { delete theINCLModel; theINCLModel=NULL; }
191 
193 
194  static G4INCLXXInterfaceStore *theInstance;
195 
196  G4bool dumpInput;
197  G4bool accurateProjectile;
198  const G4int theMaxClusterMassDefault;
199  G4int theMaxClusterMass;
200  const G4int theMaxProjMassINCL;
201 
202  G4INCLXXInterfaceMessenger *theINCLXXInterfaceMessenger;
203 
204  G4INCL::INCL *theINCLModel;
205 
207  G4int nWarnings;
208 
210  const G4int maxWarnings;
211 };
212 
213 #endif // G4INCLXXINTERFACESTORE_HH_