CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/TopQuarkAnalysis/TopJetCombination/plugins/TtFullHadHypGenMatch.cc

Go to the documentation of this file.
00001 #include "TopQuarkAnalysis/TopJetCombination/plugins/TtFullHadHypGenMatch.h"
00002 #include "AnalysisDataFormats/TopObjects/interface/TtFullHadEvtPartons.h"
00003 
00004 TtFullHadHypGenMatch::TtFullHadHypGenMatch(const edm::ParameterSet& cfg):
00005   TtFullHadHypothesis( cfg ) 
00006 {  
00007 }
00008 
00009 TtFullHadHypGenMatch::~TtFullHadHypGenMatch() { }
00010 
00011 void
00012 TtFullHadHypGenMatch::buildHypo(edm::Event& evt,
00013                                 const edm::Handle<std::vector<pat::Jet> >& jets, 
00014                                 std::vector<int>& match,
00015                                 const unsigned int iComb)
00016 {
00017   // -----------------------------------------------------
00018   // get genEvent (to distinguish between uds and c quarks)
00019   // -----------------------------------------------------
00020   edm::Handle<TtGenEvent> genEvt;
00021   evt.getByLabel("genEvt", genEvt);
00022 
00023   // -----------------------------------------------------
00024   // add jets
00025   // -----------------------------------------------------
00026   for(unsigned idx=0; idx<match.size(); ++idx){
00027     if( isValid(match[idx], jets) ){
00028       switch(idx){
00029       case TtFullHadEvtPartons::LightQ:
00030         if( std::abs(genEvt->daughterQuarkOfWPlus()->pdgId())==4 )
00031           setCandidate(jets, match[idx], lightQ_   , jetCorrectionLevel("cQuark"));
00032         else
00033           setCandidate(jets, match[idx], lightQ_   , jetCorrectionLevel("udsQuark"));
00034         break;
00035       case TtFullHadEvtPartons::LightQBar:
00036         if( std::abs(genEvt->daughterQuarkBarOfWPlus()->pdgId())==4 )
00037           setCandidate(jets, match[idx], lightQBar_, jetCorrectionLevel("cQuark"));
00038         else
00039           setCandidate(jets, match[idx], lightQBar_, jetCorrectionLevel("udsQuark"));
00040         break;
00041       case TtFullHadEvtPartons::B:
00042         setCandidate(jets, match[idx], b_          , jetCorrectionLevel("bQuark")); break;
00043       case TtFullHadEvtPartons::LightP:
00044         if( std::abs(genEvt->daughterQuarkOfWMinus()->pdgId())==4 )
00045           setCandidate(jets, match[idx], lightP_   , jetCorrectionLevel("cQuark"));
00046         else
00047           setCandidate(jets, match[idx], lightP_   , jetCorrectionLevel("udsQuark"));
00048         break;
00049       case TtFullHadEvtPartons::LightPBar:
00050         if( std::abs(genEvt->daughterQuarkBarOfWMinus()->pdgId())==4 )
00051           setCandidate(jets, match[idx], lightPBar_, jetCorrectionLevel("cQuark"));
00052         else
00053           setCandidate(jets, match[idx], lightPBar_, jetCorrectionLevel("udsQuark"));
00054         break;
00055       case TtFullHadEvtPartons::BBar:
00056         setCandidate(jets, match[idx], bBar_       , jetCorrectionLevel("bQuark")); break;      
00057       }
00058     }
00059   }
00060 }