ATLAS Offline Software
Loading...
Searching...
No Matches
GeoVisitVolumes.cxx File Reference

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

#include "GeoModelUtilities/GeoVisitVolumes.h"
#include "GeoModelKernel/GeoNameTag.h"
#include "GeoModelKernel/GeoSerialDenominator.h"
#include "GeoModelKernel/GeoSerialIdentifier.h"
#include "CxxUtils/inline_hints.h"
#include <string>
Include dependency graph for GeoVisitVolumes.cxx:

Go to the source code of this file.

Functions

GeoVolumeVec_t geoGetVolumes (const GeoGraphNode *node, int depthLimit, int sizeHint)
 Return the child volumes and associated transforms.
std::vector< const GeoVPhysVol * > geoGetVolumesNoXform (const GeoGraphNode *node, int depthLimit, int sizeHint)
 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.cxx.

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.