Skip to content

Commit

Permalink
Add checks in BDT initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jbsauvan committed May 15, 2018
1 parent c616c70 commit 3215350
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,32 @@ void
HGCalTriggerClusterIdentificationBDT::
initialize(const edm::ParameterSet& conf)
{
categories_.clear();
bdts_.clear();
working_points_.clear();
input_variables_.clear();
if(!bdts_.empty())
{
edm::LogWarning("HGCalTriggerClusterIdentificationBDT|Initialization")
<< "BDTs already initialized.";
return;
}
input_variables_ = conf.getParameter< std::vector<std::string> >("Inputs");
std::vector<std::string> bdt_files = conf.getParameter< std::vector<std::string> >("Weights");
std::vector<double> categories_etamin = conf.getParameter<std::vector<double>>("CategoriesEtaMin");
std::vector<double> categories_etamax = conf.getParameter<std::vector<double>>("CategoriesEtaMax");
std::vector<double> categories_ptmin = conf.getParameter<std::vector<double>>("CategoriesPtMin");
std::vector<double> categories_ptmax = conf.getParameter<std::vector<double>>("CategoriesPtMax");
working_points_ = conf.getParameter<std::vector<double>>("WorkingPoints");

if(bdt_files.size()!=categories_etamin.size() ||
categories_etamin.size()!=categories_etamax.size() ||
categories_etamax.size()!=categories_ptmin.size() ||
categories_ptmin.size()!=categories_ptmax.size() ||
categories_ptmax.size()!=working_points_.size()
)
{
throw cms::Exception("HGCalTriggerClusterIdentificationBDT|BadInitialization")
<< "Inconsistent numbers of categories, BDT weight files and working points";
}
categories_.reserve(working_points_.size());
bdts_.reserve(working_points_.size());
for(unsigned cat=0; cat<categories_etamin.size(); cat++)
{
categories_.emplace_back(
Expand Down

0 comments on commit 3215350

Please sign in to comment.