diff --git a/[refs] b/[refs] index 5b70a94953f83..330ed59a6ff2e 100644 --- a/[refs] +++ b/[refs] @@ -1,3 +1,3 @@ --- refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e -"refs/heads/CMSSW_7_1_X": 3d809401eadcd2a597d10bc5aff4a4fdafcf9905 +"refs/heads/CMSSW_7_1_X": e1c8d39ea0ef5fed798e68273728ce9a6cd541c2 diff --git a/trunk/ElectroWeakAnalysis/Skimming/BuildFile b/trunk/ElectroWeakAnalysis/Skimming/BuildFile index 57edbe82d602d..2dd27ea6f0a0d 100644 --- a/trunk/ElectroWeakAnalysis/Skimming/BuildFile +++ b/trunk/ElectroWeakAnalysis/Skimming/BuildFile @@ -4,6 +4,8 @@ - - - +# +# +# + + diff --git a/trunk/ElectroWeakAnalysis/Skimming/src/EWKMuTkSelector.cc b/trunk/ElectroWeakAnalysis/Skimming/src/EWKMuTkSelector.cc index b0bcd9b2bc113..11a40873323ba 100644 --- a/trunk/ElectroWeakAnalysis/Skimming/src/EWKMuTkSelector.cc +++ b/trunk/ElectroWeakAnalysis/Skimming/src/EWKMuTkSelector.cc @@ -18,7 +18,7 @@ class EWKMuTkSelector : public edm::EDProducer { edm::InputTag muonTag_; edm::InputTag trackTag_; - double ptCutForAdditionalTracks_; + double ptCut_; }; #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -38,7 +38,7 @@ EWKMuTkSelector::EWKMuTkSelector(const edm::ParameterSet& pset) { // Input products muonTag_ = pset.getUntrackedParameter ("MuonTag", edm::InputTag("muons")); trackTag_ = pset.getUntrackedParameter ("TrackTag", edm::InputTag("gneralTracks")); - ptCutForAdditionalTracks_ = pset.getUntrackedParameter ("PtCutForAdditionalTracks"); + ptCut_ = pset.getUntrackedParameter ("PtCut"); } @@ -79,21 +79,15 @@ void EWKMuTkSelector::produce(edm::Event& ev, const edm::EventSetup&) { // Select tracks for the new collection and set links in the new muon collection for (unsigned int j=0; jrefAt(j)).castTo(); - if (tk->pt()>ptCutForAdditionalTracks_) { - newtracks->push_back(*tk); - alreadyWritten = true; - } + if (tk->pt()push_back(*tk); + for (unsigned int i=0; iat(i); if (mu.innerTrack().isNull()) continue; reco::TrackRef tkInMuon = mu.innerTrack(); if (tk==tkInMuon) { - if (!alreadyWritten) { - newtracks->push_back(*tk); - alreadyWritten = true; - } reco::Muon* newmu = mu.clone(); newmu->setInnerTrack(reco::TrackRef(trackRefProd,newtracks->size()-1)); // insert it ordered by pt @@ -101,7 +95,7 @@ void EWKMuTkSelector::produce(edm::Event& ev, const edm::EventSetup&) { double newpt = newmu->pt(); bool inserted = false; for (unsigned int k=0; kat(i); + const reco::Muon& mu2 = newmuons->at(k); if (newpt>mu2.pt()) { newmuons->insert(newmuons->begin()+k,*newmu); inserted = true; @@ -117,6 +111,30 @@ void EWKMuTkSelector::produce(edm::Event& ev, const edm::EventSetup&) { } } + // Add standalone muons + for (unsigned int i=0; iat(i); + if (!mu.innerTrack().isNull()) continue; + reco::Muon* newmu = mu.clone(); + + // insert it ordered by pt + unsigned int newmuonCollectionSize = newmuons->size(); + double newpt = newmu->pt(); + bool inserted = false; + for (unsigned int k=0; kat(k); + if (newpt>mu2.pt()) { + newmuons->insert(newmuons->begin()+k,*newmu); + inserted = true; + break; + } + } + if (!inserted) { + newmuons->push_back(*newmu); + inserted = true; + } + } + // Write new products ev.put(newtracks); ev.put(newmuons);