LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
StandaloneGeometrySetup.h
Go to the documentation of this file.
1 
10 #ifndef LARCOREALG_GEOMETRY_STANDALONEGEOMETRYSETUP_H
11 #define LARCOREALG_GEOMETRY_STANDALONEGEOMETRYSETUP_H
12 
13 // LArSoft libraries
21 
22 // art-provided libraries
23 #include "fhiclcpp/ParameterSet.h"
24 
25 // C/C++ standard libraries
26 #include <memory> // std::make_unique()
27 #include <set>
28 #include <string>
29 
30 namespace lar::standalone {
31 
32  // --- BEGIN Geometry group ------------------------------------------------
35 
36  //--------------------------------------------------------------------------
92  std::unique_ptr<geo::GeometryCore> GeometryFor(fhicl::ParameterSet const& pset,
93  std::unique_ptr<geo::GeoObjectSorter> sorter);
94 
95  std::unique_ptr<geo::AuxDetGeometryCore> AuxDetGeometryFor(
96  fhicl::ParameterSet const& pset,
97  std::unique_ptr<geo::AuxDetGeoObjectSorter> sorter,
98  std::unique_ptr<geo::AuxDetInitializer> initializer = nullptr);
99 
100  namespace detail {
101  template <typename T>
103  {
104  if (pset.is_empty()) {
105  if constexpr (std::is_constructible_v<T>) { return std::make_unique<T>(); }
106  }
107  return std::make_unique<T>(pset);
108  }
109  }
110 
111  template <typename ObjectSorter = geo::GeoObjectSorterStandard>
112  std::unique_ptr<geo::GeometryCore> SetupGeometry(fhicl::ParameterSet const& pset)
113  {
114  auto sorting_parameters = pset.get<fhicl::ParameterSet>("SortingParameters", {});
115  return GeometryFor(pset, detail::make_unique_maybe_default<ObjectSorter>(sorting_parameters));
116  }
117 
118  template <typename ObjectSorter = geo::AuxDetGeoObjectSorterStandard>
119  std::unique_ptr<geo::AuxDetGeometryCore> SetupAuxDetGeometry(fhicl::ParameterSet const& pset)
120  {
121  auto sorting_parameters = pset.get<fhicl::ParameterSet>("SortingParameters", {});
122  return AuxDetGeometryFor(pset,
123  detail::make_unique_maybe_default<ObjectSorter>(sorting_parameters));
124  }
125 
126  template <typename ObjectSorter = geo::WireReadoutSorterStandard,
127  typename WireGeom = geo::WireReadoutStandardGeom>
128  std::unique_ptr<geo::WireReadoutGeom> SetupReadout(fhicl::ParameterSet const& pset,
129  geo::GeometryCore const* geom)
130  {
131  auto sorting_parameters = pset.get<fhicl::ParameterSet>("SortingParameters", {});
132  return std::make_unique<WireGeom>(
133  pset, geom, detail::make_unique_maybe_default<ObjectSorter>(sorting_parameters));
134  }
135 
136  // --- END Geometry group --------------------------------------------------
138 
139 } // namespace lar::standalone
140 
141 #endif // LARCOREALG_GEOMETRY_STANDALONEGEOMETRYSETUP_H
std::unique_ptr< geo::GeometryCore > SetupGeometry(fhicl::ParameterSet const &pset)
Initializes a LArSoft geometry object.
Standard algorithm class for sorting of geo::AuxDet objects .
Access the description of auxiliary detector geometry.
Access the description of the physical detector geometry.
T get(std::string const &key) const
Definition: ParameterSet.h:314
std::unique_ptr< geo::WireReadoutGeom > SetupReadout(fhicl::ParameterSet const &pset, geo::GeometryCore const *geom)
Initializes a LArSoft geometry object.
std::unique_ptr< geo::GeometryCore > GeometryFor(fhicl::ParameterSet const &pset, std::unique_ptr< geo::GeoObjectSorter > sorter)
Initializes a LArSoft geometry object.
Description of the physical geometry of one entire detector.
Definition: GeometryCore.h:91
auto make_unique_maybe_default(fhicl::ParameterSet const &pset)
std::unique_ptr< geo::AuxDetGeometryCore > AuxDetGeometryFor(fhicl::ParameterSet const &pset, std::unique_ptr< geo::AuxDetGeoObjectSorter > sorter, std::unique_ptr< geo::AuxDetInitializer > initializer=nullptr)
Initializes a LArSoft geometry object.
bool is_empty() const
Utilities for use in an environment without art.
Interface to algorithm class for a specific detector channel mapping.
std::unique_ptr< geo::AuxDetGeometryCore > SetupAuxDetGeometry(fhicl::ParameterSet const &pset)
Initializes a LArSoft geometry object.
Interface to geometry for wire readouts .
Interface to algorithm class for standard sorting of geo::XXXGeo objects .