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();
62 return (
std::abs(dr) > 1.e-3
f) ? dz/dr : 0;
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);
94 double errZip(
float apt,
float eta) {
96 double pt = (apt <= 10.) ? apt: 10.;
104 }
else if (feta <=1.6){
115 ziperr = p1 +
p2*pt +
p3*pt*pt +
p4*pt*pt*pt;
119 double errZip2(
float apt,
float eta) {
120 double err = errZip(apt,eta);
125 double errTip(
float apt,
float eta) {
126 double pt = (apt <= 10.) ? apt : 10.;
134 else if (feta <=1.6){
143 if (pt != 0) err = (p1 +
p2/pt);
147 double errTip2(
float apt,
float eta) {
148 double err = errTip(apt,eta);
158 : theConfig(cfg), theTracker(0), theField(0), theTTRecHitBuilder(0) { }
162 const std::vector<const TrackingRecHit * > & hits,
165 int nhits = hits.size();
166 if (nhits <2)
return 0;
168 vector<GlobalPoint> points(nhits);
169 vector<GlobalError>
errors(nhits);
170 vector<bool> isBarrel(nhits);
180 if (!
theField || watcherIdealMagneticFieldRecord.
check(es)) {
195 for (
int i=0;
i!=nhits; ++
i) {
198 recHit->globalPosition().y()-region.
origin().
y(),
199 recHit->globalPosition().z()-region.
origin().
z()
201 errors[
i] = recHit->globalPositionError();
202 isBarrel[
i] = recHit->detUnit()->type().isBarrel();
209 float valPhi, valTip, valPt;
211 int iCharge =
charge(points);
214 if (curvature > 1.e-4) {
216 valPt = (invPt > 1.e-4
f) ? 1.
f/invPt : 1.e4f;
219 valPhi =
phi(center.
x(), center.
y(), iCharge);
224 valPhi = direction.
phi();
225 valTip = -points[0].x()*
sin(valPhi) + points[0].y()*
cos(valPhi);
228 float errPt = 0.055f*valPt + 0.017f*valPt*valPt;
229 float errValTip = errTip(valPt, points.back().eta());
230 float errPhi = 0.002f;
232 float valZip = zip(valTip, valPhi, curvature, points[0],points[1]);
233 float errValZip = errZip(valPt, points.back().eta());
235 float valCotTheta = cotTheta(points[0],points[1]);
236 float errCotTheta = 0.002f;
240 RZLine rzLine(points,errors,isBarrel);
241 float cottheta, intercept, covss, covii, covsi;
242 rzLine.
fit(cottheta, intercept, covss, covii, covsi);
243 chi2 = rzLine.
chi2(cottheta, intercept);
253 return builder.
build(pt, phi, cotTheta, tip, zip, chi2, iCharge, hits,
theField, region.
origin() );
T getParameter(std::string const &) const
const MagneticField * theField
virtual GlobalPoint origin() const =0
PixelFitterByHelixProjections(const edm::ParameterSet &cfg)
Sin< T >::type sin(const T &t)
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 curvature(T InversePt, const edm::EventSetup &iSetup)
const T & max(const T &a, const T &b)
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
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
const TrackerGeometry * theTracker
T y() const
Cartesian y coordinate.
T const * product() const
T perp2() const
Squared magnitude of transverse component.
edm::ParameterSet theConfig
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.