test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackFitter Class Reference

#include <TrackFitter.h>

Inheritance diagram for TrackFitter:
PixelFitter

Public Member Functions

virtual reco::Trackrun (const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region) const
 
 TrackFitter (const edm::ParameterSet &cfg)
 
virtual ~TrackFitter ()
 
- Public Member Functions inherited from PixelFitter
virtual reco::Trackrun (const edm::Event &ev, const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region) const
 
virtual ~PixelFitter ()
 

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

edm::ParameterSet theConfig
 
const MagneticFieldtheField
 
const TrackerGeometrytheTracker
 
const
TransientTrackingRecHitBuilder
theTTRecHitBuilder
 

Detailed Description

Definition at line 17 of file TrackFitter.h.

Constructor & Destructor Documentation

TrackFitter::TrackFitter ( const edm::ParameterSet cfg)

Definition at line 58 of file TrackFitter.cc.

58  :
60 {
61 }
const TrackerGeometry * theTracker
Definition: TrackFitter.h:39
edm::ParameterSet theConfig
Definition: TrackFitter.h:37
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
Definition: TrackFitter.h:41
const MagneticField * theField
Definition: TrackFitter.h:40
virtual TrackFitter::~TrackFitter ( )
inlinevirtual

Definition at line 21 of file TrackFitter.h.

21 { }

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 159 of file TrackFitter.cc.

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

161 {
162  float chi = phi - M_PI_2;
163  GlobalPoint IP(d0*cos(chi), d0*sin(chi),zip);
164 
165  float phi1 = 2*asin(0.5*(inner - IP).perp()/radius);
166  float phi2 = 2*asin(0.5*(outer - IP).perp()/radius);
167 
168  float dr = radius*(phi2 - phi1);
169  float dz = outer.z()-inner.z();
170 
171  // Recalculate ZIP
172  zip = (inner.z()*phi2 - outer.z()*phi1)/(phi2 - phi1);
173 
174  return (fabs(dr) > 1.e-3) ? dz/dr : 0;
175 }
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
tuple IP
Definition: listHistos.py:76
T perp() const
Magnitude of transverse component.
void TrackFitter::getErrTipAndErrZip ( float  pt,
float  eta,
float &  errZip,
float &  errTip 
) const
private

Definition at line 211 of file TrackFitter.cc.

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

212 {
213  float coshEta = cosh(eta);
214 
215  { // transverse
216  float c_ms = 0.0115; //0.0115;
217  float s_le = 0.0095; //0.0123;
218  float s_ms2 = c_ms*c_ms / (pt*pt) * coshEta;
219 
220  errTip = sqrt(s_le*s_le + s_ms2 );
221  }
222 
223  { // z
224  float c_ms = 0.0070;
225  float s_le = 0.0135;
226 
227  errZip = sqrt( (s_le*s_le + c_ms*c_ms/(pt*pt)) * coshEta*coshEta*coshEta);
228  }
229 }
T sqrt(T t)
Definition: SSEVec.h:18
float TrackFitter::getPhi ( float  xC,
float  yC,
int  charge 
) const
private

Definition at line 179 of file TrackFitter.cc.

180 {
181  float phiC;
182 
183  if (charge>0) phiC = atan2(xC,-yC);
184  else phiC = atan2(-xC,yC);
185 
186  return phiC;
187 }
float TrackFitter::getZip ( float  d0,
float  curv,
const GlobalPoint inner,
const GlobalPoint outer 
) const
private

Definition at line 191 of file TrackFitter.cc.

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

193 {
194  // phi = asin(r*rho/2) with asin(x) ~= x+x**3/(2*3)
195  float rho3 = curv*curv*curv;
196 
197  float r1 = inner.perp();
198  double phi1 = r1*curv/2 + inner.perp2()*r1*rho3/48.;
199 
200  float r2 = outer.perp();
201  double phi2 = r2*curv/2 + outer.perp2()*r2*rho3/48.;
202 
203  double z1 = inner.z();
204  double z2 = outer.z();
205 
206  return z1 - phi1/(phi1-phi2)*(z1-z2);
207 }
T perp() const
Definition: PV3DBase.h:72
T perp2() const
Definition: PV3DBase.h:71
T z() const
Definition: PV3DBase.h:64
reco::Track * TrackFitter::run ( const edm::EventSetup es,
const std::vector< const TrackingRecHit * > &  hits,
const TrackingRegion region 
) const
virtual

Reimplemented from PixelFitter.

Definition at line 65 of file TrackFitter.cc.

References PixelTrackBuilder::build(), CircleFromThreePoints::center(), RecoTauCleanerPlugins::charge, RZLine::chi2(), beam_dqm_sourceclient-live_cfg::chi2, PixelRecoUtilities::curvature(), CircleFromThreePoints::curvature(), declareDynArray, benchmark_cfg::errors, RZLine::fit(), edm::EventSetup::get(), getCharge(), i, PixelRecoUtilities::inversePt(), GeomDetEnumerators::isBarrel(), Basic2DVector< T >::mag(), nhits, phi(), edm::ESHandle< class >::product(), EnergyCorrector::pt, AlCaHLTBitMon_QueryRunRegistry::string, HLT_25ns10e33_v2_cff::tip, Basic2DVector< T >::x(), Basic2DVector< T >::y(), and ComparisonHelper::zip().

