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::KFBasedPixelFitter ( const Propagator propagator,
const Propagator opropagator,
const TransientTrackingRecHitBuilder ttrhBuilder,
const TrackerGeometry tracker,
const MagneticField field,
const reco::BeamSpot beamSpot 
)

Definition at line 55 of file KFBasedPixelFitter.cc.

62  theOPropagator(opropagator),
63  theTTRHBuilder(ttrhBuilder),
65  theField(field),

◆ ~KFBasedPixelFitter()

KFBasedPixelFitter::~KFBasedPixelFitter ( )
inlineoverride

Definition at line 33 of file KFBasedPixelFitter.h.

33 {}

Member Function Documentation

◆ run()

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 68 of file KFBasedPixelFitter.cc.

70  {
71  std::unique_ptr<reco::Track> ret;
72 
73  int nhits = hits.size();
74  if (nhits < 2)
75  return ret;
76 
77  float ptMin = region.ptMin();
78 
79  const GlobalPoint &vertexPos = region.origin();
80  GlobalError vertexErr(sqr(region.originRBound()), 0, sqr(region.originRBound()), 0, 0, sqr(region.originZBound()));
81 
82  std::vector<GlobalPoint> points(nhits);
83  points[0] = theTracker->idToDet(hits[0]->geographicalId())->toGlobal(hits[0]->localPosition());
84  points[1] = theTracker->idToDet(hits[1]->geographicalId())->toGlobal(hits[1]->localPosition());
85  points[2] = theTracker->idToDet(hits[2]->geographicalId())->toGlobal(hits[2]->localPosition());
86 
87  //
88  //initial Kinematics
89  //
90  GlobalVector initMom;
91  int charge;
92  float theta;
93  CircleFromThreePoints circle(points[0], points[1], points[2]);
94  if (circle.curvature() > 1.e-4) {
95  float invPt = PixelRecoUtilities::inversePt(circle.curvature(), setup);
96  float valPt = 1.f / invPt;
97  float chargeTmp = (points[1].x() - points[0].x()) * (points[2].y() - points[1].y()) -
98  (points[1].y() - points[0].y()) * (points[2].x() - points[1].x());
99  charge = (chargeTmp > 0) ? -1 : 1;
100  float valPhi = (charge > 0) ? std::atan2(circle.center().x(), -circle.center().y())
101  : std::atan2(-circle.center().x(), circle.center().y());
102  theta = GlobalVector(points[1] - points[0]).theta();
103  initMom = GlobalVector(valPt * cos(valPhi), valPt * sin(valPhi), valPt / tan(theta));
104  } else {
105  initMom = GlobalVector(points[1] - points[0]);
106  initMom *= 10000. / initMom.perp();
107  charge = 1;
108  theta = initMom.theta();
109  }
110  GlobalTrajectoryParameters initialKine(vertexPos, initMom, TrackCharge(charge), theField);
111 
112  //
113  // initial error
114  //
115  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
116  float sin2th = sqr(sin(theta));
117  float minC00 = 1.0;
118  C[0][0] = std::max(sin2th / sqr(ptMin), minC00);
119  float zErr = vertexErr.czz();
120  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
121  C[3][3] = transverseErr;
122  C[4][4] = zErr * sin2th + transverseErr * (1 - sin2th);
123  CurvilinearTrajectoryError initialError(C);
124 
125  FreeTrajectoryState fts(initialKine, initialError);
126 
127  // get updator
129 
130  // Now update initial state track using information from hits.
131  TrajectoryStateOnSurface outerState;
132  DetId outerDetId = 0;
133  const TrackingRecHit *hit = nullptr;
134  for (unsigned int iHit = 0; iHit < hits.size(); iHit++) {
135  hit = hits[iHit];
136  if (iHit == 0)
137  outerState = thePropagator->propagate(fts, theTracker->idToDet(hit->geographicalId())->surface());
138  outerDetId = hit->geographicalId();
140  if (!state.isValid())
141  return ret;
142  // TransientTrackingRecHit::RecHitPointer recHit = (theTTRHBuilder->build(hit))->clone(state);
144  outerState = updator.update(state, *recHit);
145  if (!outerState.isValid())
146  return ret;
147  }
148 
149  TrajectoryStateOnSurface innerState = outerState;
150  DetId innerDetId = 0;
151  innerState.rescaleError(100000.);
152  for (int iHit = 2; iHit >= 0; --iHit) {
153  hit = hits[iHit];
154  innerDetId = hit->geographicalId();
156  if (!state.isValid())
157  return ret;
158  // TransientTrackingRecHit::RecHitPointer recHit = (theTTRHBuilder->build(hit))->clone(state);
160  innerState = updator.update(state, *recHit);
161  if (!innerState.isValid())
162  return ret;
163  }
164 
165  // extrapolate to vertex
166  auto impactPointState = TransverseImpactPointExtrapolator(theField).extrapolate(innerState, vertexPos);
167  if (!impactPointState.isValid())
168  return ret;
169 
170  //
171  // optionally update impact point state with Bs constraint
172  // using this potion makes sense if vertexPos (from TrackingRegion is centerewd at BeamSpot).
173  //
174  if (theBeamSpot) {
175  MyBeamSpotGeomDet bsgd(Plane::build(impactPointState.surface().position(), impactPointState.surface().rotation()));
176  MyBeamSpotHit bsrh(*theBeamSpot, &bsgd);
177  impactPointState = updator.update(impactPointState, bsrh); //update
178  impactPointState =
179  TransverseImpactPointExtrapolator(theField).extrapolate(impactPointState, vertexPos); //reextrapolate
180  if (!impactPointState.isValid())
181  return ret;
182  }
183 
184  int ndof = 2 * hits.size() - 5;
185  GlobalPoint vv = impactPointState.globalPosition();
186  math::XYZPoint pos(vv.x(), vv.y(), vv.z());
187  GlobalVector pp = impactPointState.globalMomentum();
188  math::XYZVector mom(pp.x(), pp.y(), pp.z());
189 
190  float chi2 = 0.;
191  ret = std::make_unique<reco::Track>(
192  chi2, ndof, pos, mom, impactPointState.charge(), impactPointState.curvilinearError());
193 
194  /*
195  vv = outerState.globalPosition();
196  pp = outerState.globalMomentum();
197  math::XYZPoint outerPosition( vv.x(), vv.y(), vv.z());
198  math::XYZVector outerMomentum( pp.x(), pp.y(), pp.z());
199  vv = innerState.globalPosition();
200  pp = innerState.globalMomentum();
201  math::XYZPoint innerPosition( vv.x(), vv.y(), vv.z());
202  math::XYZVector innerMomentum( pp.x(), pp.y(), pp.z());
203 
204  reco::TrackExtra extra( outerPosition, outerMomentum, true,
205  innerPosition, innerMomentum, true,
206  outerState.curvilinearError(), outerDetId,
207  innerState.curvilinearError(), innerDetId,
208  anyDirection);
209 */
210 
211  // std::cout <<"TRACK CREATED" << std::endl;
212  return ret;
213 }

