CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
l1tpf::HGC3DClusterEgID Class Reference

#include <HGC3DClusterEgID.h>

Classes

class  Var
 

Public Member Functions

 HGC3DClusterEgID (const edm::ParameterSet &pset)
 
std::string method ()
 
float passID (l1t::HGCalMulticluster c, l1t::PFCluster &cpf)
 
void prepareTMVA ()
 

Private Attributes

bool isPUFilter_
 
std::string method_
 
StringCutObjectSelector< l1t::HGCalMulticlusterpreselection_
 
std::unique_ptr< TMVA::Reader > reader_
 
std::vector< Varvariables_
 
std::string weightsFile_
 
StringObjectFunction< l1t::HGCalMulticlusterwp_
 

Detailed Description

Definition at line 21 of file HGC3DClusterEgID.h.

Constructor & Destructor Documentation

◆ HGC3DClusterEgID()

l1tpf::HGC3DClusterEgID::HGC3DClusterEgID ( const edm::ParameterSet pset)

Definition at line 4 of file HGC3DClusterEgID.cc.

5  : isPUFilter_(pset.getParameter<bool>("isPUFilter")),
6  preselection_(pset.getParameter<std::string>("preselection")),
7  method_(pset.getParameter<std::string>("method")),
8  weightsFile_(pset.getParameter<std::string>("weightsFile")),
9  reader_(new TMVA::Reader()),
10  wp_(pset.getParameter<std::string>("wp")) {
11  // first create all the variables
12  for (const auto &psvar : pset.getParameter<std::vector<edm::ParameterSet>>("variables")) {
13  variables_.emplace_back(psvar.getParameter<std::string>("name"), psvar.getParameter<std::string>("value"));
14  }
15 }

References muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, and variables_.

Member Function Documentation

◆ method()

std::string l1tpf::HGC3DClusterEgID::method ( )
inline

Definition at line 29 of file HGC3DClusterEgID.h.

29 { return method_; }

References method_.

Referenced by l1tpf::PFClusterProducerFromHGC3DClusters::PFClusterProducerFromHGC3DClusters().

◆ passID()

float l1tpf::HGC3DClusterEgID::passID ( l1t::HGCalMulticluster  c,
l1t::PFCluster cpf 
)

Definition at line 28 of file HGC3DClusterEgID.cc.

28  {
29  if (preselection_(c)) {
30  for (auto &var : variables_)
31  var.fill(c);
32  float mvaOut = reader_->EvaluateMVA(method_);
33  if (isPUFilter_)
34  cpf.setEgVsPUMVAOut(mvaOut);
35  else
36  cpf.setEgVsPionMVAOut(mvaOut);
37  return (mvaOut > wp_(c) ? 1 : 0);
38  } else {
39  if (isPUFilter_)
40  cpf.setEgVsPUMVAOut(-100.0);
41  else
42  cpf.setEgVsPionMVAOut(-100.0);
43  return 0;
44  }
45 }

References c, l1t::PFCluster::setEgVsPionMVAOut(), l1t::PFCluster::setEgVsPUMVAOut(), and trigObjTnPSource_cfi::var.

◆ prepareTMVA()

void l1tpf::HGC3DClusterEgID::prepareTMVA ( )

Definition at line 17 of file HGC3DClusterEgID.cc.

17  {
18  // Declare the variables
19  for (auto &var : variables_)
20  var.declare(*reader_);
21  // then read the weights
22  if (weightsFile_[0] != '/' && weightsFile_[0] != '.') {
24  }
26 }

References edm::FileInPath::fullPath(), reco::details::loadTMVAWeights(), and trigObjTnPSource_cfi::var.

Referenced by l1tpf::PFClusterProducerFromHGC3DClusters::PFClusterProducerFromHGC3DClusters().

Member Data Documentation

◆ isPUFilter_

bool l1tpf::HGC3DClusterEgID::isPUFilter_
private

Definition at line 44 of file HGC3DClusterEgID.h.

◆ method_

std::string l1tpf::HGC3DClusterEgID::method_
private

Definition at line 47 of file HGC3DClusterEgID.h.

Referenced by method().

◆ preselection_

StringCutObjectSelector<l1t::HGCalMulticluster> l1tpf::HGC3DClusterEgID::preselection_
private

Definition at line 45 of file HGC3DClusterEgID.h.

◆ reader_

std::unique_ptr<TMVA::Reader> l1tpf::HGC3DClusterEgID::reader_
private

Definition at line 48 of file HGC3DClusterEgID.h.

◆ variables_

std::vector<Var> l1tpf::HGC3DClusterEgID::variables_
private

Definition at line 46 of file HGC3DClusterEgID.h.

Referenced by HGC3DClusterEgID().

◆ weightsFile_

std::string l1tpf::HGC3DClusterEgID::weightsFile_
private

Definition at line 47 of file HGC3DClusterEgID.h.

◆ wp_

StringObjectFunction<l1t::HGCalMulticluster> l1tpf::HGC3DClusterEgID::wp_
private

Definition at line 49 of file HGC3DClusterEgID.h.

l1tpf::HGC3DClusterEgID::variables_
std::vector< Var > variables_
Definition: HGC3DClusterEgID.h:46
l1tpf::HGC3DClusterEgID::wp_
StringObjectFunction< l1t::HGCalMulticluster > wp_
Definition: HGC3DClusterEgID.h:49
l1tpf::HGC3DClusterEgID::reader_
std::unique_ptr< TMVA::Reader > reader_
Definition: HGC3DClusterEgID.h:48
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
edm::FileInPath
Definition: FileInPath.h:64
l1tpf::HGC3DClusterEgID::isPUFilter_
bool isPUFilter_
Definition: HGC3DClusterEgID.h:44
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
l1t::PFCluster::setEgVsPionMVAOut
void setEgVsPionMVAOut(float egVsPionMVAOut)
Definition: PFCluster.h:63
l1tpf::HGC3DClusterEgID::weightsFile_
std::string weightsFile_
Definition: HGC3DClusterEgID.h:47
l1tpf::HGC3DClusterEgID::preselection_
StringCutObjectSelector< l1t::HGCalMulticluster > preselection_
Definition: HGC3DClusterEgID.h:45
reco::details::loadTMVAWeights
TMVA::IMethod * loadTMVAWeights(TMVA::Reader *reader, const std::string &method, const std::string &weightFile, bool verbose=false)
Definition: TMVAZipReader.cc:52
l1t::PFCluster::setEgVsPUMVAOut
void setEgVsPUMVAOut(float egVsPUMVAOut)
Definition: PFCluster.h:66
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:161
l1tpf::HGC3DClusterEgID::method_
std::string method_
Definition: HGC3DClusterEgID.h:47
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27