#include <RecoTracker/TrackProducer/plugins/GsfTrackRefitter.h>
Public Member Functions | |
GsfTrackRefitter (const edm::ParameterSet &iConfig) | |
Constructor. | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Implementation of produce method. | |
Private Attributes | |
TrackProducerAlgorithm < reco::GsfTrack > | theAlgo |
Based on the TrackRefitter.
Definition at line 11 of file GsfTrackRefitter.h.
GsfTrackRefitter::GsfTrackRefitter | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Constructor.
Definition at line 13 of file GsfTrackRefitter.cc.
References TrackProducerBase< reco::GsfTrack >::alias_, edm::ParameterSet::getParameter(), TrackProducerBase< reco::GsfTrack >::setAlias(), TrackProducerBase< reco::GsfTrack >::setConf(), and TrackProducerBase< reco::GsfTrack >::setSrc().
00013 : 00014 GsfTrackProducerBase(iConfig.getParameter<bool>("TrajectoryInEvent"), 00015 iConfig.getParameter<bool>("useHitsSplitting")), 00016 theAlgo(iConfig) 00017 { 00018 setConf(iConfig); 00019 setSrc( iConfig.getParameter<edm::InputTag>( "src" ), iConfig.getParameter<edm::InputTag>( "beamSpot" )); 00020 setAlias( iConfig.getParameter<std::string>( "@module_label" ) ); 00021 // std::string constraint_str = iConfig.getParameter<std::string>( "constraint" ); 00022 00023 // if (constraint_str == "") constraint_ = none; 00024 // else if (constraint_str == "momentum") constraint_ = momentum; 00025 // else if (constraint_str == "vertex") constraint_ = vertex; 00026 // else { 00027 // edm::LogError("GsfTrackRefitter")<<"constraint: "<<constraint_str<<" not understood. Set it to 'momentum', 'vertex' or leave it empty"; 00028 // throw cms::Exception("GsfTrackRefitter") << "unknown type of contraint! Set it to 'momentum', 'vertex' or leave it empty"; 00029 // } 00030 00031 //register your products 00032 produces<reco::GsfTrackCollection>().setBranchAlias( alias_ + "GsfTracks" ); 00033 produces<reco::TrackExtraCollection>().setBranchAlias( alias_ + "TrackExtras" ); 00034 produces<reco::GsfTrackExtraCollection>().setBranchAlias( alias_ + "GsfTrackExtras" ); 00035 produces<TrackingRecHitCollection>().setBranchAlias( alias_ + "RecHits" ); 00036 produces<std::vector<Trajectory> >() ; 00037 produces<TrajTrackAssociationCollection>(); 00038 00039 }
void GsfTrackRefitter::produce | ( | edm::Event & | theEvent, | |
const edm::EventSetup & | setup | |||
) | [virtual] |
Implementation of produce method.
Implements edm::EDProducer.
Definition at line 41 of file GsfTrackRefitter.cc.
References e, edm::Handle< T >::failedToGet(), TrackProducerBase< reco::GsfTrack >::getFromES(), TrackProducerBase< reco::GsfTrack >::getFromEvt(), edm::Event::id(), LogDebug, edm::ESHandle< T >::product(), GsfTrackProducerBase::putInEvt(), TrackProducerAlgorithm< T >::runWithTrack(), and theAlgo.
00042 { 00043 edm::LogInfo("GsfTrackRefitter") << "Analyzing event number: " << theEvent.id() << "\n"; 00044 // 00045 // create empty output collections 00046 // 00047 std::auto_ptr<TrackingRecHitCollection> outputRHColl (new TrackingRecHitCollection); 00048 std::auto_ptr<reco::GsfTrackCollection> outputTColl(new reco::GsfTrackCollection); 00049 std::auto_ptr<reco::TrackExtraCollection> outputTEColl(new reco::TrackExtraCollection); 00050 std::auto_ptr<reco::GsfTrackExtraCollection> outputGsfTEColl(new reco::GsfTrackExtraCollection); 00051 std::auto_ptr<std::vector<Trajectory> > outputTrajectoryColl(new std::vector<Trajectory>); 00052 00053 // 00054 //declare and get stuff to be retrieved from ES 00055 // 00056 edm::ESHandle<TrackerGeometry> theG; 00057 edm::ESHandle<MagneticField> theMF; 00058 edm::ESHandle<TrajectoryFitter> theFitter; 00059 edm::ESHandle<Propagator> thePropagator; 00060 // getFromES(setup,theG,theMF,theFitter,thePropagator); 00061 edm::ESHandle<TransientTrackingRecHitBuilder> theBuilder; 00062 getFromES(setup,theG,theMF,theFitter,thePropagator,theBuilder); 00063 00064 // 00065 //declare and get TrackCollection to be retrieved from the event 00066 // 00067 AlgoProductCollection algoResults; 00068 reco::BeamSpot bs; 00069 { 00070 edm::Handle<reco::GsfTrackCollection> theTCollection; 00071 getFromEvt(theEvent,theTCollection,bs); 00072 if (theTCollection.failedToGet()){ 00073 edm::LogError("GsfTrackRefitter")<<"could not get the reco::GsfTrackCollection."; return;} 00074 LogDebug("GsfTrackRefitter") << "run the algorithm" << "\n"; 00075 try { 00076 theAlgo.runWithTrack(theG.product(), theMF.product(), *theTCollection, 00077 theFitter.product(), thePropagator.product(), theBuilder.product(), bs, algoResults); 00078 }catch (cms::Exception &e){ edm::LogError("TrackProducer") << "cms::Exception caught during theAlgo.runWithTrack." << "\n" << e << "\n"; throw; } 00079 } 00080 00081 00082 //put everything in th event 00083 putInEvt(theEvent, outputRHColl, outputTColl, outputTEColl, outputGsfTEColl, outputTrajectoryColl, algoResults, bs); 00084 LogDebug("GsfTrackRefitter") << "end" << "\n"; 00085 }