CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/TopQuarkAnalysis/TopJetCombination/plugins/TtFullLepHypKinSolution.cc

Go to the documentation of this file.
00001 #include "DataFormats/PatCandidates/interface/Particle.h"
00002 #include "TopQuarkAnalysis/TopJetCombination/plugins/TtFullLepHypKinSolution.h"
00003 
00004 
00005 TtFullLepHypKinSolution::TtFullLepHypKinSolution(const edm::ParameterSet& cfg):
00006   TtFullLepHypothesis( cfg ),
00007   nus_         (cfg.getParameter<edm::InputTag>("Neutrinos"      )),
00008   nuBars_      (cfg.getParameter<edm::InputTag>("NeutrinoBars"   )),  
00009   solWeight_   (cfg.getParameter<edm::InputTag>("solutionWeight" )) 
00010 {
00011 }
00012 
00013 TtFullLepHypKinSolution::~TtFullLepHypKinSolution() { }
00014 
00015 void
00016 TtFullLepHypKinSolution::buildHypo(edm::Event& evt,
00017                                    const edm::Handle<std::vector<pat::Electron > >& elecs, 
00018                                    const edm::Handle<std::vector<pat::Muon> >& mus, 
00019                                    const edm::Handle<std::vector<pat::Jet> >& jets, 
00020                                    const edm::Handle<std::vector<pat::MET> >& mets, 
00021                                    std::vector<int>& match,
00022                                    const unsigned int iComb)
00023 { 
00024   edm::Handle<std::vector<double> > solWeight;  
00025   edm::Handle<std::vector<std::vector<int> > >   idcsVec; 
00026   edm::Handle<std::vector<reco::LeafCandidate> > nus;
00027   edm::Handle<std::vector<reco::LeafCandidate> > nuBars;  
00028   
00029   evt.getByLabel(solWeight_,    solWeight);
00030   evt.getByLabel(particleIdcs_, idcsVec  );
00031   evt.getByLabel(nus_,          nus      );
00032   evt.getByLabel(nuBars_,       nuBars   );  
00033 
00034   if( (*solWeight)[iComb]<0 ){
00035     // create empty hypothesis if no solution exists
00036     return;
00037   }
00038 
00039   // -----------------------------------------------------
00040   // add jets
00041   // -----------------------------------------------------
00042   if( !jets->empty() ){
00043     setCandidate(jets, match[0], b_   , jetCorrectionLevel_);
00044     setCandidate(jets, match[1], bBar_, jetCorrectionLevel_);
00045   }
00046   // -----------------------------------------------------
00047   // add leptons
00048   // -----------------------------------------------------    
00049   if( !elecs->empty() && match[2]>=0) 
00050     setCandidate(elecs,  match[2], leptonBar_); 
00051 
00052   if( !elecs->empty() && match[3]>=0)
00053     setCandidate(elecs,  match[3], lepton_);
00054 
00055   if( !mus->empty() && match[4]>=0 && match[2]<0)
00056     setCandidate(mus,  match[4], leptonBar_);  
00057 
00058   // this 'else' happens if you have a wrong charge electron-muon-
00059   // solution so the indices are (b-idx, bbar-idx, 0, -1, 0, -1)
00060   // so the mu^+ is stored as l^-
00061   else if( !mus->empty() && match[4]>=0)
00062     setCandidate(mus,  match[4], lepton_);
00063     
00064   if( !mus->empty()  && match[5]>=0 && match[3]<0) 
00065     setCandidate(mus,  match[5], lepton_);   
00066 
00067   // this 'else' happens if you have a wrong charge electron-muon-
00068   // solution so the indices are (b-idx, bbar-idx, -1, 0, -1, 0)  
00069   // so the mu^- is stored as l^+
00070   else if( !mus->empty()  && match[5]>=0) 
00071     setCandidate(mus,  match[5], leptonBar_);   
00072       
00073   // -----------------------------------------------------
00074   // add neutrinos
00075   // -----------------------------------------------------
00076   if( !nus->empty() )
00077     setCandidate(nus,    iComb, neutrino_);
00078 
00079   if( !nuBars->empty() ) 
00080     setCandidate(nuBars, iComb, neutrinoBar_);   
00081 
00082 }