Skip to content

Commit

Permalink
Merge pull request cms-sw#111 from HEP-KBFI/fixSIGSEGV
Browse files Browse the repository at this point in the history
fixed segmentation violation that occurred in subjet analyses in case…
  • Loading branch information
arizzi authored Mar 14, 2018
2 parents fb8502c + bf5c417 commit 2aa9689
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions PhysicsTools/SelectorUtils/interface/PFJetIDSelectionFunctor.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,24 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
iend = patJet->end(), isub = ibegin;
isub != iend; ++isub ) {
reco::PFJet const * pfsub = dynamic_cast<reco::PFJet const *>( &*isub );
e_chf += pfsub->chargedHadronEnergy();
e_nhf += pfsub->neutralHadronEnergy();
e_cef += pfsub->chargedEmEnergy();
e_nef += pfsub->neutralEmEnergy();
nch += pfsub->chargedMultiplicity();
nconstituents += pfsub->numberOfDaughters();
nneutrals += pfsub->neutralMultiplicity();
pat::Jet const * patsub = dynamic_cast<pat::Jet const *>( &*isub );
if ( patsub ) {
e_chf += patsub->chargedHadronEnergy();
e_nhf += patsub->neutralHadronEnergy();
e_cef += patsub->chargedEmEnergy();
e_nef += patsub->neutralEmEnergy();
nch += patsub->chargedMultiplicity();
nconstituents += patsub->numberOfDaughters();
nneutrals += patsub->neutralMultiplicity();
} else if ( pfsub ) {
e_chf += pfsub->chargedHadronEnergy();
e_nhf += pfsub->neutralHadronEnergy();
e_cef += pfsub->chargedEmEnergy();
e_nef += pfsub->neutralEmEnergy();
nch += pfsub->chargedMultiplicity();
nconstituents += pfsub->numberOfDaughters();
nneutrals += pfsub->neutralMultiplicity();
} else assert(0);
}
double e = patJet->energy();
if ( e > 0.000001 ) {
Expand Down Expand Up @@ -407,8 +418,6 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
}
} // end if basic jet



// Cuts for |eta| < 2.4 for FIRSTDATA, RUNIISTARTUP and WINTER16
if ( ignoreCut(indexCEF_) || ( cef < cut(indexCEF_, double()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexCEF_);
if ( ignoreCut(indexCHF_) || ( chf > cut(indexCHF_, double()) || std::abs(jet.eta()) > 2.4 ) ) passCut( ret, indexCHF_);
Expand Down Expand Up @@ -443,7 +452,6 @@ class PFJetIDSelectionFunctor : public Selector<pat::Jet> {
if ( ignoreCut(indexNNeutrals_FW_) || ( nneutrals > cut(indexNNeutrals_FW_, int()) || std::abs(jet.eta()) <= 3.0 ) ) passCut( ret, indexNNeutrals_FW_);
}


//std::cout << "<PFJetIDSelectionFunctor::firstDataCuts>:" << std::endl;
//std::cout << " jet: Pt = " << jet.pt() << ", eta = " << jet.eta() << ", phi = " << jet.phi() << std::endl;
//ret.print(std::cout);
Expand Down

0 comments on commit 2aa9689

Please sign in to comment.