LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geo::GeoNodePath Class Reference

Representation of a node and its ancestry. More...

#include "GeoNodePath.h"

Public Types

using Node_t = TGeoNode const
 Type of node object. More...
 
using Nodes_t = std::vector< Node_t const * >
 Type of list of nodes. More...
 
using Depth_t = std::size_t
 Type used to represent the depth of the path. More...
 

Public Member Functions

 GeoNodePath ()=default
 Default constructor: an empty path. More...
 
 GeoNodePath (std::initializer_list< TGeoNode const * > nodes)
 Sets all the the specified nodes into the current path. More...
 
template<typename Iter >
 GeoNodePath (Iter begin, Iter end)
 Sets the nodes from begin to end as the path content. More...
 
bool empty () const
 Returns whether there is a current node. More...
 
Depth_t depth () const
 Returns the depth of the path (elements including up to the current). More...
 
Node_t const & current () const
 Returns the current node. Undefined if the path is empty. More...
 
void append (Node_t const &node)
 Adds a node to the current path. More...
 
void pop ()
 Removes the current node from the path, moving the current one up. More...
 
template<typename Matrix = TGeoHMatrix>
Matrix currentTransformation () const
 Returns the total transformation to the current node, as a Matrix. More...
 
 operator std::string () const
 Prints the full path (as node names) into a string. More...
 

Private Attributes

Nodes_t fNodes
 Local path of pointers to ROOT geometry nodes. More...
 

Detailed Description

Representation of a node and its ancestry.

A GeoNodePath contains a sequence of nodes, from the root() node down to a current() one.

It behaves like a stack in that it inserts and removes elements at the "top", which is also what defines the current node.

Definition at line 37 of file GeoNodePath.h.

Member Typedef Documentation

using geo::GeoNodePath::Depth_t = std::size_t

Type used to represent the depth of the path.

Definition at line 48 of file GeoNodePath.h.

using geo::GeoNodePath::Node_t = TGeoNode const

Type of node object.

Definition at line 42 of file GeoNodePath.h.

using geo::GeoNodePath::Nodes_t = std::vector<Node_t const*>

Type of list of nodes.

Definition at line 45 of file GeoNodePath.h.

Constructor & Destructor Documentation

geo::GeoNodePath::GeoNodePath ( )
default

Default constructor: an empty path.

geo::GeoNodePath::GeoNodePath ( std::initializer_list< TGeoNode const * >  nodes)
inline

Sets all the the specified nodes into the current path.

Definition at line 57 of file GeoNodePath.h.

57 : fNodes(nodes) {}
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:94
template<typename Iter >
geo::GeoNodePath::GeoNodePath ( Iter  begin,
Iter  end 
)
inline

Sets the nodes from begin to end as the path content.

Definition at line 61 of file GeoNodePath.h.

61  : fNodes(begin, end)
62  {}
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:94
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69

Member Function Documentation

void geo::GeoNodePath::append ( Node_t const &  node)
inline

Adds a node to the current path.

Definition at line 80 of file GeoNodePath.h.

References fNodes.

Referenced by geo::ROOTGeometryNavigator::apply(), and geo::GeometryBuilderStandard::doExtractGeometryObjects().

80 { fNodes.push_back(&node); }
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:94
template<typename Matrix >
Matrix geo::GeoNodePath::currentTransformation ( ) const

Returns the total transformation to the current node, as a Matrix.

Definition at line 104 of file GeoNodePath.h.

References fNodes.

Referenced by geo::GeometryBuilderStandard::doMakeAuxDet(), geo::GeometryBuilderStandard::doMakeAuxDetSensitive(), geo::GeometryBuilderStandard::doMakeCryostat(), geo::GeometryBuilderStandard::doMakeOpDet(), geo::GeometryBuilderStandard::doMakePlane(), geo::GeometryBuilderStandard::doMakeTPC(), geo::GeometryBuilderStandard::doMakeWire(), and pop().

105 {
106  return geo::transformationFromPath<Matrix>(fNodes.begin(), fNodes.end());
107 } // geo::GeoNodePath::currentTransformation()
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:94
Depth_t geo::GeoNodePath::depth ( ) const
inline

Returns the depth of the path (elements including up to the current).

Definition at line 71 of file GeoNodePath.h.

References fNodes.

Referenced by geo::GeometryBuilderStandard::doExtractGeometryObjects().

71 { return fNodes.size(); }
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:94
bool geo::GeoNodePath::empty ( ) const
inline

Returns whether there is a current node.

Definition at line 68 of file GeoNodePath.h.

References fNodes.

68 { return fNodes.empty(); }
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:94
geo::GeoNodePath::operator std::string ( ) const

Prints the full path (as node names) into a string.

Definition at line 16 of file GeoNodePath.cxx.

References util::end().

17 {
18 
19  std::string s = "[";
20  auto it = fNodes.cbegin(), end = fNodes.cend();
21  if (it != end) {
22  s += (*it++)->GetName();
23  while (++it != fNodes.cend()) {
24  s += '/';
25  s += (*it)->GetName();
26  }
27  } // if
28  return s + "]";
29 
30 } // operator std::string()
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:94
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
void geo::GeoNodePath::pop ( )
inline

Removes the current node from the path, moving the current one up.

Definition at line 83 of file GeoNodePath.h.

References currentTransformation(), and fNodes.

Referenced by geo::ROOTGeometryNavigator::apply(), and geo::GeometryBuilderStandard::doExtractGeometryObjects().

83 { fNodes.pop_back(); }
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:94

Member Data Documentation

Nodes_t geo::GeoNodePath::fNodes
private

Local path of pointers to ROOT geometry nodes.

Definition at line 94 of file GeoNodePath.h.

Referenced by append(), current(), currentTransformation(), depth(), empty(), and pop().


The documentation for this class was generated from the following files: