Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
eRosita.cc File Reference
#include "eRositaDetectorConstruction.hh"
#include "eRositaPhysicsList.hh"
#include "eRositaPrimaryGeneratorAction.hh"
#include "eRositaRunAction.hh"
#include "eRositaEventAction.hh"
#include "eRositaSteppingAction.hh"
#include "eRositaSteppingVerbose.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"

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 51 of file eRosita.cc.

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

52 {
53  // User Verbose output class
54  //
57 
58  // Run manager
59  //
60  G4RunManager* runManager = new G4RunManager;
61 
62  // User Initialization classes (mandatory)
63  //
65  runManager->SetUserInitialization(detector);
66  //
68  runManager->SetUserInitialization(physics);
69 
70  // User Action classes
71  //
73  runManager->SetUserAction(genAction);
74  //
75  G4UserRunAction* runAction = new eRositaRunAction;
76  runManager->SetUserAction(runAction);
77  //
78  G4UserEventAction* eventAction = new eRositaEventAction;
79  runManager->SetUserAction(eventAction);
80  //
81  G4UserSteppingAction* steppingAction = new eRositaSteppingAction;
82  runManager->SetUserAction(steppingAction);
83 
84  // Initialize G4 kernel
85  //
86  runManager->Initialize();
87 
88  // Get the pointer to the User Interface manager
89  //
90  G4UImanager * UImanager = G4UImanager::GetUIpointer();
91 
92  if (argc!=1) // batch mode
93  {
94  G4String command = "/control/execute ";
95  G4String fileName = argv[1];
96  UImanager->ApplyCommand(command+fileName);
97  }
98 
99  else // interactive mode : define visualization and UI terminal
100  {
101 #ifdef G4VIS_USE
102  G4VisManager* visManager = new G4VisExecutive;
103  visManager->Initialize();
104 #endif
105 
106 #ifdef G4UI_USE
107  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
108  UImanager->ApplyCommand("/control/execute vis.mac");
109  ui->SessionStart();
110  delete ui;
111 #endif
112 
113 #ifdef G4VIS_USE
114  delete visManager;
115 #endif
116  }
117 
118  // Free the store: user actions, physics_list and detector_description are
119  // owned and deleted by the run manager, so they should not
120  // be deleted in the main() program !
121 
122  delete runManager;
123  delete verbosity;
124 
125  return 0;
126 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)