Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 76263
b: "refs/heads/CMSSW_7_1_X"
c: 3144e63
h: "refs/heads/CMSSW_7_1_X"
i:
  76261: 7ffe3d2
  76259: 4c8c80e
  76255: 3cd5c87
v: v3
  • Loading branch information
Juan Alcaraz Maestre committed Oct 24, 2009
1 parent 6729979 commit 026a582
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e
"refs/heads/CMSSW_7_1_X": 5ecf5451044d9ace91e757c84a44884c168161aa
"refs/heads/CMSSW_7_1_X": 3144e639016fe84ff3941241d856e84fc8635fc6
19 changes: 13 additions & 6 deletions trunk/ElectroWeakAnalysis/Skimming/src/EWKMuTkSelector.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include <memory>
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/EDFilter.h"

//
// class declaration
//
class EWKMuTkSelector : public edm::EDProducer {
class EWKMuTkSelector : public edm::EDFilter {
public:
explicit EWKMuTkSelector(const edm::ParameterSet&);
~EWKMuTkSelector();

private:
virtual void beginJob(const edm::EventSetup&) ;
virtual void produce(edm::Event&, const edm::EventSetup&);
virtual bool filter(edm::Event&, const edm::EventSetup&);
virtual void endJob() ;

edm::InputTag muonTag_;
Expand Down Expand Up @@ -54,21 +54,23 @@ void EWKMuTkSelector::beginJob(const edm::EventSetup&) {
void EWKMuTkSelector::endJob(){}

/////////////////////////////////////////////////////////////////////////////////////
void EWKMuTkSelector::produce(edm::Event& ev, const edm::EventSetup&) {
bool EWKMuTkSelector::filter(edm::Event& ev, const edm::EventSetup&) {

bool selected = false;

// Muon collection
edm::Handle<edm::View<reco::Muon> > muonCollection;
if (!ev.getByLabel(muonTag_, muonCollection)) {
edm::LogError("") << ">>> Muon collection does not exist !!!";
return;
return false;
}
unsigned int muonCollectionSize = muonCollection->size();

// Track collection
edm::Handle<edm::View<reco::Track> > trackCollection;
if (!ev.getByLabel(trackTag_, trackCollection)) {
edm::LogError("") << ">>> Track collection does not exist !!!";
return;
return false;
}
unsigned int trackCollectionSize = trackCollection->size();

Expand All @@ -86,9 +88,11 @@ void EWKMuTkSelector::produce(edm::Event& ev, const edm::EventSetup&) {
for (unsigned int i=0; i<muonCollectionSize; ++i) {
const reco::Muon& mu = muonCollection->at(i);
if (mu.innerTrack().isNull()) continue;
if (mu.pt()<ptCut_) continue;
reco::TrackRef tkInMuon = mu.innerTrack();
if (tk==tkInMuon) {
reco::Muon* newmu = mu.clone();
selected = true;
newmu->setInnerTrack(reco::TrackRef(trackRefProd,newtracks->size()-1));
// insert it ordered by pt
unsigned int newmuonCollectionSize = newmuons->size();
Expand All @@ -115,7 +119,9 @@ void EWKMuTkSelector::produce(edm::Event& ev, const edm::EventSetup&) {
for (unsigned int i=0; i<muonCollectionSize; ++i) {
const reco::Muon& mu = muonCollection->at(i);
if (!mu.innerTrack().isNull()) continue;
if (mu.pt()<ptCut_) continue;
reco::Muon* newmu = mu.clone();
selected = true;

// insert it ordered by pt
unsigned int newmuonCollectionSize = newmuons->size();
Expand All @@ -138,6 +144,7 @@ void EWKMuTkSelector::produce(edm::Event& ev, const edm::EventSetup&) {
// Write new products
ev.put(newtracks);
ev.put(newmuons);
return selected;
}

DEFINE_FWK_MODULE(EWKMuTkSelector);

0 comments on commit 026a582

Please sign in to comment.