Skip to content

Commit

Permalink
Merge pull request cms-sw#99 from arizzi/goodPV
Browse files Browse the repository at this point in the history
add goodPV filter
  • Loading branch information
arizzi authored Jan 26, 2018
2 parents 9de5569 + 8157bd1 commit f13c75e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions PhysicsTools/NanoAOD/plugins/VertexTableProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class VertexTableProducer : public edm::stream::EDProducer<> {
const edm::EDGetTokenT<edm::ValueMap<float>> pvsScore_;
const edm::EDGetTokenT<edm::View<reco::VertexCompositePtrCandidate> > svs_;
const StringCutObjectSelector<reco::Candidate> svCut_;
const StringCutObjectSelector<reco::Vertex> goodPvCut_;
const std::string goodPvCutString_;
const std::string pvName_;
const std::string svName_;
const std::string svDoc_;
Expand All @@ -85,6 +87,8 @@ VertexTableProducer::VertexTableProducer(const edm::ParameterSet& params):
pvsScore_(consumes<edm::ValueMap<float>>( params.getParameter<edm::InputTag>("pvSrc") )),
svs_(consumes<edm::View<reco::VertexCompositePtrCandidate> >( params.getParameter<edm::InputTag>("svSrc") )),
svCut_(params.getParameter<std::string>("svCut") , true),
goodPvCut_(params.getParameter<std::string>("goodPvCut") , true),
goodPvCutString_(params.getParameter<std::string>("goodPvCut") ),
pvName_(params.getParameter<std::string>("pvName") ),
svName_(params.getParameter<std::string>("svName") ),
svDoc_(params.getParameter<std::string>("svDoc") ),
Expand Down Expand Up @@ -130,7 +134,10 @@ VertexTableProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
pvTable->addColumnValue<float>("y",(*pvsIn)[0].position().y(),"main primary vertex position y coordinate",nanoaod::FlatTable::FloatColumn,10);
pvTable->addColumnValue<float>("z",(*pvsIn)[0].position().z(),"main primary vertex position z coordinate",nanoaod::FlatTable::FloatColumn,16);
pvTable->addColumnValue<float>("chi2",(*pvsIn)[0].normalizedChi2(),"main primary vertex reduced chi2",nanoaod::FlatTable::FloatColumn,8);
int goodPVs=0;
for (const auto & pv : *pvsIn) if (goodPvCut_(pv)) goodPVs++;
pvTable->addColumnValue<int>("npvs",(*pvsIn).size(),"total number of reconstructed primary vertices",nanoaod::FlatTable::IntColumn);
pvTable->addColumnValue<int>("npvsGood",goodPVs,"number of good reconstructed primary vertices. selection:"+goodPvCutString_,nanoaod::FlatTable::IntColumn);
pvTable->addColumnValue<float>("score",(*pvsScoreIn).get(pvsIn.id(),0),"main primary vertex score, i.e. sum pt2 of clustered objects",nanoaod::FlatTable::FloatColumn,8);

auto otherPVsTable = std::make_unique<nanoaod::FlatTable>((*pvsIn).size() >4?3:(*pvsIn).size()-1,"Other"+pvName_,false);
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@
Plot1D('chi2', 'chi2', 20, 0.5, 3, 'main primary vertex reduced chi2'),
Plot1D('ndof', 'ndof', 20, 0, 500, 'main primary vertex number of degree of freedom'),
Plot1D('npvs', 'npvs', 20, 0, 60, 'total number of reconstructed primary vertices'),
Plot1D('npvsGood', 'npvsGood', 20, 0, 60, 'total number of Good primary vertices'),
Plot1D('score', 'score', 20, 0, 300000, 'main primary vertex score, i.e. sum pt2 of clustered objects'),
Plot1D('x', 'x', 20, -0.3, 0.3, 'main primary vertex position x coordinate'),
Plot1D('y', 'y', 20, -0.3, 0.3, 'main primary vertex position y coordinate'),
Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/python/vertices_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
##################### User floats producers, selectors ##########################



##################### Tables for final output and docs ##########################
vertexTable = cms.EDProducer("VertexTableProducer",
pvSrc = cms.InputTag("offlineSlimmedPrimaryVertices"),
goodPvCut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
svSrc = cms.InputTag("slimmedSecondaryVertices"),
svCut = cms.string(""),
dlenMin = cms.double(0),
Expand Down

0 comments on commit f13c75e

Please sign in to comment.