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 override
 
 TrackFitter (const edm::EventSetup *es, const TrackerGeometry *tracker, const MagneticField *field, const TransientTrackingRecHitBuilder *ttrhBuilder)
 
 ~TrackFitter () override
 
- Public Member Functions inherited from PixelFitterBase
virtual reco::Trackrun (const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region) const
 
virtual reco::Trackrun (const edm::Event &ev, const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region) const
 
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 edm::EventSetuptheES
 
const MagneticFieldtheField
 
const TrackerGeometrytheTracker
 
const TransientTrackingRecHitBuildertheTTRecHitBuilder
 

Detailed Description

Definition at line 17 of file TrackFitter.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file TrackFitter.h.

21  :
22  theES(es), theTracker(tracker), theField(field), theTTRecHitBuilder(ttrhBuilder)
23  {}
const TrackerGeometry * theTracker
Definition: TrackFitter.h:39
const edm::EventSetup * theES
Definition: TrackFitter.h:38
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
Definition: TrackFitter.h:41
const MagneticField * theField
Definition: TrackFitter.h:40
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 120 of file TrackFitter.cc.

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

Referenced by run(), and ~TrackFitter().

122 {
123  float chi = phi - M_PI_2;
124  GlobalPoint IP(d0*cos(chi), d0*sin(chi),zip);
125 
126  float phi1 = 2*asin(0.5*(inner - IP).perp()/radius);
127  float phi2 = 2*asin(0.5*(outer - IP).perp()/radius);
128 
129  float dr = radius*(phi2 - phi1);
130  float dz = outer.z()-inner.z();
131 
132  // Recalculate ZIP
133  zip = (inner.z()*phi2 - outer.z()*phi1)/(phi2 - phi1);
134 
135  return (fabs(dr) > 1.e-3) ? dz/dr : 0;
136 }
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:64
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 172 of file TrackFitter.cc.

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

Referenced by getZip(), and ~TrackFitter().

173 {
174  float coshEta = cosh(eta);
175 
176  { // transverse
177  float c_ms = 0.0115; //0.0115;
178  float s_le = 0.0095; //0.0123;
179  float s_ms2 = c_ms*c_ms / (pt*pt) * coshEta;
180 
181  errTip = sqrt(s_le*s_le + s_ms2 );
182  }
183 
184  { // z
185  float c_ms = 0.0070;
186  float s_le = 0.0135;
187 
188  errZip = sqrt( (s_le*s_le + c_ms*c_ms/(pt*pt)) * coshEta*coshEta*coshEta);
189  }
190 }
T sqrt(T t)
Definition: SSEVec.h:18
float TrackFitter::getPhi ( float  xC,
float  yC,
int  charge 
) const
private

Definition at line 140 of file TrackFitter.cc.

References getZip().

Referenced by getCotThetaAndUpdateZip(), and ~TrackFitter().

141 {
142  float phiC;
143 
144  if (charge>0) phiC = atan2(xC,-yC);
145  else phiC = atan2(-xC,yC);
146 
147  return phiC;
148 }
float TrackFitter::getZip ( float  d0,
float  curv,
const GlobalPoint inner,
const GlobalPoint outer 
) const
private

Definition at line 152 of file TrackFitter.cc.

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

Referenced by getPhi(), and ~TrackFitter().

154 {
155  // phi = asin(r*rho/2) with asin(x) ~= x+x**3/(2*3)
156  float rho3 = curv*curv*curv;
157 
158  float r1 = inner.perp();
159  double phi1 = r1*curv/2 + inner.perp2()*r1*rho3/48.;
160 
161  float r2 = outer.perp();
162  double phi2 = r2*curv/2 + outer.perp2()*r2*rho3/48.;
163 
164  double z1 = inner.z();
165  double z2 = outer.z();
166 
167  return z1 - phi1/(phi1-phi2)*(z1-z2);
168 }
T perp() const
Definition: PV3DBase.h:72
T perp2() const
Definition: PV3DBase.h:71
T z() const
Definition: PV3DBase.h:64
std::unique_ptr< reco::Track > TrackFitter::run ( const std::vector< const TrackingRecHit * > &  hits,
const TrackingRegion region 
) const
overridevirtual

Reimplemented from PixelFitterBase.

Definition at line 43 of file TrackFitter.cc.

