10 #ifndef LARCOREALG_GEOMETRY_ROOTGEOMETRYNAVIGATOR_H 11 #define LARCOREALG_GEOMETRY_ROOTGEOMETRYNAVIGATOR_H 18 #include "TGeoManager.h" 20 #include "TGeoVolume.h" 28 class ROOTGeometryNavigator;
86 template <
typename Op>
100 template <
typename Op>
101 bool apply(TGeoNode
const& node, Op&& op)
const;
112 template <
typename Op>
113 bool apply(Op&& op)
const;
120 template <
typename Op>
123 if (!op(path))
return false;
125 TGeoNode
const& node = path.
current();
126 TGeoVolume
const* pVolume = node.GetVolume();
128 int const nDaughters = pVolume->GetNdaughters();
129 for (
int iDaughter : util::counter<int>(nDaughters)) {
130 TGeoNode
const* pDaughter = pVolume->GetNode(iDaughter);
131 if (!pDaughter)
continue;
134 if (!
apply(path, std::forward<Op>(op)))
return false;
143 template <
typename Op>
147 return apply(path, std::forward<Op>(op));
151 template <
typename Op>
160 #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.
Namespace collecting geometry-related classes utilities.