CMS 3D CMS Logo

PileupJetIdAlgo.h
Go to the documentation of this file.
1 //--------------------------------------------------------------------------------------------------
2 //
3 // PileupJetIdAlgo
4 //
5 // Author: P. Musella, P. Harris
6 //--------------------------------------------------------------------------------------------------
7 
8 #ifndef RecoJets_JetProducers_plugins_PileupJetIdAlgo_h
9 #define RecoJets_JetProducers_plugins_PileupJetIdAlgo_h
10 
17 
20 
21 // ----------------------------------------------------------------------------------------------------
23 public:
24  enum version_t { USER=-1, PHILv0=0 };
25 
27 
30 
32  float jec, const reco::Vertex *, const reco::VertexCollection &, double rho, bool usePuppi);
33 
34  void set(const PileupJetIdentifier &);
35  float getMVAval(const std::vector<std::string> &, const std::unique_ptr<const GBRForest> &);
37  const std::string method() const { return cache_->tmvaMethod(); }
38 
39  std::string dumpVariables() const;
40 
41  typedef std::map<std::string,std::pair<float *,float> > variables_list_t;
42 
43  std::pair<int,int> getJetIdKey(float jetPt, float jetEta);
44  int computeCutIDflag(float betaStarClassic,float dR2Mean,float nvtx, float jetPt, float jetEta);
45  int computeIDflag (float mva, float jetPt, float jetEta);
46  int computeIDflag (float mva,int ptId,int etaId);
47 
49  const variables_list_t & getVariables() const { return variables_; };
50 
51  // In multithreaded mode, each PileupIdAlgo object will get duplicated
52  // on every stream. Some of the data it contains never changes after
53  // construction and can be shared by all streams. This nested class contains
54  // the data members that can be shared across streams. In particular
55  // the GBRForests take significant time to initialize and can be shared.
57  public:
58 
60 
61  std::unique_ptr<const GBRForest> const& reader() const { return reader_; }
62  std::vector<std::unique_ptr<const GBRForest>> const& etaReader() const { return etaReader_; }
63  bool cutBased() const { return cutBased_; }
64  bool etaBinnedWeights() const { return etaBinnedWeights_; }
65  bool runMvas() const { return runMvas_; }
66  int nEtaBins() const { return nEtaBins_; }
67  std::vector<double> const& jEtaMin() const { return jEtaMin_; }
68  std::vector<double> const& jEtaMax() const { return jEtaMax_; }
69  std::string const& label() const { return label_; }
70  std::string const& tmvaMethod() const { return tmvaMethod_; }
71  std::vector<std::string> const& tmvaVariables() const { return tmvaVariables_; }
72  std::vector<std::vector<std::string>> const& tmvaEtaVariables() const { return tmvaEtaVariables_; }
73 
74  typedef float array_t[3][4][4];
75  array_t const& mvacut() const { return mvacut_; }
76  array_t const& rmsCut() const { return rmsCut_; }
77  array_t const& betaStarCut() const { return betaStarCut_; }
78 
79  private:
80 
81  std::unique_ptr<const GBRForest> reader_;
82  std::vector<std::unique_ptr<const GBRForest>> etaReader_;
83  bool cutBased_;
85  bool runMvas_;
86  int nEtaBins_;
87  std::vector<double> jEtaMin_;
88  std::vector<double> jEtaMax_;
91  std::vector<std::string> tmvaVariables_;
92  std::vector<std::vector<std::string>> tmvaEtaVariables_;
93 
94  float mvacut_ [3][4][4]; //Keep the array fixed
95  float rmsCut_ [3][4][4]; //Keep the array fixed
96  float betaStarCut_[3][4][4]; //Keep the array fixed
97 
98  std::map<std::string,std::string> tmvaNames_;
99  };
100 
101 protected:
102 
103  void runMva();
104  void resetVariables();
105  void initVariables();
106 
108  variables_list_t variables_;
110 };
111 #endif
AlgoGBRForestsAndConstants const * cache_
AlgoGBRForestsAndConstants(edm::ParameterSet const &, bool runMvas)
std::vector< double > const & jEtaMin() const
std::map< std::string, std::string > tmvaNames_
std::vector< std::unique_ptr< const GBRForest > > etaReader_
Base class for all types of Jets.
Definition: Jet.h:20
std::string const & tmvaMethod() const
std::pair< int, int > getJetIdKey(float jetPt, float jetEta)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const std::string method() const
int computeCutIDflag(float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta)
std::vector< double > const & jEtaMax() const
const variables_list_t & getVariables() const
const PileupJetIdentifier::variables_list_t & getVariables() const { return variables_; }; ...
std::vector< std::string > tmvaVariables_
PileupJetIdentifier computeIdVariables(const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho, bool usePuppi)
PileupJetIdentifier internalId_
std::string dumpVariables() const
std::unique_ptr< const GBRForest > const & reader() const
std::vector< std::vector< std::string > > tmvaEtaVariables_
int computeIDflag(float mva, float jetPt, float jetEta)
def cache(function)
PileupJetIdentifier computeMva()
std::vector< std::unique_ptr< const GBRForest > > const & etaReader() const
std::map< std::string, std::pair< float *, float > > variables_list_t
std::vector< std::vector< std::string > > const & tmvaEtaVariables() const
variables_list_t variables_
std::vector< std::string > const & tmvaVariables() const
float getMVAval(const std::vector< std::string > &, const std::unique_ptr< const GBRForest > &)
std::unique_ptr< const GBRForest > reader_
PileupJetIdAlgo(AlgoGBRForestsAndConstants const *cache)