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 persistency/P02/exampleP02.cc 26 /// \file persistency/P02/exampleP02.cc 27 /// \brief Main program of the persistency/P02 27 /// \brief Main program of the persistency/P02 example 28 // 28 // 29 // 29 // 30 // 30 // 31 // 31 // 32 //....oooOO0OOooo........oooOO0OOooo........oo 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 //....oooOO0OOooo........oooOO0OOooo........oo 33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 34 34 35 #include "ExP02DetConstrReader.hh" << 35 #include "G4Types.hh" >> 36 36 #include "ExP02DetectorConstruction.hh" 37 #include "ExP02DetectorConstruction.hh" >> 38 #include "ExP02DetConstrReader.hh" 37 #include "ExP02PrimaryGeneratorAction.hh" 39 #include "ExP02PrimaryGeneratorAction.hh" >> 40 38 #include "FTFP_BERT.hh" 41 #include "FTFP_BERT.hh" 39 42 40 #include "G4RunManagerFactory.hh" 43 #include "G4RunManagerFactory.hh" 41 #include "G4Types.hh" << 42 #include "G4UIExecutive.hh" << 43 #include "G4UImanager.hh" 44 #include "G4UImanager.hh" >> 45 44 #include "G4VisExecutive.hh" 46 #include "G4VisExecutive.hh" >> 47 #include "G4UIExecutive.hh" 45 48 46 //....oooOO0OOooo........oooOO0OOooo........oo 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 47 50 48 int main(int argc, char** argv) 51 int main(int argc, char** argv) 49 { 52 { 50 if (argc == 1) { << 53 >> 54 if(argc==1) >> 55 { 51 G4cout << "Please give 'write' or 'read' a 56 G4cout << "Please give 'write' or 'read' as argument " << G4endl; 52 return 0; 57 return 0; 53 } 58 } 54 59 55 G4VUserDetectorConstruction* det; 60 G4VUserDetectorConstruction* det; 56 61 57 if (std::string(argv[1]) == "read") { << 62 if(std::string(argv[1]) == "read") 58 det = new ExP02DetConstrReader; << 63 { 59 } << 64 det = new ExP02DetConstrReader; 60 else if (std::string(argv[1]) == "write") { << 65 } >> 66 else if(std::string(argv[1]) == "write") >> 67 { 61 det = new ExP02DetectorConstruction; 68 det = new ExP02DetectorConstruction; 62 } 69 } 63 else { << 70 else >> 71 { 64 G4cout << "Wrong argument!" << G4endl; 72 G4cout << "Wrong argument!" << G4endl; 65 return 0; 73 return 0; 66 } 74 } 67 75 68 // User interface 76 // User interface 69 G4UIExecutive* ui = new G4UIExecutive(argc, 77 G4UIExecutive* ui = new G4UIExecutive(argc, argv); 70 78 71 // Run manager 79 // Run manager 72 auto* runManager = G4RunManagerFactory::Crea 80 auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly); 73 81 74 // UserInitialization classes (mandatory) 82 // UserInitialization classes (mandatory) 75 runManager->SetUserInitialization(det); 83 runManager->SetUserInitialization(det); 76 84 77 G4VModularPhysicsList* physicsList = new FTF 85 G4VModularPhysicsList* physicsList = new FTFP_BERT; 78 runManager->SetUserInitialization(physicsLis 86 runManager->SetUserInitialization(physicsList); 79 87 80 // Visualization 88 // Visualization 81 G4VisManager* visManager = new G4VisExecutiv 89 G4VisManager* visManager = new G4VisExecutive; 82 visManager->Initialize(); 90 visManager->Initialize(); 83 91 84 // UserAction classes 92 // UserAction classes 85 runManager->SetUserAction(new ExP02PrimaryGe 93 runManager->SetUserAction(new ExP02PrimaryGeneratorAction()); 86 94 87 // Initialize G4 kernel << 95 //Initialize G4 kernel 88 runManager->Initialize(); 96 runManager->Initialize(); 89 97 90 // get the pointer to the User Interface man << 98 //get the pointer to the User Interface manager 91 G4UImanager* UImanager = G4UImanager::GetUIp << 99 G4UImanager * UImanager = G4UImanager::GetUIpointer(); 92 100 93 UImanager->ApplyCommand("/control/execute vi 101 UImanager->ApplyCommand("/control/execute vis.mac"); 94 ui->SessionStart(); 102 ui->SessionStart(); 95 delete ui; 103 delete ui; 96 104 97 delete visManager; 105 delete visManager; 98 delete runManager; 106 delete runManager; 99 107 100 return 0; 108 return 0; 101 } 109 } 102 110 103 //....oooOO0OOooo........oooOO0OOooo........oo 111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 112 104 113