CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/TopQuarkAnalysis/TopSkimming/interface/TtDecayChannelSelector.h

Go to the documentation of this file.
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   // return the check sum of all entries
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 restrictTauDecays_;
00046   bool allowLepton_;
00048   bool allow1Prong_;
00050   bool allow3Prong_;
00052   Decay decayBranchA_;
00054   Decay decayBranchB_;
00057   Decay allowedDecays_;
00058 };
00059 
00060 inline unsigned int
00061 TtDecayChannelSelector::decayChannel() const
00062 {
00063   unsigned int channel=0;
00064   if( std::count(decayBranchA_.begin(), decayBranchA_.end(), 1) > 0 ){ 
00065     ++channel; 
00066   }
00067   if( std::count(decayBranchB_.begin(), decayBranchB_.end(), 1) > 0 ){ 
00068     ++channel; 
00069   }
00070   return channel;
00071 }
00072 
00073 inline unsigned int
00074 TtDecayChannelSelector::checkSum(const Decay& vec) const
00075 {
00076   unsigned int sum=0;
00077   for(unsigned int d=0; d<vec.size(); ++d){
00078     sum+=vec[d];
00079   }
00080   return sum;
00081 }