Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
examplePar01.cc File Reference
#include "Par01PrimaryGeneratorAction.hh"
#include "G4GlobalFastSimulationManager.hh"
#include "Par01DetectorConstruction.hh"
#include "Par01ParallelWorldForPion.hh"
#include "Par01PhysicsList.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
#include "Par01ActionInitialization.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 77 of file examplePar01.cc.

References G4UImanager::ApplyCommand(), G4cout, G4endl, G4UImanager::GetUIpointer(), Initialize(), G4RunManager::Initialize(), G4VUserDetectorConstruction::RegisterParallelWorld(), G4UIExecutive::SessionStart(), G4MTRunManager::SetNumberOfThreads(), and G4RunManager::SetUserInitialization().

78 {
79  //-------------------------------
80  // Initialization of Run manager
81  //-------------------------------
82 #ifdef G4MULTITHREADED
83  G4MTRunManager * runManager = new G4MTRunManager;
84  runManager->SetNumberOfThreads(4);
85  G4cout<<"+-------------------------------------------------------+"<<G4endl;
86  G4cout<<"| Constructing MT run manager |"<<G4endl;
87  G4cout<<"+-------------------------------------------------------+"<<G4endl;
88 #else
89  G4RunManager * runManager = new G4RunManager;
90  G4cout<<"+-------------------------------------------------------+"<<G4endl;
91  G4cout<<"| Constructing sequential run manager |"<<G4endl;
92  G4cout<<"+-------------------------------------------------------+"<<G4endl;
93 #endif
94 
95  // Detector/mass geometry and parallel geometry(ies):
97  // -- Parallel geometry for pion parameterisation
98  detector->RegisterParallelWorld(new Par01ParallelWorldForPion("pionGhostWorld"));
99  // -- The name passed must be the same passed to the
100  // -- G4FastSimulationManagerProcess attached to the pions
101  runManager->SetUserInitialization(detector);
102 
103  // PhysicsList (including G4FastSimulationManagerProcess)
104  G4VUserPhysicsList* physicsList = new Par01PhysicsList;
105  runManager->SetUserInitialization(physicsList);
106 
107  //-------------------------------
108  // UserAction classes
109  //-------------------------------
111 
112  // Initialize Run manager
113  runManager->Initialize();
114 
115  //----------------
116  // Visualization:
117  //----------------
118 #ifdef G4VIS_USE
119  G4cout << "Instantiating Visualization Manager......." << G4endl;
120  G4VisManager* visManager = new G4VisExecutive;
121  visManager -> Initialize ();
122 #endif
123 
124  if(argc==1)
125  {
126  //--------------------------
127  // Define (G)UI
128  //--------------------------
129 #ifdef G4UI_USE
130  G4UIExecutive * ui = new G4UIExecutive(argc, argv);
131  ui->SessionStart();
132  delete ui;
133 #endif
134  }
135  else
136  {
137  G4String command = "/control/execute ";
138  G4String fileName = argv[1];
139  G4UImanager * UImanager = G4UImanager::GetUIpointer();
140  UImanager->ApplyCommand(command+fileName);
141  }
142 
143  // Free the store: user actions, physics_list and detector_description are
144  // owned and deleted by the run manager, so they should not
145  // be deleted in the main() program !
146 
147 #ifdef G4VIS_USE
148  delete visManager;
149 #endif
150  delete runManager;
151 
152  return 0;
153 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
void Initialize()
Definition: errprop.cc:96
void RegisterParallelWorld(G4VUserParallelWorld *)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4GLOB_DLL std::ostream G4cout
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419