7 #include <boost/regex.hpp>
9 #include <Math/VectorUtil.h>
11 #include "Kappa/DataFormats/interface/Kappa.h"
13 #include "Artus/Core/interface/ProducerBase.h"
14 #include "Artus/Utility/interface/SafeMap.h"
15 #include "Artus/Utility/interface/Utility.h"
16 #include "Artus/KappaAnalysis/interface/Producers/TriggerMatchingProducers.h"
18 #include "HiggsAnalysis/KITHiggsToTauTau/interface/HttTypes.h"
22 template<
class TTag,
class TProbe>
28 std::vector<TTag*> product_type::*tagObjectsMember,
29 std::vector<TProbe*> product_type::*probeObjectsMember,
30 std::map<TTag*, std::map<std::string, std::map<std::string, std::vector<KLV*> > > > product_type::*detailedTriggerMatchedTagObjectsMember,
31 std::map<TProbe*, std::map<std::string, std::map<std::string, std::vector<KLV*> > > > product_type::*detailedTriggerMatchedProbeObjectsMember,
32 std::vector<std::string>& (setting_type::*GetTagObjectHltPaths)(
void)
const,
33 std::vector<std::string>& (setting_type::*GetProbeObjectHltPaths)(
void)
const,
36 std::vector<std::pair<TTag*, TProbe*> > product_type::*triggerTagProbeObjectPairsMember,
37 std::vector<std::pair<bool, bool> > product_type::*triggerTagProbeObjectMatchedPairsMember
40 m_tagObjectsMember(tagObjectsMember),
41 m_probeObjectsMember(probeObjectsMember),
42 m_detailedTriggerMatchedTagObjectsMember(detailedTriggerMatchedTagObjectsMember),
43 m_detailedTriggerMatchedProbeObjectsMember(detailedTriggerMatchedProbeObjectsMember),
44 GetTagObjectHltPaths(GetTagObjectHltPaths),
45 GetProbeObjectHltPaths(GetProbeObjectHltPaths),
48 m_triggerTagProbeObjectPairsMember(triggerTagProbeObjectPairsMember),
49 m_triggerTagProbeObjectMatchedPairsMember(triggerTagProbeObjectMatchedPairsMember)
53 virtual void Init(setting_type
const& settings, metadata_type& metadata)
override
55 ProducerBase<HttTypes>::Init(settings, metadata);
58 virtual void Produce(event_type
const& event, product_type & product,
59 setting_type
const& settings, metadata_type
const& metadata)
const override
61 assert((product.*m_tagObjectsMember).size() > 0);
62 assert((product.*m_probeObjectsMember).size() > 0);
64 for (
typename std::vector<TTag*>::iterator tagObject = (product.*m_tagObjectsMember).begin();
65 tagObject != (product.*m_tagObjectsMember).end(); ++tagObject)
67 std::vector<std::string> tagFiredHltPaths = TriggerMatchingProducerBase<TObject>::GetHltNamesWhereAllFiltersMatched(SafeMap::GetWithDefault(
68 (product.*m_detailedTriggerMatchedTagObjectsMember),
70 std::map<std::string, std::map<std::string, std::vector<KLV*> > >()
73 bool matchedTagObject =
false;
74 for (std::vector<std::string>::iterator tagFiredHltPath = tagFiredHltPaths.begin();
75 tagFiredHltPath != tagFiredHltPaths.end(); ++tagFiredHltPath)
77 for (std::vector<std::string>::iterator tagObjectHltPath = (settings.*GetTagObjectHltPaths)().
begin();
78 tagObjectHltPath != (settings.*GetTagObjectHltPaths)().end(); ++tagObjectHltPath)
80 if (boost::regex_search(*tagFiredHltPath,
boost::regex(*tagObjectHltPath, boost::regex::icase | boost::regex::extended)))
82 matchedTagObject =
true;
88 for (
typename std::vector<TProbe*>::iterator probeObject = (product.*m_probeObjectsMember).begin();
89 probeObject != (product.*m_probeObjectsMember).end(); ++probeObject)
91 if ((static_cast<void*>(*tagObject) !=
static_cast<void*
>(*probeObject)) &&
92 ROOT::Math::VectorUtil::DeltaR((*tagObject)->p4, (*probeObject)->p4) > settings.GetDiTauPairMinDeltaRCut())
94 std::vector<std::string> probeFiredHltPaths = TriggerMatchingProducerBase<TObject>::GetHltNamesWhereAllFiltersMatched(SafeMap::GetWithDefault(
95 (product.*m_detailedTriggerMatchedProbeObjectsMember),
97 std::map<std::string, std::map<std::string, std::vector<KLV*> > >()
100 bool matchedProbeObject =
false;
101 for (std::vector<std::string>::iterator probeFiredHltPath = probeFiredHltPaths.begin();
102 probeFiredHltPath != probeFiredHltPaths.end(); ++probeFiredHltPath)
104 for (std::vector<std::string>::iterator probeObjectHltPath = (settings.*GetProbeObjectHltPaths)().
begin();
105 probeObjectHltPath != (settings.*GetProbeObjectHltPaths)().end(); ++probeObjectHltPath)
107 if (boost::regex_search(*probeFiredHltPath,
boost::regex(*probeObjectHltPath, boost::regex::icase | boost::regex::extended)))
109 matchedProbeObject =
true;
115 (product.*m_triggerTagProbeObjectPairsMember).push_back(std::pair<TTag*, TProbe*>(*tagObject, *probeObject));
116 (product.*m_triggerTagProbeObjectMatchedPairsMember).push_back(std::pair<bool, bool>(matchedTagObject, matchedProbeObject));
124 std::vector<TTag*> product_type::*m_tagObjectsMember;
125 std::vector<TProbe*> product_type::*m_probeObjectsMember;
126 std::map<TTag*, std::map<std::string, std::map<std::string, std::vector<KLV*> > > > product_type::*m_detailedTriggerMatchedTagObjectsMember;
127 std::map<TProbe*, std::map<std::string, std::map<std::string, std::vector<KLV*> > > > product_type::*m_detailedTriggerMatchedProbeObjectsMember;
128 std::vector<std::string>& (setting_type::*GetTagObjectHltPaths)(
void)
const;
129 std::vector<std::string>& (setting_type::*GetProbeObjectHltPaths)(
void)
const;
132 std::vector<std::pair<TTag*, TProbe*> > product_type::*m_triggerTagProbeObjectPairsMember;
133 std::vector<std::pair<bool, bool> > product_type::*m_triggerTagProbeObjectMatchedPairsMember;
ETTriggerTagAndProbeProducer()
Definition: TriggerTagAndProbeProducers.cc:71
MTTriggerTagAndProbeProducer()
Definition: TriggerTagAndProbeProducers.cc:49
EETriggerTagAndProbeProducer()
Definition: TriggerTagAndProbeProducers.cc:5
virtual std::string GetProducerId() const override
Definition: TriggerTagAndProbeProducers.cc:43
virtual std::string GetProducerId() const override
Definition: TriggerTagAndProbeProducers.cc:87
TriggerTagAndProbeProducerBase(std::vector< TTag * > product_type::*tagObjectsMember, std::vector< TProbe * > product_type::*probeObjectsMember, std::map< TTag *, std::map< std::string, std::map< std::string, std::vector< KLV * > > > > product_type::*detailedTriggerMatchedTagObjectsMember, std::map< TProbe *, std::map< std::string, std::map< std::string, std::vector< KLV * > > > > product_type::*detailedTriggerMatchedProbeObjectsMember, std::vector< std::string > &(setting_type::*GetTagObjectHltPaths)(void) const, std::vector< std::string > &(setting_type::*GetProbeObjectHltPaths)(void) const, std::vector< std::pair< TTag *, TProbe * > > product_type::*triggerTagProbeObjectPairsMember, std::vector< std::pair< bool, bool > > product_type::*triggerTagProbeObjectMatchedPairsMember)
Definition: TriggerTagAndProbeProducers.h:27
virtual std::string GetProducerId() const override
Definition: TriggerTagAndProbeProducers.cc:21
virtual void Init(setting_type const &settings, metadata_type &metadata) override
Definition: TriggerTagAndProbeProducers.h:53
Definition: TriggerTagAndProbeProducers.h:155
MMTriggerTagAndProbeProducer()
Definition: TriggerTagAndProbeProducers.cc:27
Definition: TriggerTagAndProbeProducers.h:23
Definition: TriggerTagAndProbeProducers.h:163
Definition: TriggerTagAndProbeProducers.h:139
Definition: TriggerTagAndProbeProducers.h:147
virtual void Produce(event_type const &event, product_type &product, setting_type const &settings, metadata_type const &metadata) const override
Definition: TriggerTagAndProbeProducers.h:58
all data types which are used for Htt analyses
Definition: HttTypes.h:27
tuple regex
Definition: plot_overtraining.py:51
begin
Definition: plot_BDTSeparation.py:82
virtual std::string GetProducerId() const override
Definition: TriggerTagAndProbeProducers.cc:65