CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/RecoMuon/MuonIsolation/src/MuPFIsoHelper.cc

Go to the documentation of this file.
00001 #include "RecoMuon/MuonIsolation/interface/MuPFIsoHelper.h"
00002 
00003 
00004 MuPFIsoHelper::MuPFIsoHelper(const edm::ParameterSet& iConfig):
00005   isoCfg03_(iConfig.getParameter<edm::ParameterSet>("isolationR03")),
00006   isoCfg04_(iConfig.getParameter<edm::ParameterSet>("isolationR04"))
00007 {
00008   
00009 
00010 }
00011 
00012 
00013 
00014 MuPFIsoHelper::~MuPFIsoHelper() {
00015 
00016 }
00017 
00018 
00019 
00020 int MuPFIsoHelper::embedPFIsolation(reco::Muon& muon,reco::MuonRef& muonRef ) {
00021   reco::MuonPFIsolation isoR3;
00022   if(chargedParticle03_.isValid()) {
00023        isoR3.sumChargedParticlePt = (*chargedParticle03_)[muonRef];
00024   }
00025   else {    return -1;}
00026 
00027   if(chargedHadron03_.isValid()) {
00028        isoR3.sumChargedHadronPt = (*chargedHadron03_)[muonRef];
00029   }
00030   else {    return -1;}
00031 
00032   if(neutralHadron03_.isValid()) {
00033        isoR3.sumNeutralHadronEt = (*neutralHadron03_)[muonRef];
00034   }
00035   else {    return -1;}
00036 
00037   if(photon03_.isValid()) {
00038        isoR3.sumPhotonEt = (*photon03_)[muonRef];
00039   }
00040   else {    return -1;}
00041 
00042   if(pu03_.isValid()) {
00043        isoR3.sumPUPt = (*pu03_)[muonRef];
00044   }
00045   else {    return -1;}
00046 
00047 
00048 
00049   reco::MuonPFIsolation isoR4;
00050   if(chargedParticle04_.isValid()) {
00051        isoR4.sumChargedParticlePt = (*chargedParticle04_)[muonRef];
00052   }
00053   else {    return -1;}
00054 
00055   if(chargedHadron04_.isValid()) {
00056        isoR4.sumChargedHadronPt = (*chargedHadron04_)[muonRef];
00057   }
00058   else {    return -1;}
00059 
00060   if(neutralHadron04_.isValid()) {
00061        isoR4.sumNeutralHadronEt = (*neutralHadron04_)[muonRef];
00062   }
00063   else {    return -1;}
00064 
00065   if(photon04_.isValid()) {
00066        isoR4.sumPhotonEt = (*photon04_)[muonRef];
00067   }
00068   else {    return -1;}
00069 
00070   if(pu04_.isValid()) {
00071        isoR4.sumPUPt = (*pu04_)[muonRef];
00072   }
00073   else {    return -1;}
00074 
00075 
00076   muon.setPFIsolation(isoR3,isoR4);
00077                                         
00078   return 0;
00079 }
00080 
00081 
00082 
00083 void MuPFIsoHelper::beginEvent(const edm::Event& iEvent){
00084 
00085   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("chargedParticle"),chargedParticle03_);
00086   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("chargedHadron"),chargedHadron03_);
00087   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("neutralHadron"),neutralHadron03_);
00088   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("photon"),photon03_);
00089   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("pu"),pu03_);
00090 
00091   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("chargedParticle"),chargedParticle04_);
00092   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("chargedHadron"),chargedHadron04_);
00093   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("neutralHadron"),neutralHadron04_);
00094   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("photon"),photon04_);
00095   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("pu"),pu04_);
00096 
00097 }