ATLAS Offline Software
Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
Trk::SubtractedVolumeBounds Class Referencefinal

#include <SubtractedVolumeBounds.h>

Inheritance diagram for Trk::SubtractedVolumeBounds:
Collaboration diagram for Trk::SubtractedVolumeBounds:

Public Member Functions

 SubtractedVolumeBounds ()
 Default Constructor. More...
 
 SubtractedVolumeBounds (Volume *outerVol, Volume *innerVol)
 Constructor - the box boundaries. More...
 
 SubtractedVolumeBounds (const SubtractedVolumeBounds &bobo)
 Copy Constructor. More...
 
virtual ~SubtractedVolumeBounds ()
 Destructor. More...
 
SubtractedVolumeBoundsoperator= (const SubtractedVolumeBounds &bobo)
 Assignment operator. More...
 
SubtractedVolumeBoundsclone () const override final
 Virtual constructor. More...
 
bool inside (const Amg::Vector3D &, double tol=0.) const override final
 This method checks if position in the 3D volume frame is inside the cylinder. More...
 
const std::vector< const Trk::Surface * > * decomposeToSurfaces (const Amg::Transform3D &transform) override final
 Method to decompose the Bounds into boundarySurfaces. More...
 
ObjectAccessor boundarySurfaceAccessor (const Amg::Vector3D &gp, const Amg::Vector3D &dir, bool forceInside=false) const override final
 Provide accessor for BoundarySurfaces. More...
 
const Volumeouter () const
 This method returns the outer Volume. More...
 
Volumeouter ()
 
const Volumeinner () const
 This method returns the inner Volume. More...
 
Volumeinner ()
 
std::vector< bool > boundsOrientation () const
 This method returns bounds orientation. More...
 
MsgStream & dump (MsgStream &sl) const override
 Output Method for MsgStream. More...
 
std::ostream & dump (std::ostream &sl) const override final
 Output Method for std::ostream. More...
 

Static Private Member Functions

static Trk::VolumecreateSubtractedVolume (const Amg::Transform3D &transf, Trk::Volume *subtrVol)
 

Private Attributes

Volumem_outer
 
Volumem_inner
 
EightObjectsAccessor m_objectAccessor
 There's only one single object Acessor for the moment has to be implemented if Subtracteds are used more widely. More...
 
std::vector< bool > m_boundsOrientation
 

Detailed Description

Bounds for a generic subtracted volume, the decomposeToSurfaces method creates a vector of n surfaces (n1+n2-n_subtracted):

BoundarySurfaceFace [index]: [n1] surfaces from 'outer' volume [n1+n2-n_subtr] remaining surfaces (after subtraction) from 'inner' volume

Author
Sarka.nosp@m..Tod.nosp@m.orova.nosp@m.@cer.nosp@m.n.ch

Definition at line 40 of file SubtractedVolumeBounds.h.

Constructor & Destructor Documentation

◆ SubtractedVolumeBounds() [1/3]

Trk::SubtractedVolumeBounds::SubtractedVolumeBounds ( )

Default Constructor.

Definition at line 33 of file SubtractedVolumeBounds.cxx.

34  : VolumeBounds()
35  , m_outer(nullptr)
36  , m_inner(nullptr)
39 {}

◆ SubtractedVolumeBounds() [2/3]

Trk::SubtractedVolumeBounds::SubtractedVolumeBounds ( Volume outerVol,
Volume innerVol 
)

Constructor - the box boundaries.

Definition at line 41 of file SubtractedVolumeBounds.cxx.

42  : VolumeBounds()
43  , m_outer(vol1)
44  , m_inner(vol2)
47 {}

◆ SubtractedVolumeBounds() [3/3]

Trk::SubtractedVolumeBounds::SubtractedVolumeBounds ( const SubtractedVolumeBounds bobo)

Copy Constructor.

Definition at line 49 of file SubtractedVolumeBounds.cxx.

