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

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

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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the electromagnetic/TestEm18 example.

Definition in file TestEm18.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file TestEm18.cc.

58  {
59 
60  //choose the Random engine
61  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
62 
63  //my Verbose output class
64  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
65 
66  // Construct the default run manager
67  G4RunManager * runManager = new G4RunManager;
68 
69  // set mandatory initialization classes
70  DetectorConstruction* detector;
71  detector = new DetectorConstruction;
72  runManager->SetUserInitialization(detector);
73  runManager->SetUserInitialization(new PhysicsList());
74 
75  // set user action classes
76  //
77  //primaryGenerator
78  PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
79  runManager->SetUserAction(primary);
80 
81  //runAction
82  RunAction* runaction = new RunAction(detector,primary);
83  runManager->SetUserAction(runaction);
84 
85  //eventAction
86  EventAction* eventaction = new EventAction(runaction);
87  runManager->SetUserAction(eventaction);
88 
89  //stepAction
90  SteppingAction* steppingaction = new SteppingAction(runaction, eventaction);
91  runManager->SetUserAction(steppingaction);
92 
93  //stackAction
94  StackingAction* stackingaction = new StackingAction(runaction, eventaction);
95  runManager->SetUserAction(stackingaction);
96 
97  // get the pointer to the User Interface manager
98  G4UImanager* UI = G4UImanager::GetUIpointer();
99 
100  if (argc!=1) // batch mode
101  {
102  G4String command = "/control/execute ";
103  G4String fileName = argv[1];
104  UI->ApplyCommand(command+fileName);
105  }
106 
107  else //define visualization and UI terminal for interactive mode
108  {
109 #ifdef G4VIS_USE
110  G4VisManager* visManager = new G4VisExecutive;
111  visManager->Initialize();
112 #endif
113 
114 #ifdef G4UI_USE
115  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
116  ui->SessionStart();
117  delete ui;
118 #endif
119 
120 #ifdef G4VIS_USE
121  delete visManager;
122 #endif
123  }
124 
125  // job termination
126  //
127  delete runManager;
128 
129  return 0;
130 }
TConfigurablePhysicsList< ModularPhysicsList > PhysicsList
Definition: PhysicsList.h:86