4 #include "Kappa/DataFormats/interface/Kappa.h"
6 #include "Artus/Core/interface/ProducerBase.h"
7 #include "Artus/Consumer/interface/LambdaNtupleConsumer.h"
8 #include "Artus/Utility/interface/SafeMap.h"
9 #include "boost/functional/hash.hpp"
11 #include "HiggsAnalysis/KITHiggsToTauTau/interface/HttTypes.h"
30 virtual void Init(setting_type
const& settings, metadata_type& metadata)
override
32 ProducerBase<HttTypes>::Init(settings, metadata);
35 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"metSumEt", [](event_type
const& event, product_type
const& product)
37 return product.m_met.sumEt;
39 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"metPt", [](event_type
const& event, product_type
const& product)
41 return product.m_met.p4.Pt();
43 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"metPhi", [](event_type
const& event, product_type
const& product)
45 return product.m_met.p4.Phi();
47 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"metCov00", [](event_type
const& event, product_type
const& product)
49 return product.m_met.significance.At(0, 0);
51 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"metCov01", [](event_type
const& event, product_type
const& product)
53 return product.m_met.significance.At(0, 1);
55 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"metCov10", [](event_type
const& event, product_type
const& product)
57 return product.m_met.significance.At(1, 0);
59 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"metCov11", [](event_type
const& event, product_type
const& product)
61 return product.m_met.significance.At(1, 1);
64 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"pfMetSumEt", [](event_type
const& event, product_type
const& product)
66 return product.m_pfmet.sumEt;
68 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"pfMetPt", [](event_type
const& event, product_type
const& product)
70 return product.m_pfmet.p4.Pt();
72 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"pfMetPhi", [](event_type
const& event, product_type
const& product)
74 return product.m_pfmet.p4.Phi();
76 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"pfMetCov00", [](event_type
const& event, product_type
const& product)
78 return product.m_pfmet.significance.At(0, 0);
80 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"pfMetCov01", [](event_type
const& event, product_type
const& product)
82 return product.m_pfmet.significance.At(0, 1);
84 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"pfMetCov10", [](event_type
const& event, product_type
const& product)
86 return product.m_pfmet.significance.At(1, 0);
88 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"pfMetCov11", [](event_type
const& event, product_type
const& product)
90 return product.m_pfmet.significance.At(1, 1);
93 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"mvaMetSumEt", [](event_type
const& event, product_type
const& product)
95 return product.m_mvamet.sumEt;
97 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"mvaMetPt", [](event_type
const& event, product_type
const& product)
99 return product.m_mvamet.p4.Pt();
101 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"mvaMetPhi", [](event_type
const& event, product_type
const& product)
103 return product.m_mvamet.p4.Phi();
105 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"mvaMetCov00", [](event_type
const& event, product_type
const& product)
107 return product.m_mvamet.significance.At(0, 0);
109 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"mvaMetCov01", [](event_type
const& event, product_type
const& product)
111 return product.m_mvamet.significance.At(0, 1);
113 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"mvaMetCov10", [](event_type
const& event, product_type
const& product)
115 return product.m_mvamet.significance.At(1, 0);
117 LambdaNtupleConsumer<HttTypes>::AddFloatQuantity(metadata,
"mvaMetCov11", [](event_type
const& event, product_type
const& product)
119 return product.m_mvamet.significance.At(1, 1);
123 virtual void Produce(event_type
const& event, product_type & product,
124 setting_type
const& settings, metadata_type
const& metadata)
const override
128 assert(product.m_ptOrderedLeptons.size() > 0);
131 std::vector<KLepton*> leptons = product.m_ptOrderedLeptons;
132 std::vector<size_t> hashes;
133 if (leptons.size() == 2 && (leptons[0]->p4.Pt() < leptons[1]->p4.Pt()))
138 for (std::vector<KLepton*>::iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton)
140 boost::hash_combine(hash,(*lepton)->internalId);
142 hashes.push_back(hash);
144 while (std::prev_permutation(leptons.begin(), leptons.end(), [](KLepton
const* lepton1, KLepton
const* lepton2) ->
bool {
return lepton1->p4.Pt() < lepton2->p4.Pt(); }));
151 for (std::vector<KLepton*>::iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton)
153 boost::hash_combine(hash,(*lepton)->internalId);
155 hashes.push_back(hash);
157 std::swap(leptons[0],leptons[1]);
159 for (std::vector<KLepton*>::iterator lepton = leptons.begin(); lepton != leptons.end(); ++lepton)
161 boost::hash_combine(hash,(*lepton)->internalId);
163 hashes.push_back(hash);
167 bool foundMvaMet =
false;
168 for (
typename std::vector<TMet>::iterator met = (event.*
m_metsMember)->begin(); met != (
event.*
m_metsMember)->end(); ++met)
170 if (std::find(hashes.begin(), hashes.end(), met->leptonSelectionHash)!= hashes.end())
172 product.m_mvametUncorr = &(*met);
179 assert(foundMvaMet && (product.m_mvametUncorr !=
nullptr));
184 product.m_mvamet = *(product.m_mvametUncorr);
185 if (settings.GetChooseMvaMet())
187 product.m_metUncorr = product.m_mvametUncorr;
188 product.m_met = product.m_mvamet;
196 product.m_pfmet = *(product.m_pfmetUncorr);
197 if (!settings.GetChooseMvaMet())
199 product.m_metUncorr = product.m_pfmetUncorr;
200 product.m_met = product.m_pfmet;
235 virtual void Produce(event_type
const& event, product_type & product,
236 setting_type
const& settings, metadata_type
const& metadata)
const override;
MvaMetEMSelector()
Definition: MetSelectors.cc:68
virtual std::string GetProducerId() const override
Definition: MetSelectors.cc:11
virtual void Produce(event_type const &event, product_type &product, setting_type const &settings, metadata_type const &metadata) const override
Definition: MetSelectors.cc:22
Producer for Puppi MET.
Definition: MetSelectors.h:232
virtual std::string GetProducerId() const override
Definition: MetSelectors.cc:62
Producer for MVAMET (TT channel)
Definition: MetSelectors.h:244
virtual std::string GetProducerId() const override
Definition: MetSelectors.cc:51
virtual void Init(setting_type const &settings, metadata_type &metadata) override
Definition: MetSelectors.h:30
virtual std::string GetProducerId() const override
Definition: MetSelectors.cc:40
Producer for (PF) MET.
Definition: MetSelectors.h:221
virtual void Produce(event_type const &event, product_type &product, setting_type const &settings, metadata_type const &metadata) const override
Definition: MetSelectors.h:123
virtual std::string GetProducerId() const override
Definition: MetSelectors.cc:30
MetSelector()
Definition: MetSelectors.cc:5
MvaMetTTSelector()
Definition: MetSelectors.cc:35
Producer for MVAMET (EM channel)
Definition: MetSelectors.h:290
Producer for the MET.
Definition: MetSelectors.h:19
virtual std::string GetProducerId() const override
Definition: MetSelectors.cc:73
MvaMetETSelector()
Definition: MetSelectors.cc:57
Producer for MVAMET (ET channel)
Definition: MetSelectors.h:268
all data types which are used for Htt analyses
Definition: HttTypes.h:27
virtual std::string GetProducerId() const override
Definition: MetSelectors.cc:83
Producer for MVAMET (EM channel)
Definition: MetSelectors.h:280
std::vector< TMet > *event_type::* m_metsMember
Definition: MetSelectors.h:213
TMet *event_type::* m_metMember
Definition: MetSelectors.h:212
MetSelectorPuppi()
Definition: MetSelectors.cc:17
MvaMetSelector()
Definition: MetSelectors.cc:78
Producer for MVAMET (MT channel)
Definition: MetSelectors.h:256
MetSelectorBase(TMet *event_type::*met, std::vector< TMet > *event_type::*mets)
Definition: MetSelectors.h:23
MvaMetMTSelector()
Definition: MetSelectors.cc:46