51  : VolumeBounds()
52  , m_outer(bobo.m_outer)
53  , m_inner(bobo.m_inner)
54  , m_objectAccessor(bobo.m_objectAccessor)
56 {
57  m_boundsOrientation.resize(bobo.m_boundsOrientation.size());
58  for (unsigned int i = 0; i < bobo.m_boundsOrientation.size(); i++)
59  m_boundsOrientation[i] = bobo.m_boundsOrientation[i];
60 }

◆ ~SubtractedVolumeBounds()

Trk::SubtractedVolumeBounds::~SubtractedVolumeBounds ( )
virtual

Destructor.

Definition at line 62 of file SubtractedVolumeBounds.cxx.

63 {
64  m_boundsOrientation.clear();
65  delete m_outer;
66  delete m_inner;
67 }

Member Function Documentation

◆ boundarySurfaceAccessor()

ObjectAccessor Trk::SubtractedVolumeBounds::boundarySurfaceAccessor ( const Amg::Vector3D gp,
const Amg::Vector3D dir,
bool  forceInside = false 
) const
inlinefinaloverridevirtual

Provide accessor for BoundarySurfaces.

Implements Trk::VolumeBounds.

Definition at line 119 of file SubtractedVolumeBounds.h.

120  {
122 }

◆ boundsOrientation()

std::vector< bool > Trk::SubtractedVolumeBounds::boundsOrientation ( ) const
inline

This method returns bounds orientation.

Definition at line 124 of file SubtractedVolumeBounds.h.

124  {
125  return (m_boundsOrientation);
126 }

◆ clone()

SubtractedVolumeBounds * Trk::SubtractedVolumeBounds::clone ( ) const
inlinefinaloverridevirtual

Virtual constructor.

Implements Trk::VolumeBounds.

Definition at line 104 of file SubtractedVolumeBounds.h.

104  {
105  return new SubtractedVolumeBounds(*this);
106 }

◆ createSubtractedVolume()

Trk::Volume * Trk::SubtractedVolumeBounds::createSubtractedVolume ( const Amg::Transform3D transf,
Trk::Volume subtrVol 
)
staticprivate

Definition at line 331 of file SubtractedVolumeBounds.cxx.

334 {
335  Trk::Volume* subVol = nullptr;
336  if (!subtrVol)
337  return subVol;
338 
339  subVol = new Trk::Volume(*subtrVol, transf);
340 
341  return subVol;
342 }

◆ decomposeToSurfaces()

const std::vector< const Trk::Surface * > * Trk::SubtractedVolumeBounds::decomposeToSurfaces ( const Amg::Transform3D transform)
finaloverridevirtual

Method to decompose the Bounds into boundarySurfaces.

Implements Trk::VolumeBounds.

Definition at line 85 of file SubtractedVolumeBounds.cxx.

