CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/PhysicsTools/IsolationAlgos/src/EventDependentAbsVetos.cc

Go to the documentation of this file.
00001 
00002 #include "PhysicsTools/IsolationAlgos/interface/EventDependentAbsVetos.h"
00003 #include "DataFormats/Common/interface/View.h"
00004 #include "DataFormats/Candidate/interface/Candidate.h"
00005 #include "DataFormats/Math/interface/deltaR.h"
00006 
00007 bool 
00008 reco::isodeposit::OtherCandidatesDeltaRVeto::veto(double eta, double phi, float value) const 
00009 {
00010     for (std::vector<Direction>::const_iterator it = items_.begin(), ed = items_.end(); it != ed; ++it) {
00011         if (::deltaR2(it->eta(), it->phi(), eta, phi) < deltaR2_) return true;
00012     }
00013     return false;
00014 }
00015 
00016 void
00017 reco::isodeposit::OtherCandidatesDeltaRVeto::setEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
00018     items_.clear();
00019     edm::Handle<edm::View<reco::Candidate> > candidates;
00020     iEvent.getByLabel(src_, candidates);
00021     for (edm::View<reco::Candidate>::const_iterator it = candidates->begin(), ed = candidates->end(); it != ed; ++it) {
00022         items_.push_back(Direction(it->eta(), it->phi()));
00023     }
00024 }
00025 
00026 bool 
00027 reco::isodeposit::OtherCandVeto::veto(double eta, double phi, float value) const 
00028 {
00029     for (std::vector<Direction>::const_iterator it = items_.begin(), ed = items_.end(); it != ed; ++it) {
00030         veto_->centerOn(it->eta(), it->phi());
00031         if ( veto_->veto(eta,phi,value) ) return true;
00032     }
00033     return false;
00034 }
00035 
00036 void
00037 reco::isodeposit::OtherCandVeto::setEvent(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
00038     items_.clear();
00039     edm::Handle<edm::View<reco::Candidate> > candidates;
00040     iEvent.getByLabel(src_, candidates);
00041     for (edm::View<reco::Candidate>::const_iterator it = candidates->begin(), ed = candidates->end(); it != ed; ++it) {
00042         items_.push_back(Direction(it->eta(), it->phi()));
00043     }
00044 }
00045