40 theConfig(cfg), theTracker(0), theField(0), theTTRecHitBuilder(0)
47 const std::vector<const TrackingRecHit *> & hits,
50 int nhits = hits.size();
51 if(nhits <2)
return 0;
53 vector<GlobalPoint> points;
54 vector<GlobalError>
errors;
57 if (!theField || !theTracker || !theTTRecHitBuilder)
61 theTracker = trackerESH.
product();
70 theTTRecHitBuilder = ttrhbESH.
product();
73 for (vector<const TrackingRecHit*>::const_iterator ih = hits.begin();
74 ih!= hits.end(); ih++)
77 theTTRecHitBuilder->build(*ih);
79 points.push_back(recHit->globalPosition());
80 errors.push_back(recHit->globalPositionError());
81 isBarrel.push_back(recHit->detUnit()->type().isBarrel() );
93 float valPt = (invPt > 1.e-4) ? 1./invPt : 1.e4;
94 float errPt = 0.055*valPt + 0.017*valPt*valPt;
101 float valZip = getZip(valTip, curvature, points[0],points[1]);
103 float valPhi = getPhi(center.
x(), center.
y(), charge);
106 getCotThetaAndUpdateZip(points[0],points[1], 1/curvature,
107 valPhi,valTip,valZip);
110 float errTip, errZip;
111 getErrTipAndErrZip(valPt, points.back().eta(), errTip,errZip);
112 float errPhi = 0.002;
113 float errCotTheta = 0.002;
118 RZLine rzLine(points,errors,isBarrel);
119 float cotTheta, intercept, covss, covii, covsi;
120 rzLine.
fit(cotTheta, intercept, covss, covii, covsi);
121 chi2 = rzLine.
chi2(cotTheta, intercept);
134 return builder.
build(pt, phi, cotTheta, tip, zip, chi2,
135 charge, hits, theField);
140 (
const vector<GlobalPoint> & points)
const
144 float dphi = v32.
phi() - v21.
phi();
146 while (dphi < -
M_PI) dphi += 2*
M_PI;
147 return (dphi > 0) ? -1 : 1;
153 float radius,
float phi,
float d0,
float& zip)
const
158 float phi1 = 2*asin(0.5*(inner - IP).
perp()/radius);
159 float phi2 = 2*asin(0.5*(outer - IP).
perp()/radius);
161 float dr = radius*(phi2 - phi1);
162 float dz = outer.
z()-inner.
z();
165 zip = (inner.
z()*phi2 - outer.
z()*phi1)/(phi2 - phi1);
167 return (fabs(dr) > 1.e-3) ? dz/dr : 0;
172 (
float xC,
float yC,
int charge)
const
176 if (charge>0) phiC = atan2(xC,-yC);
177 else phiC = atan2(-xC,yC);
184 (
float d0,
float curv,
188 float rho3 = curv*curv*curv;
191 double phi1 = r1*curv/2 + inner.
perp2()*r1*rho3/48.;
194 double phi2 = r2*curv/2 + outer.
perp2()*r2*rho3/48.;
196 double z1 = inner.
z();
197 double z2 = outer.
z();
199 return z1 - phi1/(phi1-phi2)*(z1-z2);
204 (
float pt,
float eta,
float & errTip,
float & errZip)
const
206 float coshEta = cosh(eta);
211 float s_ms2 = c_ms*c_ms / (pt*
pt) * coshEta;
213 errTip =
sqrt(s_le*s_le + s_ms2 );
220 errZip =
sqrt( (s_le*s_le + c_ms*c_ms/(pt*pt)) * coshEta*coshEta*coshEta);
bool isBarrel(GeomDetEnumerators::SubDetector m)
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
void getErrTipAndErrZip(float pt, float eta, float &errZip, float &errTip) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
int getCharge(const std::vector< GlobalPoint > &points) const
T inversePt(T curvature, const edm::EventSetup &iSetup)
float getZip(float d0, float curv, const GlobalPoint &inner, const GlobalPoint &outer) const
T curvature(T InversePt, const edm::EventSetup &iSetup)
Cos< T >::type cos(const T &t)
reco::Track * build(const Measurement1D &pt, const Measurement1D &phi, const Measurement1D &cotTheta, const Measurement1D &tip, const Measurement1D &zip, float chi2, int charge, const std::vector< const TrackingRecHit * > &hits, const MagneticField *mf, const GlobalPoint &reference=GlobalPoint(0, 0, 0)) const
float getCotThetaAndUpdateZip(const GlobalPoint &inner, const GlobalPoint &outer, float radius, float phi, float d0, float &zip) const
T y() const
Cartesian y coordinate.
std::shared_ptr< TrackingRecHit const > RecHitPointer
T const * product() const
Geom::Phi< T > phi() const
T perp() const
Magnitude of transverse component.
void fit(float &cotTheta, float &intercept, float &covss, float &covii, float &covsi) const
TrackFitter(const edm::ParameterSet &cfg)
float chi2(float cotTheta, float intercept) const
float getPhi(float xC, float yC, int charge) const
T x() const
Cartesian x coordinate.
virtual reco::Track * run(const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion ®ion) const