CMS 3D CMS Logo

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

#include <RecoTracker/TrackExtrapolator/src/TrackExtrapolator.cc>

Inheritance diagram for TrackExtrapolator:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackExtrapolator (const edm::ParameterSet &)
 
 ~TrackExtrapolator ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 
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 More...
 

Private Attributes

reco::TrackBase::TrackQuality trackQuality_
 Input tracks. More...
 
edm::EDGetTokenT
< reco::TrackCollection
tracksSrc_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Extrapolates tracks to Calo Face. Migrating this functionality from RecoJets/JetAssociationAlgorithms/JetTracksAssociatorDRCalo.h, which will now essentially be defunct.

Implementation:

Definition at line 58 of file TrackExtrapolator.h.

Constructor & Destructor Documentation

TrackExtrapolator::TrackExtrapolator ( const edm::ParameterSet iConfig)
explicit

Definition at line 11 of file TrackExtrapolator.cc.

References edm::hlt::Exception, edm::ParameterSet::getParameter(), reco::TrackBase::qualityByName(), AlCaHLTBitMon_QueryRunRegistry::string, trackQuality_, tracksSrc_, and reco::TrackBase::undefQuality.

12 {
13  tracksSrc_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("trackSrc"));
14  trackQuality_ =
15  reco::TrackBase::qualityByName (iConfig.getParameter<std::string> ("trackQuality"));
16  if (trackQuality_ == reco::TrackBase::undefQuality) { // we have a problem
17  throw cms::Exception("InvalidInput") << "Unknown trackQuality value '"
18  << iConfig.getParameter<std::string> ("trackQuality")
19  << "'. See possible values in 'reco::TrackBase::qualityByName'";
20  }
21 
22  produces< std::vector<reco::TrackExtrapolation> > ();
23 }
T getParameter(std::string const &) const
reco::TrackBase::TrackQuality trackQuality_
Input tracks.
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:114
edm::EDGetTokenT< reco::TrackCollection > tracksSrc_
TrackExtrapolator::~TrackExtrapolator ( )

Definition at line 26 of file TrackExtrapolator.cc.

27 {
28 }

Member Function Documentation

void TrackExtrapolator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 37 of file TrackExtrapolator.cc.

References edm::EventSetup::get(), edm::Event::getByToken(), goodTracks_cfi::goodTracks, propagateTrackToVolume(), edm::Event::put(), HLT_25ns14e33_v1_cff::trackQuality, trackQuality_, and tracksSrc_.

