CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackFitter Class Reference

#include <TrackFitter.h>

Inheritance diagram for TrackFitter:
PixelFitterBase

Public Member Functions

std::unique_ptr< reco::Trackrun (const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region, const edm::EventSetup &setup) const override
 
 TrackFitter (const TrackerGeometry *tracker, const MagneticField *field, const TransientTrackingRecHitBuilder *ttrhBuilder)
 
 ~TrackFitter () override
 
- Public Member Functions inherited from PixelFitterBase
virtual ~PixelFitterBase ()
 

Private Member Functions

float getCotThetaAndUpdateZip (const GlobalPoint &inner, const GlobalPoint &outer, float radius, float phi, float d0, float &zip) const
 
void getErrTipAndErrZip (float pt, float eta, float &errZip, float &errTip) const
 
float getPhi (float xC, float yC, int charge) const
 
float getZip (float d0, float curv, const GlobalPoint &inner, const GlobalPoint &outer) const
 

Private Attributes

const MagneticFieldtheField
 
const TrackerGeometrytheTracker
 
const TransientTrackingRecHitBuildertheTTRecHitBuilder
 

Detailed Description

Definition at line 17 of file TrackFitter.h.

Constructor & Destructor Documentation

TrackFitter::TrackFitter ( const TrackerGeometry tracker,
const MagneticField field,
const TransientTrackingRecHitBuilder ttrhBuilder 
)
inline

Definition at line 19 of file TrackFitter.h.

22  : theTracker(tracker), theField(field), theTTRecHitBuilder(ttrhBuilder) {}
const TrackerGeometry * theTracker
Definition: TrackFitter.h:36
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
Definition: TrackFitter.h:38
const MagneticField * theField
Definition: TrackFitter.h:37
TrackFitter::~TrackFitter ( )
inlineoverride

Member Function Documentation

float TrackFitter::getCotThetaAndUpdateZip ( const GlobalPoint inner,
const GlobalPoint outer,
float  radius,
float  phi,
float  d0,
float &  zip 
) const
private

Definition at line 111 of file TrackFitter.cc.

