Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-13 08:28:26

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 /// @file exMPI02.cc
0026 //
0027 /// @brief A MPI example code
0028 
0029 #include "G4MPImanager.hh"
0030 #include "G4MPIsession.hh"
0031 
0032 #ifdef G4MULTITHREADED
0033 #  include "G4MTRunManager.hh"
0034 #else
0035 #  include "G4RunManager.hh"
0036 #endif
0037 
0038 #include "ActionInitialization.hh"
0039 #include "DetectorConstruction.hh"
0040 #include "FTFP_BERT.hh"
0041 
0042 #include "G4ScoringManager.hh"
0043 #include "G4UImanager.hh"
0044 #include "G4VisExecutive.hh"
0045 int main(int argc, char** argv)
0046 {
0047   // --------------------------------------------------------------------
0048   // MPI session
0049   // --------------------------------------------------------------------
0050   // At first, G4MPImanager/G4MPIsession should be created.
0051   G4MPImanager* g4MPI = new G4MPImanager(argc, argv);
0052 
0053   // MPI session (G4MPIsession) instead of G4UIterminal
0054   // Terminal availability depends on your MPI implementation.
0055   G4MPIsession* session = g4MPI->GetMPIsession();
0056 
0057   // LAM/MPI users can use G4tcsh.
0058   G4String prompt = "";
0059   prompt += "G4MPI";
0060   prompt += "(%s)[%/]:";
0061   session->SetPrompt(prompt);
0062 
0063   // --------------------------------------------------------------------
0064   // user application setting
0065   // --------------------------------------------------------------------
0066 #ifdef G4MULTITHREADED_DISABLE  // ROOT ISSUES WITH MT, SEE exMPI03 FOR A MT
0067   G4MTRunManager* runManager = new G4MTRunManager();
0068   runManager->SetNumberOfThreads(4);
0069 #else
0070   G4RunManager* runManager = new G4RunManager();
0071 #endif
0072 
0073   // setup your application
0074   runManager->SetUserInitialization(new DetectorConstruction);
0075   runManager->SetUserInitialization(new FTFP_BERT);
0076   runManager->SetUserInitialization(new ActionInitialization);
0077 
0078   runManager->Initialize();
0079 
0080   G4VisExecutive* visManager = new G4VisExecutive;
0081   visManager->Initialize();
0082   G4cout << G4endl;
0083 
0084   // --------------------------------------------------------------------
0085   // ready for go
0086   // MPIsession treats both interactive and batch modes.
0087   // Just start your session as below.
0088   // --------------------------------------------------------------------
0089   session->SessionStart();
0090 
0091   // --------------------------------------------------------------------
0092   // termination
0093   // --------------------------------------------------------------------
0094   delete visManager;
0095 
0096   delete g4MPI;
0097 
0098   delete runManager;
0099 
0100   return EXIT_SUCCESS;
0101 }