17 if (pt < pt_min_ || pt >=
pt_max_)
73 std::vector<std::unique_ptr<TMVAEvaluator>>
bdts_;
90 edm::LogWarning(
"HGCalTriggerClusterIdentificationBDT|Initialization") <<
"BDTs already initialized.";
94 std::vector<std::string> bdt_files = conf.
getParameter<std::vector<std::string>>(
"Weights");
95 std::vector<double> categories_etamin = conf.
getParameter<std::vector<double>>(
"CategoriesEtaMin");
96 std::vector<double> categories_etamax = conf.
getParameter<std::vector<double>>(
"CategoriesEtaMax");
97 std::vector<double> categories_ptmin = conf.
getParameter<std::vector<double>>(
"CategoriesPtMin");
98 std::vector<double> categories_ptmax = conf.
getParameter<std::vector<double>>(
"CategoriesPtMax");
100 if (bdt_files.size() != categories_etamin.size() || categories_etamin.size() != categories_etamax.size() ||
101 categories_etamax.size() != categories_ptmin.size() || categories_ptmin.size() != categories_ptmax.size()) {
102 throw cms::Exception(
"HGCalTriggerClusterIdentificationBDT|BadInitialization")
103 <<
"Inconsistent numbers of categories, BDT weight files and working points";
105 size_t categories_size = categories_etamin.size();
107 const auto wps_conf = conf.
getParameter<std::vector<edm::ParameterSet>>(
"WorkingPoints");
109 for (
const auto& wp_conf : wps_conf) {
111 std::vector<double> wps = wp_conf.getParameter<std::vector<double>>(
"WorkingPoint");
113 if (wps.size() != categories_size) {
114 throw cms::Exception(
"HGCalTriggerClusterIdentificationBDT|BadInitialization")
115 <<
"Inconsistent number of categories in working point '" << wp_name <<
"'";
117 for (
size_t cat = 0;
cat < categories_size;
cat++) {
123 bdts_.reserve(categories_size);
124 for (
size_t cat = 0;
cat < categories_size;
cat++) {
126 categories_ptmin[
cat], categories_ptmax[
cat], categories_etamin[
cat], categories_etamax[
cat]);
129 for (
const auto&
file : bdt_files) {
131 bdts_.back()->initialize(
"!Color:Silent:!Error",
143 if (
variable ==
"cl3d_showerlength")
145 else if (
variable ==
"cl3d_coreshowerlength")
147 else if (
variable ==
"cl3d_firstlayer")
149 else if (
variable ==
"cl3d_maxlayer")
165 else if (
variable ==
"cl3d_srrmean")
171 std::map<std::string, float>
inputs;
175 float pt = cluster.
pt();
176 float eta = cluster.
eta();
182 float bdt_output =
value(cluster);
183 float pt = cluster.
pt();
184 float eta = cluster.
eta();
192 return static_cast<int>(
cat);
float sigmaEtaEtaTot() const
int category(float pt, float eta) const
T getParameter(std::string const &) const
const std::string & name() const
bool contains(EventRange const &lh, EventID const &rh)
double pt() const final
transverse momentum
int coreShowerLength() const
std::vector< std::string > input_variables_
float sigmaPhiPhiTot() const
bool decision(const l1t::HGCalMulticluster &cluster, unsigned wp=0) const final
bool contains(float pt, float eta) const
std::vector< Category > categories_
float sigmaPhiPhiMax() const
float clusterVariable(ClusterVariable, const l1t::HGCalMulticluster &) const
std::vector< std::vector< WorkingPoint > > working_points_
HGCalTriggerClusterIdentificationBDT()
Abs< T >::type abs(const T &t)
#define DEFINE_HGC_TPG_CLUSTER_ID(type, name)
const std::vector< std::string > & working_points() const final
void initialize(const edm::ParameterSet &conf) final
Category(float pt_min, float pt_max, float eta_min, float eta_max)
double working_point() const
std::vector< std::unique_ptr< TMVAEvaluator > > bdts_
std::vector< std::string > working_points_names_
float value(const l1t::HGCalMulticluster &cluster) const final
~HGCalTriggerClusterIdentificationBDT() override
float sigmaRRMean() const
std::vector< ClusterVariable > input_variables_id_
Log< level::Warning, false > LogWarning
float sigmaEtaEtaMax() const
WorkingPoint(const std::string &name, double wp)
double eta() const final
momentum pseudorapidity