Public Types | Public Member Functions | Private Attributes | List of all members
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 38 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 50 of file GeoNodePath.h.

using geo::GeoNodePath::Node_t = TGeoNode const

Type of node object.

Definition at line 44 of file GeoNodePath.h.

Type of list of nodes.

Definition at line 47 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 59 of file GeoNodePath.h.

60  : fNodes(nodes)
61  {}
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:102
#define nodes
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 65 of file GeoNodePath.h.

65 : fNodes(begin, end) {}
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:102
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72

Member Function Documentation

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

Adds a node to the current path.

Definition at line 85 of file GeoNodePath.h.

85 { fNodes.push_back(&node); }
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:102
Node_t const& geo::GeoNodePath::current ( ) const
inline

Returns the current node. Undefined if the path is empty.

Definition at line 78 of file GeoNodePath.h.

78 { return *(fNodes.back()); }
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:102
template<typename Matrix >
Matrix geo::GeoNodePath::currentTransformation ( ) const

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

Definition at line 114 of file GeoNodePath.h.

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

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

Definition at line 75 of file GeoNodePath.h.

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

Returns whether there is a current node.

Definition at line 72 of file GeoNodePath.h.

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

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

Definition at line 16 of file GeoNodePath.cxx.

16  {
17 
18  std::string s = "[";
19  auto it = fNodes.cbegin(), end = fNodes.cend();
20  if (it != end) {
21  s += (*it++)->GetName();
22  while (++it != fNodes.cend()) {
23  s += '/';
24  s += (*it)->GetName();
25  }
26  } // if
27  return s + "]";
28 
29 } // operator std::string()
Nodes_t fNodes
Local path of pointers to ROOT geometry nodes.
Definition: GeoNodePath.h:102
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::string string
Definition: nybbler.cc:12
static QCString * s
Definition: config.cpp:1042
void geo::GeoNodePath::pop ( )
inline

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

Definition at line 88 of file GeoNodePath.h.

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

Member Data Documentation

Nodes_t geo::GeoNodePath::fNodes
private

Local path of pointers to ROOT geometry nodes.

Definition at line 102 of file GeoNodePath.h.


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