Loading...
Searching...
No Matches
exampleRE05.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//
27/// \file RE05/exampleRE05.cc
28/// \brief Main program of the RE05 example
29//
30
31//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33
34#include "G4Types.hh"
35
36#include "G4RunManagerFactory.hh"
38
39#include "G4UImanager.hh"
40
43#include "QBBC.hh"
44#include "G4ParallelWorldPhysics.hh"
46
47#include "G4VisExecutive.hh"
48#include "G4UIExecutive.hh"
49
50int main(int argc,char** argv)
51{
52 // Instantiate G4UIExecutive if there are no arguments (interactive mode)
53 G4UIExecutive* ui = nullptr;
54 if ( argc == 1 ) {
55 ui = new G4UIExecutive(argc, argv);
56 }
57
58 // Setting the application-sepcific SteppingVerbose
59 auto verbosity = new RE05SteppingVerbose;
60
61 // Creating the run manager
62 auto runManager = G4RunManagerFactory::CreateRunManager();
63
64 G4String parallelWorldName = "ReadoutWorld";
65 // User Initialization classes (mandatory)
66 //
67 auto detector = new RE05DetectorConstruction();
68 detector->RegisterParallelWorld
69 (new RE05CalorimeterParallelWorld(parallelWorldName));
70 runManager->SetUserInitialization(detector);
71 //
72 auto physicsList = new QBBC;
73 physicsList
74 ->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
75 runManager->SetUserInitialization(physicsList);
76 //
77 auto actions = new RE05ActionInitialization;
78 runManager->SetUserInitialization(actions);
79
80 runManager->Initialize();
81
82 auto visManager = new G4VisExecutive;
83 visManager->Initialize();
84
85 //get the pointer to the User Interface manager
86 auto UImanager = G4UImanager::GetUIpointer();
87
88 if (!ui) // batch mode
89 {
90 G4String command = "/control/execute ";
91 G4String fileName = argv[1];
92 UImanager->ApplyCommand(command+fileName);
93 }
94 else // interactive mode : define UI session
95 {
96 UImanager->ApplyCommand("/control/execute vis.mac");
97 ui->SessionStart();
98 delete ui;
99 }
100
101 // Job termination
102 // Free the store: user actions, physics_list and detector_description are
103 // owned and deleted by the run manager, so they should not
104 // be deleted in the main() program !
105 delete visManager;
106 delete runManager;
107 delete verbosity;
108
109 return 0;
110}
111
112//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Definition of the RE05ActionInitialization class.
Definition of the RE05CalorimeterParallelWorld class.
Definition of the RE05DetectorConstruction class.
Definition of the RE05SteppingVerbose class.
This class manages the verbose outputs in G4SteppingManager.
int main()
Definition testCommon.cc:47

Applications | User Support | Publications | Collaboration