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 /// \file exoticphysics/phonon/XGeBox.cc 26 /// \file exoticphysics/phonon/XGeBox.cc 27 /// \brief Main program of the exoticphysics/p 27 /// \brief Main program of the exoticphysics/phonon example 28 // 28 // >> 29 // $Id: XGeBox.cc 84197 2014-10-10 14:33:03Z gcosmo $ 29 // 30 // 30 31 >> 32 #include "G4UImanager.hh" >> 33 #include "G4UserSteppingAction.hh" >> 34 >> 35 #ifdef G4MULTITHREADED >> 36 #include "G4MTRunManager.hh" >> 37 #else >> 38 #include "G4RunManager.hh" >> 39 #endif >> 40 >> 41 #ifdef G4VIS_USE >> 42 #include "G4VisExecutive.hh" >> 43 #endif >> 44 >> 45 #ifdef G4UI_USE >> 46 #include "G4UIExecutive.hh" >> 47 #endif >> 48 31 #include "XActionInitialization.hh" 49 #include "XActionInitialization.hh" 32 #include "XDetectorConstruction.hh" 50 #include "XDetectorConstruction.hh" 33 #include "XPhysicsList.hh" 51 #include "XPhysicsList.hh" 34 52 35 #include "G4RunManagerFactory.hh" << 36 #include "G4Types.hh" << 37 #include "G4UIExecutive.hh" << 38 #include "G4UImanager.hh" << 39 #include "G4UserSteppingAction.hh" << 40 #include "G4VisExecutive.hh" << 41 53 42 //....oooOO0OOooo........oooOO0OOooo........oo 54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 43 55 44 int main(int argc, char** argv) << 56 int main(int argc,char** argv) { 45 { << 57 // Construct the run manager 46 // Instantiate G4UIExecutive if interactive << 58 // 47 G4UIExecutive* ui = nullptr; << 59 #ifdef G4MULTITHREADED 48 if (argc == 1) { << 60 G4MTRunManager* runManager = new G4MTRunManager; 49 ui = new G4UIExecutive(argc, argv); << 61 #else 50 } << 62 G4RunManager* runManager = new G4RunManager; 51 << 63 #endif 52 // Construct the run manager << 64 53 // << 65 // Set mandatory initialization classes 54 auto* runManager = G4RunManagerFactory::Crea << 66 // 55 << 67 XDetectorConstruction* detector = new XDetectorConstruction(); 56 // Set mandatory initialization classes << 68 runManager->SetUserInitialization(detector); 57 // << 69 // 58 XDetectorConstruction* detector = new XDetec << 70 G4VUserPhysicsList* physics = new XPhysicsList(); 59 runManager->SetUserInitialization(detector); << 71 physics->SetCuts(); 60 // << 72 runManager->SetUserInitialization(physics); 61 G4VUserPhysicsList* physics = new XPhysicsLi << 73 62 physics->SetCuts(); << 74 // Set user action classes 63 runManager->SetUserInitialization(physics); << 75 // 64 << 76 runManager->SetUserInitialization(new XActionInitialization); 65 // Set user action classes << 77 66 // << 78 #ifdef G4VIS_USE 67 runManager->SetUserInitialization(new XActio << 79 // Visualization manager 68 << 80 // 69 // Visualization manager << 81 G4VisManager* visManager = new G4VisExecutive; 70 // << 82 visManager->Initialize(); 71 G4VisManager* visManager = new G4VisExecutiv << 83 #endif 72 visManager->Initialize(); << 84 73 << 85 // Initialize G4 kernel (replaces /run/initialize macro command) 74 // Initialize G4 kernel (replaces /run/initi << 86 // 75 // << 87 runManager->Initialize(); 76 runManager->Initialize(); << 88 77 << 89 // Get the pointer to the User Interface manager 78 // Get the pointer to the User Interface man << 90 // 79 // << 91 G4UImanager* UImanager = G4UImanager::GetUIpointer(); 80 G4UImanager* UImanager = G4UImanager::GetUIp << 92 81 << 93 if (argc==1) // Define UI session for interactive mode 82 if (ui) // Define UI session for interactiv << 94 { 83 { << 95 #ifdef G4UI_USE 84 UImanager->ApplyCommand("/control/execute << 96 G4UIExecutive * ui = new G4UIExecutive(argc,argv); 85 ui->SessionStart(); << 97 #ifdef G4VIS_USE 86 delete ui; << 98 UImanager->ApplyCommand("/control/execute vis.mac"); 87 } << 99 #endif 88 else // Batch mode << 100 ui->SessionStart(); 89 { << 101 delete ui; 90 G4String command = "/control/execute "; << 102 #endif 91 G4String fileName = argv[1]; << 103 } 92 UImanager->ApplyCommand(command + fileName << 104 else // Batch mode 93 } << 105 { >> 106 G4String command = "/control/execute "; >> 107 G4String fileName = argv[1]; >> 108 UImanager->ApplyCommand(command+fileName); >> 109 } >> 110 >> 111 #ifdef G4VIS_USE >> 112 delete visManager; >> 113 #endif >> 114 delete runManager; 94 115 95 delete visManager; << 116 return 0; 96 delete runManager; << 97 << 98 return 0; << 99 } 117 } >> 118 >> 119 100 120