LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
TestEm6.cc File Reference

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

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "SteppingVerbose.hh"
#include "RunAction.hh"
#include "SteppingAction.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/TestEm6 example.

Definition in file TestEm6.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 57 of file TestEm6.cc.

57  {
58 
59  //choose the Random engine
60  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
61 
62  //my Verbose output class
63  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
64 
65  //Construct the default run manager
66  G4RunManager * runManager = new G4RunManager;
67 
68  //set mandatory initialization classes
70  runManager->SetUserInitialization(det = new DetectorConstruction);
71  runManager->SetUserInitialization(new PhysicsList);
72  runManager->SetUserAction(new PrimaryGeneratorAction(det));
73 
74  //set user action classes
75  RunAction* RunAct;
76 
77  runManager->SetUserAction(RunAct = new RunAction(det));
78  runManager->SetUserAction(new SteppingAction(RunAct));
79  runManager->SetUserAction(new StackingAction);
80 
81  //get the pointer to the User Interface manager
82  G4UImanager* UI = G4UImanager::GetUIpointer();
83 
84  if (argc!=1) // batch mode
85  {
86  G4String command = "/control/execute ";
87  G4String fileName = argv[1];
88  UI->ApplyCommand(command+fileName);
89  }
90 
91  else //define visualization and UI terminal for interactive mode
92  {
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 runManager;
112 
113  return 0;
114 }