CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/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(neutralHadronHighThreshold03_.isValid()) {
00043        isoR3.sumNeutralHadronEtHighThreshold = (*neutralHadronHighThreshold03_)[muonRef];
00044   }
00045   else {    return -1;}
00046 
00047   if(photonHighThreshold03_.isValid()) {
00048        isoR3.sumPhotonEtHighThreshold = (*photonHighThreshold03_)[muonRef];
00049   }
00050   else {    return -1;}
00051 
00052   if(pu03_.isValid()) {
00053        isoR3.sumPUPt = (*pu03_)[muonRef];
00054   }
00055   else {    return -1;}
00056 
00057 
00058 
00059   reco::MuonPFIsolation isoR4;
00060   if(chargedParticle04_.isValid()) {
00061        isoR4.sumChargedParticlePt = (*chargedParticle04_)[muonRef];
00062   }
00063   else {    return -1;}
00064 
00065   if(chargedHadron04_.isValid()) {
00066        isoR4.sumChargedHadronPt = (*chargedHadron04_)[muonRef];
00067   }
00068   else {    return -1;}
00069 
00070   if(neutralHadron04_.isValid()) {
00071        isoR4.sumNeutralHadronEt = (*neutralHadron04_)[muonRef];
00072   }
00073   else {    return -1;}
00074 
00075   if(photon04_.isValid()) {
00076        isoR4.sumPhotonEt = (*photon04_)[muonRef];
00077   }
00078   else {    return -1;}
00079 
00080   if(neutralHadronHighThreshold04_.isValid()) {
00081        isoR4.sumNeutralHadronEtHighThreshold = (*neutralHadronHighThreshold04_)[muonRef];
00082   }
00083   else {    return -1;}
00084 
00085   if(photonHighThreshold04_.isValid()) {
00086        isoR4.sumPhotonEtHighThreshold = (*photonHighThreshold04_)[muonRef];
00087   }
00088   else {    return -1;}
00089 
00090   if(pu04_.isValid()) {
00091        isoR4.sumPUPt = (*pu04_)[muonRef];
00092   }
00093   else {    return -1;}
00094 
00095 
00096   muon.setPFIsolation(isoR3,isoR4);
00097                                         
00098   return 0;
00099 }
00100 
00101 
00102 
00103 void MuPFIsoHelper::beginEvent(const edm::Event& iEvent){
00104 
00105   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("chargedParticle"),chargedParticle03_);
00106   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("chargedHadron"),chargedHadron03_);
00107   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("neutralHadron"),neutralHadron03_);
00108   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("photon"),photon03_);
00109   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("neutralHadronHighThreshold"),neutralHadronHighThreshold03_);
00110   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("photonHighThreshold"),photonHighThreshold03_);
00111   iEvent.getByLabel(isoCfg03_.getParameter<edm::InputTag>("pu"),pu03_);
00112 
00113   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("chargedParticle"),chargedParticle04_);
00114   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("chargedHadron"),chargedHadron04_);
00115   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("neutralHadron"),neutralHadron04_);
00116   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("photon"),photon04_);
00117   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("neutralHadronHighThreshold"),neutralHadronHighThreshold04_);
00118   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("photonHighThreshold"),photonHighThreshold04_);
00119   iEvent.getByLabel(isoCfg04_.getParameter<edm::InputTag>("pu"),pu04_);
00120 
00121 }