Skip to content

Commit

Permalink
Clean up test script for LHE weights a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
kdlong committed Oct 4, 2019
1 parent acc3817 commit 27a9239
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
4 changes: 2 additions & 2 deletions GeneratorInterface/Core/test/testGenWeightProducer_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
process.testLHEWeights = cms.EDProducer("LHEWeightProductProducer")
process.testGenWeights = cms.EDProducer("GenWeightProductProducer")

#process.p = cms.Path(process.testLHEWeights*process.testGenWeights)
process.p = cms.Path(process.testGenWeights)
process.p = cms.Path(process.testLHEWeights*process.testGenWeights)
#process.p = cms.Path(process.testGenWeights)

process.output = cms.EndPath(process.out)
process.schedule = cms.Schedule(process.p,process.output)
Expand Down
25 changes: 0 additions & 25 deletions GeneratorInterface/LHEInterface/plugins/LHEWeightsTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,6 @@ std::pair<reco::GenParticle,reco::GenParticle> find_z_candidate(std::vector<reco
}
return std::make_pair(p1,p2);
}
reco::Candidate const * find_first_mother_with_different_id( reco::Candidate const * daughter ){
reco::Candidate const * mother = daughter->mother(0);
if(abs(mother->pdgId()) != abs(daughter->pdgId())) {
return mother;
}else{
return find_first_mother_with_different_id(mother);
}
}

std::vector<reco::GenJet> clean_jets(const std::vector<reco::GenJet> genJets, const std::vector<reco::GenParticle> leptons){
std::vector<reco::GenJet> cleaned_jets;
Expand Down Expand Up @@ -282,22 +274,6 @@ bool has_v_in_history(reco::GenParticle const & part){
return false;
}
}
std::vector<reco::GenJet> clean_v_jets(const std::vector<reco::GenJet> & genJets){
std::vector<reco::GenJet> cleaned;
for( auto const & j : genJets ) {
bool found = false;
for( auto const & c: j.getGenConstituents() ) {
found |= has_v_in_history(*c);
if(found) break;
}
if(not found){
cleaned.push_back(j);
}
}

return cleaned;
}


void LHEWeightsTest::setup_variables(const edm::Event& iEvent) {
using namespace edm;
Expand Down Expand Up @@ -337,7 +313,6 @@ void LHEWeightsTest::setup_variables(const edm::Event& iEvent) {

//// Jets
std::vector<reco::GenJet> jets = clean_jets(select_jets(*genJets),leptons);
//std::vector<reco::GenJet> jets = clean_v_jets(clean_jets(select_jets(*genJets),leptons));
int njets = jets.size();
variables["n_jets"] = njets;
variables["pt_jet1"] = njets > 0 ? jets.at(0).pt() : -999;
Expand Down

0 comments on commit 27a9239

Please sign in to comment.