CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
PileupJetIdAlgo::AlgoGBRForestsAndConstants Class Reference

#include <PileupJetIdAlgo.h>

Public Types

typedef float array_t[3][5][4]
 

Public Member Functions

 AlgoGBRForestsAndConstants (edm::ParameterSet const &, bool runMvas)
 
array_t const & betaStarCut () const
 
bool cutBased () const
 
bool etaBinnedWeights () const
 
std::vector< std::unique_ptr< const GBRForest > > const & etaReader () const
 
std::vector< double > const & jEtaMax () const
 
std::vector< double > const & jEtaMin () const
 
std::string const & label () const
 
array_t const & mvacut () const
 
int nEtaBins () const
 
std::unique_ptr< const GBRForest > const & reader () const
 
array_t const & rmsCut () const
 
bool runMvas () const
 
std::vector< std::vector< std::string > > const & tmvaEtaVariables () const
 
std::string const & tmvaMethod () const
 
std::vector< std::string > const & tmvaVariables () const
 

Private Attributes

float betaStarCut_ [3][5][4]
 
bool cutBased_
 
bool etaBinnedWeights_
 
std::vector< std::unique_ptr< const GBRForest > > etaReader_
 
std::vector< double > jEtaMax_
 
std::vector< double > jEtaMin_
 
std::string label_
 
float mvacut_ [3][5][4]
 
int nEtaBins_
 
std::unique_ptr< const GBRForestreader_
 
float rmsCut_ [3][5][4]
 
bool runMvas_
 
std::vector< std::vector< std::string > > tmvaEtaVariables_
 
std::string tmvaMethod_
 
std::map< std::string, std::string > tmvaNames_
 
std::vector< std::string > tmvaVariables_
 

Detailed Description

Definition at line 56 of file PileupJetIdAlgo.h.

Member Typedef Documentation

◆ array_t

typedef float PileupJetIdAlgo::AlgoGBRForestsAndConstants::array_t[3][5][4]

Definition at line 73 of file PileupJetIdAlgo.h.

Constructor & Destructor Documentation

◆ AlgoGBRForestsAndConstants()

PileupJetIdAlgo::AlgoGBRForestsAndConstants::AlgoGBRForestsAndConstants ( edm::ParameterSet const &  ps,
bool  runMvas 
)

Definition at line 21 of file PileupJetIdAlgo.cc.

