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

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

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

Definition in file TestEm7.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 51 of file TestEm7.cc.

References track.

51  {
52 
53  //detect interactive mode (if no arguments) and define UI session
54  G4UIExecutive* ui = nullptr;
55  if (argc == 1) ui = new G4UIExecutive(argc,argv);
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
67  //
69  PhysicsList* phys = new PhysicsList();
70 
71  runManager->SetUserInitialization(det);
72  runManager->SetUserInitialization(phys);
73 
74  //set user action classes
75  //
77  RunAction* run = new RunAction(det,phys,kin);
78  TrackingAction* track = new TrackingAction(det,run);
79  SteppingAction* step = new SteppingAction(det,run);
80 
81  runManager->SetUserAction(kin);
82  runManager->SetUserAction(run);
83  runManager->SetUserAction(track);
84  runManager->SetUserAction(step);
85 
86  //initialize visualization
87  G4VisManager* visManager = nullptr;
88 
89  //get the pointer to the User Interface manager
90  G4UImanager* UImanager = G4UImanager::GetUIpointer();
91 
92  if (ui) {
93  //interactive mode
94  visManager = new G4VisExecutive;
95  visManager->Initialize();
96  UImanager->ApplyCommand("/control/execute vis.mac");
97  ui->SessionStart();
98  delete ui;
99  }
100  else {
101  //batch mode
102  G4String command = "/control/execute ";
103  G4String fileName = argv[1];
104  UImanager->ApplyCommand(command+fileName);
105  }
106 
107  //job termination
108  delete visManager;
109  delete runManager;
110 }
TConfigurablePhysicsList< ModularPhysicsList > PhysicsList
Definition: PhysicsList.h:83
Float_t track
Definition: plot.C:35