CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PixelNtupletsFitter Class Referencefinal

#include <PixelNtupletsFitter.h>

Inheritance diagram for PixelNtupletsFitter:
PixelFitterBase

Public Member Functions

 PixelNtupletsFitter (float nominalB, const MagneticField *field, bool useRiemannFit)
 
std::unique_ptr< reco::Trackrun (const std::vector< const TrackingRecHit *> &hits, const TrackingRegion &region) const override
 
 ~PixelNtupletsFitter () override=default
 
- Public Member Functions inherited from PixelFitterBase
virtual ~PixelFitterBase ()
 

Private Attributes

const MagneticFieldfield_
 
float nominalB_
 
bool useRiemannFit_
 

Detailed Description

Definition at line 12 of file PixelNtupletsFitter.h.

Constructor & Destructor Documentation

◆ PixelNtupletsFitter()

PixelNtupletsFitter::PixelNtupletsFitter ( float  nominalB,
const MagneticField field,
bool  useRiemannFit 
)
explicit

Definition at line 22 of file PixelNtupletsFitter.cc.

◆ ~PixelNtupletsFitter()

PixelNtupletsFitter::~PixelNtupletsFitter ( )
overridedefault

Member Function Documentation

◆ run()

std::unique_ptr< reco::Track > PixelNtupletsFitter::run ( const std::vector< const TrackingRecHit *> &  hits,
const TrackingRegion region 
) const
overridevirtual

Implements PixelFitterBase.

Definition at line 25 of file PixelNtupletsFitter.cc.

References cms::cuda::assert(), PixelTrackBuilder::build(), hltPixelTracks_cff::chi2, riemannFit::HelixFit::chi2_circle, riemannFit::HelixFit::chi2_line, riemannFit::HelixFit::cov, declareDynArray, field_, brokenline::helixFit(), riemannFit::helixFit(), hfClusterShapes_cfi::hits, mps_fire::i, PixelPluginsPhase0_cfi::isBarrel, nhits, nominalB_, riemannFit::HelixFit::par, phi, HLT_FULL_cff::points, DiDispStaMuonMonitor_cfi::pt, riemannFit::HelixFit::qCharge, rpcPointValidation_cfi::recHit, HLT_2022v12_cff::region, runTheMatrix::ret, mathSSE::sqrt(), qcdUeDQM_cfi::tip, useRiemannFit_, and ComparisonHelper::zip().

26  {
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 }
ret
prodAgent to be discontinued
Vector5d par
(phi,Tip,pt,cotan(theta)),Zip)
Definition: FitResult.h:49
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:61
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
T sqrt(T t)
Definition: SSEVec.h:19
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:584
Eigen::Matrix< double, 3, N > Matrix3xNd
Definition: FitResult.h:24
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:975

Member Data Documentation

◆ field_

const MagneticField* PixelNtupletsFitter::field_
private

Definition at line 21 of file PixelNtupletsFitter.h.

Referenced by run().

◆ nominalB_

float PixelNtupletsFitter::nominalB_
private

Definition at line 20 of file PixelNtupletsFitter.h.

Referenced by run().

◆ useRiemannFit_

bool PixelNtupletsFitter::useRiemannFit_
private

Definition at line 22 of file PixelNtupletsFitter.h.

Referenced by run().