Geant4  10.01.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 83430 2014-08-21 15:48:43Z gcosmo $
27 //
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
37 #include "G4GenericPhysicsList.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  std::vector<G4String>* MyConstr = new std::vector<G4String>;
76  MyConstr->push_back("G4EmStandardPhysics");
77  G4VModularPhysicsList* phys = new G4GenericPhysicsList(MyConstr);
78  runManager->SetUserInitialization(phys);
79 
80  // User Action classes
81  //
82  //MT runManager->SetUserAction(new ExTGPrimaryGeneratorAction);
83 
85 
86  // Run action that dumps GEANT4 in-memory geometry to text file
87  //MT runManager->SetUserAction(new ExTGRunAction);
88 
89  // Initialize G4 kernel
90  //
91  // runManager->Initialize();
92 
93  // Get the pointer to the User Interface manager
94  //
95  G4UImanager * UImanager = G4UImanager::GetUIpointer();
96 
97 #ifdef G4VIS_USE
98  G4VisManager* visManager = new G4VisExecutive;
99  visManager->Initialize();
100 #endif
101 
102  if (argc!=1) // batch mode
103  {
104  G4String command = "/control/execute ";
105  G4String fileName = argv[1];
106  UImanager->ApplyCommand(command+fileName);
107  }
108  else // interactive mode : define visualization and UI terminal
109  {
110 #ifdef G4UI_USE
111  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
112 #ifdef G4VIS_USE
113  UImanager->ApplyCommand("/control/execute run.mac");
114 #endif
115  ui->SessionStart();
116  delete ui;
117 #endif
118  }
119 
120  // Free the store: user actions, physics_list and detector_description are
121  // owned and deleted by the run manager, so they should not
122  // be deleted in the main() program !
123 
124 #ifdef G4VIS_USE
125  delete visManager;
126 #endif
127  delete runManager;
128 
129  return 0;
130 }
131 
132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133 
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()
TG4GenericPhysicsList< G4VModularPhysicsList > G4GenericPhysicsList
Action initialization class.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432