CMS 3D CMS Logo

MVAJetPuId.h
Go to the documentation of this file.
1 #ifndef RecoJets_JetProducers_plugins_MVAJetPuId_h
2 #define RecoJets_JetProducers_plugins_MVAJetPuId_h
3 
8 
9 #include "TMVA/Tools.h"
10 #include "TMVA/Reader.h"
11 #include "TMVA/Tools.h"
12 #include "TMVA/Reader.h"
13 
15 
16 class MVAJetPuId {
17  static constexpr int NWPs = 3;
18  static constexpr int NPts = 4;
19  static constexpr int NEtas = 4;
20 
21 public:
22  enum version_t { USER = -1, CATEv0 = 0 };
23 
25  const std::string &tmvaWeight = "",
26  const std::string &tmvaMethod = "",
27  Float_t impactParTkThreshod_ = 1.,
28  const std::vector<std::string> &tmvaVariables = std::vector<std::string>());
29  MVAJetPuId(const edm::ParameterSet &ps);
30  ~MVAJetPuId();
31 
33  float jec,
34  const reco::Vertex *,
35  const reco::VertexCollection &,
36  double rho,
37  bool calculateMva = false);
38 
39  void set(const PileupJetIdentifier &);
41  const std::string method() const { return tmvaMethod_; }
42 
43  std::string dumpVariables() const;
44 
45  typedef std::map<std::string, std::pair<float *, float> > variables_list_t;
46 
47  std::pair<int, int> getJetIdKey(float jetPt, float jetEta);
48  int computeCutIDflag(float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta);
49  int computeIDflag(float mva, float jetPt, float jetEta);
50  int computeIDflag(float mva, int ptId, int etaId);
51 
52  const variables_list_t &getVariables() const { return variables_; };
53 
54 protected:
55  void setup();
56  void runMva();
57  void bookReader();
58  void resetVariables();
59  void initVariables();
60 
63 
64  TMVA::Reader *reader_;
66  std::vector<std::string> tmvaVariables_;
67  std::vector<std::string> tmvaSpectators_;
68  std::map<std::string, std::string> tmvaNames_;
69 
70  Int_t version_;
72  bool cutBased_;
73  Float_t mvacut_[NWPs][NEtas][NPts]; //Keep the array fixed
74  Float_t rmsCut_[NWPs][NEtas][NPts]; //Keep the array fixed
75  Float_t betaStarCut_[NWPs][NEtas][NPts]; //Keep the array fixed
76 };
77 
78 #endif
std::vector< std::string > tmvaVariables_
Definition: MVAJetPuId.h:66
Float_t mvacut_[NWPs][NEtas][NPts]
Definition: MVAJetPuId.h:73
Base class for all types of Jets.
Definition: Jet.h:20
Int_t version_
Definition: MVAJetPuId.h:70
std::vector< std::string > tmvaSpectators_
Definition: MVAJetPuId.h:67
static constexpr int NEtas
Definition: MVAJetPuId.h:19
void bookReader()
Definition: MVAJetPuId.cc:125
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
variables_list_t variables_
Definition: MVAJetPuId.h:62
static constexpr int NPts
Definition: MVAJetPuId.h:18
void runMva()
Definition: MVAJetPuId.cc:145
Float_t rmsCut_[NWPs][NEtas][NPts]
Definition: MVAJetPuId.h:74
const variables_list_t & getVariables() const
Definition: MVAJetPuId.h:52
const std::string method() const
Definition: MVAJetPuId.h:41
bool cutBased_
Definition: MVAJetPuId.h:72
int computeCutIDflag(float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta)
PileupJetIdentifier computeIdVariables(const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho, bool calculateMva=false)
Definition: MVAJetPuId.cc:196
void initVariables()
Definition: MVAJetPuId.cc:500
TMVA::Reader * reader_
Definition: MVAJetPuId.h:64
PileupJetIdentifier internalId_
Definition: MVAJetPuId.h:61
std::string tmvaWeights_
Definition: MVAJetPuId.h:65
void resetVariables()
Definition: MVAJetPuId.cc:489
Float_t betaStarCut_[NWPs][NEtas][NPts]
Definition: MVAJetPuId.h:75
std::string dumpVariables() const
Definition: MVAJetPuId.cc:480
std::map< std::string, std::string > tmvaNames_
Definition: MVAJetPuId.h:68
std::pair< int, int > getJetIdKey(float jetPt, float jetEta)
Definition: MVAJetPuId.cc:156
PileupJetIdentifier computeMva()
Definition: MVAJetPuId.cc:191
Float_t impactParTkThreshod_
Definition: MVAJetPuId.h:71
MVAJetPuId(int version=CATEv0, const std::string &tmvaWeight="", const std::string &tmvaMethod="", Float_t impactParTkThreshod_=1., const std::vector< std::string > &tmvaVariables=std::vector< std::string >())
Definition: MVAJetPuId.cc:50
void setup()
Definition: MVAJetPuId.cc:66
int computeIDflag(float mva, float jetPt, float jetEta)
Definition: MVAJetPuId.cc:175
static constexpr int NWPs
Definition: MVAJetPuId.h:17
std::map< std::string, std::pair< float *, float > > variables_list_t
Definition: MVAJetPuId.h:45
std::string tmvaMethod_
Definition: MVAJetPuId.h:65