References TransientTrackingRecHitBuilder::build(), Plane::build(), gen::C, CircleFromThreePoints::center(), ALCARECOTkAlJpsiMuMu_cff::charge, hltPixelTracks_cff::chi2, funct::cos(), CircleFromThreePoints::curvature(), GlobalErrorBase< T, ErrorWeightType >::cxx(), GlobalErrorBase< T, ErrorWeightType >::czz(), TransverseImpactPointExtrapolator::extrapolate(), hfClusterShapes_cfi::hits, TrackerGeometry::idToDet(), PixelRecoUtilities::inversePt(), TrajectoryStateOnSurface::isValid(), SiStripPI::max, ndof, nhits, PV3DBase< T, PVType, FrameType >::perp(), HLT_FULL_cff::points, createTree::pp, Propagator::propagate(), ptMin, rpcPointValidation_cfi::recHit, HLT_FULL_cff::region, TrajectoryStateOnSurface::rescaleError(), runTheMatrix::ret, singleTopDQM_cfi::setup, funct::sin(), sqr(), GeomDet::surface(), funct::tan(), theBeamSpot, theField, theOPropagator, thePropagator, PV3DBase< T, PVType, FrameType >::theta(), theta(), theTracker, theTTRHBuilder, GeomDet::toGlobal(), HLT_FULL_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().

Member Data Documentation

◆ theBeamSpot

const reco::BeamSpot* KFBasedPixelFitter::theBeamSpot
private

