#include <RecoTracker/TrackExtrapolator/src/TrackExtrapolator.cc>
Public Member Functions | |
TrackExtrapolator (const edm::ParameterSet &) | |
~TrackExtrapolator () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
bool | propagateTrackToVolume (const reco::Track &fTrack, const MagneticField &fField, const Propagator &fPropagator, const FiducialVolume &volume, reco::TrackBase::Point &resultPos, reco::TrackBase::Vector &resultMom) |
track quality of the tracks we care about | |
Private Attributes | |
reco::TrackBase::TrackQuality | trackQuality_ |
Input tracks. | |
edm::InputTag | tracksSrc_ |
Description: Extrapolates tracks to Calo Face. Migrating this functionality from RecoJets/JetAssociationAlgorithms/JetTracksAssociatorDRCalo.h, which will now essentially be defunct.
Implementation:
Definition at line 59 of file TrackExtrapolator.h.
TrackExtrapolator::TrackExtrapolator | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 11 of file TrackExtrapolator.cc.
References Exception, edm::ParameterSet::getParameter(), reco::TrackBase::qualityByName(), trackQuality_, and reco::TrackBase::undefQuality.
: tracksSrc_(iConfig.getParameter<edm::InputTag> ("trackSrc")) { trackQuality_ = reco::TrackBase::qualityByName (iConfig.getParameter<std::string> ("trackQuality")); if (trackQuality_ == reco::TrackBase::undefQuality) { // we have a problem throw cms::Exception("InvalidInput") << "Unknown trackQuality value '" << iConfig.getParameter<std::string> ("trackQuality") << "'. See possible values in 'reco::TrackBase::qualityByName'"; } produces< std::vector<reco::TrackExtrapolation> > (); }
TrackExtrapolator::~TrackExtrapolator | ( | ) |
Definition at line 26 of file TrackExtrapolator.cc.
{ }
void TrackExtrapolator::beginJob | ( | void | ) | [private, virtual] |
void TrackExtrapolator::endJob | ( | void | ) | [private, virtual] |
void TrackExtrapolator::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 37 of file TrackExtrapolator.cc.
References edm::EventSetup::get(), edm::Event::getByLabel(), ZElectronSkim_cff::goodTracks, propagateTrackToVolume(), edm::Event::put(), TrackQuality_cff::trackQuality, trackQuality_, and tracksSrc_.
{ // get stuff from Event Setup edm::ESHandle<MagneticField> field_h; iSetup.get<IdealMagneticFieldRecord>().get(field_h); edm::ESHandle<Propagator> propagator_h; iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAlong", propagator_h); edm::ESHandle<DetIdAssociator> ecalDetIdAssociator_h; iSetup.get<DetIdAssociatorRecord>().get("EcalDetIdAssociator", ecalDetIdAssociator_h); FiducialVolume ecalvolume = ecalDetIdAssociator_h->volume(); // get stuff from Event edm::Handle <reco::TrackCollection> tracks_h; iEvent.getByLabel (tracksSrc_, tracks_h); std::auto_ptr< std::vector<reco::TrackExtrapolation> > extrapolations( new std::vector<reco::TrackExtrapolation>() ); // Get list of tracks we want to extrapolate std::vector <reco::TrackRef> goodTracks; for ( reco::TrackCollection::const_iterator trkBegin = tracks_h->begin(), trkEnd = tracks_h->end(), itrk = trkBegin; itrk != trkEnd; ++itrk ) { reco::TrackBase::TrackQuality trackQuality = reco::TrackBase::TrackQuality (trackQuality_); // Cut on track quality if (itrk->quality (trackQuality)) { goodTracks.push_back (reco::TrackRef (tracks_h, itrk - trkBegin)); } } std::vector<reco::TrackBase::Point> vresultPos(1); std::vector<reco::TrackBase::Vector> vresultMom(1); // Now loop through the list of tracks and extrapolate them for ( std::vector<reco::TrackRef>::const_iterator trkBegin = goodTracks.begin(), trkEnd = goodTracks.end(), itrk = trkBegin; itrk != trkEnd; ++itrk ) { if( propagateTrackToVolume( **itrk, *field_h, *propagator_h, ecalvolume, vresultPos[0], vresultMom[0]) ) { extrapolations->push_back( reco::TrackExtrapolation( *itrk, vresultPos, vresultMom ) ); } } iEvent.put( extrapolations ); }
bool TrackExtrapolator::propagateTrackToVolume | ( | const reco::Track & | fTrack, |
const MagneticField & | fField, | ||
const Propagator & | fPropagator, | ||
const FiducialVolume & | volume, | ||
reco::TrackBase::Point & | resultPos, | ||
reco::TrackBase::Vector & | resultMom | ||
) | [private] |
track quality of the tracks we care about
Propagate a track to a given radius, given the magnetic field and the propagator. Store the resulting position, momentum, and direction.
Definition at line 101 of file TrackExtrapolator.cc.
References Plane::build(), Cylinder::build(), reco::TrackBase::charge(), reco::Track::extra(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), FiducialVolume::minR(), FiducialVolume::minZ(), reco::Track::outerPx(), reco::Track::outerPy(), reco::Track::outerPz(), reco::Track::outerX(), reco::Track::outerY(), reco::Track::outerZ(), Propagator::propagate(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), reco::btau::trackMomentum, reco::TrackBase::vx(), reco::TrackBase::vy(), reco::TrackBase::vz(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by produce().
{ GlobalPoint trackPosition (fTrack.vx(), fTrack.vy(), fTrack.vz()); // reference point GlobalVector trackMomentum (fTrack.px(), fTrack.py(), fTrack.pz()); // reference momentum if (fTrack.extra().isAvailable() ) { // use outer point information, if available trackPosition = GlobalPoint (fTrack.outerX(), fTrack.outerY(), fTrack.outerZ()); trackMomentum = GlobalVector (fTrack.outerPx(), fTrack.outerPy(), fTrack.outerPz()); } GlobalTrajectoryParameters trackParams(trackPosition, trackMomentum, fTrack.charge(), &fField); FreeTrajectoryState trackState (trackParams); TrajectoryStateOnSurface propagatedInfo = fPropagator.propagate (trackState, *Cylinder::build (Surface::PositionType (0,0,0), Surface::RotationType(), volume.minR()) ); // if the track went through either side of the endcaps, repropagate the track double minz=volume.minZ(); if(propagatedInfo.isValid() && propagatedInfo.globalPosition().z()>minz) { propagatedInfo = fPropagator.propagate (trackState, *Plane::build (Surface::PositionType (0,0,minz), Surface::RotationType()) ); } else if(propagatedInfo.isValid() && propagatedInfo.globalPosition().z()<-minz) { propagatedInfo = fPropagator.propagate (trackState, *Plane::build (Surface::PositionType (0,0,-minz), Surface::RotationType()) ); } if (propagatedInfo.isValid()) { resultPos = propagatedInfo.globalPosition (); resultMom = propagatedInfo.globalMomentum (); return true; } else { return false; } }
Input tracks.
Definition at line 72 of file TrackExtrapolator.h.
Referenced by produce(), and TrackExtrapolator().
edm::InputTag TrackExtrapolator::tracksSrc_ [private] |
Definition at line 71 of file TrackExtrapolator.h.
Referenced by produce().