LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.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 49 of file TestEm15.cc.

49  {
50 
51  //detect interactive mode (if no arguments) and define UI session
52  G4UIExecutive* ui = nullptr;
53  if (argc == 1) ui = new G4UIExecutive(argc,argv);
54 
55  //my Verbose output class
56  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
57 
58  //construct the default run manager
59  G4RunManager * runManager = new G4RunManager;
60 
61  //set mandatory initialization classes
64  runManager->SetUserInitialization(det = new DetectorConstruction);
65  runManager->SetUserInitialization(new PhysicsList);
66  runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
67 
68  //set user action classes
69  RunAction* run;
70  runManager->SetUserAction(run = new RunAction(det,prim));
71  runManager->SetUserAction(new SteppingAction(det,run));
72 
73  //initialize visualization
74  G4VisManager* visManager = nullptr;
75 
76  //get the pointer to the User Interface manager
77  G4UImanager* UImanager = G4UImanager::GetUIpointer();
78 
79  if (ui) {
80  //interactive mode
81  visManager = new G4VisExecutive;
82  visManager->Initialize();
83  ui->SessionStart();
84  delete ui;
85  }
86  else {
87  //batch mode
88  G4String command = "/control/execute ";
89  G4String fileName = argv[1];
90  UImanager->ApplyCommand(command+fileName);
91  }
92 
93  //job termination
94  delete visManager;
95  delete runManager;
96 }