Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:19:55

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 
0027 #include "eRositaActionInitialization.hh"
0028 #include "eRositaDetectorConstruction.hh"
0029 #include "eRositaEventAction.hh"
0030 #include "eRositaPhysicsList.hh"
0031 #include "eRositaPrimaryGeneratorAction.hh"
0032 #include "eRositaRunAction.hh"
0033 #include "eRositaSteppingAction.hh"
0034 #include "eRositaSteppingVerbose.hh"
0035 
0036 #include "G4RunManagerFactory.hh"
0037 #include "G4UIExecutive.hh"
0038 #include "G4UImanager.hh"
0039 #include "G4VisExecutive.hh"
0040 
0041 auto main(int argumentCount, char** argumentVector) -> int
0042 {
0043     // User verbose output class
0044     //
0045     auto *verbosity = new eRositaSteppingVerbose();
0046     G4VSteppingVerbose::SetInstance(verbosity);
0047 
0048     // Run manager
0049     //
0050     auto *runManager = G4RunManagerFactory::CreateRunManager();
0051 
0052     constexpr auto NUMBER_OF_THREADS{4};
0053     runManager->SetNumberOfThreads(NUMBER_OF_THREADS);
0054 
0055     G4cout << "***********************" << G4endl;
0056     G4cout << "** Seed: " << G4Random::getTheSeed() << " **" << G4endl;
0057     G4cout << "***********************" << G4endl;
0058 
0059     runManager->SetUserInitialization(new eRositaDetectorConstruction);
0060     runManager->SetUserInitialization(new eRositaPhysicsList);
0061     runManager->SetUserInitialization(new eRositaActionInitialization());
0062 
0063     // Initialize GEANT4 kernel
0064     //
0065     runManager->Initialize();
0066 
0067     // Get the pointer to the User Interface (UI) manager
0068     //
0069     auto *userInterfaceManager = G4UImanager::GetUIpointer();
0070 
0071     if (argumentCount != 1) { // batch mode
0072         G4String command = "/control/execute ";
0073         G4String fileName = argumentVector[1];
0074         userInterfaceManager->ApplyCommand(command + fileName);
0075     } else { // interactive mode : define visualization and UI terminal
0076         auto *visualizationManager = new G4VisExecutive;
0077         visualizationManager->Initialize();
0078 
0079         auto *userInterface = new G4UIExecutive(argumentCount, argumentVector);
0080         userInterfaceManager->ApplyCommand("/control/execute vis.mac");
0081         userInterface->SessionStart();
0082         
0083         delete userInterface;
0084         delete visualizationManager;
0085     }
0086 
0087     // Free the store:
0088     // user actions, physics list and detector description are
0089     // owned and deleted by the run manager,
0090     // so they should not be deleted in the main() program!
0091 
0092     delete runManager;
0093     delete verbosity;
0094 
0095     return 0;
0096 }