LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
geo::GeometryExtractor Class Reference

Object for extracting geometry objects from the GDML file. More...

#include "GeometryExtractor.h"

Classes

struct  Config
 

Public Member Functions

 GeometryExtractor (Config const &config)
 
template<typename FT >
void operator() (Path_t &path, std::function< bool(TGeoNode const &)> IsObj, FT captureObject) const
 Boilerplate implementation of geometry-extraction methods. More...
 

Private Types

using Path_t = GeoNodePath
 

Private Attributes

Path_t::Depth_t fMaxDepth
 Maximum level to descend into in the path. More...
 

Detailed Description

Object for extracting geometry objects from the GDML file.

The general flow of the algorithm is a top-down crawl of the geometry tree structure, where the top objects (cryostats and auxiliary detectors) are discovered and built, and each of these objects takes care of discovering its own relevant components. Therefore e.g. the cryostat algorithm will, once found a candidate cryostat, descend into it to discover TPCs and optical detectors. This nested discovery is delegated to other algorithms, and e.g. the TPC algorithm will take care of creating a TPC and populating it with wire planes whose discovery is again delegated to another algorithm.

Definition at line 39 of file GeometryExtractor.h.

Member Typedef Documentation

Definition at line 40 of file GeometryExtractor.h.

Constructor & Destructor Documentation

geo::GeometryExtractor::GeometryExtractor ( Config const &  config)
inlineexplicit

Definition at line 51 of file GeometryExtractor.h.

References geo::GeometryExtractor::Config::maxDepth, and operator()().

51 : fMaxDepth{config.maxDepth()} {}
Path_t::Depth_t fMaxDepth
Maximum level to descend into in the path.

Member Function Documentation

template<typename FT >
void geo::GeometryExtractor::operator() ( Path_t path,
std::function< bool(TGeoNode const &)>  IsObj,
FT  captureObject 
) const

Boilerplate implementation of geometry-extraction methods.

Template Parameters
ObjGeothe geometry object being extracted (e.g. geo::WireGeo)
Parameters
paththe path to the node describing the object
IsObjfunction to identify if a node is of the right type
captureObjectcallable object invoked to create the target object from a path

This implementation first evaluates if the current node in the specified path is suitable to create a ObjGeo; if not, then it descends into the node daughters and recursively to their descendents. For each candidate node, a ObjGeo is created. All descendents of the candidates are ignored.

Note
The recursive descent is an inefficiency whenever it is know that the specified element will not be part of a given branch of the geometry tree.
Multithreading note: path is allowed to change during processing.

Definition at line 83 of file GeometryExtractor.h.

References geo::GeoNodePath::append(), geo::GeoNodePath::current(), geo::GeoNodePath::depth(), fMaxDepth, n, and geo::GeoNodePath::pop().

Referenced by GeometryExtractor().

86  {
87  TGeoNode const* current = path.current();
88  if (IsObj(*current)) {
89  captureObject(path);
90  return;
91  }
92 
93  // descend into the next layer down, concatenate the results and return them
94  if (path.depth() >= fMaxDepth) return; // yep, this is empty
95 
96  int const n = current->GetNdaughters();
97  for (int i = 0; i < n; ++i) {
98  path.append(current->GetDaughter(i));
99  operator()(path, IsObj, captureObject);
100  path.pop();
101  }
102  }
void operator()(Path_t &path, std::function< bool(TGeoNode const &)> IsObj, FT captureObject) const
Boilerplate implementation of geometry-extraction methods.
Path_t::Depth_t fMaxDepth
Maximum level to descend into in the path.
Char_t n[5]

Member Data Documentation

Path_t::Depth_t geo::GeometryExtractor::fMaxDepth
private

Maximum level to descend into in the path.

Definition at line 77 of file GeometryExtractor.h.

Referenced by operator()().


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