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 // >> 28 // 27 #include "eRositaActionInitialization.hh" 29 #include "eRositaActionInitialization.hh" 28 #include "eRositaDetectorConstruction.hh" 30 #include "eRositaDetectorConstruction.hh" 29 #include "eRositaEventAction.hh" << 30 #include "eRositaPhysicsList.hh" 31 #include "eRositaPhysicsList.hh" 31 #include "eRositaPrimaryGeneratorAction.hh" 32 #include "eRositaPrimaryGeneratorAction.hh" 32 #include "eRositaRunAction.hh" 33 #include "eRositaRunAction.hh" >> 34 #include "eRositaEventAction.hh" 33 #include "eRositaSteppingAction.hh" 35 #include "eRositaSteppingAction.hh" 34 #include "eRositaSteppingVerbose.hh" 36 #include "eRositaSteppingVerbose.hh" 35 << 36 #include "G4RunManagerFactory.hh" 37 #include "G4RunManagerFactory.hh" 37 #include "G4UIExecutive.hh" << 38 #include "G4UImanager.hh" 38 #include "G4UImanager.hh" 39 #include "G4VisExecutive.hh" 39 #include "G4VisExecutive.hh" >> 40 #include "G4UIExecutive.hh" 40 41 41 auto main(int argumentCount, char** argumentVe << 42 >> 43 int main(int argc,char** argv) 42 { 44 { 43 // User verbose output class << 45 // User Verbose output class 44 // << 46 // 45 auto *verbosity = new eRositaSteppingVerbo << 47 G4VSteppingVerbose* verbosity = new eRositaSteppingVerbose; 46 G4VSteppingVerbose::SetInstance(verbosity) << 48 G4VSteppingVerbose::SetInstance(verbosity); 47 << 49 48 // Run manager << 50 // Run manager 49 // << 51 // 50 auto *runManager = G4RunManagerFactory::Cr << 52 auto* runManager = G4RunManagerFactory::CreateRunManager(); 51 << 53 G4int nThreads = 4; 52 constexpr auto NUMBER_OF_THREADS{4}; << 54 runManager->SetNumberOfThreads(nThreads); 53 runManager->SetNumberOfThreads(NUMBER_OF_T << 55 54 << 56 G4cout << "***********************" << G4endl; 55 G4cout << "***********************" << G4e << 57 G4cout << "*** Seed: " << G4Random::getTheSeed() << " ***" << G4endl; 56 G4cout << "** Seed: " << G4Random::getTheS << 58 G4cout << "***********************" << G4endl; 57 G4cout << "***********************" << G4e << 59 58 << 60 runManager->SetUserInitialization(new eRositaDetectorConstruction); 59 runManager->SetUserInitialization(new eRos << 61 runManager->SetUserInitialization(new eRositaPhysicsList); 60 runManager->SetUserInitialization(new eRos << 62 runManager->SetUserInitialization(new eRositaActionInitialization()); 61 runManager->SetUserInitialization(new eRos << 63 62 << 64 // Initialize G4 kernel 63 // Initialize GEANT4 kernel << 65 // 64 // << 66 runManager->Initialize(); 65 runManager->Initialize(); << 67 66 << 68 // Get the pointer to the User Interface manager 67 // Get the pointer to the User Interface ( << 69 // 68 // << 70 G4UImanager * UImanager = G4UImanager::GetUIpointer(); 69 auto *userInterfaceManager = G4UImanager:: << 71 70 << 72 if (argc != 1) // batch mode 71 if (argumentCount != 1) { // batch mode << 73 { 72 G4String command = "/control/execute " << 74 G4String command = "/control/execute "; 73 G4String fileName = argumentVector[1]; << 75 G4String fileName = argv[1]; 74 userInterfaceManager->ApplyCommand(com << 76 UImanager->ApplyCommand(command+fileName); 75 } else { // interactive mode : define visu << 77 } 76 auto *visualizationManager = new G4Vis << 78 else // interactive mode : define visualization and UI terminal 77 visualizationManager->Initialize(); << 79 { 78 << 80 G4VisManager* visManager = new G4VisExecutive; 79 auto *userInterface = new G4UIExecutiv << 81 visManager->Initialize(); 80 userInterfaceManager->ApplyCommand("/c << 82 81 userInterface->SessionStart(); << 83 G4UIExecutive* ui = new G4UIExecutive(argc, argv); 82 << 84 UImanager->ApplyCommand("/control/execute vis.mac"); 83 delete userInterface; << 85 ui->SessionStart(); 84 delete visualizationManager; << 86 delete ui; >> 87 >> 88 delete visManager; 85 } 89 } 86 90 87 // Free the store: << 91 // Free the store: user actions, physics_list and detector_description are 88 // user actions, physics list and detector << 92 // owned and deleted by the run manager, so they should not 89 // owned and deleted by the run manager, << 93 // be deleted in the main() program ! 90 // so they should not be deleted in the ma << 91 94 92 delete verbosity; << 95 delete runManager; 93 delete runManager; << 96 delete verbosity; 94 97 95 return 0; << 98 return 0; 96 } 99 } 97 100