CMS 3D CMS Logo

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

#include <PixelFitterByHelixProjections.h>

Inheritance diagram for PixelFitterByHelixProjections:
PixelFitterBase

Public Member Functions

 PixelFitterByHelixProjections (const TrackerTopology *ttopo, const MagneticField *field, bool scaleErrorsForBPix1, float scaleFactor)
 
std::unique_ptr< reco::Trackrun (const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region) const override
 
 ~PixelFitterByHelixProjections () override
 
- Public Member Functions inherited from PixelFitterBase
virtual ~PixelFitterBase ()
 

Private Attributes

const MagneticFieldtheField
 
const bool thescaleErrorsForBPix1
 
const float thescaleFactor
 
const TrackerTopologytheTopo
 

Detailed Description

Definition at line 14 of file PixelFitterByHelixProjections.h.

Constructor & Destructor Documentation

PixelFitterByHelixProjections::PixelFitterByHelixProjections ( const TrackerTopology ttopo,
const MagneticField field,
bool  scaleErrorsForBPix1,
float  scaleFactor 
)
explicit
PixelFitterByHelixProjections::~PixelFitterByHelixProjections ( )
inlineoverride

Definition at line 20 of file PixelFitterByHelixProjections.h.

20 {}

Member Function Documentation

std::unique_ptr< reco::Track > PixelFitterByHelixProjections::run ( const std::vector< const TrackingRecHit * > &  hits,
const TrackingRegion region 
) const
overridevirtual

Implements PixelFitterBase.

Definition at line 96 of file PixelFitterByHelixProjections.cc.

References PV3DBase< T, PVType, FrameType >::barePhi(), PV3DBase< T, PVType, FrameType >::basicVector(), PixelTrackBuilder::build(), CircleFromThreePoints::center(), RecoTauCleanerPlugins::charge, RZLine::chi2(), HLT_FULL_cff::chi2, funct::cos(), PixelRecoUtilities::curvature(), CircleFromThreePoints::curvature(), declareDynArray, alignCSCRings::e, PixelTrackErrorParam::errCot(), PixelTrackErrorParam::errPhi(), PixelTrackErrorParam::errPt(), PixelTrackErrorParam::errTip(), PixelTrackErrorParam::errZip(), validate-o2o-wbm::f, mps_fire::i, MagneticField::inverseBzAtOriginInGeV(), PixelRecoUtilities::inversePt(), PixelPluginsPhase0_cfi::isBarrel, LIKELY, Basic2DVector< T >::mag(), nhits, TrackingRegion::origin(), phi, PixelSubdetector::PixelBarrel, DiDispStaMuonMonitor_cfi::pt, TrackerTopology::pxbLayer(), runTheMatrix::ret, funct::sin(), theField, thescaleErrorsForBPix1, thescaleFactor, theTopo, HLT_FULL_cff::tip, Basic2DVector< T >::x(), Basic2DVector< T >::y(), and ComparisonHelper::zip().

