CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
KFBasedPixelFitter Class Reference

#include <KFBasedPixelFitter.h>

Inheritance diagram for KFBasedPixelFitter:
PixelFitterBase

Classes

class  MyBeamSpotGeomDet
 
class  MyBeamSpotHit
 

Public Member Functions

 KFBasedPixelFitter (const Propagator *propagator, const Propagator *opropagator, const TransientTrackingRecHitBuilder *ttrhBuilder, const TrackerGeometry *tracker, const MagneticField *field, const reco::BeamSpot *beamSpot)
 
std::unique_ptr< reco::Trackrun (const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region, const edm::EventSetup &setup) const override
 
 ~KFBasedPixelFitter () override
 
- Public Member Functions inherited from PixelFitterBase
virtual ~PixelFitterBase ()
 

Private Attributes

const reco::BeamSpottheBeamSpot
 
const MagneticFieldtheField
 
const PropagatortheOPropagator
 
const PropagatorthePropagator
 
const TrackerGeometrytheTracker
 
const TransientTrackingRecHitBuildertheTTRHBuilder
 

Detailed Description

Definition at line 25 of file KFBasedPixelFitter.h.

Constructor & Destructor Documentation

KFBasedPixelFitter::KFBasedPixelFitter ( const Propagator propagator,
const Propagator opropagator,
const TransientTrackingRecHitBuilder ttrhBuilder,
const TrackerGeometry tracker,
const MagneticField field,
const reco::BeamSpot beamSpot 
)

Definition at line 75 of file KFBasedPixelFitter.cc.

81  : thePropagator(propagator),
82  theOPropagator(opropagator),
83  theTTRHBuilder(ttrhBuilder),
84  theTracker(tracker),
85  theField(field),
86  theBeamSpot(beamSpot) {}
const Propagator * theOPropagator
const Propagator * thePropagator
const TrackerGeometry * theTracker
const MagneticField * theField
const reco::BeamSpot * theBeamSpot
const TransientTrackingRecHitBuilder * theTTRHBuilder
KFBasedPixelFitter::~KFBasedPixelFitter ( )
inlineoverride

Member Function Documentation

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

Implements PixelFitterBase.

Definition at line 88 of file KFBasedPixelFitter.cc.

