LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
geo::ROOTGeoPathBuilder Class Reference

Public Types

using PathIndex_t = std::vector< std::size_t >
 
using Path_t = std::vector< TGeoNode const * >
 

Public Member Functions

 ROOTGeoPathBuilder (TGeoNode const *rootNode)
 
Path_t toPath (PathIndex_t const &pathIndex) const
 

Static Public Member Functions

static PathIndex_t toPathIndex (Path_t const &path)
 
static Path_t toPath (TGeoNode const *rootNode, PathIndex_t const &pathIndex)
 
static PathIndex_t emptyPathIndex ()
 
static Path_t emptyPath ()
 

Static Private Member Functions

static std::size_t findDaughterIndex (TGeoNode const *pDaughter, TGeoNode const *pParent)
 

Private Attributes

TGeoNode const * pRoot = nullptr
 

Detailed Description

Definition at line 989 of file GeometryCore.cxx.

Member Typedef Documentation

using geo::ROOTGeoPathBuilder::Path_t = std::vector<TGeoNode const*>

Definition at line 992 of file GeometryCore.cxx.

using geo::ROOTGeoPathBuilder::PathIndex_t = std::vector<std::size_t>

Definition at line 991 of file GeometryCore.cxx.

Constructor & Destructor Documentation

geo::ROOTGeoPathBuilder::ROOTGeoPathBuilder ( TGeoNode const *  rootNode)
inline

Definition at line 994 of file GeometryCore.cxx.

994 : pRoot(rootNode) {}
TGeoNode const * pRoot

Member Function Documentation

static Path_t geo::ROOTGeoPathBuilder::emptyPath ( )
inlinestatic

Definition at line 1026 of file GeometryCore.cxx.

1026 { return {}; }
static PathIndex_t geo::ROOTGeoPathBuilder::emptyPathIndex ( )
inlinestatic

Definition at line 1025 of file GeometryCore.cxx.

1025 { return {}; }
static std::size_t geo::ROOTGeoPathBuilder::findDaughterIndex ( TGeoNode const *  pDaughter,
TGeoNode const *  pParent 
)
inlinestaticprivate

Definition at line 1032 of file GeometryCore.cxx.

References n.

1033  {
1034  assert(pParent);
1035  std::size_t n = pParent->GetNdaughters();
1036  for (std::size_t i = 0U; i < n; ++i) {
1037  if (pParent->GetDaughter(i) == pDaughter) return i;
1038  }
1039  throw std::runtime_error("Node is not daughter of specified parent!");
1040  } // findDaughterIndex()
Char_t n[5]
Path_t geo::ROOTGeoPathBuilder::toPath ( PathIndex_t const &  pathIndex) const
inline

Definition at line 996 of file GeometryCore.cxx.

997  { return toPath(pRoot, pathIndex); }
TGeoNode const * pRoot
Path_t toPath(PathIndex_t const &pathIndex) const
static Path_t geo::ROOTGeoPathBuilder::toPath ( TGeoNode const *  rootNode,
PathIndex_t const &  pathIndex 
)
inlinestatic

Definition at line 1013 of file GeometryCore.cxx.

1014  {
1015  Path_t path;
1016  path.push_back(rootNode);
1017  TGeoNode const* pCurrentNode = path.back();
1018  for (std::size_t daughterIndex: pathIndex) {
1019  pCurrentNode = pCurrentNode->GetVolume()->GetNode(daughterIndex);
1020  path.push_back(pCurrentNode);
1021  }
1022  return path;
1023  } // toPath()
std::vector< TGeoNode const * > Path_t
static PathIndex_t geo::ROOTGeoPathBuilder::toPathIndex ( Path_t const &  path)
inlinestatic

Definition at line 999 of file GeometryCore.cxx.

References geo::vect::indices().

1000  {
1001  assert(!path.empty());
1003  auto itParent = path.begin();
1004  auto itDaughter = itParent;
1005  while (++itDaughter != path.end()) {
1006  indices.push_back(findDaughterIndex(*itDaughter, *itParent));
1007  itParent = itDaughter;
1008  }
1009  return indices;
1010  } // toPathIndex()
std::vector< std::size_t > PathIndex_t
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices()
Returns a sequence of indices valid for a vector of the specified type.
static std::size_t findDaughterIndex(TGeoNode const *pDaughter, TGeoNode const *pParent)

Member Data Documentation

TGeoNode const* geo::ROOTGeoPathBuilder::pRoot = nullptr
private

Definition at line 1029 of file GeometryCore.cxx.


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