Run 3. Basic concept of Run In Geant4, Run is the largest unit of simulation. A run consists of a sequence of events. Within a run, the detector geometry, the set up of sensitive detectors, and the physics processes used in the simulation should be kept unchanged. A run is represented by a G4Run class object. Representation of a run G4Run represents a run.
|Published (Last):||13 September 2005|
|PDF File Size:||5.20 Mb|
|ePub File Size:||2.76 Mb|
|Price:||Free* [*Free Regsitration Required]|
Run 3. Basic concept of Run In Geant4, Run is the largest unit of simulation. A run consists of a sequence of events. Within a run, the detector geometry, the set up of sensitive detectors, and the physics processes used in the simulation should be kept unchanged. A run is represented by a G4Run class object. Representation of a run G4Run represents a run. It has a run identification number, which should be set by the user, and the number of events simulated during the run.
These tables are associated in case sensitive detectors and digitizer modules are simulated, respectively. G4Run has two virtual methods, and thus you can extend G4Run class. In particular if you use Geant4 in multi-threaded mode and need to accumulate values, these two virtual method must be overwritten to specify how such values should be collected firstly for a worker thread, and then for the entire run.
These virtual methods are the following. At the end of the implementation, G4Run base-class method for must be invoked for recording data members in the base class. At the end of the implementation, G4Run base-class method for must be invoked for merging data members in the base class.
Manage the run procedures G4RunManager manages the procedures of a run. In the constructor of G4RunManager, all of the manager classes in Geant4 kernel, except for some static managers, are constructed. These managers are deleted in the destructor of G4RunManager. The assignments of these user classes are done by SetUserInitialization methods. G4RunManager has several public methods, which are listed below.
Initialize All initializations required by the Geant4 kernel are triggered by this method. This method is thus mandatory before proceeding to the first run. This method will be invoked automatically for the second and later runs in case some of the initialized quantities need to be updated. BeamOn G4int numberOfEvent This method triggers the actual simulation of a run, that is, an event loop. It takes an integer argument which represents the number of events to be simulated. GetCurrentEvent This method returns the pointer to the G4Event object which is currently being simulated.
This method is available only when an event is being processed. At this moment, the application state of Geant4, which is explained in the following sub-section, is "EventProc". When Geant4 is in a state other than "EventProc", this method returns null. This method must be invoked before proceeding to BeamOn. A pointer to a const object is returned. Otherwise, this method returns null. AbortRun This method should be invoked whenever the processing of a run must be stopped. It is valid for GeomClosed and EventProc states.
Run processing will be safely aborted even in the midst of processing an event. However, the last event of the aborted run will be incomplete and should not be used for further analysis. It returns the pointer to the G4WorkerRunManager of the local thread when it is invoked from thread-local object. It returns the pointer to the base G4RunManager if it is used in the sequential mode. From a worker thread, the user may access to, for example, detector construction it is a shared class through this GetMasterRunManager method.
This base class has three virtual methods as follows: GenerateRun This method is invoked at the beginning of the BeamOn method but after confirmation of the conditions of the Geant4 kernel. This method should be used to instantiate a user-specific run class object.
BeginOfRunAction This method is invoked at the beginning of the BeamOn method but after confirmation of the conditions of the Geant4 kernel. Geant4 as a state machine Geant4 is designed as a state machine. Some methods in Geant4 are available for only a certain state s. G4RunManager controls the state changes of the Geant4 application. States of Geant4 are represented by the enumeration G4ApplicationState.
It has six states through the life cycle of a Geant4 application. The application needs to be initialized when it is in this state. Methods defined in any user initialization classes are invoked during this state. Geometry, physics processes, and cut-off cannot be changed during run processing. Managers of the Geant4 kernel are being deleted and thus the application cannot come back to any other state. The user still has a hook to do some "safe" opperations, e.
When abortion is suppressed, you will still get error messages issued by G4Exception, and there is NO guarantee of a correct result after the G4Exception error message. G4StateManager belongs to the intercoms category. For example, the user can store histograms when G4Exception occurs and Geant4 comes to the Abort state, but before the actual core dump. The following is an example user code which stores histograms when Geant4 becomes to the Abort state. This class object should be mabe in, for example main , by the user code.
This object will be automatically registered to G4StateManager at its construction. Customizing the Run Manager 3. Virtual Methods in the Run Manager G4RunManager is a concrete class with a complete set of functionalities for managing the Geant4 kernel.
For this purpose, G4RunManager has various virtual methods which provide all the functionalities required to handle the Geant4 kernel. Hence, your customized run manager need only override the methods particular to your needs; the remaining methods in G4RunManager base class can still be used. A summary of the available methods is presented here: public: virtual void Initialize ; main entry point of Geant4 kernel initialization protected: virtual void InitializeGeometry ;.
Hands On 1: Setting Up the Environment
There is no exercise tar-ball for this first hands on since we use Geant4 code base. We are going to use Geant4 Version We are going to use Geant4 and related libraries pre-installed on the CNL central computer farm. You do not need to manually install Geant4 during this tutorial, however we review here some options and give some details on the installation process.
Geant4 Tutorials and Applications