Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:08

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 //
0026 /// \file scavenger.cc
0027 /// \brief Scavenger example
0028 
0029 #include "ActionInitialization.hh"
0030 #include "DetectorConstruction.hh"
0031 #include "PhysicsList.hh"
0032 
0033 #ifdef G4MULTITHREADED
0034 #  include "G4MTRunManager.hh"
0035 #else
0036 #  include "G4RunManager.hh"
0037 #endif
0038 #include "G4UIExecutive.hh"
0039 #include "G4UImanager.hh"
0040 #include "G4VisExecutive.hh"
0041 
0042 using namespace scavenger;
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0045 
0046 int main(int argc, char** argv)
0047 {
0048   G4UIExecutive* pUi = nullptr;
0049   if (argc == 1) {
0050     pUi = new G4UIExecutive(argc, argv);
0051   }
0052 
0053   if (argc > 2) {
0054     G4int change_seed(0);
0055     change_seed = std::stoi(argv[2]);
0056     long enterseed = change_seed;
0057     G4Random::setTheSeed(enterseed);
0058     G4Random::showEngineStatus();
0059     G4cout << "Used seed : " << change_seed << G4endl;
0060   }
0061 
0062 #ifdef G4MULTITHREADED
0063   std::unique_ptr<G4MTRunManager> pRunManager(new G4MTRunManager);
0064   pRunManager->SetNumberOfThreads(2);  // by default
0065 #else
0066   std::unique_ptr<G4RunManager> pRunManager(new G4RunManager);
0067 #endif
0068 
0069   // Set mandatory initialization classes
0070   pRunManager->SetUserInitialization(new PhysicsList());
0071   pRunManager->SetUserInitialization(new DetectorConstruction());
0072   pRunManager->SetUserInitialization(new ActionInitialization());
0073 
0074   // visualization
0075   std::unique_ptr<G4VisManager> pVisuManager(new G4VisExecutive);
0076   pVisuManager->Initialize();
0077 
0078   // Get the pointer to the User Interface manager
0079   auto pUImanager = G4UImanager::GetUIpointer();
0080 
0081   // Bash mode : define UI session
0082   if (pUi == nullptr) {
0083     // batch mode
0084     pUImanager->ApplyCommand("/control/macroPath ../");
0085     G4String command = "/control/execute ";
0086     G4String fileName = argv[1];
0087     pUImanager->ApplyCommand(command + fileName);
0088   }
0089   else {
0090     // interactive mode
0091     pUImanager->ApplyCommand("/control/execute vis.mac");
0092     pUi->SessionStart();
0093     delete pUi;
0094   }
0095   return 0;
0096 }
0097 
0098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......