87 {
88  // double tol=0.001;
89  // get surfaces for outer boundaries
90  const std::vector<const Trk::Surface*>* outerSurfaces =
92  // get surfaces for inner boundaries
93  const std::vector<const Trk::Surface*>* innerSurfaces =
95  std::vector<unsigned int> subtrInner;
96  std::vector<const Trk::Surface*>* retsf =
97  new std::vector<const Trk::Surface*>;
98 
99  unsigned int nSurf = outerSurfaces->size() + innerSurfaces->size();
100  m_boundsOrientation.resize(nSurf);
101 
102  const Trk::CylinderVolumeBounds* cylVol =
103  dynamic_cast<const Trk::CylinderVolumeBounds*>(&(m_outer->volumeBounds()));
104  const Trk::SimplePolygonBrepVolumeBounds* spbVol =
105  dynamic_cast<const Trk::SimplePolygonBrepVolumeBounds*>(
106  &(m_outer->volumeBounds()));
107  const Trk::CombinedVolumeBounds* comVol =
108  dynamic_cast<const Trk::CombinedVolumeBounds*>(&(m_outer->volumeBounds()));
109  const Trk::SubtractedVolumeBounds* subVol =
110  dynamic_cast<const Trk::SubtractedVolumeBounds*>(
111  &(m_outer->volumeBounds()));
112 
113  // loop over 'outer' boundary surfaces; modified by subtracted volume
114  for (unsigned int out = 0; out < outerSurfaces->size(); out++) {
115  const SubtractedPlaneSurface* splo =
116  dynamic_cast<const SubtractedPlaneSurface*>((*outerSurfaces)[out]);
117  const PlaneSurface* plo =
118  dynamic_cast<const PlaneSurface*>((*outerSurfaces)[out]);
119  const SubtractedCylinderSurface* sclo =
120  dynamic_cast<const SubtractedCylinderSurface*>((*outerSurfaces)[out]);
121  const CylinderSurface* clo =
122  dynamic_cast<const CylinderSurface*>((*outerSurfaces)[out]);
123  const DiscSurface* dlo =
124  dynamic_cast<const DiscSurface*>((*outerSurfaces)[out]);
125  if (!(splo || plo || sclo || clo || dlo)) {
126  throw std::runtime_error("Unhandled surface.");
127  }
128  // resolve bounds orientation : copy from combined/subtracted, swap inner
129  // cyl, swap bottom spb
130  if (comVol)
132  else if (subVol)
134  else if (cylVol && clo && out == 3)
135  m_boundsOrientation[out] = false;
136  else if (spbVol && out == 0)
137  m_boundsOrientation[out] = false;
138  else
139  m_boundsOrientation[out] = true;
140  //
142  (*outerSurfaces)[out]->transform().inverse() * transf, m_inner);
143 
144  if (splo || sclo) { // multiple subtraction
146  bool shared = false;
147  if (splo) {
148  vEx = splo->subtractedVolume();
149  shared = splo->shared();
150  }
151  if (sclo) {
152  vEx = sclo->subtractedVolume();
153  shared = sclo->shared();
154  }
155  const Trk::VolumeExcluder* volExcl =
156  dynamic_cast<const Trk::VolumeExcluder*>(vEx.get());
157  if (!volExcl)
158  throw std::logic_error("Not a VolumeExcluder");
159  Trk::Volume* outerSub = new Trk::Volume(*volExcl->volume());
160 
161  Trk::Volume* comb_sub = nullptr;
162  if (!shared)
163  comb_sub = new Trk::Volume(
164  nullptr, new Trk::CombinedVolumeBounds(innerSub, outerSub, false));
165  else
166  comb_sub = new Trk::Volume(
167  nullptr, new Trk::SubtractedVolumeBounds(outerSub, innerSub));
168  Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(comb_sub);
169  if (splo)
170  retsf->push_back(new Trk::SubtractedPlaneSurface(*splo, volEx, shared));
171  if (sclo)
172  retsf->push_back(
173  new Trk::SubtractedCylinderSurface(*sclo, volEx, shared));
174  } else {
175  Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(innerSub);
176  if (plo)
177  retsf->push_back(new Trk::SubtractedPlaneSurface(*plo, volEx, false));
178  if (clo)
179  retsf->push_back(
180  new Trk::SubtractedCylinderSurface(*clo, volEx, false));
181  if (dlo) {
182  // turn disc into ellipse for simplification
183  const DiscBounds* db =
184  dynamic_cast<const DiscBounds*>(&(dlo->bounds()));
185  if (!db)
186  throw std::logic_error("Not DiscBounds");
187  EllipseBounds* eb = new EllipseBounds(
188  db->rMin(), db->rMin(), db->rMax(), db->rMax(), db->halfPhiSector());
189  plo = new PlaneSurface(Amg::Transform3D(dlo->transform()), eb);
190  retsf->push_back(new Trk::SubtractedPlaneSurface(*plo, volEx, false));
191  delete plo;
192  }
193  }
194  }
195 
196  // loop over 'inner' boundary surfaces; include only if represent a new
197  // surface change: include allways otherwise orientation messed up bonus :
198  // solves 'double boundary' problem
199 
200  cylVol =
201  dynamic_cast<const Trk::CylinderVolumeBounds*>(&(m_inner->volumeBounds()));
202  spbVol = dynamic_cast<const Trk::SimplePolygonBrepVolumeBounds*>(
203  &(m_inner->volumeBounds()));
204  comVol =
205  dynamic_cast<const Trk::CombinedVolumeBounds*>(&(m_inner->volumeBounds()));
206  subVol = dynamic_cast<const Trk::SubtractedVolumeBounds*>(
207  &(m_inner->volumeBounds()));
208  unsigned int nOut = outerSurfaces->size();
209 
210  for (unsigned int in = 0; in < innerSurfaces->size(); in++) {
211  const SubtractedPlaneSurface* spli =
212  dynamic_cast<const SubtractedPlaneSurface*>((*innerSurfaces)[in]);
213  const PlaneSurface* pli =
214  dynamic_cast<const PlaneSurface*>((*innerSurfaces)[in]);
215  const SubtractedCylinderSurface* scli =
216  dynamic_cast<const SubtractedCylinderSurface*>((*innerSurfaces)[in]);
217  const CylinderSurface* cli =
218  dynamic_cast<const CylinderSurface*>((*innerSurfaces)[in]);
219  const DiscSurface* dli =
220  dynamic_cast<const DiscSurface*>((*innerSurfaces)[in]);
221  // resolve bounds orientation : copy from combined/subtracted, swap inner
222  // cyl, swap bottom spb, swap all
223  if (comVol)
224  m_boundsOrientation[nOut + in] = !comVol->boundsOrientation()[in];
225  else if (subVol)
226  m_boundsOrientation[nOut + in] = !subVol->boundsOrientation()[in];
227  else if (cylVol && cli && in == 3)
228  m_boundsOrientation[nOut + in] = true;
229  else if (spbVol && in == 0)
230  m_boundsOrientation[nOut + in] = true;
231  else
232  m_boundsOrientation[nOut + in] = false;
233  //
235  (*innerSurfaces)[in]->transform().inverse() * transf, m_outer);
236 
237  if (spli || scli) {
238  bool shared = false;
240  if (spli) {
241  vEx = spli->subtractedVolume();
242  shared = spli->shared();
243  }
244  if (scli) {
245  vEx = scli->subtractedVolume();
246  shared = scli->shared();
247  }
248  const Trk::VolumeExcluder* volExcl =
249  dynamic_cast<const Trk::VolumeExcluder*>(vEx.get());
250  if (!volExcl)
251  throw std::logic_error("Not a VolumeExcluder");
252  Trk::Volume* innerSub = new Trk::Volume(*volExcl->volume());
253 
254  // combined volume
255  Trk::Volume* comb_sub = nullptr;
256  if (!shared)
257  comb_sub = new Trk::Volume(
258  nullptr, new Trk::SubtractedVolumeBounds(outerSub, innerSub));
259  else
260  comb_sub = new Trk::Volume(
261  nullptr, new Trk::CombinedVolumeBounds(innerSub, outerSub, true));
262  Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(comb_sub);
263  if (spli)
264  retsf->push_back(new Trk::SubtractedPlaneSurface(*spli, volEx, true));
265  if (scli)
266  retsf->push_back(
267  new Trk::SubtractedCylinderSurface(*scli, volEx, true));
268 
269  } else if (pli || cli) {
270  Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(outerSub);
271  if (pli)
272  retsf->push_back(new Trk::SubtractedPlaneSurface(*pli, volEx, true));
273  if (cli)
274  retsf->push_back(new Trk::SubtractedCylinderSurface(*cli, volEx, true));
275  } else if (dli) {
276  // turn disc into ellipse for simplification
277  const DiscBounds* db = dynamic_cast<const DiscBounds*>(&(dli->bounds()));
278  if (!db)
279  throw std::logic_error("Not DiscBounds");
280  EllipseBounds* eb = new EllipseBounds(
281  db->rMin(), db->rMin(), db->rMax(), db->rMax(), db->halfPhiSector());
282  PlaneSurface pla(Amg::Transform3D(dli->transform()), eb);
283  Trk::VolumeExcluder* volEx = new Trk::VolumeExcluder(outerSub);
284  retsf->push_back(new Trk::SubtractedPlaneSurface(pla, volEx, true));
285  } else {
286  throw std::runtime_error(
287  "Unhandled surface in "
288  "Trk::SubtractedVolumeBounds::decomposeToSurfaces.");
289  }
290  }
291 
292  for (const auto *outerSurface : *outerSurfaces)
293  delete outerSurface;
294  for (const auto *innerSurface : *innerSurfaces)
295  delete innerSurface;
296  delete outerSurfaces;
297  delete innerSurfaces;
298 
299  return retsf;
300 }

