ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GeoVisitVolumes Class Reference

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

#include <GeoVisitVolumes.h>

Inheritance diagram for GeoVisitVolumes:
Collaboration diagram for GeoVisitVolumes:

Public Member Functions

 GeoVisitVolumes (IGeoVisitVolumesAction &action, int depthLimit=1)
 Initialize to visit volumes keeping track of transformations. More...
 
 GeoVisitVolumes (IGeoVisitVolumesNoXformAction &action, int depthLimit=1)
 Initialize to visit volumes withoutkeeping track of transformations. More...
 
virtual void handleTransform (const GeoTransform *xform) override
 Handles a Transform. More...
 
virtual void handlePhysVol (const GeoPhysVol *vol) override
 Handles a physical volume. More...
 
virtual void handleFullPhysVol (const GeoFullPhysVol *vol) override
 Handles a physical volume. More...
 
virtual void handleNameTag (const GeoNameTag *nameTag) override
 Handles a Name Tag. More...
 
virtual void handleSerialDenominator (const GeoSerialDenominator *sD) override
 Handles a Serial Denominator. More...
 
virtual void handleSerialTransformer (const GeoSerialTransformer *sT) override
 Handles a Serial Transformer. More...
 
virtual void handleIdentifierTag (const GeoIdentifierTag *idTag) override
 Handles an Identifier Tag. More...
 
virtual void handleSerialIdentifier (const GeoSerialIdentifier *sI) override
 Handles an Serial Identifier. More...
 

Private Member Functions

 GeoVisitVolumes (const GeoVisitVolumes &right)=delete
 
GeoVisitVolumesoperator= (const GeoVisitVolumes &right)=delete
 
void handleVol (const GeoVPhysVol *vol)
 

Private Attributes

std::variant< IGeoVisitVolumesAction *, IGeoVisitVolumesNoXformAction * > m_action
 Callback. More...
 
const GeoNameTag * m_nameTag
 A pointer to a name tag. If the volume is named. More...
 
const GeoSerialDenominator * m_serialDenominator
 A pointer to a serial denominator. If one exists. More...
 
const GeoIdentifierTag * m_idTag
 A pointer to an identifier tag. If the volume is identified. More...
 
std::vector< const GeoTransform * > m_pendingTransformList
 List of Pending Transformations. More...
 
const GeoSerialIdentifier * m_serialIdentifier
 

Detailed Description

Visitor to process all volumes under a GeoModel node.

Can take either an IGeoVisitVolumesAction or an IGeoVisitVolumesNoXformAction. In the latter case, we don't keep track of the geometrical transforms. It can be used as a faster option if you only care about the list of volumes but not where they're located.

Definition at line 76 of file GeoVisitVolumes.h.

Constructor & Destructor Documentation

◆ GeoVisitVolumes() [1/3]

GeoVisitVolumes::GeoVisitVolumes ( IGeoVisitVolumesAction action,
int  depthLimit = 1 
)

Initialize to visit volumes keeping track of transformations.

Definition at line 23 of file GeoVisitVolumes.cxx.

25  : m_action(&action)
26  , m_nameTag(nullptr)
27  , m_serialDenominator(nullptr)
28  , m_idTag(nullptr)
29  , m_serialIdentifier(nullptr)
30 {
31  setDepthLimit (depthLimit);
32  m_pendingTransformList.reserve(1);
33 }

◆ GeoVisitVolumes() [2/3]

GeoVisitVolumes::GeoVisitVolumes ( IGeoVisitVolumesNoXformAction action,
int  depthLimit = 1 
)

Initialize to visit volumes withoutkeeping track of transformations.

Definition at line 36 of file GeoVisitVolumes.cxx.

38  : m_action(&action)
39  , m_nameTag(nullptr)
40  , m_serialDenominator(nullptr)
41  , m_idTag(nullptr)
42  , m_serialIdentifier(nullptr)
43 {
44  setDepthLimit (depthLimit);
45 }

◆ GeoVisitVolumes() [3/3]

GeoVisitVolumes::GeoVisitVolumes ( const GeoVisitVolumes right)
privatedelete

Member Function Documentation

◆ handleFullPhysVol()

void GeoVisitVolumes::handleFullPhysVol ( const GeoFullPhysVol *  vol)
overridevirtual

