Public Member Functions | |
UpdatedMuonInnerTrackRef (const edm::ParameterSet &) | |
~UpdatedMuonInnerTrackRef () | |
Private Member Functions | |
virtual void | beginJob () |
virtual void | endJob () |
reco::TrackRef | findNewRef (reco::TrackRef oldTrackRef, edm::Handle< reco::TrackCollection > &newTrackCollection) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
double | maxInvPtDiff |
double | minDR |
edm::InputTag | muonTag_ |
edm::InputTag | newTrackTag_ |
edm::InputTag | oldTrackTag_ |
Definition at line 19 of file UpdatedMuonInnerTrackRef.cc.
UpdatedMuonInnerTrackRef::UpdatedMuonInnerTrackRef | ( | const edm::ParameterSet & | pset | ) | [explicit] |
Definition at line 41 of file UpdatedMuonInnerTrackRef.cc.
References edm::ParameterSet::getUntrackedParameter(), maxInvPtDiff, minDR, muonTag_, newTrackTag_, and oldTrackTag_.
{ // What is being produced produces<std::vector<reco::Muon> >(); // Input products muonTag_ = pset.getUntrackedParameter<edm::InputTag> ("MuonTag" , edm::InputTag("muons")); oldTrackTag_ = pset.getUntrackedParameter<edm::InputTag> ("OldTrackTag", edm::InputTag("generalTracks")); newTrackTag_ = pset.getUntrackedParameter<edm::InputTag> ("NewTrackTag", edm::InputTag("generalTracksSkim")); // matching criteria products maxInvPtDiff=pset.getUntrackedParameter<double>("maxInvPtDiff", 0.005); minDR=pset.getUntrackedParameter<double>("minDR", 0.1); }
UpdatedMuonInnerTrackRef::~UpdatedMuonInnerTrackRef | ( | ) |
Definition at line 57 of file UpdatedMuonInnerTrackRef.cc.
{ }
void UpdatedMuonInnerTrackRef::beginJob | ( | void | ) | [private, virtual] |
void UpdatedMuonInnerTrackRef::endJob | ( | void | ) | [private, virtual] |
reco::TrackRef UpdatedMuonInnerTrackRef::findNewRef | ( | reco::TrackRef | oldTrackRef, |
edm::Handle< reco::TrackCollection > & | newTrackCollection | ||
) | [private] |
Definition at line 117 of file UpdatedMuonInnerTrackRef.cc.
References deltaR(), newFWLiteAna::found, i, edm::Ref< C, T, F >::isNull(), maxInvPtDiff, and minDR.
Referenced by produce().
{ float dRMin=1000; int found = -1; for(unsigned int i=0;i<newTrackCollection->size();i++){ reco::TrackRef newTrackRef = reco::TrackRef( newTrackCollection, i ); if(newTrackRef.isNull())continue; if( fabs( (1.0/newTrackRef->pt())-(1.0/oldTrackRef->pt())) > maxInvPtDiff) continue; float dR = deltaR(newTrackRef->momentum(), oldTrackRef->momentum()); if(dR <= minDR && dR < dRMin){ dRMin=dR; found = i;} } if(found>=0){ return reco::TrackRef( newTrackCollection, found ); }else{ return reco::TrackRef(); } }
void UpdatedMuonInnerTrackRef::produce | ( | edm::Event & | ev, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 69 of file UpdatedMuonInnerTrackRef.cc.
References findNewRef(), edm::Event::getByLabel(), i, edm::RefToBase< T >::isNonnull(), muonTag_, newTrackTag_, oldTrackTag_, edm::Event::put(), and reco::Muon::setInnerTrack().
{ // Muon collection edm::Handle<edm::View<reco::Muon> > muonCollectionHandle; if (!ev.getByLabel(muonTag_, muonCollectionHandle)) { edm::LogError("") << ">>> Muon collection does not exist !!!"; return; } edm::Handle<reco::TrackCollection> oldTrackCollection; if (!ev.getByLabel(oldTrackTag_, oldTrackCollection)) { edm::LogError("") << ">>> Old Track collection does not exist !!!"; return; } edm::Handle<reco::TrackCollection> newTrackCollection; if (!ev.getByLabel(newTrackTag_, newTrackCollection)) { edm::LogError("") << ">>> New Track collection does not exist !!!"; return; } unsigned int muonCollectionSize = muonCollectionHandle->size(); std::auto_ptr<reco::MuonCollection> newmuons (new reco::MuonCollection); for (unsigned int i=0; i<muonCollectionSize; i++) { edm::RefToBase<reco::Muon> mu = muonCollectionHandle->refAt(i); reco::Muon* newmu = mu->clone(); if(mu->innerTrack().isNonnull()){ reco::TrackRef newTrackRef = findNewRef(mu->innerTrack(), newTrackCollection); /* printf(" %6.2f %+6.2f %+6.2f --> ",mu->innerTrack()->pt (), mu->innerTrack()->eta(), mu->innerTrack()->phi()); if(newTrackRef.isNonnull()){ printf(" %6.2f %+6.2f %+6.2f\n",newTrackRef->pt (), newTrackRef->eta(), newTrackRef->phi()); }else{ printf("\n"); } */ newmu->setInnerTrack(newTrackRef); } newmuons->push_back(*newmu); } ev.put(newmuons); }
double UpdatedMuonInnerTrackRef::maxInvPtDiff [private] |
Definition at line 35 of file UpdatedMuonInnerTrackRef.cc.
Referenced by findNewRef(), and UpdatedMuonInnerTrackRef().
double UpdatedMuonInnerTrackRef::minDR [private] |
Definition at line 36 of file UpdatedMuonInnerTrackRef.cc.
Referenced by findNewRef(), and UpdatedMuonInnerTrackRef().
Definition at line 31 of file UpdatedMuonInnerTrackRef.cc.
Referenced by produce(), and UpdatedMuonInnerTrackRef().
Definition at line 33 of file UpdatedMuonInnerTrackRef.cc.
Referenced by produce(), and UpdatedMuonInnerTrackRef().
Definition at line 32 of file UpdatedMuonInnerTrackRef.cc.
Referenced by produce(), and UpdatedMuonInnerTrackRef().