68 {
69  int nhits = hits.size();
70  if(nhits <2) return 0;
71 
72  declareDynArray(GlobalPoint,nhits, points);
74  declareDynArray(bool,nhits, isBarrel);
75 
77  {
79  es.get<TrackerDigiGeometryRecord>().get(trackerESH);
80  theTracker = trackerESH.product();
81 
83  es.get<IdealMagneticFieldRecord>().get(fieldESH);
84  theField = fieldESH.product();
85 
87  std::string builderName = theConfig.getParameter<std::string>("TTRHBuilder");
88  es.get<TransientRecHitRecord>().get(builderName,ttrhbESH);
89  theTTRecHitBuilder = ttrhbESH.product();
90  }
91 
92  unsigned int i=0;
93  for (auto const & ih : hits)
94  {
95  auto recHit = theTTRecHitBuilder->build(ih);
96 
97  points[i] = recHit->globalPosition();
98  errors[i] = recHit->globalPositionError();
99  isBarrel[++i] = recHit->detUnit()->type().isBarrel();
100  }
101 
102  CircleFromThreePoints circle = (nhits==2) ?
103  CircleFromThreePoints(GlobalPoint(0.,0.,0.), points[0], points[1]) :
104  CircleFromThreePoints(points[0],points[1],points[2]);
105 
106  int charge = getCharge(points);
107  float curvature = circle.curvature();
108 
109  // pt
110  float invPt = PixelRecoUtilities::inversePt(curvature, es);
111  float valPt = (invPt > 1.e-4) ? 1./invPt : 1.e4;
112  float errPt = 0.055*valPt + 0.017*valPt*valPt;
113 
114  CircleFromThreePoints::Vector2D center = circle.center();
115 
116  // tip
117  float valTip = charge * (center.mag()-1/curvature);
118  // zip
119  float valZip = getZip(valTip, curvature, points[0],points[1]);
120  // phi
121  float valPhi = getPhi(center.x(), center.y(), charge);
122  // cot(theta), update zip
123  float valCotTheta =
124  getCotThetaAndUpdateZip(points[0],points[1], 1/curvature,
125  valPhi,valTip,valZip);
126 
127  // errors
128  float errTip, errZip;
129  getErrTipAndErrZip(valPt, points.back().eta(), errTip,errZip);
130  float errPhi = 0.002;
131  float errCotTheta = 0.002;
132 
133  float chi2 = 0;
134  if(nhits > 2)
135  {
136  RZLine rzLine(points,errors,isBarrel);
137  float cotTheta, intercept, covss, covii, covsi;
138  rzLine.fit(cotTheta, intercept, covss, covii, covsi);
139  chi2 = rzLine.chi2(cotTheta, intercept);
140  //FIXME: check which intercept to use!
141  }
142 
143  // build pixel track
144  PixelTrackBuilder builder;
145 
146  Measurement1D pt (valPt, errPt);
147  Measurement1D phi (valPhi, errPhi);
148  Measurement1D cotTheta(valCotTheta, errCotTheta);
149  Measurement1D tip (valTip, errTip);
150  Measurement1D zip (valZip, errZip);
151 
152  return builder.build(pt, phi, cotTheta, tip, zip, chi2,
153  charge, hits, theField);
154 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
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:211
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const TrackerGeometry * theTracker
Definition: TrackFitter.h:39
T inversePt(T curvature, const edm::EventSetup &iSetup)
float getZip(float d0, float curv, const GlobalPoint &inner, const GlobalPoint &outer) const
Definition: TrackFitter.cc:191
T curvature(T InversePt, const edm::EventSetup &iSetup)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
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:159
int getCharge(int phi1, int phi2, int phi3, int phi4, int mode)
T y() const
Cartesian y coordinate.
Definition: RZLine.h:9
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
edm::ParameterSet theConfig
Definition: TrackFitter.h:37
#define declareDynArray(T, n, x)
Definition: DynArray.h:58
float getPhi(float xC, float yC, int charge) const
Definition: TrackFitter.cc:179
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
Definition: TrackFitter.h:41
T x() const
Cartesian x coordinate.
const MagneticField * theField
Definition: TrackFitter.h:40

Member Data Documentation

edm::ParameterSet TrackFitter::theConfig
private

Definition at line 37 of file TrackFitter.h.

const MagneticField* TrackFitter::theField
mutableprivate

Definition at line 40 of file TrackFitter.h.

const TrackerGeometry* TrackFitter::theTracker
mutableprivate

Definition at line 39 of file TrackFitter.h.

const TransientTrackingRecHitBuilder* TrackFitter::theTTRecHitBuilder
mutableprivate

Definition at line 41 of file TrackFitter.h.