Skip to content

Commit

Permalink
add exception against potential file reading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu committed Jun 2, 2015
1 parent 5a6ff8a commit f5ce07b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions RecoMET/METPUSubtraction/src/PFMETAlgorithmMVA.cc
Expand Up @@ -55,12 +55,13 @@ const GBRForest* PFMETAlgorithmMVA::loadMVAfromFile(const edm::FileInPath& input
<< " Failed to find File = " << inputFileName << " !!\n";
std::unique_ptr<TFile> inputFile(new TFile(inputFileName.fullPath().data()) );

if(inputFile==nullptr) {
std::vector<std::string> *lVec = (std::vector<std::string>*)inputFile->Get("varlist");

if(lVec==nullptr) {
throw cms::Exception("PFMETAlgorithmMVA::loadMVA")
<< " Failed to load file " << inputFileName.fullPath().data() << " !!\n";
<< " Failed to load mva file : " << inputFileName.fullPath().data() << " is not a proper file !!\n";
}

std::vector<std::string> *lVec = (std::vector<std::string>*)inputFile->Get("varlist");
std::vector<std::string> variableNames;
for(unsigned int i=0; i< lVec->size();++i)
{
Expand Down

0 comments on commit f5ce07b

Please sign in to comment.