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 61 of file PileupJetIdAlgo.h.

Member Typedef Documentation

◆ array_t

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

Definition at line 78 of file PileupJetIdAlgo.h.

Constructor & Destructor Documentation

◆ AlgoGBRForestsAndConstants()

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

Definition at line 22 of file PileupJetIdAlgo.cc.

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

Member Function Documentation

◆ betaStarCut()

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

Definition at line 81 of file PileupJetIdAlgo.h.

References betaStarCut_.

◆ cutBased()

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

Definition at line 67 of file PileupJetIdAlgo.h.

References cutBased_.

Referenced by PileupJetIdAlgo::runMva().

◆ etaBinnedWeights()

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

Definition at line 68 of file PileupJetIdAlgo.h.

References etaBinnedWeights_.

Referenced by PileupJetIdAlgo::runMva().

◆ etaReader()

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

Definition at line 66 of file PileupJetIdAlgo.h.

References etaReader_.

Referenced by PileupJetIdAlgo::runMva().

66 { return etaReader_; }
std::vector< std::unique_ptr< const GBRForest > > etaReader_

◆ jEtaMax()

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

Definition at line 72 of file PileupJetIdAlgo.h.

References jEtaMax_.

Referenced by PileupJetIdAlgo::runMva().

72 { return jEtaMax_; }

◆ jEtaMin()

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

Definition at line 71 of file PileupJetIdAlgo.h.

References jEtaMin_.

Referenced by PileupJetIdAlgo::runMva().

71 { return jEtaMin_; }

◆ label()

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

Definition at line 73 of file PileupJetIdAlgo.h.

References label_.

◆ mvacut()

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

Definition at line 79 of file PileupJetIdAlgo.h.

References mvacut_.

Referenced by PileupJetIdAlgo::computeIDflag().

◆ nEtaBins()

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

Definition at line 70 of file PileupJetIdAlgo.h.

References nEtaBins_.

Referenced by PileupJetIdAlgo::runMva().

◆ reader()

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

Definition at line 65 of file PileupJetIdAlgo.h.

References reader_.

Referenced by PileupJetIdAlgo::runMva().

65 { return reader_; }
std::unique_ptr< const GBRForest > reader_

◆ rmsCut()

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

Definition at line 80 of file PileupJetIdAlgo.h.

References rmsCut_.

◆ runMvas()

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

Definition at line 69 of file PileupJetIdAlgo.h.

References runMvas_.

Referenced by PileupJetIdAlgo::computeIdVariables().

◆ tmvaEtaVariables()

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

Definition at line 76 of file PileupJetIdAlgo.h.

References tmvaEtaVariables_.

Referenced by PileupJetIdAlgo::runMva().

76 { return tmvaEtaVariables_; }
std::vector< std::vector< std::string > > tmvaEtaVariables_

◆ tmvaMethod()

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

Definition at line 74 of file PileupJetIdAlgo.h.

References tmvaMethod_.

Referenced by PileupJetIdAlgo::method().

◆ tmvaVariables()

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

Definition at line 75 of file PileupJetIdAlgo.h.

References tmvaVariables_.

Referenced by PileupJetIdAlgo::runMva().

75 { return tmvaVariables_; }
std::vector< std::string > tmvaVariables_

Member Data Documentation

◆ betaStarCut_

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

Definition at line 99 of file PileupJetIdAlgo.h.

Referenced by betaStarCut().

◆ cutBased_

bool PileupJetIdAlgo::AlgoGBRForestsAndConstants::cutBased_
private

Definition at line 86 of file PileupJetIdAlgo.h.

Referenced by cutBased().

◆ etaBinnedWeights_

bool PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaBinnedWeights_
private

Definition at line 87 of file PileupJetIdAlgo.h.

Referenced by etaBinnedWeights().

◆ etaReader_

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

Definition at line 85 of file PileupJetIdAlgo.h.

Referenced by etaReader().

◆ jEtaMax_

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

Definition at line 91 of file PileupJetIdAlgo.h.

Referenced by jEtaMax().

◆ jEtaMin_

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

Definition at line 90 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 97 of file PileupJetIdAlgo.h.

Referenced by mvacut().

◆ nEtaBins_

int PileupJetIdAlgo::AlgoGBRForestsAndConstants::nEtaBins_
private

Definition at line 89 of file PileupJetIdAlgo.h.

Referenced by nEtaBins().

◆ reader_

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

Definition at line 84 of file PileupJetIdAlgo.h.

Referenced by reader().

◆ rmsCut_

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

Definition at line 98 of file PileupJetIdAlgo.h.

Referenced by rmsCut().

◆ runMvas_

bool PileupJetIdAlgo::AlgoGBRForestsAndConstants::runMvas_
private

Definition at line 88 of file PileupJetIdAlgo.h.

Referenced by runMvas().

◆ tmvaEtaVariables_

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

Definition at line 95 of file PileupJetIdAlgo.h.

Referenced by tmvaEtaVariables().

◆ tmvaMethod_

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

Definition at line 93 of file PileupJetIdAlgo.h.

Referenced by tmvaMethod().

◆ tmvaNames_

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

Definition at line 101 of file PileupJetIdAlgo.h.

◆ tmvaVariables_

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

Definition at line 94 of file PileupJetIdAlgo.h.

Referenced by tmvaVariables().