◆ dump() [1/2]

MsgStream & Trk::SubtractedVolumeBounds::dump ( MsgStream &  sl) const
overridevirtual

Output Method for MsgStream.

Implements Trk::VolumeBounds.

Definition at line 305 of file SubtractedVolumeBounds.cxx.

306 {
307  std::stringstream temp_sl;
308  temp_sl << std::setiosflags(std::ios::fixed);
309  temp_sl << std::setprecision(7);
310  temp_sl << "Trk::SubtractedVolumeBounds: outer,inner ";
311  sl << temp_sl.str();
312  std::as_const(*m_outer).volumeBounds().dump(sl);
313  std::as_const(*m_inner).volumeBounds().dump(sl);
314  return sl;
315 }

◆ dump() [2/2]

std::ostream & Trk::SubtractedVolumeBounds::dump ( std::ostream &  sl) const
finaloverridevirtual

Output Method for std::ostream.

Implements Trk::VolumeBounds.

Definition at line 318 of file SubtractedVolumeBounds.cxx.

319 {
320  std::stringstream temp_sl;
321  temp_sl << std::setiosflags(std::ios::fixed);
322  temp_sl << std::setprecision(7);
323  temp_sl << "Trk::SubtractedVolumeBounds: outer,inner ";
324  sl << temp_sl.str();
325  std::as_const(*m_outer).volumeBounds().dump(sl);
326  std::as_const(*m_inner).volumeBounds().dump(sl);
327  return sl;
328 }

