LDMX Software
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
simcore::geo::GDMLParser Class Reference

Parse GDML files, build the geometry in memory and load it into Geant4. More...

#include <GDMLParser.h>

Public Member Functions

 GDMLParser (framework::config::Parameters &parameters, simcore::ConditionsInterface &ci)
 Default constructor.
 
virtual ~GDMLParser ()=default
 Default destructor.
 
G4VPhysicalVolume * GetWorldVolume () override
 Retrieve the G4VPhysicalVolume associated with the most top-level (world) volume.
 
std::string getDetectorName () override
 Get the name of the parsed detector.
 
void read () override
 Parse the detector geometry and read it into memory.
 

Static Public Member Functions

static Parsercreate (framework::config::Parameters &parameters, simcore::ConditionsInterface &ci)
 Create an instance of this parser.
 

Private Attributes

std::unique_ptr< G4GDMLParser > parser_
 The GDML parser.
 
std::unique_ptr< simcore::geo::AuxInfoReaderinfo_
 The auxiliary info reader.
 
std::string detector_
 path to the detector GDML
 
bool validate_
 should we take the time to validate
 
std::string detector_name_ {""}
 The name of the parsed detector.
 

Detailed Description

Parse GDML files, build the geometry in memory and load it into Geant4.

This class extends the interface Parser which allows creation of the parser at runtime via a factory.

Definition at line 26 of file GDMLParser.h.

Constructor & Destructor Documentation

◆ GDMLParser()

simcore::geo::GDMLParser::GDMLParser ( framework::config::Parameters parameters,
simcore::ConditionsInterface ci 
)

Default constructor.

Parameters
parametersThe parameters used to configure this parser.
ciInterface that allows access to the conditions.

Definition at line 6 of file GDMLParser.cxx.

7 {
8 detector_ = parameters.getParameter<std::string>("detector");
9 validate_ = parameters.getParameter<bool>("validate_detector");
10 parser_ = std::make_unique<G4GDMLParser>();
11 parser_->SetOverlapCheck(validate_);
12 info_ =
13 std::make_unique<simcore::geo::AuxInfoReader>(parser_.get(), parameters);
14}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
bool validate_
should we take the time to validate
Definition GDMLParser.h:82
std::unique_ptr< simcore::geo::AuxInfoReader > info_
The auxiliary info reader.
Definition GDMLParser.h:76
std::string detector_
path to the detector GDML
Definition GDMLParser.h:79
std::unique_ptr< G4GDMLParser > parser_
The GDML parser.
Definition GDMLParser.h:73

References detector_, framework::config::Parameters::getParameter(), info_, parser_, and validate_.

Member Function Documentation

◆ create()

static Parser * simcore::geo::GDMLParser::create ( framework::config::Parameters parameters,
simcore::ConditionsInterface ci 
)
inlinestatic

Create an instance of this parser.

Definition at line 66 of file GDMLParser.h.

67 {
68 return new GDMLParser(parameters, ci);
69 }
GDMLParser(framework::config::Parameters &parameters, simcore::ConditionsInterface &ci)
Default constructor.
Definition GDMLParser.cxx:6

Referenced by simcore::geo::ParserFactory::ParserFactory().

◆ getDetectorName()

std::string simcore::geo::GDMLParser::getDetectorName ( )
inlineoverridevirtual

Get the name of the parsed detector.

This name is typically extracted from the file containing the detector description.

Returns
The name of the detector.

Implements simcore::geo::Parser.

Definition at line 56 of file GDMLParser.h.

56{ return detector_name_; }
std::string detector_name_
The name of the parsed detector.
Definition GDMLParser.h:85

References detector_name_.

◆ GetWorldVolume()

G4VPhysicalVolume * simcore::geo::GDMLParser::GetWorldVolume ( )
overridevirtual

Retrieve the G4VPhysicalVolume associated with the most top-level (world) volume.

Returns
The world volume.

Implements simcore::geo::Parser.

Definition at line 16 of file GDMLParser.cxx.

16 {
17 return parser_->GetWorldVolume();
18}

References parser_.

◆ read()

void simcore::geo::GDMLParser::read ( )
overridevirtual

Parse the detector geometry and read it into memory.

Implements simcore::geo::Parser.

Definition at line 20 of file GDMLParser.cxx.

20 {
22 info_->readGlobalAuxInfo();
23 info_->assignAuxInfoToVolumes();
24 detector_name_ = info_->getDetectorHeader()->getName();
25}

References detector_, detector_name_, info_, parser_, and validate_.

Member Data Documentation

◆ detector_

std::string simcore::geo::GDMLParser::detector_
private

path to the detector GDML

Definition at line 79 of file GDMLParser.h.

Referenced by GDMLParser(), and read().

◆ detector_name_

std::string simcore::geo::GDMLParser::detector_name_ {""}
private

The name of the parsed detector.

Definition at line 85 of file GDMLParser.h.

85{""};

Referenced by getDetectorName(), and read().

◆ info_

std::unique_ptr<simcore::geo::AuxInfoReader> simcore::geo::GDMLParser::info_
private

The auxiliary info reader.

Definition at line 76 of file GDMLParser.h.

Referenced by GDMLParser(), and read().

◆ parser_

std::unique_ptr<G4GDMLParser> simcore::geo::GDMLParser::parser_
private

The GDML parser.

Definition at line 73 of file GDMLParser.h.

Referenced by GDMLParser(), GetWorldVolume(), and read().

◆ validate_

bool simcore::geo::GDMLParser::validate_
private

should we take the time to validate

Definition at line 82 of file GDMLParser.h.

Referenced by GDMLParser(), and read().


The documentation for this class was generated from the following files: