ATLAS Offline Software
Loading...
Searching...
No Matches
BevelledCylinderVolumeBounds.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// BevelledCylinderVolumeBounds.h, (c) ATLAS Detector software
8
9#ifndef TRKVOLUMES_BEVELLEDCYLINDERVOLUMESBOUNDS_H
10#define TRKVOLUMES_BEVELLEDCYLINDERVOLUMESBOUNDS_H
11
12// Trk
15// Eigen
18
19class MsgStream;
20
21
22namespace Trk {
23
28
29 double yOfX;
30 double segLength;
31
32 BevelledBoundaryIntersector(double px, double py, double k, double xprime) {
33 double deltax = xprime-px;
34 yOfX = py + k*(deltax);
35 double deltay = yOfX-py;
36 segLength = sqrt(deltax*deltax+deltay*deltay);
37 }
38
39 };
40
41 class Surface;
42 class EllipseBounds;
43 class TrapezoidBounds;
44 class RectangleBounds;
45 class CylinderBounds;
46 class DiscBounds;
47
99
101
102 public:
105
107 BevelledCylinderVolumeBounds(double rinner, double router, double halfPhiSector, double halez, int type);
108
111
114
117
119 BevelledCylinderVolumeBounds* clone() const override;
120
122 bool inside(const Amg::Vector3D& , double tol=0.) const override;
123
125 virtual std::vector<std::unique_ptr<Trk::Surface>> decomposeToSurfaces (const Amg::Transform3D& transform) override;
126
129 const Amg::Vector3D& dir,
130 bool forceInside=false) const override;
131
133 double innerRadius() const;
134
136 double outerRadius() const;
137
139 double mediumRadius() const;
140
142 double deltaRadius() const;
143
145 double halfPhiSector() const;
146
148 double halflengthZ() const;
149
151 double thetaMinus() const;
152
154 double thetaPlus() const;
155
157 int type() const;
158
160 MsgStream& dump(MsgStream& sl) const override;
161
163 std::ostream& dump(std::ostream& sl) const override;
164
165 private:
167 std::shared_ptr<CylinderBounds> innerBevelledCylinderBounds() const;
169 std::shared_ptr<CylinderBounds> outerBevelledCylinderBounds() const;
171 std::shared_ptr<RectangleBounds> innerBevelledPlaneBounds() const;
173 std::shared_ptr<RectangleBounds> outerBevelledPlaneBounds() const;
175 std::shared_ptr<EllipseBounds> bottomEllipseBounds() const;
177 std::shared_ptr<EllipseBounds> topEllipseBounds() const;
179 std::shared_ptr<CylinderBounds> innerCylinderBounds() const;
181 std::shared_ptr<CylinderBounds> outerCylinderBounds() const;
183 std::shared_ptr<DiscBounds> discBounds() const;
185 Volume* subtractedVolume() const;
187 std::shared_ptr<TrapezoidBounds> sectorTrdBounds() const;
188 std::shared_ptr<RectangleBounds> sectorPlaneBounds() const;
191
192#ifdef TRKDETDESCR_USEFLOATPRECISON
193#define double float
194#endif
198 double m_halfZ;
202#ifdef TRKDETDESCR_USEFLOATPRECISON
203#undef double
204#endif
205
210
212 static const double s_numericalStable;
213
215 };
216
219
220 inline bool BevelledCylinderVolumeBounds::inside(const Amg::Vector3D &pos, double tol) const
221 {
222 double ros = pos.perp();
223 bool insidePhi = fabs(pos.phi()) <= m_halfPhiSector + tol;
224 double cphi = cos(pos.phi());
225 bool insideR = insidePhi;
226 if (m_type < 1) insideR = insidePhi ? ((ros >= m_innerRadius - tol ) && (ros <= m_outerRadius + tol)) : false;
227 else if (m_type == 1 ) insideR = insidePhi ? ((ros>= m_innerRadius/cphi-tol)&&(ros<=m_outerRadius+tol)):false;
228 else if (m_type == 2 ) insideR = insidePhi ? ((ros>= m_innerRadius-tol)&&(ros<=m_outerRadius/cphi+tol)):false;
229 else if (m_type == 3 ) insideR = insidePhi ? ((ros>= m_innerRadius/cphi-tol)&&(ros<=m_outerRadius/cphi+tol)):false;
230// bool insideZ = insideR ? (fabs(pos.z()) <= m_halfZ + tol ) : false ;
231 bool insideZ = insideR ? ((pos.z()<=m_halfZ-(pos.x()+m_outerRadius)*tan(m_thetaPlus) + tol)
232 && ( pos.z()>=-m_halfZ+(pos.x()+m_outerRadius)*tan(m_thetaMinus) - tol)) : false ;
233
234 return insideZ;
235 }
236
242 inline double BevelledCylinderVolumeBounds::halflengthZ() const { return m_halfZ; }
244 inline double BevelledCylinderVolumeBounds::thetaPlus() const { return m_thetaPlus; }
245 inline int BevelledCylinderVolumeBounds::type() const { return m_type; }
246
247
248}
249
250
251#endif // TRKVOLUMES_BEVELLEDCYLINDERVOLUMESBOUNDS_H
252
253
254
Cached unique_ptr with atomic update.
Different Accessor types for a cylindrical Volume, if returs accessors to the volume boundary surface...
std::shared_ptr< RectangleBounds > outerBevelledPlaneBounds() const
This method returns the associated BevelledCylinderBounds of the outer BevelledCylinderSurfaces.
std::shared_ptr< DiscBounds > discBounds() const
This method returns the associated DiscBounds for the bottom/top DiscSurface.
void createBoundarySurfaceAccessors()
Private method to construct the accessors.
virtual std::vector< std::unique_ptr< Trk::Surface > > decomposeToSurfaces(const Amg::Transform3D &transform) override
Method to decompose the Bounds into boundarySurfaces.
std::shared_ptr< EllipseBounds > bottomEllipseBounds() const
This method returns the associated EllipseBounds for the bottom/top EllipseSurface.
virtual ~BevelledCylinderVolumeBounds()
Destructor.
Volume * subtractedVolume() const
This method returns the bevelled area volume.
int type() const
This method returns the type.
double thetaPlus() const
This method returns the thetaPlus.
ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D &gp, const Amg::Vector3D &dir, bool forceInside=false) const override
Provide accessor for BoundarySurfaces.
double deltaRadius() const
This method returns the delta radius.
std::shared_ptr< RectangleBounds > innerBevelledPlaneBounds() const
This method returns the associated plane surface bounds of the inner bevelled surface.
static const double s_numericalStable
numerical stability
CxxUtils::CachedUniquePtr< Trk::Volume > m_subtractedVolume
double halflengthZ() const
This method returns the halflengthZ.
double mediumRadius() const
This method returns the medium radius.
double innerRadius() const
This method returns the inner radius.
std::shared_ptr< TrapezoidBounds > sectorTrdBounds() const
This method returns the associated PlaneBounds limiting a sectoral BevelledCylinderVolume.
BevelledCylinderVolumeBounds & operator=(const BevelledCylinderVolumeBounds &cylbo)
Assignment operator.
std::shared_ptr< CylinderBounds > outerBevelledCylinderBounds() const
This method returns the associated BevelledCylinderBounds of the outer BevelledCylinderSurfaces.
std::shared_ptr< CylinderBounds > outerCylinderBounds() const
This method returns the associated CylinderBounds of the outer CylinderSurfaces.
std::shared_ptr< RectangleBounds > sectorPlaneBounds() const
double outerRadius() const
This method returns the outer radius.
std::shared_ptr< EllipseBounds > topEllipseBounds() const
This method returns the associated EllipseBounds for the bottom/top EllipseSurface.
double halfPhiSector() const
This method returns the halfPhiSector angle.
std::shared_ptr< CylinderBounds > innerBevelledCylinderBounds() const
This method returns the associated BevelledCylinderBounds of the inner BevelledCylinderSurfaces.
BevelledCylinderVolumeBoundaryAccessors m_boundaryAccessors
Accessors for Boundary surface access - static is not possible due to mismatched delete() / free () w...
bool inside(const Amg::Vector3D &, double tol=0.) const override
This method checks if position in the 3D volume frame is inside the cylinder.
BevelledCylinderVolumeBounds * clone() const override
Virtual constructor.
std::shared_ptr< CylinderBounds > innerCylinderBounds() const
This method returns the associated CylinderBounds of the inner CylinderSurfaces.
double thetaMinus() const
This method returns the thetaMinus.
VolumeBounds()
Default Constructor.
Base class for all volumes inside the tracking realm, it defines the interface for inherited Volume c...
Definition Volume.h:36
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
CachedUniquePtrT< const T > CachedUniquePtr
Ensure that the ATLAS eigen extensions are properly loaded.
@ px
Definition ParamDefs.h:59
@ py
Definition ParamDefs.h:60
-event-from-file
double segLength
length of the line segment
BevelledBoundaryIntersector(double px, double py, double k, double xprime)