![]() |
|
|||
File indexing completed on 2025-02-23 09:22:36
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 /// \file persistency/gdml/G02/geotest.cc 0027 /// \brief Main program of the persistency/gdml/G02 example 0028 // 0029 // 0030 // 0031 // 0032 // -------------------------------------------------------------- 0033 // GEANT 4 - geotest 0034 // 0035 // -------------------------------------------------------------- 0036 0037 // Geant4 includes 0038 // 0039 #include "G4RunManagerFactory.hh" 0040 #include "G4UImanager.hh" 0041 #include "globals.hh" 0042 0043 // A pre-built physics list 0044 // 0045 #include "QGSP_BERT.hh" 0046 0047 // Example includes 0048 // 0049 #include "G02DetectorConstruction.hh" 0050 #include "G02PrimaryGeneratorAction.hh" 0051 #include "G02RunAction.hh" 0052 0053 #include "G4UIExecutive.hh" 0054 #include "G4VisExecutive.hh" 0055 0056 // -------------------------------------------------------------- 0057 0058 int main(int argc, char** argv) 0059 { 0060 // Construct a serial run manager 0061 // 0062 auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly); 0063 0064 // Set mandatory initialization and user action classes 0065 // 0066 G02DetectorConstruction* detector = new G02DetectorConstruction; 0067 runManager->SetUserInitialization(detector); 0068 runManager->SetUserInitialization(new QGSP_BERT); 0069 runManager->SetUserAction(new G02PrimaryGeneratorAction); 0070 G02RunAction* runAction = new G02RunAction; 0071 runManager->SetUserAction(runAction); 0072 0073 // Initialisation of runManager via macro for the interactive mode 0074 // This gives possibility to give different names for GDML file to READ 0075 0076 // Initialize visualization 0077 // 0078 G4VisManager* visManager = new G4VisExecutive; 0079 visManager->Initialize(); 0080 0081 // Open a UI session: will stay there until the user types "exit" 0082 // 0083 G4UImanager* UImanager = G4UImanager::GetUIpointer(); 0084 0085 if (argc == 1) // Automatically run default macro for writing... 0086 { 0087 G4UIExecutive* ui = new G4UIExecutive(argc, argv); 0088 UImanager->ApplyCommand("/control/execute vis.mac"); 0089 ui->SessionStart(); 0090 delete ui; 0091 } 0092 else // Interactive, provides macro in input 0093 { 0094 G4UIExecutive* ui = new G4UIExecutive(argc, argv); 0095 G4String command = "/control/execute "; 0096 G4String fileName = argv[1]; 0097 UImanager->ApplyCommand(command + fileName); 0098 ui->SessionStart(); 0099 delete ui; 0100 } 0101 0102 // Job termination 0103 // 0104 delete visManager; 0105 delete runManager; 0106 0107 return 0; 0108 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |