#include <RecoTracker/TrackProducer/plugins/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 &) |
Implementation of produce method. | |
TrackProducer (const edm::ParameterSet &iConfig) | |
Constructor. | |
Private Attributes | |
TrackProducerAlgorithm < reco::Track > | theAlgo |
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(), and ecalRecalibSequence_cff::tag.
00015 : 00016 KfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"), 00017 iConfig.getParameter<bool>("useHitsSplitting")), 00018 theAlgo(iConfig) 00019 { 00020 setConf(iConfig); 00021 setSrc( iConfig.getParameter<edm::InputTag>( "src" ), iConfig.getParameter<edm::InputTag>( "beamSpot" )); 00022 setAlias( iConfig.getParameter<std::string>( "@module_label" ) ); 00023 00024 if ( iConfig.exists("clusterRemovalInfo") ) { 00025 edm::InputTag tag = iConfig.getParameter<edm::InputTag>("clusterRemovalInfo"); 00026 if (!(tag == edm::InputTag())) { setClusterRemovalInfo( tag ); } 00027 } 00028 00029 //register your products 00030 produces<reco::TrackCollection>().setBranchAlias( alias_ + "Tracks" ); 00031 produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" ); 00032 produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" ); 00033 produces<std::vector<Trajectory> >() ; 00034 produces<TrajTrackAssociationCollection>(); 00035 00036 }
std::vector< reco::TransientTrack > TrackProducer::getTransient | ( | edm::Event & | theEvent, | |
const edm::EventSetup & | setup | |||
) |
Get Transient Tracks.
Definition at line 84 of file TrackProducer.cc.
References e, edm::Handle< T >::failedToGet(), TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), edm::Event::id(), LogDebug, Propagator::magneticField(), edm::ESHandle< T >::product(), TrackProducerAlgorithm< T >::runWithCandidate(), and theAlgo.
00085 { 00086 edm::LogInfo("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n"; 00087 // 00088 // create empty output collections 00089 // 00090 std::vector<reco::TransientTrack> ttks; 00091 00092 // 00093 //declare and get stuff to be retrieved from ES 00094 // 00095 edm::ESHandle<TrackerGeometry> theG; 00096 edm::ESHandle<MagneticField> theMF; 00097 edm::ESHandle<TrajectoryFitter> theFitter; 00098 edm::ESHandle<Propagator> thePropagator; 00099 edm::ESHandle<TransientTrackingRecHitBuilder> theBuilder; 00100 getFromES(setup,theG,theMF,theFitter,thePropagator,theBuilder); 00101 00102 // 00103 //declare and get TrackColection to be retrieved from the event 00104 // 00105 AlgoProductCollection algoResults; 00106 edm::Handle<TrackCandidateCollection> theTCCollection; 00107 reco::BeamSpot bs; 00108 getFromEvt(theEvent,theTCCollection,bs); 00109 //protect against missing product 00110 if (theTCCollection.failedToGet()){ 00111 edm::LogError("TrackProducer") <<"could not get the TrackCandidateCollection.";} 00112 else{ 00113 LogDebug("TrackProducer") << "run the algorithm" << "\n"; 00114 try{ 00115 theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection, 00116 theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults); 00117 } 00118 catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate." << "\n" << e << "\n"; throw; } 00119 } 00120 00121 for (AlgoProductCollection::iterator prod=algoResults.begin();prod!=algoResults.end(); prod++){ 00122 ttks.push_back( reco::TransientTrack(*((*prod).second.first),thePropagator.product()->magneticField() )); 00123 } 00124 00125 LogDebug("TrackProducer") << "end" << "\n"; 00126 00127 return ttks; 00128 }
void TrackProducer::produce | ( | edm::Event & | theEvent, | |
const edm::EventSetup & | setup | |||
) | [virtual] |
Implementation of produce method.
Implements edm::EDProducer.
Definition at line 39 of file TrackProducer.cc.
References e, edm::Handle< T >::failedToGet(), TrackProducerBase< reco::Track >::getFromES(), TrackProducerBase< reco::Track >::getFromEvt(), edm::Event::id(), LogDebug, edm::ESHandle< T >::product(), KfTrackProducerBase::putInEvt(), TrackProducerAlgorithm< T >::runWithCandidate(), and theAlgo.
00040 { 00041 edm::LogInfo("TrackProducer") << "Analyzing event number: " << theEvent.id() << "\n"; 00042 // 00043 // create empty output collections 00044 // 00045 std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection); 00046 std::auto_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection); 00047 std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection); 00048 std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>); 00049 00050 // 00051 //declare and get stuff to be retrieved from ES 00052 // 00053 edm::ESHandle<TrackerGeometry> theG; 00054 edm::ESHandle<MagneticField> theMF; 00055 edm::ESHandle<TrajectoryFitter> theFitter; 00056 edm::ESHandle<Propagator> thePropagator; 00057 edm::ESHandle<TransientTrackingRecHitBuilder> theBuilder; 00058 getFromES(setup,theG,theMF,theFitter,thePropagator,theBuilder); 00059 00060 // 00061 //declare and get TrackColection to be retrieved from the event 00062 // 00063 AlgoProductCollection algoResults; 00064 edm::Handle<TrackCandidateCollection> theTCCollection; 00065 reco::BeamSpot bs; 00066 getFromEvt(theEvent,theTCCollection,bs); 00067 //protect against missing product 00068 if (theTCCollection.failedToGet()){ 00069 edm::LogError("TrackProducer") <<"could not get the TrackCandidateCollection.";} 00070 else{ 00071 LogDebug("TrackProducer") << "run the algorithm" << "\n"; 00072 try{ 00073 theAlgo.runWithCandidate(theG.product(), theMF.product(), *theTCCollection, 00074 theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults); 00075 } catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithCandidate." << "\n" << e << "\n"; throw;} 00076 } 00077 00078 //put everything in the event 00079 putInEvt(theEvent, outputRHColl, outputTColl, outputTEColl, outputTrajectoryColl, algoResults); 00080 LogDebug("TrackProducer") << "end" << "\n"; 00081 }