Geant4  10.00.p03
textGeom.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 // $Id: textGeom.cc 76481 2013-11-11 10:49:21Z gcosmo $
27 //
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
37 #include "ExTGPhysicsList.hh"
40 
41 #ifdef G4MULTITHREADED
42 #include "G4MTRunManager.hh"
43 #else
44 #include "G4RunManager.hh"
45 #endif
46 
47 #include "G4UImanager.hh"
48 
49 #ifdef G4VIS_USE
50 #include "G4VisExecutive.hh"
51 #endif
52 
53 #ifdef G4UI_USE
54 #include "G4UIExecutive.hh"
55 #endif
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
59 int main(int argc,char** argv)
60 {
61  // Run manager
62  //
63 #ifdef G4MULTITHREADED
64  G4MTRunManager* runManager = new G4MTRunManager;
65  runManager->SetNumberOfThreads(1);
66 #else
67  G4RunManager* runManager = new G4RunManager;
68 #endif
69 
70  // User Initialization classes (mandatory)
71  //
73 
74  //
75  runManager->SetUserInitialization(new ExTGPhysicsList);
76 
77  // User Action classes
78  //
79  //MT runManager->SetUserAction(new ExTGPrimaryGeneratorAction);
80 
82 
83  // Run action that dumps GEANT4 in-memory geometry to text file
84  //MT runManager->SetUserAction(new ExTGRunAction);
85 
86  // Initialize G4 kernel
87  //
88  // runManager->Initialize();
89 
90  // Get the pointer to the User Interface manager
91  //
92  G4UImanager * UImanager = G4UImanager::GetUIpointer();
93 
94 #ifdef G4VIS_USE
95  G4VisManager* visManager = new G4VisExecutive;
96  visManager->Initialize();
97 #endif
98 
99  if (argc!=1) // batch mode
100  {
101  G4String command = "/control/execute ";
102  G4String fileName = argv[1];
103  UImanager->ApplyCommand(command+fileName);
104  }
105  else // interactive mode : define visualization and UI terminal
106  {
107 #ifdef G4UI_USE
108  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
109 #ifdef G4VIS_USE
110  UImanager->ApplyCommand("/control/execute run.mac");
111 #endif
112  ui->SessionStart();
113  delete ui;
114 #endif
115  }
116 
117  // Free the store: user actions, physics_list and detector_description are
118  // owned and deleted by the run manager, so they should not
119  // be deleted in the main() program !
120 
121 #ifdef G4VIS_USE
122  delete visManager;
123 #endif
124  delete runManager;
125 
126  return 0;
127 }
128 
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130 
Definition of the ActionInitialization class.
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
int main(int argc, char **argv)
Definition: textGeom.cc:59
Detector construction class using text geometry file.
void SetNumberOfThreads(G4int n)
Definition of the ExTGPrimaryGeneratorAction class.
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
Definition of the ExTGDetectorConstructionWithCuts class.
Definition of the ExTGDetectorConstructionWithCpp class.
Definition of the ExTGDetectorConstructionWithSD class.
Definition of the ExTGDetectorConstruction class.
void Initialize()
Action initialization class.
Modular physics list.
Definition of the ExTGPhysicsList class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432