CMS 3D CMS Logo

SimpleDiskBounds.cc
Go to the documentation of this file.
1 
2 
5 #include <algorithm>
6 #include <cmath>
7 
8 SimpleDiskBounds::SimpleDiskBounds(float rmin, float rmax, float zmin, float zmax)
9  : theRmin(rmin), theRmax(rmax), theZmin(zmin), theZmax(zmax) {
10  if (theRmin > theRmax)
12  if (theZmin > theZmax)
14 }
15 
16 bool SimpleDiskBounds::inside(const Local2DPoint& p, const LocalError& err) const { return Bounds::inside(p, err); }
17 
18 Bounds* SimpleDiskBounds::clone() const { return new SimpleDiskBounds(*this); }
19 
20 bool SimpleDiskBounds::inside(const Local3DPoint& p, const LocalError& err, float scale) const {
21  if (p.z() < theZmin || p.z() > theZmax)
22  return false; // check the easy part first
23 
24  double perp2 = p.perp2();
25  double perp = sqrt(perp2);
26  if (perp2 == 0)
27  return scale * scale * (err.xx() + err.xy()) > theRmin * theRmin;
28 
29  // rotated error along p.x(),p.y()
30  // equivalent to (but faster than) err.rotate(p.x(),p.y()).xx()
31  // since we don't need all matrix elements
32  float deltaR = scale * sqrt(p.x() * p.x() / perp2 * err.xx() - 2 * p.x() * p.y() / perp2 * err.xy() +
33  p.y() * p.y() / perp2 * err.yy());
34  return perp > std::max(theRmin - deltaR, 0.f) && perp < theRmax + deltaR;
35 }
SimpleDiskBounds(float rmin, float rmax, float zmin, float zmax)
Construct the bounds from min and max R and Z in LOCAL coordinates.
float xx() const
Definition: LocalError.h:22
Bounds * clone() const override
T y() const
Definition: PV3DBase.h:60
T perp2() const
Definition: PV3DBase.h:68
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
float xy() const
Definition: LocalError.h:23
float yy() const
Definition: LocalError.h:24
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
double f[11][100]
T perp2() const
Squared magnitude of transverse component.
T perp() const
Magnitude of transverse component.
bool inside(const Local3DPoint &p) const override
Determine if the point is inside the bounds.
Definition: Bounds.h:20
T x() const
Definition: PV3DBase.h:59