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 /// \file optical/wls/wls.cc 27 /// \file optical/wls/wls.cc 28 /// \brief Main program of the optical/wls exa 28 /// \brief Main program of the optical/wls example 29 // 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 31 32 #include "FTFP_BERT.hh" << 33 #include "WLSActionInitialization.hh" 32 #include "WLSActionInitialization.hh" 34 #include "WLSDetectorConstruction.hh" 33 #include "WLSDetectorConstruction.hh" 35 34 >> 35 #include "FTFP_BERT.hh" 36 #include "G4EmStandardPhysics_option4.hh" 36 #include "G4EmStandardPhysics_option4.hh" 37 #include "G4OpticalPhysics.hh" 37 #include "G4OpticalPhysics.hh" 38 #include "G4RunManagerFactory.hh" 38 #include "G4RunManagerFactory.hh" 39 #include "G4Types.hh" 39 #include "G4Types.hh" 40 #include "G4UIExecutive.hh" 40 #include "G4UIExecutive.hh" 41 #include "G4UImanager.hh" 41 #include "G4UImanager.hh" 42 #include "G4VisExecutive.hh" 42 #include "G4VisExecutive.hh" 43 43 44 //....oooOO0OOooo........oooOO0OOooo........oo 44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 45 46 int main(int argc, char** argv) 46 int main(int argc, char** argv) 47 { 47 { 48 // Instantiate G4UIExecutive if interactive 48 // Instantiate G4UIExecutive if interactive mode 49 G4UIExecutive* ui = nullptr; 49 G4UIExecutive* ui = nullptr; 50 if (argc == 1) { << 50 if(argc == 1) >> 51 { 51 ui = new G4UIExecutive(argc, argv); 52 ui = new G4UIExecutive(argc, argv); 52 } 53 } 53 54 54 auto runManager = G4RunManagerFactory::Creat 55 auto runManager = G4RunManagerFactory::CreateRunManager(); 55 G4int seed = 123; << 56 G4int seed = 123; 56 if (argc > 2) seed = atoi(argv[argc - 1]); << 57 if(argc > 2) >> 58 seed = atoi(argv[argc - 1]); 57 59 58 // Choose the Random engine and set the seed 60 // Choose the Random engine and set the seed 59 // G4Random::setTheEngine(new CLHEP::RanecuE 61 // G4Random::setTheEngine(new CLHEP::RanecuEngine); 60 G4Random::setTheSeed(seed); 62 G4Random::setTheSeed(seed); 61 63 62 // Detector construction 64 // Detector construction 63 auto detector = new WLSDetectorConstruction( 65 auto detector = new WLSDetectorConstruction(); 64 runManager->SetUserInitialization(detector); 66 runManager->SetUserInitialization(detector); 65 67 66 // Physics list 68 // Physics list 67 G4VModularPhysicsList* physicsList = new FTF 69 G4VModularPhysicsList* physicsList = new FTFP_BERT; 68 physicsList->ReplacePhysics(new G4EmStandard 70 physicsList->ReplacePhysics(new G4EmStandardPhysics_option4()); 69 auto opticalPhysics = new G4OpticalPhysics() 71 auto opticalPhysics = new G4OpticalPhysics(); 70 72 71 auto opticalParams = G4OpticalParameters::In 73 auto opticalParams = G4OpticalParameters::Instance(); 72 opticalParams->SetBoundaryInvokeSD(true); 74 opticalParams->SetBoundaryInvokeSD(true); 73 75 74 physicsList->RegisterPhysics(opticalPhysics) 76 physicsList->RegisterPhysics(opticalPhysics); 75 runManager->SetUserInitialization(physicsLis 77 runManager->SetUserInitialization(physicsList); 76 78 77 // User action initialization 79 // User action initialization 78 runManager->SetUserInitialization(new WLSAct 80 runManager->SetUserInitialization(new WLSActionInitialization(detector)); 79 81 80 // Initialize visualization 82 // Initialize visualization 81 G4VisManager* visManager = new G4VisExecutiv 83 G4VisManager* visManager = new G4VisExecutive; 82 visManager->Initialize(); 84 visManager->Initialize(); 83 85 84 // Get the pointer to the User Interface man 86 // Get the pointer to the User Interface manager 85 G4UImanager* UImanager = G4UImanager::GetUIp 87 G4UImanager* UImanager = G4UImanager::GetUIpointer(); 86 88 87 if (ui) { << 89 if(ui) >> 90 { 88 // Define (G)UI terminal for interactive m 91 // Define (G)UI terminal for interactive mode 89 if (ui->IsGUI()) UImanager->ApplyCommand(" << 92 if(ui->IsGUI()) >> 93 UImanager->ApplyCommand("/control/execute gui.mac"); 90 ui->SessionStart(); 94 ui->SessionStart(); 91 delete ui; 95 delete ui; 92 } 96 } 93 else { << 97 else 94 G4String command = "/control/execute "; << 98 { >> 99 G4String command = "/control/execute "; 95 G4String fileName = argv[1]; 100 G4String fileName = argv[1]; 96 UImanager->ApplyCommand(command + fileName 101 UImanager->ApplyCommand(command + fileName); 97 } 102 } 98 103 99 // job termination 104 // job termination 100 delete visManager; 105 delete visManager; 101 delete runManager; 106 delete runManager; 102 return 0; 107 return 0; 103 } 108 } 104 109 105 //....oooOO0OOooo........oooOO0OOooo........oo 110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 106 111