#include <MuonLinksProducerForHLT.h>
Public Member Functions | |
MuonLinksProducerForHLT (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
virtual | ~MuonLinksProducerForHLT () |
Private Attributes | |
double | pMin |
double | ptMin |
double | shareHitFraction |
edm::InputTag | theInclusiveTrackCollectionInInput |
edm::InputTag | theLinkCollectionInInput |
Simple producer to make reco::MuonTrackLinks collection out of the global muons from "muons" collection to restore dropped links used as input for MuonIdProducer.
Definition at line 22 of file MuonLinksProducerForHLT.h.
MuonLinksProducerForHLT::MuonLinksProducerForHLT | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 31 of file MuonLinksProducerForHLT.cc.
References edm::ParameterSet::getParameter(), pMin, ptMin, shareHitFraction, theInclusiveTrackCollectionInInput, and theLinkCollectionInInput.
{ produces<reco::MuonTrackLinksCollection>(); theLinkCollectionInInput = iConfig.getParameter<edm::InputTag>("LinkCollection"); theInclusiveTrackCollectionInInput = iConfig.getParameter<edm::InputTag>("InclusiveTrackerTrackCollection"); ptMin = iConfig.getParameter<double>("ptMin"); pMin = iConfig.getParameter<double>("pMin"); shareHitFraction = iConfig.getParameter<double>("shareHitFraction"); }
MuonLinksProducerForHLT::~MuonLinksProducerForHLT | ( | ) | [virtual] |
Definition at line 41 of file MuonLinksProducerForHLT.cc.
{ }
void MuonLinksProducerForHLT::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 45 of file MuonLinksProducerForHLT.cc.
References newFWLiteAna::found, edm::Event::getByLabel(), link(), electronStore::links, convertSQLitetoXML_cfg::output, pMin, ptMin, edm::Event::put(), shareHitFraction, TrackingRecHit::some, theInclusiveTrackCollectionInInput, and theLinkCollectionInInput.
{ std::auto_ptr<reco::MuonTrackLinksCollection> output(new reco::MuonTrackLinksCollection()); edm::Handle<reco::MuonTrackLinksCollection> links; iEvent.getByLabel(theLinkCollectionInInput, links); edm::Handle<reco::TrackCollection> incTracks; iEvent.getByLabel(theInclusiveTrackCollectionInInput, incTracks); for(reco::MuonTrackLinksCollection::const_iterator link = links->begin(); link != links->end(); ++link){ bool found = false; unsigned int trackIndex = 0; unsigned int muonTrackHits = link->trackerTrack()->extra()->recHits().size(); for(reco::TrackCollection::const_iterator track = incTracks->begin(); track != incTracks->end(); ++track, ++trackIndex){ if ( track->pt() < ptMin ) continue; if ( track->p() < pMin ) continue; //std::cout << "pt (muon/track) " << link->trackerTrack()->pt() << " " << track->pt() << std::endl; unsigned trackHits = track->extra()->recHits().size(); //std::cout << "hits (muon/track) " << muonTrackHits << " " << trackHits() << std::endl; unsigned int smallestNumberOfHits = trackHits < muonTrackHits ? trackHits : muonTrackHits; int numberOfCommonDetIds = 0; for ( TrackingRecHitRefVector::const_iterator hit = track->extra()->recHitsBegin(); hit != track->extra()->recHitsEnd(); ++hit ) { for ( TrackingRecHitRefVector::const_iterator mit = link->trackerTrack()->extra()->recHitsBegin(); mit != link->trackerTrack()->extra()->recHitsEnd(); ++mit ) { if ( hit->get()->geographicalId() == mit->get()->geographicalId() && hit->get()->sharesInput(mit->get(),TrackingRecHit::some) ) { numberOfCommonDetIds++; break; } } } double fraction = (double)numberOfCommonDetIds/smallestNumberOfHits; // std::cout << "Overlap/Smallest/fraction = " << numberOfCommonDetIds << " " << smallestNumberOfHits << " " << fraction << std::endl; if( fraction > shareHitFraction ) { output->push_back(reco::MuonTrackLinks(reco::TrackRef(incTracks,trackIndex), link->standAloneTrack(), link->globalTrack() ) ); found = true; break; } } if (!found) output->push_back(reco::MuonTrackLinks(link->trackerTrack(), link->standAloneTrack(), link->globalTrack() ) ); } iEvent.put( output ); }
double MuonLinksProducerForHLT::pMin [private] |
Definition at line 34 of file MuonLinksProducerForHLT.h.
Referenced by MuonLinksProducerForHLT(), and produce().
double MuonLinksProducerForHLT::ptMin [private] |
Definition at line 33 of file MuonLinksProducerForHLT.h.
Referenced by MuonLinksProducerForHLT(), and produce().
double MuonLinksProducerForHLT::shareHitFraction [private] |
Definition at line 35 of file MuonLinksProducerForHLT.h.
Referenced by MuonLinksProducerForHLT(), and produce().
Definition at line 32 of file MuonLinksProducerForHLT.h.
Referenced by MuonLinksProducerForHLT(), and produce().
Definition at line 31 of file MuonLinksProducerForHLT.h.
Referenced by MuonLinksProducerForHLT(), and produce().