19 #include "TGeoManager.h" 29 std::unique_ptr<geo::ChannelMapAlg> channelMap)
31 auto const bForceReload =
true;
36 auto geom = std::make_unique<geo::GeometryCore>(pset);
41 std::string relPath = pset.
get<std::string>(
"RelativePath",
"");
42 const bool disableWiresInG4 = pset.
get<
bool>(
"DisableWiresInG4",
false);
43 const std::string GDMLFileName = pset.
get<std::string>(
"GDML");
47 if (!relPath.empty() && (relPath.back() !=
'/')) relPath +=
'/';
52 cet::search_path sp(
"FW_SEARCH_PATH");
58 std::string GDMLFilePathHint = relPath + GDMLFileName;
61 if (disableWiresInG4) {
62 GDMLFilePathHint.insert(std::min(GDMLFilePathHint.rfind(
".gdml"), GDMLFilePathHint.length()),
66 std::string GDMLFilePath;
67 if (!sp.find_file(GDMLFilePathHint, GDMLFilePath)) {
69 <<
"Can't find geometry file '" << GDMLFilePathHint <<
"' (for GEANT4)!\n";
76 std::string ROOTFilePathHint = relPath + GDMLFileName;
78 std::string ROOTFilePath;
79 if (!sp.find_file(ROOTFilePathHint, ROOTFilePath)) {
81 <<
"Can't find geometry file '" << ROOTFilePathHint <<
"' (for geometry)!\n";
87 geom->LoadGeometryFile(GDMLFilePath, ROOTFilePath, bForceReload);
93 geom->ApplyChannelMap(move(channelMap));
Utilities for one-line geometry initialization.
Access the description of detector geometry.
T get(std::string const &key) const
std::unique_ptr< geo::GeometryCore > SetupGeometryWithChannelMapping(fhicl::ParameterSet const &pset, std::unique_ptr< geo::ChannelMapAlg > channelMap)
Initializes a LArSoft geometry object.
Interface to algorithm class for a specific detector channel mapping.
cet::coded_exception< error, detail::translate > exception