ATLAS Offline Software
AbstractVolume.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // AbstractVolume.cxx, (c) ATLAS Detector software
8 
9 // Trk
11 //
15 #include "TrkSurfaces/Surface.h"
21 // Gaudi
22 #include "GaudiKernel/MsgStream.h"
23 #include "GaudiKernel/SystemOfUnits.h"
24 // STD
25 #include <iostream>
26 // Eigen accessor
28 
29 // Default constructor
31  : Volume()
32  , m_boundarySurfaces(nullptr)
33 {}
34 
35 // constructor with Amg::Transform3D
37  Amg::Transform3D* htrans,
38  Trk::VolumeBounds* volbounds)
39  : Volume(htrans, volbounds)
40  , m_boundarySurfaces(nullptr)
41 {
43 }
44 
45 // copy constructor - will up to now not copy the sub structure!
47  : Volume(vol)
48  , m_boundarySurfaces(nullptr)
49 {}
50 
51 // destructor
53 {
54  delete m_boundarySurfaces;
55 }
56 
57 // assignment operator
60 {
61  if (this != &vol) {
62  Volume::operator=(vol);
63  delete m_boundarySurfaces;
64  m_boundarySurfaces = new std::vector<
66  *vol.m_boundarySurfaces);
67  }
68  return *this;
69 }
70 
71 const std::vector<
74 {
75  return (*m_boundarySurfaces);
76 }
77 
79 {
80  // prepare the BoundarySurfaces
81  m_boundarySurfaces = new std::vector<
83  // transform Surfaces To BoundarySurfaces
84  const std::vector<const Trk::Surface*>* surfaces =
86  std::vector<const Trk::Surface*>::const_iterator surfIter = surfaces->begin();
87 
88  // counter to flip the inner/outer position for Cylinders
89  int sfCounter = 0;
90  int sfNumber = surfaces->size();
91 
92  for (; surfIter != surfaces->end(); ++surfIter) {
93  sfCounter++;
94  const Trk::PlaneSurface* psf =
95  dynamic_cast<const Trk::PlaneSurface*>(*surfIter);
96  if (psf) {
97  m_boundarySurfaces->push_back(
100  this, nullptr, *psf)));
101  delete psf;
102  continue;
103  }
104  const Trk::DiscSurface* dsf =
105  dynamic_cast<const Trk::DiscSurface*>(*surfIter);
106  if (dsf) {
107  m_boundarySurfaces->push_back(
110  this, nullptr, *dsf)));
111  delete dsf;
112  continue;
113  }
114  const Trk::CylinderSurface* csf =
115  dynamic_cast<const Trk::CylinderSurface*>(*surfIter);
116  if (csf) {
117  Trk::AbstractVolume* inner =
118  (sfCounter == 3 && sfNumber > 3) ? nullptr : this;
119  Trk::AbstractVolume* outer = (inner) ? nullptr : this;
120  m_boundarySurfaces->push_back(
123  inner, outer, *csf)));
124  delete csf;
125  continue;
126  }
127  }
128 
129  delete surfaces;
130 }
131 
Trk::Volume::operator=
Volume & operator=(const Volume &vol)
Assignment operator.
Definition: Volume.cxx:63
AbstractVolume.h
BoundaryPlaneSurface.h
Trk::BoundarySurface
Definition: BoundarySurface.h:50
Surface.h
Trk::AbstractVolume::~AbstractVolume
virtual ~AbstractVolume()
Virtual Destructor.
Definition: AbstractVolume.cxx:52
Trk::AbstractVolume
Definition: AbstractVolume.h:51
VolumeBounds.h
Trk::DiscSurface
Definition: DiscSurface.h:54
Trk::AbstractVolume::operator=
AbstractVolume & operator=(const AbstractVolume &vol)
Assignment operator.
Definition: AbstractVolume.cxx:59
Trk::BoundaryPlaneSurface
Definition: BoundaryPlaneSurface.h:38
GeoPrimitives.h
Trk::VolumeBounds
Definition: VolumeBounds.h:45
Trk::BoundaryDiscSurface
Definition: BoundaryDiscSurface.h:40
Trk::CylinderSurface
Definition: CylinderSurface.h:55
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
CylinderSurface.h
BoundaryDiscSurface.h
BoundarySurface.h
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::BoundaryCylinderSurface
Definition: BoundaryCylinderSurface.h:37
Trk::SharedObject
std::shared_ptr< T > SharedObject
Definition: SharedObject.h:24
BoundaryCylinderSurface.h
Trk::PlaneSurface
Definition: PlaneSurface.h:64
PlaneSurface.h
Trk::Volume::volumeBounds
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Definition: Volume.h:97
Trk::AbstractVolume::boundarySurfaces
const std::vector< SharedObject< const BoundarySurface< AbstractVolume > > > & boundarySurfaces() const
Method to return the BoundarySurfaces.
Definition: AbstractVolume.cxx:73
DiscSurface.h
Trk::Volume
Definition: Volume.h:35
Trk::AbstractVolume::m_boundarySurfaces
std::vector< SharedObject< const BoundarySurface< AbstractVolume > > > * m_boundarySurfaces
boundary Surfaces
Definition: AbstractVolume.h:81
Trk::AbstractVolume::AbstractVolume
AbstractVolume()
Default Constructor - needed for pool and inherited classes.
Definition: AbstractVolume.cxx:30
Trk::AbstractVolume::createBoundarySurfaces
void createBoundarySurfaces()
Private method to create BoundarySurfaces.
Definition: AbstractVolume.cxx:78