◆ inner() [1/2]

Volume * Trk::SubtractedVolumeBounds::inner ( )
inline

Definition at line 117 of file SubtractedVolumeBounds.h.

117 { return m_inner; }

◆ inner() [2/2]

const Volume * Trk::SubtractedVolumeBounds::inner ( ) const
inline

This method returns the inner Volume.

Definition at line 116 of file SubtractedVolumeBounds.h.

116 { return m_inner; }

◆ inside()

bool Trk::SubtractedVolumeBounds::inside ( const Amg::Vector3D pos,
double  tol = 0. 
) const
inlinefinaloverridevirtual

This method checks if position in the 3D volume frame is inside the cylinder.

Implements Trk::VolumeBounds.

Definition at line 108 of file SubtractedVolumeBounds.h.

109  {
110  return (m_outer->inside(pos, tol) && !m_inner->inside(pos, -tol));
111 }

◆ operator=()

Trk::SubtractedVolumeBounds & Trk::SubtractedVolumeBounds::operator= ( const SubtractedVolumeBounds bobo)

Assignment operator.

Definition at line 70 of file SubtractedVolumeBounds.cxx.

71 {
72  if (this != &bobo) {
73  m_outer = bobo.m_outer;
74  m_inner = bobo.m_inner;
75  m_objectAccessor = bobo.m_objectAccessor;
76  m_boundsOrientation = bobo.m_boundsOrientation;
77  m_boundsOrientation.resize(bobo.m_boundsOrientation.size());
78  for (unsigned int i = 0; i < bobo.m_boundsOrientation.size(); i++)
79  m_boundsOrientation[i] = bobo.m_boundsOrientation[i];
80  }
81  return *this;
82 }

◆ outer() [1/2]

Volume * Trk::SubtractedVolumeBounds::outer ( )
inline

Definition at line 114 of file SubtractedVolumeBounds.h.

114 { return m_outer; }

◆ outer() [2/2]

const Volume * Trk::SubtractedVolumeBounds::outer ( ) const
inline

This method returns the outer Volume.

Definition at line 113 of file SubtractedVolumeBounds.h.

113 { return m_outer; }

Member Data Documentation

◆ m_boundsOrientation

std::vector<bool> Trk::SubtractedVolumeBounds::m_boundsOrientation
private

Definition at line 101 of file SubtractedVolumeBounds.h.