97  {
98  std::unique_ptr<reco::Track> ret;
99 
100  int nhits = hits.size();
101  if (nhits < 2)
102  return ret;
103 
104  declareDynArray(GlobalPoint, nhits, points);
105  declareDynArray(GlobalError, nhits, errors);
106  declareDynArray(bool, nhits, isBarrel);
107 
108  for (int i = 0; i != nhits; ++i) {
109  auto const& recHit = hits[i];
110  points[i] = GlobalPoint(recHit->globalPosition().basicVector() - region.origin().basicVector());
111  errors[i] = recHit->globalPositionError();
112  isBarrel[i] = recHit->detUnit()->type().isBarrel();
113  }
114 
115  CircleFromThreePoints circle = (nhits == 2) ? CircleFromThreePoints(GlobalPoint(0., 0., 0.), points[0], points[1])
116  : CircleFromThreePoints(points[0], points[1], points[2]);
117 
118  float valPhi, valTip, valPt;
119 
120  int iCharge = charge(points);
121  float curvature = circle.curvature();
122 
123  if ((curvature > 1.e-4) && (LIKELY(theField->inverseBzAtOriginInGeV()) > 0.01)) {
124  float invPt = PixelRecoUtilities::inversePt(circle.curvature(), *theField);
125  valPt = (invPt > 1.e-4f) ? 1.f / invPt : 1.e4f;
126  CircleFromThreePoints::Vector2D center = circle.center();
127  valTip = iCharge * (center.mag() - 1.f / curvature);
128  valPhi = phi(center.x(), center.y(), iCharge);
129  } else {
130  valPt = 1.e4f;
131  GlobalVector direction(points[1] - points[0]);
132  valPhi = direction.barePhi();
133  valTip = -points[0].x() * sin(valPhi) + points[0].y() * cos(valPhi);
134  }
135 
136  float valCotTheta = cotTheta(points[0], points[1]);
137  float valEta = std::asinh(valCotTheta);
138  float valZip = zip(valTip, valPhi, curvature, points[0], points[1]);
139 
140  // Rescale down the error to take into accont the fact that the
141  // inner pixel barrel layer for PhaseI is closer to the interaction
142  // point. The effective scale factor has been derived by checking
143  // that the pulls of the pixelVertices derived from the pixelTracks
144  // have the correct mean and sigma.
145  float errFactor = 1.;
146  if (thescaleErrorsForBPix1 && (hits[0]->geographicalId().subdetId() == PixelSubdetector::PixelBarrel) &&
147  (theTopo->pxbLayer(hits[0]->geographicalId()) == 1))
148  errFactor = thescaleFactor;
149 
150  PixelTrackErrorParam param(valEta, valPt);
151  float errValPt = errFactor * param.errPt();
152  float errValCot = errFactor * param.errCot();
153  float errValTip = errFactor * param.errTip();
154  float errValPhi = errFactor * param.errPhi();
155  float errValZip = errFactor * param.errZip();
156 
157  float chi2 = 0;
158  if (nhits > 2) {
159  RZLine rzLine(points, errors, isBarrel);
160  chi2 = rzLine.chi2();
161  }
162 
163  PixelTrackBuilder builder;
164  Measurement1D pt(valPt, errValPt);
165  Measurement1D phi(valPhi, errValPhi);
166  Measurement1D cotTheta(valCotTheta, errValCot);
167  Measurement1D tip(valTip, errValTip);
168  Measurement1D zip(valZip, errValZip);
169 
170  ret.reset(builder.build(pt, phi, cotTheta, tip, zip, chi2, iCharge, hits, theField, region.origin()));
171  return ret;
172 }
tuple ret
prodAgent to be discontinued
GlobalPoint const & origin() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
#define LIKELY(x)
Definition: Likely.h:20
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T curvature(T InversePt, const MagneticField &field)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
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
float inverseBzAtOriginInGeV() const
The inverse of field z component for this map in GeV.
Definition: MagneticField.h:52
T inversePt(T curvature, const MagneticField &field)
T y() const
Cartesian y coordinate.
Definition: RZLine.h:12
unsigned int pxbLayer(const DetId &id) const
#define declareDynArray(T, n, x)
Definition: DynArray.h:91
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
T x() const
Cartesian x coordinate.

Member Data Documentation

const MagneticField* PixelFitterByHelixProjections::theField
private

Definition at line 26 of file PixelFitterByHelixProjections.h.

Referenced by run().

const bool PixelFitterByHelixProjections::thescaleErrorsForBPix1
private

Definition at line 27 of file PixelFitterByHelixProjections.h.

Referenced by run().

const float PixelFitterByHelixProjections::thescaleFactor
private

Definition at line 28 of file PixelFitterByHelixProjections.h.

Referenced by run().

const TrackerTopology* PixelFitterByHelixProjections::theTopo
private

Definition at line 25 of file PixelFitterByHelixProjections.h.

Referenced by run().