Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
XrayTel.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "XrayTelDetectorConstruction.hh"
#include "XrayTelPhysicsList.hh"
#include "XrayTelRunAction.hh"
#include "XrayTelSteppingAction.hh"
#include "XrayTelPrimaryGeneratorAction.hh"
#include <vector>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 97 of file XrayTel.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4RunManager::SetUserAction(), and G4RunManager::SetUserInitialization().

98 {
99  // Construct the default run manager
100  G4RunManager * runManager = new G4RunManager;
101 
102  // set mandatory initialization classes
104  runManager->SetUserInitialization(new XrayTelPhysicsList);
105 
106  // set mandatory user action class
108  runManager->SetUserAction(new XrayTelRunAction);
109  runManager->SetUserAction(new XrayTelSteppingAction);
110 
111 #ifdef G4VIS_USE
112  // visualization manager
113  G4VisManager* visManager = new G4VisExecutive;
114  visManager->Initialize();
115 #endif
116 
117  //Initialize G4 kernel
118  runManager->Initialize();
119 
120  // get the pointer to the User Interface manager
121  G4UImanager *UImanager = G4UImanager::GetUIpointer();
122  if ( argc==1 ){
123 #ifdef G4UI_USE
124  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
125 #ifdef G4VIS_USE
126  UImanager->ApplyCommand("/control/execute vis.mac");
127 #endif
128  ui->SessionStart();
129  delete ui;
130 #endif
131  }
132  else {
133  // Create a pointer to the User Interface manager
134  G4String command = "/control/execute ";
135  for (int i=2; i<=argc; i++) {
136  G4String macroFileName = argv[i-1];
137  UImanager->ApplyCommand(command+macroFileName);
138  }
139  }
140 
141  // job termination
142 #ifdef G4VIS_USE
143  delete visManager;
144 #endif
145  delete runManager;
146  return 0;
147 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)