17 #include "cetlib_except/exception.h" 18 #include "cetlib/search_path.h" 33 , fRelPath (pset.get<
std::string >(
"RelativePath",
"" ))
34 , fDisableWiresInG4 (pset.get< bool >(
"DisableWiresInG4", false))
35 , fForceUseFCLOnly (pset.get< bool >(
"ForceUseFCLOnly" , false))
36 , fSortingParameters(pset.get<
fhicl::ParameterSet>(
"SortingParameters",
fhicl::ParameterSet() ))
50 std::string GDMLFileName = pset.
get<std::string>(
"GDML");
51 std::string ROOTFileName = pset.
get<std::string>(
"GDML");
69 std::vector< art::Handle<sumdata::RunData> > rdcol;
72 mf::LogWarning(
"Geometry") <<
"cannot find sumdata::RunData object to grab detector name\n" 73 <<
"this is expected if generating MC files\n" 74 <<
"using default geometry from configuration file\n";
79 std::string newDetectorName = rdcol.front()->DetName();
84 std::string
const nodetname(
"nodetectorname");
85 if (newDetectorName == nodetname) {
86 LOG_WARNING(
"Geometry") <<
"Detector name not set: " << newDetectorName;
107 <<
" failed to load new channel map";
114 std::string gdmlfile, std::string ,
121 ROOTFileName.append(gdmlfile);
122 GDMLFileName.append(gdmlfile);
126 GDMLFileName.insert(GDMLFileName.find(
".gdml"),
"_nowires");
132 cet::search_path sp(
"FW_SEARCH_PATH");
134 std::string GDMLfile;
135 if( !sp.find_file(GDMLFileName, GDMLfile) ) {
137 <<
"cannot find the gdml geometry file:" 138 <<
"\n" << GDMLFileName
139 <<
"\nbail ungracefully.\n";
142 std::string ROOTfile;
143 if( !sp.find_file(ROOTFileName, ROOTfile) ) {
145 <<
"cannot find the root geometry file:\n" 146 <<
"\n" << ROOTFileName
147 <<
"\nbail ungracefully.\n";
void LoadGeometryFile(std::string gdmlfile, std::string rootfile, bool bForceReload=false)
Loads the geometry information from the specified files.
fhicl::ParameterSet fSortingParameters
Parameter set to define the channel map sorting.
#define DEFINE_ART_SERVICE(svc)
Geometry(fhicl::ParameterSet const &pset, art::ActivityRegistry ®)
void preBeginRun(art::Run const &run)
Updates the geometry if needed at the beginning of each new run.
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
T get(std::string const &key) const
void LoadNewGeometry(std::string gdmlfile, std::string rootfile, bool bForceReload=false)
Expands the provided paths and loads the geometry description(s)
void getManyByType(std::vector< Handle< PROD >> &results) const
Interface to a service that handles any experiment-specific knowledge that is needed by the Geometry ...
The geometry of one entire detector, as served by art.
Description of geometry of one entire detector.
Definition of data types for geometry description.
#define LOG_WARNING(category)
GlobalSignal< detail::SignalResponseType::FIFO, void(Run const &)> sPreBeginRun
geo::ChannelMapAlg const * ChannelMap() const
Returns the object handling the channel map.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Namespace collecting geometry-related classes utilities.
void SetDetectorName(std::string new_name)
Sets the detector name.
void InitializeChannelMap()
art framework interface to geometry description
cet::coded_exception< error, detail::translate > exception