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 20 of file TrackFitter.h.

21  :
22  theTracker(tracker), theField(field), theTTRecHitBuilder(ttrhBuilder)
23  {}
const TrackerGeometry * theTracker
Definition: TrackFitter.h:38
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
Definition: TrackFitter.h:40
const MagneticField * theField
Definition: TrackFitter.h:39
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 121 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().

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

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

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

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

Definition at line 141 of file TrackFitter.cc.

References getZip().

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

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

Definition at line 153 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().

155 {
156  // phi = asin(r*rho/2) with asin(x) ~= x+x**3/(2*3)
157  float rho3 = curv*curv*curv;
158 
159  float r1 = inner.perp();
160  double phi1 = r1*curv/2 + inner.perp2()*r1*rho3/48.;
161 
162  float r2 = outer.perp();
163  double phi2 = r2*curv/2 + outer.perp2()*r2*rho3/48.;
164 
165  double z1 = inner.z();
166  double z2 = outer.z();
167 
168  return z1 - phi1/(phi1-phi2)*(z1-z2);
169 }
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 edm::EventSetup setup 
) const
overridevirtual

Implements 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(), GeomDetEnumerators::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().

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

Member Data Documentation

const MagneticField* TrackFitter::theField
private

Definition at line 39 of file TrackFitter.h.

const TrackerGeometry* TrackFitter::theTracker
private

Definition at line 38 of file TrackFitter.h.

const TransientTrackingRecHitBuilder* TrackFitter::theTTRecHitBuilder
private

Definition at line 40 of file TrackFitter.h.