LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
TestEm17.cc File Reference

Main program of the electromagnetic/TestEm17 example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"
#include "StackingAction.hh"
#include "HistoManager.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the electromagnetic/TestEm17 example.

Definition in file TestEm17.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file TestEm17.cc.

59  {
60 
61  //choose the Random engine
62  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
63 
64  //my Verbose output class
65  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
66 
67  // Construct the default run manager
68  G4RunManager * runManager = new G4RunManager;
69 
70  // set mandatory initialization classes
73  runManager->SetUserInitialization(det = new DetectorConstruction);
74  runManager->SetUserInitialization(new PhysicsList);
75  runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
76 
77  HistoManager* histo = new HistoManager();
78 
79  // set user action classes
80  RunAction* run;
81  runManager->SetUserAction(run = new RunAction(det,prim,histo));
82  runManager->SetUserAction(new SteppingAction(run,histo));
83  runManager->SetUserAction(new StackingAction);
84 
85  // Start execution
86  //
87  if (argc > 1) { // execute an argument macro file if exist
88  G4String command = "/control/execute ";
89  G4String fileName = argv[1];
90  G4UImanager::GetUIpointer()->ApplyCommand(command+fileName);
91 
92  } else { // start interactive session
93 #ifdef G4VIS_USE
94  G4VisManager* visManager = new G4VisExecutive;
95  visManager->Initialize();
96 #endif
97 
98 #ifdef G4UI_USE
99  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
100  ui->SessionStart();
101  delete ui;
102 #endif
103 
104 #ifdef G4VIS_USE
105  delete visManager;
106 #endif
107  }
108 
109  // job termination
110  //
111  delete histo;
112  delete runManager;
113 
114  return 0;
115 }