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

Main program of the electromagnetic/TestEm15 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"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the electromagnetic/TestEm15 example.

Definition in file TestEm15.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 55 of file TestEm15.cc.

55  {
56 
57  //choose the Random engine
58  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
59 
60  //my Verbose output class
61  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
62 
63  // Construct the default run manager
64  G4RunManager * runManager = new G4RunManager;
65 
66  // set mandatory initialization classes
69  runManager->SetUserInitialization(det = new DetectorConstruction);
70  runManager->SetUserInitialization(new PhysicsList);
71  runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
72 
73  // set user action classes
74  RunAction* run;
75  runManager->SetUserAction(run = new RunAction(det,prim));
76  runManager->SetUserAction(new SteppingAction(det,run));
77 
78  // get the pointer to the User Interface manager
79  G4UImanager* UI = G4UImanager::GetUIpointer();
80 
81  if (argc!=1) // batch mode
82  {
83  G4String command = "/control/execute ";
84  G4String fileName = argv[1];
85  UI->ApplyCommand(command+fileName);
86  }
87 
88  else //define visualization and UI terminal for interactive mode
89  {
90 #ifdef G4VIS_USE
91  G4VisManager* visManager = new G4VisExecutive;
92  visManager->Initialize();
93 #endif
94 
95 #ifdef G4UI_USE
96  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
97  ui->SessionStart();
98  delete ui;
99 #endif
100 
101 #ifdef G4VIS_USE
102  delete visManager;
103 #endif
104  }
105 
106  // job termination
107  //
108  delete runManager;
109 
110  return 0;
111 }