CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoPixelVertexing/PixelTriplets/plugins/ThirdHitZPrediction.cc

Go to the documentation of this file.
00001 #include "ThirdHitZPrediction.h"
00002 template<class T> T sqr(T t) { return t * t; }
00003 
00004 ThirdHitZPrediction::ThirdHitZPrediction(
00005     const GlobalPoint& p1, float erroRPhi1, float errorZ1,
00006     const GlobalPoint& p2, float erroRPhi2, float errorZ2, 
00007     double curvature, double nSigma)
00008   :
00009     thePoint1(p1), thePoint2(p2),
00010     theErrorXY1(erroRPhi1), theErrorZ1(errorZ1),
00011     theErrorXY2(erroRPhi2), theErrorZ2(errorZ2),
00012     theCurvature(curvature), theNSigma(nSigma)
00013 {}
00014 
00015 ThirdHitZPrediction::Range ThirdHitZPrediction::operator()(
00016    const GlobalPoint& thePoint3, float erroRPhi3) const
00017 {
00018   double dR12 = (thePoint2-thePoint1).perp();
00019   if (dR12 < 1.e-5) dR12 = 1.e-5;
00020   double dR23 = (thePoint3-thePoint2).perp();
00021   double dZ12 = thePoint2.z()-thePoint1.z();
00022 
00023   double slope = dR23/dR12;
00024   if (    (theCurvature > 1.e-4) 
00025        && (fabs(dR23/2.*theCurvature) < 1.) 
00026        && (fabs(dR12/2.*theCurvature) <1.) 
00027          ) slope = asin(dR23/2.*theCurvature)/asin(dR12/2.*theCurvature);
00028 
00029   double z3 = thePoint2.z() + dZ12*slope;
00030 
00031   double sqr_errorXY12 = sqr(theErrorXY1)+sqr(theErrorXY2);
00032   double sqr_errorXY23 = sqr(theErrorXY2)+sqr(erroRPhi3);
00033   double error = sqrt( sqr( (1+dR23/dR12)*theErrorZ2 )
00034                      + sqr( dR23/dR12 * theErrorZ1 )
00035                      + sqr(dZ12/dR12 )*sqr_errorXY23 
00036                      + sqr(dZ12*dR23/dR12/dR12)*sqr_errorXY12
00037                      );
00038   error *= theNSigma;
00039   return Range(z3-error,z3+error);
00040 }
00041