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.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/inclxx/interface/src/G4INCLXXInterfaceStore.cc (Version 11.3.0) and /processes/hadronic/models/inclxx/interface/src/G4INCLXXInterfaceStore.cc (Version 10.0)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // INCL++ intra-nuclear cascade model              26 // INCL++ intra-nuclear cascade model
 27 // Alain Boudard, CEA-Saclay, France           <<  27 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
 28 // Joseph Cugnon, University of Liege, Belgium <<  28 // Davide Mancusi, CEA
 29 // Jean-Christophe David, CEA-Saclay, France   <<  29 // Alain Boudard, CEA
 30 // Pekka Kaitaniemi, CEA-Saclay, France, and H <<  30 // Sylvie Leray, CEA
 31 // Sylvie Leray, CEA-Saclay, France            <<  31 // Joseph Cugnon, University of Liege
 32 // Davide Mancusi, CEA-Saclay, France          << 
 33 //                                                 32 //
 34 #define INCLXX_IN_GEANT4_MODE 1                    33 #define INCLXX_IN_GEANT4_MODE 1
 35                                                    34 
 36 #include "globals.hh"                              35 #include "globals.hh"
 37                                                    36 
 38 /** \file G4INCLXXInterfaceStore.cc                37 /** \file G4INCLXXInterfaceStore.cc
 39  * \brief The G4INCLXXInterfaceStore class imp     38  * \brief The G4INCLXXInterfaceStore class implementation
 40  *                                                 39  *
 41  * \date 24 May 2012                               40  * \date 24 May 2012
 42  * \author Davide Mancusi                          41  * \author Davide Mancusi
 43  */                                                42  */
 44                                                    43 
 45 #include "G4INCLXXInterfaceStore.hh"           << 
 46 #include "G4INCLXXInterfaceMessenger.hh"           44 #include "G4INCLXXInterfaceMessenger.hh"
 47 #include "G4INCLConfigEnums.hh"                << 
 48 #include "G4SystemOfUnits.hh"                      45 #include "G4SystemOfUnits.hh"
 49 #include "G4HadronicInteraction.hh"            << 
 50 #include "G4HadronicInteractionRegistry.hh"    << 
 51 #include "G4INCLXXInterface.hh"                << 
 52 #include "G4INCLConfig.hh"                     << 
 53 #include "G4AblaInterface.hh"                  << 
 54 #include "G4HadronicParameters.hh"             << 
 55 #include <vector>                              << 
 56                                                    46 
 57 G4ThreadLocal G4INCLXXInterfaceStore *G4INCLXX     47 G4ThreadLocal G4INCLXXInterfaceStore *G4INCLXXInterfaceStore::theInstance = NULL;
 58                                                    48 
 59 G4INCLXXInterfaceStore::G4INCLXXInterfaceStore     49 G4INCLXXInterfaceStore::G4INCLXXInterfaceStore() :
 60   accurateProjectile(true),                        50   accurateProjectile(true),
                                                   >>  51   theMaxClusterMassDefault(8),
                                                   >>  52   theMaxClusterMass(theMaxClusterMassDefault),
 61   theMaxProjMassINCL(18),                          53   theMaxProjMassINCL(18),
 62   cascadeMinEnergyPerNucleon(1.*MeV),              54   cascadeMinEnergyPerNucleon(1.*MeV),
 63   conservationTolerance(5*MeV),                    55   conservationTolerance(5*MeV),
 64   theINCLModel(NULL),                              56   theINCLModel(NULL),
 65   theTally(NULL),                              << 
 66   nWarnings(0),                                    57   nWarnings(0),
 67   maxWarnings(50)                                  58   maxWarnings(50)
 68 {                                                  59 {
 69   constructINCLXXVersionName();                    60   constructINCLXXVersionName();
 70   theINCLXXInterfaceMessenger = new G4INCLXXIn     61   theINCLXXInterfaceMessenger = new G4INCLXXInterfaceMessenger(this);
 71 }                                                  62 }
 72                                                    63 
 73 G4INCLXXInterfaceStore::~G4INCLXXInterfaceStor     64 G4INCLXXInterfaceStore::~G4INCLXXInterfaceStore() {
 74   delete theINCLXXInterfaceMessenger;              65   delete theINCLXXInterfaceMessenger;
 75   delete theINCLModel;                             66   delete theINCLModel;
 76 }                                                  67 }
 77                                                    68 
 78 void G4INCLXXInterfaceStore::DeleteModel() {   << 
 79   delete theINCLModel; theINCLModel=NULL;      << 
 80 }                                              << 
 81                                                << 
 82 G4INCLXXInterfaceStore *G4INCLXXInterfaceStore     69 G4INCLXXInterfaceStore *G4INCLXXInterfaceStore::GetInstance() {
 83   if(!theInstance)                                 70   if(!theInstance)
 84     theInstance = new G4INCLXXInterfaceStore;      71     theInstance = new G4INCLXXInterfaceStore;
 85   return theInstance;                              72   return theInstance;
 86 }                                                  73 }
 87                                                    74 
 88 void G4INCLXXInterfaceStore::DeleteInstance()      75 void G4INCLXXInterfaceStore::DeleteInstance() {
 89   delete theInstance;                              76   delete theInstance;
 90   theInstance = NULL;                              77   theInstance = NULL;
 91 }                                                  78 }
 92                                                    79 
 93 G4INCL::INCL *G4INCLXXInterfaceStore::GetINCLM     80 G4INCL::INCL *G4INCLXXInterfaceStore::GetINCLModel() {
 94   if(!theINCLModel) {                              81   if(!theINCLModel) {
 95     G4INCL::Config *aConfig = new G4INCL::Conf <<  82     G4INCL::Config *theConfig = new G4INCL::Config;
 96     theINCLModel = new G4INCL::INCL(aConfig);  <<  83     theConfig->setClusterMaxMass(theMaxClusterMass);
 97     // ownership of the aConfig object is take <<  84     theINCLModel = new G4INCL::INCL(theConfig);
                                                   >>  85     // ownership of the Config object is taken over by the INCL model engine
 98   }                                                86   }
 99   return theINCLModel;                             87   return theINCLModel;
100 }                                                  88 }
101                                                    89 
102 void G4INCLXXInterfaceStore::constructINCLXXVe     90 void G4INCLXXInterfaceStore::constructINCLXXVersionName() {
103   const std::string versionID = G4INCL_VERSION     91   const std::string versionID = G4INCL_VERSION_ID;
104   const size_t lastDash = versionID.find_last_     92   const size_t lastDash = versionID.find_last_of("-");
105   versionName = "INCL++ " + versionID.substr(0     93   versionName = "INCL++ " + versionID.substr(0,lastDash);
106 }                                                  94 }
107                                                    95 
108 const std::string &G4INCLXXInterfaceStore::get     96 const std::string &G4INCLXXInterfaceStore::getINCLXXVersionName() {
109   return versionName;                              97   return versionName;
110 }                                                  98 }
111                                                    99 
112                                                   100 
113                                                   101 
114 void G4INCLXXInterfaceStore::SetAccurateProjec    102 void G4INCLXXInterfaceStore::SetAccurateProjectile(const G4bool b) {
115   if(accurateProjectile!=b) {                     103   if(accurateProjectile!=b) {
116     // Parameter is changed, emit a big warnin    104     // Parameter is changed, emit a big warning message
117     std::stringstream ss;                         105     std::stringstream ss;
118     ss << "Switching from "                       106     ss << "Switching from "
119       << (accurateProjectile ? "\"accurate pro    107       << (accurateProjectile ? "\"accurate projectile\" mode to \"accurate target\"" : "\"accurate target\" mode to \"accurate projectile\"")
120       << " mode."                                 108       << " mode."
121       << G4endl                                   109       << G4endl
122       << "Do this ONLY if you fully understand    110       << "Do this ONLY if you fully understand what it does!";
123     EmitBigWarning(ss.str());                     111     EmitBigWarning(ss.str());
124   }                                               112   }
125                                                   113 
126   // No need to delete the model for this para    114   // No need to delete the model for this parameter
127                                                   115 
128   accurateProjectile=b;                           116   accurateProjectile=b;
129 }                                                 117 }
130                                                   118 
131 void G4INCLXXInterfaceStore::SetMaxClusterMass    119 void G4INCLXXInterfaceStore::SetMaxClusterMass(const G4int aMass) {
132   const G4int theMaxClusterMass = theConfig.ge << 
133   if(theMaxClusterMass!=aMass) {                  120   if(theMaxClusterMass!=aMass) {
134     // Parameter is changed, emit a big warnin    121     // Parameter is changed, emit a big warning message
135     std::stringstream ss;                         122     std::stringstream ss;
136     ss << "Changing maximum cluster mass from     123     ss << "Changing maximum cluster mass from "
137       << theMaxClusterMass                        124       << theMaxClusterMass
138       << " to "                                   125       << " to "
139       << aMass                                    126       << aMass
140       << "."                                      127       << "."
141       << G4endl                                   128       << G4endl
142       << "Do this ONLY if you fully understand    129       << "Do this ONLY if you fully understand what this setting does!";
143     EmitBigWarning(ss.str());                     130     EmitBigWarning(ss.str());
                                                   >> 131   }
144                                                   132 
145     // We must delete the model object to make << 133   // We must delete the model object to make sure that we use the new
146     // parameter                               << 134   // parameter
147     DeleteModel();                             << 135   DeleteModel();
148                                                   136 
149     theConfig.setClusterMaxMass(aMass);        << 137   theMaxClusterMass=aMass;
150   }                                            << 
151 }                                                 138 }
152                                                   139 
153                                                   140 
154                                                   141 
155                                                   142 
156 G4bool G4INCLXXInterfaceStore::GetAccurateProj    143 G4bool G4INCLXXInterfaceStore::GetAccurateProjectile() const { return accurateProjectile; }
157                                                   144 
158 G4double G4INCLXXInterfaceStore::GetCascadeMin    145 G4double G4INCLXXInterfaceStore::GetCascadeMinEnergyPerNucleon() const { return cascadeMinEnergyPerNucleon; }
159                                                   146 
160 G4INCL::Config &G4INCLXXInterfaceStore::GetINC << 147 G4int G4INCLXXInterfaceStore::GetMaxClusterMass() const { return theMaxClusterMass; }
161   DeleteModel(); // in case the Config is modi << 
162   return theConfig;                            << 
163 }                                              << 
164                                                   148 
165 G4double G4INCLXXInterfaceStore::GetConservati    149 G4double G4INCLXXInterfaceStore::GetConservationTolerance() const { return conservationTolerance; }
166                                                   150 
167                                                   151 
168                                                   152 
169                                                   153 
170 G4int G4INCLXXInterfaceStore::GetMaxProjMassIN    154 G4int G4INCLXXInterfaceStore::GetMaxProjMassINCL() const { return theMaxProjMassINCL; }
171                                                   155 
172 void G4INCLXXInterfaceStore::EmitWarning(const    156 void G4INCLXXInterfaceStore::EmitWarning(const G4String &message) {
173   if(++nWarnings<=maxWarnings) {                  157   if(++nWarnings<=maxWarnings) {
174     G4cout << "[INCL++] Warning: " << message     158     G4cout << "[INCL++] Warning: " << message << G4endl;
175     if(nWarnings==maxWarnings) {                  159     if(nWarnings==maxWarnings) {
176       G4cout << "[INCL++] INCL++ has already e    160       G4cout << "[INCL++] INCL++ has already emitted " << maxWarnings << " warnings and will emit no more." << G4endl;
177     }                                             161     }
178   }                                               162   }
179 }                                                 163 }
180                                                   164 
181 void G4INCLXXInterfaceStore::EmitBigWarning(co    165 void G4INCLXXInterfaceStore::EmitBigWarning(const G4String &message) const {
182   // Disable the printing when global hadronic << 
183   // (which can be issued via the UI command " << 
184   if ( G4HadronicParameters::Instance()->GetVe << 
185   G4cout                                          166   G4cout
186     << G4endl                                     167     << G4endl
187     << "======================================    168     << "================================================================================"
188     << G4endl                                     169     << G4endl
189     << "                                 INCL+    170     << "                                 INCL++ WARNING                                 "
190     << G4endl                                     171     << G4endl
191     << message                                    172     << message
192     << G4endl                                     173     << G4endl
193     << "======================================    174     << "================================================================================"
194     << G4endl                                     175     << G4endl
195     << G4endl;                                    176     << G4endl;
196 }                                                 177 }
197                                                   178 
198 void G4INCLXXInterfaceStore::SetCascadeMinEner    179 void G4INCLXXInterfaceStore::SetCascadeMinEnergyPerNucleon(const G4double anEnergy) {
199   if(cascadeMinEnergyPerNucleon!=anEnergy) {      180   if(cascadeMinEnergyPerNucleon!=anEnergy) {
200     // Parameter is changed, emit a big warnin    181     // Parameter is changed, emit a big warning message
201     std::stringstream ss;                         182     std::stringstream ss;
202     ss << "Changing minimim cascade energy fro    183     ss << "Changing minimim cascade energy from "
203       << cascadeMinEnergyPerNucleon / MeV         184       << cascadeMinEnergyPerNucleon / MeV
204       << " to "                                   185       << " to "
205       << anEnergy / MeV                           186       << anEnergy / MeV
206       << " MeV."                                  187       << " MeV."
207       << G4endl                                   188       << G4endl
208       << "Do this ONLY if you fully understand    189       << "Do this ONLY if you fully understand what this setting does!";
209     EmitBigWarning(ss.str());                     190     EmitBigWarning(ss.str());
210   }                                               191   }
211                                                   192 
212   // No need to delete the model object           193   // No need to delete the model object
213                                                   194 
214   cascadeMinEnergyPerNucleon=anEnergy;            195   cascadeMinEnergyPerNucleon=anEnergy;
215 }                                                 196 }
216                                                   197 
217 void G4INCLXXInterfaceStore::SetConservationTo    198 void G4INCLXXInterfaceStore::SetConservationTolerance(const G4double aTolerance) {
218   conservationTolerance = aTolerance;             199   conservationTolerance = aTolerance;
219 }                                                 200 }
220                                                   201 
221 G4INCLXXVInterfaceTally *G4INCLXXInterfaceStor << 
222                                                << 
223 void G4INCLXXInterfaceStore::SetTally(G4INCLXX << 
224                                                << 
225 void G4INCLXXInterfaceStore::SetINCLPhysics(co << 
226   if(option == "default") {                    << 
227     theConfig.init();                          << 
228   } else if(option == "incl42") {              << 
229     const G4String message = "Changing INCL++  << 
230     EmitBigWarning(message);                   << 
231                                                << 
232     theConfig.setPotentialType(G4INCL::Constan << 
233     theConfig.setPionPotential(false);         << 
234     theConfig.setLocalEnergyBBType(G4INCL::Nev << 
235     theConfig.setLocalEnergyPiType(G4INCL::Nev << 
236     theConfig.setBackToSpectator(false);       << 
237     theConfig.setClusterAlgorithm(G4INCL::NoCl << 
238     theConfig.setCoulombType(G4INCL::NoCoulomb << 
239     // UseRealMasses intentionally left out be << 
240     // energy conservation                     << 
241     // theConfig.setUseRealMasses(false);      << 
242     theConfig.setCrossSectionsType(G4INCL::INC << 
243   } else {                                     << 
244     G4Exception("G4INCLXXInterfaceStore::SetIN << 
245                 "SetINCLPhysics argument must  << 
246                 );                             << 
247   }                                            << 
248 }                                              << 
249                                                << 
250 void G4INCLXXInterfaceStore::UseAblaDeExcitati << 
251   // Get hold of pointers to the INCL++ model  << 
252   std::vector<G4HadronicInteraction *> const & << 
253     ->FindAllModels(G4INCLXXInterfaceStore::Ge << 
254   for(std::vector<G4HadronicInteraction *>::co << 
255       iInter!=e; ++iInter) {                   << 
256     G4INCLXXInterface *theINCLInterface = dyna << 
257     if(theINCLInterface) {                     << 
258       // Instantiate the ABLA model            << 
259       G4HadronicInteraction *interaction = G4H << 
260       G4AblaInterface *theAblaInterface = dyna << 
261       if(!theAblaInterface)                    << 
262         theAblaInterface = new G4AblaInterface << 
263       // Couple INCL++ to ABLA                 << 
264       G4cout << "Coupling INCLXX to ABLA" << G << 
265       theINCLInterface->SetDeExcitation(theAbl << 
266     }                                          << 
267   }                                            << 
268 }                                              << 
269                                                   202