10 #ifndef LARCOREALG_GEOMETRY_ROOTGEOMETRYNAVIGATOR_H 11 #define LARCOREALG_GEOMETRY_ROOTGEOMETRYNAVIGATOR_H 19 #include "TGeoManager.h" 21 #include "TGeoVolume.h" 30 class ROOTGeometryNavigator;
72 : fTopNode(manager.GetTopNode())
92 template <
typename Op>
106 template <
typename Op>
107 bool apply(TGeoNode
const& node, Op&& op)
const;
118 template <
typename Op>
119 bool apply(Op&& op)
const;
127 template <
typename Op>
129 if (!op(path))
return false;
131 TGeoNode
const& node = path.
current();
132 TGeoVolume
const* pVolume = node.GetVolume();
134 int const nDaughters = pVolume->GetNdaughters();
135 for (
int iDaughter: util::counter<int>(nDaughters)) {
136 TGeoNode
const* pDaughter = pVolume->GetNode(iDaughter);
137 if (!pDaughter)
continue;
140 if (!
apply(path, std::forward<Op>(op)))
return false;
150 template <
typename Op>
153 return apply(path, std::forward<Op>(op));
158 template <
typename Op>
168 #endif // LARCOREALG_GEOMETRY_ROOTGEOMETRYNAVIGATOR_H bool apply(geo::GeoNodePath &path, Op &&op) const
Applies the specified operation to all nodes under the path.
Executes an operation on all the nodes of the ROOT geometry.
Class representing a path in ROOT geometry.
void append(Node_t const &node)
Adds a node to the current path.
void pop()
Removes the current node from the path, moving the current one up.
Test of util::counter and support utilities.
TGeoNode const * fTopNode
Representation of a node and its ancestry.
Node_t const & current() const
Returns the current node. Undefined if the path is empty.
ROOTGeometryNavigator(TGeoManager const &manager)
Constructor: picks the manager.
LArSoft geometry interface.