| 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 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | // $Id: exMPI02.cc,v 1.1 2007/11/16 14:28:34 kmura Exp $
|
|---|
| 27 | // $Name: geant4-09-03-cand-01 $
|
|---|
| 28 | //
|
|---|
| 29 | // ====================================================================
|
|---|
| 30 | // exMPI02.cc
|
|---|
| 31 | //
|
|---|
| 32 | // 2007 Q
|
|---|
| 33 | // ====================================================================
|
|---|
| 34 | #include "G4RunManager.hh"
|
|---|
| 35 | #include "G4UImanager.hh"
|
|---|
| 36 |
|
|---|
| 37 | // my application
|
|---|
| 38 | #include "DetectorConstruction.hh"
|
|---|
| 39 | #include "MedicalBeam.hh"
|
|---|
| 40 | #include "QGSP_BIC.hh"
|
|---|
| 41 | #include "RunAction.hh"
|
|---|
| 42 | #include "EventAction.hh"
|
|---|
| 43 |
|
|---|
| 44 | // MPI session
|
|---|
| 45 | #include "G4MPImanager.hh"
|
|---|
| 46 | #include "G4MPIsession.hh"
|
|---|
| 47 | #include "G4UItcsh.hh"
|
|---|
| 48 |
|
|---|
| 49 | #ifdef G4VIS_USE
|
|---|
| 50 | #include "G4VisExecutive.hh"
|
|---|
| 51 | #endif
|
|---|
| 52 |
|
|---|
| 53 | int main(int argc,char** argv)
|
|---|
| 54 | {
|
|---|
| 55 | // random engine
|
|---|
| 56 | //CLHEP::Ranlux64Engine randomEngine;
|
|---|
| 57 | //CLHEP::HepRandom::setTheEngine(&randomEngine);
|
|---|
| 58 |
|
|---|
| 59 | // --------------------------------------------------------------------
|
|---|
| 60 | // MPI session
|
|---|
| 61 | // --------------------------------------------------------------------
|
|---|
| 62 | // At first, G4MPImanager/G4MPIsession should be created.
|
|---|
| 63 | G4MPImanager* g4MPI= new G4MPImanager(argc,argv);
|
|---|
| 64 |
|
|---|
| 65 | // MPI session (G4MPIsession) instead of G4UIterminal
|
|---|
| 66 | // Terminal availability depends on your MPI implementation.
|
|---|
| 67 | G4MPIsession* session= g4MPI-> GetMPIsession();
|
|---|
| 68 |
|
|---|
| 69 | // LAM/MPI users can use G4tcsh.
|
|---|
| 70 | G4String prompt= "[40;01;33m";
|
|---|
| 71 | prompt+= "G4MPI";
|
|---|
| 72 | prompt+= "[40;31m(%s)[40;36m[%/][00;30m:";
|
|---|
| 73 |
|
|---|
| 74 | G4UItcsh* tcsh= new G4UItcsh(prompt);
|
|---|
| 75 | tcsh-> SetLsColor(BLUE,RED);
|
|---|
| 76 | session-> SetShell(tcsh);
|
|---|
| 77 |
|
|---|
| 78 | // --------------------------------------------------------------------
|
|---|
| 79 | // user application setting
|
|---|
| 80 | // --------------------------------------------------------------------
|
|---|
| 81 | G4RunManager* runManager= new G4RunManager();
|
|---|
| 82 |
|
|---|
| 83 | // setup your application
|
|---|
| 84 | runManager-> SetUserInitialization(new DetectorConstruction);
|
|---|
| 85 | runManager-> SetUserInitialization(new QGSP_BIC);
|
|---|
| 86 | runManager-> SetUserAction(new MedicalBeam);
|
|---|
| 87 | runManager-> SetUserAction(new RunAction);
|
|---|
| 88 | runManager-> SetUserAction(new EventAction);
|
|---|
| 89 |
|
|---|
| 90 | runManager-> Initialize();
|
|---|
| 91 |
|
|---|
| 92 | #ifdef G4VIS_USE
|
|---|
| 93 | G4VisExecutive* visManager= new G4VisExecutive;
|
|---|
| 94 | visManager-> Initialize();
|
|---|
| 95 | G4cout << G4endl;
|
|---|
| 96 | #endif
|
|---|
| 97 |
|
|---|
| 98 | // --------------------------------------------------------------------
|
|---|
| 99 | // ready for go
|
|---|
| 100 | // MPIsession treats both interactive and batch modes.
|
|---|
| 101 | // Just start your session as below.
|
|---|
| 102 | // --------------------------------------------------------------------
|
|---|
| 103 | session-> SessionStart();
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 | // termination
|
|---|
| 107 | #ifdef G4VIS_USE
|
|---|
| 108 | delete visManager;
|
|---|
| 109 | #endif
|
|---|
| 110 |
|
|---|
| 111 | delete g4MPI;
|
|---|
| 112 |
|
|---|
| 113 | delete runManager;
|
|---|
| 114 |
|
|---|
| 115 | return 0;
|
|---|
| 116 | }
|
|---|