References funct::cos(), flavorHistoryFilter_cfi::dr, PVValHelper::dz, listHistos::IP, M_PI_2, perp(), funct::sin(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by ~TrackFitter().

112  {
113  float chi = phi - M_PI_2;
114  GlobalPoint IP(d0 * cos(chi), d0 * sin(chi), zip);
115 
116  float phi1 = 2 * asin(0.5 * (inner - IP).perp() / radius);
117  float phi2 = 2 * asin(0.5 * (outer - IP).perp() / radius);
118 
119  float dr = radius * (phi2 - phi1);
120  float dz = outer.z() - inner.z();
121 
122  // Recalculate ZIP
123  zip = (inner.z() * phi2 - outer.z() * phi1) / (phi2 - phi1);
124 
125  return (fabs(dr) > 1.e-3) ? dz / dr : 0;
126 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
#define M_PI_2
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
T z() const
Definition: PV3DBase.h:61
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T perp() const
Magnitude of transverse component.
void TrackFitter::getErrTipAndErrZip ( float  pt,
float  eta,
float &  errZip,
float &  errTip 
) const
private

Definition at line 158 of file TrackFitter.cc.

References DiDispStaMuonMonitor_cfi::pt, and mathSSE::sqrt().

Referenced by ~TrackFitter().

158  {
159  float coshEta = cosh(eta);
160 
161  { // transverse
162  float c_ms = 0.0115; //0.0115;
163  float s_le = 0.0095; //0.0123;
164  float s_ms2 = c_ms * c_ms / (pt * pt) * coshEta;
165 
166  errTip = sqrt(s_le * s_le + s_ms2);
167  }
168 
169  { // z
170  float c_ms = 0.0070;
171  float s_le = 0.0135;
172 
173  errZip = sqrt((s_le * s_le + c_ms * c_ms / (pt * pt)) * coshEta * coshEta * coshEta);
174  }
175 }
T sqrt(T t)
Definition: SSEVec.h:19
float TrackFitter::getPhi ( float  xC,
float  yC,
int  charge 
) const
private

Definition at line 129 of file TrackFitter.cc.

Referenced by ~TrackFitter().

129  {
130  float phiC;
131 
132  if (charge > 0)
133  phiC = atan2(xC, -yC);
134  else
135  phiC = atan2(-xC, yC);
136 
137  return phiC;
138 }
float TrackFitter::getZip ( float  d0,
float  curv,
const GlobalPoint inner,
const GlobalPoint outer 
) const
private

Definition at line 141 of file TrackFitter.cc.

References PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::perp2(), diffTwoXMLs::r1, diffTwoXMLs::r2, PV3DBase< T, PVType, FrameType >::z(), and testProducerWithPsetDescEmpty_cfi::z2.

Referenced by ~TrackFitter().

141  {
142  // phi = asin(r*rho/2) with asin(x) ~= x+x**3/(2*3)
143  float rho3 = curv * curv * curv;
144 
145  float r1 = inner.perp();
146  double phi1 = r1 * curv / 2 + inner.perp2() * r1 * rho3 / 48.;
147 
148  float r2 = outer.perp();
149  double phi2 = r2 * curv / 2 + outer.perp2() * r2 * rho3 / 48.;
150 
151  double z1 = inner.z();
152  double z2 = outer.z();
153 
154  return z1 - phi1 / (phi1 - phi2) * (z1 - z2);
155 }
T perp() const
Definition: PV3DBase.h:69
T perp2() const
Definition: PV3DBase.h:68
T z() const
Definition: PV3DBase.h:61
std::unique_ptr< reco::Track > TrackFitter::run ( const std::vector< const TrackingRecHit * > &  hits,
const TrackingRegion region,
const edm::EventSetup setup 
) const
overridevirtual

Implements PixelFitterBase.

Definition at line 41 of file TrackFitter.cc.

References PixelTrackBuilder::build(), CircleFromThreePoints::center(), ALCARECOTkAlJpsiMuMu_cff::charge, hltPixelTracks_cff::chi2, RZLine::chi2(), PixelRecoUtilities::curvature(), CircleFromThreePoints::curvature(), declareDynArray, vertexPlots::e4, DeDxTools::getCharge(), mps_fire::i, PixelRecoUtilities::inversePt(), PixelPluginsPhase0_cfi::isBarrel, Basic2DVector< T >::mag(), nhits, DiDispStaMuonMonitor_cfi::pt, rpcPointValidation_cfi::recHit, runTheMatrix::ret, qcdUeDQM_cfi::tip, Basic2DVector< T >::x(), Basic2DVector< T >::y(), and ComparisonHelper::zip().

Referenced by ~TrackFitter().

43  {
44  std::unique_ptr<reco::Track> ret;
45 
46  int nhits = hits.size();
47  if (nhits < 2)
48  return ret;
49 
52  declareDynArray(bool, nhits, isBarrel);
53 
54  unsigned int i = 0;
55  for (auto const& ih : hits) {
56  auto recHit = theTTRecHitBuilder->build(ih);
57 
58  points[i] = recHit->globalPosition();
59  errors[i] = recHit->globalPositionError();
60  isBarrel[++i] = recHit->detUnit()->type().isBarrel();
61  }
62 
63  CircleFromThreePoints circle = (nhits == 2) ? CircleFromThreePoints(GlobalPoint(0., 0., 0.), points[0], points[1])
65 
66  int charge = getCharge(points);
67  float curvature = circle.curvature();
68 
69  // pt
70  float invPt = PixelRecoUtilities::inversePt(curvature, setup);
71  float valPt = (invPt > 1.e-4) ? 1. / invPt : 1.e4;
72  float errPt = 0.055 * valPt + 0.017 * valPt * valPt;
73 
74  CircleFromThreePoints::Vector2D center = circle.center();
75 
76  // tip
77  float valTip = charge * (center.mag() - 1 / curvature);
78  // zip
79  float valZip = getZip(valTip, curvature, points[0], points[1]);
80  // phi
81  float valPhi = getPhi(center.x(), center.y(), charge);
82  // cot(theta), update zip
83  float valCotTheta = getCotThetaAndUpdateZip(points[0], points[1], 1 / curvature, valPhi, valTip, valZip);
84 
85  // errors
86  float errTip, errZip;
87  getErrTipAndErrZip(valPt, points.back().eta(), errTip, errZip);
88  float errPhi = 0.002;
89  float errCotTheta = 0.002;
90 
91  float chi2 = 0;
92  if (nhits > 2) {
93  RZLine rzLine(points, errors, isBarrel);
94  chi2 = rzLine.chi2();
95  }
96 
97  // build pixel track
98  PixelTrackBuilder builder;
99 
100  Measurement1D pt(valPt, errPt);
101  Measurement1D phi(valPhi, errPhi);
102  Measurement1D cotTheta(valCotTheta, errCotTheta);
103  Measurement1D tip(valTip, errTip);
104  Measurement1D zip(valZip, errZip);
105 
106  ret.reset(builder.build(pt, phi, cotTheta, tip, zip, chi2, charge, hits, theField));
107  return ret;
108 }
#define declareDynArray(T, n, x)
Definition: DynArray.h:91
int getCharge(const SiStripCluster *cluster, int &nSatStrip, const GeomDetUnit &detUnit, const std::vector< std::vector< float > > &calibGains, const unsigned int &m_off)
Definition: DeDxTools.cc:214
ret
prodAgent to be discontinued
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void getErrTipAndErrZip(float pt, float eta, float &errZip, float &errTip) const
Definition: TrackFitter.cc:158
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T inversePt(T curvature, const edm::EventSetup &iSetup)
float getZip(float d0, float curv, const GlobalPoint &inner, const GlobalPoint &outer) const
Definition: TrackFitter.cc:141
T curvature(T InversePt, const edm::EventSetup &iSetup)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
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
float getCotThetaAndUpdateZip(const GlobalPoint &inner, const GlobalPoint &outer, float radius, float phi, float d0, float &zip) const
Definition: TrackFitter.cc:111
T y() const
Cartesian y coordinate.
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
Definition: RZLine.h:12
Definition: errors.py:1
float getPhi(float xC, float yC, int charge) const
Definition: TrackFitter.cc:129
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
Definition: TrackFitter.h:38
T x() const
Cartesian x coordinate.
const MagneticField * theField
Definition: TrackFitter.h:37

Member Data Documentation

const MagneticField* TrackFitter::theField
private

Definition at line 37 of file TrackFitter.h.

const TrackerGeometry* TrackFitter::theTracker
private

Definition at line 36 of file TrackFitter.h.

const TransientTrackingRecHitBuilder* TrackFitter::theTTRecHitBuilder
private

Definition at line 38 of file TrackFitter.h.