Loading...
Searching...
No Matches
Functions
textGeom.cc File Reference

Main program of the persistency/P03 example. More...

#include "G4Types.hh"
#include "ExTGDetectorConstruction.hh"
#include "ExTGDetectorConstructionWithSD.hh"
#include "ExTGDetectorConstructionWithCpp.hh"
#include "ExTGDetectorConstructionWithCuts.hh"
#include "G4GenericPhysicsList.hh"
#include "ExTGPrimaryGeneratorAction.hh"
#include "ExTGActionInitialization.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the persistency/P03 example.

Definition in file textGeom.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 51 of file textGeom.cc.

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}
Action initialization class.
Detector construction class using text geometry file.

Applications | User Support | Publications | Collaboration