LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
WireReadoutGeomBuilderStandard.cxx
Go to the documentation of this file.
1 // LArSoft libraries
3 
4 // ROOT libraries
5 #include "TGeoNode.h"
6 
7 // C++ standard library
8 #include <algorithm> // std::move(...)
9 #include <string_view>
10 
11 using namespace std::literals;
12 
13 namespace {
14  template <typename Dest, typename Src>
15  void extendCollection(Dest& dest, Src&& src)
16  {
17  std::move(src.begin(), src.end(), std::back_inserter(dest));
18  }
19 
22  bool starts_with(std::string_view const s, std::string_view const key)
23  {
24  return s.compare(0, key.size(), key) == 0;
25  }
26 
27  bool isPlaneNode(TGeoNode const& node)
28  {
29  return starts_with(node.GetName(), "volTPCPlane"sv);
30  }
31  bool isWireNode(TGeoNode const& node)
32  {
33  return starts_with(node.GetName(), "volTPCWire"sv);
34  }
35 }
36 
38  fhicl::Table<Config> const& config)
39  : fExtractObjects(config().extractor())
40 {}
41 
44 {}
45 //------------------------------------------------------------------------------
47 {
48  Planes_t result;
49  fExtractObjects(path, isPlaneNode, [&result, this](Path_t& path) {
50  auto const [tpc, tpc_hash] = path.parent_entry();
51  assert(tpc);
52  result[tpc_hash].push_back(makePlane(path));
53  });
54  return result;
55 }
56 
57 //------------------------------------------------------------------------------
59 {
60  return {path.current(), path.currentTransformation<TransformationMatrix>(), extractWires(path)};
61 }
62 
63 //------------------------------------------------------------------------------
64 std::vector<geo::WireGeo> geo::WireReadoutGeomBuilderStandard::extractWires(Path_t& path) const
65 {
66  std::vector<WireGeo> result;
68  path, isWireNode, [&result, this](Path_t const& path) { result.push_back(makeWire(path)); });
69  return result;
70 }
71 
72 //------------------------------------------------------------------------------
74 {
75  return {path.current(), path.currentTransformation<TransformationMatrix>()};
76 }
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:112
WireReadoutGeomBuilderStandard(fhicl::Table< Config > const &config)
TGeoNode const * current() const
Returns the current node. Undefined if the path is empty.
Definition: GeoNodePath.cxx:51
Entry parent_entry() const
Returns the parent entry of the current entry, or null if there is no parent.
Definition: GeoNodePath.cxx:61
WireGeo makeWire(Path_t const &path) const
Planes_t doExtractPlanes(Path_t &path) const override
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:67
std::map< std::size_t, std::vector< PlaneGeo >> Planes_t
Collection of wire-plane information objects.
Matrix currentTransformation() const
Returns the total transformation to the current node, as a Matrix.
Definition: GeoNodePath.h:94
Extracts of LArSoft geometry information from ROOT.
std::vector< WireGeo > extractWires(Path_t &path) const
Representation of a node and its ancestry.
Definition: GeoNodePath.h:34
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.