Go to the documentation of this file.00001
00002 #include "RecoPixelVertexing/PixelTriplets/interface/ThirdHitPredictionFromInvParabola.h"
00003
00004 #include <cmath>
00005 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00006 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00007
00008 #include "RecoTracker/TkHitPairs/interface/OrderedHitPair.h"
00009 #include "RecoTracker/TkTrackingRegions/interface/TrackingRegion.h"
00010 #include "RecoTracker/TkMSParametrization/interface/PixelRecoUtilities.h"
00011
00012 #include "RecoTracker/TkMSParametrization/interface/PixelRecoRange.h"
00013
00014 namespace {
00015 template <class T> inline T sqr( T t) {return t*t;}
00016 }
00017
00018
00019 typedef Basic2DVector<double> Point2D;
00020 typedef PixelRecoRange<double> Ranged;
00021
00022 using namespace std;
00023
00024 ThirdHitPredictionFromInvParabola::ThirdHitPredictionFromInvParabola(
00025 const GlobalPoint& P1, const GlobalPoint& P2,double ip, double curv, double torlerance)
00026 : theTolerance(torlerance)
00027 {
00028 init(P1,P2,ip,std::abs(curv));
00029 }
00030
00031
00032 void ThirdHitPredictionFromInvParabola::
00033 init( const GlobalPoint & P1, const GlobalPoint & P2, double ip, double curv)
00034 {
00035
00036
00037 Point2D p1 = P1.basicVector().xy();
00038 Point2D p2 = P2.basicVector().xy();
00039 theRotation = Rotation(p1);
00040 p1 = transform(p1);
00041 p2 = transform(p2);
00042
00043
00044 u1u2 = p1.x()*p2.x();
00045 overDu = 1./(p2.x() - p1.x());
00046 pv = p1.y()*p2.x() - p2.y()*p1.x();
00047 dv = p2.y() - p1.y();
00048 su = p2.x() + p1.x();
00049
00050 RangeD ipRange(-ip, ip);
00051 ipRange.sort();
00052
00053 double ipIntyPlus = ipFromCurvature(0.,1);
00054 double ipCurvPlus = ipFromCurvature(curv, 1);
00055 double ipCurvMinus = ipFromCurvature(curv, -1);
00056
00057
00058 RangeD ipRangePlus(ipIntyPlus, ipCurvPlus); ipRangePlus.sort();
00059 RangeD ipRangeMinus(-ipIntyPlus, ipCurvMinus); ipRangeMinus.sort();
00060
00061 theIpRangePlus = ipRangePlus.intersection(ipRange);
00062 theIpRangeMinus = ipRangeMinus.intersection(ipRange);
00063 }
00064
00065
00066
00067 ThirdHitPredictionFromInvParabola::Range
00068 ThirdHitPredictionFromInvParabola::rangeRPhi(double radius, int icharge) const
00069 {
00070 double charge = icharge;
00071
00072 RangeD ip = (charge > 0) ? theIpRangePlus : theIpRangeMinus;
00073
00074
00075
00076 double ipv[2]={ip.min(),ip.max()};
00077 double u[2], v[2];
00078 for (int i=0; i!=2; ++i)
00079 findPointAtCurve(radius, charge, ipv[i],u[i],v[i]);
00080
00081
00082 double phi1 = theRotation.rotateBack(Point2D(u[0],v[0])).barePhi();
00083 double phi2 = phi1+(v[1]-v[0]);
00084
00085 if (ip.empty()) {
00086 Range r1(phi1*radius-theTolerance, phi1*radius+theTolerance);
00087 Range r2(phi2*radius-theTolerance, phi2*radius+theTolerance);
00088 return r1.intersection(r2);
00089 }
00090
00091 if (phi2<phi1) std::swap(phi1, phi2);
00092 return Range(radius*phi1-theTolerance, radius*phi2+theTolerance);
00093
00094 }
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147