Loading...
Searching...
No Matches
gdml_det.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/G04/gdml_det.cc
27/// \brief Main program of the persistency/gdml/G04 example
28//
29//
30//
31//
32// --------------------------------------------------------------
33// GEANT 4 - gdml_det
34//
35// --------------------------------------------------------------
36
37#include <vector>
38
42
43#include "G4RunManagerFactory.hh"
44
45#include "FTFP_BERT.hh"
46#include "G4UImanager.hh"
47#include "G4VisExecutive.hh"
48#include "G4UIExecutive.hh"
49#include "G4GDMLParser.hh"
50
51int main(int argc,char **argv)
52{
53 G4cout << G4endl;
54 G4cout << "Usage: gdml_det <intput_gdml_file:mandatory>"
55 << G4endl;
56 G4cout << G4endl;
57
58 if (argc<2)
59 {
60 G4cout << "Error! Mandatory input file is not specified!" << G4endl;
61 G4cout << G4endl;
62 return -1;
63 }
64
65 // Detect interactive mode (if only one argument) and define UI session
66 //
67 G4UIExecutive* ui = 0;
68 if ( argc == 2 ) {
69 ui = new G4UIExecutive(argc, argv);
70 }
71
72 G4GDMLParser parser;
73 parser.Read(argv[1]);
74
75 auto* runManager = G4RunManagerFactory::CreateRunManager();
76
77 runManager->SetUserInitialization(new G04DetectorConstruction(parser));
78 runManager->SetUserInitialization(new FTFP_BERT);
79
80 // User action initialization
81 runManager->SetUserInitialization(new G04ActionInitialization());
82 runManager->Initialize();
83
84 // Initialize visualization
85 G4VisManager* visManager = new G4VisExecutive;
86 visManager->Initialize();
87
88 // Get the pointer to the User Interface manager
89 G4UImanager* UImanager = G4UImanager::GetUIpointer();
90
91 // Process macro or start UI session
92 if ( ! ui ) // batch mode
93 {
94 G4String command = "/control/execute ";
95 G4String fileName = argv[2];
96 UImanager->ApplyCommand(command+fileName);
97 }
98 else // interactive mode
99 {
100 UImanager->ApplyCommand("/control/execute vis.mac");
101 ui->SessionStart();
102 delete ui;
103 }
104
105 delete visManager;
106 delete runManager;
107}
Definition of the G04ActionInitialization class.
Definition of the G04DetectorConstruction class.
Definition of the G04SensitiveDetector class.
Action initialization class.
Detector construction for laoding GDML geometry.
int main()
Definition testCommon.cc:47

Applications | User Support | Publications | Collaboration