HiggsAnalysis-KITHiggsToTauTau
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
TagAndProbePairConsumer.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <cstdint>
5 #include <cassert>
6 
7 #include <boost/algorithm/string/predicate.hpp>
8 
9 #include <TTree.h>
10 #include <Math/Vector4D.h>
11 #include <Math/Vector4Dfwd.h>
12 
13 #include "Artus/Core/interface/EventBase.h"
14 #include "Artus/Core/interface/ProductBase.h"
15 #include "Artus/Core/interface/ConsumerBase.h"
16 #include "Artus/Configuration/interface/SettingsBase.h"
17 #include "Artus/Utility/interface/Utility.h"
18 #include "Artus/Utility/interface/DefaultValues.h"
19 #include "Artus/Utility/interface/SafeMap.h"
20 #include "Artus/Utility/interface/RootFileHelper.h"
21 
22 #include "HiggsAnalysis/KITHiggsToTauTau/interface/HttTypes.h"
23 
24 #include "Kappa/DataFormats/interface/Kappa.h"
25 #include <boost/regex.hpp>
26 
27 
28 class TagAndProbeMuonPairConsumer: public ConsumerBase<HttTypes> {
29 
30 public:
31  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<float> > RMFLV;
32 
33  std::string GetConsumerId() const override;
34 
35  void Init(setting_type const& settings, metadata_type& metadata) override;
36 
37  void ProcessFilteredEvent(event_type const& event, product_type const& product, setting_type const& settings, metadata_type const& metadata ) override;
38 
39  void Finish(setting_type const& settings, metadata_type const& metadata) override;
40 
41 
42 private:
43  TTree* m_tree = nullptr;
44  std::map <std::string, bool> BoolQuantities;
45  std::map <std::string, int> IntQuantities;
46  std::map <std::string, float> FloatQuantities;
47  bool usedMuonIDshortTerm = false;
48  // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideMuonIdRun2#Short_Term_Medium_Muon_Definitio
49  bool IsMediumMuon2016ShortTerm(KMuon* muon) const;
50  bool IsMediumMuon2016(KMuon* muon) const;
51 };
52 
53 
54 class TagAndProbeElectronPairConsumer: public ConsumerBase<HttTypes> {
55 
56 public:
57  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<float> > RMFLV;
58 
59  std::string GetConsumerId() const override;
60 
61  void Init(setting_type const& settings, metadata_type& metadata) override;
62 
63  void ProcessFilteredEvent(event_type const& event, product_type const& product, setting_type const& settings, metadata_type const& metadata ) override;
64 
65  void Finish(setting_type const& settings, metadata_type const& metadata) override;
66 
67 
68 private:
69  TTree* m_tree = nullptr;
70  std::map <std::string, bool> BoolQuantities;
71  std::map <std::string, int> IntQuantities;
72  std::map <std::string, float> FloatQuantities;
73  std::string electronIDName;
74  double electronMvaIDCutEB1;
75  double electronMvaIDCutEB2;
76  double electronMvaIDCutEE;
77  bool IsMVABased(KElectron* electron, event_type const& event, const std::string &idName) const;
78 };
79 
80 
81 class TagAndProbeGenTauConsumer: public ConsumerBase<HttTypes> {
82 
83 public:
84  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<float> > RMFLV;
85 
86  std::string GetConsumerId() const override;
87 
88  void Init(setting_type const& settings, metadata_type& metadata) override;
89 
90  void ProcessFilteredEvent(event_type const& event, product_type const& product, setting_type const& settings, metadata_type const& metadata ) override;
91 
92  void Finish(setting_type const& settings, metadata_type const& metadata) override;
93 
94 
95 private:
96  TTree* m_tree = nullptr;
97  std::map <std::string, bool> BoolQuantities;
98  std::map <std::string, int> IntQuantities;
99  std::map <std::string, float> FloatQuantities;
100  bool oldTauDMs;
101  bool IsTauIDRecommendation13TeV(KTau* tau, event_type const& event, bool const& oldTauDMs, bool const& isAOD=false) const;
102 };
103 
104 
105 class TagAndProbeGenMuonConsumer: public ConsumerBase<HttTypes> {
106 
107 public:
108  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<float> > RMFLV;
109 
110  std::string GetConsumerId() const override;
111 
112  void Init(setting_type const& settings, metadata_type& metadata) override;
113 
114  void ProcessFilteredEvent(event_type const& event, product_type const& product, setting_type const& settings, metadata_type const& metadata ) override;
115 
116  void Finish(setting_type const& settings, metadata_type const& metadata) override;
117 
118 
119 private:
120  TTree* m_tree = nullptr;
121  std::map <std::string, bool> BoolQuantities;
122  std::map <std::string, int> IntQuantities;
123  std::map <std::string, float> FloatQuantities;
124  bool usedMuonIDshortTerm = false;
125  // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideMuonIdRun2#Short_Term_Medium_Muon_Definitio
126  bool IsMediumMuon2016ShortTerm(KMuon* muon) const;
127  bool IsMediumMuon2016(KMuon* muon) const;
128 };
129 
130 
131 class TagAndProbeGenElectronConsumer: public ConsumerBase<HttTypes> {
132 
133 public:
134  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<float> > RMFLV;
135 
136  std::string GetConsumerId() const override;
137 
138  void Init(setting_type const& settings, metadata_type& metadata) override;
139 
140  void ProcessFilteredEvent(event_type const& event, product_type const& product, setting_type const& settings, metadata_type const& metadata ) override;
141 
142  void Finish(setting_type const& settings, metadata_type const& metadata) override;
143 
144 
145 private:
146  TTree* m_tree = nullptr;
147  std::map <std::string, bool> BoolQuantities;
148  std::map <std::string, int> IntQuantities;
149  std::map <std::string, float> FloatQuantities;
150  std::string electronIDName;
151  double electronMvaIDCutEB1;
152  double electronMvaIDCutEB2;
153  double electronMvaIDCutEE;
154  bool IsMVABased(KElectron* electron, event_type const& event, const std::string &idName) const;
155 };
void ProcessFilteredEvent(event_type const &event, product_type const &product, setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:579
std::string GetConsumerId() const override
Definition: TagAndProbePairConsumer.cc:1388
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< float > > RMFLV
Definition: TagAndProbePairConsumer.h:134
void Init(setting_type const &settings, metadata_type &metadata) override
Definition: TagAndProbePairConsumer.cc:525
void ProcessFilteredEvent(event_type const &event, product_type const &product, setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:1081
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< float > > RMFLV
Definition: TagAndProbePairConsumer.h:108
std::string GetConsumerId() const override
Definition: TagAndProbePairConsumer.cc:44
void Finish(setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:821
std::string GetConsumerId() const override
Definition: TagAndProbePairConsumer.cc:1024
void Finish(setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:1356
Definition: TagAndProbePairConsumer.h:131
void ProcessFilteredEvent(event_type const &event, product_type const &product, setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:110
void Init(setting_type const &settings, metadata_type &metadata) override
Definition: TagAndProbePairConsumer.cc:49
Definition: TagAndProbePairConsumer.h:28
std::string GetConsumerId() const override
Definition: TagAndProbePairConsumer.cc:848
void Finish(setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:489
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< float > > RMFLV
Definition: TagAndProbePairConsumer.h:57
std::string GetConsumerId() const override
Definition: TagAndProbePairConsumer.cc:520
void Finish(setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:994
void ProcessFilteredEvent(event_type const &event, product_type const &product, setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:1438
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< float > > RMFLV
Definition: TagAndProbePairConsumer.h:31
Definition: TagAndProbePairConsumer.h:81
void Init(setting_type const &settings, metadata_type &metadata) override
Definition: TagAndProbePairConsumer.cc:1029
Definition: TagAndProbePairConsumer.h:105
void Init(setting_type const &settings, metadata_type &metadata) override
Definition: TagAndProbePairConsumer.cc:853
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< float > > RMFLV
Definition: TagAndProbePairConsumer.h:84
void Init(setting_type const &settings, metadata_type &metadata) override
Definition: TagAndProbePairConsumer.cc:1393
Definition: TagAndProbePairConsumer.h:54
void ProcessFilteredEvent(event_type const &event, product_type const &product, setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:901
void Finish(setting_type const &settings, metadata_type const &metadata) override
Definition: TagAndProbePairConsumer.cc:1586