Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examplePar02.cc File Reference
Include dependency graph for examplePar02.cc:

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:
83  runManager->SetUserInitialization( detector );
84 
85  // PhysicsList (including G4FastSimulationManagerProcess)
86  G4VUserPhysicsList* physicsList = new Par02PhysicsList;
87  runManager->SetUserInitialization( physicsList );
88 
89  //-------------------------------
90  // UserAction classes
91  //-------------------------------
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 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
void Initialize()
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: