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 Attributes
PixelFitterByHelixProjections Class Reference

#include <PixelFitterByHelixProjections.h>

Inheritance diagram for PixelFitterByHelixProjections:
PixelFitter

Public Member Functions

 PixelFitterByHelixProjections (const edm::ParameterSet &cfg)
 
virtual reco::Trackrun (const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region) const
 
virtual ~PixelFitterByHelixProjections ()
 
- 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 Attributes

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

Detailed Description

Definition at line 19 of file PixelFitterByHelixProjections.h.

Constructor & Destructor Documentation

PixelFitterByHelixProjections::PixelFitterByHelixProjections ( const edm::ParameterSet cfg)

Definition at line 96 of file PixelFitterByHelixProjections.cc.

virtual PixelFitterByHelixProjections::~PixelFitterByHelixProjections ( )
inlinevirtual

Definition at line 22 of file PixelFitterByHelixProjections.h.

22 {}

Member Function Documentation

reco::Track * PixelFitterByHelixProjections::run ( const edm::EventSetup es,
const std::vector< const TrackingRecHit * > &  hits,
const TrackingRegion region 
) const
virtual

Reimplemented from PixelFitter.

Definition at line 100 of file PixelFitterByHelixProjections.cc.

References TransientTrackingRecHitBuilder::build(), PixelTrackBuilder::build(), CircleFromThreePoints::center(), DeDxDiscriminatorTools::charge(), edm::ESWatcher< T >::check(), RZLine::chi2(), funct::cos(), PixelRecoUtilities::curvature(), CircleFromThreePoints::curvature(), alignCSCRings::e, PixelTrackErrorParam::errCot(), benchmark_cfg::errors, PixelTrackErrorParam::errPhi(), PixelTrackErrorParam::errPt(), PixelTrackErrorParam::errTip(), PixelTrackErrorParam::errZip(), f, RZLine::fit(), edm::EventSetup::get(), edm::ParameterSet::getParameter(), i, MagneticField::inTesla(), PixelRecoUtilities::inversePt(), likely, Basic2DVector< T >::mag(), TrackingRegion::origin(), phi, PV3DBase< T, PVType, FrameType >::phi(), edm::ESHandle< class >::product(), funct::sin(), theConfig, theField, theTracker, theTTRecHitBuilder, Basic2DVector< T >::x(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), Basic2DVector< T >::y(), and PV3DBase< T, PVType, FrameType >::z().

