CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
HGCalTriggerClusterIdentificationBDT Class Reference
Inheritance diagram for HGCalTriggerClusterIdentificationBDT:
HGCalTriggerClusterIdentificationBase

Classes

class  Category
 

Public Member Functions

bool decision (const l1t::HGCalMulticluster &cluster) const final
 
 HGCalTriggerClusterIdentificationBDT ()
 
void initialize (const edm::ParameterSet &conf) final
 
float value (const l1t::HGCalMulticluster &cluster) const final
 
 ~HGCalTriggerClusterIdentificationBDT () override
 
- Public Member Functions inherited from HGCalTriggerClusterIdentificationBase
 HGCalTriggerClusterIdentificationBase ()
 
virtual ~HGCalTriggerClusterIdentificationBase ()
 

Private Types

enum  ClusterVariable {
  ClusterVariable::cl3d_showerlength, ClusterVariable::cl3d_coreshowerlength, ClusterVariable::cl3d_firstlayer, ClusterVariable::cl3d_maxlayer,
  ClusterVariable::cl3d_seetot, ClusterVariable::cl3d_seemax, ClusterVariable::cl3d_spptot, ClusterVariable::cl3d_sppmax,
  ClusterVariable::cl3d_szz, ClusterVariable::cl3d_srrtot, ClusterVariable::cl3d_srrmax, ClusterVariable::cl3d_srrmean
}
 

Private Member Functions

int category (float pt, float eta) const
 
float clusterVariable (ClusterVariable, const l1t::HGCalMulticluster &) const
 

Private Attributes

std::vector< std::unique_ptr< TMVAEvaluator > > bdts_
 
std::vector< Categorycategories_
 
std::vector< std::string > input_variables_
 
std::vector< ClusterVariableinput_variables_id_
 
std::vector< double > working_points_
 

Detailed Description

Definition at line 8 of file HGCalTriggerClusterIdentificationBDT.cc.

Member Enumeration Documentation

◆ ClusterVariable

Enumerator
cl3d_showerlength 
cl3d_coreshowerlength 
cl3d_firstlayer 
cl3d_maxlayer 
cl3d_seetot 
cl3d_seemax 
cl3d_spptot 
cl3d_sppmax 
cl3d_szz 
cl3d_srrtot 
cl3d_srrmax 
cl3d_srrmean 

Definition at line 44 of file HGCalTriggerClusterIdentificationBDT.cc.

44  {
45  cl3d_showerlength,
46  cl3d_coreshowerlength,
47  cl3d_firstlayer,
48  cl3d_maxlayer,
49  cl3d_seetot,
50  cl3d_seemax,
51  cl3d_spptot,
52  cl3d_sppmax,
53  cl3d_szz,
54  cl3d_srrtot,
55  cl3d_srrmax,
56  cl3d_srrmean
57  };

Constructor & Destructor Documentation

◆ HGCalTriggerClusterIdentificationBDT()

HGCalTriggerClusterIdentificationBDT::HGCalTriggerClusterIdentificationBDT ( )

◆ ~HGCalTriggerClusterIdentificationBDT()

HGCalTriggerClusterIdentificationBDT::~HGCalTriggerClusterIdentificationBDT ( )
inlineoverride

Definition at line 38 of file HGCalTriggerClusterIdentificationBDT.cc.

38 {};

Member Function Documentation

◆ category()

int HGCalTriggerClusterIdentificationBDT::category ( float  pt,
float  eta 
) const
private

Definition at line 159 of file HGCalTriggerClusterIdentificationBDT.cc.

159  {
160  for (unsigned cat = 0; cat < categories_.size(); cat++) {
161  if (categories_[cat].contains(pt, eta))
162  return static_cast<int>(cat);
163  }
164  return -1;
165 }

References eostools::cat(), categories_, edm::contains(), PVValHelper::eta, and DiDispStaMuonMonitor_cfi::pt.

Referenced by decision(), and value().

◆ clusterVariable()

float HGCalTriggerClusterIdentificationBDT::clusterVariable ( ClusterVariable  variable,
const l1t::HGCalMulticluster cluster 
) const
private

Definition at line 167 of file HGCalTriggerClusterIdentificationBDT.cc.

