Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 26 27 #include "eRositaActionInitialization.hh" 27 #include "eRositaActionInitialization.hh" 28 #include "eRositaDetectorConstruction.hh" 28 #include "eRositaDetectorConstruction.hh" 29 #include "eRositaEventAction.hh" 29 #include "eRositaEventAction.hh" 30 #include "eRositaPhysicsList.hh" 30 #include "eRositaPhysicsList.hh" 31 #include "eRositaPrimaryGeneratorAction.hh" 31 #include "eRositaPrimaryGeneratorAction.hh" 32 #include "eRositaRunAction.hh" 32 #include "eRositaRunAction.hh" 33 #include "eRositaSteppingAction.hh" 33 #include "eRositaSteppingAction.hh" 34 #include "eRositaSteppingVerbose.hh" 34 #include "eRositaSteppingVerbose.hh" 35 35 36 #include "G4RunManagerFactory.hh" 36 #include "G4RunManagerFactory.hh" 37 #include "G4UIExecutive.hh" 37 #include "G4UIExecutive.hh" 38 #include "G4UImanager.hh" 38 #include "G4UImanager.hh" 39 #include "G4VisExecutive.hh" 39 #include "G4VisExecutive.hh" 40 40 41 auto main(int argumentCount, char** argumentVe 41 auto main(int argumentCount, char** argumentVector) -> int 42 { 42 { 43 // User verbose output class 43 // User verbose output class 44 // 44 // 45 auto *verbosity = new eRositaSteppingVerbo 45 auto *verbosity = new eRositaSteppingVerbose(); 46 G4VSteppingVerbose::SetInstance(verbosity) 46 G4VSteppingVerbose::SetInstance(verbosity); 47 47 48 // Run manager 48 // Run manager 49 // 49 // 50 auto *runManager = G4RunManagerFactory::Cr 50 auto *runManager = G4RunManagerFactory::CreateRunManager(); 51 51 52 constexpr auto NUMBER_OF_THREADS{4}; 52 constexpr auto NUMBER_OF_THREADS{4}; 53 runManager->SetNumberOfThreads(NUMBER_OF_T 53 runManager->SetNumberOfThreads(NUMBER_OF_THREADS); 54 54 55 G4cout << "***********************" << G4e 55 G4cout << "***********************" << G4endl; 56 G4cout << "** Seed: " << G4Random::getTheS 56 G4cout << "** Seed: " << G4Random::getTheSeed() << " **" << G4endl; 57 G4cout << "***********************" << G4e 57 G4cout << "***********************" << G4endl; 58 58 59 runManager->SetUserInitialization(new eRos 59 runManager->SetUserInitialization(new eRositaDetectorConstruction); 60 runManager->SetUserInitialization(new eRos 60 runManager->SetUserInitialization(new eRositaPhysicsList); 61 runManager->SetUserInitialization(new eRos 61 runManager->SetUserInitialization(new eRositaActionInitialization()); 62 62 63 // Initialize GEANT4 kernel 63 // Initialize GEANT4 kernel 64 // 64 // 65 runManager->Initialize(); 65 runManager->Initialize(); 66 66 67 // Get the pointer to the User Interface ( 67 // Get the pointer to the User Interface (UI) manager 68 // 68 // 69 auto *userInterfaceManager = G4UImanager:: 69 auto *userInterfaceManager = G4UImanager::GetUIpointer(); 70 70 71 if (argumentCount != 1) { // batch mode 71 if (argumentCount != 1) { // batch mode 72 G4String command = "/control/execute " 72 G4String command = "/control/execute "; 73 G4String fileName = argumentVector[1]; 73 G4String fileName = argumentVector[1]; 74 userInterfaceManager->ApplyCommand(com 74 userInterfaceManager->ApplyCommand(command + fileName); 75 } else { // interactive mode : define visu 75 } else { // interactive mode : define visualization and UI terminal 76 auto *visualizationManager = new G4Vis 76 auto *visualizationManager = new G4VisExecutive; 77 visualizationManager->Initialize(); 77 visualizationManager->Initialize(); 78 78 79 auto *userInterface = new G4UIExecutiv 79 auto *userInterface = new G4UIExecutive(argumentCount, argumentVector); 80 userInterfaceManager->ApplyCommand("/c 80 userInterfaceManager->ApplyCommand("/control/execute vis.mac"); 81 userInterface->SessionStart(); 81 userInterface->SessionStart(); 82 82 83 delete userInterface; 83 delete userInterface; 84 delete visualizationManager; 84 delete visualizationManager; 85 } 85 } 86 86 87 // Free the store: 87 // Free the store: 88 // user actions, physics list and detector 88 // user actions, physics list and detector description are 89 // owned and deleted by the run manager, 89 // owned and deleted by the run manager, 90 // so they should not be deleted in the ma 90 // so they should not be deleted in the main() program! 91 91 92 delete verbosity; << 93 delete runManager; 92 delete runManager; >> 93 delete verbosity; 94 94 95 return 0; 95 return 0; 96 } 96 } 97 97