HiggsAnalysis-KITHiggsToTauTau
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
GenDiTauPairCandidatesProducers.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <boost/regex.hpp>
5 
6 #include "Kappa/DataFormats/interface/Kappa.h"
7 
8 #include "Artus/Core/interface/ProducerBase.h"
9 #include "Artus/Consumer/interface/LambdaNtupleConsumer.h"
10 #include "Artus/Utility/interface/Utility.h"
11 
12 #include "HiggsAnalysis/KITHiggsToTauTau/interface/HttTypes.h"
13 
19 template<class TGenLepton1, class TGenLepton2>
20 class GenDiTauPairCandidatesProducerBase: public ProducerBase<HttTypes>
21 {
22 public:
23 
24  GenDiTauPairCandidatesProducerBase(std::vector<TGenLepton1*> product_type::*genLeptonsMember1,
25  std::vector<TGenLepton2*> product_type::*genLeptonsMember2) :
26  ProducerBase<HttTypes>(),
27  m_genLeptonsMember1(genLeptonsMember1),
28  m_genLeptonsMember2(genLeptonsMember2)
29  {
30  }
31 
32  virtual void Init(setting_type const& settings, metadata_type& metadata) override
33  {
34  ProducerBase<HttTypes>::Init(settings, metadata);
35 
36  // add possible quantities for the lambda ntuples consumers
37  LambdaNtupleConsumer<HttTypes>::AddIntQuantity(metadata, "nGenDiTauPairCandidates", [](event_type const& event, product_type const& product)
38  {
39  return static_cast<int>(product.m_genDiTauPairCandidates.size());
40  });
41  }
42 
43  virtual void Produce(event_type const& event, product_type & product,
44  setting_type const& settings, metadata_type const& metadata) const override
45  {
46  product.m_genDiTauPairCandidates.clear();
47 
48  // build pairs for all combinations
49  for (typename std::vector<TGenLepton1*>::iterator lepton1 = (product.*m_genLeptonsMember1).begin();
50  lepton1 != (product.*m_genLeptonsMember1).end(); ++lepton1)
51  {
52  for (typename std::vector<TGenLepton2*>::iterator lepton2 = (product.*m_genLeptonsMember2).begin();
53  lepton2 != (product.*m_genLeptonsMember2).end(); ++lepton2)
54  {
55  DiGenTauPair diGenTauPair(*lepton1, *lepton2);
56 
57  // avoid self-pairs and combinatorics (pair 1-2 = pair 2-1)
58  bool pairInVector = false;
59  for (std::vector<DiGenTauPair>::iterator pair = product.m_genDiTauPairCandidates.begin();
60  pair != product.m_genDiTauPairCandidates.end() && !pairInVector; ++pair)
61  {
62  if ((diGenTauPair.first->p4 == (*pair).second->p4) && (diGenTauPair.second->p4 == (*pair).first->p4))
63  pairInVector = true;
64  }
65  if ((diGenTauPair.GetDeltaR() > 0) && !pairInVector)
66  {
67  product.m_genDiTauPairCandidates.push_back(diGenTauPair);
68  }
69  }
70  }
71  }
72 
73 private:
74  std::vector<TGenLepton1*> product_type::*m_genLeptonsMember1;
75  std::vector<TGenLepton2*> product_type::*m_genLeptonsMember2;
76 
77 };
78 
79 
81 {
82 public:
84  virtual std::string GetProducerId() const override;
85 };
86 
88 {
89 public:
91  virtual std::string GetProducerId() const override;
92 };
93 
95 {
96 public:
98  virtual std::string GetProducerId() const override;
99 };
100 
101 class GenEMPairCandidatesProducer: public GenDiTauPairCandidatesProducerBase<KGenParticle, KGenParticle>
102 {
103 public:
105  virtual std::string GetProducerId() const override;
106 };
107 
108 class GenMMPairCandidatesProducer: public GenDiTauPairCandidatesProducerBase<KGenParticle, KGenParticle>
109 {
110 public:
112  virtual std::string GetProducerId() const override;
113 };
114 
115 class GenEEPairCandidatesProducer: public GenDiTauPairCandidatesProducerBase<KGenParticle, KGenParticle>
116 {
117 public:
119  virtual std::string GetProducerId() const override;
120 };
virtual std::string GetProducerId() const override
Definition: GenDiTauPairCandidatesProducers.cc:27
Definition: GenDiTauPairCandidatesProducers.h:94
Definition: DiGenTauPair.h:7
GenTTPairCandidatesProducer()
Definition: GenDiTauPairCandidatesProducers.cc:5
GenMMPairCandidatesProducer()
Definition: GenDiTauPairCandidatesProducers.cc:61
GenEMPairCandidatesProducer()
Definition: GenDiTauPairCandidatesProducers.cc:47
virtual void Produce(event_type const &event, product_type &product, setting_type const &settings, metadata_type const &metadata) const override
Definition: GenDiTauPairCandidatesProducers.h:43
virtual std::string GetProducerId() const override
Definition: GenDiTauPairCandidatesProducers.cc:13
Definition: GenDiTauPairCandidatesProducers.h:115
virtual std::string GetProducerId() const override
Definition: GenDiTauPairCandidatesProducers.cc:69
Definition: GenDiTauPairCandidatesProducers.h:108
GenETPairCandidatesProducer()
Definition: GenDiTauPairCandidatesProducers.cc:33
virtual std::string GetProducerId() const override
Definition: GenDiTauPairCandidatesProducers.cc:55
GenEEPairCandidatesProducer()
Definition: GenDiTauPairCandidatesProducers.cc:75
Definition: GenDiTauPairCandidatesProducers.h:80
Definition: GenDiTauPairCandidatesProducers.h:87
virtual std::string GetProducerId() const override
Definition: GenDiTauPairCandidatesProducers.cc:83
virtual void Init(setting_type const &settings, metadata_type &metadata) override
Definition: GenDiTauPairCandidatesProducers.h:32
GenMTPairCandidatesProducer()
Definition: GenDiTauPairCandidatesProducers.cc:19
virtual std::string GetProducerId() const override
Definition: GenDiTauPairCandidatesProducers.cc:41
all data types which are used for Htt analyses
Definition: HttTypes.h:27
Definition: GenDiTauPairCandidatesProducers.h:101
double GetDeltaR()
Definition: DiGenTauPair.cc:14
Producers for generator-level di-tau pairs candidates.
Definition: GenDiTauPairCandidatesProducers.h:20
GenDiTauPairCandidatesProducerBase(std::vector< TGenLepton1 * > product_type::*genLeptonsMember1, std::vector< TGenLepton2 * > product_type::*genLeptonsMember2)
Definition: GenDiTauPairCandidatesProducers.h:24