168  {
169  switch (variable) {
171  return cluster.showerLength();
173  return cluster.coreShowerLength();
175  return cluster.firstLayer();
177  return cluster.maxLayer();
179  return cluster.sigmaEtaEtaTot();
181  return cluster.sigmaEtaEtaMax();
183  return cluster.sigmaPhiPhiTot();
185  return cluster.sigmaPhiPhiMax();
187  return cluster.sigmaZZ();
189  return cluster.sigmaRRTot();
191  return cluster.sigmaRRMax();
193  return cluster.sigmaRRMean();
194  default:
195  break;
196  }
197  return 0.;
198 }

References cl3d_coreshowerlength, cl3d_firstlayer, cl3d_maxlayer, cl3d_seemax, cl3d_seetot, cl3d_showerlength, cl3d_sppmax, cl3d_spptot, cl3d_srrmax, cl3d_srrmean, cl3d_srrtot, cl3d_szz, l1t::HGCalClusterT< C >::coreShowerLength(), l1t::HGCalClusterT< C >::firstLayer(), l1t::HGCalClusterT< C >::maxLayer(), l1t::HGCalClusterT< C >::showerLength(), l1t::HGCalClusterT< C >::sigmaEtaEtaMax(), l1t::HGCalClusterT< C >::sigmaEtaEtaTot(), l1t::HGCalClusterT< C >::sigmaPhiPhiMax(), l1t::HGCalClusterT< C >::sigmaPhiPhiTot(), l1t::HGCalClusterT< C >::sigmaRRMax(), l1t::HGCalClusterT< C >::sigmaRRMean(), l1t::HGCalClusterT< C >::sigmaRRTot(), l1t::HGCalClusterT< C >::sigmaZZ(), and taus_updatedMVAIds_cff::variable.

Referenced by value().

◆ decision()

bool HGCalTriggerClusterIdentificationBDT::decision ( const l1t::HGCalMulticluster cluster) const
finalvirtual

Implements HGCalTriggerClusterIdentificationBase.

Definition at line 151 of file HGCalTriggerClusterIdentificationBDT.cc.

151  {
152  float bdt_output = value(cluster);
153  float pt = cluster.pt();
154  float eta = cluster.eta();
155  int cat = category(pt, eta);
156  return (cat != -1 ? bdt_output > working_points_.at(cat) : true);
157 }

References eostools::cat(), category(), PVValHelper::eta, reco::LeafCandidate::eta(), DiDispStaMuonMonitor_cfi::pt, reco::LeafCandidate::pt(), value(), and working_points_.

◆ initialize()

void HGCalTriggerClusterIdentificationBDT::initialize ( const edm::ParameterSet conf)
finalvirtual

Implements HGCalTriggerClusterIdentificationBase.

Definition at line 73 of file HGCalTriggerClusterIdentificationBDT.cc.

73  {
74  if (!bdts_.empty()) {
75  edm::LogWarning("HGCalTriggerClusterIdentificationBDT|Initialization") << "BDTs already initialized.";
76  return;
77  }
78  input_variables_ = conf.getParameter<std::vector<std::string>>("Inputs");
79  std::vector<std::string> bdt_files = conf.getParameter<std::vector<std::string>>("Weights");
80  std::vector<double> categories_etamin = conf.getParameter<std::vector<double>>("CategoriesEtaMin");
81  std::vector<double> categories_etamax = conf.getParameter<std::vector<double>>("CategoriesEtaMax");
82  std::vector<double> categories_ptmin = conf.getParameter<std::vector<double>>("CategoriesPtMin");
83  std::vector<double> categories_ptmax = conf.getParameter<std::vector<double>>("CategoriesPtMax");
84  working_points_ = conf.getParameter<std::vector<double>>("WorkingPoints");
85 
86  if (bdt_files.size() != categories_etamin.size() || categories_etamin.size() != categories_etamax.size() ||
87  categories_etamax.size() != categories_ptmin.size() || categories_ptmin.size() != categories_ptmax.size() ||
88  categories_ptmax.size() != working_points_.size()) {
89  throw cms::Exception("HGCalTriggerClusterIdentificationBDT|BadInitialization")
90  << "Inconsistent numbers of categories, BDT weight files and working points";
91  }
92  categories_.reserve(working_points_.size());
93  bdts_.reserve(working_points_.size());
94  for (unsigned cat = 0; cat < categories_etamin.size(); cat++) {
95  categories_.emplace_back(
96  categories_ptmin[cat], categories_ptmax[cat], categories_etamin[cat], categories_etamax[cat]);
97  }
98  std::vector<std::string> spectators = {};
99  for (const auto& file : bdt_files) {
100  bdts_.emplace_back(new TMVAEvaluator());
101  bdts_.back()->initialize("!Color:Silent:!Error",
102  "BDT::bdt",
105  spectators,
106  false,
107  false);
108  }
109 
110  // Transform input variable strings to enum values for later comparisons
111  input_variables_id_.reserve(input_variables_.size());
112  for (const auto& variable : input_variables_) {
113  if (variable == "cl3d_showerlength")
115  else if (variable == "cl3d_coreshowerlength")
117  else if (variable == "cl3d_firstlayer")
119  else if (variable == "cl3d_maxlayer")
121  else if (variable == "cl3d_seetot")
123  else if (variable == "cl3d_seemax")
125  else if (variable == "cl3d_spptot")
127  else if (variable == "cl3d_sppmax")
129  else if (variable == "cl3d_szz")
131  else if (variable == "cl3d_srrtot")
133  else if (variable == "cl3d_srrmax")
135  else if (variable == "cl3d_srrmean")
137  }
138 }

