Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
+3 -13
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 1999/10/07 15:48:30 johna Exp $
# $Id: GNUmakefile,v 1.3 2000/10/24 14:00:56 gcosmo Exp $
# ----------------------------------------------------------
# GNUmakefile for run library. Gabriele Cosmo, 3/4/1997.
# ----------------------------------------------------------
@@ -11,25 +11,15 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
CPPFLAGS += \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/shortlived/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/general/include \
-I$(G4BASE)/processes/electromagnetic/standard/include \
-I$(G4BASE)/processes/electromagnetic/muons/include \
-I$(G4BASE)/processes/electromagnetic/utils/include \
-I$(G4BASE)/processes/electromagnetic/xrays/include \
-I$(G4BASE)/processes/hadronic/include \
-I$(G4BASE)/processes/transportation/include \
-I$(G4BASE)/processes/decay/include \
-I$(G4BASE)/geometry/management/include \
+27 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.15 1999/12/02 16:26:05 asaim Exp $
$Id: History,v 1.27 2000/12/14 10:39:44 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,32 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Dec 14 2000, G.Cosmo (run-V02-00-06)
- Updated date to G4RunManager.cc for public release 3.0.
Nov 19 2000, M.Asai (run-V02-00-05)
- Another fix to G4VUserPhysicsList (H.K)
Nov 16 2000, M.Asai (run-V02-00-04)
- Fixes a bug in G4VUserPhysicsList (H.K)
Nov 16 2000, M.Asai (run-V02-00-03)
- Add G4VModularPhysicsList and G4VPhysicsConstructor
to modularize UserPhysicsList (H.K)
Nov 13 2000, M.Asai (run-V02-00-02)
- Introducing a capability of storing random number status file to other directory
Nov 9 2000, M.Asai (run-V02-00-01)
- add Retrieve/StorePhysicsTable and related methods
in G4VUserPhysicsList and modify BuildPhysicsTable method (H.K.)
- add store/retreivePhysicsTable command in G4UserPhysicsListMessenger (H.K.)
Jul 22 2000, M.Asai (run-V02-00-00)
- Modify G4RunManager and G4RunMessenger because of elimination of
G4StateManager::Pause() and introducing new G4UImanager as state
dependent class.
Dec 2 99, M.Asai (run-V00-01-04)
- G4RunManager displays the version number when it is constructed.
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Run.hh,v 1.2.4.1 1999/12/07 20:52:58 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4Run.hh,v 1.3 1999/12/15 14:53:52 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#ifndef G4Run_h
+11 -12
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RunManager.hh,v 1.7.2.1 1999/12/07 20:52:58 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4RunManager.hh,v 1.13 2000/11/13 01:24:20 asaim Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
@@ -184,9 +184,6 @@ class G4RunManager
G4bool initializedAtLeastOnce;
G4bool geometryToBeOptimized;
G4bool pauseAtBeginOfEvent;
G4bool pauseAtEndOfEvent;
G4int runIDCounter;
G4int verboseLevel;
G4Timer * timer;
@@ -198,6 +195,7 @@ class G4RunManager
G4int n_perviousEventsToBeStored;
G4int storeRandomNumberStatus;
G4String randomNumberStatusDir;
public:
virtual void StoreRandomNumberStatus(G4int eventID=-1);
@@ -256,6 +254,14 @@ class G4RunManager
{ storeRandomNumberStatus = i; }
inline G4int GetRandomNumberStore() const
{ return storeRandomNumberStatus; }
inline void SetRandomNumberStoreDir(G4String dir)
{
G4String dirStr = dir;
if( dirStr(dirStr.length()-1) != '/' ) dirStr += "/";
randomNumberStatusDir = dirStr;
}
inline G4String GetRandomNumberStoreDir() const
{ return randomNumberStatusDir; }
public: // with description
inline void GeometryHasBeenModified()
@@ -266,13 +272,6 @@ class G4RunManager
// in case the user changes his/her detector geometry or cut off value(s) after
// Initialize() metho has been invoked. Then, at the begining of the next BeamOn(),
// all necessary re-initialization will be done.
inline void SetPauseAtBeginOfEvent(G4bool vl)
{ pauseAtBeginOfEvent = vl; }
inline void SetPauseAtEndOfEvent(G4bool vl)
{ pauseAtEndOfEvent = vl; }
// If the boolean flags are true, Pause() method of G4StateManager is invoked
// at the very begining (before generating a G4Event object) or at the end of
// each event. So that, in case a (G)UI session is defined, the user can interact.
public:
inline void SetVerboseLevel(G4int vl)
+3 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RunMessenger.hh,v 1.4.4.1 1999/12/07 20:52:58 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4RunMessenger.hh,v 1.6 2000/11/13 01:24:20 asaim Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// GEANT 4 class header file
@@ -72,6 +72,7 @@ class G4RunMessenger: public G4UImessenger
G4UIcmdWithoutParameter * cutCmd;
G4UIcmdWithAnInteger * storeRandCmd;
G4UIcmdWithAString * restoreRandCmd;
G4UIcmdWithAString * randDirCmd;
};
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserPhysicsListMessenger.hh,v 1.4.4.1 1999/12/07 20:52:58 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4UserPhysicsListMessenger.hh,v 1.6 2000/11/08 10:01:59 kurasige Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//---------------------------------------------------------------
@@ -22,17 +22,20 @@
// /run/particle/ Paricle control commands.
// Commands :
// SetCuts * Set default cut value
// DumpList * Dump List of particles in G4VUserPhysicsList.
// dumpList * Dump List of particles in G4VUserPhysicsList.
// dumpCutValue * Dump cut value information
// Verbose * Set the Verbose level of G4VUserPhysicsList.
// verbose * Set the Verbose level of G4VUserPhysicsList.
// addProcessManager * add process manager
// buildPhysicsTable * build physics table
//
// storePhysicsTable * store physics table into files
// retreivePhysicsTable * retreive physics table from files
//
// ------------------------------------------------------------
// History
// first version 09 Jan. 1998 by H.Kurashige
// second version 24 Jan. 1998 by H.Kurashige
// add buildPhysicsTable command 13 Apr. 1999 by H.Kurashige
// add store/retreivePhysicsTable 08 Nov. 2000 by H.Kurashige
// ------------------------------------------------------------
#ifndef G4UserPhysicsListMessenger_h
@@ -75,6 +78,8 @@ public: // with description
G4UIcmdWithAString * dumpCutValuesCmd;
G4UIcmdWithAString * addProcManCmd;
G4UIcmdWithAString * buildPTCmd;
G4UIcmdWithAString * storeCmd;
G4UIcmdWithAString * retrieveCmd;
};
#endif
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserRunAction.hh,v 1.3.4.1 1999/12/07 20:52:58 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4UserRunAction.hh,v 1.4 1999/12/15 14:53:52 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#ifndef G4UserRunAction_h
+143
View File
@@ -0,0 +1,143 @@
// This code implementation is the intellectual property of
// the 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: G4VModularPhysicsList.hh,v 1.1 2000/11/14 23:53:13 kurasige Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// Class Description:
// This class is an derived class of G4VUserPhysicsList.
// User should regsiter his/her physics constructors
// by using
// G4VModularPhysicsList::RegsiterPhysics()
// to construt particles and processes.
// In addition User must implement following four virtual methods
// in his own concrete class derived from this class.
// G4VModularPhysicsList::SetCuts()
// set cut values in range to all particles
// (and rebuilding physics table will be invoked )
//
// -------------------------------------------
// History
// first version 12 Nov. 2000 by H.Kurashige
// ------------------------------------------------------------
#ifndef G4VModularPhysicsList_h
#define G4VModularPhysicsList_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "g4std/vector"
#include "G4VUserPhysicsList.hh"
#include "G4VPhysicsConstructor.hh"
class G4VModularPhysicsList: public G4VUserPhysicsList
{
public:
G4VModularPhysicsList();
virtual ~G4VModularPhysicsList();
public: // with description
// "SetCuts" method sets a cut value for all particle types
// in the particle table
virtual void SetCuts() = 0;
protected: // with description
// This method will be invoked in the Construct() method.
// each particle type will be instantiated
virtual void ConstructParticle();
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
virtual void ConstructProcess();
public: // with description
void RegisterPhysics(G4VPhysicsConstructor* );
const G4VPhysicsConstructor* GetPhysics(G4int index) const;
const G4VPhysicsConstructor* GetPhysics(const G4String& name) const;
/////////////////////////////////////
protected: // with description
// vector of pointers to G4VPhysicsConstructor
typedef G4std::vector<G4VPhysicsConstructor*> G4PhysConstVector;
G4PhysConstVector* physicsVector;
};
inline
G4VModularPhysicsList::G4VModularPhysicsList()
: G4VUserPhysicsList()
{
physicsVector = new G4PhysConstVector();
}
inline
G4VModularPhysicsList::~G4VModularPhysicsList()
{
G4PhysConstVector::iterator itr;
for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
delete (*itr);
}
physicsVector->clear();
}
inline
void G4VModularPhysicsList::ConstructParticle()
{
// create particles
G4PhysConstVector::iterator itr;
for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
(*itr)->ConstructParticle();;
}
}
inline
void G4VModularPhysicsList::ConstructProcess()
{
AddTransportation();
G4PhysConstVector::iterator itr;
for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
(*itr)->ConstructProcess();
}
}
inline
void G4VModularPhysicsList::RegisterPhysics(G4VPhysicsConstructor* fPhysics)
{
physicsVector->push_back(fPhysics);
}
inline
const G4VPhysicsConstructor* G4VModularPhysicsList::GetPhysics(G4int idx) const
{
G4int i;
G4PhysConstVector::iterator itr= physicsVector->begin();
for (i=0; i<idx && itr!= physicsVector->end() ; ++i) ++itr;
if (itr!= physicsVector->end()) return (*itr);
else return 0;
}
inline
const G4VPhysicsConstructor* G4VModularPhysicsList::GetPhysics(const G4String& name) const
{
G4PhysConstVector::iterator itr;
for (itr = physicsVector->begin(); itr!= physicsVector->end(); ++itr) {
if ( name == (*itr)->GetPhysicsName()) break;
}
if (itr!= physicsVector->end()) return (*itr);
else return 0;
}
#endif
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VPersistencyManager.hh,v 1.2.4.1 1999/12/07 20:52:58 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VPersistencyManager.hh,v 1.3 1999/12/15 14:53:52 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#ifndef G4VPersistencyManager_h
+113
View File
@@ -0,0 +1,113 @@
// This code implementation is the intellectual property of
// the 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: G4VPhysicsConstructor.hh,v 1.1 2000/11/14 23:53:13 kurasige Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// Class Description:
// This class is an virtual class for constructing
// particles and processes. This class objects will be
// registered to G4VPhysicsList.
//
// User must implement following four virtual methods
// in his own concrete class derived from this class.
//
// all necessary particle type will be instantiated
// virtual void ConstructParticle();
//
// all physics processes will be instantiated and
// registered to the process manager of each particle type
// virtual void ConstructProcess();
//
//
// -------------------------------------------
// History
// first version 12 Nov. 2000 by H.Kurashige
// ------------------------------------------------------------
#ifndef G4VPhysicsConstructor_h
#define G4VPhysicsConstructor_h 1
#include "globals.hh"
#include "G4ios.hh"
#include "G4ParticleTable.hh"
class G4VPhysicsConstructor
{
public:
G4VPhysicsConstructor(const G4String& ="");
virtual ~G4VPhysicsConstructor(){};
public: // with description
// This method will be invoked in the Construct() method.
// each particle type will be instantiated
virtual void ConstructParticle()=0;
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
virtual void ConstructProcess()=0;
public: // with description
void SetPhysicsName(const G4String& ="");
const G4String& GetPhysicsName() const;
void SetVerboseLevel(G4int value);
G4int GetVerboseLevel() const;
// set/get controle flag for output message
// 0: Silent
// 1: Warning message
// 2: More
// verbose level is set equal to physics list when registered
protected:
G4String namePhysics;
G4int verboseLevel;
protected:
// the particle table has the complete List of existing particle types
G4ParticleTable* theParticleTable;
G4ParticleTable::G4PTblDicIterator* theParticleIterator;
};
inline
G4VPhysicsConstructor::G4VPhysicsConstructor(const G4String& name)
:verboseLevel(0),namePhysics(name)
{
// pointer to the particle table
theParticleTable = G4ParticleTable::GetParticleTable();
theParticleIterator = theParticleTable->GetIterator();
}
inline void G4VPhysicsConstructor::SetVerboseLevel(G4int value)
{
verboseLevel = value;
}
inline G4int G4VPhysicsConstructor::GetVerboseLevel() const
{
return verboseLevel;
}
inline void G4VPhysicsConstructor::SetPhysicsName(const G4String& name)
{
namePhysics = name;
}
inline const G4String& G4VPhysicsConstructor::GetPhysicsName() const
{
return namePhysics;
}
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUserDetectorConstruction.hh,v 1.2.4.1 1999/12/07 20:52:59 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VUserDetectorConstruction.hh,v 1.3 1999/12/15 14:53:52 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#ifndef G4VUserDetectorConstruction_h
+104 -4
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUserPhysicsList.hh,v 1.5.6.1 1999/12/08 17:35:17 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VUserPhysicsList.hh,v 1.8 2000/11/14 23:53:13 kurasige Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
@@ -42,6 +42,8 @@
// change BuildPhysicsTable as public
// removed ConstructAllParticles() and related methods
// changed SetCuts method argument
// modified 08, Nov 2000 by H.Kurashige
// added Retrieve/StorePhysicsTable and related methods
// ------------------------------------------------------------
#ifndef G4VUserPhysicsList_h
#define G4VUserPhysicsList_h 1
@@ -52,6 +54,7 @@
#include "G4ParticleDefinition.hh"
class G4UserPhysicsListMessenger;
class G4VProcess;
class G4VUserPhysicsList
{
@@ -83,7 +86,7 @@ class G4VUserPhysicsList
void AddTransportation();
/////////////////////////////////////
public:
public: // with description
// "SetCuts" method sets a cut value for all particle types
// in the particle table
virtual void SetCuts() = 0;
@@ -94,9 +97,53 @@ class G4VUserPhysicsList
void SetCutsWithDefault();
public: // with description
//
// Invoke BuildPhysicsTable for all processes for each particle
// In case of "Retrieve" flag is ON, PhysicsTable will be
// retrieved from files
void BuildPhysicsTable(G4ParticleDefinition* );
// Store PhysicsTable together with both material and cut value
// information in files under the specified directory.
// (return true if files are sucessfully created)
G4bool StorePhysicsTable(const G4String& directory = ".");
// Return true if "Retrieve" flag is ON.
// (i.e. PhysicsTable will be retrieved from files)
G4bool IsPhysicsTableRetrieved() const;
// Get directory path for physics table files.
const G4String& GetPhysicsTableDirectory() const;
// Set "Retrieve" flag
// Directory path can be set together.
// Null string (default) means directory is not changed
// from the current value
void SetPhysicsTableRetrieved(const G4String& directory = "");
// Reset "Retrieve" flag
void ResetPhysicsTableRetrieved();
protected: // with description
// do BuildPhysicsTable for make the integral schema
void BuildIntegralPhysicsTable(G4VProcess* ,G4ParticleDefinition* );
protected: // with description
// Retrieve PhysicsTable from files for proccess belongng the particle.
// Normal BuildPhysics procedure of processes will be invoked,
// if it fails (in case of Process's RetrievePhysicsTable returns false)
virtual void RetrievePhysicsTable(G4ParticleDefinition* );
// Store material information in files under the specified directory.
virtual G4bool StoreMaterialInfo(const G4String& directory);
// Store cut values information in files under the specified directory.
virtual G4bool StoreCutValues(const G4String& directory);
// check stored material and cut values
virtual G4bool CheckForRetrievePhysicsTable(const G4String& directory);
// check stored material is consistent with the current detector setup.
virtual G4bool CheckMaterialInfo(const G4String& directory);
// check stored cuvalue is consistent with the current detector setup.
virtual G4bool CheckCutValues(const G4String& directory);
protected: // with description
// Following are utility methods for SetCuts/reCalcCuts
@@ -189,19 +236,35 @@ class G4VUserPhysicsList
protected:
G4int verboseLevel;
protected:
// flag to determine physics table will be build from file or not
G4bool fRetrievePhysicsTable;
G4bool fIsCheckedForRetrievePhysicsTable;
// directory name for physics table files
G4String directoryPhysicsTable;
// number of materials in G4MaterialTable
// (this member is used by store/restore physics table)
G4int numberOfMaterial;
};
inline void G4VUserPhysicsList::Construct()
{
#ifdef G4VERBOSE
if (verboseLevel >1) G4cout << "G4VUserPhysicsList::Construct()" << G4endl;
if (verboseLevel >1) G4cout << "Construct particles " << G4endl;
#endif
ConstructParticle();
InitializeProcessManager();
#ifdef G4VERBOSE
if (verboseLevel >1) G4cout << "Construct processes " << G4endl;
#endif
ConstructProcess();
}
@@ -213,10 +276,12 @@ inline G4double G4VUserPhysicsList::GetDefaultCutValue() const
inline void G4VUserPhysicsList::SetVerboseLevel(G4int value)
{
verboseLevel = value;
#ifdef G4VERBOSE
if (verboseLevel >1){
G4cout << "G4VUserPhysicsList::SetVerboseLevel :";
G4cout << " Verbose level is set to " << verboseLevel << G4endl;
}
#endif
}
inline G4int G4VUserPhysicsList::GetVerboseLevel() const
@@ -224,4 +289,39 @@ inline G4int G4VUserPhysicsList::GetVerboseLevel() const
return verboseLevel;
}
inline
G4bool G4VUserPhysicsList::IsPhysicsTableRetrieved() const
{
return fRetrievePhysicsTable;
}
inline
const G4String& G4VUserPhysicsList::GetPhysicsTableDirectory() const
{
return directoryPhysicsTable;
}
inline
void G4VUserPhysicsList::SetPhysicsTableRetrieved(const G4String& directory)
{
fRetrievePhysicsTable = true;
if(!directory.isNull()) {
directoryPhysicsTable = directory;
}
fIsCheckedForRetrievePhysicsTable=false;
}
inline
void G4VUserPhysicsList::ResetPhysicsTableRetrieved()
{
fRetrievePhysicsTable = false;
fIsCheckedForRetrievePhysicsTable=false;
}
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUserPrimaryGeneratorAction.hh,v 1.2.4.1 1999/12/07 20:52:59 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VUserPrimaryGeneratorAction.hh,v 1.3 1999/12/15 14:53:52 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#ifndef G4VUserPrimaryGeneratorAction_h
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Run.cc,v 1.1.10.1 1999/12/07 20:52:59 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4Run.cc,v 1.2 1999/12/15 14:53:53 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4Run.hh"
+13 -10
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RunManager.cc,v 1.15 2000/06/28 10:25:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4RunManager.cc,v 1.18 2000/12/14 10:38:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
@@ -52,7 +52,7 @@ G4RunManager::G4RunManager()
currentRun(NULL),currentEvent(NULL),n_perviousEventsToBeStored(0),
geometryInitialized(false),physicsInitialized(false),cutoffInitialized(false),
geometryNeedsToBeClosed(true),initializedAtLeastOnce(false),
runAborted(false),pauseAtBeginOfEvent(false),pauseAtEndOfEvent(false),
runAborted(false),
geometryToBeOptimized(true),verboseLevel(0),DCtable(NULL),runIDCounter(0),
storeRandomNumberStatus(0)
{
@@ -66,10 +66,11 @@ G4RunManager::G4RunManager()
previousEvents = new G4RWTPtrOrderedVector<G4Event>;
G4ParticleTable::GetParticleTable()->CreateMessenger();
G4ProcessTable::GetProcessTable()->CreateMessenger();
randomNumberStatusDir = "./";
G4cout
<< "**********************************************" << G4endl
<< " Geant4 version $Name: geant4-02-00 $" << G4endl
<< " (30-Jun-2000)" << G4endl
<< " Geant4 version $Name: geant4-03-00 $" << G4endl
<< " (15-Dec-2000)" << G4endl
<< " Copyright : Geant4 Collaboration" << G4endl
<< "**********************************************" << G4endl;
}
@@ -228,8 +229,6 @@ void G4RunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_selec
{
stateManager->SetNewState(EventProc);
if(pauseAtBeginOfEvent) stateManager->Pause("BeginOfEvent");
currentEvent = GenerateEvent(i_event);
eventManager->ProcessOneEvent(currentEvent);
@@ -237,7 +236,6 @@ void G4RunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_selec
AnalyzeEvent(currentEvent);
if(i_event<n_select) G4UImanager::GetUIpointer()->ApplyCommand(msg);
if(pauseAtEndOfEvent) stateManager->Pause("EndOfEvent");
stateManager->SetNewState(GeomClosed);
StackPreviousEvent(currentEvent);
currentEvent = NULL;
@@ -398,7 +396,7 @@ void G4RunManager::DefineWorldVolume(G4VPhysicalVolume* worldVol)
void G4RunManager::StoreRandomNumberStatus(G4int eventID)
{
G4String fileN = "RandEngine";
G4String fileN = randomNumberStatusDir+"RandEngine";
if(storeRandomNumberStatus>0 && currentRun != NULL)
{
char st[20];
@@ -421,7 +419,12 @@ void G4RunManager::StoreRandomNumberStatus(G4int eventID)
void G4RunManager::RestoreRandomNumberStatus(G4String fileN)
{
HepRandom::restoreEngineStatus(fileN);
G4String fileNameWithDirectory;
if(fileN.index("/")==G4std::string::npos)
{ fileNameWithDirectory = randomNumberStatusDir+fileN; }
else
{ fileNameWithDirectory = fileN; }
HepRandom::restoreEngineStatus(fileNameWithDirectory);
}
+17 -4
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4RunMessenger.cc,v 1.4.8.1.2.5 1999/12/14 09:16:50 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4RunMessenger.cc,v 1.7 2000/11/13 01:24:21 asaim Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4RunMessenger.hh"
@@ -18,6 +18,7 @@
#include "G4UIcmdWithABool.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "g4std/strstream"
@@ -128,10 +129,17 @@ G4RunMessenger::G4RunMessenger(G4RunManager * runMgr)
restoreRandCmd->SetGuidance("Restore the status of the random number engine from a file.");
restoreRandCmd->SetGuidance("See CLHEP manual for detail.");
restoreRandCmd->SetGuidance("The engine status must be stored beforehand.");
restoreRandCmd->SetGuidance("Directory of the status file should be set by /run/randomNumberStatusDirectory command.");
restoreRandCmd->SetParameterName("fileName",true);
restoreRandCmd->SetDefaultValue("RandEngine.stat");
restoreRandCmd->AvailableForStates(PreInit,Idle,GeomClosed);
randDirCmd = new G4UIcmdWithAString("/run/randomNumberStatusDirectory",this);
randDirCmd->SetGuidance("Define the directory name of the random number status files.");
randDirCmd->SetGuidance("Directory must be creates before storing the file.");
randDirCmd->SetParameterName("fileName",true);
randDirCmd->SetDefaultValue("./");
randDirCmd->AvailableForStates(PreInit,Idle,GeomClosed);
}
G4RunMessenger::~G4RunMessenger()
@@ -147,6 +155,7 @@ G4RunMessenger::~G4RunMessenger()
delete cutCmd;
delete storeRandCmd;
delete restoreRandCmd;
delete randDirCmd;
delete runDirectory;
}
@@ -169,9 +178,9 @@ void G4RunMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
else if( command==optCmd )
{ runManager->SetGeometryToBeOptimized(optCmd->GetNewBoolValue(newValue)); }
else if( command==brkBoECmd )
{ runManager->SetPauseAtBeginOfEvent(brkBoECmd->GetNewBoolValue(newValue)); }
{ G4UImanager::GetUIpointer()->SetPauseAtBeginOfEvent(brkBoECmd->GetNewBoolValue(newValue)); }
else if( command==brkEoECmd )
{ runManager->SetPauseAtEndOfEvent(brkEoECmd->GetNewBoolValue(newValue)); }
{ G4UImanager::GetUIpointer()->SetPauseAtEndOfEvent(brkEoECmd->GetNewBoolValue(newValue)); }
else if( command==abortCmd )
{ runManager->AbortRun(); }
else if( command==initCmd )
@@ -184,6 +193,8 @@ void G4RunMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{ runManager->SetRandomNumberStore(storeRandCmd->GetNewIntValue(newValue)); }
else if( command==restoreRandCmd )
{ runManager->RestoreRandomNumberStatus(newValue); }
else if( command==randDirCmd )
{ runManager->SetRandomNumberStoreDir(newValue); }
}
G4String G4RunMessenger::GetCurrentValue(G4UIcommand * command)
@@ -194,6 +205,8 @@ G4String G4RunMessenger::GetCurrentValue(G4UIcommand * command)
{ cv = verboseCmd->ConvertToString(runManager->GetVerboseLevel()); }
else if( command==storeRandCmd )
{ cv = storeRandCmd->ConvertToString(runManager->GetRandomNumberStore()); }
else if( command==randDirCmd )
{ cv = runManager->GetRandomNumberStoreDir(); }
return cv;
}
+45 -7
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserPhysicsListMessenger.cc,v 1.2.8.1 1999/12/07 20:52:59 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4UserPhysicsListMessenger.cc,v 1.5 2000/11/08 12:40:05 kurasige Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//---------------------------------------------------------------
@@ -42,7 +42,7 @@ G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pPart
verboseCmd->SetGuidance(" 2 : Display more");
verboseCmd->SetParameterName("level",true);
verboseCmd->SetDefaultValue(0);
verboseCmd->SetRange("level >=0 && level <=2");
verboseCmd->SetRange("level >=0 && level <=3");
// /run/particle/setCut command
setCutCmd = new G4UIcmdWithADoubleAndUnit("/run/particle/setCut",this);
@@ -81,6 +81,22 @@ G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pPart
buildPTCmd->SetParameterName("particleType", true);
buildPTCmd->SetDefaultValue("");
buildPTCmd->AvailableForStates(Init,Idle,GeomClosed,EventProc);
// /run/particle/storePhysicsTable command
storeCmd = new G4UIcmdWithAString("/run/particle/storePhysicsTable",this);
storeCmd->SetGuidance("Store Physics Table");
storeCmd->SetGuidance(" Enter directory name");
storeCmd->SetParameterName("dirName",true);
storeCmd->SetDefaultValue("");
storeCmd->AvailableForStates(Idle);
// /run/particle/retrievePhysicsTable command
retrieveCmd = new G4UIcmdWithAString("/run/particle/retrievePhysicsTable",this);
retrieveCmd->SetGuidance("Retrieve Physics Table");
retrieveCmd->SetGuidance(" Enter directory name or OFF to switch off");
retrieveCmd->SetParameterName("dirName",true);
retrieveCmd->SetDefaultValue("");
retrieveCmd->AvailableForStates(PreInit,Idle);
}
G4UserPhysicsListMessenger::~G4UserPhysicsListMessenger()
@@ -91,7 +107,9 @@ G4UserPhysicsListMessenger::~G4UserPhysicsListMessenger()
delete dumpCutValuesCmd;
delete addProcManCmd;
delete buildPTCmd;
delete theDirectory;
delete storeCmd;
delete retrieveCmd;
delete theDirectory;
}
void G4UserPhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
@@ -123,8 +141,18 @@ void G4UserPhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newV
G4ParticleDefinition* particle = (G4ParticleTable::GetParticleTable())->FindParticle(newValue);
if (particle == NULL) return;
thePhysicsList->BuildPhysicsTable(particle);
} else if ( command == storeCmd ){
thePhysicsList->StorePhysicsTable(newValue);
} else if( command == retrieveCmd ) {
if ((newValue == "OFF") || (newValue == "off") ){
thePhysicsList->ResetPhysicsTableRetrieved();
} else {
thePhysicsList->SetPhysicsTableRetrieved(newValue);
}
}
}
}
G4String G4UserPhysicsListMessenger::GetCurrentValue(G4UIcommand * command)
{
@@ -137,7 +165,7 @@ G4String G4UserPhysicsListMessenger::GetCurrentValue(G4UIcommand * command)
} else if( command==verboseCmd ){
cv = verboseCmd->ConvertToString(thePhysicsList->GetVerboseLevel());
} else if( command== addProcManCmd ){
// set candidate list
piter -> reset();
@@ -147,7 +175,7 @@ G4String G4UserPhysicsListMessenger::GetCurrentValue(G4UIcommand * command)
}
addProcManCmd->SetCandidates(candidates);
cv = "";
} else if( command== buildPTCmd ){
// set candidate list
piter -> reset();
@@ -157,6 +185,16 @@ G4String G4UserPhysicsListMessenger::GetCurrentValue(G4UIcommand * command)
}
addProcManCmd->SetCandidates(candidates);
cv = "";
} else if ( command == storeCmd ){
cv = thePhysicsList->GetPhysicsTableDirectory();
}else if( command == retrieveCmd ) {
if (thePhysicsList->IsPhysicsTableRetrieved()) {
cv = thePhysicsList->GetPhysicsTableDirectory();
} else {
cv = "OFF";
}
}
return cv;
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UserRunAction.cc,v 1.2.8.1 1999/12/07 20:53:00 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4UserRunAction.cc,v 1.3 1999/12/15 14:53:54 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4UserRunAction.hh"
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VPersistencyManager.cc,v 1.1.10.1 1999/12/07 20:53:00 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VPersistencyManager.cc,v 1.2 1999/12/15 14:53:54 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4VPersistencyManager.hh"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUserDetectorConstruction.cc,v 1.1.10.1 1999/12/07 20:53:00 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VUserDetectorConstruction.cc,v 1.2 1999/12/15 14:53:54 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4VUserDetectorConstruction.hh"
+466 -58
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUserPhysicsList.cc,v 1.7.8.1.2.3 1999/12/14 07:08:32 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VUserPhysicsList.cc,v 1.12 2000/11/16 14:46:48 kurasige Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
@@ -41,7 +41,11 @@
G4VUserPhysicsList::G4VUserPhysicsList()
:verboseLevel(1)
:verboseLevel(1),
numberOfMaterial(0),
fRetrievePhysicsTable(false),
directoryPhysicsTable("."),
fIsCheckedForRetrievePhysicsTable(false)
{
// default cut value (1.0mm)
defaultCutValue = 1.0*mm;
@@ -484,56 +488,74 @@ void G4VUserPhysicsList::ReCalcCutValueForOthers()
void G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition* particle)
{
if (fRetrievePhysicsTable) {
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VUserPhysicsList::BuildPhysicsTable ";
G4cout << " Retrieve Physics Table for ";
G4cout << particle->GetParticleName() << G4endl;
}
#endif
if (CheckForRetrievePhysicsTable(directoryPhysicsTable)) {
// Retrieve PhysicsTable from files for proccesses
RetrievePhysicsTable(particle);
return;
} else {
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "CheckForRetrievePhysicsTable failed " << G4endl;
}
#endif
fRetrievePhysicsTable = false;
}
}
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VUserPhysicsList::BuildPhysicsTable ";
G4cout << " for " << particle->GetParticleName() << G4endl;
}
#endif
G4int j;
// Rebuild the physics tables for every process for this particle type
G4ProcessVector* pVector = (particle->GetProcessManager())->GetProcessList();
for ( j=0; j < pVector->entries(); ++j) {
(*pVector)[j]->BuildPhysicsTable(*particle);
}
for ( j=0; j < pVector->entries(); ++j) {
//*********************************************************************
// temporary addition to make the integral schema of electromagnetic
// processes work.
//
if((*pVector)[j]->GetProcessName() == "Imsc")
{
(*pVector)[j]->BuildPhysicsTable(*particle);
}
if((*pVector)[j]->GetProcessName() == "IeIoni")
{
(*pVector)[j]->BuildPhysicsTable(*particle);
}
if((*pVector)[j]->GetProcessName() == "IeBrems")
{
(*pVector)[j]->BuildPhysicsTable(*particle);
}
if((*pVector)[j]->GetProcessName() == "Iannihil")
{
(*pVector)[j]->BuildPhysicsTable(*particle);
}
if((*pVector)[j]->GetProcessName() == "IhIoni")
{
(*pVector)[j]->BuildPhysicsTable(*particle);
}
if((*pVector)[j]->GetProcessName() == "IMuIoni")
{
(*pVector)[j]->BuildPhysicsTable(*particle);
}
if((*pVector)[j]->GetProcessName() == "IMuBrems")
{
(*pVector)[j]->BuildPhysicsTable(*particle);
}
if((*pVector)[j]->GetProcessName() == "IMuPairProd")
{
(*pVector)[j]->BuildPhysicsTable(*particle);
}
//*********************************************************************
// temporary addition to make the integral schema
BuildIntegralPhysicsTable((*pVector)[j], particle);
}
}
void G4VUserPhysicsList::BuildIntegralPhysicsTable(G4VProcess* process,
G4ParticleDefinition* particle)
{
//*********************************************************************
// temporary addition to make the integral schema of electromagnetic
// processes work.
//
if ( (process->GetProcessName() == "Imsc") ||
(process->GetProcessName() == "IeIoni") ||
(process->GetProcessName() == "IeBrems") ||
(process->GetProcessName() == "Iannihil") ||
(process->GetProcessName() == "IhIoni") ||
(process->GetProcessName() == "IMuIoni") ||
(process->GetProcessName() == "IMuBrems") ||
(process->GetProcessName() == "IMuPairProd") ) {
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VUserPhysicsList::BuildIntegralPhysicsTable ";
G4cout << " BuildPhysicsTable is invoked for ";
G4cout << process->GetProcessName();
G4cout << "(" << particle->GetParticleName() << ")" << G4endl;
}
#endif
process->BuildPhysicsTable(*particle);
}
}
void G4VUserPhysicsList::DumpList() const
{
theParticleIterator->reset();
@@ -611,8 +633,9 @@ void G4VUserPhysicsList::DumpCutValuesTable() const
G4String name[size] = {"gamma", "e-", "mu-", "proton", "neutron"};
G4ParticleDefinition* particle[size];
G4bool IsOK = true;
G4int size_display=2;
G4int idx;
for (idx=0; idx <size; idx++) {
for (idx=0; idx <size_display; idx++) {
particle[idx] = theParticleTable->FindParticle(name[idx]);
}
@@ -625,14 +648,14 @@ void G4VUserPhysicsList::DumpCutValuesTable() const
// line 3
G4cout << " ";
for (idx=0; idx <size; idx++) {
for (idx=0; idx <size_display; idx++) {
G4cout << " " << G4std::setw(11) << name[idx] << " ";
}
G4cout << G4endl;
// line 4
G4cout << "Cut in range ";
for (idx=0; idx <size; idx++) {
for (idx=0; idx <size_display; idx++) {
if (particle[idx] == 0) {
G4cout << " ";
} else {
@@ -649,7 +672,7 @@ void G4VUserPhysicsList::DumpCutValuesTable() const
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
for (G4int J=0; J<materialTable->entries(); J++) {
G4cout << " " << G4std::setw(18) << ((*materialTable)[J])->GetName();
for (idx=0; idx <size; idx++) {
for (idx=0; idx <size_display; idx++) {
if (particle[idx] == 0) {
G4cout << " ";
} else {
@@ -674,15 +697,400 @@ void G4VUserPhysicsList::DumpCutValuesTable() const
G4cout.precision(prec);
}
G4bool G4VUserPhysicsList::StorePhysicsTable(const G4String& directory)
{
G4String dir = directory;
if (dir.isNull()) dir = directoryPhysicsTable;
if (!StoreMaterialInfo(dir)) return false;
if (!StoreCutValues(dir)) return false;
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VUserPhysicsList::StorePhysicsTable ";
G4cout << " Store material and cu values successfully" << G4endl;
}
#endif
return true;
}
G4bool G4VUserPhysicsList::StoreMaterialInfo(const G4String& directory)
{
const G4String fileName = directory + "/" + "material.dat";
const G4String key = "MATERIAL";
G4std::ofstream fOut;
// open output file //
fOut.open(fileName,G4std::ios::out);
// check if the file has been opened successfully
if (!fOut) {
#ifdef G4VERBOSE
G4cerr << "G4VUserPhysicsList::StoreMaterialInfo ";
G4cerr << " Can not open file " << fileName << G4endl;
#endif
return false;
}
// key word
fOut << key << G4endl;
const G4MaterialTable* matTable = G4Material::GetMaterialTable();
// number of materials in the table
numberOfMaterial = matTable->entries();
fOut << numberOfMaterial << G4endl;
fOut.setf(G4std::ios::scientific);
// material name and density
for (G4int idx=0; idx<matTable->entries(); ++idx){
fOut << G4std::setw(20) << ((*matTable)[idx])->GetName();
fOut << G4std::setw(20) << ((*matTable)[idx])->GetDensity()/(g/cm3) << G4endl;
}
fOut.unsetf(G4std::ios::scientific);
fOut.close();
return true;
}
G4bool G4VUserPhysicsList::StoreCutValues(const G4String& directory)
{
const G4String fileName = directory + "/" + "cut_value.dat";
const G4String key = "CUT_VALUE";
G4std::ofstream fOut;
// open output file //
fOut.open(fileName,G4std::ios::out);
// check if the file has been opened successfully
if (!fOut) {
#ifdef G4VERBOSE
G4cerr << "G4VUserPhysicsList::StoreCutValues ";
G4cerr << " Can not open file " << fileName << G4endl;
#endif
return false;
}
// key word
fOut << key << G4endl;
fOut.setf(G4std::ios::scientific);
// default cut value
fOut << "Default " << G4std::setw(20) << defaultCutValue/mm << G4endl;
// loop over all particles in G4ParticleTable
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
if ( (particle->GetParticleName() == "gamma" ) ||
(particle->GetParticleName() == "e-" ) ||
(particle->GetParticleName() == "e+" ) ||
(particle->GetParticleName() == "mu-" ) ||
(particle->GetParticleName() == "mu+" ) ||
(particle->GetParticleName() == "proton" ) ||
(particle->GetParticleName() == "anti_proton" ) ||
((particle->GetPDGCharge()==0.0)&&(!particle->IsShortLived())) ) {
// particle name and cut in length
fOut << G4std::setw(40) << particle->GetParticleName();
fOut << G4std::setw(20) << particle->GetLengthCuts()/mm << G4endl;
G4double* cutArray = particle->GetEnergyCuts();
// cut energy for each material
G4int jj =0;
for(G4int idx=0; idx<numberOfMaterial; ++idx, ++jj) {
if (jj==4) {
fOut << G4endl;
jj =0;
}
fOut << G4std::setw(20) << cutArray[idx]/keV;
}
fOut << G4endl;
}
}
fOut.unsetf(G4std::ios::scientific);
fOut.close();
return true;
}
void G4VUserPhysicsList::RetrievePhysicsTable(G4ParticleDefinition* particle)
{
G4int j;
G4bool success[100];
// Retrieve physics tables for every process for this particle type
G4ProcessVector* pVector = (particle->GetProcessManager())->GetProcessList();
for ( j=0; j < pVector->entries(); ++j) {
success[j] =
(*pVector)[j]->RetrievePhysicsTable(directoryPhysicsTable);
if (!success[j]) {
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << "G4VUserPhysicsList::RetrievePhysicsTable ";
G4cout << " Fail to retrieve for ";
G4cout << (*pVector)[j]->GetProcessName();
G4cout << "(" << particle->GetParticleName() <<")" << G4endl;
}
#endif
(*pVector)[j]->BuildPhysicsTable(*particle);
}
}
for ( j=0; j < pVector->entries(); ++j) {
// temporary addition to make the integral schema
if (!success[j]) BuildIntegralPhysicsTable((*pVector)[j], particle);
}
}
G4bool G4VUserPhysicsList::CheckForRetrievePhysicsTable(const G4String& directory)
{
if (!fIsCheckedForRetrievePhysicsTable) {
if (CheckMaterialInfo(directory)) {
if (CheckCutValues(directory)) {
fIsCheckedForRetrievePhysicsTable = true;
}
}
}
return fIsCheckedForRetrievePhysicsTable;
}
G4bool G4VUserPhysicsList::CheckMaterialInfo(const G4String& directory)
{
const G4String fileName = directory + "/" + "material.dat";
const G4String key = "MATERIAL";
G4std::ifstream fIn;
// open input file //
fIn.open(fileName,G4std::ios::in);
// check if the file has been opened successfully
if (!fIn) {
#ifdef G4VERBOSE
G4cerr << "G4VUserPhysicsList::CheckMaterialInfo ";
G4cerr << " Can not open file " << fileName << G4endl;
#endif
return false;
}
// key word
G4String keyword;
fIn >> keyword;
if (key!=keyword) {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckMaterialInfo ";
G4cout << " Can not find key word " << keyword << G4endl;
}
#endif
return false;
}
const G4MaterialTable* matTable = G4Material::GetMaterialTable();
numberOfMaterial = matTable->entries();
// number of materials in the table
G4int nmat;
fIn >> nmat;
if (nmat!=numberOfMaterial) {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckMaterialInfo ";
G4cout << "Number of material is inconsistent "<< G4endl;
}
#endif
return false;
}
// list of material
for (G4int idx=0; idx<matTable->entries(); ++idx){
// check eof
if(fIn.eof()) {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckMaterialInfo ";
G4cout << " encountered End of File" << G4endl;
}
#endif
fIn.close();
return false;
}
// check material name and density
char name[40];
double density;
fIn >> name >> density;
if (fIn.fail()) {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckMaterialInfo ";
G4cout << " Bad data format " << G4endl;
}
#endif
fIn.close();
return false;
}
G4double ratio = abs( (density*g/cm3)/((*matTable)[idx])->GetDensity() );
if ( (name != ((*matTable)[idx])->GetName()) || (0.999>ratio) || (ratio>1.001) ){
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckMaterialInfo ";
G4cout << " Inconsistent material name or density" << G4endl;;
G4cout << G4std::setw(40) << name;
G4cout << G4std::setw(20) << G4std::setiosflags(G4std::ios::scientific) << density << G4endl;
G4cout << G4std::resetiosflags(G4std::ios::scientific);
}
#endif
fIn.close();
return false;
}
}
fIn.close();
return true;
}
G4bool G4VUserPhysicsList::CheckCutValues(const G4String& directory)
{
const G4String fileName = directory + "/" + "cut_value.dat";
const G4String key = "CUT_VALUE";
G4std::ifstream fIn;
// open output file //
fIn.open(fileName,G4std::ios::in);
// check if the file has been opened successfully
if (!fIn) {
#ifdef G4VERBOSE
G4cerr << "G4VUserPhysicsList::CheckCutValues ";
G4cerr << " Can not open file " << fileName << G4endl;
#endif
return false;
}
// key word
G4String keyword;
fIn >> keyword;
if (key!=keyword) {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckCutValues ";
G4cout << " Can not find key word " << keyword << G4endl;
}
#endif
}
// default cut value
G4double defaultCut;
fIn >> keyword >> defaultCut;
if (fIn.fail()) {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckCutValues ";
G4cout << " Bad data format " << G4endl;
}
#endif
fIn.close();
return false;
}
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout.setf(G4std::ios::scientific);
G4cout << "Default " << G4std::setw(20) << defaultCutValue/mm << G4endl;
G4cout.unsetf(G4std::ios::scientific);
}
#endif
// check default value
G4double ratio = abs(defaultCut / (defaultCutValue/mm) );
if ((keyword != "Default")|| (ratio<0.999) ||(ratio>1.001) ){
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckCutValues ";
G4cout << " Inconsistent default cut values" << G4endl;;
}
#endif
fIn.close();
return false;
}
// loop over all particles
while(!fIn.eof()){
// read in particle name and cut in length
G4String name;
G4double cutLength;
fIn >> name >> cutLength;
if (fIn.eof()) break;
if (fIn.fail()) {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckCutValues ";
G4cout << " Bad data format " << G4endl;
}
#endif
fIn.close();
return false;
}
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout.setf(G4std::ios::scientific);
G4cout << name << G4std::setw(20) << cutLength << G4endl;
G4cout.unsetf(G4std::ios::scientific);
}
#endif
// Search particle
G4ParticleDefinition* particle = theParticleTable->FindParticle(name);
if (particle==0) {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckCutValues ";
G4cout << " Particle " << name <<" is not found "<< G4endl;
}
fIn.close();
return false;
#endif
}
// check cut in length
ratio = abs(cutLength/ (particle->GetLengthCuts()/mm) );
if ((ratio<0.999) ||(ratio>1.001) ){
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "G4VUserPhysicsList::CheckCutValues ";
G4cout << " Inconsistent cut values for " << name << G4endl;;
}
#endif
fIn.close();
return false;
}
// read in energy cut for all materials (not used)
G4int jj;
for(G4int idx=0; idx<numberOfMaterial; ++idx) {
#ifdef G4VERBOSE
if (verboseLevel>2){
if(jj==4) G4cout << G4endl;
}
#endif
G4double value;
fIn >> value;
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout.setf(G4std::ios::scientific);
G4cout << G4std::setw(20) << value;
G4cout.unsetf(G4std::ios::scientific);
++jj;
}
#endif
}
#ifdef G4VERBOSE
if (verboseLevel>2){
G4cout << G4endl;
}
#endif
}
fIn.close();
return true;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VUserPrimaryGeneratorAction.cc,v 1.1.10.1 1999/12/07 20:53:00 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4VUserPrimaryGeneratorAction.cc,v 1.2 1999/12/15 14:53:54 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
#include "G4VUserPrimaryGeneratorAction.hh"