CMS 3D CMS Logo

TtDecayChannelSelector.h
Go to the documentation of this file.
1 #include <vector>
2 #include <cstring>
3 #include <iostream>
4 #include <string_view>
5 
8 
10 public:
12  enum { Elec = 0, Muon = 1, Tau = 2 };
14  typedef std::vector<int> Decay;
15 
19  bool operator()(const reco::GenParticleCollection& parts, std::string_view inputType) const;
20 
21 private:
23  unsigned int decayChannel() const;
24  // return the check sum of all entries
25  unsigned int checkSum(const Decay& vec) const;
27  bool search(reco::GenParticleCollection::const_iterator& part, int pdgId, std::string_view inputType) const;
29  bool search(reco::GenParticle::const_iterator& part, int pdgId, std::string_view inputType) const;
31  bool tauDecay(const reco::Candidate&) const;
33  unsigned int countProngs(const reco::Candidate& part) const;
34 
35 private:
37  bool invert_;
43  bool allowMuon_;
55 };
56 
57 inline unsigned int TtDecayChannelSelector::decayChannel() const {
58  unsigned int channel = 0;
59  if (std::count(decayBranchA_.begin(), decayBranchA_.end(), 1) > 0) {
60  ++channel;
61  }
62  if (std::count(decayBranchB_.begin(), decayBranchB_.end(), 1) > 0) {
63  ++channel;
64  }
65  return channel;
66 }
67 
68 inline unsigned int TtDecayChannelSelector::checkSum(const Decay& vec) const {
69  unsigned int sum = 0;
70  for (unsigned int d = 0; d < vec.size(); ++d) {
71  sum += vec[d];
72  }
73  return sum;
74 }
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Decay decayBranchA_
top decay branch 1
unsigned int checkSum(const Decay &vec) const
bool tauDecay(const reco::Candidate &) const
check tau decay to be leptonic, 1-prong or 3-prong
unsigned int countProngs(const reco::Candidate &part) const
count the number of charged particles for tau decays
Definition: Muon.py:1
bool restrictTauDecays_
restrict tau decays
TtDecayChannelSelector(const edm::ParameterSet &)
std contructor
d
Definition: ztail.py:151
unsigned int decayChannel() const
return decay channel to select for from configuration
Decay decayBranchB_
top decay branch 2
bool allowElectron_
allow tau decays into electron
bool allow3Prong_
allow 2-prong tau decays
Definition: Tau.py:1
bool allowMuon_
allow tau decays into muon
part
Definition: HCALResponse.h:20
std::vector< int > Decay
typedef to simplify the decay vectors
bool operator()(const reco::GenParticleCollection &parts, std::string_view inputType) const
operator for decay channel selection
bool allow1Prong_
allow 1-prong tau decays
bool search(reco::GenParticleCollection::const_iterator &part, int pdgId, std::string_view inputType) const
search for particle with pdgId in given listing (for top)
bool invert_
invert selection