37 template <
class T>
T sqr(
T t) {
return t*
t;}
49 const std::vector<const TrackingRecHit * > & hits,
53 int nhits = hits.size();
55 vector<GlobalPoint> points;
56 vector<GlobalError>
errors;
70 for (vector<const TrackingRecHit*>::const_iterator ih=hits.begin(); ih!=hits.end(); ih++) {
72 points.push_back( recHit->globalPosition() );
73 errors.push_back( recHit->globalPositionError() );
74 isBarrel.push_back( recHit->detUnit()->type().isBarrel() );
87 vector<PointXY>
xy; vector<float> errRPhi2;
88 for (
int i=0;
i < nhits; ++
i) {
90 xy.push_back(PointXY( point.
x()-region.
origin().
x(), point.
y()-region.
origin().
y()));
91 float phiErr2 = errors[
i].phierr(point);
92 errRPhi2.push_back( point.
perp2()*phiErr2);
102 float valPt = (invPt > 1.e-4) ? 1./invPt : 1.e4;
111 vector<float>
r(nhits),
z(nhits),errZ(nhits);
112 float simpleCot = ( points.back().z()-points.front().z() )/ (points.back().perp() - points.front().perp() );
113 for (
int i=0;
i< nhits; ++
i) {
119 errZ[
i] = (isBarrel[
i]) ?
sqrt(error.
czz()) :
sqrt( error.
rerr(point) )*simpleCot;
126 float cottheta, intercept, covss, covii, covsi;
127 rzLine.
fit(cottheta, intercept, covss, covii, covsi);
134 float chi2 = parabola.
chi2() + rzLine.
chi2(cottheta, intercept);
139 return builder.
build(pt, phi, cotTheta, tip, zip, chi2, charge, hits, field.
product(), region.
origin());
T getParameter(std::string const &) const
GlobalPoint const & origin() const
bool isBarrel(GeomDetEnumerators::SubDetector m)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
T inversePt(T curvature, const edm::EventSetup &iSetup)
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
std::shared_ptr< TrackingRecHit const > RecHitPointer
T rerr(const GlobalPoint &aPoint) const
T const * product() const
Square< F >::type sqr(const F &f)
void fit(float &cotTheta, float &intercept, float &covss, float &covii, float &covsi) const
float chi2(float cotTheta, float intercept) const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point