Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -30,7 +30,7 @@
// Sylvie Leray, CEA
// Joseph Cugnon, University of Liege
//
// INCL++ revision: v5.0_rc3
// INCL++ revision: v5.1.8
//
#define INCLXX_IN_GEANT4_MODE 1
@@ -48,6 +48,7 @@
#include "G4ParticleChange.hh"
#include "G4ReactionProductVector.hh"
#include "G4ReactionProduct.hh"
#include "globals.hh"
// INCL++
#include "G4INCLCascade.hh"
@@ -55,20 +56,24 @@
// Geant4 de-excitation
#include "G4ExcitationHandler.hh"
// Binary cascade
#include "G4BinaryLightIonReaction.hh"
#include <fstream>
#include <iostream>
using namespace std;
/**
* <h1>INCL G4intra-nuclear cascade with G4ExcitationHandler for de-excitation</h1>
class G4INCLXXInterfaceStore;
/** \brief INCL++ intra-nuclear cascade with G4ExcitationHandler for de-excitation
*
* Interface for INCL. This G4interface handles basic hadron
* bullet particles (protons, neutrons, pions).
* Interface for INCL++. This interface handles basic hadron bullet particles
* (protons, neutrons, pions), as well as light ions.
*
* Example usage in case of protons:
* @code
* G4InclCascadeInterface* inclModel = new G4InclCascadeInterface;
* G4INCLXXInterface* inclModel = new G4INCLXXInterface;
* inclModel -> SetMinEnergy(0.0 * MeV); // Set the energy limits
* inclModel -> SetMaxEnergy(3.0 * GeV);
*
@@ -82,15 +87,14 @@ using namespace std;
* processManager = particle -> GetProcessManager();
* processManager -> AddDiscreteProcess(protonInelasticProcess);
* @endcode
* The same setup procedure is needed for neutron and pion inelastic processes
* as well.
*
* @see G4InclLightIonInterface
* The same setup procedure is needed for neutron, pion and generic-ion
* inelastic processes as well.
*/
class G4INCLXXInterface : public G4VIntraNuclearTransportModel {
public:
G4INCLXXInterface(const G4String& name = "INCL++ Cascade with G4ExcitationHandler");
G4INCLXXInterface(const G4String& name = "INCL++ cascade with G4ExcitationHandler");
~G4INCLXXInterface(); // Destructor
G4int operator==(G4INCLXXInterface& right) {
return (this == &right);
}
@@ -99,8 +103,6 @@ public:
return (this != &right);
}
~G4INCLXXInterface(); // Destructor
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus); // Idle
/**
@@ -111,14 +113,51 @@ public:
*/
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& theNucleus);
void DeleteModel() {
delete theINCLModel;
theINCLModel = NULL;
}
private:
G4bool AccurateProjectile(const G4HadProjectile &aTrack, const G4Nucleus &theTargetNucleus) const;
/// \brief Dummy copy constructor to shut up Coverity warnings
G4INCLXXInterface(const G4INCLXXInterface &rhs);
/// \brief Dummy assignment operator to shut up Coverity warnings
G4INCLXXInterface &operator=(G4INCLXXInterface const &rhs);
/// \brief Convert G4ParticleDefinition to corresponding INCL particle type
G4INCL::ParticleType toINCLParticleType(G4ParticleDefinition const * const) const;
/// \brief Convert G4HadProjectile to corresponding INCL particle species
G4INCL::ParticleSpecies toINCLParticleSpecies(G4HadProjectile const &) const;
/// \brief Convert G4HadProjectile to corresponding INCL particle kinetic energy
G4double toINCLKineticEnergy(G4HadProjectile const &) const;
/// \brief Convert an INCL particle to a G4DynamicParticle
G4DynamicParticle *toG4Particle(G4int A, G4int Z , G4double kinE, G4double px, G4double py, G4double pz) const;
/// \brief Convert A and Z to a G4ParticleDefinition
G4ParticleDefinition *toG4ParticleDefinition (G4int A, G4int Z) const;
/// \brief Rescale remnant momentum if necessary
G4double remnant4MomentumScaling(G4double mass,
G4double kineticE,
G4double px, G4double py, G4double pz) const;
G4INCL::INCL *theINCLModel;
G4HadFinalState theResult;
G4ExcitationHandler *theExcitationHandler;
G4bool storeDebugOutput;
std::ofstream *debugOutputFile;
G4bool dumpInput;
G4HadronicInteraction *theBackupModel;
G4INCLXXInterfaceStore * const theInterfaceStore;
G4bool complainedAboutBackupModel;
};
#endif
@@ -30,65 +30,49 @@
// Sylvie Leray, CEA
// Joseph Cugnon, University of Liege
//
// INCL++ revision: v5.0_rc3
// INCL++ revision: v5.1.8
//
#define INCLXX_IN_GEANT4_MODE 1
#include "globals.hh"
#ifndef G4INCLXXFactory_hh
#define G4INCLXXFactory_hh 1
#include "G4Nucleus.hh"
#include "G4HadProjectile.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4Alpha.hh"
#include "G4ParticleTable.hh"
#include "G4INCLConfig.hh"
#include "G4INCLCascade.hh"
/**
* Build a new INCL++ instance with correct configuration and input information.
/** \file G4INCLXXInterfaceMessenger.hh
* \brief Messenger class for the Geant4 INCL++ interface.
*
* \date 26th April 2012
* \author Davide Mancusi
*/
class G4INCLXXFactory {
public:
/**
* Convert G4ParticleDefinition to corresponding INCL particle type
*/
static G4INCL::ParticleType toINCLParticleType(const G4ParticleDefinition*);
/**
* Convert INCL particle type to corresponding G4ParticleDefinition
*/
static const G4ParticleDefinition* fromINCLParticleType(G4INCL::ParticleType);
#ifndef G4INCLXXInterfaceMessenger_hh
#define G4INCLXXInterfaceMessenger_hh
/**
* Create INCL projectile particle
*/
static G4INCL::Particle* createProjectile(const G4HadProjectile &);
#include "G4INCLXXInterfaceStore.hh"
#include "G4UImessenger.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4String.hh"
/**
* Create the INCL model initialized with the target information
*/
static G4INCL::INCL* createModel(const G4Nucleus &);
class G4INCLXXInterfaceStore;
static G4DynamicParticle* toG4Particle(G4int A, G4int Z , G4double kinE, G4double px, G4double py, G4double pz);
static G4ParticleDefinition* toG4ParticleDefinition (G4int A,
G4int Z);
static G4double remnant4MomentumScaling(G4double mass,
G4double kineticE,
G4double px, G4double py, G4double pz);
protected:
G4INCLXXFactory() {};
~G4INCLXXFactory() {};
class G4INCLXXInterfaceMessenger : public G4UImessenger
{
public:
G4INCLXXInterfaceMessenger (G4INCLXXInterfaceStore *anInterfaceStore);
~G4INCLXXInterfaceMessenger ();
void SetNewValue (G4UIcommand *command, G4String newValues);
// Identifies the command which has been invoked by the user, extracts the
// parameters associated with that command (held in newValues, and uses
// these values with the appropriate member function of G4INCLXXInterfaceStore.
//
private:
static const G4String theUIDirectory;
G4INCLXXInterfaceStore *theINCLXXInterfaceStore;
G4UIdirectory *theINCLXXDirectory;
G4UIcmdWithAString *accurateNucleusCmd;
G4UIcmdWithAnInteger *maxClusterMassCmd;
};
#endif
@@ -0,0 +1,215 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// INCL++ intra-nuclear cascade model
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
// Davide Mancusi, CEA
// Alain Boudard, CEA
// Sylvie Leray, CEA
// Joseph Cugnon, University of Liege
//
// INCL++ revision: v5.1.8
//
#define INCLXX_IN_GEANT4_MODE 1
#include "globals.hh"
/** \file G4INCLXXInterfaceStore.hh
* \brief Header file for the G4INCLXXInterfaceStore class
*
* \date 24 May 2012
* \author Davide Mancusi
*/
#ifndef G4INCLXXINTERFACESTORE_HH_
#define G4INCLXXINTERFACESTORE_HH_
#include "G4INCLXXInterface.hh"
#include "G4INCLCascade.hh"
#include "G4INCLConfig.hh"
#include <list>
#include <sstream>
class G4INCLXXInterfaceMessenger;
/** \class G4INCLXXInterfaceStore
* \brief Singleton class for configuring the INCL++ Geant4 interface.
*
* This class also contains a single cached instance of the INCL model
* (\see{G4INCL::INCL}).
*/
class G4INCLXXInterfaceStore {
public:
/// \brief Get the singleton instance
static G4INCLXXInterfaceStore *GetInstance() {
if(!theInstance)
theInstance = new G4INCLXXInterfaceStore;
return theInstance;
}
/// \brief Delete the singleton instance
static void DeleteInstance() {
delete theInstance;
theInstance = NULL;
}
/// \brief Get the cached INCL model engine
G4INCL::INCL *GetINCLModel() {
if(!theINCLModel) {
G4INCL::Config *theConfig = new G4INCL::Config;
theConfig->setClusterMaxMass(theMaxClusterMass);
theINCLModel = new G4INCL::INCL(theConfig);
// ownership of the Config object is taken over by the INCL model engine
}
return theINCLModel;
}
/// \brief Setter for accurateProjectile
void SetAccurateProjectile(const G4bool b) {
if(accurateProjectile!=b) {
// Parameter is changed, emit a big warning message
std::stringstream ss;
ss << "Switching from "
<< (accurateProjectile ? "\"accurate projectile\" mode to \"accurate target\"" : "\"accurate target\" mode to \"accurate projectile\"")
<< " mode."
<< G4endl
<< "Do this ONLY if you fully understand what it does!";
EmitBigWarning(ss.str());
}
// No need to delete the model for this parameter
accurateProjectile=b;
}
/// \brief Setter for theMaxClusterMass
void SetMaxClusterMass(const G4int aMass) {
if(theMaxClusterMass!=aMass) {
// Parameter is changed, emit a big warning message
std::stringstream ss;
ss << "Changing maximum cluster mass from "
<< theMaxClusterMass
<< " to "
<< aMass
<< "."
<< G4endl
<< "Do this ONLY if you fully understand what this setting does!";
EmitBigWarning(ss.str());
}
// We must delete the model object to make sure that we use the new
// parameter
DeleteModel();
theMaxClusterMass=aMass;
}
/** \brief Getter for accurateProjectile
*
* The \see{G4INCLXXInterfaceMessenger} class provides a UI command to set
* this parameter.
*/
G4bool GetAccurateProjectile() const { return accurateProjectile; }
/** \brief Getter for ClusterMaxMass
*
* The \see{G4INCLXXInterfaceMessenger} class provides a UI command to set
* this parameter.
*/
G4int GetMaxClusterMass() const { return theMaxClusterMass; }
/// \brief Getter for theMaxProjMassINCL
G4int GetMaxProjMassINCL() const { return theMaxProjMassINCL; }
/// \brief Getter for dumpInput
G4bool GetDumpInput() const { return dumpInput; }
/** \brief Emit a warning to G4cout
*
* The InterfaceStore will not emit more than maxWarnings warnings.
*/
void EmitWarning(const G4String &message);
/** \brief Emit a BIG warning to G4cout
*
* There is no limit on the number of BIG warnings emitted.
*/
void EmitBigWarning(const G4String &message) const;
private:
/** \brief Private constructor
*
* This class is a singleton. It must be instantiated using the GetInstance
* static method.
*/
G4INCLXXInterfaceStore();
/** \brief Private destructor
*
* This class is a singleton. Its instance must be deleted using the
* DeleteInstance static method.
*/
~G4INCLXXInterfaceStore();
/// \brief Delete the INCL model engine
void DeleteModel() { delete theINCLModel; theINCLModel=NULL; }
/// \brief Create a new Config object from the current options
static G4INCLXXInterfaceStore *theInstance;
G4bool dumpInput;
G4bool accurateProjectile;
const G4int theMaxClusterMassDefault;
G4int theMaxClusterMass;
const G4int theMaxProjMassINCL;
G4INCLXXInterfaceMessenger *theINCLXXInterfaceMessenger;
G4INCL::INCL *theINCLModel;
/// \brief Static warning counter
G4int nWarnings;
/// \brief Maximum number of warnings
const G4int maxWarnings;
};
#endif // G4INCLXXINTERFACESTORE_HH_