CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/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 allowElectron_;
00048   bool allowMuon_;
00050   bool allow1Prong_;
00052   bool allow3Prong_;
00054   Decay decayBranchA_;
00056   Decay decayBranchB_;
00059   Decay allowedDecays_;
00060 };
00061 
00062 inline unsigned int
00063 TtDecayChannelSelector::decayChannel() const
00064 {
00065   unsigned int channel=0;
00066   if( std::count(decayBranchA_.begin(), decayBranchA_.end(), 1) > 0 ){ 
00067     ++channel; 
00068   }
00069   if( std::count(decayBranchB_.begin(), decayBranchB_.end(), 1) > 0 ){ 
00070     ++channel; 
00071   }
00072   return channel;
00073 }
00074 
00075 inline unsigned int
00076 TtDecayChannelSelector::checkSum(const Decay& vec) const
00077 {
00078   unsigned int sum=0;
00079   for(unsigned int d=0; d<vec.size(); ++d){
00080     sum+=vec[d];
00081   }
00082   return sum;
00083 }