LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
textGeom.cc File Reference

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

#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"

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 59 of file textGeom.cc.

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  //
72  runManager->SetUserInitialization(new ExTGDetectorConstruction);
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 
84  runManager->SetUserInitialization(new ExTGActionInitialization);
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 }