22  : cutBased_(ps.getParameter<bool>("cutBased")),
23  etaBinnedWeights_(false),
25  nEtaBins_(0),
26  label_(ps.getParameter<std::string>("label")),
27  mvacut_{},
28  rmsCut_{},
29  betaStarCut_{} {
30  std::vector<edm::FileInPath> tmvaEtaWeights;
31  std::vector<std::string> tmvaSpectators;
32  int version;
33 
34  if (!cutBased_) {
35  etaBinnedWeights_ = ps.getParameter<bool>("etaBinnedWeights");
36  if (etaBinnedWeights_) {
37  const std::vector<edm::ParameterSet>& trainings = ps.getParameter<std::vector<edm::ParameterSet> >("trainings");
38  nEtaBins_ = ps.getParameter<int>("nEtaBins");
39  for (int v = 0; v < nEtaBins_; v++) {
40  tmvaEtaWeights.push_back(trainings.at(v).getParameter<edm::FileInPath>("tmvaWeights"));
41  jEtaMin_.push_back(trainings.at(v).getParameter<double>("jEtaMin"));
42  jEtaMax_.push_back(trainings.at(v).getParameter<double>("jEtaMax"));
43  }
44  for (int v = 0; v < nEtaBins_; v++) {
45  tmvaEtaVariables_.push_back(trainings.at(v).getParameter<std::vector<std::string> >("tmvaVariables"));
46  }
47  } else {
48  tmvaVariables_ = ps.getParameter<std::vector<std::string> >("tmvaVariables");
49  }
50  tmvaMethod_ = ps.getParameter<std::string>("tmvaMethod");
51  tmvaSpectators = ps.getParameter<std::vector<std::string> >("tmvaSpectators");
52  version = ps.getParameter<int>("version");
53  } else {
54  version = USER;
55  }
56 
57  edm::ParameterSet jetConfig = ps.getParameter<edm::ParameterSet>("JetIdParams");
58  for (int i0 = 0; i0 < 3; i0++) {
59  std::string lCutType = "Tight";
61  lCutType = "Medium";
63  lCutType = "Loose";
64  int nCut = 1;
65  if (cutBased_)
66  nCut++;
67  for (int i1 = 0; i1 < nCut; i1++) {
68  std::string lFullCutType = lCutType;
69  if (cutBased_ && i1 == 0)
70  lFullCutType = "BetaStar" + lCutType;
71  if (cutBased_ && i1 == 1)
72  lFullCutType = "RMS" + lCutType;
73  std::vector<double> pt010 = jetConfig.getParameter<std::vector<double> >(("Pt010_" + lFullCutType).c_str());
74  std::vector<double> pt1020 = jetConfig.getParameter<std::vector<double> >(("Pt1020_" + lFullCutType).c_str());
75  std::vector<double> pt2030 = jetConfig.getParameter<std::vector<double> >(("Pt2030_" + lFullCutType).c_str());
76  std::vector<double> pt3040 = jetConfig.getParameter<std::vector<double> >(("Pt3040_" + lFullCutType).c_str());
77  std::vector<double> pt4050 = jetConfig.getParameter<std::vector<double> >(("Pt4050_" + lFullCutType).c_str());
78  if (!cutBased_) {
79  for (int i2 = 0; i2 < 4; i2++)
80  mvacut_[i0][0][i2] = pt010[i2];
81  for (int i2 = 0; i2 < 4; i2++)
82  mvacut_[i0][1][i2] = pt1020[i2];
83  for (int i2 = 0; i2 < 4; i2++)
84  mvacut_[i0][2][i2] = pt2030[i2];
85  for (int i2 = 0; i2 < 4; i2++)
86  mvacut_[i0][3][i2] = pt3040[i2];
87  for (int i2 = 0; i2 < 4; i2++)
88  mvacut_[i0][4][i2] = pt4050[i2];
89  }
90  if (cutBased_ && i1 == 0) {
91  for (int i2 = 0; i2 < 4; i2++)
92  betaStarCut_[i0][0][i2] = pt010[i2];
93  for (int i2 = 0; i2 < 4; i2++)
94  betaStarCut_[i0][1][i2] = pt1020[i2];
95  for (int i2 = 0; i2 < 4; i2++)
96  betaStarCut_[i0][2][i2] = pt2030[i2];
97  for (int i2 = 0; i2 < 4; i2++)
98  betaStarCut_[i0][3][i2] = pt3040[i2];
99  for (int i2 = 0; i2 < 4; i2++)
100  betaStarCut_[i0][4][i2] = pt4050[i2];
101  }
102  if (cutBased_ && i1 == 1) {
103  for (int i2 = 0; i2 < 4; i2++)
104  rmsCut_[i0][0][i2] = pt010[i2];
105  for (int i2 = 0; i2 < 4; i2++)
106  rmsCut_[i0][1][i2] = pt1020[i2];
107  for (int i2 = 0; i2 < 4; i2++)
108  rmsCut_[i0][2][i2] = pt2030[i2];
109  for (int i2 = 0; i2 < 4; i2++)
110  rmsCut_[i0][3][i2] = pt3040[i2];
111  for (int i2 = 0; i2 < 4; i2++)
112  rmsCut_[i0][4][i2] = pt4050[i2];
113  }
114  }
115  }
116 
117  if (!cutBased_) {
118  assert(tmvaMethod_.empty() || ((!tmvaVariables_.empty() || (!tmvaEtaVariables_.empty())) && version == USER));
119  }
120 
121  if ((!cutBased_) && (runMvas_)) {
122  if (etaBinnedWeights_) {
123  for (int v = 0; v < nEtaBins_; v++) {
124  etaReader_.push_back(createGBRForest(tmvaEtaWeights.at(v)));
125  }
126  } else {
127  reader_ = createGBRForest(ps.getParameter<std::string>("tmvaWeights"));
128  }
129  }
130 }

Member Function Documentation

◆ betaStarCut()

array_t const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::betaStarCut ( ) const
inline

Definition at line 76 of file PileupJetIdAlgo.h.

76 { return betaStarCut_; }

References betaStarCut_.

◆ cutBased()

bool PileupJetIdAlgo::AlgoGBRForestsAndConstants::cutBased ( ) const
inline

Definition at line 62 of file PileupJetIdAlgo.h.

62 { return cutBased_; }

References cutBased_.

Referenced by PileupJetIdAlgo::runMva().

◆ etaBinnedWeights()

bool PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaBinnedWeights ( ) const
inline

Definition at line 63 of file PileupJetIdAlgo.h.

63 { return etaBinnedWeights_; }

References etaBinnedWeights_.

Referenced by PileupJetIdAlgo::runMva().

◆ etaReader()

std::vector<std::unique_ptr<const GBRForest> > const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaReader ( ) const
inline

Definition at line 61 of file PileupJetIdAlgo.h.

