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  const reco::Jet* jet, 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:
59 
60  std::unique_ptr<const GBRForest> const& reader() const { return reader_; }
61  std::vector<std::unique_ptr<const GBRForest>> const& etaReader() const { return etaReader_; }
62  bool cutBased() const { return cutBased_; }
63  bool etaBinnedWeights() const { return etaBinnedWeights_; }
64  bool runMvas() const { return runMvas_; }
65  int nEtaBins() const { return nEtaBins_; }
66  std::vector<double> const& jEtaMin() const { return jEtaMin_; }
67  std::vector<double> const& jEtaMax() const { return jEtaMax_; }
68  std::string const& label() const { return label_; }
69  std::string const& tmvaMethod() const { return tmvaMethod_; }
70  std::vector<std::string> const& tmvaVariables() const { return tmvaVariables_; }
71  std::vector<std::vector<std::string>> const& tmvaEtaVariables() const { return tmvaEtaVariables_; }
72 
73  typedef float array_t[3][4][4];
74  array_t const& mvacut() const { return mvacut_; }
75  array_t const& rmsCut() const { return rmsCut_; }
76  array_t const& betaStarCut() const { return betaStarCut_; }
77 
78  private:
79  std::unique_ptr<const GBRForest> reader_;
80  std::vector<std::unique_ptr<const GBRForest>> etaReader_;
81  bool cutBased_;
83  bool runMvas_;
84  int nEtaBins_;
85  std::vector<double> jEtaMin_;
86  std::vector<double> jEtaMax_;
89  std::vector<std::string> tmvaVariables_;
90  std::vector<std::vector<std::string>> tmvaEtaVariables_;
91 
92  float mvacut_[3][4][4]; //Keep the array fixed
93  float rmsCut_[3][4][4]; //Keep the array fixed
94  float betaStarCut_[3][4][4]; //Keep the array fixed
95 
96  std::map<std::string, std::string> tmvaNames_;
97  };
98 
99 protected:
100  void runMva();
101  void resetVariables();
102  void initVariables();
103 
107 };
108 #endif
PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMin_
std::vector< double > jEtaMin_
Definition: PileupJetIdAlgo.h:85
reco::btau::jetPt
Definition: TaggingVariable.h:32
PileupJetIdAlgo::resetVariables
void resetVariables()
Definition: PileupJetIdAlgo.cc:723
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
PileupJetIdAlgo::USER
Definition: PileupJetIdAlgo.h:24
PileupJetIdAlgo::initVariables
void initVariables()
Definition: PileupJetIdAlgo.cc:736
PileupJetIdAlgo::AlgoGBRForestsAndConstants::runMvas
bool runMvas() const
Definition: PileupJetIdAlgo.h:64
PileupJetIdAlgo::AlgoGBRForestsAndConstants::label
std::string const & label() const
Definition: PileupJetIdAlgo.h:68
PileupJetIdAlgo::dumpVariables
std::string dumpVariables() const
Definition: PileupJetIdAlgo.cc:713
PileupJetIdAlgo::AlgoGBRForestsAndConstants::cutBased_
bool cutBased_
Definition: PileupJetIdAlgo.h:81
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
PFJetCollection.h
PileupJetIdAlgo::AlgoGBRForestsAndConstants::mvacut_
float mvacut_[3][4][4]
Definition: PileupJetIdAlgo.h:92
Jet.h
PileupJetIdAlgo::AlgoGBRForestsAndConstants::betaStarCut_
float betaStarCut_[3][4][4]
Definition: PileupJetIdAlgo.h:94
PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMax
std::vector< double > const & jEtaMax() const
Definition: PileupJetIdAlgo.h:67
PileupJetIdAlgo::AlgoGBRForestsAndConstants::AlgoGBRForestsAndConstants
AlgoGBRForestsAndConstants(edm::ParameterSet const &, bool runMvas)
Definition: PileupJetIdAlgo.cc:21
beam_dqm_sourceclient-live_cfg.mva
mva
Definition: beam_dqm_sourceclient-live_cfg.py:119
GBRForest.h
PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaBinnedWeights_
bool etaBinnedWeights_
Definition: PileupJetIdAlgo.h:82
PileupJetIdAlgo::method
const std::string method() const
Definition: PileupJetIdAlgo.h:37
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaVariables
std::vector< std::string > const & tmvaVariables() const
Definition: PileupJetIdAlgo.h:70
PileupJetIdentifier.h
PileupJetIdAlgo::AlgoGBRForestsAndConstants::reader_
std::unique_ptr< const GBRForest > reader_
Definition: PileupJetIdAlgo.h:79
PileupJetIdAlgo::getJetIdKey
std::pair< int, int > getJetIdKey(float jetPt, float jetEta)
Definition: PileupJetIdAlgo.cc:189
PileupJetIdAlgo::set
void set(const PileupJetIdentifier &)
Definition: PileupJetIdAlgo.cc:146
PileupJetIdAlgo::PHILv0
Definition: PileupJetIdAlgo.h:24
PileupJetIdAlgo::cache_
AlgoGBRForestsAndConstants const * cache_
Definition: PileupJetIdAlgo.h:106
PileupJetIdAlgo::computeCutIDflag
int computeCutIDflag(float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta)
Definition: PileupJetIdAlgo.cc:209
PileupJetIdAlgo::computeIdVariables
PileupJetIdentifier computeIdVariables(const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho, bool usePuppi)
Definition: PileupJetIdAlgo.cc:251
PileupJetIdAlgo::computeIDflag
int computeIDflag(float mva, float jetPt, float jetEta)
Definition: PileupJetIdAlgo.cc:227
PileupJetIdAlgo::version_t
version_t
Definition: PileupJetIdAlgo.h:24
utilities.cache
def cache(function)
Definition: utilities.py:3
PileupJetIdAlgo::AlgoGBRForestsAndConstants::array_t
float array_t[3][4][4]
Definition: PileupJetIdAlgo.h:73
DDAxes::rho
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PileupJetIdAlgo::AlgoGBRForestsAndConstants::nEtaBins_
int nEtaBins_
Definition: PileupJetIdAlgo.h:84
PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMin
std::vector< double > const & jEtaMin() const
Definition: PileupJetIdAlgo.h:66
reco::btau::jetEta
Definition: TaggingVariable.h:34
edm::ParameterSet
Definition: ParameterSet.h:36
PileupJetIdAlgo::variables_list_t
std::map< std::string, std::pair< float *, float > > variables_list_t
Definition: PileupJetIdAlgo.h:41
PileupJetIdAlgo::AlgoGBRForestsAndConstants::runMvas_
bool runMvas_
Definition: PileupJetIdAlgo.h:83
PileupJetIdAlgo::internalId_
PileupJetIdentifier internalId_
Definition: PileupJetIdAlgo.h:104
PackedCandidate.h
PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaBinnedWeights
bool etaBinnedWeights() const
Definition: PileupJetIdAlgo.h:63
PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaReader
std::vector< std::unique_ptr< const GBRForest > > const & etaReader() const
Definition: PileupJetIdAlgo.h:61
PileupJetIdAlgo::computeMva
PileupJetIdentifier computeMva()
Definition: PileupJetIdAlgo.cc:245
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaEtaVariables_
std::vector< std::vector< std::string > > tmvaEtaVariables_
Definition: PileupJetIdAlgo.h:90
PileupJetIdAlgo::runMva
void runMva()
Definition: PileupJetIdAlgo.cc:160
PileupJetIdentifier
Definition: PileupJetIdentifier.h:74
PileupJetIdAlgo::AlgoGBRForestsAndConstants::nEtaBins
int nEtaBins() const
Definition: PileupJetIdAlgo.h:65
PileupJetIdAlgo::AlgoGBRForestsAndConstants
Definition: PileupJetIdAlgo.h:56
PileupJetIdAlgo::PileupJetIdAlgo
PileupJetIdAlgo(AlgoGBRForestsAndConstants const *cache)
Definition: PileupJetIdAlgo.cc:125
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaMethod
std::string const & tmvaMethod() const
Definition: PileupJetIdAlgo.h:69
Jet.h
PileupJetIdAlgo::AlgoGBRForestsAndConstants::cutBased
bool cutBased() const
Definition: PileupJetIdAlgo.h:62
PileupJetIdAlgo::AlgoGBRForestsAndConstants::betaStarCut
array_t const & betaStarCut() const
Definition: PileupJetIdAlgo.h:76
VertexFwd.h
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaNames_
std::map< std::string, std::string > tmvaNames_
Definition: PileupJetIdAlgo.h:96
PileupJetIdAlgo::AlgoGBRForestsAndConstants::etaReader_
std::vector< std::unique_ptr< const GBRForest > > etaReader_
Definition: PileupJetIdAlgo.h:80
PileupJetIdAlgo::AlgoGBRForestsAndConstants::jEtaMax_
std::vector< double > jEtaMax_
Definition: PileupJetIdAlgo.h:86
metsig::jet
Definition: SignAlgoResolutions.h:47
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaVariables_
std::vector< std::string > tmvaVariables_
Definition: PileupJetIdAlgo.h:89
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaEtaVariables
std::vector< std::vector< std::string > > const & tmvaEtaVariables() const
Definition: PileupJetIdAlgo.h:71
PileupJetIdAlgo::AlgoGBRForestsAndConstants::rmsCut_
float rmsCut_[3][4][4]
Definition: PileupJetIdAlgo.h:93
PileupJetIdAlgo::AlgoGBRForestsAndConstants::tmvaMethod_
std::string tmvaMethod_
Definition: PileupJetIdAlgo.h:88
PileupJetIdAlgo::getMVAval
float getMVAval(const std::vector< std::string > &, const std::unique_ptr< const GBRForest > &)
Definition: PileupJetIdAlgo.cc:150
jetMETDQMOfflineSource_cff.jec
jec
Definition: jetMETDQMOfflineSource_cff.py:27
PileupJetIdAlgo
Definition: PileupJetIdAlgo.h:22
ParameterSet.h
PileupJetIdAlgo::variables_
variables_list_t variables_
Definition: PileupJetIdAlgo.h:105
PileupJetIdAlgo::~PileupJetIdAlgo
~PileupJetIdAlgo()
Definition: PileupJetIdAlgo.cc:128
PileupJetIdAlgo::AlgoGBRForestsAndConstants::rmsCut
array_t const & rmsCut() const
Definition: PileupJetIdAlgo.h:75
PileupJetIdAlgo::AlgoGBRForestsAndConstants::label_
std::string label_
Definition: PileupJetIdAlgo.h:87
PileupJetID_cfi.usePuppi
usePuppi
Definition: PileupJetID_cfi.py:32
PileupJetIdAlgo::AlgoGBRForestsAndConstants::mvacut
array_t const & mvacut() const
Definition: PileupJetIdAlgo.h:74
PileupJetIdAlgo::AlgoGBRForestsAndConstants::reader
std::unique_ptr< const GBRForest > const & reader() const
Definition: PileupJetIdAlgo.h:60
reco::Vertex
Definition: Vertex.h:35
PileupJetIdAlgo::getVariables
const variables_list_t & getVariables() const
const PileupJetIdentifier::variables_list_t & getVariables() const { return variables_; };
Definition: PileupJetIdAlgo.h:49