Skip to content

Commit

Permalink
introduced more logical parameter names when using input xml files
Browse files Browse the repository at this point in the history
  • Loading branch information
ferencek committed Aug 13, 2015
1 parent 1d0cdce commit fd95157
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions CommonTools/Utils/plugins/GBRForestWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ void GBRForestWriter::analyze(const edm::Event&, const edm::EventSetup&)
dummyVariables.push_back(0.);
mvaReader->AddSpectator(spectatorVariable->data(), &dummyVariables.back());
}
mvaReader->BookMVA((*category)->gbrForestName_.data(), (*category)->inputFileName_.data());
TMVA::MethodBDT* bdt = dynamic_cast<TMVA::MethodBDT*>(mvaReader->FindMVA((*category)->gbrForestName_.data()));
mvaReader->BookMVA((*category)->methodName_.data(), (*category)->inputFileName_.data());
TMVA::MethodBDT* bdt = dynamic_cast<TMVA::MethodBDT*>(mvaReader->FindMVA((*category)->methodName_.data()));
if ( !bdt )
throw cms::Exception("GBRForestWriter")
<< "Failed to load MVA = " << (*category)->gbrForestName_.data() << " from file = " << (*category)->inputFileName_ << " !!\n";
<< "Failed to load MVA = " << (*category)->methodName_.data() << " from file = " << (*category)->inputFileName_ << " !!\n";
gbrForest = new GBRForest(bdt);
delete mvaReader;
TMVA::Tools::DestroyInstance();
Expand Down
6 changes: 5 additions & 1 deletion CommonTools/Utils/plugins/GBRForestWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ class GBRForestWriter : public edm::EDAnalyzer
if ( inputFileType_ == kXML ) {
inputVariables_ = cfg.getParameter<vstring>("inputVariables");
spectatorVariables_ = cfg.getParameter<vstring>("spectatorVariables");
methodName_ = cfg.getParameter<std::string>("methodName");
gbrForestName_ = ( cfg.existsAs<std::string>("gbrForestName") ? cfg.getParameter<std::string>("gbrForestName") : methodName_ );
}
gbrForestName_ = cfg.getParameter<std::string>("gbrForestName");
else
gbrForestName_ = cfg.getParameter<std::string>("gbrForestName");
}
~categoryEntryType() {}
std::string inputFileName_;
Expand All @@ -65,6 +68,7 @@ class GBRForestWriter : public edm::EDAnalyzer
vstring inputVariables_;
vstring spectatorVariables_;
std::string gbrForestName_;
std::string methodName_;
};
struct jobEntryType
{
Expand Down

0 comments on commit fd95157

Please sign in to comment.