Geant4  10.02.p01
eRosita.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id$
28 //
29 //
30 
32 #include "eRositaPhysicsList.hh"
34 #include "eRositaRunAction.hh"
35 #include "eRositaEventAction.hh"
36 #include "eRositaSteppingAction.hh"
38 
39 #include "G4RunManager.hh"
40 #include "G4UImanager.hh"
41 
42 #ifdef G4VIS_USE
43 #include "G4VisExecutive.hh"
44 #endif
45 
46 #ifdef G4UI_USE
47 #include "G4UIExecutive.hh"
48 #endif
49 
50 
51 int main(int argc,char** argv)
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 }
127 
128 
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
int main(int argc, char **argv)
Definition: eRosita.cc:51
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
virtual void SetUserAction(G4UserRunAction *userAction)