LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
TestEm0.cc File Reference

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

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "G4UIExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the electromagnetic/TestEm0 example.

Definition in file TestEm0.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 47 of file TestEm0.cc.

47  {
48 
49  //detect interactive mode (if no arguments) and define UI session
50  G4UIExecutive* ui = 0;
51  if (argc == 1) ui = new G4UIExecutive(argc,argv);
52 
53  // Construct the default run manager
54  G4RunManager * runManager = new G4RunManager;
55 
56  // set mandatory initialization classes
59  runManager->SetUserInitialization(det = new DetectorConstruction);
60  runManager->SetUserInitialization(new PhysicsList);
61  runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
62 
63  // set user action classes
64  runManager->SetUserAction(new RunAction(det,prim));
65 
66  //get the pointer to the User Interface manager
67  G4UImanager* UImanager = G4UImanager::GetUIpointer();
68 
69  if (ui) {
70  //interactive mode
71  ui->SessionStart();
72  delete ui;
73  }
74  else {
75  //batch mode
76  G4String command = "/control/execute ";
77  G4String fileName = argv[1];
78  UImanager->ApplyCommand(command+fileName);
79  }
80 
81  //job termination
82  //
83  delete runManager;
84 }