CMS 3D CMS Logo

TtDecayChannelSelector.h
Go to the documentation of this file.
1 #include <vector>
2 #include <cstring>
3 #include <iostream>
4 
7 
9 
10  public:
11 
13  enum {Elec=0, Muon=1, Tau =2};
15  typedef std::vector<int> Decay;
16 
22  bool operator()(const reco::GenParticleCollection& parts, std::string inputType) const;
23 
24  private:
25 
27  unsigned int decayChannel() const;
28  // return the check sum of all entries
29  unsigned int checkSum(const Decay& vec) const;
31  bool search(reco::GenParticleCollection::const_iterator& part, int pdgId, std::string& inputType) const;
33  bool search(reco::GenParticle::const_iterator& part, int pdgId, std::string& inputType) const;
35  bool tauDecay(const reco::Candidate&) const;
37  unsigned int countProngs(const reco::Candidate& part) const;
38 
39  private:
40 
42  bool invert_;
48  bool allowMuon_;
60 };
61 
62 inline unsigned int
64 {
65  unsigned int channel=0;
66  if( std::count(decayBranchA_.begin(), decayBranchA_.end(), 1) > 0 ){
67  ++channel;
68  }
69  if( std::count(decayBranchB_.begin(), decayBranchB_.end(), 1) > 0 ){
70  ++channel;
71  }
72  return channel;
73 }
74 
75 inline unsigned int
77 {
78  unsigned int sum=0;
79  for(unsigned int d=0; d<vec.size(); ++d){
80  sum+=vec[d];
81  }
82  return sum;
83 }
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Decay decayBranchA_
top decay branch 1
bool search(reco::GenParticleCollection::const_iterator &part, int pdgId, std::string &inputType) const
search for particle with pdgId in given listing (for top)
Definition: Muon.py:1
bool restrictTauDecays_
restrict tau decays
TtDecayChannelSelector(const edm::ParameterSet &)
std contructor
unsigned int countProngs(const reco::Candidate &part) const
count the number of charged particles for tau decays
Decay decayBranchB_
top decay branch 2
bool allowElectron_
allow tau decays into electron
bool tauDecay(const reco::Candidate &) const
check tau decay to be leptonic, 1-prong or 3-prong
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
unsigned int decayChannel() const
return decay channel to select for from configuration
unsigned int checkSum(const Decay &vec) const
~TtDecayChannelSelector()
default destructor
bool operator()(const reco::GenParticleCollection &parts, std::string inputType) const
operator for decay channel selection
bool allow1Prong_
allow 1-prong tau decays
bool invert_
invert selection