61 { return etaReader_; }

References etaReader_.

Referenced by PileupJetIdAlgo::runMva().

◆ jEtaMax()

std::vector<double> const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMax ( ) const
inline

Definition at line 67 of file PileupJetIdAlgo.h.

67 { return jEtaMax_; }

References jEtaMax_.

Referenced by PileupJetIdAlgo::runMva().

◆ jEtaMin()

std::vector<double> const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMin ( ) const
inline

Definition at line 66 of file PileupJetIdAlgo.h.

66 { return jEtaMin_; }

References jEtaMin_.

Referenced by PileupJetIdAlgo::runMva().

◆ label()

std::string const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::label ( ) const
inline

Definition at line 68 of file PileupJetIdAlgo.h.

68 { return label_; }

References label_.

◆ mvacut()

array_t const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::mvacut ( ) const
inline

Definition at line 74 of file PileupJetIdAlgo.h.

74 { return mvacut_; }

References mvacut_.

Referenced by PileupJetIdAlgo::computeIDflag().

◆ nEtaBins()

int PileupJetIdAlgo::AlgoGBRForestsAndConstants::nEtaBins ( ) const
inline

Definition at line 65 of file PileupJetIdAlgo.h.

65 { return nEtaBins_; }

References nEtaBins_.

Referenced by PileupJetIdAlgo::runMva().

◆ reader()

std::unique_ptr<const GBRForest> const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::reader ( ) const
inline

Definition at line 60 of file PileupJetIdAlgo.h.

60 { return reader_; }

References reader_.

Referenced by PileupJetIdAlgo::runMva().

◆ rmsCut()

array_t const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::rmsCut ( ) const
inline

Definition at line 75 of file PileupJetIdAlgo.h.

75 { return rmsCut_; }

References rmsCut_.

◆ runMvas()

bool PileupJetIdAlgo::AlgoGBRForestsAndConstants::runMvas ( ) const
inline

Definition at line 64 of file PileupJetIdAlgo.h.

64 { return runMvas_; }

References runMvas_.

Referenced by PileupJetIdAlgo::computeIdVariables().

◆ tmvaEtaVariables()

std::vector<std::vector<std::string> > const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaEtaVariables ( ) const
inline

Definition at line 71 of file PileupJetIdAlgo.h.

71 { return tmvaEtaVariables_; }

References tmvaEtaVariables_.

Referenced by PileupJetIdAlgo::runMva().

◆ tmvaMethod()

std::string const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaMethod ( ) const
inline

Definition at line 69 of file PileupJetIdAlgo.h.

69 { return tmvaMethod_; }

References tmvaMethod_.

Referenced by PileupJetIdAlgo::method().

◆ tmvaVariables()

std::vector<std::string> const& PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaVariables ( ) const
inline

Definition at line 70 of file PileupJetIdAlgo.h.

70 { return tmvaVariables_; }

References tmvaVariables_.

Referenced by PileupJetIdAlgo::runMva().

Member Data Documentation

◆ betaStarCut_

float PileupJetIdAlgo::AlgoGBRForestsAndConstants::betaStarCut_[3][5][4]
private

Definition at line 94 of file PileupJetIdAlgo.h.

Referenced by betaStarCut().

◆ cutBased_

bool PileupJetIdAlgo::AlgoGBRForestsAndConstants::cutBased_
private

Definition at line 81 of file PileupJetIdAlgo.h.

Referenced by cutBased().

◆ etaBinnedWeights_

bool PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaBinnedWeights_
private

Definition at line 82 of file PileupJetIdAlgo.h.

Referenced by etaBinnedWeights().

◆ etaReader_

std::vector<std::unique_ptr<const GBRForest> > PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaReader_
private

Definition at line 80 of file PileupJetIdAlgo.h.

Referenced by etaReader().

◆ jEtaMax_

std::vector<double> PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMax_
private

Definition at line 86 of file PileupJetIdAlgo.h.

Referenced by jEtaMax().

◆ jEtaMin_

std::vector<double> PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMin_
private

Definition at line 85 of file PileupJetIdAlgo.h.

Referenced by jEtaMin().

◆ label_

std::string PileupJetIdAlgo::AlgoGBRForestsAndConstants::label_
private

◆ mvacut_

float PileupJetIdAlgo::AlgoGBRForestsAndConstants::mvacut_[3][5][4]
private

Definition at line 92 of file PileupJetIdAlgo.h.

Referenced by mvacut().

◆ nEtaBins_

int PileupJetIdAlgo::AlgoGBRForestsAndConstants::nEtaBins_
private

Definition at line 84 of file PileupJetIdAlgo.h.