References TransientTrackingRecHitBuilder::build(), Plane::build(), gen::C, CircleFromThreePoints::center(), ALCARECOTkAlJpsiMuMu_cff::charge, TrajectoryStateOnSurface::charge(), hltPixelTracks_cff::chi2, funct::cos(), CircleFromThreePoints::curvature(), TrajectoryStateOnSurface::curvilinearError(), GlobalErrorBase< T, ErrorWeightType >::cxx(), GlobalErrorBase< T, ErrorWeightType >::czz(), TransverseImpactPointExtrapolator::extrapolate(), TrackingRecHit::geographicalId(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrackerGeometry::idToDet(), PixelRecoUtilities::inversePt(), TrajectoryStateOnSurface::isValid(), SiStripPI::max, ndof, nhits, TrackingRegion::origin(), TrackingRegion::originRBound(), TrackingRegion::originZBound(), PV3DBase< T, PVType, FrameType >::perp(), HLT_2018_cff::points, GloballyPositioned< T >::position(), createTree::pp, Propagator::propagate(), TrackingRegion::ptMin(), ptMin, rpcPointValidation_cfi::recHit, TrajectoryStateOnSurface::rescaleError(), runTheMatrix::ret, GloballyPositioned< T >::rotation(), singleTopDQM_cfi::setup, funct::sin(), sqr(), GeomDet::surface(), TrajectoryStateOnSurface::surface(), funct::tan(), theBeamSpot, theField, theOPropagator, thePropagator, PV3DBase< T, PVType, FrameType >::theta(), theta(), theTracker, theTTRHBuilder, GeomDet::toGlobal(), KFUpdator::update(), HLT_2018_cff::updator, x, PV3DBase< T, PVType, FrameType >::x(), Basic2DVector< T >::x(), y, PV3DBase< T, PVType, FrameType >::y(), Basic2DVector< T >::y(), and PV3DBase< T, PVType, FrameType >::z().

90  {
91  std::unique_ptr<reco::Track> ret;
92 
93  int nhits = hits.size();
94  if (nhits < 2)
95  return ret;
96 
97  float ptMin = region.ptMin();
98 
99  const GlobalPoint &vertexPos = region.origin();
100  GlobalError vertexErr(sqr(region.originRBound()), 0, sqr(region.originRBound()), 0, 0, sqr(region.originZBound()));
101 
102  std::vector<GlobalPoint> points(nhits);
103  points[0] = theTracker->idToDet(hits[0]->geographicalId())->toGlobal(hits[0]->localPosition());
104  points[1] = theTracker->idToDet(hits[1]->geographicalId())->toGlobal(hits[1]->localPosition());
105  points[2] = theTracker->idToDet(hits[2]->geographicalId())->toGlobal(hits[2]->localPosition());
106 
107  //
108  //initial Kinematics
109  //
110  GlobalVector initMom;
111  int charge;
112  float theta;
113  CircleFromThreePoints circle(points[0], points[1], points[2]);
114  if (circle.curvature() > 1.e-4) {
115  float invPt = PixelRecoUtilities::inversePt(circle.curvature(), setup);
116  float valPt = 1.f / invPt;
117  float chargeTmp = (points[1].x() - points[0].x()) * (points[2].y() - points[1].y()) -
118  (points[1].y() - points[0].y()) * (points[2].x() - points[1].x());
119  charge = (chargeTmp > 0) ? -1 : 1;
120  float valPhi = (charge > 0) ? std::atan2(circle.center().x(), -circle.center().y())
121  : std::atan2(-circle.center().x(), circle.center().y());
122  theta = GlobalVector(points[1] - points[0]).theta();
123  initMom = GlobalVector(valPt * cos(valPhi), valPt * sin(valPhi), valPt / tan(theta));
124  } else {
125  initMom = GlobalVector(points[1] - points[0]);
126  initMom *= 10000. / initMom.perp();
127  charge = 1;
128  theta = initMom.theta();
129  }
130  GlobalTrajectoryParameters initialKine(vertexPos, initMom, TrackCharge(charge), theField);
131 
132  //
133  // initial error
134  //
135  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
136  float sin2th = sqr(sin(theta));
137  float minC00 = 1.0;
138  C[0][0] = std::max(sin2th / sqr(ptMin), minC00);
139  float zErr = vertexErr.czz();
140  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
141  C[3][3] = transverseErr;
142  C[4][4] = zErr * sin2th + transverseErr * (1 - sin2th);
143  CurvilinearTrajectoryError initialError(C);
144 
145  FreeTrajectoryState fts(initialKine, initialError);
146 
147  // get updator
149 
150  // Now update initial state track using information from hits.
151  TrajectoryStateOnSurface outerState;
152  DetId outerDetId = 0;
153  const TrackingRecHit *hit = nullptr;
154  for (unsigned int iHit = 0; iHit < hits.size(); iHit++) {
155  hit = hits[iHit];
156  if (iHit == 0)
157  outerState = thePropagator->propagate(fts, theTracker->idToDet(hit->geographicalId())->surface());
158  outerDetId = hit->geographicalId();
159  TrajectoryStateOnSurface state = thePropagator->propagate(outerState, theTracker->idToDet(outerDetId)->surface());
160  if (!state.isValid())
161  return ret;
162  // TransientTrackingRecHit::RecHitPointer recHit = (theTTRHBuilder->build(hit))->clone(state);
164  outerState = updator.update(state, *recHit);
165  if (!outerState.isValid())
166  return ret;
167  }
168 
169  TrajectoryStateOnSurface innerState = outerState;
170  DetId innerDetId = 0;
171  innerState.rescaleError(100000.);
172  for (int iHit = 2; iHit >= 0; --iHit) {
173  hit = hits[iHit];
174  innerDetId = hit->geographicalId();
175  TrajectoryStateOnSurface state = theOPropagator->propagate(innerState, theTracker->idToDet(innerDetId)->surface());
176  if (!state.isValid())
177  return ret;
178  // TransientTrackingRecHit::RecHitPointer recHit = (theTTRHBuilder->build(hit))->clone(state);
180  innerState = updator.update(state, *recHit);
181  if (!innerState.isValid())
182  return ret;
183  }
184 
185  // extrapolate to vertex
186  TrajectoryStateOnSurface impactPointState =
188  if (!impactPointState.isValid())
189  return ret;
190 
191  //
192  // optionally update impact point state with Bs constraint
193  // using this potion makes sense if vertexPos (from TrackingRegion is centerewd at BeamSpot).
194  //
195  if (theBeamSpot) {
196  MyBeamSpotGeomDet bsgd(Plane::build(impactPointState.surface().position(), impactPointState.surface().rotation()));
197  MyBeamSpotHit bsrh(*theBeamSpot, &bsgd);
198  impactPointState = updator.update(impactPointState, bsrh); //update
199  impactPointState =
200  TransverseImpactPointExtrapolator(theField).extrapolate(impactPointState, vertexPos); //reextrapolate
201  if (!impactPointState.isValid())
202  return ret;
203  }
204 
205  int ndof = 2 * hits.size() - 5;
206  GlobalPoint vv = impactPointState.globalPosition();
207  math::XYZPoint pos(vv.x(), vv.y(), vv.z());
208  GlobalVector pp = impactPointState.globalMomentum();
209  math::XYZVector mom(pp.x(), pp.y(), pp.z());
210 
211  float chi2 = 0.;
212  ret = std::make_unique<reco::Track>(
213  chi2, ndof, pos, mom, impactPointState.charge(), impactPointState.curvilinearError());
214 
215  /*
216  vv = outerState.globalPosition();
217  pp = outerState.globalMomentum();
218  math::XYZPoint outerPosition( vv.x(), vv.y(), vv.z());
219  math::XYZVector outerMomentum( pp.x(), pp.y(), pp.z());
220  vv = innerState.globalPosition();
221  pp = innerState.globalMomentum();
222  math::XYZPoint innerPosition( vv.x(), vv.y(), vv.z());
223  math::XYZVector innerMomentum( pp.x(), pp.y(), pp.z());
224 
225  reco::TrackExtra extra( outerPosition, outerMomentum, true,
226  innerPosition, innerMomentum, true,
227  outerState.curvilinearError(), outerDetId,
228  innerState.curvilinearError(), innerDetId,
229  anyDirection);
230 */
231 
232  // std::cout <<"TRACK CREATED" << std::endl;
233  return ret;
234 }
float originRBound() const
bounds the particle vertex in the transverse plane
const Propagator * theOPropagator
const Propagator * thePropagator
T perp() const
Definition: PV3DBase.h:69
GlobalPoint const & origin() const
ret
prodAgent to be discontinued
const TrackerGeometry * theTracker
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
const CurvilinearTrajectoryError & curvilinearError() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
const MagneticField * theField
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
T inversePt(T curvature, const edm::EventSetup &iSetup)
int TrackCharge
Definition: TrackCharge.h:4
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const override
Definition: KFUpdator.cc:177
const SurfaceType & surface() const
T sqr(T t)
static PlanePointer build(Args &&...args)
Definition: Plane.h:33
T z() const
Definition: PV3DBase.h:61
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
float originZBound() const
bounds the particle vertex in the longitudinal plane
std::shared_ptr< TrackingRecHit const > RecHitPointer
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
const reco::BeamSpot * theBeamSpot
const TransientTrackingRecHitBuilder * theTTRHBuilder
Definition: DetId.h:17
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
float ptMin() const
minimal pt of interest
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
GlobalVector globalMomentum() const
const TrackerGeomDet * idToDet(DetId) const override
const RotationType & rotation() const
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:59
const PositionType & position() const
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

const reco::BeamSpot* KFBasedPixelFitter::theBeamSpot
private

Definition at line 73 of file KFBasedPixelFitter.h.

Referenced by run().

const MagneticField* KFBasedPixelFitter::theField
private

Definition at line 72 of file KFBasedPixelFitter.h.

Referenced by run().

const Propagator* KFBasedPixelFitter::theOPropagator
private

Definition at line 69 of file KFBasedPixelFitter.h.

Referenced by run().

const Propagator* KFBasedPixelFitter::thePropagator
private

Definition at line 68 of file KFBasedPixelFitter.h.

Referenced by run().

const TrackerGeometry* KFBasedPixelFitter::theTracker
private

Definition at line 71 of file KFBasedPixelFitter.h.

Referenced by run().

const TransientTrackingRecHitBuilder* KFBasedPixelFitter::theTTRHBuilder
private

Definition at line 70 of file KFBasedPixelFitter.h.

Referenced by run().