References bdts_, eostools::cat(), categories_, cl3d_coreshowerlength, cl3d_firstlayer, cl3d_maxlayer, cl3d_seemax, cl3d_seetot, cl3d_showerlength, cl3d_sppmax, cl3d_spptot, cl3d_srrmax, cl3d_srrmean, cl3d_srrtot, cl3d_szz, Exception, FrontierConditions_GlobalTag_cff::file, contentValuesFiles::fullPath, edm::ParameterSet::getParameter(), input_variables_, input_variables_id_, candidateCombinedMVAV2Computer_cfi::spectators, taus_updatedMVAIds_cff::variable, and working_points_.

◆ value()

float HGCalTriggerClusterIdentificationBDT::value ( const l1t::HGCalMulticluster cluster) const
finalvirtual

Implements HGCalTriggerClusterIdentificationBase.

Definition at line 140 of file HGCalTriggerClusterIdentificationBDT.cc.

140  {
141  std::map<std::string, float> inputs;
142  for (unsigned i = 0; i < input_variables_.size(); i++) {
144  }
145  float pt = cluster.pt();
146  float eta = cluster.eta();
147  int cat = category(pt, eta);
148  return (cat != -1 ? bdts_.at(cat)->evaluate(inputs) : -999.);
149 }

References bdts_, eostools::cat(), category(), clusterVariable(), PVValHelper::eta, reco::LeafCandidate::eta(), mps_fire::i, input_variables_, input_variables_id_, PixelMapPlotter::inputs, DiDispStaMuonMonitor_cfi::pt, and reco::LeafCandidate::pt().

Referenced by average.Average::average(), and decision().

Member Data Documentation

◆ bdts_

std::vector<std::unique_ptr<TMVAEvaluator> > HGCalTriggerClusterIdentificationBDT::bdts_
private

Definition at line 59 of file HGCalTriggerClusterIdentificationBDT.cc.

Referenced by initialize(), and value().

◆ categories_

std::vector<Category> HGCalTriggerClusterIdentificationBDT::categories_
private

Definition at line 58 of file HGCalTriggerClusterIdentificationBDT.cc.

Referenced by category(), and initialize().

◆ input_variables_

std::vector<std::string> HGCalTriggerClusterIdentificationBDT::input_variables_
private

Definition at line 61 of file HGCalTriggerClusterIdentificationBDT.cc.

Referenced by initialize(), and value().

◆ input_variables_id_

std::vector<ClusterVariable> HGCalTriggerClusterIdentificationBDT::input_variables_id_
private

Definition at line 62 of file HGCalTriggerClusterIdentificationBDT.cc.

Referenced by initialize(), and value().

◆ working_points_

std::vector<double> HGCalTriggerClusterIdentificationBDT::working_points_
private

Definition at line 60 of file HGCalTriggerClusterIdentificationBDT.cc.

Referenced by decision(), and initialize().

