CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DiskSectorBounds.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 
6  // transform to system with local frame situated at disk center
7  // and rotated x/y axis
8  Local3DPoint tmp(p.y() + theOffset, -p.x(), p.z());
9 
10  return ((tmp.z() >= theZmin) & (tmp.z() <= theZmax) & (tmp.perp2() >= theRmin * theRmin) &
11  (tmp.perp2() <= theRmax * theRmax)) &&
12  (std::abs(tmp.barePhi()) <= thePhiExtH);
13 }
14 
15 bool DiskSectorBounds::inside(const Local3DPoint& p, const LocalError& err, float scale) const {
16  if ((p.z() < theZmin) | (p.z() > theZmax))
17  return false;
18 
19  Local2DPoint tmp(p.x(), p.y() + theOffset);
20  auto perp2 = tmp.mag2();
21  auto perp = std::sqrt(perp2);
22 
23  // this is not really correct, should consider also the angle of the error ellipse
24  if (perp2 == 0)
25  return scale * scale * err.yy() > theRmin * theRmin;
26 
27  LocalError tmpErr(err.xx(), err.xy(), err.yy());
28  LocalError rotatedErr = tmpErr.rotate(tmp.x(), tmp.y());
29  // x direction in this system is now r, phi is y
30 
31  float deltaR = scale * std::sqrt(rotatedErr.xx());
32  float deltaPhi = std::atan(scale * std::sqrt(rotatedErr.yy() / perp2));
33 
34  float tmpPhi = std::acos(tmp.y() / perp);
35 
36  // the previous code (tmpPhi <= thePhiExt + deltaPhi) was wrong
37  return ((perp >= std::max(theRmin - deltaR, 0.f)) & (perp <= theRmax + deltaR)) && (tmpPhi <= thePhiExtH + deltaPhi);
38 }
float xx() const
Definition: LocalError.h:22
T y() const
Definition: PV3DBase.h:60
float xy() const
Definition: LocalError.h:23
float yy() const
Definition: LocalError.h:24
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool inside(const Local3DPoint &p) const override
Determine if the point is inside the bounds.
T perp2() const
Squared magnitude of transverse component.
T perp() const
Magnitude of transverse component.
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
Definition: LocalError.h:37
tmp
align.sh
Definition: createJobs.py:716
T x() const
Definition: PV3DBase.h:59