![]() |
|
|||
File indexing completed on 2025-02-23 09:21:19
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 /// \file field/field05/field05.cc 0028 /// \brief Main program of the field/field05 example 0029 // 0030 // 0031 // 0032 // 0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0034 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0035 0036 #ifndef WIN32 0037 # include <unistd.h> 0038 #endif 0039 0040 #include "G4Types.hh" 0041 0042 #ifdef G4MULTITHREADED 0043 # include "G4MTRunManager.hh" 0044 #else 0045 # include "F05SteppingVerbose.hh" 0046 0047 # include "G4RunManager.hh" 0048 #endif 0049 0050 #include "F05ActionInitialization.hh" 0051 #include "F05DetectorConstruction.hh" 0052 #include "F05PhysicsList.hh" 0053 0054 #include "G4UIExecutive.hh" 0055 #include "G4UImanager.hh" 0056 #include "G4VisExecutive.hh" 0057 #include "Randomize.hh" 0058 0059 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0060 0061 int main(int argc, char** argv) 0062 { 0063 // Instantiate G4UIExecutive if there are no arguments (interactive mode) 0064 G4UIExecutive* ui = nullptr; 0065 if (argc == 1) { 0066 ui = new G4UIExecutive(argc, argv); 0067 } 0068 0069 // Choose the Random engine 0070 // 0071 G4Random::setTheEngine(new CLHEP::RanecuEngine); 0072 0073 G4int myseed = 1234; 0074 if (argc > 2) myseed = atoi(argv[argc - 1]); 0075 0076 // Construct the default run manager 0077 // 0078 #ifdef G4MULTITHREADED 0079 G4MTRunManager* runManager = new G4MTRunManager; 0080 #else 0081 G4VSteppingVerbose::SetInstance(new F05SteppingVerbose); 0082 auto runManager = new G4RunManager; 0083 #endif 0084 0085 G4Random::setTheSeed(myseed); 0086 0087 // Set mandatory initialization classes 0088 // 0089 // Detector construction 0090 runManager->SetUserInitialization(new F05DetectorConstruction()); 0091 // Physics list 0092 runManager->SetUserInitialization(new F05PhysicsList()); 0093 // User action initialization 0094 runManager->SetUserInitialization(new F05ActionInitialization()); 0095 0096 // Initialize visualization 0097 // 0098 G4VisManager* visManager = new G4VisExecutive; 0099 // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance. 0100 // G4VisManager* visManager = new G4VisExecutive("Quiet"); 0101 visManager->Initialize(); 0102 0103 // Get the pointer to the User Interface manager 0104 // 0105 G4UImanager* UImanager = G4UImanager::GetUIpointer(); 0106 0107 if (!ui) // batch mode 0108 { 0109 G4String command = "/control/execute "; 0110 G4String fileName = argv[1]; 0111 UImanager->ApplyCommand(command + fileName); 0112 } 0113 else { // interactive mode : define UI session 0114 UImanager->ApplyCommand("/control/execute init_vis.mac"); 0115 if (ui->IsGUI()) UImanager->ApplyCommand("/control/execute gui.mac"); 0116 ui->SessionStart(); 0117 delete ui; 0118 } 0119 0120 // Job termination 0121 // Free the store: user actions, physics_list and detector_description are 0122 // owned and deleted by the run manager, so they should not 0123 // be deleted in the main() program ! 0124 0125 delete visManager; 0126 delete runManager; 0127 0128 return 0; 0129 } 0130 0131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |