Loading...
Searching...
No Matches
gdml_ext.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 persistency/gdml/G03/gdml_ext.cc
27/// \brief Main program of the persistency/gdml/G03 example
28//
29//
30//
31//
32// --------------------------------------------------------------
33// GEANT 4 - read_ext
34//
35// --------------------------------------------------------------
36
37// Geant4 includes
38//
39#include "G4RunManagerFactory.hh"
40#include "G4UImanager.hh"
41#include "globals.hh"
42
43// A pre-built physics list
44//
45#include "QGSP_BERT.hh"
46
47// Example includes
48//
51#include "G03RunAction.hh"
52
53#include "G4VisExecutive.hh"
54#include "G4UIExecutive.hh"
55
56// --------------------------------------------------------------
57
58int main(int argc, char** argv)
59{
60
61 // Construct a serial run manager
62 //
63 auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly);
64
65 // Set mandatory initialization and user action classes
66 //
68 runManager->SetUserInitialization(detector);
69 runManager->SetUserInitialization(new QGSP_BERT);
70 runManager->SetUserAction(new G03PrimaryGeneratorAction);
71 G03RunAction* runAction = new G03RunAction;
72 runManager->SetUserAction(runAction);
73
74 // Initialisation of runManager via macro for the interactive mode
75 // This gives possibility to give different names for GDML file to READ
76
77 // Initialize visualization
78 //
79 G4VisManager* visManager = new G4VisExecutive;
80 visManager->Initialize();
81
82 // Run initialisation macro
83 //
84 G4UImanager* UImanager = G4UImanager::GetUIpointer();
85
86 if ( argc==1 ) // Define UI session for interactive mode.
87 {
88 G4UIExecutive* ui = new G4UIExecutive(argc, argv);
89 UImanager->ApplyCommand("/control/execute vis.mac");
90 ui->SessionStart();
91 delete ui;
92 }
93 else // Batch mode
94 {
95 G4UIExecutive* ui = new G4UIExecutive(argc, argv);
96 G4String command = "/control/execute ";
97 G4String fileName = argv[1];
98 UImanager->ApplyCommand(command+fileName);
99 ui->SessionStart();
100 delete ui;
101 }
102
103 // Job termination
104 //
105 delete visManager;
106 delete runManager;
107
108 return 0;
109}
Definition of the G03DetectorConstruction class.
Definition of the G03PrimaryGeneratorAction class.
Definition of the G03RunAction class.
Detector construction for the GDML extensions example.
Primary generator action for the GDML extension example.
Run action for the GDML extension example.
int main()
Definition testCommon.cc:47

Applications | User Support | Publications | Collaboration