ATLAS Offline Software
Loading...
Searching...
No Matches
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.

Functions

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

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{
215 GeoVolumeVec_t ret;
216 ret.reserve (sizeHint);
217 geoVisitVolumes ([&] (int /*id*/,
218 const std::string& /*name*/,
219 const GeoVPhysVol* volume,
220 const GeoTrf::Transform3D& transform,
221 const GeoTrf::Transform3D& /*defTransform*/)
222 { ret.emplace_back (volume, transform); },
223 node,
224 depthLimit);
225 return ret;
226}
std::vector< std::pair< const GeoVPhysVol *, GeoTrf::Transform3D > > GeoVolumeVec_t
Return the child volumes and associated transforms.
void geoVisitVolumes(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.
Definition node.h:24

◆ 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}
void geoVisitVolumesNoXform(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.

◆ 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}
Callback object calling a templated functional.
Visitor to process all volumes under a GeoModel node.

◆ 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}
Callback object calling a templated functional.