1#include "Framework/Configure/Parameters.h"
3#include "G4GDMLParser.hh"
4#include "G4GeometryManager.hh"
5#include "G4PhysListFactory.hh"
6#include "G4RunManager.hh"
7#include "G4UIExecutive.hh"
8#include "G4VisExecutive.hh"
9#include "SimCore/DetectorConstruction.h"
10#include "SimCore/Geo/Parser.h"
12static void printUsage() {
13 std::cout <<
"usage: g4-vis {detector.gdml}" << std::endl;
14 std::cout <<
" {detector.gdml} is the geometry description "
15 "that you wish to visualize."
19int main(
int argc,
char* argv[]) {
22 std::cerr <<
"** Need to be given a single detector description. **"
27 std::string the_arg{argv[1]};
28 if (the_arg ==
"-h" or the_arg ==
"--help") {
37 parser_parameters.addParameter(
"validate_detector",
true);
38 parser_parameters.addParameter<std::string>(
"detector", the_arg);
41 G4RunManager* run_manager =
new G4RunManager;
44 auto parser{simcore::geo::Parser::Factory::get().make(
45 "gdml", parser_parameters, empty_interface)};
47 std::cerr <<
"Unable to create a 'gdml' parser to read the geometry."
51 auto parser_ptr{parser.value()};
53 parser_ptr, parser_parameters, empty_interface));
54 G4GeometryManager::GetInstance()->OpenGeometry();
56 run_manager->DefineWorldVolume(parser_ptr->getWorldVolume());
59 G4PhysListFactory lists;
60 run_manager->SetUserInitialization(lists.GetReferencePhysList(
"FTFP_BERT"));
62 run_manager->Initialize();
65 G4UIExecutive* ui =
new G4UIExecutive(argc, argv);
66 G4VisManager* vis_manager =
new G4VisExecutive;
67 vis_manager->Initialize();
Base classes for all user event processing components to extend.
Base class for all event processing components.
Class encapsulating parameters for configuring a processor.
Handle to the conditions system, provided at construction to classes which require it.
Implements the Geant4 detector construction.