Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
TestEm10.cc File Reference

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

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "Em10DetectorConstruction.hh"
#include "Em10PhysicsList.hh"
#include "Em10PrimaryGeneratorAction.hh"
#include "Em10RunAction.hh"
#include "Em10EventAction.hh"
#include "Em10SteppingAction.hh"
#include "Em10SteppingVerbose.hh"
#include "Em10TrackingAction.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 60 of file TestEm10.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4VSteppingVerbose::SetInstance(), CLHEP::HepRandom::setTheEngine(), G4RunManager::SetUserAction(), and G4RunManager::SetUserInitialization().

61 {
62 
63  //choose the Random engine
64 
66 
67  //my Verbose output class
68 
70 
71  // Construct the default run manager
72 
73  G4RunManager * runManager = new G4RunManager;
74 
75  // set mandatory initialization classes
76 
77  Em10DetectorConstruction* detector;
78  detector = new Em10DetectorConstruction;
79 
80  // ALICEDetectorConstruction* detector;
81  // detector = new ALICEDetectorConstruction;
82 
83  runManager->SetUserInitialization(detector);
84  runManager->SetUserInitialization(new Em10PhysicsList(detector));
85 
86  // set user action classes
87  runManager->SetUserAction(new Em10PrimaryGeneratorAction(detector));
88 
89  Em10RunAction* runAction = new Em10RunAction;
90 
91  runManager->SetUserAction(runAction);
92 
93  Em10EventAction* eventAction = new Em10EventAction(runAction);
94 
95  runManager->SetUserAction(eventAction);
96 
97  Em10SteppingAction* steppingAction = new Em10SteppingAction(eventAction,
98  runAction);
99  runManager->SetUserAction(steppingAction);
100 
101 
102  runManager->SetUserAction( new Em10TrackingAction );
103 
104 
106 
107  if (argc!=1) // batch mode
108  {
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  UI->ApplyCommand(command+fileName);
112  }
113 
114  else //define visualization and UI terminal for interactive mode
115  {
116 #ifdef G4VIS_USE
117  G4VisManager* visManager = new G4VisExecutive;
118  visManager->Initialize();
119 #endif
120 
121 #ifdef G4UI_USE
122  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
123  ui->SessionStart();
124  delete ui;
125 #endif
126 
127 #ifdef G4VIS_USE
128  delete visManager;
129 #endif
130  }
131 
132  // job termination
133  //
134  delete runManager;
135 
136  return 0;
137 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:170
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)