Loading...
Searching...
No Matches
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//
27/// \file persistency/P03/textGeom.cc
28/// \brief Main program of the persistency/P03 example
29//
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "G4Types.hh"
33
38#include "G4GenericPhysicsList.hh"
41
42#include "G4RunManagerFactory.hh"
43
44#include "G4UImanager.hh"
45
46#include "G4VisExecutive.hh"
47#include "G4UIExecutive.hh"
48
49//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50
51int main(int argc,char** argv)
52{
53 // Instantiate G4UIExecutive if interactive mode
54 G4UIExecutive* ui = nullptr;
55 if ( argc == 1 ) {
56 ui = new G4UIExecutive(argc, argv);
57 }
58
59 // Run manager
60 //
61 auto* runManager = G4RunManagerFactory::CreateRunManager();
62 runManager->SetNumberOfThreads(1);
63
64 // User Initialization classes (mandatory)
65 //
66 runManager->SetUserInitialization(new ExTGDetectorConstruction);
67
68 //
69 std::vector<G4String>* MyConstr = new std::vector<G4String>;
70 MyConstr->push_back("G4EmStandardPhysics");
71 G4VModularPhysicsList* phys = new G4GenericPhysicsList(MyConstr);
72 runManager->SetUserInitialization(phys);
73
74 // User Action classes
75 //
76 //MT runManager->SetUserAction(new ExTGPrimaryGeneratorAction);
77
78 runManager->SetUserInitialization(new ExTGActionInitialization);
79
80 // Run action that dumps GEANT4 in-memory geometry to text file
81 //MT runManager->SetUserAction(new ExTGRunAction);
82
83 // Initialize G4 kernel
84 //
85 // runManager->Initialize();
86
87 // Get the pointer to the User Interface manager
88 //
89 G4UImanager * UImanager = G4UImanager::GetUIpointer();
90
91 if (!ui) // batch mode
92 {
93 G4String command = "/control/execute ";
94 G4String fileName = argv[1];
95 UImanager->ApplyCommand(command+fileName);
96 }
97 else // interactive mode : define visualization and UI terminal
98 {
99 G4VisManager* visManager = new G4VisExecutive;
100 visManager->Initialize();
101
102 UImanager->ApplyCommand("/control/execute run.mac");
103 ui->SessionStart();
104 delete ui;
105 delete visManager;
106 }
107
108 // Free the store: user actions, physics_list and detector_description are
109 // owned and deleted by the run manager, so they should not
110 // be deleted in the main() program !
111
112 delete runManager;
113
114 return 0;
115}
116
117//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
118
Definition of the ActionInitialization class.
Definition of the ExTGDetectorConstructionWithCpp class.
Definition of the ExTGDetectorConstructionWithCuts class.
Definition of the ExTGDetectorConstructionWithSD class.
Definition of the ExTGDetectorConstruction class.
Definition of the ExTGPrimaryGeneratorAction class.
Action initialization class.
Detector construction class using text geometry file.
int main()
Definition testCommon.cc:47

Applications | User Support | Publications | Collaboration