ATLAS Offline Software
Classes | Typedefs | Functions
GeoVisitVolumes.h File Reference

Visitor to process all volumes under a GeoModel node. More...

#include "GeoPrimitives/GeoPrimitives.h"
#include "GeoModelKernel/GeoNodeAction.h"
#include "GeoModelKernel/GeoDefinitions.h"
#include <vector>
#include <variant>
Include dependency graph for GeoVisitVolumes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  IGeoVisitVolumesAction
 Define a simple callback for each volume found. More...
 
class  IGeoVisitVolumesNoXformAction
 Define a simple callback for each volume found, without keeping track of geometrical transforms. More...
 
class  GeoVisitVolumes
 Visitor to process all volumes under a GeoModel node. More...
 
class  GeoVisitVolumesAction< FUNCTION >
 Callback object calling a templated functional. More...
 
class  GeoVisitVolumesNoXformAction< FUNCTION >
 Callback object calling a templated functional. More...
 

Typedefs

typedef std::vector< std::pair< const GeoVPhysVol *, GeoTrf::Transform3D > > GeoVolumeVec_t
 Return the child volumes and associated transforms. More...
 

Functions

template<class FUNCTION >
void geoVisitVolumes (FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
 Template helper for running the visitor. More...
 
template<class FUNCTION >
void geoVisitVolumesNoXform (FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
 Template helper for running the visitor. More...
 
GeoVolumeVec_t geoGetVolumes (const GeoGraphNode *node, int depthLimit=1, int sizeHint=20)
 Return the child volumes and associated transforms. More...
 
std::vector< const GeoVPhysVol * > geoGetVolumesNoXform (const GeoGraphNode *node, int depthLimit=1, int sizeHint=20)
 Return the child volumes. More...
 

Detailed Description

Visitor to process all volumes under a GeoModel node.

Author
scott snyder snyde.nosp@m.r@bn.nosp@m.l.gov
Date
Jul, 2019 Based on GeoAccessVolumeAction.

Definition in file GeoVisitVolumes.h.

Typedef Documentation

◆ GeoVolumeVec_t

typedef std::vector<std::pair<const GeoVPhysVol*, GeoTrf::Transform3D> > GeoVolumeVec_t

Return the child volumes and associated transforms.

Parameters
nodeRoot of the graph to traverse.
depthLimitDepth limit for the traversal.
sizeHintHint about the number of volumes to be returned, to allow avoiding resizes of the output vector.

Returns a vector of (volume, transform) pairs for volumes in the graph. The same volume may be returned multiple times with different transforms in the case of a GeoSerialTransform.

Definition at line 219 of file GeoVisitVolumes.h.

Function Documentation

◆ geoGetVolumes()

GeoVolumeVec_t geoGetVolumes ( const GeoGraphNode *  node,
int  depthLimit,
int  sizeHint 
)

Return the child volumes and associated transforms.

Parameters
nodeRoot of the graph to traverse.
depthLimitDepth limit for the traversal.
sizeHintHint about the number of volumes to be returned, to allow avoiding resizes of the output vector.

Returns a vector of (volume, transform) pairs for volumes in the graph. The same volume may be returned multiple times with different transforms in the case of a GeoSerialTransform.

Definition at line 211 of file GeoVisitVolumes.cxx.

214 {
216  ret.reserve (sizeHint);
217  geoVisitVolumes ([&] (int /*id*/,
218  const std::string& /*name*/,
219  const GeoVPhysVol* volume,
221  const GeoTrf::Transform3D& /*defTransform*/)
222  { ret.emplace_back (volume, transform); },
223  node,
224  depthLimit);
225  return ret;
226 }

◆ geoGetVolumesNoXform()

std::vector<const GeoVPhysVol*> geoGetVolumesNoXform ( const GeoGraphNode *  node,
int  depthLimit,
int  sizeHint 
)

Return the child volumes.

Parameters
nodeRoot of the graph to traverse.
depthLimitDepth limit for the traversal.
sizeHintHint about the number of volumes to be returned, to allow avoiding resizes of the output vector.

Returns a vector of volumes in the graph. The same volume may be returned multiple times in the case of a GeoSerialTransform.

Definition at line 240 of file GeoVisitVolumes.cxx.

243 {
244  std::vector<const GeoVPhysVol*> ret;
245  ret.reserve (sizeHint);
246  geoVisitVolumesNoXform ([&] (int /*id*/,
247  const std::string& /*name*/,
248  const GeoVPhysVol* volume)
249  { ret.push_back (volume); },
250  node,
251  depthLimit);
252  return ret;
253 }

◆ geoVisitVolumes()

template<class FUNCTION >
void geoVisitVolumes ( FUNCTION  f,
const GeoGraphNode *  node,
int  depthLimit = 1 
)

Template helper for running the visitor.

Definition at line 185 of file GeoVisitVolumes.h.

186 {
188  GeoVisitVolumes visitor (act, depthLimit);
189  node->exec (&visitor);
190 }

◆ geoVisitVolumesNoXform()

template<class FUNCTION >
void geoVisitVolumesNoXform ( FUNCTION  f,
const GeoGraphNode *  node,
int  depthLimit = 1 
)

Template helper for running the visitor.

This version doesn't supply transformation information.

Definition at line 199 of file GeoVisitVolumes.h.

200 {
202  GeoVisitVolumes visitor (act, depthLimit);
203  node->exec (&visitor);
204 }
geoVisitVolumesNoXform
void geoVisitVolumesNoXform(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.
Definition: GeoVisitVolumes.h:199
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
GeoVolumeVec_t
std::vector< std::pair< const GeoVPhysVol *, GeoTrf::Transform3D > > GeoVolumeVec_t
Return the child volumes and associated transforms.
Definition: GeoVisitVolumes.h:219
ret
T ret(T t)
Definition: rootspy.cxx:260
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
PyPoolBrowser.node
node
Definition: PyPoolBrowser.py:131
GeoVisitVolumesNoXformAction
Callback object calling a templated functional.
Definition: GeoVisitVolumes.h:166
GeoVisitVolumesAction
Callback object calling a templated functional.
Definition: GeoVisitVolumes.h:142
GeoVisitVolumes
Visitor to process all volumes under a GeoModel node.
Definition: GeoVisitVolumes.h:77
node
Definition: memory_hooks-stdcmalloc.h:74
geoVisitVolumes
void geoVisitVolumes(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.
Definition: GeoVisitVolumes.h:185