ATLAS Offline Software
Volume.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // AbstractVolume.h, (c) ATLAS Detector software
8 
9 #ifndef TRKVOLUMES_VOLUME_H
10 #define TRKVOLUMES_VOLUME_H
11 
12 //Trk
16 //
17 #include "AthenaKernel/CLASS_DEF.h"
18 //std
19 #include <memory>
20 
21 class MsgStream;
22 
23 namespace Trk {
24 
25  class VolumeBounds;
26 
36  class Volume {
37  public:
39  Volume() = default;
40  Volume(Volume&&) = default;
41  Volume& operator=(Volume&&) = default;
42  virtual ~Volume() = default;
43 
45  Volume(std::unique_ptr<Amg::Transform3D> htrans,
46  std::shared_ptr<VolumeBounds> volBounds);
47 
49  Volume(const Volume& vol);
50 
52  Volume(const Volume& vol, const Amg::Transform3D& shift);
53 
55  Volume& operator=(const Volume& vol);
56 
58  virtual Volume* clone() const;
59 
61  const Amg::Transform3D& transform() const;
62 
64  const Amg::Vector3D& center() const;
65 
67  const VolumeBounds& volumeBounds() const;
69 
71  bool inside(const Amg::Vector3D& gp, double tol=0.) const ;
72 
75  const Amg::Vector3D& mom,
76  bool forceInside=false) const;
77  protected:
78  std::unique_ptr<Amg::Transform3D> m_transform = nullptr;
79  Amg::Vector3D m_center = Trk::s_origin;
80  std::shared_ptr<VolumeBounds> m_volumeBounds = nullptr;
81  };
82 
83  inline const Amg::Transform3D& Volume::transform() const {
84  if (m_transform) {
85  return (*m_transform);
86  }
87  return Trk::s_idTransform;
88  }
89 
90  inline const Amg::Vector3D& Volume::center() const
91  {
92  return m_center;
93  }
94 
95  inline const VolumeBounds&
97  {
98  return *(m_volumeBounds.get());
99  }
100 
101  inline VolumeBounds&
103  {
104  return *(m_volumeBounds.get());
105  }
106 
107 
109 MsgStream& operator << ( MsgStream& sl, const Volume& vol);
110 std::ostream& operator << ( std::ostream& sl, const Volume& vol);
111 
112 
113 } // end of namespace Trk
114 
115 CLASS_DEF( Trk::Volume , 125765716 , 1 )
116 
117 
118 #endif // TRKVOLUMES_VOLUME_H
119 
Trk::Volume::~Volume
virtual ~Volume()=default
ObjectAccessor.h
Trk::Volume::inside
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
Definition: Volume.cxx:72
Trk::Volume::m_volumeBounds
std::shared_ptr< VolumeBounds > m_volumeBounds
the volumeBounds
Definition: Volume.h:80
GeoPrimitives.h
GeometryStatics.h
Trk::VolumeBounds
Definition: VolumeBounds.h:46
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Trk::Volume::Volume
Volume()=default
Defaults copies are special due ot unique ptr data member
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Trk::Volume::clone
virtual Volume * clone() const
polymorpic deep copy
Definition: Volume.cxx:60
Trk::Volume::center
const Amg::Vector3D & center() const
returns the center of the volume
Definition: Volume.h:90
Trk::Volume::boundarySurfaceAccessor
ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D &gp, const Amg::Vector3D &mom, bool forceInside=false) const
Provide accessor for BoundarySurfaces.
Definition: Volume.cxx:82
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::Volume::transform
const Amg::Transform3D & transform() const
Return methods for geometry transform.
Definition: Volume.h:83
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::Volume::operator=
Volume & operator=(Volume &&)=default
Trk::ObjectAccessor
Definition: ObjectAccessor.h:15
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition: AlignModule.cxx:204
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
Trk::Volume::volumeBounds
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Definition: Volume.h:96
Trk::Volume::m_transform
std::unique_ptr< Amg::Transform3D > m_transform
Transform3D (optional)
Definition: Volume.h:78
Trk::Volume
Definition: Volume.h:36
Trk::Volume::Volume
Volume(Volume &&)=default
CLASS_DEF.h
macros to associate a CLID to a type
Trk::Volume::m_center
Amg::Vector3D m_center
center position of the surface
Definition: Volume.h:79