Loading...
Searching...
No Matches
exampleRE06.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26/// \file RE06/exampleRE06.cc
27/// \brief Main program of the RE06 example
28//
29//
30// --------------------------------------------------------------
31// GEANT 4 - example RE06
32// --------------------------------------------------------------
33
34#include "G4Types.hh"
35
36#include "G4RunManagerFactory.hh"
37
38#include "G4VisExecutive.hh"
39#include "G4UIExecutive.hh"
40
41#include "G4UImanager.hh"
42#include "FTFP_BERT.hh"
43#include "G4ParallelWorldPhysics.hh"
44
46#include "RE06ParallelWorld.hh"
48#include "RE06RunAction.hh"
51
52int main(int argc,char** argv)
53{
54 // Instantiate G4UIExecutive if there are no arguments (interactive mode)
55 G4UIExecutive* ui = nullptr;
56 if ( argc == 1 ) {
57 ui = new G4UIExecutive(argc, argv);
58 }
59
60 // Construct the stepping verbose class
61 //
62 auto verbosity = new RE06SteppingVerbose;
63
64 // Construct the run manager
65 //
66 auto runManager = G4RunManagerFactory::CreateRunManager();
67
68 // Set mandatory initialization classes
69 //
70 G4String parallelWorldName = "ParallelScoringWorld";
71 auto detector = new RE06DetectorConstruction;
72 detector->RegisterParallelWorld(new RE06ParallelWorld(parallelWorldName));
73 runManager->SetUserInitialization(detector);
74 //
75 auto physics = new FTFP_BERT;
76 physics->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
77 runManager->SetUserInitialization(physics);
78
79 // Set user action classes
80 //
81 runManager->SetUserInitialization(new RE06ActionInitialization);
82
83 // Visualization manager
84 //
85 auto visManager = new G4VisExecutive;
86 visManager->Initialize();
87
88 // Initialize G4 kernel
89 //
90 runManager->Initialize();
91
92 // Get the pointer to the User Interface manager
93 //
94 auto UImanager = G4UImanager::GetUIpointer();
95
96 if (ui) // Define UI session for interactive mode
97 {
98 UImanager->ApplyCommand("/control/execute vis.mac");
99 ui->SessionStart();
100 delete ui;
101 }
102 else // Batch mode
103 {
104 G4String command = "/control/execute ";
105 G4String fileName = argv[1];
106 UImanager->ApplyCommand(command+fileName);
107 }
108
109 // Job termination
110 // Free the store:
111 // user actions, physics_list and detector_description are
112 // owned and deleted by the run manager, so they should not
113 // be deleted in the main() program !
114
115 delete verbosity;
116 delete visManager;
117 delete runManager;
118
119 return 0;
120}
Definition of the RE06ActionInitialization class.
Definition of the RE06DetectorConstruction class.
Definition of the RE06ParallelWorld class.
Definition of the RE06PrimaryGeneratorAction class.
Definition of the RE06RunAction class.
Definition of the RE06SteppingVerbose class.
int main()
Definition testCommon.cc:47

Applications | User Support | Publications | Collaboration