Examples AnaEx01 and AnaEx02 show the usage of histogram and tuple manipulations using G4Analysis and ROOT compliant systems on the same scenario. All analysis manipulations (histo booking, filling, saving histos in a file, etc...) are located in one class : HistoManager, implementation of which is different in each example. All the other classes are same in all three examples.
This example shows the usage of histogram and tuple manipulations using ROOT system. Please install ROOT before building this example: http://root.cern.ch
The example is an adaptation of examples/novice/N03. It describes a simple sampling calorimeter setup.
The calorimeter is a box made of a given number of layers. A layer consists of an absorber plate and of a detection gap. The layer is replicated.
Six parameters define the calorimeter :
The default geometry is constructed in DetectorConstruction class, but all of the above parameters can be modified interactively via the commands defined in the DetectorMessenger class.
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->| | | | | ========================================================================== || | || | || | || || | || | || | || beam || absorber | gap || absorber | gap || absorber | gap || ======> || | || | || | || || | || | || | || ==========================================================================
The particle's type and the physic processes which will be available in this example are set in the FTFP_BERT physics list.
A newly introduced class, ActionInitialization, instantiates and registers to Geant4 kernel all user action classes which are defined thread-local and a run action class which is defined both thread-local and global.
The thread-local action classes are defined in ActionInitialization::Build() and the global run action class is defined in ActionInitialization::BuildForMaster(). Note that ActionInitialization::Build() is also used to instatiate user action clasess in sequential mode.
The primary kinematic consists of a single particle which hits the calorimeter perpendicular to the input face. The type of the particle and its energy are set in the PrimaryGeneratorAction class, and can be changed via the G4 build-in commands of ParticleGun class.
To produce histograms, ROOT system must be installed
AnaEx02 can produce 4 histograms :
And 2 Ntuples :
These histos and ntuples are booked in HistoManager and filled from EventAction.
One can control the name of the histograms file :
See HistoManager constructor
An additional step is needed when building the example with GNUmake due to using the extra shared directory:
% cd path_to_AnaEx02/AnaEx02 % gmake setup % gmake
This will copy the files from shared in the example include and src; to remove these files:
% gmake clean_setup
% ./AnaEx02 and type in the commands from run.mac line by line: Idle> /control/verbose 2 Idle> /tracking/verbose 1 Idle> /run/beamOn 10 Idle> ... Idle> exitor
Idle> /control/execute run.mac .... Idle> exit
% ./AnaEx02 run.mac % ./AnaEx02 run.mac > run.out
The AnaEx02.in macro is used in Geant4 testing.