HGCalTriggerClusterIdentificationBDT::clusterVariable
float clusterVariable(ClusterVariable, const l1t::HGCalMulticluster &) const
Definition: HGCalTriggerClusterIdentificationBDT.cc:167
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_seemax
mps_fire.i
i
Definition: mps_fire.py:355
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_szz
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_maxlayer
candidateCombinedMVAV2Computer_cfi.spectators
spectators
Definition: candidateCombinedMVAV2Computer_cfi.py:15
eostools.cat
def cat(path)
Definition: eostools.py:401
l1t::HGCalClusterT::showerLength
int showerLength() const
Definition: HGCalClusterT.h:149
l1t::HGCalClusterT::sigmaEtaEtaTot
float sigmaEtaEtaTot() const
Definition: HGCalClusterT.h:156
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_spptot
l1t::HGCalClusterT::sigmaRRTot
float sigmaRRTot() const
Definition: HGCalClusterT.h:159
TMVAEvaluator
Definition: TMVAEvaluator.h:16
edm::FileInPath
Definition: FileInPath.h:64
l1t::HGCalClusterT::sigmaPhiPhiMax
float sigmaPhiPhiMax() const
Definition: HGCalClusterT.h:155
PVValHelper::eta
Definition: PVValidationHelpers.h:69
l1t::HGCalClusterT::sigmaPhiPhiTot
float sigmaPhiPhiTot() const
Definition: HGCalClusterT.h:157
HGCalTriggerClusterIdentificationBDT::input_variables_id_
std::vector< ClusterVariable > input_variables_id_
Definition: HGCalTriggerClusterIdentificationBDT.cc:62
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_seetot
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_srrmean
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_firstlayer
edm::LogWarning
Definition: MessageLogger.h:141
HGCalTriggerClusterIdentificationBDT::working_points_
std::vector< double > working_points_
Definition: HGCalTriggerClusterIdentificationBDT.cc:60
HGCalTriggerClusterIdentificationBDT::input_variables_
std::vector< std::string > input_variables_
Definition: HGCalTriggerClusterIdentificationBDT.cc:61
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
HGCalTriggerClusterIdentificationBDT::bdts_
std::vector< std::unique_ptr< TMVAEvaluator > > bdts_
Definition: HGCalTriggerClusterIdentificationBDT.cc:59
l1t::HGCalClusterT::firstLayer
int firstLayer() const
Definition: HGCalClusterT.h:151
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
edm::contains
bool contains(EventRange const &lh, EventID const &rh)
Definition: EventRange.cc:37
l1t::HGCalClusterT::coreShowerLength
int coreShowerLength() const
Definition: HGCalClusterT.h:150
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_showerlength
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HGCalTriggerClusterIdentificationBDT::categories_
std::vector< Category > categories_
Definition: HGCalTriggerClusterIdentificationBDT.cc:58
l1t::HGCalClusterT::maxLayer
int maxLayer() const
Definition: HGCalClusterT.h:152
HGCalTriggerClusterIdentificationBDT::category
int category(float pt, float eta) const
Definition: HGCalTriggerClusterIdentificationBDT.cc:159
taus_updatedMVAIds_cff.variable
variable
Definition: taus_updatedMVAIds_cff.py:32
l1t::HGCalClusterT::sigmaRRMean
float sigmaRRMean() const
Definition: HGCalClusterT.h:161
l1t::HGCalClusterT::sigmaRRMax
float sigmaRRMax() const
Definition: HGCalClusterT.h:160
l1t::HGCalClusterT::sigmaZZ
float sigmaZZ() const
Definition: HGCalClusterT.h:158
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_srrmax
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_coreshowerlength
HGCalTriggerClusterIdentificationBase::HGCalTriggerClusterIdentificationBase
HGCalTriggerClusterIdentificationBase()
Definition: HGCalTriggerClusterIdentificationBase.h:9
Exception
Definition: hltDiff.cc:246
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_srrtot
HGCalTriggerClusterIdentificationBDT::ClusterVariable::cl3d_sppmax
HGCalTriggerClusterIdentificationBDT::value
float value(const l1t::HGCalMulticluster &cluster) const final
Definition: HGCalTriggerClusterIdentificationBDT.cc:140
l1t::HGCalClusterT::sigmaEtaEtaMax
float sigmaEtaEtaMax() const
Definition: HGCalClusterT.h:154