Referenced by nEtaBins().

◆ reader_

std::unique_ptr<const GBRForest> PileupJetIdAlgo::AlgoGBRForestsAndConstants::reader_
private

Definition at line 79 of file PileupJetIdAlgo.h.

Referenced by reader().

◆ rmsCut_

float PileupJetIdAlgo::AlgoGBRForestsAndConstants::rmsCut_[3][5][4]
private

Definition at line 93 of file PileupJetIdAlgo.h.

Referenced by rmsCut().

◆ runMvas_

bool PileupJetIdAlgo::AlgoGBRForestsAndConstants::runMvas_
private

Definition at line 83 of file PileupJetIdAlgo.h.

Referenced by runMvas().

◆ tmvaEtaVariables_

std::vector<std::vector<std::string> > PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaEtaVariables_
private

Definition at line 90 of file PileupJetIdAlgo.h.

Referenced by tmvaEtaVariables().

◆ tmvaMethod_

std::string PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaMethod_
private

Definition at line 88 of file PileupJetIdAlgo.h.

Referenced by tmvaMethod().

◆ tmvaNames_

std::map<std::string, std::string> PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaNames_
private

Definition at line 96 of file PileupJetIdAlgo.h.

◆ tmvaVariables_

std::vector<std::string> PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaVariables_
private

Definition at line 89 of file PileupJetIdAlgo.h.

Referenced by tmvaVariables().

PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMin_
std::vector< double > jEtaMin_
Definition: PileupJetIdAlgo.h:85
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
PileupJetIdAlgo::USER
Definition: PileupJetIdAlgo.h:24
PileupJetIdAlgo::AlgoGBRForestsAndConstants::runMvas
bool runMvas() const
Definition: PileupJetIdAlgo.h:64
PileupJetIDParams_cfi.trainings
trainings
Definition: PileupJetIDParams_cfi.py:12
PileupJetIdAlgo::AlgoGBRForestsAndConstants::cutBased_
bool cutBased_
Definition: PileupJetIdAlgo.h:81
hltPUIdAlgo_cff.tmvaSpectators
tmvaSpectators
Definition: hltPUIdAlgo_cff.py:52
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
cms::cuda::assert
assert(be >=bs)
createGBRForest
std::unique_ptr< const GBRForest > createGBRForest(const std::string &weightsFile)
Definition: GBRForestTools.cc:244
findQualityFiles.v
v
Definition: findQualityFiles.py:179
PileupJetIdAlgo::AlgoGBRForestsAndConstants::mvacut_
float mvacut_[3][5][4]
Definition: PileupJetIdAlgo.h:92
PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaBinnedWeights_
bool etaBinnedWeights_
Definition: PileupJetIdAlgo.h:82
PileupJetIdAlgo::AlgoGBRForestsAndConstants::reader_
std::unique_ptr< const GBRForest > reader_
Definition: PileupJetIdAlgo.h:79
edm::FileInPath
Definition: FileInPath.h:64
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PileupJetIdAlgo::AlgoGBRForestsAndConstants::nEtaBins_
int nEtaBins_
Definition: PileupJetIdAlgo.h:84
edm::ParameterSet
Definition: ParameterSet.h:47
PileupJetIdAlgo::AlgoGBRForestsAndConstants::runMvas_
bool runMvas_
Definition: PileupJetIdAlgo.h:83
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaEtaVariables_
std::vector< std::vector< std::string > > tmvaEtaVariables_
Definition: PileupJetIdAlgo.h:90
PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaReader_
std::vector< std::unique_ptr< const GBRForest > > etaReader_
Definition: PileupJetIdAlgo.h:80
PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMax_
std::vector< double > jEtaMax_
Definition: PileupJetIdAlgo.h:86
PileupJetIdAlgo::AlgoGBRForestsAndConstants::rmsCut_
float rmsCut_[3][5][4]
Definition: PileupJetIdAlgo.h:93
PileupJetIdentifier::kLoose
Definition: PileupJetIdentifier.h:87
PileupJetIdAlgo::AlgoGBRForestsAndConstants::betaStarCut_
float betaStarCut_[3][5][4]
Definition: PileupJetIdAlgo.h:94
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaVariables_
std::vector< std::string > tmvaVariables_
Definition: PileupJetIdAlgo.h:89
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaMethod_
std::string tmvaMethod_
Definition: PileupJetIdAlgo.h:88
PileupJetIdentifier::kMedium
Definition: PileupJetIdentifier.h:87
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
PileupJetIdAlgo::AlgoGBRForestsAndConstants::label_
std::string label_
Definition: PileupJetIdAlgo.h:87