CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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) {
12 }
13 
14 
15 bool SimpleDiskBounds::inside( const Local2DPoint& p, const LocalError& err) const {
16  return Bounds::inside(p,err);
17 }
18 
20  return new SimpleDiskBounds(*this);
21 }
22 
23 
24 
25 bool SimpleDiskBounds::inside( const Local3DPoint& p, const LocalError& err, float scale) const
26 {
27  if (p.z() < theZmin || p.z() > theZmax) return false; // check the easy part first
28 
29  double perp2 = p.perp2();
30  double perp = sqrt(perp2);
31  if (perp2 == 0) return scale*scale*(err.xx() + err.xy()) > theRmin*theRmin;
32 
33  // rotated error along p.x(),p.y()
34  // equivalent to (but faster than) err.rotate(p.x(),p.y()).xx()
35  // since we don't need all matrix elements
36  float deltaR = scale * sqrt( p.x()*p.x()/perp2 * err.xx() -
37  2*p.x()*p.y()/perp2 * err.xy() +
38  p.y()*p.y()/perp2 * err.yy());
39  return perp > std::max(theRmin-deltaR, 0.f) && perp < theRmax+deltaR;
40 }
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:24
virtual bool inside(const Local3DPoint &p) const
Determine if the point is inside the bounds.
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
T y() const
Definition: PV3DBase.h:63
T perp2() const
Definition: PV3DBase.h:71
float xy() const
Definition: LocalError.h:25
float yy() const
Definition: LocalError.h:26
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
virtual Bounds * clone() const
double f[11][100]
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
T perp2() const
Squared magnitude of transverse component.
T perp() const
Magnitude of transverse component.
Definition: Bounds.h:22
T x() const
Definition: PV3DBase.h:62