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/ParserFactory.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* runManager =
new G4RunManager;
45 "gdml", parser_parameters, empty_interface)};
47 parser, parser_parameters, empty_interface));
48 G4GeometryManager::GetInstance()->OpenGeometry();
50 runManager->DefineWorldVolume(parser->GetWorldVolume());
53 G4PhysListFactory lists;
54 runManager->SetUserInitialization(lists.GetReferencePhysList(
"FTFP_BERT"));
56 runManager->Initialize();
59 G4UIExecutive* ui =
new G4UIExecutive(argc, argv);
60 G4VisManager* visManager =
new G4VisExecutive;
61 visManager->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.
void addParameter(const std::string &name, const T &value)
Add a parameter to the parameter list.
Handle to the conditions system, provided at construction to classes which require it.
Implements the Geant4 detector construction.
Parser * createParser(const std::string &name, framework::config::Parameters ¶meters, simcore::ConditionsInterface &ci)
Create an instance of the parser of the given type.
static ParserFactory & getInstance()
Get the instance to this factory.
virtual void read()=0
Parse the detector geometry and read it into memory.