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 
26  class AlgoGBRForestsAndConstants;
27 
28  PileupJetIdAlgo(AlgoGBRForestsAndConstants const* cache);
30 
32  float jec,
33  const reco::Vertex*,
35  double rho,
36  edm::ValueMap<float>& constituentWeights,
37  bool applyConstituentWeight);
38 
39  void set(const PileupJetIdentifier&);
40  float getMVAval(const std::vector<std::string>&, const std::unique_ptr<const GBRForest>&);
42  const std::string method() const { return cache_->tmvaMethod(); }
43 
44  std::string dumpVariables() const;
45 
46  typedef std::map<std::string, std::pair<float*, float>> variables_list_t;
47 
48  std::pair<int, int> getJetIdKey(float jetPt, float jetEta);
49  int computeCutIDflag(float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta);
50  int computeIDflag(float mva, float jetPt, float jetEta);
51  int computeIDflag(float mva, int ptId, int etaId);
52 
54  const variables_list_t& getVariables() const { return variables_; };
55 
56  // In multithreaded mode, each PileupIdAlgo object will get duplicated
57  // on every stream. Some of the data it contains never changes after
58  // construction and can be shared by all streams. This nested class contains
59  // the data members that can be shared across streams. In particular
60  // the GBRForests take significant time to initialize and can be shared.
62  public:
64 
65  std::unique_ptr<const GBRForest> const& reader() const { return reader_; }
66  std::vector<std::unique_ptr<const GBRForest>> const& etaReader() const { return etaReader_; }
67  bool cutBased() const { return cutBased_; }
68  bool etaBinnedWeights() const { return etaBinnedWeights_; }
69  bool runMvas() const { return runMvas_; }
70  int nEtaBins() const { return nEtaBins_; }
71  std::vector<double> const& jEtaMin() const { return jEtaMin_; }
72  std::vector<double> const& jEtaMax() const { return jEtaMax_; }
73  std::string const& label() const { return label_; }
74  std::string const& tmvaMethod() const { return tmvaMethod_; }
75  std::vector<std::string> const& tmvaVariables() const { return tmvaVariables_; }
76  std::vector<std::vector<std::string>> const& tmvaEtaVariables() const { return tmvaEtaVariables_; }
77 
78  typedef float array_t[3][5][4];
79  array_t const& mvacut() const { return mvacut_; }
80  array_t const& rmsCut() const { return rmsCut_; }
81  array_t const& betaStarCut() const { return betaStarCut_; }
82 
83  private:
84  std::unique_ptr<const GBRForest> reader_;
85  std::vector<std::unique_ptr<const GBRForest>> etaReader_;
86  bool cutBased_;
88  bool runMvas_;
89  int nEtaBins_;
90  std::vector<double> jEtaMin_;
91  std::vector<double> jEtaMax_;
94  std::vector<std::string> tmvaVariables_;
95  std::vector<std::vector<std::string>> tmvaEtaVariables_;
96 
97  float mvacut_[3][5][4]; //Keep the array fixed
98  float rmsCut_[3][5][4]; //Keep the array fixed
99  float betaStarCut_[3][5][4]; //Keep the array fixed
100 
101  std::map<std::string, std::string> tmvaNames_;
102  };
103 
104 protected:
105  void runMva();
106  void resetVariables();
107  void initVariables();
108 
112 };
113 #endif
const std::string method() const
std::map< std::string, std::pair< float *, float > > variables_list_t
std::vector< double > const & jEtaMin() const
AlgoGBRForestsAndConstants const * cache_
AlgoGBRForestsAndConstants(edm::ParameterSet const &, bool runMvas)
std::vector< std::unique_ptr< const GBRForest > > etaReader_
Base class for all types of Jets.
Definition: Jet.h:20
std::string dumpVariables() const
std::pair< int, int > getJetIdKey(float jetPt, float jetEta)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
int computeCutIDflag(float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta)
std::vector< std::vector< std::string > > const & tmvaEtaVariables() const
std::vector< std::string > tmvaVariables_
PileupJetIdentifier internalId_
PileupJetIdentifier computeIdVariables(const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho, edm::ValueMap< float > &constituentWeights, bool applyConstituentWeight)
std::map< std::string, std::string > tmvaNames_
std::vector< std::string > const & tmvaVariables() const
std::vector< std::vector< std::string > > tmvaEtaVariables_
int computeIDflag(float mva, float jetPt, float jetEta)
std::vector< std::unique_ptr< const GBRForest > > const & etaReader() const
std::string const & tmvaMethod() const
const variables_list_t & getVariables() const
const PileupJetIdentifier::variables_list_t & getVariables() const { return variables_; }; ...
PileupJetIdentifier computeMva()
std::unique_ptr< const GBRForest > const & reader() const
def cache(function)
Definition: utilities.py:3
variables_list_t variables_
std::vector< double > const & jEtaMax() const
float getMVAval(const std::vector< std::string > &, const std::unique_ptr< const GBRForest > &)
std::unique_ptr< const GBRForest > reader_
PileupJetIdAlgo(AlgoGBRForestsAndConstants const *cache)