Skip to content

Commit

Permalink
Merge pull request #23746 from guitargeek/Category_not_found_fix
Browse files Browse the repository at this point in the history
Changed category not defined error to warning in ElectronMVA
  • Loading branch information
cmsbuild committed Jul 8, 2018
2 parents 45cdd40 + 7b0b8cd commit 4d160db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion RecoEgamma/EgammaTools/src/GBRForestTools.cc
Expand Up @@ -62,7 +62,9 @@ std::unique_ptr<const GBRForest> GBRForestTools::createGBRForest(const edm::File
tmpstr = "";
} else if (reco::details::hasEnding(weightFile.fullPath(), ".gz") || reco::details::hasEnding(weightFile.fullPath(), ".gzip")) {
gzipped = true;
tmpstr = std::string(reco::details::readGzipFile(weightFile.fullPath()));
char *buffer = reco::details::readGzipFile(weightFile.fullPath());
tmpstr = std::string(buffer);
free(buffer);
}
std::stringstream is(tmpstr);

Expand Down
Expand Up @@ -104,6 +104,9 @@ float ElectronMVAEstimatorRun2::
mvaValue( const edm::Ptr<reco::Candidate>& candPtr, const edm::EventBase & iEvent) const {

const int iCategory = findCategory( candPtr );

if (iCategory < 0) return -999;

std::vector<float> vars;

const edm::Ptr<reco::GsfElectron> gsfPtr{ candPtr };
Expand Down Expand Up @@ -148,7 +151,10 @@ int ElectronMVAEstimatorRun2::findCategory( const edm::Ptr<reco::Candidate>& can
if (categoryFunctions_[i](*gsfEle)) return i;
}

throw cms::Exception("MVA failure: ")
<< " category not defined for particle in " << name_ << tag_ << std::endl;
edm::LogWarning ("MVA warning") <<
"category not defined for particle with pt " << gsfEle->pt() << " GeV, eta " <<
gsfEle->superCluster()->eta() << " in " << name_ << tag_;

return -1;

}

0 comments on commit 4d160db

Please sign in to comment.