Import Geant4 6.0.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.6 2002/07/11 16:18:35 dressel Exp $
|
||||
# $Id: GNUmakefile,v 1.8 2003/10/03 14:46:30 gcosmo Exp $
|
||||
# ----------------------------------------------------------
|
||||
# GNUmakefile for run library. Gabriele Cosmo, 3/4/1997.
|
||||
# ----------------------------------------------------------
|
||||
@@ -19,17 +19,19 @@ CPPFLAGS += \
|
||||
-I$(G4BASE)/materials/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/processes/cuts/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/utils/include \
|
||||
-I$(G4BASE)/processes/transportation/include \
|
||||
-I$(G4BASE)/processes/decay/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/navigation/include \
|
||||
-I$(G4BASE)/geometry/magneticfield/include \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/tracking/include \
|
||||
-I$(G4BASE)/digits+hits/detector/include \
|
||||
-I$(G4BASE)/digits+hits/hits/include \
|
||||
-I$(G4BASE)/digits+hits/digits/include \
|
||||
-I$(G4BASE)/digits_hits/detector/include \
|
||||
-I$(G4BASE)/digits_hits/hits/include \
|
||||
-I$(G4BASE)/digits_hits/digits/include \
|
||||
-I$(G4BASE)/event/include \
|
||||
-I$(G4BASE)/intercoms/include \
|
||||
-I$(G4BASE)/geometry/biasing/include
|
||||
|
||||
+41
-1
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.95 2003/06/19 13:21:02 gcosmo Exp $
|
||||
$Id: History,v 1.106 2003/12/09 09:14:48 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,46 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
December 09, 2003, G.Cosmo (run-V05-02-10)
|
||||
- Changed date for release 6.0.
|
||||
|
||||
November 12, 2003, M.Asai (run-V05-02-09)
|
||||
- Remove dedicated treatment of anti-proton, neutron and anti-neutron
|
||||
from BuildPhysicsTable of UserPhysicsList.
|
||||
|
||||
November 04, 2003, M.Asai (run-V05-02-08)
|
||||
- Cosmetic changes of messages for storing/retreiving physics table
|
||||
|
||||
November 03, 2003, M.Asai (run-V05-02-07)
|
||||
- Introducing PhysicsHasBeenModified() method in G4RunManagerKernel class
|
||||
and relared wrapper methods in G4RunManager and G4RunMessenger.
|
||||
|
||||
November 3, 2003, H.Kurashige (run-V05-02-06)
|
||||
- G4VUserPhysicsList:
|
||||
o Clean Up error messages for store/retreiving physcs table
|
||||
|
||||
October 21, 2003, M.Asai (run-V05-02-05)
|
||||
- G4RunManagerKernel:
|
||||
o Protect against a region which does not have a cut pointer.
|
||||
|
||||
October 4, 2003, G.Cosmo (run-V05-02-04)
|
||||
- GNUmakefile:
|
||||
o added dependency to new module "geometry/navigation".
|
||||
o replaced "digits+hits" with "digits_hits".
|
||||
- Coworks with "geometry-V05-02-00" and "digits_hits-V05-02-00".
|
||||
|
||||
September 25, 2003, H.Kurashige (run-V05-02-03)
|
||||
- Modify GNUmakefile for processes/cuts category
|
||||
|
||||
September 09, 2003, M.Asai (run-V05-02-02)
|
||||
- Fix a typo in G4VUserPhysicsList.
|
||||
|
||||
August 25, 2003, G.Cosmo (run-V05-02-01)
|
||||
- G4RunManager.cc: changed date for release 5.2-patch01.
|
||||
|
||||
August 01, 2003, M.Asai (run-V05-02-00)
|
||||
- Introducing G4RunManagerKernel class.
|
||||
|
||||
June 19, 2003, G.Cosmo (run-V05-01-04)
|
||||
- G4VUserPhysicsList.cc: check IsShortLived() before building the
|
||||
physics table in BuildPhysicsTable(). (V.Ivantchenko)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ExceptionHandler.hh,v 1.1 2002/08/19 18:33:29 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Run.hh,v 1.7 2003/04/23 17:54:17 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#ifndef G4Run_h
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunManager.hh,v 1.34 2003/06/16 17:12:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4RunManager.hh,v 1.37 2003/11/04 01:58:00 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -81,13 +81,12 @@ class G4Timer;
|
||||
class G4RunMessenger;
|
||||
class G4DCtable;
|
||||
class G4Run;
|
||||
class G4ExceptionHandler;
|
||||
|
||||
#include "G4RunManagerKernel.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "globals.hh"
|
||||
#include <vector>
|
||||
////////#include <signal.h>
|
||||
|
||||
class G4RunManager
|
||||
{
|
||||
@@ -95,11 +94,6 @@ class G4RunManager
|
||||
static G4RunManager* GetRunManager();
|
||||
// Static method which returns the singleton pointer of G4RunManager or
|
||||
// its derived class.
|
||||
public:
|
||||
//////// static G4int RegisterInteruption(int interuptionSignal = SIGQUIT);
|
||||
// Static method to define the interuption key
|
||||
//////// static void ReceiveInteruption(int sig);
|
||||
// Static method to accept interuption signal
|
||||
|
||||
private:
|
||||
static G4RunManager* fRunManager;
|
||||
@@ -126,8 +120,8 @@ class G4RunManager
|
||||
// loop. This method must be invoked at the Geant4 state of PreInit or Idle. The
|
||||
// state will be changed to Init during the initialization procedures and then
|
||||
// changed to Idle.
|
||||
// This method invokes three protected methods, InitializeGeometry(),
|
||||
// InitializePhysics(), and InitializeCutOff().
|
||||
// This method invokes two protected methods, InitializeGeometry() and
|
||||
// InitializePhysics().
|
||||
// After some event loops, the user can invoke this method once again. It is
|
||||
// required if the user changes geometry, physics process, and/or cut off value.
|
||||
// If the user forget the second invokation, G4RunManager will invoke BeamOn()
|
||||
@@ -140,7 +134,7 @@ class G4RunManager
|
||||
// different from the original one used in the previous run; if not, it must be
|
||||
// set to false, so that the original optimisation and navigation history is
|
||||
// preserved. This method is invoked also at initialisation.
|
||||
virtual void ResetNavigator() const;
|
||||
//////////////////////////////////////////////////////virtual void ResetNavigator() const;
|
||||
// Resets the state of the navigator for tracking; needed for geometry updates.
|
||||
// It forces the optimisation and navigation history to be reset.
|
||||
virtual void AbortRun(G4bool softAbort=false);
|
||||
@@ -158,11 +152,10 @@ class G4RunManager
|
||||
|
||||
virtual void InitializeGeometry();
|
||||
virtual void InitializePhysics();
|
||||
virtual void InitializeCutOff();
|
||||
// These three protected methods are invoked from Initialize() method for the
|
||||
// initializations of geometry, physics processes, and cut off. The user's concrete
|
||||
// These protected methods are invoked from Initialize() method for the
|
||||
// initializations of geometry and physics processes. The user's concrete
|
||||
// G4VUserDetectorConstruction class will be accessed from InitializeGeometry() and
|
||||
// G4VUserPhysicsList class will be accessed from other two methods.
|
||||
// G4VUserPhysicsList class will be accessed from InitializePhysics().
|
||||
|
||||
virtual G4bool ConfirmBeamOnCondition();
|
||||
virtual void RunInitialization();
|
||||
@@ -182,7 +175,7 @@ class G4RunManager
|
||||
// object is deleted in this class. If the user uses ODBMS and wants to store the
|
||||
// G4Run class object, he/she must override this method.
|
||||
|
||||
virtual void BuildPhysicsTables();
|
||||
///////////////////////////////////////////////////////////virtual void BuildPhysicsTables();
|
||||
// This method is invoked from RunInitialization() to create physics tables.
|
||||
|
||||
virtual G4Event* GenerateEvent(G4int i_event);
|
||||
@@ -197,7 +190,7 @@ class G4RunManager
|
||||
// class is defined.
|
||||
|
||||
public: // with description
|
||||
void UpdateRegion();
|
||||
//////////////////////////////////////////////////////void UpdateRegion();
|
||||
// Update region list.
|
||||
// This method is mandatory before invoking following two dump methods.
|
||||
// At RunInitialization(), this method is automatically invoked, and thus
|
||||
@@ -214,12 +207,13 @@ class G4RunManager
|
||||
void StackPreviousEvent(G4Event* anEvent);
|
||||
|
||||
protected:
|
||||
G4RunManagerKernel * kernel;
|
||||
G4EventManager * eventManager;
|
||||
|
||||
G4VUserDetectorConstruction * userDetector;
|
||||
G4VUserPhysicsList * physicsList;
|
||||
G4UserRunAction * userRunAction;
|
||||
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction;
|
||||
|
||||
G4UserEventAction * userEventAction;
|
||||
G4UserStackingAction * userStackingAction;
|
||||
G4UserTrackingAction * userTrackingAction;
|
||||
@@ -227,12 +221,10 @@ class G4RunManager
|
||||
|
||||
private:
|
||||
G4RunMessenger* runMessenger;
|
||||
G4ExceptionHandler* defaultExceptionHandler;
|
||||
|
||||
protected:
|
||||
G4bool geometryInitialized;
|
||||
G4bool physicsInitialized;
|
||||
G4bool cutoffInitialized;
|
||||
G4bool geometryNeedsToBeClosed;
|
||||
G4bool runAborted;
|
||||
G4bool initializedAtLeastOnce;
|
||||
@@ -251,10 +243,8 @@ class G4RunManager
|
||||
|
||||
G4bool storeRandomNumberStatus;
|
||||
G4String randomNumberStatusDir;
|
||||
G4String versionString;
|
||||
|
||||
G4VPhysicalVolume* currentWorld;
|
||||
G4Region* defaultRegion;
|
||||
|
||||
public:
|
||||
virtual void rndmSaveThisRun();
|
||||
@@ -317,7 +307,7 @@ class G4RunManager
|
||||
// he/she can use the corresponding ENUM in G4ClassificationOfNewTrack.
|
||||
|
||||
inline G4String GetVersionString() const
|
||||
{ return versionString; }
|
||||
{ return kernel->GetVersionString(); }
|
||||
|
||||
public:
|
||||
inline void SetRandomNumberStore(G4bool flag)
|
||||
@@ -336,16 +326,29 @@ class G4RunManager
|
||||
public: // with description
|
||||
inline void GeometryHasBeenModified()
|
||||
{ geometryNeedsToBeClosed = true; }
|
||||
inline void CutOffHasBeenModified()
|
||||
{ cutoffInitialized = false; }
|
||||
// These two methods must be invoked (or equivalent UI commands can be used)
|
||||
// in case the user changes his/her detector geometry or cut off value(s) after
|
||||
// This method must be invoked (or equivalent UI command can be used)
|
||||
// in case the user changes his/her detector geometry after
|
||||
// Initialize() metho has been invoked. Then, at the begining of the next BeamOn(),
|
||||
// all necessary re-initialization will be done.
|
||||
|
||||
inline void PhysicsHasBeenModified()
|
||||
{ kernel->PhysicsHasBeenModified(); }
|
||||
// This method must be invoked (or equivalent UI command can be used)
|
||||
// in case the user changes his/her physics process(es), e.g. (in)activate
|
||||
// some processes. Once this method is invoked, regardless of cuts are
|
||||
// changed or not, BuildPhysicsTable() of PhysicsList is invoked for
|
||||
// refreshing all physics tables.
|
||||
|
||||
inline void CutOffHasBeenModified()
|
||||
{
|
||||
G4cerr << "CutOffHasBeenModified becomes obsolete." << G4endl;
|
||||
G4cerr << "It is safe to remove invoking this method." << G4endl;
|
||||
}
|
||||
|
||||
public:
|
||||
inline void SetVerboseLevel(G4int vl)
|
||||
{ verboseLevel = vl; }
|
||||
{ verboseLevel = vl;
|
||||
kernel->SetVerboseLevel(vl); }
|
||||
inline G4int GetVerboseLevel() const
|
||||
{ return verboseLevel; }
|
||||
|
||||
@@ -355,6 +358,7 @@ class G4RunManager
|
||||
{
|
||||
geometryToBeOptimized = vl;
|
||||
geometryNeedsToBeClosed = true;
|
||||
kernel->SetGeometryToBeOptimized(vl);
|
||||
}
|
||||
}
|
||||
inline G4bool GetGeometryToBeOptimized()
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * 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: G4RunManagerKernel.hh,v 1.3 2003/11/04 01:58:28 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a class for mandatory control of GEANT4 kernel.
|
||||
//
|
||||
// This class is constructed by G4RunManager. If a user uses his/her own
|
||||
// class instead of G4RunManager, this class must be instantiated by
|
||||
// him/herself at the very beginning of the application and must be deleted
|
||||
// at the very end of the application. Also, following methods must be
|
||||
// invoked in the proper order.
|
||||
// DefineWorldVolume
|
||||
// InitializePhysics
|
||||
// RunInitialization
|
||||
// RunTermination
|
||||
//
|
||||
// User must provide his/her own classes derived from the following
|
||||
// abstract class and register it to the RunManagerKernel.
|
||||
// G4VUserPhysicsList - Particle types, Processes and Cuts
|
||||
//
|
||||
// G4RunManagerKernel does not have any eveny loop. Handling of events
|
||||
// is managed by G4RunManager.
|
||||
//
|
||||
|
||||
#ifndef G4RunManagerKernel_h
|
||||
#define G4RunManagerKernel_h 1
|
||||
|
||||
class G4VUserPhysicsList;
|
||||
class G4EventManager;
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4Region;
|
||||
class G4ExceptionHandler;
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4RunManagerKernel
|
||||
{
|
||||
public: // with description
|
||||
static G4RunManagerKernel* GetRunManagerKernel();
|
||||
// Static method which returns the singleton pointer of G4RunManagerKernel or
|
||||
// its derived class.
|
||||
|
||||
private:
|
||||
static G4RunManagerKernel* fRunManagerKernel;
|
||||
|
||||
public: // with description
|
||||
G4RunManagerKernel();
|
||||
virtual ~G4RunManagerKernel();
|
||||
// The constructor and the destructor. The user must construct this class
|
||||
// object at the beginning of his/her main() and must delete it at the
|
||||
// bottom of the main(), unless he/she used G4RunManager.
|
||||
|
||||
public: // with description
|
||||
void DefineWorldVolume(G4VPhysicalVolume * worldVol,
|
||||
G4bool topologyIsChanged=true);
|
||||
// This method must be invoked if the geometry setup has been changed between
|
||||
// runs. The flag 'topologyIsChanged' will specify if the geometry topology is
|
||||
// different from the original one used in the previous run; if not, it must be
|
||||
// set to false, so that the original optimisation and navigation history is
|
||||
// preserved. This method is invoked also at initialisation.
|
||||
|
||||
|
||||
void InitializePhysics(G4VUserPhysicsList* uPhys);
|
||||
// This method must be invoked at least once by the user with a valid
|
||||
// concrete implementation of user physics list.
|
||||
|
||||
G4bool RunInitialization();
|
||||
// Trigger geometry closing and physics table constructions.
|
||||
// It returns TRUE is all procedures went well.
|
||||
|
||||
void RunTermination();
|
||||
// Set the application state to G4State_Idle so that the user can modify
|
||||
// physics/geometry.
|
||||
|
||||
private:
|
||||
void ResetNavigator();
|
||||
void BuildPhysicsTables();
|
||||
void CheckRegions();
|
||||
|
||||
public: // with description
|
||||
void UpdateRegion();
|
||||
// Update region list.
|
||||
// This method is mandatory before invoking following two dump methods.
|
||||
// At RunInitialization(), this method is automatically invoked, and thus
|
||||
// the user needs not invoke.
|
||||
|
||||
void DumpRegion(G4String rname) const;
|
||||
// Dump information of a region.
|
||||
|
||||
void DumpRegion(G4Region* region=0) const;
|
||||
// Dump information of a region.
|
||||
// If the pointer is NULL, all regions are shown.
|
||||
|
||||
private:
|
||||
G4VUserPhysicsList * physicsList;
|
||||
G4VPhysicalVolume* currentWorld;
|
||||
G4bool geometryInitialized;
|
||||
G4bool physicsInitialized;
|
||||
G4bool geometryNeedsToBeClosed;
|
||||
G4bool geometryToBeOptimized;
|
||||
G4bool physicsNeedsToBeReBuilt;
|
||||
G4int verboseLevel;
|
||||
|
||||
G4EventManager * eventManager;
|
||||
G4ExceptionHandler* defaultExceptionHandler;
|
||||
G4Region* defaultRegion;
|
||||
G4String versionString;
|
||||
|
||||
public: // with description
|
||||
inline void GeometryHasBeenModified()
|
||||
{ geometryNeedsToBeClosed = true; }
|
||||
// This method must be invoked (or equivalent UI commands can be used)
|
||||
// in case the user changes his/her detector geometry.
|
||||
// This method is automatically invoked from DefineWorldVolume() method.
|
||||
|
||||
inline void PhysicsHasBeenModified()
|
||||
{ physicsNeedsToBeReBuilt = true; }
|
||||
// This method must be invoked in case the user changes his/her physics
|
||||
// process(es), e.g. (in)activate some processes. Once this method is
|
||||
// invoked, regardless of cuts are changed or not, BuildPhysicsTable()
|
||||
// of PhysicsList is invoked for refreshing all physics tables.
|
||||
|
||||
public:
|
||||
inline G4EventManager* GetEventManager() const
|
||||
{ return eventManager; }
|
||||
|
||||
inline G4String GetVersionString() const
|
||||
{ return versionString; }
|
||||
|
||||
inline void SetVerboseLevel(G4int vl)
|
||||
{ verboseLevel = vl; }
|
||||
|
||||
inline void SetGeometryToBeOptimized(G4bool vl)
|
||||
{
|
||||
if(geometryToBeOptimized != vl)
|
||||
{
|
||||
geometryToBeOptimized = vl;
|
||||
geometryNeedsToBeClosed = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunMessenger.hh,v 1.11 2003/03/11 05:00:47 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4RunMessenger.hh,v 1.12 2003/11/04 01:58:28 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
// GEANT 4 class header file
|
||||
@@ -43,7 +43,7 @@
|
||||
// abort * Abort current run processing.
|
||||
// Initialize * Initialize G4 kernel.
|
||||
// geometryModified * Force geometry to be closed again.
|
||||
// cutoffModified * Force closssection tables to be calculated again.
|
||||
// physicsModified * Force cross-section tables to be calculated again.
|
||||
// (and rebuilding physics table will be invoked)
|
||||
// storeRandomNumberStatus * Set the flag for storing random number status
|
||||
// restoreRandomNumberStatus * Restore the stored random number status
|
||||
@@ -90,6 +90,7 @@ class G4RunMessenger: public G4UImessenger
|
||||
G4UIcmdWithoutParameter * abortEventCmd;
|
||||
G4UIcmdWithoutParameter * initCmd;
|
||||
G4UIcmdWithoutParameter * geomCmd;
|
||||
G4UIcmdWithoutParameter * physCmd;
|
||||
G4UIcmdWithoutParameter * cutCmd;
|
||||
|
||||
G4UIdirectory * randomDirectory;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UserPhysicsListMessenger.hh,v 1.15 2003/04/14 20:07:25 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UserRunAction.hh,v 1.7 2003/04/04 16:45:30 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#ifndef G4UserRunAction_h
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VModularPhysicsList.hh,v 1.5 2003/06/16 17:12:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VPersistencyManager.hh,v 1.4 2001/07/11 10:08:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VPersistencyManager_h
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VPhysicsConstructor.hh,v 1.3 2001/11/06 06:08:04 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VUserDetectorConstruction.hh,v 1.4 2001/07/11 10:08:33 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VUserDetectorConstruction_h
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VUserPhysicsList.hh,v 1.24 2003/05/21 21:06:00 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4VUserPhysicsList.hh,v 1.25 2003/11/03 02:16:36 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -343,16 +343,6 @@ inline G4double G4VUserPhysicsList::GetDefaultCutValue() const
|
||||
return defaultCutValue;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VUserPrimaryGeneratorAction.hh,v 1.4 2001/07/11 10:08:33 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VUserPrimaryGeneratorAction_h
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ExceptionHandler.cc,v 1.3 2003/05/21 21:06:01 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Run.cc,v 1.5 2003/04/23 17:54:31 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#include "G4Run.hh"
|
||||
|
||||
+31
-243
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunManager.cc,v 1.81 2003/06/19 13:05:13 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4RunManager.cc,v 1.83 2003/08/01 19:30:14 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -31,100 +31,63 @@
|
||||
#include "G4Timer.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4RunManagerKernel.hh"
|
||||
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4ApplicationState.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunMessenger.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4ApplicationState.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4VPersistencyManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ProcessTable.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4ExceptionHandler.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <strstream>
|
||||
|
||||
|
||||
G4RunManager* G4RunManager::fRunManager = 0;
|
||||
|
||||
G4RunManager* G4RunManager::GetRunManager()
|
||||
{ return fRunManager; }
|
||||
|
||||
//G4int G4RunManager::RegisterInteruption(int interuptionSignal)
|
||||
//{
|
||||
// if(signal(interuptionSignal,ReceiveInteruption)==SIG_ERR) return -1;
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
//void G4RunManager::ReceiveInteruption(int sig)
|
||||
//{
|
||||
// if(!fRunManager) return;
|
||||
// G4ApplicationState state
|
||||
// = G4StateManager::GetStateManager()->GetCurrentState();
|
||||
// if(state==G4State_GeomClosed || state==G4State_EventProc)
|
||||
// { fRunManager->AbortRun(true); }
|
||||
//}
|
||||
|
||||
G4RunManager::G4RunManager()
|
||||
:userDetector(0),physicsList(0),
|
||||
userRunAction(0),userPrimaryGeneratorAction(0),userEventAction(0),
|
||||
userStackingAction(0),userTrackingAction(0),userSteppingAction(0),
|
||||
geometryInitialized(false),physicsInitialized(false),cutoffInitialized(false),
|
||||
geometryInitialized(false),physicsInitialized(false),
|
||||
geometryNeedsToBeClosed(true),runAborted(false),initializedAtLeastOnce(false),
|
||||
geometryToBeOptimized(true),runIDCounter(0),verboseLevel(0),DCtable(0),
|
||||
currentRun(0),currentEvent(0),n_perviousEventsToBeStored(0),
|
||||
numberOfEventToBeProcessed(0),storeRandomNumberStatus(false),currentWorld(0)
|
||||
{
|
||||
defaultExceptionHandler = new G4ExceptionHandler();
|
||||
if(fRunManager)
|
||||
{ G4Exception("G4RunManager constructed twice."); }
|
||||
//G4UnitDefinition::BuildUnitsTable();
|
||||
fRunManager = this;
|
||||
eventManager = new G4EventManager();
|
||||
|
||||
kernel = new G4RunManagerKernel();
|
||||
eventManager = kernel->GetEventManager();
|
||||
|
||||
timer = new G4Timer();
|
||||
runMessenger = new G4RunMessenger(this);
|
||||
previousEvents = new std::vector<G4Event*>;
|
||||
defaultRegion = new G4Region("DefaultRegionForTheWorld");
|
||||
defaultRegion->SetProductionCuts(G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
|
||||
G4ParticleTable::GetParticleTable()->CreateMessenger();
|
||||
G4ProcessTable::GetProcessTable()->CreateMessenger();
|
||||
randomNumberStatusDir = "./";
|
||||
versionString = " Geant4 version $Name: geant4-05-02 $\n (27-June-2003)";
|
||||
G4cout
|
||||
<< "**********************************************" << G4endl
|
||||
<< versionString << G4endl
|
||||
<< " Copyright : Geant4 Collaboration" << G4endl
|
||||
<< "**********************************************" << G4endl;
|
||||
}
|
||||
|
||||
G4RunManager::~G4RunManager()
|
||||
{
|
||||
if(verboseLevel>0) G4cout << "G4 kernel has come to Quit state." << G4endl;
|
||||
G4StateManager* pStateManager = G4StateManager::GetStateManager();
|
||||
pStateManager->SetNewState(G4State_Quit);
|
||||
|
||||
if(verboseLevel>1) G4cout << "Deletion of G4 kernel class start." << G4endl;
|
||||
delete timer;
|
||||
delete runMessenger;
|
||||
G4GeometryManager::GetInstance()->OpenGeometry();
|
||||
physicsList->RemoveProcessManager();
|
||||
G4ParticleTable::GetParticleTable()->DeleteMessenger();
|
||||
G4ProcessTable::GetProcessTable()->DeleteMessenger();
|
||||
delete previousEvents;
|
||||
@@ -148,25 +111,9 @@ G4RunManager::~G4RunManager()
|
||||
delete userPrimaryGeneratorAction;
|
||||
if(verboseLevel>1) G4cout << "UserPrimaryGenerator deleted." << G4endl;
|
||||
}
|
||||
G4SDManager* fSDM = G4SDManager::GetSDMpointerIfExist();
|
||||
if(fSDM)
|
||||
{
|
||||
delete fSDM;
|
||||
if(verboseLevel>1) G4cout << "G4SDManager deleted." << G4endl;
|
||||
}
|
||||
delete eventManager;
|
||||
if(verboseLevel>1) G4cout << "EventManager deleted." << G4endl;
|
||||
G4UImanager* pUImanager = G4UImanager::GetUIpointer();
|
||||
{
|
||||
if(pUImanager) delete pUImanager;
|
||||
if(verboseLevel>1) G4cout << "UImanager deleted." << G4endl;
|
||||
}
|
||||
if(pStateManager)
|
||||
{
|
||||
delete pStateManager;
|
||||
if(verboseLevel>1) G4cout << "StateManager deleted." << G4endl;
|
||||
}
|
||||
delete defaultExceptionHandler;
|
||||
|
||||
delete kernel;
|
||||
|
||||
if(verboseLevel>1) G4cout << "RunManager is deleting." << G4endl;
|
||||
}
|
||||
|
||||
@@ -200,14 +147,13 @@ G4bool G4RunManager::ConfirmBeamOnCondition()
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!geometryInitialized || !physicsInitialized || !cutoffInitialized)
|
||||
if(!geometryInitialized || !physicsInitialized)
|
||||
{
|
||||
if(verboseLevel>0)
|
||||
{
|
||||
G4cout << "Start re-initialization because " << G4endl;
|
||||
if(!geometryInitialized) G4cout << " Geometry" << G4endl;
|
||||
if(!physicsInitialized) G4cout << " Physics processes" << G4endl;
|
||||
if(!cutoffInitialized) G4cout << " SetCuts" << G4endl;
|
||||
G4cout << "has been modified since last Run." << G4endl;
|
||||
}
|
||||
Initialize();
|
||||
@@ -217,33 +163,22 @@ G4bool G4RunManager::ConfirmBeamOnCondition()
|
||||
|
||||
void G4RunManager::RunInitialization()
|
||||
{
|
||||
if(!(kernel->RunInitialization())) return;
|
||||
|
||||
currentRun = 0;
|
||||
if(userRunAction) currentRun = userRunAction->GenerateRun();
|
||||
if(!currentRun) currentRun = new G4Run();
|
||||
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
stateManager->SetNewState(G4State_GeomClosed);
|
||||
currentRun->SetRunID(runIDCounter);
|
||||
currentRun->SetNumberOfEventToBeProcessed(numberOfEventToBeProcessed);
|
||||
|
||||
BuildPhysicsTables();
|
||||
|
||||
currentRun->SetDCtable(DCtable);
|
||||
G4SDManager* fSDM = G4SDManager::GetSDMpointerIfExist();
|
||||
if(fSDM)
|
||||
{ currentRun->SetHCtable(fSDM->GetHCtable()); }
|
||||
|
||||
if(userRunAction) userRunAction->BeginOfRunAction(currentRun);
|
||||
if(geometryNeedsToBeClosed)
|
||||
{
|
||||
if(verboseLevel>1) G4cout << "Start closing geometry." << G4endl;
|
||||
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
|
||||
geomManager->OpenGeometry();
|
||||
geomManager->CloseGeometry(geometryToBeOptimized, verboseLevel>1);
|
||||
geometryNeedsToBeClosed = false;
|
||||
}
|
||||
|
||||
//previousEvents->clearAndDestroy();
|
||||
for(size_t itr=0;itr<previousEvents->size();itr++)
|
||||
{ delete (*previousEvents)[itr]; }
|
||||
previousEvents->clear();
|
||||
@@ -262,8 +197,6 @@ void G4RunManager::RunInitialization()
|
||||
|
||||
void G4RunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_select)
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
|
||||
if(verboseLevel>0)
|
||||
{ timer->Start(); }
|
||||
|
||||
@@ -277,19 +210,14 @@ void G4RunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_selec
|
||||
else
|
||||
{ n_select = -1; }
|
||||
|
||||
// Event loop
|
||||
G4int i_event;
|
||||
for( i_event=0; i_event<n_event; i_event++ )
|
||||
{
|
||||
stateManager->SetNewState(G4State_EventProc);
|
||||
|
||||
currentEvent = GenerateEvent(i_event);
|
||||
|
||||
eventManager->ProcessOneEvent(currentEvent);
|
||||
|
||||
AnalyzeEvent(currentEvent);
|
||||
|
||||
if(i_event<n_select) G4UImanager::GetUIpointer()->ApplyCommand(msg);
|
||||
stateManager->SetNewState(G4State_GeomClosed);
|
||||
StackPreviousEvent(currentEvent);
|
||||
currentEvent = 0;
|
||||
if(runAborted) break;
|
||||
@@ -336,9 +264,6 @@ void G4RunManager::AnalyzeEvent(G4Event* anEvent)
|
||||
|
||||
void G4RunManager::RunTermination()
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
|
||||
//previousEvents->clearAndDestroy();
|
||||
for(size_t itr=0;itr<previousEvents->size();itr++)
|
||||
{ delete (*previousEvents)[itr]; }
|
||||
previousEvents->clear();
|
||||
@@ -351,7 +276,7 @@ void G4RunManager::RunTermination()
|
||||
currentRun = 0;
|
||||
runIDCounter++;
|
||||
|
||||
stateManager->SetNewState(G4State_Idle);
|
||||
kernel->RunTermination();
|
||||
}
|
||||
|
||||
void G4RunManager::StackPreviousEvent(G4Event* anEvent)
|
||||
@@ -379,11 +304,8 @@ void G4RunManager::Initialize()
|
||||
return;
|
||||
}
|
||||
|
||||
stateManager->SetNewState(G4State_Init);
|
||||
if(!geometryInitialized) InitializeGeometry();
|
||||
if(!physicsInitialized) InitializePhysics();
|
||||
if(!cutoffInitialized) InitializeCutOff();
|
||||
stateManager->SetNewState(G4State_Idle);
|
||||
initializedAtLeastOnce = true;
|
||||
}
|
||||
|
||||
@@ -396,7 +318,7 @@ void G4RunManager::InitializeGeometry()
|
||||
}
|
||||
|
||||
if(verboseLevel>1) G4cout << "userDetector->Construct() start." << G4endl;
|
||||
DefineWorldVolume(userDetector->Construct(),false);
|
||||
kernel->DefineWorldVolume(userDetector->Construct(),false);
|
||||
geometryInitialized = true;
|
||||
}
|
||||
|
||||
@@ -405,7 +327,7 @@ void G4RunManager::InitializePhysics()
|
||||
if(physicsList)
|
||||
{
|
||||
if(verboseLevel>1) G4cout << "physicsList->Construct() start." << G4endl;
|
||||
physicsList->Construct();
|
||||
kernel->InitializePhysics(physicsList);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -414,42 +336,6 @@ void G4RunManager::InitializePhysics()
|
||||
physicsInitialized = true;
|
||||
}
|
||||
|
||||
void G4RunManager::InitializeCutOff()
|
||||
{
|
||||
if(physicsList)
|
||||
{
|
||||
if(verboseLevel>1) G4cout << "physicsList->setCut() start." << G4endl;
|
||||
physicsList->SetCuts();
|
||||
cutoffInitialized = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4VUserPhysicsList is not defined");
|
||||
}
|
||||
}
|
||||
|
||||
void G4RunManager::BuildPhysicsTables()
|
||||
{
|
||||
UpdateRegion();
|
||||
|
||||
// Let G4ProductionCutsTable create new couples
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->UpdateCoupleTable();
|
||||
|
||||
if(G4ProductionCutsTable::GetProductionCutsTable()->IsModified())
|
||||
{
|
||||
physicsList->BuildPhysicsTable();
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->PhysicsTableUpdated();
|
||||
}
|
||||
|
||||
physicsList->DumpCutValuesTableIfRequested();
|
||||
}
|
||||
|
||||
void G4RunManager::UpdateRegion()
|
||||
{
|
||||
// Let G4RegionStore scan materials
|
||||
G4RegionStore::GetInstance()->UpdateMaterialList();
|
||||
}
|
||||
|
||||
void G4RunManager::AbortRun(G4bool softAbort)
|
||||
{
|
||||
// This method is valid only for GeomClosed or EventProc state
|
||||
@@ -489,85 +375,7 @@ void G4RunManager::AbortEvent()
|
||||
void G4RunManager::DefineWorldVolume(G4VPhysicalVolume* worldVol,
|
||||
G4bool topologyIsChanged)
|
||||
{
|
||||
// The world volume MUST NOT have a region defined by the user
|
||||
if(worldVol->GetLogicalVolume()->GetRegion())
|
||||
{
|
||||
if(worldVol->GetLogicalVolume()->GetRegion()!=defaultRegion)
|
||||
{
|
||||
G4cerr << "The world volume has a user-defined region <"
|
||||
<< worldVol->GetLogicalVolume()->GetRegion()->GetName()
|
||||
<< ">." << G4endl;
|
||||
G4Exception("G4RunManager::DefineWorldVolume",
|
||||
"RUN:WorldHasUserDefinedRegion",
|
||||
FatalException,
|
||||
"World would have a default region assigned by RunManager.");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove old world logical volume from the default region, if exist
|
||||
if(defaultRegion->GetNumberOfRootVolumes())
|
||||
{
|
||||
if(defaultRegion->GetNumberOfRootVolumes()>size_t(1))
|
||||
{
|
||||
G4Exception("G4RunManager::DefineWorldVolume",
|
||||
"RUN:DefaultRegionHasMoreThanOneVolume",
|
||||
FatalException,
|
||||
"Default world region should have a unique logical volume.");
|
||||
}
|
||||
std::vector<G4LogicalVolume*>::iterator lvItr
|
||||
= defaultRegion->GetRootLogicalVolumeIterator();
|
||||
defaultRegion->RemoveRootLogicalVolume(*lvItr);
|
||||
if(verboseLevel>1) G4cout << (*lvItr)->GetName()
|
||||
<< " is removed from the default region." << G4endl;
|
||||
}
|
||||
|
||||
// Set the default region to the world
|
||||
G4LogicalVolume* worldLog = worldVol->GetLogicalVolume();
|
||||
worldLog->SetRegion(defaultRegion);
|
||||
defaultRegion->AddRootLogicalVolume(worldLog);
|
||||
if(verboseLevel>1) G4cout << worldLog->GetName()
|
||||
<< " is registered to the default region." << G4endl;
|
||||
|
||||
// Set the world volume, notify the Navigator and reset its state
|
||||
currentWorld = worldVol;
|
||||
G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->SetWorldVolume(worldVol);
|
||||
if (topologyIsChanged) ResetNavigator();
|
||||
|
||||
// Notify the VisManager as well
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager) pVVisManager->GeometryHasChanged();
|
||||
}
|
||||
|
||||
void G4RunManager::ResetNavigator() const
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
G4ApplicationState currentState = stateManager->GetCurrentState();
|
||||
|
||||
if(!initializedAtLeastOnce) return;
|
||||
|
||||
if( currentState != G4State_Idle )
|
||||
{
|
||||
G4cerr << " Geant4 kernel not in Idle state" << G4endl;
|
||||
G4cerr << " Navigator is not touched..." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// We have to tweak the navigator's state in case a geometry has been
|
||||
// modified between runs. By the following calls we ensure that navigator's
|
||||
// state is reset properly. It is required the geometry to be closed
|
||||
// and previous optimisations to be cleared.
|
||||
|
||||
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
|
||||
if(verboseLevel>1) G4cout << "Start closing geometry." << G4endl;
|
||||
geomManager->OpenGeometry();
|
||||
geomManager->CloseGeometry(geometryToBeOptimized, verboseLevel>1);
|
||||
|
||||
G4ThreeVector center(0,0,0);
|
||||
G4Navigator* navigator =
|
||||
G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
|
||||
navigator->LocateGlobalPointAndSetup(center,0,false);
|
||||
kernel->DefineWorldVolume(worldVol,topologyIsChanged);
|
||||
}
|
||||
|
||||
void G4RunManager::rndmSaveThisRun()
|
||||
@@ -629,34 +437,14 @@ void G4RunManager::RestoreRandomNumberStatus(G4String fileN)
|
||||
|
||||
void G4RunManager::DumpRegion(G4String rname) const
|
||||
{
|
||||
G4Region* region = G4RegionStore::GetInstance()->GetRegion(rname);
|
||||
if(region) DumpRegion(region);
|
||||
kernel->UpdateRegion();
|
||||
kernel->DumpRegion(rname);
|
||||
}
|
||||
|
||||
void G4RunManager::DumpRegion(G4Region* region) const
|
||||
{
|
||||
if(!region)
|
||||
{
|
||||
for(size_t i=0;i<G4RegionStore::GetInstance()->size();i++)
|
||||
{ DumpRegion((*(G4RegionStore::GetInstance()))[i]); }
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "Region " << region->GetName() << G4endl;
|
||||
G4cout << " Materials : ";
|
||||
std::vector<G4Material*>::const_iterator mItr = region->GetMaterialIterator();
|
||||
size_t nMaterial = region->GetNumberOfMaterials();
|
||||
for(size_t iMate=0;iMate<nMaterial;iMate++)
|
||||
{
|
||||
G4cout << (*mItr)->GetName() << " ";
|
||||
mItr++;
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4ProductionCuts* cuts = region->GetProductionCuts();
|
||||
G4cout << " Production cuts : "
|
||||
<< " gamma " << G4BestUnit(cuts->GetProductionCut("gamma"),"Length")
|
||||
<< " e- " << G4BestUnit(cuts->GetProductionCut("e-"),"Length")
|
||||
<< " e+ " << G4BestUnit(cuts->GetProductionCut("e+"),"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
kernel->UpdateRegion();
|
||||
kernel->DumpRegion(region);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,369 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * 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: G4RunManagerKernel.cc,v 1.9 2003/12/09 09:13:18 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4RunManagerKernel.hh"
|
||||
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4ApplicationState.hh"
|
||||
#include "G4ExceptionHandler.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <vector>
|
||||
|
||||
G4RunManagerKernel* G4RunManagerKernel::fRunManagerKernel = 0;
|
||||
|
||||
G4RunManagerKernel* G4RunManagerKernel::GetRunManagerKernel()
|
||||
{ return fRunManagerKernel; }
|
||||
|
||||
G4RunManagerKernel::G4RunManagerKernel()
|
||||
:physicsList(0),currentWorld(0),
|
||||
geometryInitialized(false),physicsInitialized(false),
|
||||
geometryNeedsToBeClosed(true),geometryToBeOptimized(true),
|
||||
physicsNeedsToBeReBuilt(true),verboseLevel(0)
|
||||
{
|
||||
defaultExceptionHandler = new G4ExceptionHandler();
|
||||
if(fRunManagerKernel)
|
||||
{
|
||||
G4Exception("G4RunManagerKernel::G4RunManagerKernel()","MoreThanOneRunManager",
|
||||
FatalException,"More than one G4RunManagerKernel is constructed.");
|
||||
}
|
||||
fRunManagerKernel = this;
|
||||
|
||||
// construction of Geant4 kernel classes
|
||||
eventManager = new G4EventManager();
|
||||
defaultRegion = new G4Region("DefaultRegionForTheWorld");
|
||||
defaultRegion->SetProductionCuts(
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
|
||||
|
||||
// set the initial application state
|
||||
G4StateManager::GetStateManager()->SetNewState(G4State_PreInit);
|
||||
|
||||
// version banner
|
||||
versionString
|
||||
= " Geant4 version $Name: geant4-06-00 $\n (12-December-2003)";
|
||||
G4cout
|
||||
<< "**********************************************" << G4endl
|
||||
<< versionString << G4endl
|
||||
<< " Copyright : Geant4 Collaboration" << G4endl
|
||||
<< "**********************************************" << G4endl;
|
||||
}
|
||||
|
||||
G4RunManagerKernel::~G4RunManagerKernel()
|
||||
{
|
||||
// set the application state to the quite state
|
||||
if(verboseLevel>0) G4cout << "G4 kernel has come to Quit state." << G4endl;
|
||||
G4StateManager* pStateManager = G4StateManager::GetStateManager();
|
||||
pStateManager->SetNewState(G4State_Quit);
|
||||
|
||||
// open geometry for deletion
|
||||
G4GeometryManager::GetInstance()->OpenGeometry();
|
||||
|
||||
// deletion of Geant4 kernel classes
|
||||
G4SDManager* fSDM = G4SDManager::GetSDMpointerIfExist();
|
||||
if(fSDM)
|
||||
{
|
||||
delete fSDM;
|
||||
if(verboseLevel>1) G4cout << "G4SDManager deleted." << G4endl;
|
||||
}
|
||||
delete eventManager;
|
||||
if(verboseLevel>1) G4cout << "EventManager deleted." << G4endl;
|
||||
G4UImanager* pUImanager = G4UImanager::GetUIpointer();
|
||||
{
|
||||
if(pUImanager) delete pUImanager;
|
||||
if(verboseLevel>1) G4cout << "UImanager deleted." << G4endl;
|
||||
}
|
||||
delete pStateManager;
|
||||
if(verboseLevel>1) G4cout << "StateManager deleted." << G4endl;
|
||||
delete defaultExceptionHandler;
|
||||
if(verboseLevel>1) G4cout << "RunManagerKernel is deleted." << G4endl;
|
||||
}
|
||||
|
||||
void G4RunManagerKernel::DefineWorldVolume(G4VPhysicalVolume* worldVol,
|
||||
G4bool topologyIsChanged)
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
G4ApplicationState currentState = stateManager->GetCurrentState();
|
||||
if(!(currentState==G4State_Idle||currentState==G4State_PreInit))
|
||||
{
|
||||
G4Exception("G4RunManagerKernel::DefineWorldVolume",
|
||||
"DefineWorldVolumeAtIncorrectState",
|
||||
JustWarning,
|
||||
"Geant4 kernel is not PreInit or Idle state : Method ignored.");
|
||||
if(verboseLevel>1) G4cerr << "Current application state is "
|
||||
<< stateManager->GetStateString(currentState) << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// The world volume MUST NOT have a region defined by the user
|
||||
if(worldVol->GetLogicalVolume()->GetRegion())
|
||||
{
|
||||
if(worldVol->GetLogicalVolume()->GetRegion()!=defaultRegion)
|
||||
{
|
||||
G4cerr << "The world volume has a user-defined region <"
|
||||
<< worldVol->GetLogicalVolume()->GetRegion()->GetName()
|
||||
<< ">." << G4endl;
|
||||
G4Exception("G4RunManager::DefineWorldVolume",
|
||||
"RUN:WorldHasUserDefinedRegion",
|
||||
FatalException,
|
||||
"World would have a default region assigned by RunManagerKernel.");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove old world logical volume from the default region, if exist
|
||||
if(defaultRegion->GetNumberOfRootVolumes())
|
||||
{
|
||||
if(defaultRegion->GetNumberOfRootVolumes()>size_t(1))
|
||||
{
|
||||
G4Exception("G4RunManager::DefineWorldVolume",
|
||||
"DefaultRegionHasMoreThanOneVolume",
|
||||
FatalException,
|
||||
"Default world region should have a unique logical volume.");
|
||||
}
|
||||
std::vector<G4LogicalVolume*>::iterator lvItr
|
||||
= defaultRegion->GetRootLogicalVolumeIterator();
|
||||
defaultRegion->RemoveRootLogicalVolume(*lvItr);
|
||||
if(verboseLevel>1) G4cout << (*lvItr)->GetName()
|
||||
<< " is removed from the default region." << G4endl;
|
||||
}
|
||||
|
||||
// Accept the world volume
|
||||
currentWorld = worldVol;
|
||||
|
||||
// Set the default region to the world
|
||||
G4LogicalVolume* worldLog = currentWorld->GetLogicalVolume();
|
||||
worldLog->SetRegion(defaultRegion);
|
||||
defaultRegion->AddRootLogicalVolume(worldLog);
|
||||
if(verboseLevel>1) G4cout << worldLog->GetName()
|
||||
<< " is registered to the default region." << G4endl;
|
||||
|
||||
// Set the world volume, notify the Navigator and reset its state
|
||||
G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->SetWorldVolume(currentWorld);
|
||||
if(topologyIsChanged) geometryNeedsToBeClosed = true;
|
||||
|
||||
// Notify the VisManager as well
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager) pVVisManager->GeometryHasChanged();
|
||||
|
||||
geometryInitialized = true;
|
||||
if(physicsInitialized && currentState!=G4State_Idle)
|
||||
{ stateManager->SetNewState(G4State_Idle); }
|
||||
}
|
||||
|
||||
void G4RunManagerKernel::InitializePhysics(G4VUserPhysicsList* uPhys)
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
G4ApplicationState currentState = stateManager->GetCurrentState();
|
||||
if(!(currentState==G4State_Idle||currentState==G4State_PreInit))
|
||||
{
|
||||
G4Exception("G4RunManagerKernel::InitializePhysics",
|
||||
"InitializePhysicsAtIncorrectState",
|
||||
JustWarning,
|
||||
"Geant4 kernel is not PreInit or Idle state : Method ignored.");
|
||||
return;
|
||||
}
|
||||
|
||||
physicsList = uPhys;
|
||||
if(!physicsList)
|
||||
{
|
||||
G4Exception("G4RunManagerKernel::InitializePhysics",
|
||||
"PhysicsListIsNotDefined",
|
||||
FatalException,
|
||||
"G4VUserPhysicsList is not defined");
|
||||
}
|
||||
|
||||
if(verboseLevel>1) G4cout << "physicsList->Construct() start." << G4endl;
|
||||
physicsList->Construct();
|
||||
if(verboseLevel>1) G4cout << "physicsList->setCut() start." << G4endl;
|
||||
physicsList->SetCuts();
|
||||
CheckRegions();
|
||||
physicsInitialized = true;
|
||||
if(geometryInitialized && currentState!=G4State_Idle)
|
||||
{ stateManager->SetNewState(G4State_Idle); }
|
||||
}
|
||||
|
||||
G4bool G4RunManagerKernel::RunInitialization()
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
G4ApplicationState currentState = stateManager->GetCurrentState();
|
||||
|
||||
if(!geometryInitialized)
|
||||
{
|
||||
G4Exception("G4RunManagerKernel::RunInitialization",
|
||||
"GeometryHasNotYetInitialized",
|
||||
JustWarning,
|
||||
"Geometry has not yet initialized : method ignored.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!physicsInitialized)
|
||||
{
|
||||
G4Exception("G4RunManagerKernel::RunInitialization",
|
||||
"PhysicsHasNotYetInitialized",
|
||||
JustWarning,
|
||||
"Physics has not yet initialized : method ignored.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if( currentState != G4State_Idle )
|
||||
{
|
||||
G4Exception("G4RunManagerKernel::RunInitialization",
|
||||
"RunInitializationAtIncorrectState",
|
||||
JustWarning,
|
||||
"Geant4 kernel not in Idle state : method ignored.");
|
||||
return false;
|
||||
}
|
||||
|
||||
CheckRegions();
|
||||
UpdateRegion();
|
||||
BuildPhysicsTables();
|
||||
|
||||
if(geometryNeedsToBeClosed) ResetNavigator();
|
||||
|
||||
stateManager->SetNewState(G4State_GeomClosed);
|
||||
return true;
|
||||
}
|
||||
|
||||
void G4RunManagerKernel::RunTermination()
|
||||
{ G4StateManager::GetStateManager()->SetNewState(G4State_Idle); }
|
||||
|
||||
void G4RunManagerKernel::ResetNavigator()
|
||||
{
|
||||
// We have to tweak the navigator's state in case a geometry has been
|
||||
// modified between runs. By the following calls we ensure that navigator's
|
||||
// state is reset properly. It is required the geometry to be closed
|
||||
// and previous optimisations to be cleared.
|
||||
|
||||
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
|
||||
if(verboseLevel>1) G4cout << "Start closing geometry." << G4endl;
|
||||
geomManager->OpenGeometry();
|
||||
geomManager->CloseGeometry(geometryToBeOptimized, verboseLevel>1);
|
||||
|
||||
G4ThreeVector center(0,0,0);
|
||||
G4Navigator* navigator =
|
||||
G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
|
||||
navigator->LocateGlobalPointAndSetup(center,0,false);
|
||||
|
||||
geometryNeedsToBeClosed = false;
|
||||
}
|
||||
|
||||
void G4RunManagerKernel::UpdateRegion()
|
||||
{
|
||||
G4RegionStore::GetInstance()->UpdateMaterialList();
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->UpdateCoupleTable();
|
||||
}
|
||||
|
||||
void G4RunManagerKernel::BuildPhysicsTables()
|
||||
{
|
||||
if(G4ProductionCutsTable::GetProductionCutsTable()->IsModified()
|
||||
|| physicsNeedsToBeReBuilt)
|
||||
{
|
||||
physicsList->BuildPhysicsTable();
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->PhysicsTableUpdated();
|
||||
physicsNeedsToBeReBuilt = false;
|
||||
}
|
||||
|
||||
if(verboseLevel>1) DumpRegion();
|
||||
if(verboseLevel>0) physicsList->DumpCutValuesTable();
|
||||
physicsList->DumpCutValuesTableIfRequested();
|
||||
}
|
||||
|
||||
void G4RunManagerKernel::CheckRegions()
|
||||
{
|
||||
for(size_t i=0;i<G4RegionStore::GetInstance()->size();i++)
|
||||
{
|
||||
G4Region* region = (*(G4RegionStore::GetInstance()))[i];
|
||||
G4ProductionCuts* cuts = region->GetProductionCuts();
|
||||
if(!cuts)
|
||||
{
|
||||
G4cerr << "Warning : Region <" << region->GetName()
|
||||
<< "> does not have specific production cuts." << G4endl;
|
||||
G4cerr << "Default cuts are used for this region." << G4endl;
|
||||
region->SetProductionCuts(
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4RunManagerKernel::DumpRegion(G4String rname) const
|
||||
{
|
||||
G4Region* region = G4RegionStore::GetInstance()->GetRegion(rname);
|
||||
if(region) DumpRegion(region);
|
||||
}
|
||||
|
||||
void G4RunManagerKernel::DumpRegion(G4Region* region) const
|
||||
{
|
||||
if(!region)
|
||||
{
|
||||
for(size_t i=0;i<G4RegionStore::GetInstance()->size();i++)
|
||||
{ DumpRegion((*(G4RegionStore::GetInstance()))[i]); }
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << G4endl;
|
||||
G4cout << "Region " << region->GetName() << G4endl;
|
||||
G4cout << " Materials : ";
|
||||
std::vector<G4Material*>::const_iterator mItr = region->GetMaterialIterator();
|
||||
size_t nMaterial = region->GetNumberOfMaterials();
|
||||
for(size_t iMate=0;iMate<nMaterial;iMate++)
|
||||
{
|
||||
G4cout << (*mItr)->GetName() << " ";
|
||||
mItr++;
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4ProductionCuts* cuts = region->GetProductionCuts();
|
||||
if(!cuts)
|
||||
{
|
||||
G4cerr << "Warning : Region <" << region->GetName()
|
||||
<< "> does not have specific production cuts." << G4endl;
|
||||
G4cerr << "Default cuts are used for this region." << G4endl;
|
||||
region->SetProductionCuts(
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
|
||||
}
|
||||
G4cout << " Production cuts : "
|
||||
<< " gamma " << G4BestUnit(cuts->GetProductionCut("gamma"),"Length")
|
||||
<< " e- " << G4BestUnit(cuts->GetProductionCut("e-"),"Length")
|
||||
<< " e+ " << G4BestUnit(cuts->GetProductionCut("e+"),"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunMessenger.cc,v 1.18 2003/06/16 17:12:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4RunMessenger.cc,v 1.20 2003/11/04 01:58:29 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#include "G4RunMessenger.hh"
|
||||
@@ -135,12 +135,16 @@ G4RunMessenger::G4RunMessenger(G4RunManager * runMgr)
|
||||
geomCmd->SetGuidance(" first initialization (or BeamOn).");
|
||||
geomCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
physCmd = new G4UIcmdWithoutParameter("/run/physicsModified",this);
|
||||
physCmd->SetGuidance("Force all physics tables recalculated again.");
|
||||
physCmd->SetGuidance("This command must be applied");
|
||||
physCmd->SetGuidance(" if physics process has been modified after the");
|
||||
physCmd->SetGuidance(" first initialization (or BeamOn).");
|
||||
physCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
cutCmd = new G4UIcmdWithoutParameter("/run/cutoffModified",this);
|
||||
cutCmd->SetGuidance("Force closssection tables to be calculated again.");
|
||||
cutCmd->SetGuidance("This command must be applied");
|
||||
cutCmd->SetGuidance(" if cutoff value(s) have been modified after the");
|
||||
cutCmd->SetGuidance(" first initialization (or BeamOn).");
|
||||
cutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
cutCmd->SetGuidance("/run/cutoffModified becomes obsolete.");
|
||||
cutCmd->SetGuidance("It is safe to remove invoking this command.");
|
||||
|
||||
randomDirectory = new G4UIdirectory("/random/");
|
||||
randomDirectory->SetGuidance("Random number status control commands.");
|
||||
@@ -218,6 +222,7 @@ G4RunMessenger::~G4RunMessenger()
|
||||
delete abortEventCmd;
|
||||
delete initCmd;
|
||||
delete geomCmd;
|
||||
delete physCmd;
|
||||
delete cutCmd;
|
||||
delete randDirOld; delete storeRandOld; delete restoreRandOld;
|
||||
delete runDirectory;
|
||||
@@ -248,7 +253,6 @@ void G4RunMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{ runManager->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue)); }
|
||||
else if( command==dumpRegCmd )
|
||||
{
|
||||
runManager->UpdateRegion();
|
||||
if(newValue=="**ALL**")
|
||||
{ runManager->DumpRegion(); }
|
||||
else
|
||||
@@ -272,6 +276,8 @@ void G4RunMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{ runManager->Initialize(); }
|
||||
else if( command==geomCmd )
|
||||
{ runManager->GeometryHasBeenModified(); }
|
||||
else if( command==physCmd )
|
||||
{ runManager->PhysicsHasBeenModified(); }
|
||||
else if( command==cutCmd )
|
||||
{ runManager->CutOffHasBeenModified(); }
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UserPhysicsListMessenger.cc,v 1.23 2003/06/16 17:12:53 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UserRunAction.cc,v 1.6 2003/05/21 21:06:01 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VModularPhysicsList.cc,v 1.2 2002/05/29 12:11:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VPersistencyManager.cc,v 1.4 2001/07/13 15:57:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#include "G4VPersistencyManager.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VUserDetectorConstruction.cc,v 1.3 2001/07/11 10:08:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VUserPhysicsList.cc,v 1.45 2003/06/19 13:20:28 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// $Id: G4VUserPhysicsList.cc,v 1.48 2003/11/10 15:49:39 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -74,7 +74,6 @@ G4VUserPhysicsList::G4VUserPhysicsList()
|
||||
// default cut value (1.0mm)
|
||||
defaultCutValue = 1.0*mm;
|
||||
|
||||
|
||||
// pointer to the particle table
|
||||
theParticleTable = G4ParticleTable::GetParticleTable();
|
||||
theParticleIterator = theParticleTable->GetIterator();
|
||||
@@ -98,6 +97,21 @@ G4VUserPhysicsList::~G4VUserPhysicsList()
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
// set verboseLevel for G4ProductionCutsTable same as one for G4VUserPhysicsList:
|
||||
fCutsTable->SetVerboseLevel(value);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel >1){
|
||||
G4cout << "G4VUserPhysicsList::SetVerboseLevel :";
|
||||
G4cout << " Verbose level is set to " << verboseLevel << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::AddProcessManager(G4ParticleDefinition* newParticle,
|
||||
G4ProcessManager* newManager)
|
||||
@@ -202,6 +216,12 @@ void G4VUserPhysicsList::AddTransportation()
|
||||
{
|
||||
G4Transportation* theTransportationProcess= new G4Transportation();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel >2){
|
||||
G4cout << "G4VUserPhysicsList::AddTransportation() "<< G4endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// loop over all particles in G4ParticleTable
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
@@ -211,7 +231,9 @@ void G4VUserPhysicsList::AddTransportation()
|
||||
// Add transportation process for all particles other than "shortlived"
|
||||
if ( pmanager == 0) {
|
||||
// Error !! no process manager
|
||||
G4Exception("G4VUserPhysicsList::AddTransportation : no process manager!");
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4Exception("G4VUserPhysicsList::AddTransportation","No process manager",
|
||||
RunMustBeAborted, particleName );
|
||||
} else {
|
||||
// add transportation with ordering = ( -1, "first", "first" )
|
||||
pmanager ->AddProcess(theTransportationProcess);
|
||||
@@ -295,16 +317,10 @@ void G4VUserPhysicsList::SetCutsWithDefault()
|
||||
SetCutValue(cut, "e-");
|
||||
SetCutValue(cut, "e+");
|
||||
|
||||
// set cut values for proton and anti_proton
|
||||
//SetCutValue(cut, "proton");
|
||||
//SetCutValue(cut, "anti_proton");
|
||||
//SetCutValue(cut, "neutron");
|
||||
//SetCutValue(cut, "anti_neutron");
|
||||
|
||||
|
||||
//if (verboseLevel>1) {
|
||||
// DumpCutValuesTable();
|
||||
//}
|
||||
// dump Cut values if verboseLevel==3
|
||||
if (verboseLevel>2) {
|
||||
DumpCutValuesTable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +335,6 @@ void G4VUserPhysicsList::SetCutsForRegion(G4double aCut, const G4String& rname)
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::SetParticleCuts( G4double cut, G4ParticleDefinition* particle, G4Region* region)
|
||||
@@ -333,71 +348,83 @@ void G4VUserPhysicsList::SetParticleCuts( G4double cut, G4ParticleDefinition* pa
|
||||
void G4VUserPhysicsList::BuildPhysicsTable()
|
||||
{
|
||||
if (fRetrievePhysicsTable) {
|
||||
if (!fIsRestoredCutValues) fIsRestoredCutValues = fCutsTable->RetrieveCutsTable(directoryPhysicsTable, fStoredInAscii);
|
||||
// check if retrieve Cut Table successfully
|
||||
if (!fIsRestoredCutValues) {
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << "G4VUserPhysicsList::SetParticleCuts ";
|
||||
G4cout << " Retrieve Cut Values for ";
|
||||
if (verboseLevel>0){
|
||||
G4cout << "G4VUserPhysicsList::BuildPhysicsTable";
|
||||
G4cout << " Retrieve Cut Table failed !!" << G4endl;
|
||||
}
|
||||
#endif
|
||||
fIsRestoredCutValues = fCutsTable->RetrieveCutsTable(directoryPhysicsTable, fStoredInAscii);
|
||||
}
|
||||
#endif
|
||||
G4Exception("G4VUserPhysicsList::BuildPhysicsTable","Fail to Retreive",
|
||||
RunMustBeAborted,"Production Cut Table can not be retreived");
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << "G4VUserPhysicsList::BuildPhysicsTable";
|
||||
G4cout << " Retrieve Cut Table successfully " << G4endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// Sets a value to particle
|
||||
// set cut values for gamma at first and for e- and e+
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* GammaP = theParticleTable->FindParticle(particleName="gamma");
|
||||
G4ParticleDefinition* GammaP = theParticleTable->FindParticle("gamma");
|
||||
if(GammaP) BuildPhysicsTable(GammaP);
|
||||
G4ParticleDefinition* EMinusP = theParticleTable->FindParticle(particleName="e-");
|
||||
G4ParticleDefinition* EMinusP = theParticleTable->FindParticle("e-");
|
||||
if(EMinusP) BuildPhysicsTable(EMinusP);
|
||||
G4ParticleDefinition* EPlusP = theParticleTable->FindParticle(particleName="e+");
|
||||
G4ParticleDefinition* EPlusP = theParticleTable->FindParticle("e+");
|
||||
if(EPlusP) BuildPhysicsTable(EPlusP);
|
||||
G4ParticleDefinition* ProtonP = theParticleTable->FindParticle(particleName="proton");
|
||||
G4ParticleDefinition* ProtonP = theParticleTable->FindParticle("proton");
|
||||
if(ProtonP) BuildPhysicsTable(ProtonP);
|
||||
G4ParticleDefinition* AntiProtonP = theParticleTable->FindParticle(particleName="anti_proton");
|
||||
if(AntiProtonP) BuildPhysicsTable(AntiProtonP);
|
||||
G4ParticleDefinition* NeutronP = theParticleTable->FindParticle(particleName="newtron");
|
||||
if(NeutronP) BuildPhysicsTable(NeutronP);
|
||||
G4ParticleDefinition* AntiNeutronP = theParticleTable->FindParticle(particleName="anti_neutron");
|
||||
if(AntiNeutronP) BuildPhysicsTable(AntiNeutronP);
|
||||
|
||||
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
if(particle!=GammaP && particle!=EMinusP && particle!=EPlusP && particle!=ProtonP
|
||||
&& particle!=AntiProtonP && particle!=NeutronP && particle!=AntiNeutronP)
|
||||
{ BuildPhysicsTable(particle); }
|
||||
if( particle!=GammaP &&
|
||||
particle!=EMinusP &&
|
||||
particle!=EPlusP &&
|
||||
particle!=ProtonP ){
|
||||
BuildPhysicsTable(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
///////////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition* particle)
|
||||
{
|
||||
if (fRetrievePhysicsTable) {
|
||||
if ( !fIsRestoredCutValues){
|
||||
// fail to retreive cut tables
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << "G4VUserPhysicsList::BuildPhysicsTable ";
|
||||
G4cout << " Retrieve Physics Table for ";
|
||||
G4cout << particle->GetParticleName() << G4endl;
|
||||
}
|
||||
if (verboseLevel>0){
|
||||
G4cout << "G4VUserPhysicsList::BuildPhysicsTable ";
|
||||
G4cout << "Physics table can not be retreived and will be calculated "<< G4endl;
|
||||
}
|
||||
#endif
|
||||
if ( fIsRestoredCutValues){
|
||||
// Retrieve PhysicsTable from files for proccesses
|
||||
RetrievePhysicsTable(particle, directoryPhysicsTable, fStoredInAscii);
|
||||
return;
|
||||
fRetrievePhysicsTable = false;
|
||||
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << "CheckForRetrievePhysicsTable failed " << G4endl;
|
||||
G4cout << "G4VUserPhysicsList::BuildPhysicsTable ";
|
||||
G4cout << " Retrieve Physics Table for ";
|
||||
G4cout << particle->GetParticleName() << G4endl;
|
||||
}
|
||||
#endif
|
||||
// Retrieve PhysicsTable from files for proccesses
|
||||
RetrievePhysicsTable(particle, directoryPhysicsTable, fStoredInAscii);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << "G4VUserPhysicsList::BuildPhysicsTable ";
|
||||
G4cout << " for " << particle->GetParticleName() << G4endl;
|
||||
}
|
||||
if (verboseLevel>2){
|
||||
G4cout << "G4VUserPhysicsList::BuildPhysicsTable ";
|
||||
G4cout << "Calculate Physics Table for " << particle->GetParticleName() << G4endl;
|
||||
}
|
||||
#endif
|
||||
// Rebuild the physics tables for every process for this particle type
|
||||
// if particle is not ShortLived
|
||||
@@ -459,7 +486,9 @@ void G4VUserPhysicsList::DumpList() const
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::DumpCutValuesTable(G4int nParticles)
|
||||
{ fDisplayThreshold = nParticles; }
|
||||
{
|
||||
fDisplayThreshold = nParticles;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::DumpCutValuesTableIfRequested()
|
||||
@@ -480,7 +509,11 @@ G4bool G4VUserPhysicsList::StorePhysicsTable(const G4String& directory)
|
||||
else directoryPhysicsTable = dir;
|
||||
|
||||
// store CutsTable info
|
||||
if (!fCutsTable->StoreCutsTable(dir, ascii)) return false;
|
||||
if (!fCutsTable->StoreCutsTable(dir, ascii)) {
|
||||
G4Exception("G4VUserPhysicsList::StorePhysicsTable","Faile to store ",
|
||||
JustWarning,"Cut Table can not be stored");
|
||||
return false;
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << "G4VUserPhysicsList::StorePhysicsTable ";
|
||||
@@ -499,14 +532,10 @@ G4bool G4VUserPhysicsList::StorePhysicsTable(const G4String& directory)
|
||||
G4int j;
|
||||
for ( j=0; j < pVector->size(); ++j) {
|
||||
if (!(*pVector)[j]->StorePhysicsTable(particle,dir,ascii)){
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << "G4VUserPhysicsList::StorePhysicsTable ";
|
||||
G4cout << " Fail to store for ";
|
||||
G4cout << (*pVector)[j]->GetProcessName();
|
||||
G4cout << "(" << particle->GetParticleName() <<")" << G4endl;
|
||||
}
|
||||
#endif
|
||||
G4String comment = "Fail to store for " + (*pVector)[j]->GetProcessName();
|
||||
comment += "(" + particle->GetParticleName() + ")";
|
||||
G4Exception("G4VUserPhysicsList::StorePhysicsTable","Faile to store ",
|
||||
JustWarning,comment);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
@@ -546,9 +575,9 @@ void G4VUserPhysicsList::RetrievePhysicsTable(G4ParticleDefinition* particle,
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << "G4VUserPhysicsList::RetrievePhysicsTable ";
|
||||
G4cout << " Fail to retrieve for ";
|
||||
G4cout << (*pVector)[j]->GetProcessName();
|
||||
G4cout << "(" << particle->GetParticleName() <<")" << G4endl;
|
||||
G4cout << " Fail to retrieve Physics Table for ";
|
||||
G4cout << (*pVector)[j]->GetProcessName() << G4endl;
|
||||
G4cout << "Calculate Physics Table for " << particle->GetParticleName() << G4endl;
|
||||
}
|
||||
#endif
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
@@ -572,14 +601,16 @@ void G4VUserPhysicsList::ResetCuts()
|
||||
|
||||
void G4VUserPhysicsList::SetApplyCuts(G4bool value, const G4String& name)
|
||||
{
|
||||
if(name=="all")
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
G4cout << "G4VUserPhysicsList::SetApplyCuts for " << name << G4endl;
|
||||
}
|
||||
#endif
|
||||
if(name=="all") {
|
||||
theParticleTable->FindParticle("gamma")->SetApplyCutsFlag(value);
|
||||
theParticleTable->FindParticle("e-")->SetApplyCutsFlag(value);
|
||||
theParticleTable->FindParticle("e+")->SetApplyCutsFlag(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
theParticleTable->FindParticle(name)->SetApplyCutsFlag(value);
|
||||
}
|
||||
}
|
||||
@@ -592,3 +623,5 @@ G4bool G4VUserPhysicsList::GetApplyCuts(const G4String& name) const
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VUserPrimaryGeneratorAction.cc,v 1.3 2001/07/11 10:08:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-05-02 $
|
||||
// GEANT4 tag $Name: geant4-06-00 $
|
||||
//
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
Reference in New Issue
Block a user