#include <KFBasedPixelFitter.h>
Classes | |
class | MyBeamSpotGeomDet |
class | MyBeamSpotHit |
Public Member Functions | |
KFBasedPixelFitter (const edm::ParameterSet &cfg) | |
virtual reco::Track * | run (const edm::Event &ev, const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion ®ion) const |
virtual | ~KFBasedPixelFitter () |
Public Attributes | |
tuple | KFBasedPixelFitter |
Private Attributes | |
edm::InputTag | theBeamSpot |
std::string | thePropagatorLabel |
std::string | thePropagatorOppositeLabel |
std::string | theTTRHBuilderName |
bool | theUseBeamSpot |
Definition at line 20 of file KFBasedPixelFitter.h.
KFBasedPixelFitter::KFBasedPixelFitter | ( | const edm::ParameterSet & | cfg | ) |
virtual KFBasedPixelFitter::~KFBasedPixelFitter | ( | ) | [inline, virtual] |
Definition at line 23 of file KFBasedPixelFitter.h.
{}
reco::Track * KFBasedPixelFitter::run | ( | const edm::Event & | ev, |
const edm::EventSetup & | es, | ||
const std::vector< const TrackingRecHit * > & | hits, | ||
const TrackingRegion & | region | ||
) | const [virtual] |
Reimplemented from PixelFitter.
Definition at line 95 of file KFBasedPixelFitter.cc.
References SiPixelRawToDigiRegional_cfi::beamSpot, BoundPlane::build(), funct::C, CircleFromThreePoints::center(), TrajectoryStateOnSurface::charge(), DeDxDiscriminatorTools::charge(), funct::cos(), CircleFromThreePoints::curvature(), TrajectoryStateOnSurface::curvilinearError(), GlobalErrorBase< T, ErrorWeightType >::cxx(), GlobalErrorBase< T, ErrorWeightType >::czz(), TransverseImpactPointExtrapolator::extrapolate(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), edm::Event::getByLabel(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), PixelRecoUtilities::inversePt(), TrajectoryStateOnSurface::isValid(), max(), TrackingRegion::origin(), TrackingRegion::originRBound(), TrackingRegion::originZBound(), PV3DBase< T, PVType, FrameType >::perp(), pos, GloballyPositioned< T >::position(), createTree::pp, LargeD0_PixelPairStep_cff::propagator, PtMinSelector_cfg::ptMin, TrackingRegion::ptMin(), TrajectoryStateOnSurface::rescaleError(), GloballyPositioned< T >::rotation(), funct::sin(), funct::sqr(), TrajectoryStateOnSurface::surface(), funct::tan(), thePropagatorLabel, thePropagatorOppositeLabel, theta(), PV3DBase< T, PVType, FrameType >::theta(), theTTRHBuilderName, theUseBeamSpot, patCandidatesForDimuonsSequences_cff::tracker, KFUpdator::update(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().
{ int nhits = hits.size(); if (nhits <2) return 0; edm::ESHandle<TrackerGeometry> tracker; es.get<TrackerDigiGeometryRecord>().get(tracker); edm::ESHandle<MagneticField> field; es.get<IdealMagneticFieldRecord>().get(field); edm::ESHandle<TransientTrackingRecHitBuilder> ttrhb; es.get<TransientRecHitRecord>().get( theTTRHBuilderName, ttrhb); float ptMin = region.ptMin(); const GlobalPoint vertexPos = region.origin(); GlobalError vertexErr( sqr(region.originRBound()), 0, sqr(region.originRBound()), 0, 0, sqr(region.originZBound())); std::vector<GlobalPoint> points(nhits); points[0] = tracker->idToDet(hits[0]->geographicalId())->toGlobal(hits[0]->localPosition()); points[1] = tracker->idToDet(hits[1]->geographicalId())->toGlobal(hits[1]->localPosition()); points[2] = tracker->idToDet(hits[2]->geographicalId())->toGlobal(hits[2]->localPosition()); // //initial Kinematics // GlobalVector initMom; int charge; float theta; CircleFromThreePoints circle(points[0], points[1], points[2]); if (circle.curvature() > 1.e-4) { float invPt = PixelRecoUtilities::inversePt( circle.curvature(), es); float valPt = 1.f/invPt; float chargeTmp = (points[1].x()-points[0].x())*(points[2].y()-points[1].y()) - (points[1].y()-points[0].y())*(points[2].x()-points[1].x()); int charge = (chargeTmp>0) ? -1 : 1; float valPhi = (charge>0) ? std::atan2(circle.center().x(),-circle.center().y()) : std::atan2(-circle.center().x(),circle.center().y()); theta = GlobalVector(points[1]-points[0]).theta(); initMom = GlobalVector(valPt*cos(valPhi), valPt*sin(valPhi), valPt/tan(theta)); } else { initMom = GlobalVector(points[1]-points[0]); initMom *= 10000./initMom.perp(); charge = 1; theta = initMom.theta(); } GlobalTrajectoryParameters initialKine(vertexPos, initMom, TrackCharge(charge), &*field); // // initial error // AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity(); float sin2th = sqr(sin(theta)); float minC00 = 1.0; C[0][0] = std::max(sin2th/sqr(ptMin), minC00); float zErr = vertexErr.czz(); float transverseErr = vertexErr.cxx(); // assume equal cxx cyy C[3][3] = transverseErr; C[4][4] = zErr*sin2th + transverseErr*(1-sin2th); CurvilinearTrajectoryError initialError(C); FreeTrajectoryState fts(initialKine, initialError); // get propagator edm::ESHandle<Propagator> propagator; es.get<TrackingComponentsRecord>().get(thePropagatorLabel, propagator); // get updator KFUpdator updator; // Now update initial state track using information from hits. TrajectoryStateOnSurface outerState; DetId outerDetId = 0; const TrackingRecHit* hit = 0; for ( unsigned int iHit = 0; iHit < hits.size(); iHit++) { hit = hits[iHit]; if (iHit==0) outerState = propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface()); outerDetId = hit->geographicalId(); TrajectoryStateOnSurface state = propagator->propagate(outerState, tracker->idToDet(outerDetId)->surface()); if (!state.isValid()) return 0; // TransientTrackingRecHit::RecHitPointer recHit = (ttrhb->build(hit))->clone(state); TransientTrackingRecHit::RecHitPointer recHit = ttrhb->build(hit); outerState = updator.update(state, *recHit); if (!outerState.isValid()) return 0; } // get propagator edm::ESHandle<Propagator> opropagator; es.get<TrackingComponentsRecord>().get(thePropagatorOppositeLabel, opropagator); TrajectoryStateOnSurface innerState = outerState; DetId innerDetId = 0; innerState.rescaleError(100000.); for ( int iHit = 2; iHit >= 0; --iHit) { hit = hits[iHit]; innerDetId = hit->geographicalId(); TrajectoryStateOnSurface state = opropagator->propagate(innerState, tracker->idToDet(innerDetId)->surface()); if (!state.isValid()) return 0; // TransientTrackingRecHit::RecHitPointer recHit = (ttrhb->build(hit))->clone(state); TransientTrackingRecHit::RecHitPointer recHit = ttrhb->build(hit); innerState = updator.update(state, *recHit); if (!innerState.isValid()) return 0; } // extrapolate to vertex TrajectoryStateOnSurface impactPointState = TransverseImpactPointExtrapolator(&*field).extrapolate( innerState, vertexPos); if (!impactPointState.isValid()) return 0; // // optionally update impact point state with Bs constraint // using this potion makes sense if vertexPos (from TrackingRegion is centerewd at BeamSpot). // if (theUseBeamSpot) { edm::Handle<reco::BeamSpot> beamSpot; ev.getByLabel( "offlineBeamSpot", beamSpot); MyBeamSpotGeomDet bsgd(BoundPlane::build(impactPointState.surface().position(), impactPointState.surface().rotation(),OpenBounds())); MyBeamSpotHit bsrh(*beamSpot, &bsgd); impactPointState = updator.update(impactPointState, bsrh); //update impactPointState = TransverseImpactPointExtrapolator(&*field).extrapolate( impactPointState, vertexPos); //reextrapolate if (!impactPointState.isValid()) return 0; } int ndof = 2*hits.size()-5; GlobalPoint vv = impactPointState.globalPosition(); math::XYZPoint pos( vv.x(), vv.y(), vv.z() ); GlobalVector pp = impactPointState.globalMomentum(); math::XYZVector mom( pp.x(), pp.y(), pp.z() ); float chi2 = 0.; reco::Track * track = new reco::Track( chi2, ndof, pos, mom, impactPointState.charge(), impactPointState.curvilinearError()); /* vv = outerState.globalPosition(); pp = outerState.globalMomentum(); math::XYZPoint outerPosition( vv.x(), vv.y(), vv.z()); math::XYZVector outerMomentum( pp.x(), pp.y(), pp.z()); vv = innerState.globalPosition(); pp = innerState.globalMomentum(); math::XYZPoint innerPosition( vv.x(), vv.y(), vv.z()); math::XYZVector innerMomentum( pp.x(), pp.y(), pp.z()); reco::TrackExtra extra( outerPosition, outerMomentum, true, innerPosition, innerMomentum, true, outerState.curvilinearError(), outerDetId, innerState.curvilinearError(), innerDetId, anyDirection); */ // std::cout <<"TRACK CREATED" << std::endl; return track; }
cms.PSet( ComponentName = cms.string('KFBasedPixelFitter'), useBeamSpotConstraint = cms.bool(True), beamSpotConstraint = cms.InputTag('offlineBeamSpot'), propagator = cms.string('PropagatorWithMaterial'), propagatorOpposite = cms.string('PropagatorWithMaterialOpposite'), TTRHBuilder = cms.string('PixelTTRHBuilderWithoutAngle') )
Definition at line 3 of file KFBasedPixelFitter.py.
edm::InputTag KFBasedPixelFitter::theBeamSpot [private] |
Definition at line 62 of file KFBasedPixelFitter.h.
std::string KFBasedPixelFitter::thePropagatorLabel [private] |
Definition at line 59 of file KFBasedPixelFitter.h.
Referenced by run().
std::string KFBasedPixelFitter::thePropagatorOppositeLabel [private] |
Definition at line 60 of file KFBasedPixelFitter.h.
Referenced by run().
std::string KFBasedPixelFitter::theTTRHBuilderName [private] |
Definition at line 63 of file KFBasedPixelFitter.h.
Referenced by run().
bool KFBasedPixelFitter::theUseBeamSpot [private] |
Definition at line 61 of file KFBasedPixelFitter.h.
Referenced by run().