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