38 {
39 
40  // get stuff from Event Setup
42  iSetup.get<IdealMagneticFieldRecord>().get(field_h);
43  edm::ESHandle<Propagator> propagator_h;
44  iSetup.get<TrackingComponentsRecord>().get("SteppingHelixPropagatorAlong", propagator_h);
45  edm::ESHandle<DetIdAssociator> ecalDetIdAssociator_h;
46  iSetup.get<DetIdAssociatorRecord>().get("EcalDetIdAssociator", ecalDetIdAssociator_h);
47  FiducialVolume const & ecalvolume = ecalDetIdAssociator_h->volume();
48 
49  // get stuff from Event
51  iEvent.getByToken (tracksSrc_, tracks_h);
52 
53  std::auto_ptr< std::vector<reco::TrackExtrapolation> > extrapolations( new std::vector<reco::TrackExtrapolation>() );
54 
55  // Get list of tracks we want to extrapolate
56  std::vector <reco::TrackRef> goodTracks;
57  for ( reco::TrackCollection::const_iterator trkBegin = tracks_h->begin(),
58  trkEnd = tracks_h->end(), itrk = trkBegin;
59  itrk != trkEnd; ++itrk ) {
61 
62  // Cut on track quality
63  if (itrk->quality (trackQuality)) {
64  goodTracks.push_back (reco::TrackRef (tracks_h, itrk - trkBegin));
65  }
66  }
67  std::vector<reco::TrackBase::Point> vresultPos(1);
68  std::vector<reco::TrackBase::Vector> vresultMom(1);
69 
70 
71  // Now loop through the list of tracks and extrapolate them
72  for ( std::vector<reco::TrackRef>::const_iterator trkBegin = goodTracks.begin(),
73  trkEnd = goodTracks.end(), itrk = trkBegin;
74  itrk != trkEnd; ++itrk ) {
75  if( propagateTrackToVolume( **itrk, *field_h, *propagator_h, ecalvolume,
76  vresultPos[0], vresultMom[0]) ) {
77  extrapolations->push_back( reco::TrackExtrapolation( *itrk,
78  vresultPos,
79  vresultMom ) );
80  }
81  }
82  iEvent.put( extrapolations );
83 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
TrackQuality
track quality
Definition: TrackBase.h:139
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
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
reco::TrackBase::TrackQuality trackQuality_
Input tracks.
const T & get() const
Definition: EventSetup.h:55
edm::EDGetTokenT< reco::TrackCollection > tracksSrc_
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 87 of file TrackExtrapolator.cc.

References Cylinder::build(), newFWLiteAna::build, reco::TrackBase::charge(), reco::Track::extra(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), edm::Ref< C, T, F >::isAvailable(), 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().

94 {
95  GlobalPoint trackPosition (fTrack.vx(), fTrack.vy(), fTrack.vz()); // reference point
96  GlobalVector trackMomentum (fTrack.px(), fTrack.py(), fTrack.pz()); // reference momentum
97  if (fTrack.extra().isAvailable() ) { // use outer point information, if available
98  trackPosition = GlobalPoint (fTrack.outerX(), fTrack.outerY(), fTrack.outerZ());
99  trackMomentum = GlobalVector (fTrack.outerPx(), fTrack.outerPy(), fTrack.outerPz());
100  }
101 
102  GlobalTrajectoryParameters trackParams(trackPosition, trackMomentum, fTrack.charge(), &fField);
103  FreeTrajectoryState trackState (trackParams);
104 
106  propagatedInfo = fPropagator.propagate (trackState,
107  *Cylinder::build (volume.minR(), Surface::PositionType (0,0,0),
109  )
110  );
111 
112  // if the track went through either side of the endcaps, repropagate the track
113  double minz=volume.minZ();
114  if(propagatedInfo.isValid() && propagatedInfo.globalPosition().z()>minz) {
115  propagatedInfo = fPropagator.propagate (trackState,
116  *Plane::build (Surface::PositionType (0,0,minz),
118  );
119 
120  } else if(propagatedInfo.isValid() && propagatedInfo.globalPosition().z()<-minz) {
121  propagatedInfo = fPropagator.propagate (trackState,
122  *Plane::build (Surface::PositionType (0,0,-minz),
124  );
125  }
126 
127 
128  if (propagatedInfo.isValid()) {
129  resultPos = propagatedInfo.globalPosition ();
130  resultMom = propagatedInfo.globalMomentum ();
131  return true;
132  }
133  else {
134  return false;
135  }
136 }
bool isAvailable() const
Definition: Ref.h:576
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
double outerPy() const
y coordinate of momentum vector at the outermost hit position
Definition: Track.h:129
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:189
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint globalPosition() const
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:580
double minZ(bool withTolerance=true) const
double outerZ() const
z coordinate of the outermost hit position
Definition: Track.h:149
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
Definition: Cylinder.h:51
T z() const
Definition: PV3DBase.h:64
double outerX() const
x coordinate of the outermost hit position
Definition: Track.h:139
double outerPz() const
z coordinate of momentum vector at the outermost hit position
Definition: Track.h:134
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:592
double minR(bool withTolerance=true) const
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:622
Point3DBase< float, GlobalTag > PositionType
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:616
GlobalVector globalMomentum() const
TkRotation< float > RotationType
double outerY() const
y coordinate of the outermost hit position
Definition: Track.h:144
int charge() const
track electric charge
Definition: TrackBase.h:520
double outerPx() const
x coordinate of momentum vector at the outermost hit position
Definition: Track.h:124
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:586
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:610
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

reco::TrackBase::TrackQuality TrackExtrapolator::trackQuality_
private

Input tracks.

Definition at line 70 of file TrackExtrapolator.h.

Referenced by produce(), and TrackExtrapolator().

edm::EDGetTokenT<reco::TrackCollection> TrackExtrapolator::tracksSrc_
private

Definition at line 69 of file TrackExtrapolator.h.

Referenced by produce(), and TrackExtrapolator().