CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ThirdHitZPrediction.cc
Go to the documentation of this file.
1 #include "ThirdHitZPrediction.h"
2 template<class T> T sqr(T t) { return t * t; }
3 
5  const GlobalPoint& p1, float erroRPhi1, float errorZ1,
6  const GlobalPoint& p2, float erroRPhi2, float errorZ2,
7  double curvature, double nSigma)
8  :
9  thePoint1(p1), thePoint2(p2),
10  theErrorXY1(erroRPhi1), theErrorZ1(errorZ1),
11  theErrorXY2(erroRPhi2), theErrorZ2(errorZ2),
12  theCurvature(curvature), theNSigma(nSigma)
13 {}
14 
16  const GlobalPoint& thePoint3, float erroRPhi3) const
17 {
18  double dR12 = (thePoint2-thePoint1).perp();
19  if (dR12 < 1.e-5) dR12 = 1.e-5;
20  double dR23 = (thePoint3-thePoint2).perp();
21  double dZ12 = thePoint2.z()-thePoint1.z();
22 
23  double slope = dR23/dR12;
24  if ( (theCurvature > 1.e-4)
25  && (fabs(dR23/2.*theCurvature) < 1.)
26  && (fabs(dR12/2.*theCurvature) <1.)
27  ) slope = asin(dR23/2.*theCurvature)/asin(dR12/2.*theCurvature);
28 
29  double z3 = thePoint2.z() + dZ12*slope;
30 
31  double sqr_errorXY12 = sqr(theErrorXY1)+sqr(theErrorXY2);
32  double sqr_errorXY23 = sqr(theErrorXY2)+sqr(erroRPhi3);
33  double error = sqrt( sqr( (1+dR23/dR12)*theErrorZ2 )
34  + sqr( dR23/dR12 * theErrorZ1 )
35  + sqr(dZ12/dR12 )*sqr_errorXY23
36  + sqr(dZ12*dR23/dR12/dR12)*sqr_errorXY12
37  );
38  error *= theNSigma;
39  return Range(z3-error,z3+error);
40 }
41 
PixelRecoRange< float > Range
static const double slope[3]
T curvature(T InversePt, const edm::EventSetup &iSetup)
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
Range operator()(const GlobalPoint &p3, float erroRPhi3) const
double p2[4]
Definition: TauolaWrapper.h:90
T perp() const
Magnitude of transverse component.
double p1[4]
Definition: TauolaWrapper.h:89
Square< F >::type sqr(const F &f)
Definition: Square.h:13
long double T
ThirdHitZPrediction(const GlobalPoint &p1, float erroRPhi1, float errorZ1, const GlobalPoint &p2, float erroRPhi2, float errorZ2, double curvature, double nSigma=3.)