LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 //
28 //
29 
30 #include "eRositaDetectorConstruction.hh"
31 #include "eRositaPhysicsList.hh"
32 #include "eRositaPrimaryGeneratorAction.hh"
33 #include "eRositaRunAction.hh"
34 #include "eRositaEventAction.hh"
35 #include "eRositaSteppingAction.hh"
36 #include "eRositaSteppingVerbose.hh"
37 
38 #include "G4RunManager.hh"
39 #include "G4UImanager.hh"
40 
41 #include "G4VisExecutive.hh"
42 
43 #include "G4UIExecutive.hh"
44 
45 
46 int main(int argc,char** argv)
47 {
48  // User Verbose output class
49  //
50  G4VSteppingVerbose* verbosity = new eRositaSteppingVerbose;
51  G4VSteppingVerbose::SetInstance(verbosity);
52 
53  // Run manager
54  //
55  G4RunManager* runManager = new G4RunManager;
56 
57  // User Initialization classes (mandatory)
58  //
59  eRositaDetectorConstruction* detector = new eRositaDetectorConstruction;
60  runManager->SetUserInitialization(detector);
61  //
62  G4VUserPhysicsList* physics = new eRositaPhysicsList;
63  runManager->SetUserInitialization(physics);
64 
65  // User Action classes
66  //
67  G4VUserPrimaryGeneratorAction* genAction = new eRositaPrimaryGeneratorAction();
68  runManager->SetUserAction(genAction);
69  //
70  G4UserRunAction* runAction = new eRositaRunAction;
71  runManager->SetUserAction(runAction);
72  //
73  G4UserEventAction* eventAction = new eRositaEventAction;
74  runManager->SetUserAction(eventAction);
75  //
76  G4UserSteppingAction* steppingAction = new eRositaSteppingAction;
77  runManager->SetUserAction(steppingAction);
78 
79  // Initialize G4 kernel
80  //
81  runManager->Initialize();
82 
83  // Get the pointer to the User Interface manager
84  //
85  G4UImanager * UImanager = G4UImanager::GetUIpointer();
86 
87  if (argc!=1) // batch mode
88  {
89  G4String command = "/control/execute ";
90  G4String fileName = argv[1];
91  UImanager->ApplyCommand(command+fileName);
92  }
93 
94  else // interactive mode : define visualization and UI terminal
95  {
96 
97  G4VisManager* visManager = new G4VisExecutive;
98  visManager->Initialize();
99 
100  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
101  UImanager->ApplyCommand("/control/execute vis.mac");
102  ui->SessionStart();
103  delete ui;
104 
105  delete visManager;
106 
107  }
108 
109  // Free the store: user actions, physics_list and detector_description are
110  // owned and deleted by the run manager, so they should not
111  // be deleted in the main() program !
112 
113  delete runManager;
114  delete verbosity;
115 
116  return 0;
117 }
118 
119 
int main(int argc, char **argv)
Definition: eRosita.cc:46