Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Run.hh,v 2.1 1998/07/12 03:08:30 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4Run_h
#define G4Run_h 1
#include "globals.hh"
#include "G4Allocator.hh"
class G4Event;
class G4HCtable;
class G4DCtable;
class G4Run
{
public:
G4Run();
virtual ~G4Run();
inline void *operator new(size_t);
inline void operator delete(void* aRun);
protected:
G4int runID;
G4int numberOfEvent;
G4HCtable* HCtable;
G4DCtable* DCtable;
public:
inline void SetRunID(G4int id)
{ runID = id; }
inline G4int GetRunID() const
{ return runID; }
inline G4int GetNumberOfEvent() const
{ return numberOfEvent; }
inline virtual void RecordEvent(G4Event*)
{ numberOfEvent++; }
inline void SetHCtable(G4HCtable* HCtbl)
{ HCtable = HCtbl; }
inline const G4HCtable* GetHCtable() const
{ return HCtable; }
inline void SetDCtable(G4DCtable* DCtbl)
{ DCtable = DCtbl; }
inline const G4DCtable* GetDCtable() const
{ return DCtable; }
};
extern G4Allocator<G4Run> aRunAllocator;
inline void* G4Run::operator new(size_t)
{
void* aRun;
aRun = (void*)aRunAllocator.MallocSingle();
return aRun;
}
inline void G4Run::operator delete(void* aRun)
{
aRunAllocator.FreeSingle((G4Run*)aRun);
}
#endif
+192
View File
@@ -0,0 +1,192 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RunManager.hh,v 2.3 1998/10/01 17:01:38 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This is a class for run controle in GEANT4
//
// User must provide his own classes derived from the following
// three abstract classes and register them to the RunManager.
// G4VUserDetectorConstruction - Detector Geometry, Materials
// G4VUserPhysicsList - Particle types and Processes
// G4VUserPrimaryGeneratorAction - Event Generator selection
//
// In addition to the above mandatory classes, user can easily
// customize of the default functionality of GEANT4 simulation
// by making his own classes derived from the following 5 user
// action classes.
// G4UserRunAction - Actions for each Run
// G4UserEventAction - Actions for each Event
// G4UserStackingAction - Tracks Stacking selection
// G4UserTrackingAction - Actions for each Track
// G4UserSteppingAction - Actions for each Step
//
// History
// first version by Makoto Asai
// modified 11 Mar. 1998 by H.Kurashige
// ------------------------------------------------------------
#ifndef G4RunManager_h
#define G4RunManager_h 1
// userAction classes
class G4VUserDetectorConstruction;
class G4VUserPhysicsList;
class G4UserRunAction;
class G4VUserPrimaryGeneratorAction;
class G4UserEventAction;
class G4UserStackingAction;
class G4UserTrackingAction;
class G4UserSteppingAction;
class G4VPhysicalVolume;
class G4Timer;
class G4RunMessenger;
class G4DCtable;
class G4Run;
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "globals.hh"
#include <rw/tpordvec.h>
class G4RunManager
{
public:
static G4RunManager* GetRunManager();
private:
static G4RunManager* fRunManager;
public:
G4RunManager();
virtual ~G4RunManager();
public:
virtual void BeamOn(G4int n_event,const char* macroFile=NULL,G4int n_select=-1);
virtual void Initialize();
virtual void DefineWorldVolume(G4VPhysicalVolume * worldVol);
virtual void AbortRun();
protected:
// methods invoked from Initialize()
virtual void InitializeGeometry();
virtual void InitializePhysics();
virtual void InitializeCutOff();
// methods invoked from BeamOn()
virtual G4bool ConfirmBeamOnCondition();
virtual void RunInitialization();
virtual void DoEventLoop(G4int n_event,const char* macroFile=NULL,G4int n_select=-1);
virtual void RunTermination();
// methods invoked from DoEventLoop()
virtual G4Event* GenerateEvent(G4int i_event);
virtual void AnalyzeEvent(G4Event* anEvent);
protected:
void StackPreviousEvent(G4Event* anEvent);
protected:
G4EventManager * eventManager;
G4VUserDetectorConstruction * userDetector;
G4VUserPhysicsList * physicsList;
G4UserRunAction * userRunAction;
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction;
private:
G4RunMessenger* runMessenger;
protected:
G4bool geometryInitialized;
G4bool physicsInitialized;
G4bool cutoffInitialized;
G4bool geometryNeedsToBeClosed;
G4bool runAborted;
G4bool initializedAtLeastOnce;
G4bool geometryToBeOptimized;
G4bool pauseAtBeginOfEvent;
G4bool pauseAtEndOfEvent;
G4int verboseLevel;
G4Timer * timer;
G4DCtable* DCtable;
G4Run* currentRun;
G4Event* currentEvent;
RWTPtrOrderedVector<G4Event>* previousEvents;
G4int n_perviousEventsToBeStored;
public:
inline void SetUserInitialization(G4VUserDetectorConstruction* userInit)
{ userDetector = userInit; }
inline void SetUserInitialization(G4VUserPhysicsList* userInit)
{ physicsList = userInit; }
inline void SetUserAction(G4UserRunAction* userAction)
{ userRunAction = userAction; }
inline void SetUserAction(G4VUserPrimaryGeneratorAction* userAction)
{ userPrimaryGeneratorAction = userAction; }
inline void SetUserAction(G4UserEventAction* userAction)
{ eventManager->SetUserAction(userAction); }
inline void SetUserAction(G4UserStackingAction* userAction)
{ eventManager->SetUserAction(userAction); }
inline void SetUserAction(G4UserTrackingAction* userAction)
{ eventManager->SetUserAction(userAction); }
inline void SetUserAction(G4UserSteppingAction* userAction)
{ eventManager->SetUserAction(userAction); }
inline void GeometryHasBeenModified()
{ geometryNeedsToBeClosed = true; }
inline void CutOffHasBeenModified()
{ cutoffInitialized = false; }
inline void SetPauseAtBeginOfEvent(G4bool vl)
{ pauseAtBeginOfEvent = vl; }
inline void SetPauseAtEndOfEvent(G4bool vl)
{ pauseAtEndOfEvent = vl; }
inline void SetVerboseLevel(G4int vl)
{ verboseLevel = vl; }
inline G4int GetVerboseLevel() const
{ return verboseLevel; }
inline void SetGeometryToBeOptimized(G4bool vl)
{
if(geometryToBeOptimized != vl)
{
geometryToBeOptimized = vl;
geometryNeedsToBeClosed = true;
}
}
inline G4bool GetGeometryToBeOptimized()
{ return geometryToBeOptimized; }
inline void SetNumberOfEventsToBeStored(G4int val)
{ n_perviousEventsToBeStored = val; }
inline const G4Run* GetCurrentRun() const
{ return currentRun; }
inline const G4Event* GetCurrentEvent() const
{ return currentEvent; }
inline const G4Event* GetPreviousEvent(G4int i) const
{
if(i>=1 && i<=n_perviousEventsToBeStored)
{ return (*previousEvents)[i-1]; }
return NULL;
}
inline void SetDCtable(G4DCtable* DCtbl)
{ DCtable = DCtbl; }
};
#endif
+76
View File
@@ -0,0 +1,76 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RunMessenger.hh,v 2.4 1998/10/01 17:01:38 asaim Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// GEANT 4 class header file
//
// This is a messenger class for G4RunManager.
// Implemented commands are following;
//
// Commands :
// BeamOn * Start a Run.
// Verbose * Set the Verbose level of G4RunManager.
// optimizeGeometry * Set the optimization flag of closing geometry.
// breakAtBeginOfEvent * Set a break point at the begining of every event.
// breakAtEndOfEvent * Set a break point at the end of every event.
// abort * Abort current run processing.
// Initialize * Initialize G4 kernel.
// geometryModified * Force geometry to be closed again.
// cutoffModified * Force closssection tables to be calculated again.
// (and rebuilding physics table will be invoked)
//
// History
// first version by Makoto Asai
// ------------------------------------------------------------
#ifndef G4RunMessenger_h
#define G4RunMessenger_h 1
class G4RunManager;
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
class G4UIcommand;
#include "G4UImessenger.hh"
#include "globals.hh"
class G4RunMessenger: public G4UImessenger
{
public:
G4RunMessenger(G4RunManager* runMgr);
~G4RunMessenger();
public:
void SetNewValue(G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
private:
G4RunManager * runManager;
G4String macroFileName; // internal use only!!!
private: //commands
G4UIdirectory * runDirectory;
G4UIcommand * beamOnCmd;
G4UIcmdWithAnInteger * verboseCmd;
G4UIcmdWithABool * optCmd;
G4UIcmdWithABool * brkBoECmd;
G4UIcmdWithABool * brkEoECmd;
G4UIcmdWithoutParameter * abortCmd;
G4UIcmdWithoutParameter * initCmd;
G4UIcmdWithoutParameter * geomCmd;
G4UIcmdWithoutParameter * cutCmd;
};
#endif
@@ -0,0 +1,74 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserPhysicsListMessenger.hh,v 2.3 1998/07/12 16:03:36 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
//---------------------------------------------------------------
//
// G4UserPhysicsListMessenger.hh
//
// Description:
// This is a messenger class to interface to exchange information
// between ParticleUserList and UI.
//
// ------------------------------------------------------
// the List of Directory and Commands
// ------------------------------------------------------
// /run/particle/ Paricle control commands.
// Commands :
// SetCuts * Set default cut value
// DumpList * Dump List of particles in G4VUserPhysicsList.
// dumpCutValue * Dump cut value information
// Verbose * Set the Verbose level of G4VUserPhysicsList.
// ------------------------------------------------------------
// History
// first version 09 Jan. 1998 by H.Kurashige
// second version 24 Jan. 1998 by H.Kurashige
// ------------------------------------------------------------
#ifndef G4UserPhysicsListMessenger_h
#define G4UserPhysicsListMessenger_h 1
class G4VUserPhysicsList;
class G4VUserPhysicsList;
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
#include "G4UImessenger.hh"
#include "globals.hh"
class G4UserPhysicsListMessenger: public G4UImessenger
{
public:
G4UserPhysicsListMessenger(G4VUserPhysicsList* pParticleList);
virtual ~G4UserPhysicsListMessenger();
public:
void SetNewValue(G4UIcommand * command,G4String newValues);
G4String GetCurrentValue(G4UIcommand * command);
protected:
G4VUserPhysicsList* theParticleList;
private: //commands
G4UIdirectory * theDirectory;
G4UIcmdWithADoubleAndUnit * setCutCmd;
G4UIcmdWithAnInteger * verboseCmd;
G4UIcmdWithoutParameter * dumpListCmd;
G4UIcmdWithAString * dumpCutValuesCmd;
G4UIcmdWithAString * addProcManCmd;
};
#endif
+30
View File
@@ -0,0 +1,30 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserRunAction.hh,v 2.1 1998/07/12 03:08:32 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4UserRunAction_h
#define G4UserRunAction_h 1
class G4Run;
class G4UserRunAction
{
public:
G4UserRunAction();
virtual ~G4UserRunAction();
public:
virtual void BeginOfRunAction(G4Run* aRun);
virtual void EndOfRunAction(G4Run* aRun);
};
#endif
@@ -0,0 +1,50 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VPersistencyManager.hh,v 2.1 1998/07/12 03:08:33 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VPersistencyManager_h
#define G4VPersistencyManager_h 1
#include "globals.hh"
class G4Event;
class G4Run;
class G4VPhysicalVolume;
class G4VPersistencyManager
{
public:
static G4VPersistencyManager* GetPersistencyManager();
protected:
G4VPersistencyManager();
public:
virtual ~G4VPersistencyManager();
private:
static G4VPersistencyManager * fPersistencyManager;
public:
virtual G4bool Store(const G4Event* anEvent)=0;
virtual G4bool Store(const G4Run* aRun)=0;
virtual G4bool Store(const G4VPhysicalVolume* theWorld)=0;
virtual G4bool Retrieve(G4Event*& anEvent)=0;
virtual G4bool Retrieve(G4Run*& aRun)=0;
virtual G4bool Retrieve(G4VPhysicalVolume*& theWorld)=0;
};
#endif
@@ -0,0 +1,28 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUserDetectorConstruction.hh,v 2.1 1998/07/12 03:08:33 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VUserDetectorConstruction_h
#define G4VUserDetectorConstruction_h 1
class G4VPhysicalVolume;
class G4VUserDetectorConstruction
{
public:
G4VUserDetectorConstruction();
virtual ~G4VUserDetectorConstruction();
public:
virtual G4VPhysicalVolume* Construct() = 0;
};
#endif
+227
View File
@@ -0,0 +1,227 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUserPhysicsList.hh,v 2.3 1998/12/05 09:45:15 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This class is an abstruct class for
// constructing particles and processes.
// User must implement following four virtual methods
// in his own concrete class derived from this class.
// G4VUserPhysicsList::ConstructParticle()
// Construct particles
// G4VUserPhysicsList::constructPhysics()
// Construct procesess and register them to particles
// G4VUserPhysicsList::SetCuts(G4double aValue)
// set a cut value in range to all particles
// (and rebuilding physics table will be invoked)
//
// History
// first version 09 Jan. 1998 by H.Kurashige
// modified 24 Jan. 1998 by H.Kurashige
// rename DumpCutValues/DumpCutValuesTable
// change SetCuts method
// add SetCutsWithDefault method
// modified 06 June 1998 by H.Kurashige
// add AddProcessManager
// add BuildPhysicsTable
// modified 29 June 1998 by H.Kurashige
// add AddProcessManager
// modified 05 Dec. 1998 by H.Kurashige
// add ConstructAllParticles()
// ------------------------------------------------------------
#ifndef G4VUserPhysicsList_h
#define G4VUserPhysicsList_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
class G4UserPhysicsListMessenger;
class G4VUserPhysicsList
{
public:
G4VUserPhysicsList();
virtual ~G4VUserPhysicsList();
public:
// By calling the "Construct" method,
// particles and processes are created
void Construct();
protected:
// These two methods of ConstructParticle() and ConstructProcess()
// will be invoked in the Construct() method.
// each particle type will be instantiated
virtual void ConstructParticle() = 0;
// each physics process will be instantiated and
// registered to the process manager of each particle type
virtual void ConstructProcess() = 0;
protected:
// User must invoke this method in his ConstructProcess()
// implementation in order to insures particle transportation.
// !! Caution: this class must not be overriden !!
void AddTransportation();
// Construct All particles
virtual void ConstructAllParticles();
// these methods Construct all particles in each category
virtual void ConstructAllBosons();
virtual void ConstructAllLeptons();
virtual void ConstructAllMesons();
virtual void ConstructAllBarions();
virtual void ConstructAllIons();
virtual void ConstructAllShortLiveds();
public:
// "SetCuts" method sets a cut value for all particle types
// in the particle table
virtual void SetCuts(G4double aCut) = 0;
// "SetCutsWithDefault" method sets a cut value with the default
// cut values for all particle types in the particle table
void SetCutsWithDefault();
protected:
//
void BuildPhysicsTable(G4ParticleDefinition* );
protected:
// Following are utility methods for SetCuts/reCalcCuts
// Reset cut values in energy for all particle types
// By calling this methods, the run manager will invoke
// SetCuts() just before event loop
void ResetCuts();
// SetCutValue sets a cut value for a particle type
void SetCutValue(G4double aCut, const G4String& name);
void ReCalcCutValue(const G4String& name);
// "setCutsForOthers" method sets a cut value to all particle types
// which have not be called SetCuts() methods yet.
// (i.e. particles which have no definit cut values)
void SetCutValueForOthers(G4double cutValue);
// "setCutsForOtherThan" sets a cut value to all particle types
// other than particle types specified in arguments
void SetCutValueForOtherThan(G4double cutValue,
G4ParticleDefinition* first,
G4ParticleDefinition* second = NULL,
G4ParticleDefinition* third = NULL,
G4ParticleDefinition* fourth = NULL,
G4ParticleDefinition* fifth = NULL,
G4ParticleDefinition* sixth = NULL,
G4ParticleDefinition* seventh = NULL,
G4ParticleDefinition* eighth = NULL,
G4ParticleDefinition* nineth = NULL,
G4ParticleDefinition* tenth = NULL );
// "reCalcCutsForOthers" method re-calculates a cut value
// to all particle types which have not be called SetCuts() methods yet.
void ReCalcCutValueForOthers();
public:
// set/get the default cut value
// Calling SetDefaultCutValue causes re-calcuration of cut values
// and physics tables just before the next event loop
void SetDefaultCutValue(G4double newCutValue);
G4double GetDefaultCutValue() const;
protected:
// this is the default cut value for all particles
G4double defaultCutValue;
public:
// Print out the List of registered particles types
void DumpList() const;
public:
// Print out information of cut values
void DumpCutValuesTable() const;
void DumpCutValues(const G4String &particle_name = "ALL") const;
void DumpCutValues(G4ParticleDefinition* ) const;
protected:
// adds new ProcessManager to all particles in the Particle Table
// this routine is used in Construct()
void InitializeProcessManager();
public:
// add process manager for particles created on-the-fly
void AddProcessManager(G4ParticleDefinition* newParticle,
G4ProcessManager* newManager = NULL );
protected:
// the particle table has the complete List of existing particle types
G4ParticleTable* theParticleTable;
G4ParticleTable::G4PTblDicIterator* theParticleIterator;
protected:
// pointer to G4UserPhysicsListMessenger
G4UserPhysicsListMessenger* theMessenger;
public:
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
protected:
G4int verboseLevel;
// controle flag for output message
// 0: Silent
// 1: Warning message
// 2: More
};
inline void G4VUserPhysicsList::SetCutsWithDefault()
{
SetCuts(defaultCutValue);
}
inline void G4VUserPhysicsList::Construct()
{
if (verboseLevel >1) G4cout << "G4VUserPhysicsList::Construct()" << endl;
if (verboseLevel >1) G4cout << "Construct particles " << endl;
ConstructParticle();
InitializeProcessManager();
if (verboseLevel >1) G4cout << "Construct processes " << endl;
ConstructProcess();
}
inline G4double G4VUserPhysicsList::GetDefaultCutValue() const
{
return defaultCutValue;
}
inline void G4VUserPhysicsList::SetVerboseLevel(G4int value)
{
verboseLevel = value;
if (verboseLevel >1){
G4cerr << "G4VUserPhysicsList::SetVerboseLevel :";
G4cerr << " Verbose level is set to " << verboseLevel << endl;
}
}
inline G4int G4VUserPhysicsList::GetVerboseLevel() const
{
return verboseLevel;
}
#endif
@@ -0,0 +1,29 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUserPrimaryGeneratorAction.hh,v 2.1 1998/07/12 03:08:35 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
#ifndef G4VUserPrimaryGeneratorAction_h
#define G4VUserPrimaryGeneratorAction_h 1
class G4Event;
class G4VUserPrimaryGeneratorAction
{
public:
G4VUserPrimaryGeneratorAction();
virtual ~G4VUserPrimaryGeneratorAction();
public:
virtual void GeneratePrimaries(G4Event* anEvent) = 0;
};
#endif