#include <SimTracker/TrackMCQuality/src/TrackMCQuality.cc>
Public Member Functions | |
TrackMCQuality (const edm::ParameterSet &) | |
~TrackMCQuality () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
std::string | associator |
edm::InputTag | label_tp |
edm::InputTag | label_tr |
edm::ESHandle < TrackAssociatorBase > | theAssociator |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 44 of file TrackMCQuality.cc.
TrackMCQuality::TrackMCQuality | ( | const edm::ParameterSet & | pset | ) | [explicit] |
Definition at line 74 of file TrackMCQuality.cc.
: label_tr(pset.getParameter< edm::InputTag >("label_tr")), label_tp(pset.getParameter< edm::InputTag >("label_tp")), associator(pset.getParameter< std::string >("associator")) { produces<reco::TrackCollection>(); }
TrackMCQuality::~TrackMCQuality | ( | ) |
Definition at line 84 of file TrackMCQuality.cc.
{ }
void TrackMCQuality::beginJob | ( | void | ) | [private, virtual] |
void TrackMCQuality::endJob | ( | void | ) | [private, virtual] |
void TrackMCQuality::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 95 of file TrackMCQuality.cc.
References associator, edm::EventSetup::get(), edm::Event::getByLabel(), label_tp, label_tr, edm::Event::put(), reco::TrackBase::qualitySize, theAssociator, ecalTPGAnalyzer_cfg::TPCollection, ExpressReco_HICollisions_FallBack::track, and ExpressReco_HICollisions_FallBack::trackCollection.
{ iSetup.get<TrackAssociatorRecord>().get(associator,theAssociator); using namespace edm; Handle<TrackingParticleCollection> TPCollection ; iEvent.getByLabel(label_tp, TPCollection); Handle<edm::View<reco::Track> > trackCollection; iEvent.getByLabel (label_tr, trackCollection ); reco::RecoToSimCollection recSimColl=theAssociator->associateRecoToSim(trackCollection, TPCollection, &iEvent); //then loop the track collection std::auto_ptr<reco::TrackCollection> outTracks(new reco::TrackCollection(trackCollection->size())); for (unsigned int iT=0;iT!=trackCollection->size();++iT){ edm::RefToBase<reco::Track> track(trackCollection, iT); bool matched=false; //find it in the map if (recSimColl.find(track)!=recSimColl.end()){ // you can get the data if you want std::vector<std::pair<TrackingParticleRef, double> > tp= recSimColl[track]; matched=true; } else{ matched=false; } //copy the track into the new container (*outTracks)[iT] = reco::Track(*track); if (matched){ (*outTracks)[iT].setQuality(reco::TrackBase::qualitySize); //is not assigned to any quality. use it as a fake/matched flag } } iEvent.put(outTracks); }
std::string TrackMCQuality::associator [private] |
Definition at line 59 of file TrackMCQuality.cc.
Referenced by produce().
edm::InputTag TrackMCQuality::label_tp [private] |
Definition at line 58 of file TrackMCQuality.cc.
Referenced by produce().
edm::InputTag TrackMCQuality::label_tr [private] |
Definition at line 57 of file TrackMCQuality.cc.
Referenced by produce().
Definition at line 56 of file TrackMCQuality.cc.
Referenced by produce().