LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
examplePar02.cc File Reference
#include "G4UImanager.hh"
#include "G4RunManager.hh"
#include "Par02DetectorConstruction.hh"
#include "Par02PhysicsList.hh"
#include "Par02ActionInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 63 of file examplePar02.cc.

63  {
64 
65  //-------------------------------
66  // Initialization of Run manager
67  //-------------------------------
68  #ifdef G4MULTITHREADED
69  G4MTRunManager* runManager = new G4MTRunManager;
70  runManager->SetNumberOfThreads(4);
71  G4cout<<"+-------------------------------------------------------+"<<G4endl;
72  G4cout<<"| Constructing MT run manager |"<<G4endl;
73  G4cout<<"+-------------------------------------------------------+"<<G4endl;
74  #else
75  G4RunManager* runManager = new G4RunManager;
76  G4cout<<"+-------------------------------------------------------+"<<G4endl;
77  G4cout<<"| Constructing sequential run manager |"<<G4endl;
78  G4cout<<"+-------------------------------------------------------+"<<G4endl;
79  #endif
80 
81  // Detector/mass geometry:
82  G4VUserDetectorConstruction* detector = new Par02DetectorConstruction();
83  runManager->SetUserInitialization( detector );
84 
85  // PhysicsList (including G4FastSimulationManagerProcess)
86  G4VUserPhysicsList* physicsList = new Par02PhysicsList;
87  runManager->SetUserInitialization( physicsList );
88 
89  //-------------------------------
90  // UserAction classes
91  //-------------------------------
92  runManager->SetUserInitialization( new Par02ActionInitialization );
93 
94  // Initialize Run manager
95  runManager->Initialize();
96 
97  //----------------
98  // Visualization:
99  //----------------
100  #ifdef G4VIS_USE
101  G4cout << "Instantiating Visualization Manager......." << G4endl;
102  G4VisManager* visManager = new G4VisExecutive;
103  visManager->Initialize();
104  #endif
105 
106  if ( argc == 1 ) {
107  //--------------------------
108  // Define (G)UI
109  //--------------------------
110  #ifdef G4UI_USE
111  G4UIExecutive * ui = new G4UIExecutive( argc, argv );
112  ui->SessionStart();
113  delete ui;
114  #endif
115  } else {
116  G4String command = "/control/execute ";
117  G4String fileName = argv[1];
118  G4UImanager * UImanager = G4UImanager::GetUIpointer();
119  UImanager->ApplyCommand( command+fileName );
120  }
121 
122  // Free the store: user actions, physics_list and detector_description are
123  // owned and deleted by the run manager, so they should not
124  // be deleted in the main() program !
125 
126  #ifdef G4VIS_USE
127  delete visManager;
128  #endif
129  delete runManager;
130 
131  return 0;
132 }