• Main Page
  • Classes
  • Files
  • File List
  • File Members

uab_actions_root.cc

Go to the documentation of this file.
00001 
00002 // 
00003 // Program       : uab_actions_root.cc
00004 // Task          : UAB base test example + *Action classes with root output
00005 // Location      : $G4MYSIMU (See https://sbgtrac.in2p3.fr/projects/ramses/wiki/G4_MyTuto for the list of environment variables used)
00006 // Compilation   : 'cd $G4MYSIMU && make -j $NPROC' or 'rm -rf $G4TMPDIR/$G4MYSIMU_DIR $G4BINDIR/$G4MYSIMU_EXE && cd $G4MYSIMU && make -j $NPROC'  # export NPROC=$(cat /proc/cpuinfo | grep "processor.*:" | wc -l)
00007 // Execution     : 'cd $G4BINDIR ; [ ! -a $G4MYSIMU_MAC ] && ln -s $G4MYSIMU/$G4MYSIMU_MAC ; ./$G4MYSIMU_EXE $G4MYSIMU_MAC'
00008 // Output        : $G4BINDIR/uab_actions_root.heprep.zip  AND  $G4BINDIR/test.root --> In the Root prompt, type: TFile *fin = new TFile("test.root") ; tree->Draw("Ekin_MeV","Ekin_MeV>0.") ;
00009 // Documentation : See $G4MYSIMU/doc.html
00010 // Convention    : Root coding convention: TMyClass for classes, fMyVariable for class data members, kMyVariable for constants, gMyVariable for global variables
00011 // Help          : http://www.lcsim.org/software/geant4/doxygen/html/classes.html
00012 // Author        : Mathieu Trocme (mathieu.trocme@ires.in2p3.fr)
00013 // Date          : 31 Octobre 2007
00014 // Framework     : PhD thesis, CNRS/IPHC/DRS/RAMSES, Strasbourg, France
00015 // 
00016 
00017 
00018 #include "G4RunManager.hh"
00019 #include "G4VisExecutive.hh"
00020 #include "G4UImanager.hh"
00021 
00022 #include "TUAB_DetectorConstruction.hh"
00023 #include "TUAB_PhysicsList.hh"
00024 #include "TUAB_PrimaryGeneratorAction.hh"
00025 
00026 #include "TUAB_RunAction.hh"
00027 #include "TUAB_EventAction.hh"
00028 #include "TUAB_SteppingAction.hh"
00029 
00030 #include "globals.hh"  /// includes G4ios, G4Types, G4String, G4PhysicalConstants, G4SystemOfUnits, G4ExceptionSeverity, templates & algorithm
00031 
00032 
00033 int main (void)
00034 {       
00035 
00036    /// Run manager
00037 
00038    G4RunManager* runManager = new G4RunManager() ;  
00039 
00040       /// Geometry, Physics and Source
00041    TUAB_DetectorConstruction   *theTUAB_DetectorConstruction   = new TUAB_DetectorConstruction   ()                      ; runManager->SetUserInitialization ( theTUAB_DetectorConstruction   ) ;  
00042    TUAB_PhysicsList            *theTUAB_PhysicsList            = new TUAB_PhysicsList            ()                      ; runManager->SetUserInitialization ( theTUAB_PhysicsList            ) ; 
00043    TUAB_PrimaryGeneratorAction *theTUAB_PrimaryGeneratorAction = new TUAB_PrimaryGeneratorAction ()                      ; runManager->SetUserAction         ( theTUAB_PrimaryGeneratorAction ) ;
00044 
00045       /// Analysis
00046    TUAB_RunAction              *theTUAB_RunAction              = new TUAB_RunAction              ()                      ; runManager->SetUserAction         ( theTUAB_RunAction              ) ; 
00047    TUAB_EventAction            *theTUAB_EventAction            = new TUAB_EventAction            ( theTUAB_RunAction   ) ; runManager->SetUserAction         ( theTUAB_EventAction            ) ; 
00048    TUAB_SteppingAction         *theTUAB_SteppingAction         = new TUAB_SteppingAction         ( theTUAB_EventAction ) ; runManager->SetUserAction         ( theTUAB_SteppingAction         ) ; 
00049 
00050    runManager->Initialize() ;    
00051 
00052    /// Visualization manager  
00053 
00054    G4VisManager *visManager = new G4VisExecutive ();
00055    visManager->Initialize (); 
00056 
00057    /// UI manager 
00058 
00059    G4UImanager* UI = G4UImanager::GetUIpointer() ;  
00060    UI->ApplyCommand("/control/execute uab_actions_root.mac") ; 
00061 
00062    /// Cleaning...   
00063 
00064    delete visManager ; 
00065    delete runManager ;  
00066 
00067    return (0) ;  
00068 }