43 int charge(
const std::vector<GlobalPoint> & points) {
45 float dir = (points[1].x()-points[0].x())*(points[2].
y()-points[1].y())
46 - (points[1].
y()-points[0].y())*(points[2].
x()-points[1].x());
56 return (dir>0) ? -1 : 1;
60 float dr = outer.
perp()-inner.
perp();
61 float dz = outer.
z()-inner.
z();
65 inline float phi(
float xC,
float yC,
int charge) {
66 return (charge>0) ? std::atan2(xC,-yC) : std::atan2(-xC,yC);
69 float zip(
float d0,
float phi_p,
float curv,
78 float rho2 = curv*curv;
79 float r1s = (pinner-pca).
perp2();
80 double phi1 =
std::sqrt(r1s)*(curv*0.5f)*(1.
f+r1s*(rho2/24.
f));
81 float r2s = (pouter-pca).
perp2();
82 double phi2 =
std::sqrt(r2s)*(curv*0.5f)*(1.
f+r2s*(rho2/24.
f));
83 double z1 = pinner.
z();
84 double z2 = pouter.
z();
87 return z1 - phi1/(phi1-phi2)*(z1-z2);
97 : theConfig(cfg), theTracker(0), theField(0), theTTRecHitBuilder(0) {}
101 const std::vector<const TrackingRecHit * > & hits,
104 int nhits = hits.size();
105 if (nhits <2)
return 0;
107 vector<GlobalPoint> points(nhits);
108 vector<GlobalError>
errors(nhits);
132 auto const & recHit = hits[
i];
134 recHit->globalPosition().y()-region.
origin().
y(),
135 recHit->globalPosition().z()-region.
origin().
z()
137 errors[
i] = recHit->globalPositionError();
138 isBarrel[
i] = recHit->detUnit()->type().isBarrel();
145 float valPhi, valTip, valPt;
147 int iCharge =
charge(points);
150 if ((curvature > 1.
e-4)&&
153 valPt = (invPt > 1.e-4
f) ? 1.
f/invPt : 1.e4f;
156 valPhi =
phi(center.
x(), center.
y(), iCharge);
161 valPhi = direction.
phi();
162 valTip = -points[0].x()*
sin(valPhi) + points[0].y()*
cos(valPhi);
165 float valCotTheta = cotTheta(points[0],points[1]);
166 float valEta = asinh(valCotTheta);
167 float valZip = zip(valTip, valPhi, curvature, points[0],points[1]);
170 float errValPt = param.
errPt();
171 float errValCot = param.
errCot();
172 float errValTip = param.
errTip();
173 float errValPhi = param.
errPhi();
174 float errValZip = param.
errZip();
179 RZLine rzLine(points,errors,isBarrel);
180 float cottheta, intercept, covss, covii, covsi;
181 rzLine.
fit(cottheta, intercept, covss, covii, covsi);
182 chi2 = rzLine.
chi2(cottheta, intercept);
192 return builder.
build(pt, phi, cotTheta, tip, zip, chi2, iCharge, hits,
theField, region.
origin() );
T getParameter(std::string const &) const
const MagneticField * theField
edm::ESWatcher< TransientRecHitRecord > theTTRecHitBuilderWatcher
GlobalPoint const & origin() const
PixelFitterByHelixProjections(const edm::ParameterSet &cfg)
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
bool isBarrel(GeomDetEnumerators::SubDetector m)
Sin< T >::type sin(const T &t)
edm::ESWatcher< TrackerDigiGeometryRecord > theTrackerWatcher
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
virtual reco::Track * run(const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion ®ion) const
T inversePt(T curvature, const edm::EventSetup &iSetup)
T x() const
Cartesian x coordinate.
T curvature(T InversePt, const edm::EventSetup &iSetup)
edm::ESWatcher< IdealMagneticFieldRecord > theFieldWatcher
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
Abs< T >::type abs(const T &t)
const TrackerGeometry * theTracker
T y() const
Cartesian y coordinate.
T const * product() const
T perp2() const
Squared magnitude of transverse component.
edm::ParameterSet theConfig
Geom::Phi< T > phi() const
bool check(const edm::EventSetup &iSetup)
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
void fit(float &cotTheta, float &intercept, float &covss, float &covii, float &covsi) const
float chi2(float cotTheta, float intercept) const
T x() const
Cartesian x coordinate.