References PixelTrackBuilder::build(), CircleFromThreePoints::center(), ALCARECOTkAlJpsiMuMu_cff::charge, vertices_cff::chi2, RZLine::chi2(), PixelRecoUtilities::curvature(), CircleFromThreePoints::curvature(), declareDynArray, vertexPlots::e4, DeDxTools::getCharge(), getCotThetaAndUpdateZip(), mps_fire::i, PixelRecoUtilities::inversePt(), gedGsfElectrons_cfi::isBarrel, Basic2DVector< T >::mag(), nhits, EnergyCorrector::pt, rpcPointValidation_cfi::recHit, btvTracks_cfi::tip, Basic2DVector< T >::x(), Basic2DVector< T >::y(), and ComparisonHelper::zip().

Referenced by ~TrackFitter().

45 {
46  std::unique_ptr<reco::Track> ret;
47 
48  int nhits = hits.size();
49  if(nhits <2) return ret;
50 
53  declareDynArray(bool,nhits, isBarrel);
54 
55  unsigned int i=0;
56  for (auto const & ih : hits)
57  {
58  auto recHit = theTTRecHitBuilder->build(ih);
59 
60  points[i] = recHit->globalPosition();
61  errors[i] = recHit->globalPositionError();
62  isBarrel[++i] = recHit->detUnit()->type().isBarrel();
63  }
64 
65  CircleFromThreePoints circle = (nhits==2) ?
66  CircleFromThreePoints(GlobalPoint(0.,0.,0.), points[0], points[1]) :
68 
69  int charge = getCharge(points);
70  float curvature = circle.curvature();
71 
72  // pt
73  float invPt = PixelRecoUtilities::inversePt(curvature, *theES);
74  float valPt = (invPt > 1.e-4) ? 1./invPt : 1.e4;
75  float errPt = 0.055*valPt + 0.017*valPt*valPt;
76 
77  CircleFromThreePoints::Vector2D center = circle.center();
78 
79  // tip
80  float valTip = charge * (center.mag()-1/curvature);
81  // zip
82  float valZip = getZip(valTip, curvature, points[0],points[1]);
83  // phi
84  float valPhi = getPhi(center.x(), center.y(), charge);
85  // cot(theta), update zip
86  float valCotTheta =
87  getCotThetaAndUpdateZip(points[0],points[1], 1/curvature,
88  valPhi,valTip,valZip);
89 
90  // errors
91  float errTip, errZip;
92  getErrTipAndErrZip(valPt, points.back().eta(), errTip,errZip);
93  float errPhi = 0.002;
94  float errCotTheta = 0.002;
95 
96  float chi2 = 0;
97  if(nhits > 2)
98  {
99  RZLine rzLine(points,errors,isBarrel);
100  chi2 = rzLine.chi2();
101  }
102 
103  // build pixel track
104  PixelTrackBuilder builder;
105 
106  Measurement1D pt (valPt, errPt);
107  Measurement1D phi (valPhi, errPhi);
108  Measurement1D cotTheta(valCotTheta, errCotTheta);
109  Measurement1D tip (valTip, errTip);
110  Measurement1D zip (valZip, errZip);
111 
112  ret.reset(builder.build(pt, phi, cotTheta, tip, zip, chi2,
113  charge, hits, theField));
114  return ret;
115 }
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:161
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void getErrTipAndErrZip(float pt, float eta, float &errZip, float &errTip) const
Definition: TrackFitter.cc:172
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:152
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:120
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
const edm::EventSetup * theES
Definition: TrackFitter.h:38
Definition: errors.py:1
#define declareDynArray(T, n, x)
Definition: DynArray.h:59
float getPhi(float xC, float yC, int charge) const
Definition: TrackFitter.cc:140
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
Definition: TrackFitter.h:41
T x() const
Cartesian x coordinate.
const MagneticField * theField
Definition: TrackFitter.h:40

Member Data Documentation

const edm::EventSetup* TrackFitter::theES
private

Definition at line 38 of file TrackFitter.h.

const MagneticField* TrackFitter::theField
private

Definition at line 40 of file TrackFitter.h.

const TrackerGeometry* TrackFitter::theTracker
private

Definition at line 39 of file TrackFitter.h.

const TransientTrackingRecHitBuilder* TrackFitter::theTTRecHitBuilder
private

Definition at line 41 of file TrackFitter.h.