00001 #include "vector"
00002 #include "string.h"
00003 #include <iostream>
00004
00005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00006 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
00007
00008 class TtDecayChannelSelector {
00009
00010 public:
00011
00013 enum {Elec=0, Muon=1, Tau =2};
00015 typedef std::vector<int> Decay;
00016
00018 TtDecayChannelSelector(const edm::ParameterSet&);
00020 ~TtDecayChannelSelector();
00022 bool operator()(const reco::GenParticleCollection& parts, std::string inputType) const;
00023
00024 private:
00025
00027 unsigned int decayChannel() const;
00028
00029 unsigned int checkSum(const Decay& vec) const;
00031 bool search(reco::GenParticleCollection::const_iterator& part, int pdgId, std::string& inputType) const;
00033 bool search(reco::GenParticle::const_iterator& part, int pdgId, std::string& inputType) const;
00035 bool tauDecay(const reco::Candidate&) const;
00037 unsigned int countProngs(const reco::Candidate& part) const;
00038
00039 private:
00040
00042 bool invert_;
00044 bool allowLepton_;
00046 bool allow1Prong_;
00048 bool allow3Prong_;
00050 Decay decayBranchA_;
00052 Decay decayBranchB_;
00055 Decay allowedDecays_;
00056 };
00057
00058 inline unsigned int
00059 TtDecayChannelSelector::decayChannel() const
00060 {
00061 unsigned int channel=0;
00062 if( std::count(decayBranchA_.begin(), decayBranchA_.end(), 1) > 0 ){
00063 ++channel;
00064 }
00065 if( std::count(decayBranchB_.begin(), decayBranchB_.end(), 1) > 0 ){
00066 ++channel;
00067 }
00068 return channel;
00069 }
00070
00071 inline unsigned int
00072 TtDecayChannelSelector::checkSum(const Decay& vec) const
00073 {
00074 unsigned int sum=0;
00075 for(unsigned int d=0; d<vec.size(); ++d){
00076 sum+=vec[d];
00077 }
00078 return sum;
00079 }