◆ m_inner

Volume* Trk::SubtractedVolumeBounds::m_inner
private

Definition at line 95 of file SubtractedVolumeBounds.h.

◆ m_objectAccessor

EightObjectsAccessor Trk::SubtractedVolumeBounds::m_objectAccessor
private

There's only one single object Acessor for the moment has to be implemented if Subtracteds are used more widely.

Definition at line 99 of file SubtractedVolumeBounds.h.

◆ m_outer

Volume* Trk::SubtractedVolumeBounds::m_outer
private

Definition at line 94 of file SubtractedVolumeBounds.h.


The documentation for this class was generated from the following files:
Trk::SubtractedVolumeBounds::m_inner
Volume * m_inner
Definition: SubtractedVolumeBounds.h:95
Trk::SimplePolygonBrepVolumeBounds
Definition: SimplePolygonBrepVolumeBounds.h:44
Trk::SubtractedCylinderSurface
Definition: SubtractedCylinderSurface.h:33
Trk::Volume::inside
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
Definition: Volume.cxx:90
CaloCondBlobAlgs_fillNoiseFromASCII.db
db
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:43
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
Trk::SubtractedVolumeBounds::m_outer
Volume * m_outer
Definition: SubtractedVolumeBounds.h:94
SharedObject
Trk::SubtractedVolumeBounds::createSubtractedVolume
static Trk::Volume * createSubtractedVolume(const Amg::Transform3D &transf, Trk::Volume *subtrVol)
Definition: SubtractedVolumeBounds.cxx:331
Trk::SubtractedPlaneSurface
Definition: SubtractedPlaneSurface.h:32
lumiFormat.i
int i
Definition: lumiFormat.py:85
MuonR4::inverse
CalibratedSpacePoint::Covariance_t inverse(const CalibratedSpacePoint::Covariance_t &mat)
Inverts the parsed matrix.
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/src/UtilFunctions.cxx:65
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
Trk::CylinderVolumeBounds
Definition: CylinderVolumeBounds.h:70
Trk::Volume::transform
const Amg::Transform3D & transform() const
Return methods for geometry transform.
Definition: Volume.h:81
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::VolumeExcluder::volume
const Volume * volume() const
Acces the subtracted volume.
Definition: VolumeExcluder.h:70
Trk::VolumeBounds::decomposeToSurfaces
virtual const std::vector< const Trk::Surface * > * decomposeToSurfaces(const Amg::Transform3D &transform)=0
Method to decompose the Bounds into Surfaces, the Volume can turn them into BoundarySurfaces.
Trk::ObjectAccessor
Definition: ObjectAccessor.h:15
Trk::SubtractedVolumeBounds
Definition: SubtractedVolumeBounds.h:40
Trk::Volume::volumeBounds
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Definition: Volume.h:97
Trk::SubtractedVolumeBounds::m_objectAccessor
EightObjectsAccessor m_objectAccessor
There's only one single object Acessor for the moment has to be implemented if Subtracteds are used m...
Definition: SubtractedVolumeBounds.h:99
Trk::SubtractedVolumeBounds::SubtractedVolumeBounds
SubtractedVolumeBounds()
Default Constructor.
Definition: SubtractedVolumeBounds.cxx:33
Trk::CombinedVolumeBounds::boundsOrientation
std::vector< bool > boundsOrientation() const
This method returns bounds orientation.
Definition: CombinedVolumeBounds.h:128
Trk::SubtractedVolumeBounds::m_boundsOrientation
std::vector< bool > m_boundsOrientation
Definition: SubtractedVolumeBounds.h:101
Trk::VolumeExcluder
Definition: VolumeExcluder.h:29
Trk::SubtractedVolumeBounds::boundsOrientation
std::vector< bool > boundsOrientation() const
This method returns bounds orientation.
Definition: SubtractedVolumeBounds.h:124
Trk::CombinedVolumeBounds
Definition: CombinedVolumeBounds.h:42
Trk::Volume
Definition: Volume.h:35
Trk::VolumeBounds::VolumeBounds
VolumeBounds()
Default Constructor.
Definition: VolumeBounds.h:48