G4INCLXXInterfaceStore.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // INCL++ intra-nuclear cascade model
00027 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
00028 // Davide Mancusi, CEA
00029 // Alain Boudard, CEA
00030 // Sylvie Leray, CEA
00031 // Joseph Cugnon, University of Liege
00032 //
00033 #define INCLXX_IN_GEANT4_MODE 1
00034 
00035 #include "globals.hh"
00036 
00044 #ifndef G4INCLXXINTERFACESTORE_HH_
00045 #define G4INCLXXINTERFACESTORE_HH_
00046 
00047 #include "G4INCLXXInterface.hh"
00048 #include "G4INCLCascade.hh"
00049 #include "G4INCLConfig.hh"
00050 #include <list>
00051 #include <sstream>
00052 
00053 class G4INCLXXInterfaceMessenger;
00054 
00061 class G4INCLXXInterfaceStore {
00062   public:
00063 
00065     static G4INCLXXInterfaceStore *GetInstance() {
00066       if(!theInstance)
00067         theInstance = new G4INCLXXInterfaceStore;
00068       return theInstance;
00069     }
00070 
00072     static void DeleteInstance() {
00073       delete theInstance;
00074       theInstance = NULL;
00075     }
00076 
00078     G4INCL::INCL *GetINCLModel() {
00079       if(!theINCLModel) {
00080         G4INCL::Config *theConfig = new G4INCL::Config;
00081         theConfig->setClusterMaxMass(theMaxClusterMass);
00082         theINCLModel = new G4INCL::INCL(theConfig);
00083         // ownership of the Config object is taken over by the INCL model engine
00084       }
00085       return theINCLModel;
00086     }
00087 
00088 
00089 
00090 
00092     void SetAccurateProjectile(const G4bool b) {
00093       if(accurateProjectile!=b) {
00094         // Parameter is changed, emit a big warning message
00095         std::stringstream ss;
00096         ss << "Switching from "
00097           << (accurateProjectile ? "\"accurate projectile\" mode to \"accurate target\"" : "\"accurate target\" mode to \"accurate projectile\"")
00098           << " mode."
00099           << G4endl
00100           << "Do this ONLY if you fully understand what it does!";
00101         EmitBigWarning(ss.str());
00102       }
00103 
00104       // No need to delete the model for this parameter
00105 
00106       accurateProjectile=b;
00107     }
00108 
00110     void SetMaxClusterMass(const G4int aMass) {
00111       if(theMaxClusterMass!=aMass) {
00112         // Parameter is changed, emit a big warning message
00113         std::stringstream ss;
00114         ss << "Changing maximum cluster mass from "
00115           << theMaxClusterMass
00116           << " to "
00117           << aMass
00118           << "."
00119           << G4endl
00120           << "Do this ONLY if you fully understand what this setting does!";
00121         EmitBigWarning(ss.str());
00122       }
00123 
00124       // We must delete the model object to make sure that we use the new
00125       // parameter
00126       DeleteModel();
00127 
00128       theMaxClusterMass=aMass;
00129     }
00130 
00131 
00132 
00133 
00139     G4bool GetAccurateProjectile() const { return accurateProjectile; }
00140 
00146     G4int GetMaxClusterMass() const { return theMaxClusterMass; }
00147 
00148 
00149 
00150 
00152     G4int GetMaxProjMassINCL() const { return theMaxProjMassINCL; }
00153 
00155     G4bool GetDumpInput() const { return dumpInput; }
00156 
00157 
00158 
00159 
00160 
00165     void EmitWarning(const G4String &message);
00166 
00171     void EmitBigWarning(const G4String &message) const;
00172 
00173   private:
00174 
00180     G4INCLXXInterfaceStore();
00181 
00187     ~G4INCLXXInterfaceStore();
00188 
00190     void DeleteModel() { delete theINCLModel; theINCLModel=NULL; }
00191 
00193 
00194     static G4INCLXXInterfaceStore *theInstance;
00195 
00196     G4bool dumpInput;
00197     G4bool accurateProjectile;
00198     const G4int theMaxClusterMassDefault;
00199     G4int theMaxClusterMass;
00200     const G4int theMaxProjMassINCL;
00201 
00202     G4INCLXXInterfaceMessenger *theINCLXXInterfaceMessenger;
00203 
00204     G4INCL::INCL *theINCLModel;
00205 
00207     G4int nWarnings;
00208 
00210     const G4int maxWarnings;
00211 };
00212 
00213 #endif // G4INCLXXINTERFACESTORE_HH_

Generated on Mon May 27 17:48:37 2013 for Geant4 by  doxygen 1.4.7