Handles a physical volume.

Definition at line 103 of file GeoVisitVolumes.cxx.

104 {
105  handleVol (vol);
106 }

◆ handleIdentifierTag()

void GeoVisitVolumes::handleIdentifierTag ( const GeoIdentifierTag *  idTag)
overridevirtual

Handles an Identifier Tag.

Definition at line 187 of file GeoVisitVolumes.cxx.

188 {
189  m_idTag = idTag;
190  m_serialIdentifier = nullptr;
191 }

◆ handleNameTag()

void GeoVisitVolumes::handleNameTag ( const GeoNameTag *  nameTag)
overridevirtual

Handles a Name Tag.

Definition at line 109 of file GeoVisitVolumes.cxx.

110 {
111  m_nameTag = nameTag;
112  m_serialDenominator = nullptr;
113 }

◆ handlePhysVol()

void GeoVisitVolumes::handlePhysVol ( const GeoPhysVol *  vol)
overridevirtual

Handles a physical volume.

Definition at line 98 of file GeoVisitVolumes.cxx.

99 {
100  handleVol (vol);
101 }

◆ handleSerialDenominator()

void GeoVisitVolumes::handleSerialDenominator ( const GeoSerialDenominator *  sD)
overridevirtual

Handles a Serial Denominator.

Definition at line 116 of file GeoVisitVolumes.cxx.

117 {
118  m_serialDenominator = sD;
119 }

◆ handleSerialIdentifier()

void GeoVisitVolumes::handleSerialIdentifier ( const GeoSerialIdentifier *  sI)
overridevirtual

Handles an Serial Identifier.

Definition at line 194 of file GeoVisitVolumes.cxx.

195 {
196  m_serialIdentifier = sI;
197 }

◆ handleSerialTransformer()

void GeoVisitVolumes::handleSerialTransformer ( const GeoSerialTransformer *  sT)
overridevirtual

Handles a Serial Transformer.

Definition at line 130 of file GeoVisitVolumes.cxx.

131 {
132  const GeoVPhysVol* vol = &*sT->getVolume();
133  unsigned int ncopies = sT->getNCopies();
134  int idbase = -1;
135  if (m_serialIdentifier) {
136  idbase = m_serialIdentifier->getBaseId();
137  }
138 
140  GeoTrf::Transform3D defTransform;
141  if (m_action.index() == 0) {
142  if (m_pendingTransformList.size() == 0) {
143  transform = GeoTrf::Transform3D::Identity();
144  defTransform = GeoTrf::Transform3D::Identity();
145  }
146  else {
147  transform = m_pendingTransformList[0]->getTransform(nullptr);
148  defTransform = m_pendingTransformList[0]->getDefTransform(nullptr);
149  for (size_t i = 1; i < m_pendingTransformList.size(); ++i) {
150  const GeoTransform* t = m_pendingTransformList[i];
151  transform = transform * t->getTransform(nullptr);
152  defTransform = defTransform * t->getDefTransform(nullptr);
153  }
154  }
155  }
156 
157  for (unsigned int i = 0; i < ncopies; i++) {
158  int id = idbase;
159  if (id >= 0) {
160  id += i;
161  }
162 
163  std::string name;
164  if (m_serialDenominator) {
165  name = m_serialDenominator->getBaseName() + std::to_string(i);
166  }
167  else {
168  name = "ANON";
169  }
170 
171  if (m_action.index() == 0) {
172  (*std::get<0>(m_action)) (*this, id, name, vol,
173  transform * sT->getTransform (i),
174  defTransform * sT->getTransform (i));
175  }
176  else {
177  (*std::get<1>(m_action)) (*this, id, name, vol);
178  }
179  }
180 
181  m_idTag = nullptr;
182  m_nameTag = nullptr;
183  m_pendingTransformList.clear();
184 }

◆ handleTransform()

void GeoVisitVolumes::handleTransform ( const GeoTransform *  xform)
overridevirtual

Handles a Transform.

Definition at line 48 of file GeoVisitVolumes.cxx.

49 {
50  if (m_action.index() == 0)
51  m_pendingTransformList.push_back (xform);
52 }

◆ handleVol()

void GeoVisitVolumes::handleVol ( const GeoVPhysVol *  vol)
private

Definition at line 55 of file GeoVisitVolumes.cxx.

