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

Main program of the electromagnetic/TestEm10 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 "StackingAction.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/TestEm10 example.

Definition in file TestEm10.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 51 of file TestEm10.cc.

52 {
53 
54  //detect interactive mode (if no arguments) and define UI session
55  G4UIExecutive* ui = nullptr;
56  if (argc == 1) ui = new G4UIExecutive(argc,argv);
57 
58  //choose the Random engine
59  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
60 
61  //construct the default run manager
62  G4RunManager * runManager = new G4RunManager;
63 
64  //set mandatory initialization classes
65  DetectorConstruction* detector;
66  detector = new DetectorConstruction;
67 
68  // ALICEDetectorConstruction* detector;
69  // detector = new ALICEDetectorConstruction;
70 
71  runManager->SetUserInitialization(detector);
72  runManager->SetUserInitialization(new PhysicsList(detector));
73 
74  //set user action classes
75  runManager->SetUserAction(new PrimaryGeneratorAction());
76 
77  RunAction* runAction = new RunAction;
78  runManager->SetUserAction(runAction);
79 
80  EventAction* eventAction = new EventAction(runAction);
81  runManager->SetUserAction(eventAction);
82 
83  runManager->SetUserAction( new StackingAction );
84 
85  //initialize visualization
86  G4VisManager* visManager = nullptr;
87 
88  //get the pointer to the User Interface manager
89  G4UImanager* UImanager = G4UImanager::GetUIpointer();
90 
91  if (ui) {
92  //interactive mode
93  visManager = new G4VisExecutive;
94  visManager->Initialize();
95  ui->SessionStart();
96  delete ui;
97  }
98  else {
99  //batch mode
100  G4String command = "/control/execute ";
101  G4String fileName = argv[1];
102  UImanager->ApplyCommand(command+fileName);
103  }
104 
105  //job termination
106  delete visManager;
107  delete runManager;
108 }
TConfigurablePhysicsList< ModularPhysicsList > PhysicsList
Definition: PhysicsList.h:83