Definition at line 73 of file KFBasedPixelFitter.h.

Referenced by run().

◆ theField

const MagneticField* KFBasedPixelFitter::theField
private

Definition at line 72 of file KFBasedPixelFitter.h.

Referenced by run().

◆ theOPropagator

const Propagator* KFBasedPixelFitter::theOPropagator
private

Definition at line 69 of file KFBasedPixelFitter.h.

Referenced by run().

◆ thePropagator

const Propagator* KFBasedPixelFitter::thePropagator
private

Definition at line 68 of file KFBasedPixelFitter.h.

Referenced by run().

◆ theTracker

const TrackerGeometry* KFBasedPixelFitter::theTracker
private

Definition at line 71 of file KFBasedPixelFitter.h.

Referenced by run().

◆ theTTRHBuilder

const TransientTrackingRecHitBuilder* KFBasedPixelFitter::theTTRHBuilder
private

Definition at line 70 of file KFBasedPixelFitter.h.

Referenced by run().

Vector3DBase
Definition: Vector3DBase.h:8
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
DDAxes::y
CircleFromThreePoints
Definition: CircleFromThreePoints.h:18
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
TrackCharge
int TrackCharge
Definition: TrackCharge.h:4
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21469
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
PV3DBase::theta
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
pos
Definition: PixelAliasList.h:18
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
PixelRecoUtilities::inversePt
T inversePt(T curvature, const edm::EventSetup &iSetup)
Definition: PixelRecoUtilities.h:48
KFBasedPixelFitter::theOPropagator
const Propagator * theOPropagator
Definition: KFBasedPixelFitter.h:69
DDAxes::x
TransverseImpactPointExtrapolator
Definition: TransverseImpactPointExtrapolator.h:26
TrackingRecHit::RecHitPointer
std::shared_ptr< TrackingRecHit const > RecHitPointer
Definition: TrackingRecHit.h:24
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
TransientTrackingRecHitBuilder::build
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
ndof
Definition: HIMultiTrackSelector.h:49
DetId
Definition: DetId.h:17
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
KFBasedPixelFitter::theBeamSpot
const reco::BeamSpot * theBeamSpot
Definition: KFBasedPixelFitter.h:73
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
CurvilinearTrajectoryError
Definition: CurvilinearTrajectoryError.h:27
TrackCandidateProducer_cfi.propagator
propagator
Definition: TrackCandidateProducer_cfi.py:17
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
GlobalTrajectoryParameters
Definition: GlobalTrajectoryParameters.h:15
sqr
T sqr(T t)
Definition: KFBasedPixelFitter.cc:27
Point3DBase< float, GlobalTag >
nhits
Definition: HIMultiTrackSelector.h:42
Plane::build
static PlanePointer build(Args &&... args)
Definition: Plane.h:33
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
HLT_FULL_cff.updator
updator
Definition: HLT_FULL_cff.py:123
KFBasedPixelFitter::theTTRHBuilder
const TransientTrackingRecHitBuilder * theTTRHBuilder
Definition: KFBasedPixelFitter.h:70
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
KFBasedPixelFitter::theField
const MagneticField * theField
Definition: KFBasedPixelFitter.h:72
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
GlobalErrorBase< double, ErrorMatrixTag >
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
TrajectoryStateOnSurface::rescaleError
void rescaleError(double factor)
Definition: TrajectoryStateOnSurface.h:82
TrackingRecHit
Definition: TrackingRecHit.h:21
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
FreeTrajectoryState
Definition: FreeTrajectoryState.h:27
gen::C
C
Definition: PomwigHadronizer.cc:78
TransverseImpactPointExtrapolator::extrapolate
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const GlobalPoint &vtx) const
extrapolation with default (=geometrical) propagator
Definition: TransverseImpactPointExtrapolator.cc:23
createTree.pp
pp
Definition: createTree.py:17
KFBasedPixelFitter::thePropagator
const Propagator * thePropagator
Definition: KFBasedPixelFitter.h:68
AlgebraicSymMatrix55
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
Definition: AlgebraicROOTObjects.h:23
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
KFUpdator
Definition: KFUpdator.h:32
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54
hit
Definition: SiStripHitEffFromCalibTree.cc:88
KFBasedPixelFitter::theTracker
const TrackerGeometry * theTracker
Definition: KFBasedPixelFitter.h:71