Back to home page

EIC code displayed by LXR

 
 

    


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

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 runAndEvent/RE04/RE04.cc
0027 /// \brief Main program of the runAndEvent/RE04 example
0028 //
0029 //
0030 #include "FTFP_BERT.hh"
0031 #include "RE04ActionInitialization.hh"
0032 #include "RE04DetectorConstruction.hh"
0033 #include "RE04ParallelWorldConstruction.hh"
0034 
0035 #include "G4ParallelWorldPhysics.hh"
0036 #include "G4RunManagerFactory.hh"
0037 #include "G4ScoringManager.hh"
0038 #include "G4Types.hh"
0039 #include "G4UIExecutive.hh"
0040 #include "G4UImanager.hh"
0041 #include "G4VisExecutive.hh"
0042 
0043 int main(int argc, char** argv)
0044 {
0045   // Instantiate G4UIExecutive if there are no arguments (interactive mode)
0046   G4UIExecutive* ui = nullptr;
0047   if (argc == 1) {
0048     ui = new G4UIExecutive(argc, argv);
0049   }
0050 
0051   // Construct the run manager
0052   auto* runManager = G4RunManagerFactory::CreateRunManager();
0053 
0054   G4ScoringManager::GetScoringManager();
0055 
0056   G4String paraWorldName = "ParallelWorld";
0057 
0058   // Set mandatory initialization classes
0059   //
0060   RE04DetectorConstruction* realWorld = new RE04DetectorConstruction;
0061   RE04ParallelWorldConstruction* parallelWorld = new RE04ParallelWorldConstruction(paraWorldName);
0062   realWorld->RegisterParallelWorld(parallelWorld);
0063   runManager->SetUserInitialization(realWorld);
0064   //
0065   G4VModularPhysicsList* physicsList = new FTFP_BERT;
0066   physicsList->RegisterPhysics(new G4ParallelWorldPhysics(paraWorldName, true));
0067   runManager->SetUserInitialization(physicsList);
0068 
0069   // Set user action classes
0070   //
0071   runManager->SetUserInitialization(new RE04ActionInitialization);
0072 
0073   // Visualization manager
0074   //
0075   G4VisManager* visManager = new G4VisExecutive;
0076   visManager->Initialize();
0077 
0078   // Initialize G4 kernel
0079   //
0080   runManager->Initialize();
0081 
0082   // Get the pointer to the User Interface manager
0083   //
0084   G4UImanager* pUImanager = G4UImanager::GetUIpointer();
0085 
0086   if (ui)  // Define UI session for interactive mode
0087   {
0088     pUImanager->ApplyCommand("/control/execute vis.mac");
0089     ui->SessionStart();
0090     delete ui;
0091   }
0092   else  // Batch mode
0093   {
0094     G4String command = "/control/execute ";
0095     G4String fileName = argv[1];
0096     pUImanager->ApplyCommand(command + fileName);
0097   }
0098 
0099   delete visManager;
0100   delete runManager;
0101 
0102   return 0;
0103 }