CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/TopQuarkAnalysis/TopJetCombination/plugins/TtFullHadHypKinFit.cc

Go to the documentation of this file.
00001 #include "DataFormats/PatCandidates/interface/Particle.h"
00002 #include "TopQuarkAnalysis/TopJetCombination/plugins/TtFullHadHypKinFit.h"
00003 
00004 
00005 TtFullHadHypKinFit::TtFullHadHypKinFit(const edm::ParameterSet& cfg):
00006   TtFullHadHypothesis( cfg ),
00007   status_      (cfg.getParameter<edm::InputTag>("status"      )),
00008   lightQTag_   (cfg.getParameter<edm::InputTag>("lightQTag"   )),
00009   lightQBarTag_(cfg.getParameter<edm::InputTag>("lightQBarTag")),
00010   bTag_        (cfg.getParameter<edm::InputTag>("bTag"        )),
00011   bBarTag_     (cfg.getParameter<edm::InputTag>("bBarTag"     )),
00012   lightPTag_   (cfg.getParameter<edm::InputTag>("lightPTag"   )),
00013   lightPBarTag_(cfg.getParameter<edm::InputTag>("lightPBarTag"))
00014 {
00015 }
00016 
00017 TtFullHadHypKinFit::~TtFullHadHypKinFit() { }
00018 
00019 void
00020 TtFullHadHypKinFit::buildHypo(edm::Event& evt,
00021                               const edm::Handle<std::vector<pat::Jet> >& jets, 
00022                               std::vector<int>& match, const unsigned int iComb)
00023 {
00024   edm::Handle<std::vector<int> > status;
00025   evt.getByLabel(status_, status);
00026   if( (*status)[iComb] != 0 ){
00027     // create empty hypothesis if kinematic fit did not converge
00028     return;
00029   }
00030 
00031   edm::Handle<std::vector<pat::Particle> > lightQ;
00032   edm::Handle<std::vector<pat::Particle> > lightQBar;
00033   edm::Handle<std::vector<pat::Particle> > b;
00034   edm::Handle<std::vector<pat::Particle> > bBar;
00035   edm::Handle<std::vector<pat::Particle> > lightP;
00036   edm::Handle<std::vector<pat::Particle> > lightPBar;
00037 
00038   evt.getByLabel(lightQTag_   , lightQ   );
00039   evt.getByLabel(lightQBarTag_, lightQBar);
00040   evt.getByLabel(bTag_        , b        );
00041   evt.getByLabel(bBarTag_     , bBar     );
00042   evt.getByLabel(lightPTag_   , lightP   );
00043   evt.getByLabel(lightPBarTag_, lightPBar);
00044 
00045   // -----------------------------------------------------
00046   // add jets
00047   // -----------------------------------------------------
00048   if( !( lightQ->empty() || lightQBar->empty() || b->empty() || bBar->empty() ||
00049          lightP->empty() || lightPBar->empty() ) ) {
00050     setCandidate(lightQ   , iComb, lightQ_   );
00051     setCandidate(lightQBar, iComb, lightQBar_);
00052     setCandidate(b        , iComb, b_        );
00053     setCandidate(bBar     , iComb, bBar_     );
00054     setCandidate(lightP   , iComb, lightP_   );
00055     setCandidate(lightPBar, iComb, lightPBar_);
00056   }
00057 }