56 {
57  //
58  // Return if we have not got to any children:
59  //
60  if(getPath()->getLength()-1 == 0)
61  return;
62 
63  const static std::string anon = "ANON";
64  const std::string& name = m_nameTag ? m_nameTag->getName() : anon;
65 
66  int id = m_idTag ? m_idTag->getIdentifier() : -1;
67 
68  if (m_action.index() == 0) {
70  GeoTrf::Transform3D defTransform;
71 
72  if (m_pendingTransformList.size() == 0) {
73  transform = GeoTrf::Transform3D::Identity();
74  defTransform = GeoTrf::Transform3D::Identity();
75  }
76  else {
77  transform = m_pendingTransformList[0]->getTransform(nullptr);
78  defTransform = m_pendingTransformList[0]->getDefTransform(nullptr);
79  for (size_t i = 1; i < m_pendingTransformList.size(); ++i) {
80  const GeoTransform* t = m_pendingTransformList[i];
81  transform = transform * t->getTransform(nullptr);
82  defTransform = defTransform * t->getDefTransform(nullptr);
83  }
84  }
85 
86  (*std::get<0>(m_action)) (*this, id, name, vol, transform, defTransform);
87  m_pendingTransformList.clear();
88  }
89  else {
90  (*std::get<1>(m_action)) (*this, id, name, vol);
91  }
92 
93  m_idTag = nullptr;
94  m_nameTag = nullptr;
95 }

◆ operator=()

GeoVisitVolumes& GeoVisitVolumes::operator= ( const GeoVisitVolumes right)
privatedelete

Member Data Documentation

◆ m_action

std::variant<IGeoVisitVolumesAction*, IGeoVisitVolumesNoXformAction*> GeoVisitVolumes::m_action
private

Callback.

Definition at line 118 of file GeoVisitVolumes.h.

◆ m_idTag

const GeoIdentifierTag* GeoVisitVolumes::m_idTag
private

A pointer to an identifier tag. If the volume is identified.

Definition at line 127 of file GeoVisitVolumes.h.

◆ m_nameTag

const GeoNameTag* GeoVisitVolumes::m_nameTag
private

A pointer to a name tag. If the volume is named.

Definition at line 121 of file GeoVisitVolumes.h.

◆ m_pendingTransformList

std::vector<const GeoTransform *> GeoVisitVolumes::m_pendingTransformList
private

List of Pending Transformations.

Definition at line 130 of file GeoVisitVolumes.h.

◆ m_serialDenominator

const GeoSerialDenominator* GeoVisitVolumes::m_serialDenominator
private

A pointer to a serial denominator. If one exists.

Definition at line 124 of file GeoVisitVolumes.h.

◆ m_serialIdentifier

const GeoSerialIdentifier* GeoVisitVolumes::m_serialIdentifier
private

Definition at line 132 of file GeoVisitVolumes.h.


The documentation for this class was generated from the following files:
GeoVisitVolumes::m_idTag
const GeoIdentifierTag * m_idTag
A pointer to an identifier tag. If the volume is identified.
Definition: GeoVisitVolumes.h:127
GeoVisitVolumes::handleVol
void handleVol(const GeoVPhysVol *vol)
Definition: GeoVisitVolumes.cxx:55
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
GeoVisitVolumes::m_pendingTransformList
std::vector< const GeoTransform * > m_pendingTransformList
List of Pending Transformations.
Definition: GeoVisitVolumes.h:130
GeoVisitVolumes::m_serialDenominator
const GeoSerialDenominator * m_serialDenominator
A pointer to a serial denominator. If one exists.
Definition: GeoVisitVolumes.h:124
lumiFormat.i
int i
Definition: lumiFormat.py:85
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
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
GeoVisitVolumes::m_action
std::variant< IGeoVisitVolumesAction *, IGeoVisitVolumesNoXformAction * > m_action
Callback.
Definition: GeoVisitVolumes.h:118
GeoVisitVolumes::m_nameTag
const GeoNameTag * m_nameTag
A pointer to a name tag. If the volume is named.
Definition: GeoVisitVolumes.h:121
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
GeoVisitVolumes::m_serialIdentifier
const GeoSerialIdentifier * m_serialIdentifier
Definition: GeoVisitVolumes.h:132