ATLAS Offline Software
Volume.h
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.h, (c) ATLAS Detector software
8 
9 #ifndef TRKVOLUMES_VOLUME_H
10 #define TRKVOLUMES_VOLUME_H
11 
12 //Trk
17 #include "AthenaKernel/CLASS_DEF.h"
19 #include <memory>
20 #include <utility>
21 class MsgStream;
22 
23 namespace Trk {
24 
25  class VolumeBounds;
26 
35  class Volume {
36  public:
38  Volume();
39 
41  Volume(Amg::Transform3D* htrans, VolumeBounds* volBounds);
42 
44  Volume(const Volume& vol);
45 
47  Volume(const Volume& vol, const Amg::Transform3D& shift);
48 
50  virtual ~Volume();
51 
53  Volume& operator=(const Volume& vol);
54 
56  virtual Volume* clone() const;
57 
59  const Amg::Transform3D& transform() const;
60 
62  const Amg::Vector3D& center() const;
63 
65  const VolumeBounds& volumeBounds() const;
67 
69  bool inside(const Amg::Vector3D& gp, double tol=0.) const ;
70 
73  const Amg::Vector3D& mom,
74  bool forceInside=false) const;
75  protected:
76  std::unique_ptr<Amg::Transform3D> m_transform;
79  };
80 
81  inline const Amg::Transform3D& Volume::transform() const
82  { if (m_transform) return(*m_transform);
83  return Trk::s_idTransform;
84  }
85 
86  inline const Amg::Vector3D& Volume::center() const
87  {
88  if (m_center) return (*m_center);
89  if (!m_center && m_transform){
90  m_center.set(std::make_unique<Amg::Vector3D>(std::as_const(*m_transform).translation()));
91  return(*m_center);
92  }
93  return Trk::s_origin;
94  }
95 
96  inline const VolumeBounds&
98  {
99  return *(m_volumeBounds.get());
100  }
101 
102  inline VolumeBounds&
104  {
105  return *(m_volumeBounds.get());
106  }
107 
108 
110 MsgStream& operator << ( MsgStream& sl, const Volume& vol);
111 std::ostream& operator << ( std::ostream& sl, const Volume& vol);
112 
113 
114 } // end of namespace Trk
115 
116 CLASS_DEF( Trk::Volume , 125765716 , 1 )
117 
118 
119 #endif // TRKVOLUMES_VOLUME_H
120 
Trk::Volume::operator=
Volume & operator=(const Volume &vol)
Assignment operator.
Definition: Volume.cxx:63
Trk::Volume::Volume
Volume()
Default constructor.
Definition: Volume.cxx:21
ObjectAccessor.h
Trk::Volume::inside
bool inside(const Amg::Vector3D &gp, double tol=0.) const
Inside() method for checks.
Definition: Volume.cxx:90
Trk::Volume::m_center
CxxUtils::CachedUniquePtr< Amg::Vector3D > m_center
center position of the surface
Definition: Volume.h:77
CxxUtils::CachedUniquePtrT
Cached pointer with atomic update.
Definition: CachedUniquePtr.h:54
GeoPrimitives.h
GeometryStatics.h
Trk::VolumeBounds
Definition: VolumeBounds.h:45
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
CachedUniquePtr.h
Cached unique_ptr with atomic update.
Trk::Volume::clone
virtual Volume * clone() const
Pseudo-constructor.
Definition: Volume.cxx:78
Trk::Volume::center
const Amg::Vector3D & center() const
returns the center of the volume
Definition: Volume.h:86
SharedObject.h
Trk::Volume::boundarySurfaceAccessor
ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D &gp, const Amg::Vector3D &mom, bool forceInside=false) const
Provide accessor for BoundarySurfaces.
Definition: Volume.cxx:100
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::Volume::~Volume
virtual ~Volume()
Destructor.
Trk::Volume::transform
const Amg::Transform3D & transform() const
Return methods for geometry transform.
Definition: Volume.h:81
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::ObjectAccessor
Definition: ObjectAccessor.h:15
Trk::SharedObject
std::shared_ptr< T > SharedObject
Definition: SharedObject.h:24
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:64
Trk::Volume::volumeBounds
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Definition: Volume.h:97
Trk::Volume::m_transform
std::unique_ptr< Amg::Transform3D > m_transform
HepGeom::Transform3D.
Definition: Volume.h:76
Trk::Volume::m_volumeBounds
SharedObject< VolumeBounds > m_volumeBounds
the volumeBounds
Definition: Volume.h:78
Trk::Volume
Definition: Volume.h:35
CLASS_DEF.h
macros to associate a CLID to a type