ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4INCLXXInterfaceStore.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 mimic 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 }