#include <TrackProducer.h>
Public Member Functions | |
std::vector< reco::TransientTrack > | getTransient (edm::Event &, const edm::EventSetup &) |
Get Transient Tracks. | |
virtual void | produce (edm::Event &, const edm::EventSetup &) override |
Implementation of produce method. | |
TrackProducer (const edm::ParameterSet &iConfig) | |
Constructor. | |
Private Attributes | |
TrackProducerAlgorithm < reco::Track > | theAlgo |
Produce Tracks from TrackCandidates
Definition at line 17 of file TrackProducer.h.
TrackProducer::TrackProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Constructor.
Definition at line 15 of file TrackProducer.cc.
References TrackProducerBase< reco::Track >::alias_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), TrackProducerBase< reco::Track >::setAlias(), TrackProducerBase< reco::Track >::setClusterRemovalInfo(), TrackProducerBase< reco::Track >::setConf(), TrackProducerBase< reco::Track >::setSrc(), AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.
: KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"), iConfig.getParameter<bool>("useHitsSplitting")), theAlgo(iConfig) { setConf(iConfig); setSrc( iConfig.getParameter<edm::InputTag>( "src" ), iConfig.getParameter<edm::InputTag>( "beamSpot" )); setAlias( iConfig.getParameter<std::string>( "@module_label" ) ); if ( iConfig.exists("clusterRemovalInfo") ) { edm::InputTag tag = iConfig.getParameter<edm::InputTag>("clusterRemovalInfo"); if (!(tag == edm::InputTag())) { setClusterRemovalInfo( tag ); } } //register your products produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" ); produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" ); produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" ); produces<std::vector<Trajectory> >() ; produces<TrajTrackAssociationCollection>(); }
std::vector< reco::TransientTrack > TrackProducer::getTransient | ( | edm::Event & | theEvent, |
const edm::EventSetup & | setup | ||
) |
Get Transient Tracks.
Definition at line 85 of file TrackProducer.cc.
References alignCSCRings::e, edm::HandleBase::failedToGet(), TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), edm::EventBase::id(), LogDebug, parseEventContent::prod, edm::ESHandle< T >::product(), TrackProducerAlgorithm< T >::runWithCandidate(), and theAlgo.
{ LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n"; // // create empty output collections // std::vector<reco::TransientTrack> ttks; // //declare and get stuff to be retrieved from ES // edm::ESHandle<TrackerGeometry> theG; edm::ESHandle<MagneticField> theMF; edm::ESHandle<TrajectoryFitter> theFitter; edm::ESHandle<Propagator> thePropagator; edm::ESHandle<MeasurementTracker> theMeasTk; edm::ESHandle<TransientTrackingRecHitBuilder> theBuilder; getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder); // //declare and get TrackColection to be retrieved from the event // AlgoProductCollection algoResults; edm::Handle<TrackCandidateCollection> theTCCollection; reco::BeamSpot bs; getFromEvt(theEvent,theTCCollection,bs); //protect against missing product if (theTCCollection.failedToGet()){ edm::LogError("TrackProducer") <<"could not get the TrackCandidateCollection.";} else{ LogDebug("TrackProducer") << "run the algorithm" << "\n"; try{ theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection, theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults); } catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate." << "\n" << e << "\n"; throw; } } for (AlgoProductCollection::iterator prod=algoResults.begin();prod!=algoResults.end(); prod++){ ttks.push_back( reco::TransientTrack(*((*prod).second.first),thePropagator.product()->magneticField() )); } LogDebug("TrackProducer") << "end" << "\n"; return ttks; }
void TrackProducer::produce | ( | edm::Event & | theEvent, |
const edm::EventSetup & | setup | ||
) | [override, virtual] |
Implementation of produce method.
Implements edm::EDProducer.
Definition at line 39 of file TrackProducer.cc.
References alignCSCRings::e, edm::HandleBase::failedToGet(), TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), edm::EventBase::id(), LogDebug, edm::ESHandle< T >::product(), KfTrackProducerBase::putInEvt(), TrackProducerAlgorithm< T >::runWithCandidate(), and theAlgo.
{ LogDebug("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n"; // // create empty output collections // std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection); std::auto_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection); std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection); std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>); // //declare and get stuff to be retrieved from ES // edm::ESHandle<TrackerGeometry> theG; edm::ESHandle<MagneticField> theMF; edm::ESHandle<TrajectoryFitter> theFitter; edm::ESHandle<Propagator> thePropagator; edm::ESHandle<MeasurementTracker> theMeasTk; edm::ESHandle<TransientTrackingRecHitBuilder> theBuilder; getFromES(setup,theG,theMF,theFitter,thePropagator,theMeasTk,theBuilder); // //declare and get TrackColection to be retrieved from the event // AlgoProductCollection algoResults; edm::Handle<TrackCandidateCollection> theTCCollection; reco::BeamSpot bs; getFromEvt(theEvent,theTCCollection,bs); //protect against missing product if (theTCCollection.failedToGet()){ edm::LogError("TrackProducer") <<"could not get the TrackCandidateCollection.";} else{ LogDebug("TrackProducer") << "run the algorithm" << "\n"; try{ theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection, theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults); } catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate." << "\n" << e << "\n"; throw;} } //put everything in the event putInEvt(theEvent, thePropagator.product(),theMeasTk.product(), outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, algoResults); LogDebug("TrackProducer") << "end" << "\n"; }
Definition at line 38 of file TrackProducer.h.
Referenced by getTransient(), and produce().