![]() |
|
|||
File indexing completed on 2025-02-23 09:22:46
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 RE06/exampleRE06.cc 0027 /// \brief Main program of the RE06 example 0028 // 0029 // 0030 // -------------------------------------------------------------- 0031 // GEANT 4 - example RE06 0032 // -------------------------------------------------------------- 0033 0034 #include "FTFP_BERT.hh" 0035 #include "RE06ActionInitialization.hh" 0036 #include "RE06DetectorConstruction.hh" 0037 #include "RE06ParallelWorld.hh" 0038 #include "RE06PrimaryGeneratorAction.hh" 0039 #include "RE06RunAction.hh" 0040 #include "RE06SteppingVerbose.hh" 0041 0042 #include "G4ParallelWorldPhysics.hh" 0043 #include "G4RunManagerFactory.hh" 0044 #include "G4Types.hh" 0045 #include "G4UIExecutive.hh" 0046 #include "G4UImanager.hh" 0047 #include "G4VisExecutive.hh" 0048 0049 int main(int argc, char** argv) 0050 { 0051 // Instantiate G4UIExecutive if there are no arguments (interactive mode) 0052 G4UIExecutive* ui = nullptr; 0053 if (argc == 1) { 0054 ui = new G4UIExecutive(argc, argv); 0055 } 0056 0057 // Construct the stepping verbose class 0058 // 0059 auto verbosity = new RE06SteppingVerbose; 0060 0061 // Construct the run manager 0062 // 0063 auto runManager = G4RunManagerFactory::CreateRunManager(); 0064 0065 // Set mandatory initialization classes 0066 // 0067 G4String parallelWorldName = "ParallelScoringWorld"; 0068 auto detector = new RE06DetectorConstruction; 0069 detector->RegisterParallelWorld(new RE06ParallelWorld(parallelWorldName)); 0070 runManager->SetUserInitialization(detector); 0071 // 0072 auto physics = new FTFP_BERT; 0073 physics->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName)); 0074 runManager->SetUserInitialization(physics); 0075 0076 // Set user action classes 0077 // 0078 runManager->SetUserInitialization(new RE06ActionInitialization); 0079 0080 // Visualization manager 0081 // 0082 auto visManager = new G4VisExecutive; 0083 visManager->Initialize(); 0084 0085 // Initialize G4 kernel 0086 // 0087 runManager->Initialize(); 0088 0089 // Get the pointer to the User Interface manager 0090 // 0091 auto UImanager = G4UImanager::GetUIpointer(); 0092 0093 if (ui) // Define UI session for interactive mode 0094 { 0095 UImanager->ApplyCommand("/control/execute vis.mac"); 0096 ui->SessionStart(); 0097 delete ui; 0098 } 0099 else // Batch mode 0100 { 0101 G4String command = "/control/execute "; 0102 G4String fileName = argv[1]; 0103 UImanager->ApplyCommand(command + fileName); 0104 } 0105 0106 // Job termination 0107 // Free the store: 0108 // user actions, physics_list and detector_description are 0109 // owned and deleted by the run manager, so they should not 0110 // be deleted in the main() program ! 0111 0112 delete verbosity; 0113 delete visManager; 0114 delete runManager; 0115 0116 return 0; 0117 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |