![]() |
|
|||
File indexing completed on 2025-02-23 09:21:15
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 // 0028 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0029 0030 #include "SAXSActionInitialization.hh" 0031 #include "SAXSDetectorConstruction.hh" 0032 #include "SAXSEventAction.hh" 0033 #include "SAXSPhysicsList.hh" 0034 #include "SAXSRunAction.hh" 0035 #include "SAXSSteppingAction.hh" 0036 0037 #include "G4RunManagerFactory.hh" 0038 #include "G4Timer.hh" 0039 #include "G4UIExecutive.hh" 0040 #include "G4UImanager.hh" 0041 #include "G4VisExecutive.hh" 0042 #include "Randomize.hh" 0043 0044 #include <time.h> 0045 0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0047 0048 int main(int argc, char** argv) 0049 { 0050 G4Timer* theTimer = new G4Timer(); 0051 theTimer->Start(); 0052 0053 // Choose the Random engine and reset the seed (before the RunManager) 0054 /* 0055 G4int seed = time(0); 0056 G4cout << "Random seed: " << seed << G4endl; 0057 CLHEP::HepRandom::setTheSeed(seed); 0058 */ 0059 // Construct the run manager 0060 auto* runManager = G4RunManagerFactory::CreateRunManager(); 0061 int vNumberOfThreads = 2; 0062 if (argc > 2) { 0063 vNumberOfThreads = atoi(argv[2]); 0064 } 0065 if (vNumberOfThreads > 0) { 0066 runManager->SetNumberOfThreads(vNumberOfThreads); 0067 } 0068 0069 // Set mandatory initialization classes 0070 runManager->SetUserInitialization(new SAXSDetectorConstruction); 0071 runManager->SetUserInitialization(new SAXSPhysicsList()); 0072 0073 // Set user action classes 0074 runManager->SetUserInitialization(new SAXSActionInitialization()); 0075 0076 // Get the pointer to the User Interface manager 0077 G4UImanager* UImanager = G4UImanager::GetUIpointer(); 0078 0079 // No arguments: set the batch mode 0080 if (argc != 1) { 0081 // Batch mode 0082 G4String command = "/control/execute "; 0083 G4String fileName = argv[1]; 0084 UImanager->ApplyCommand(command + fileName); 0085 } 0086 else { 0087 // Visualization manager 0088 G4VisManager* visManager = new G4VisExecutive; 0089 visManager->Initialize(); 0090 0091 // Define UI session for interactive mode 0092 G4UIExecutive* ui = new G4UIExecutive(argc, argv); 0093 UImanager->ApplyCommand("/control/execute init_vis.mac"); 0094 if (ui->IsGUI()) UImanager->ApplyCommand("/control/execute gui.mac"); 0095 ui->SessionStart(); 0096 0097 delete ui; 0098 delete visManager; 0099 } 0100 0101 // Job termination 0102 delete runManager; 0103 0104 theTimer->Stop(); 0105 G4cout << "Execution completed" << G4endl; 0106 G4cout << (*theTimer) << G4endl; 0107 delete theTimer; 0108 0109 return 0; 0110 } 0111 0112 //....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 |
![]() ![]() |