CMS 3D CMS Logo

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