CMS 3D CMS Logo

PixelNtupletsFitter.cc
Go to the documentation of this file.
20 
21 using namespace std;
22 
23 PixelNtupletsFitter::PixelNtupletsFitter(float nominalB, const MagneticField* field, bool useRiemannFit)
24  : nominalB_(nominalB), field_(field), useRiemannFit_(useRiemannFit) {}
25 
26 std::unique_ptr<reco::Track> PixelNtupletsFitter::run(const std::vector<const TrackingRecHit*>& hits,
27  const TrackingRegion& region,
28  const edm::EventSetup&) const {
29  using namespace riemannFit;
30 
31  std::unique_ptr<reco::Track> ret;
32 
33  unsigned int nhits = hits.size();
34 
35  if (nhits < 2)
36  return ret;
37 
41 
42  for (unsigned int i = 0; i != nhits; ++i) {
43  auto const& recHit = hits[i];
44  points[i] = GlobalPoint(recHit->globalPosition().basicVector() - region.origin().basicVector());
45  errors[i] = recHit->globalPositionError();
46  isBarrel[i] = recHit->detUnit()->type().isBarrel();
47  }
48 
49  assert(nhits == 4);
51 
52  Eigen::Matrix<float, 6, 4> hits_ge = Eigen::Matrix<float, 6, 4>::Zero();
53 
54  for (unsigned int i = 0; i < nhits; ++i) {
55  hits_gp.col(i) << points[i].x(), points[i].y(), points[i].z();
56 
57  hits_ge.col(i) << errors[i].cxx(), errors[i].cyx(), errors[i].cyy(), errors[i].czx(), errors[i].czy(),
58  errors[i].czz();
59  }
60 
61  HelixFit fittedTrack = useRiemannFit_ ? riemannFit::helixFit(hits_gp, hits_ge, nominalB_, true)
62  : brokenline::helixFit(hits_gp, hits_ge, nominalB_);
63 
64  int iCharge = fittedTrack.qCharge;
65 
66  // parameters are:
67  // 0: phi
68  // 1: tip
69  // 2: curvature
70  // 3: cottheta
71  // 4: zip
72  float valPhi = fittedTrack.par(0);
73 
74  float valTip = fittedTrack.par(1);
75 
76  float valCotTheta = fittedTrack.par(3);
77 
78  float valZip = fittedTrack.par(4);
79  float valPt = fittedTrack.par(2);
80  //
81  // PixelTrackErrorParam param(valEta, valPt);
82  float errValPhi = std::sqrt(fittedTrack.cov(0, 0));
83  float errValTip = std::sqrt(fittedTrack.cov(1, 1));
84 
85  float errValPt = std::sqrt(fittedTrack.cov(2, 2));
86 
87  float errValCotTheta = std::sqrt(fittedTrack.cov(3, 3));
88  float errValZip = std::sqrt(fittedTrack.cov(4, 4));
89 
90  float chi2 = fittedTrack.chi2_line + fittedTrack.chi2_circle;
91 
92  PixelTrackBuilder builder;
93  Measurement1D phi(valPhi, errValPhi);
94  Measurement1D tip(valTip, errValTip);
95 
96  Measurement1D pt(valPt, errValPt);
97  Measurement1D cotTheta(valCotTheta, errValCotTheta);
98  Measurement1D zip(valZip, errValZip);
99 
100  ret.reset(builder.build(pt, phi, cotTheta, tip, zip, chi2, iCharge, hits, field_, region.origin()));
101  return ret;
102 }
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
Measurement1D
Definition: Measurement1D.h:11
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
PixelNtupletsFitter::nominalB_
float nominalB_
Definition: PixelNtupletsFitter.h:22
riemannFit::helixFit
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:975
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21453
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
riemannFit::HelixFit::qCharge
int32_t qCharge
particle charge
Definition: FitResult.h:61
Measurement1D.h
GeomDetType.h
cms::cuda::assert
assert(be >=bs)
RiemannFit.h
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
PixelNtupletsFitter::useRiemannFit_
bool useRiemannFit_
Definition: PixelNtupletsFitter.h:24
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
riemannFit::HelixFit::cov
Matrix5d cov
Definition: FitResult.h:50
TrackingRecHit.h
errors
Definition: errors.py:1
PixelNtupletsFitter::field_
const MagneticField * field_
Definition: PixelNtupletsFitter.h:23
BrokenLine.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
declareDynArray
#define declareDynArray(T, n, x)
Definition: DynArray.h:91
PixelTrackBuilder
Definition: PixelTrackBuilder.h:13
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
PixelRecoUtilities.h
Point3DBase< float, GlobalTag >
nhits
Definition: HIMultiTrackSelector.h:42
riemannFit::HelixFit::chi2_line
float chi2_line
Definition: FitResult.h:59
PixelNtupletsFitter::PixelNtupletsFitter
PixelNtupletsFitter(float nominalB, const MagneticField *field, bool useRiemannFit)
Definition: PixelNtupletsFitter.cc:23
qcdUeDQM_cfi.tip
tip
Definition: qcdUeDQM_cfi.py:23
PixelPluginsPhase0_cfi.isBarrel
isBarrel
Definition: PixelPluginsPhase0_cfi.py:17
riemannFit::Matrix3xNd
Eigen::Matrix< double, 3, N > Matrix3xNd
Definition: FitResult.h:24
Pi.h
riemannFit::HelixFit::chi2_circle
float chi2_circle
Definition: FitResult.h:58
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88271
GlobalError.h
GlobalErrorBase< double, ErrorMatrixTag >
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:58
riemannFit::HelixFit::par
Vector5d par
(phi,Tip,pt,cotan(theta)),Zip)
Definition: FitResult.h:49
DynArray.h
ComparisonHelper::zip
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
Definition: L1TStage2CaloLayer1.h:41
PixelTrackBuilder::build
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
Definition: PixelTrackBuilder.cc:123
PixelTrackBuilder.h
PixelTrackErrorParam.h
DDAxes::phi
GeomDet.h
std
Definition: JetResolutionObject.h:76
riemannFit::HelixFit
Definition: FitResult.h:48
LocalPoint.h
PixelNtupletsFitter.h
riemannFit
Definition: FitResult.h:11
EventSetup.h
PixelNtupletsFitter::run
std::unique_ptr< reco::Track > run(const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region, const edm::EventSetup &setup) const override
Definition: PixelNtupletsFitter.cc:26
TrackingRegion
Definition: TrackingRegion.h:41
brokenline::helixFit
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:571
ParameterSet.h
MagneticField
Definition: MagneticField.h:19
GlobalPoint.h