Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exMPI02.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
27 
28 #include "G4RunManager.hh"
29 #include "G4UImanager.hh"
30 
31 // my application
32 #include "DetectorConstruction.hh"
33 #include "MedicalBeam.hh"
34 #include "FTFP_BERT.hh"
35 #include "RunAction.hh"
36 #include "EventAction.hh"
37 
38 // MPI session
39 #include "G4MPImanager.hh"
40 #include "G4MPIsession.hh"
41 
42 #ifdef G4VIS_USE
43 #include "G4VisExecutive.hh"
44 #endif
45 
46 int main(int argc, char** argv)
47 {
48  // random engine
49  //CLHEP::Ranlux64Engine randomEngine;
50  //CLHEP::HepRandom::setTheEngine(&randomEngine);
51 
52  // --------------------------------------------------------------------
53  // MPI session
54  // --------------------------------------------------------------------
55  // At first, G4MPImanager/G4MPIsession should be created.
56  G4MPImanager* g4MPI = new G4MPImanager(argc, argv);
57 
58  // MPI session (G4MPIsession) instead of G4UIterminal
59  // Terminal availability depends on your MPI implementation.
60  G4MPIsession* session = g4MPI-> GetMPIsession();
61 
62  // LAM/MPI users can use G4tcsh.
63  G4String prompt = "";
64  prompt += "G4MPI";
65  prompt += "(%s)[%/]:";
66  session-> SetPrompt(prompt);
67 
68  // --------------------------------------------------------------------
69  // user application setting
70  // --------------------------------------------------------------------
71  G4RunManager* runManager= new G4RunManager();
72 
73  // setup your application
74  runManager-> SetUserInitialization(new DetectorConstruction);
75  runManager-> SetUserInitialization(new FTFP_BERT);
76  runManager-> SetUserAction(new MedicalBeam);
77  runManager-> SetUserAction(new RunAction);
78  runManager-> SetUserAction(new EventAction);
79 
80  runManager-> Initialize();
81 
82 #ifdef G4VIS_USE
83  G4VisExecutive* visManager = new G4VisExecutive;
84  visManager-> Initialize();
85  G4cout << G4endl;
86 #endif
87 
88  // --------------------------------------------------------------------
89  // ready for go
90  // MPIsession treats both interactive and batch modes.
91  // Just start your session as below.
92  // --------------------------------------------------------------------
93  session-> SessionStart();
94 
95 
96  // termination
97 #ifdef G4VIS_USE
98  delete visManager;
99 #endif
100 
101  delete g4MPI;
102 
103  delete runManager;
104 
105  return 0;
106 }