CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepHypKinFit.cc

Go to the documentation of this file.
00001 #include "DataFormats/PatCandidates/interface/Particle.h"
00002 #include "TopQuarkAnalysis/TopJetCombination/plugins/TtSemiLepHypKinFit.h"
00003 
00004 
00005 TtSemiLepHypKinFit::TtSemiLepHypKinFit(const edm::ParameterSet& cfg):
00006   TtSemiLepHypothesis( cfg ),
00007   status_     (cfg.getParameter<edm::InputTag>("status"     )),
00008   partonsHadP_(cfg.getParameter<edm::InputTag>("partonsHadP")),
00009   partonsHadQ_(cfg.getParameter<edm::InputTag>("partonsHadQ")),
00010   partonsHadB_(cfg.getParameter<edm::InputTag>("partonsHadB")),
00011   partonsLepB_(cfg.getParameter<edm::InputTag>("partonsLepB")),
00012   leptons_    (cfg.getParameter<edm::InputTag>("leptons"    )),
00013   neutrinos_  (cfg.getParameter<edm::InputTag>("neutrinos"  ))
00014 {
00015 }
00016 
00017 TtSemiLepHypKinFit::~TtSemiLepHypKinFit() { }
00018 
00019 void
00020 TtSemiLepHypKinFit::buildHypo(edm::Event& evt,
00021                               const edm::Handle<edm::View<reco::RecoCandidate> >& leps, 
00022                               const edm::Handle<std::vector<pat::MET> >& mets, 
00023                               const edm::Handle<std::vector<pat::Jet> >& jets, 
00024                               std::vector<int>& match, const unsigned int iComb)
00025 {
00026   edm::Handle<std::vector<int> > status;
00027   evt.getByLabel(status_, status);
00028   if( (*status)[iComb] != 0 ){
00029     // create empty hypothesis if kinematic fit did not converge
00030     return;
00031   }
00032 
00033   edm::Handle<std::vector<pat::Particle> > partonsHadP;
00034   edm::Handle<std::vector<pat::Particle> > partonsHadQ;
00035   edm::Handle<std::vector<pat::Particle> > partonsHadB;
00036   edm::Handle<std::vector<pat::Particle> > partonsLepB;
00037   edm::Handle<std::vector<pat::Particle> > leptons;
00038   edm::Handle<std::vector<pat::Particle> > neutrinos;
00039 
00040   evt.getByLabel(partonsHadP_,   partonsHadP);
00041   evt.getByLabel(partonsHadQ_,   partonsHadQ);
00042   evt.getByLabel(partonsHadB_,   partonsHadB);
00043   evt.getByLabel(partonsLepB_,   partonsLepB);
00044   evt.getByLabel(leptons_    ,   leptons    );
00045   evt.getByLabel(neutrinos_  ,   neutrinos  );
00046 
00047   // -----------------------------------------------------
00048   // add jets
00049   // -----------------------------------------------------
00050   if( !( partonsHadP->empty() || partonsHadQ->empty() ||
00051          partonsHadB->empty() || partonsLepB->empty() ) ) {
00052     setCandidate(partonsHadP, iComb, lightQ_   );
00053     setCandidate(partonsHadQ, iComb, lightQBar_);
00054     setCandidate(partonsHadB, iComb, hadronicB_);
00055     setCandidate(partonsLepB, iComb, leptonicB_);
00056   }
00057 
00058   // -----------------------------------------------------
00059   // add lepton
00060   // -----------------------------------------------------
00061   if( !leptons->empty() ){
00062     setCandidate(leptons, iComb, lepton_);
00063   }
00064   match.push_back( 0 );
00065   
00066   // -----------------------------------------------------
00067   // add neutrino
00068   // -----------------------------------------------------
00069   if( !neutrinos->empty() ){
00070     setCandidate(neutrinos, iComb, neutrino_);
00071   }
00072 }