Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving GBRForestWriter to CommonTools/Utils: 74X #10755

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions CommonTools/Utils/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<use name="FWCore/Framework"/>
<use name="FWCore/PluginManager"/>
<use name="FWCore/ParameterSet"/>
<use name="CondCore/DBOutputService"/>
<use name="CondFormats/EgammaObjects"/>
<use name="root"/>
<use name="roottmva"/>
<flags EDM_PLUGIN="1"/>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "RecoMET/METPUSubtraction/plugins/GBRForestWriter.h"
#include "CommonTools/Utils/plugins/GBRForestWriter.h"

#include "FWCore/Utilities/interface/Exception.h"

Expand Down 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
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