19 #include "TGeoManager.h" 28 std::unique_ptr<geo::GeometryCore>
32 std::shared_ptr<geo::ChannelMapAlg> channelMap
35 auto const bForceReload =
true;
40 auto geom = std::make_unique<geo::GeometryCore>(pset);
45 std::string relPath = pset.
get<std::string>(
"RelativePath",
"" );
46 const bool disableWiresInG4 = pset.
get<
bool> (
"DisableWiresInG4",
false);
47 const std::string GDMLFileName = pset.
get<std::string>(
"GDML" );
51 if (!relPath.empty() && (relPath.back() !=
'/')) relPath +=
'/';
56 cet::search_path sp(
"FW_SEARCH_PATH");
62 std::string GDMLFilePathHint = relPath + GDMLFileName;
65 if(disableWiresInG4) {
66 GDMLFilePathHint.insert(
67 std::min(GDMLFilePathHint.rfind(
".gdml"), GDMLFilePathHint.length()),
72 std::string GDMLFilePath;
73 if( !sp.find_file(GDMLFilePathHint, GDMLFilePath) ) {
75 <<
"Can't find geometry file '" << GDMLFilePathHint
76 <<
"' (for GEANT4)!\n";
83 std::string ROOTFilePathHint = relPath + GDMLFileName;
85 std::string ROOTFilePath;
86 if( !sp.find_file(ROOTFilePathHint, ROOTFilePath) ) {
88 <<
"Can't find geometry file '" << ROOTFilePathHint
89 <<
"' (for geometry)!\n";
95 geom->LoadGeometryFile(GDMLFilePath, ROOTFilePath, bForceReload);
101 geom->ApplyChannelMap(channelMap);
std::unique_ptr< geo::GeometryCore > SetupGeometryWithChannelMapping(fhicl::ParameterSet const &pset, std::shared_ptr< geo::ChannelMapAlg > channelMap)
Initializes a LArSoft geometry object.
Utilities for one-line geometry initialization.
Access the description of detector geometry.
T get(std::string const &key) const
Interface to algorithm class for a specific detector channel mapping.
cet::coded_exception< error, detail::translate > exception