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 
17 class MVAJetPuId {
18 
19 
20  static constexpr int NWPs = 3;
21  static constexpr int NPts = 4;
22  static constexpr int NEtas = 4;
23 
24  public:
25  enum version_t { USER=-1, CATEv0=0 };
26 
27  MVAJetPuId(int version=CATEv0, const std::string & tmvaWeight="", const std::string & tmvaMethod="",
28  Float_t impactParTkThreshod_=1., const std::vector<std::string> & tmvaVariables= std::vector<std::string>());
29  MVAJetPuId(const edm::ParameterSet & ps);
30  ~MVAJetPuId();
31 
33  float jec, const reco::Vertex *, const reco::VertexCollection &,double rho,
34  bool calculateMva=false);
35 
36  void set(const PileupJetIdentifier &);
38  const std::string method() const { return tmvaMethod_; }
39 
40  std::string dumpVariables() const;
41 
42  typedef std::map<std::string,std::pair<float *,float> > variables_list_t;
43 
44  std::pair<int,int> getJetIdKey(float jetPt, float jetEta);
45  int computeCutIDflag(float betaStarClassic,float dR2Mean,float nvtx, float jetPt, float jetEta);
46  int computeIDflag (float mva, float jetPt, float jetEta);
47  int computeIDflag (float mva,int ptId,int etaId);
48 
49  const variables_list_t & getVariables() const { return variables_; };
50 
51 
52 
53 
54  protected:
55 
56 
57  void setup();
58  void runMva();
59  void bookReader();
60  void resetVariables();
61  void initVariables();
62 
63 
65  variables_list_t variables_;
66 
67  TMVA::Reader * reader_;
69  std::vector<std::string> tmvaVariables_;
70  std::vector<std::string> tmvaSpectators_;
71  std::map<std::string,std::string> tmvaNames_;
72 
73  Int_t version_;
75  bool cutBased_;
76  Float_t mvacut_ [NWPs][NEtas][NPts]; //Keep the array fixed
77  Float_t rmsCut_ [NWPs][NEtas][NPts]; //Keep the array fixed
78  Float_t betaStarCut_[NWPs][NEtas][NPts]; //Keep the array fixed
79 };
80 
81 #endif
82 
const variables_list_t & getVariables() const
Definition: MVAJetPuId.h:49
std::vector< std::string > tmvaVariables_
Definition: MVAJetPuId.h:69
Float_t mvacut_[NWPs][NEtas][NPts]
Definition: MVAJetPuId.h:76
Base class for all types of Jets.
Definition: Jet.h:20
Int_t version_
Definition: MVAJetPuId.h:73
std::vector< std::string > tmvaSpectators_
Definition: MVAJetPuId.h:70
void bookReader()
Definition: MVAJetPuId.cc:140
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
variables_list_t variables_
Definition: MVAJetPuId.h:65
#define constexpr
void runMva()
Definition: MVAJetPuId.cc:166
static int NWPs
Definition: MVAJetPuId.h:20
Float_t rmsCut_[NWPs][NEtas][NPts]
Definition: MVAJetPuId.h:77
static int NEtas
Definition: MVAJetPuId.h:22
std::map< std::string, std::string > tmvaNames_
Definition: MVAJetPuId.h:71
bool cutBased_
Definition: MVAJetPuId.h:75
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:210
void initVariables()
Definition: MVAJetPuId.cc:490
std::map< std::string, std::pair< float *, float > > variables_list_t
Definition: MVAJetPuId.h:42
const std::string method() const
Definition: MVAJetPuId.h:38
TMVA::Reader * reader_
Definition: MVAJetPuId.h:67
static int NPts
Definition: MVAJetPuId.h:21
PileupJetIdentifier internalId_
Definition: MVAJetPuId.h:64
std::string tmvaWeights_
Definition: MVAJetPuId.h:68
void resetVariables()
Definition: MVAJetPuId.cc:477
Float_t betaStarCut_[NWPs][NEtas][NPts]
Definition: MVAJetPuId.h:78
std::pair< int, int > getJetIdKey(float jetPt, float jetEta)
Definition: MVAJetPuId.cc:174
PileupJetIdentifier computeMva()
Definition: MVAJetPuId.cc:204
Float_t impactParTkThreshod_
Definition: MVAJetPuId.h:74
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:51
void setup()
Definition: MVAJetPuId.cc:71
int computeIDflag(float mva, float jetPt, float jetEta)
Definition: MVAJetPuId.cc:189
std::string dumpVariables() const
Definition: MVAJetPuId.cc:465
std::string tmvaMethod_
Definition: MVAJetPuId.h:68