CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DiskSectorBounds.cc
Go to the documentation of this file.
1 #include "DiskSectorBounds.h"
2 
3 using namespace std;
4 
5 bool DiskSectorBounds::inside( const Local3DPoint& p) const {
6 
7  // transform to system with local frame situated at disk center
8  // and rotated x/y axis
9  Local3DPoint tmp( p.y()+theOffset, -p.x(), p.z());
10 
11  return fabs(tmp.phi()) <= thePhiExt/2. &&
12  tmp.perp() >= theRmin && tmp.perp() <= theRmax &&
13  tmp.z() >= theZmin && tmp.z() <= theZmax ;
14 
15 }
16 
17 bool DiskSectorBounds::inside( const Local3DPoint& p, const LocalError& err, float scale) const {
18 
19  if (p.z() < theZmin || p.z() > theZmax) return false;
20 
21  Local3DPoint tmp( p.x(), p.y()+ theOffset, p.z());
22  double perp2 = tmp.perp2();
23  double perp = sqrt(perp2);
24 
25  // this is not really correct, should consider also the angle of the error ellipse
26  if (perp2 == 0) return scale*scale*err.yy() > theRmin*theRmin;
27 
28  LocalError tmpErr( err.xx(), err.xy(), err.yy());
29  LocalError rotatedErr = tmpErr.rotate(tmp.x(), tmp.y());
30  // x direction in this system is now r, phi is y
31 
32  float deltaR = scale*sqrt(rotatedErr.xx());
33  float deltaPhi = atan( scale*sqrt(rotatedErr.yy())/perp);
34 
35  float tmpPhi = acos( tmp.y() / perp);
36 
37  return perp >= max(theRmin-deltaR, 0.f) && perp <= theRmax+deltaR
38  && tmpPhi <= thePhiExt + deltaPhi ;
39 
40 }
float xx() const
Definition: LocalError.h:24
T y() const
Definition: PV3DBase.h:63
float xy() const
Definition: LocalError.h:25
float yy() const
Definition: LocalError.h:26
const T & max(const T &a, const T &b)
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
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.
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
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:39
T x() const
Definition: PV3DBase.h:62