CMS 3D CMS Logo

PixelNtupletsFitter.cc
Go to the documentation of this file.
19 
20 using namespace std;
21 
23  : nominalB_(nominalB), field_(field), useRiemannFit_(useRiemannFit) {}
24 
25 std::unique_ptr<reco::Track> PixelNtupletsFitter::run(const std::vector<const TrackingRecHit*>& hits,
26  const TrackingRegion& region) const {
27  using namespace riemannFit;
28 
29  std::unique_ptr<reco::Track> ret;
30 
31  unsigned int nhits = hits.size();
32 
33  if (nhits < 2)
34  return ret;
35 
39 
40  for (unsigned int i = 0; i != nhits; ++i) {
41  auto const& recHit = hits[i];
42  points[i] = GlobalPoint(recHit->globalPosition().basicVector() - region.origin().basicVector());
43  errors[i] = recHit->globalPositionError();
44  isBarrel[i] = recHit->detUnit()->type().isBarrel();
45  }
46 
47  assert(nhits == 4);
49 
50  Eigen::Matrix<float, 6, 4> hits_ge = Eigen::Matrix<float, 6, 4>::Zero();
51 
52  for (unsigned int i = 0; i < nhits; ++i) {
53  hits_gp.col(i) << points[i].x(), points[i].y(), points[i].z();
54 
55  hits_ge.col(i) << errors[i].cxx(), errors[i].cyx(), errors[i].cyy(), errors[i].czx(), errors[i].czy(),
56  errors[i].czz();
57  }
58 
59  HelixFit fittedTrack = useRiemannFit_ ? riemannFit::helixFit(hits_gp, hits_ge, nominalB_, true)
60  : brokenline::helixFit(hits_gp, hits_ge, nominalB_);
61 
62  int iCharge = fittedTrack.qCharge;
63 
64  // parameters are:
65  // 0: phi
66  // 1: tip
67  // 2: curvature
68  // 3: cottheta
69  // 4: zip
70  float valPhi = fittedTrack.par(0);
71 
72  float valTip = fittedTrack.par(1);
73 
74  float valCotTheta = fittedTrack.par(3);
75 
76  float valZip = fittedTrack.par(4);
77  float valPt = fittedTrack.par(2);
78  //
79  // PixelTrackErrorParam param(valEta, valPt);
80  float errValPhi = std::sqrt(fittedTrack.cov(0, 0));
81  float errValTip = std::sqrt(fittedTrack.cov(1, 1));
82 
83  float errValPt = std::sqrt(fittedTrack.cov(2, 2));
84 
85  float errValCotTheta = std::sqrt(fittedTrack.cov(3, 3));
86  float errValZip = std::sqrt(fittedTrack.cov(4, 4));
87 
88  float chi2 = fittedTrack.chi2_line + fittedTrack.chi2_circle;
89 
90  PixelTrackBuilder builder;
91  Measurement1D phi(valPhi, errValPhi);
92  Measurement1D tip(valTip, errValTip);
93 
94  Measurement1D pt(valPt, errValPt);
95  Measurement1D cotTheta(valCotTheta, errValCotTheta);
96  Measurement1D zip(valZip, errValZip);
97 
98  ret.reset(builder.build(pt, phi, cotTheta, tip, zip, chi2, iCharge, hits, field_, region.origin()));
99  return ret;
100 }
std::unique_ptr< reco::Track > run(const std::vector< const TrackingRecHit *> &hits, const TrackingRegion &region) const override
ret
prodAgent to be discontinued
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float zip(ConstView const &tracks, int32_t i)
Definition: TracksSoA.h:90
Vector5d par
(phi,Tip,pt,cotan(theta)),Zip)
Definition: FitResult.h:46
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
assert(be >=bs)
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
int32_t qCharge
particle charge
Definition: FitResult.h:58
T sqrt(T t)
Definition: SSEVec.h:23
riemannFit::HelixFit helixFit(const riemannFit::Matrix3xNd< n > &hits, const Eigen::Matrix< float, 6, 4 > &hits_ge, const double bField)
Helix fit by three step: -fast pre-fit (see Fast_fit() for further info); -circle fit of the hits pr...
Definition: BrokenLine.h:585
Eigen::Matrix< double, 3, N > Matrix3xNd
Definition: HelixFit.h:30
Definition: errors.py:1
#define declareDynArray(T, n, x)
Definition: DynArray.h:91
const MagneticField * field_
HelixFit helixFit(const Matrix3xNd< N > &hits, const Eigen::Matrix< float, 6, N > &hits_ge, const double bField, const bool error)
Helix fit by three step: -fast pre-fit (see Fast_fit() for further info); -circle fit of hits proje...
Definition: RiemannFit.h:978
PixelNtupletsFitter(float nominalB, const MagneticField *field, bool useRiemannFit)