Skip to content

Commit

Permalink
Same as dc8ea29
Browse files Browse the repository at this point in the history
  • Loading branch information
tomc committed Jan 30, 2019
1 parent 4a23f49 commit e67e470
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions multilep/interface/GenTools.h
Expand Up @@ -9,6 +9,7 @@
namespace GenTools{
const reco::GenParticle* getFirstMother(const reco::GenParticle&, const std::vector<reco::GenParticle>&);
const reco::GenParticle* getMother(const reco::GenParticle&, const std::vector<reco::GenParticle>&);
int getMotherPdgId(const reco::GenParticle&, const std::vector<reco::GenParticle>&);
//return decay chain for a particle;
void setDecayChain(const reco::GenParticle& gen, const std::vector<reco::GenParticle>& genParticles, std::set<int>& list);
bool hasOnlyIncomingGluonsInChain(const reco::GenParticle& gen, const std::vector<reco::GenParticle>& genParticles);
Expand Down
9 changes: 7 additions & 2 deletions multilep/src/GenTools.cc
Expand Up @@ -11,9 +11,14 @@ const reco::GenParticle* GenTools::getFirstMother(const reco::GenParticle& gen,

const reco::GenParticle* GenTools::getMother(const reco::GenParticle& gen, const std::vector<reco::GenParticle>& genParticles){
const reco::GenParticle* mom = getFirstMother(gen, genParticles);
if(!mom) return 0;
if(!mom) return nullptr;
else if(mom->pdgId() == gen.pdgId()) return getMother(*mom, genParticles);
else return mom;
else return mom;
}

int GenTools::getMotherPdgId(const reco::GenParticle& gen, const std::vector<reco::GenParticle>& genParticles){
auto mom = getMother(gen, genParticles);
return (mom ? mom->pdgId() : 0);
}

void GenTools::setDecayChain(const reco::GenParticle& gen, const std::vector<reco::GenParticle>& genParticles, std::set<int>& list){
Expand Down
2 changes: 1 addition & 1 deletion multilep/src/LeptonAnalyzer.cc
Expand Up @@ -349,7 +349,7 @@ template <typename Lepton> void LeptonAnalyzer::fillLeptonGenVars(const Lepton&
_lProvenance[_nL] = GenTools::provenance(match, genParticles);
_lProvenanceCompressed[_nL] = GenTools::provenanceCompressed(match, genParticles, _lIsPrompt[_nL]);
_lProvenanceConversion[_nL] = GenTools::provenanceConversion(match, genParticles);
_lMomPdgId[_nL] = match ? (GenTools::getMother(*match, genParticles))->pdgId() : 0;
_lMomPdgId[_nL] = match ? GenTools::getMotherPdgId(*match, genParticles) : 0;
}


Expand Down

0 comments on commit e67e470

Please sign in to comment.