104 {
105  int nhits = hits.size();
106  if (nhits <2) return 0;
107 
108  vector<GlobalPoint> points(nhits);
109  vector<GlobalError> errors(nhits);
110  vector<bool> isBarrel(nhits);
111 
112  static edm::ESWatcher<TrackerDigiGeometryRecord> watcherTrackerDigiGeometryRecord;
113  if (!theTracker || watcherTrackerDigiGeometryRecord.check(es)) {
115  es.get<TrackerDigiGeometryRecord>().get(trackerESH);
116  theTracker = trackerESH.product();
117  }
118 
119  static edm::ESWatcher<IdealMagneticFieldRecord> watcherIdealMagneticFieldRecord;
120  if (!theField || watcherIdealMagneticFieldRecord.check(es)) {
122  es.get<IdealMagneticFieldRecord>().get(fieldESH);
123  theField = fieldESH.product();
124  }
125 
126  static edm::ESWatcher<TransientRecHitRecord> watcherTransientRecHitRecord;
127  if (!theTTRecHitBuilder || watcherTransientRecHitRecord.check(es)) {
129  std::string builderName = theConfig.getParameter<std::string>("TTRHBuilder");
130  es.get<TransientRecHitRecord>().get(builderName,ttrhbESH);
131  theTTRecHitBuilder = ttrhbESH.product();
132  }
133 
134 
135  for ( int i=0; i!=nhits; ++i) {
137  points[i] = GlobalPoint( recHit->globalPosition().x()-region.origin().x(),
138  recHit->globalPosition().y()-region.origin().y(),
139  recHit->globalPosition().z()-region.origin().z()
140  );
141  errors[i] = recHit->globalPositionError();
142  isBarrel[i] = recHit->detUnit()->type().isBarrel();
143  }
144 
145  CircleFromThreePoints circle = (nhits==2) ?
146  CircleFromThreePoints( GlobalPoint(0.,0.,0.), points[0], points[1]) :
147  CircleFromThreePoints(points[0],points[1],points[2]);
148 
149  float valPhi, valTip, valPt;
150 
151  int iCharge = charge(points);
152  float curvature = circle.curvature();
153 
154  if ((curvature > 1.e-4)&&
155  (likely(theField->inTesla(GlobalPoint(0.,0.,0.)).z()>0.01))) {
156  float invPt = PixelRecoUtilities::inversePt( circle.curvature(), es);
157  valPt = (invPt > 1.e-4f) ? 1.f/invPt : 1.e4f;
158  CircleFromThreePoints::Vector2D center = circle.center();
159  valTip = iCharge * (center.mag()-1.f/curvature);
160  valPhi = phi(center.x(), center.y(), iCharge);
161  }
162  else {
163  valPt = 1.e4f;
164  GlobalVector direction(points[1]-points[0]);
165  valPhi = direction.phi();
166  valTip = -points[0].x()*sin(valPhi) + points[0].y()*cos(valPhi);
167  }
168 
169  float valCotTheta = cotTheta(points[0],points[1]);
170  float valEta = asinh(valCotTheta);
171  float valZip = zip(valTip, valPhi, curvature, points[0],points[1]);
172 
173  PixelTrackErrorParam param(valEta, valPt);
174  float errValPt = param.errPt();
175  float errValCot = param.errCot();
176  float errValTip = param.errTip();
177  float errValPhi = param.errPhi();
178  float errValZip = param.errZip();
179 
180 
181  float chi2 = 0;
182  if (nhits > 2) {
183  RZLine rzLine(points,errors,isBarrel);
184  float cottheta, intercept, covss, covii, covsi;
185  rzLine.fit(cottheta, intercept, covss, covii, covsi);
186  chi2 = rzLine.chi2(cottheta, intercept); //FIXME: check which intercept to use!
187  }
188 
189  PixelTrackBuilder builder;
190  Measurement1D pt(valPt, errValPt);
191  Measurement1D phi(valPhi, errValPhi);
192  Measurement1D cotTheta(valCotTheta, errValCot);
193  Measurement1D tip(valTip, errValTip);
194  Measurement1D zip(valZip, errValZip);
195 
196  return builder.build(pt, phi, cotTheta, tip, zip, chi2, iCharge, hits, theField, region.origin() );
197 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
virtual GlobalPoint origin() const =0
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:62
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
double charge(const std::vector< uint8_t > &Ampls)
T inversePt(T curvature, const edm::EventSetup &iSetup)
T curvature(T InversePt, const edm::EventSetup &iSetup)
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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
double f[11][100]
T y() const
Cartesian y coordinate.
Definition: RZLine.h:8
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:59
const TransientTrackingRecHitBuilder * theTTRecHitBuilder
#define likely(x)
Definition: Likely.h:20
T x() const
Definition: PV3DBase.h:61
T x() const
Cartesian x coordinate.
Definition: DDAxes.h:10

Member Data Documentation

edm::ParameterSet PixelFitterByHelixProjections::theConfig
private

Definition at line 40 of file PixelFitterByHelixProjections.h.

Referenced by run().

const MagneticField* PixelFitterByHelixProjections::theField
mutableprivate

Definition at line 43 of file PixelFitterByHelixProjections.h.

Referenced by run().

const TrackerGeometry* PixelFitterByHelixProjections::theTracker
mutableprivate

Definition at line 42 of file PixelFitterByHelixProjections.h.

Referenced by run().

const TransientTrackingRecHitBuilder* PixelFitterByHelixProjections::theTTRecHitBuilder
mutableprivate

Definition at line 44 of file PixelFitterByHelixProjections.h.

Referenced by run().