LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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 "G4RunManager.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

int main ( int  argc,
char **  argv 
)

Definition at line 55 of file textGeom.cc.

56 {
57  // Instantiate G4UIExecutive if interactive mode
58  G4UIExecutive* ui = nullptr;
59  if ( argc == 1 ) {
60  ui = new G4UIExecutive(argc, argv);
61  }
62 
63  // Run manager
64  //
65 #ifdef G4MULTITHREADED
66  G4MTRunManager* runManager = new G4MTRunManager;
67  runManager->SetNumberOfThreads(1);
68 #else
69  G4RunManager* runManager = new G4RunManager;
70 #endif
71 
72  // User Initialization classes (mandatory)
73  //
74  runManager->SetUserInitialization(new ExTGDetectorConstruction);
75 
76  //
77  std::vector<G4String>* MyConstr = new std::vector<G4String>;
78  MyConstr->push_back("G4EmStandardPhysics");
79  G4VModularPhysicsList* phys = new G4GenericPhysicsList(MyConstr);
80  runManager->SetUserInitialization(phys);
81 
82  // User Action classes
83  //
84  //MT runManager->SetUserAction(new ExTGPrimaryGeneratorAction);
85 
86  runManager->SetUserInitialization(new ExTGActionInitialization);
87 
88  // Run action that dumps GEANT4 in-memory geometry to text file
89  //MT runManager->SetUserAction(new ExTGRunAction);
90 
91  // Initialize G4 kernel
92  //
93  // runManager->Initialize();
94 
95  // Get the pointer to the User Interface manager
96  //
97  G4UImanager * UImanager = G4UImanager::GetUIpointer();
98 
99  G4VisManager* visManager = new G4VisExecutive;
100  visManager->Initialize();
101 
102  if (!ui) // 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  UImanager->ApplyCommand("/control/execute run.mac");
111  ui->SessionStart();
112  delete ui;
113  }
114 
115  // Free the store: user actions, physics_list and detector_description are
116  // owned and deleted by the run manager, so they should not
117  // be deleted in the main() program !
118 
119  delete visManager;
120  delete runManager;
121 
122  return 0;
123 }