ATLAS Offline Software
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 
19 class MsgStream;
20 
21 
22 namespace 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 
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  const std::vector<const 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:
183  DiscBounds* discBounds() const;
185  Volume* subtractedVolume() const;
191 
192 #ifdef TRKDETDESCR_USEFLOATPRECISON
193 #define double float
194 #endif
198  double m_halfZ;
199  double m_thetaMinus;
200  double m_thetaPlus;
201  int m_type;
202 #ifdef TRKDETDESCR_USEFLOATPRECISON
203 #undef double
204 #endif
205 
210 
212  static const double s_numericalStable;
213 
215  };
216 
218  { return new BevelledCylinderVolumeBounds(*this); }
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; }
243  inline double BevelledCylinderVolumeBounds::thetaMinus() const { return m_thetaMinus; }
244  inline double BevelledCylinderVolumeBounds::thetaPlus() const { return m_thetaPlus; }
245  inline int BevelledCylinderVolumeBounds::type() const { return m_type; }
246 
247 // inline EllipseBounds* BevelledCylinderVolumeBounds::topEllipseBounds() const { return this->topEllipseBounds(); }
248 // inline EllipseBounds* BevelledCylinderVolumeBounds::bottomEllipseBounds() const { return this->bottomEllipseBounds(); }
249 
250 }
251 
252 
253 #endif // TRKVOLUMES_BEVELLEDCYLINDERVOLUMESBOUNDS_H
254 
255 
256 
Trk::RectangleBounds
Definition: RectangleBounds.h:38
Trk::py
@ py
Definition: ParamDefs.h:60
Trk::BevelledCylinderVolumeBounds::mediumRadius
double mediumRadius() const
This method returns the medium radius.
Definition: BevelledCylinderVolumeBounds.h:239
Trk::BevelledCylinderVolumeBounds::outerRadius
double outerRadius() const
This method returns the outer radius.
Definition: BevelledCylinderVolumeBounds.h:238
Trk::BevelledCylinderVolumeBounds::m_thetaMinus
double m_thetaMinus
Definition: BevelledCylinderVolumeBounds.h:199
Trk::BevelledCylinderVolumeBounds
Definition: BevelledCylinderVolumeBounds.h:100
Trk::BevelledCylinderVolumeBounds::type
int type() const
This method returns the type.
Definition: BevelledCylinderVolumeBounds.h:245
BevelledCylinderVolumeBoundaryAccessors.h
Trk::BevelledCylinderVolumeBounds::s_numericalStable
static const double s_numericalStable
numerical stability
Definition: BevelledCylinderVolumeBounds.h:212
Trk::EllipseBounds
Definition: EllipseBounds.h:38
Trk::BevelledCylinderVolumeBounds::thetaMinus
double thetaMinus() const
This method returns the thetaMinus.
Definition: BevelledCylinderVolumeBounds.h:243
Trk::BevelledCylinderVolumeBounds::m_type
int m_type
Definition: BevelledCylinderVolumeBounds.h:201
Trk::BevelledCylinderVolumeBounds::m_outerRadius
double m_outerRadius
Definition: BevelledCylinderVolumeBounds.h:196
CxxUtils::CachedUniquePtrT
Cached pointer with atomic update.
Definition: CachedUniquePtr.h:54
Trk::BevelledCylinderVolumeBounds::discBounds
DiscBounds * discBounds() const
This method returns the associated DiscBounds for the bottom/top DiscSurface.
Definition: BevelledCylinderVolumeBounds.cxx:501
Surface
Definition: Trigger/TrigAccel/TrigCudaFitter/src/Surface.h:8
Trk::BevelledCylinderVolumeBounds::BevelledCylinderVolumeBounds
BevelledCylinderVolumeBounds()
Default Constructor.
Definition: BevelledCylinderVolumeBounds.cxx:34
VolumeBounds.h
Trk::BevelledCylinderVolumeBoundaryAccessors
Definition: BevelledCylinderVolumeBoundaryAccessors.h:68
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Trk::BevelledCylinderVolumeBounds::m_innerRadius
double m_innerRadius
Definition: BevelledCylinderVolumeBounds.h:195
Trk::BevelledCylinderVolumeBounds::m_halfZ
double m_halfZ
Definition: BevelledCylinderVolumeBounds.h:198
Trk::BevelledCylinderVolumeBounds::topEllipseBounds
EllipseBounds * topEllipseBounds() const
This method returns the associated EllipseBounds for the bottom/top EllipseSurface.
Definition: BevelledCylinderVolumeBounds.cxx:477
Trk::BevelledCylinderVolumeBounds::m_thetaPlus
double m_thetaPlus
Definition: BevelledCylinderVolumeBounds.h:200
GeoPrimitives.h
Trk::VolumeBounds
Definition: VolumeBounds.h:45
Trk::BevelledCylinderVolumeBounds::bottomEllipseBounds
EllipseBounds * bottomEllipseBounds() const
This method returns the associated EllipseBounds for the bottom/top EllipseSurface.
Definition: BevelledCylinderVolumeBounds.cxx:465
Trk::BevelledCylinderVolumeBounds::createBoundarySurfaceAccessors
void createBoundarySurfaceAccessors()
Private method to construct the accessors.
Trk::BevelledCylinderVolumeBounds::decomposeToSurfaces
const std::vector< const Trk::Surface * > * decomposeToSurfaces(const Amg::Transform3D &transform) override
Method to decompose the Bounds into boundarySurfaces.
Definition: BevelledCylinderVolumeBounds.cxx:100
Trk::BevelledCylinderVolumeBounds::dump
MsgStream & dump(MsgStream &sl) const override
Output Method for MsgStream.
Definition: BevelledCylinderVolumeBounds.cxx:562
Trk::BevelledCylinderVolumeBounds::boundarySurfaceAccessor
ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D &gp, const Amg::Vector3D &dir, bool forceInside=false) const override
Provide accessor for BoundarySurfaces.
Definition: BevelledCylinderVolumeBounds.cxx:250
Trk::BevelledCylinderVolumeBounds::sectorTrdBounds
TrapezoidBounds * sectorTrdBounds() const
This method returns the associated PlaneBounds limiting a sectoral BevelledCylinderVolume.
Definition: BevelledCylinderVolumeBounds.cxx:510
Trk::BevelledCylinderVolumeBounds::outerBevelledPlaneBounds
RectangleBounds * outerBevelledPlaneBounds() const
This method returns the associated BevelledCylinderBounds of the outer BevelledCylinderSurfaces.
Definition: BevelledCylinderVolumeBounds.cxx:451
Trk::CylinderBounds
Definition: CylinderBounds.h:46
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
CachedUniquePtr.h
Cached unique_ptr with atomic update.
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
Trk::BevelledCylinderVolumeBounds::outerBevelledCylinderBounds
CylinderBounds * outerBevelledCylinderBounds() const
This method returns the associated BevelledCylinderBounds of the outer BevelledCylinderSurfaces.
Definition: BevelledCylinderVolumeBounds.cxx:443
Trk::px
@ px
Definition: ParamDefs.h:59
Trk::BevelledCylinderVolumeBounds::thetaPlus
double thetaPlus() const
This method returns the thetaPlus.
Definition: BevelledCylinderVolumeBounds.h:244
Trk::BevelledCylinderVolumeBounds::operator=
BevelledCylinderVolumeBounds & operator=(const BevelledCylinderVolumeBounds &cylbo)
Assignment operator.
Definition: BevelledCylinderVolumeBounds.cxx:82
Trk::BevelledCylinderVolumeBounds::outerCylinderBounds
CylinderBounds * outerCylinderBounds() const
This method returns the associated CylinderBounds of the outer CylinderSurfaces.
Definition: BevelledCylinderVolumeBounds.cxx:495
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::BevelledBoundaryIntersector::yOfX
double yOfX
the result of x
Definition: BevelledCylinderVolumeBounds.h:29
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::BevelledCylinderVolumeBounds::sectorPlaneBounds
RectangleBounds * sectorPlaneBounds() const
Definition: BevelledCylinderVolumeBounds.cxx:517
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::TrapezoidBounds
Definition: TrapezoidBounds.h:43
Trk::BevelledCylinderVolumeBounds::innerRadius
double innerRadius() const
This method returns the inner radius.
Definition: BevelledCylinderVolumeBounds.h:237
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::BevelledCylinderVolumeBounds::inside
bool inside(const Amg::Vector3D &, double tol=0.) const override
This method checks if position in the 3D volume frame is inside the cylinder.
Definition: BevelledCylinderVolumeBounds.h:220
Trk::ObjectAccessor
Definition: ObjectAccessor.h:15
Trk::BevelledCylinderVolumeBounds::m_subtractedVolume
CxxUtils::CachedUniquePtr< Trk::Volume > m_subtractedVolume
Definition: BevelledCylinderVolumeBounds.h:214
Trk::BevelledBoundaryIntersector::segLength
double segLength
length of the line segment
Definition: BevelledCylinderVolumeBounds.h:30
Trk::BevelledBoundaryIntersector
Definition: BevelledCylinderVolumeBounds.h:27
Trk::BevelledCylinderVolumeBounds::innerCylinderBounds
CylinderBounds * innerCylinderBounds() const
This method returns the associated CylinderBounds of the inner CylinderSurfaces.
Definition: BevelledCylinderVolumeBounds.cxx:489
Trk::BevelledCylinderVolumeBounds::innerBevelledPlaneBounds
RectangleBounds * innerBevelledPlaneBounds() const
This method returns the associated plane surface bounds of the inner bevelled surface.
Definition: BevelledCylinderVolumeBounds.cxx:458
Trk::BevelledCylinderVolumeBounds::~BevelledCylinderVolumeBounds
virtual ~BevelledCylinderVolumeBounds()
Destructor.
Trk::BevelledCylinderVolumeBounds::subtractedVolume
Volume * subtractedVolume() const
This method returns the bevelled area volume.
Definition: BevelledCylinderVolumeBounds.cxx:529
Trk::BevelledCylinderVolumeBounds::deltaRadius
double deltaRadius() const
This method returns the delta radius.
Definition: BevelledCylinderVolumeBounds.h:240
Trk::BevelledCylinderVolumeBounds::halflengthZ
double halflengthZ() const
This method returns the halflengthZ.
Definition: BevelledCylinderVolumeBounds.h:242
Trk::BevelledCylinderVolumeBounds::halfPhiSector
double halfPhiSector() const
This method returns the halfPhiSector angle.
Definition: BevelledCylinderVolumeBounds.h:241
Trk::Volume
Definition: Volume.h:35
Trk::BevelledBoundaryIntersector::BevelledBoundaryIntersector
BevelledBoundaryIntersector(double px, double py, double k, double xprime)
Definition: BevelledCylinderVolumeBounds.h:32
Trk::BevelledCylinderVolumeBounds::innerBevelledCylinderBounds
CylinderBounds * innerBevelledCylinderBounds() const
This method returns the associated BevelledCylinderBounds of the inner BevelledCylinderSurfaces.
Definition: BevelledCylinderVolumeBounds.cxx:434
Trk::BevelledCylinderVolumeBounds::m_boundaryAccessors
BevelledCylinderVolumeBoundaryAccessors m_boundaryAccessors
Accessors for Boundary surface access - static is not possible due to mismatched delete() / free () w...
Definition: BevelledCylinderVolumeBounds.h:209
Trk::BevelledCylinderVolumeBounds::clone
BevelledCylinderVolumeBounds * clone() const override
Virtual constructor.
Definition: BevelledCylinderVolumeBounds.h:217
Trk::DiscBounds
Definition: DiscBounds.h:44
fitman.k
k
Definition: fitman.py:528
Trk::BevelledCylinderVolumeBounds::m_halfPhiSector
double m_halfPhiSector
Definition: BevelledCylinderVolumeBounds.h:197