ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
exMPI01.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file exMPI01.cc
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 // ********************************************************************
26 //
28 
29 #include "G4MPImanager.hh"
30 #include "G4MPIsession.hh"
31 
32 #ifdef G4MULTITHREADED
33 #include "G4MTRunManager.hh"
34 #else
35 #include "G4RunManager.hh"
36 #endif
37 
38 #include "G4UImanager.hh"
39 
40 #include "G4VisExecutive.hh"
41 
42 #include "ActionInitialization.hh"
43 #include "DetectorConstruction.hh"
44 #include "FTFP_BERT.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
48 int main(int argc, char** argv)
49 {
50  // random engine
51  CLHEP::MTwistEngine randomEngine;
52  G4Random::setTheEngine(&randomEngine);
53 
54  // --------------------------------------------------------------------
55  // MPI session
56  // --------------------------------------------------------------------
57  // At first, G4MPImanager/G4MPIsession should be created.
58  G4MPImanager* g4MPI = new G4MPImanager(argc, argv);
59 
60  // MPI session (G4MPIsession) instead of G4UIterminal
61  // Terminal availability depends on your MPI implementation.
62  G4MPIsession* session = g4MPI-> GetMPIsession();
63 
64  // LAM/MPI users can use G4tcsh.
65  G4String prompt = "";
66  prompt += "G4MPI";
67  prompt += "(%s)[%/]:";
68  session-> SetPrompt(prompt);
69 
70  // --------------------------------------------------------------------
71  // user application setting
72  // --------------------------------------------------------------------
73 #ifdef G4MULTITHREADED
74  G4MTRunManager* runManager = new G4MTRunManager();
75  runManager-> SetNumberOfThreads(4);
76 #else
77  G4RunManager* runManager = new G4RunManager();
78 #endif
79 
80  // setup your application
81  runManager-> SetUserInitialization(new DetectorConstruction);
82  runManager-> SetUserInitialization(new FTFP_BERT);
83  runManager-> SetUserInitialization(new ActionInitialization);
84 
85  runManager-> Initialize();
86 
87  G4VisExecutive* visManager = new G4VisExecutive;
88  visManager-> Initialize();
89  G4cout << G4endl;
90 
91  // --------------------------------------------------------------------
92  // ready for go
93  // MPIsession treats both interactive and batch modes.
94  // Just start your session as below.
95  // --------------------------------------------------------------------
96  session-> SessionStart();
97 
98  // --------------------------------------------------------------------
99  // termination
100  // --------------------------------------------------------------------
101  delete visManager;
102 
103  delete g4MPI;
104 
105  delete runManager;
106 
107  return EXIT_SUCCESS;
108 }