Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "RecoEgamma/EgammaIsolationAlgos/plugins/EgammaPhotonTkNumIsolationProducer.h"
00011
00012
00013 #include "DataFormats/Common/interface/Handle.h"
00014
00015 #include "DataFormats/Candidate/interface/Candidate.h"
00016 #include "DataFormats/Candidate/interface/CandAssociation.h"
00017 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00018 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00019
00020 #include "RecoEgamma/EgammaIsolationAlgos/interface/PhotonTkIsolation.h"
00021
00022
00023 EgammaPhotonTkNumIsolationProducer::EgammaPhotonTkNumIsolationProducer(const edm::ParameterSet& config) : conf_(config)
00024 {
00025
00026 photonProducer_ = conf_.getParameter<edm::InputTag>("photonProducer");
00027
00028 trackProducer_ = conf_.getParameter<edm::InputTag>("trackProducer");
00029 beamspotProducer_ = conf_.getParameter<edm::InputTag>("BeamspotProducer");
00030
00031 ptMin_ = conf_.getParameter<double>("ptMin");
00032 intRadiusBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
00033 intRadiusEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
00034 stripBarrel_ = conf_.getParameter<double>("stripBarrel");
00035 stripEndcap_ = conf_.getParameter<double>("stripEndcap");
00036 extRadius_ = conf_.getParameter<double>("extRadius");
00037 maxVtxDist_ = conf_.getParameter<double>("maxVtxDist");
00038 drb_ = conf_.getParameter<double>("maxVtxDistXY");
00039
00040
00041 produces < edm::ValueMap<int> >();
00042 }
00043
00044
00045 EgammaPhotonTkNumIsolationProducer::~EgammaPhotonTkNumIsolationProducer(){}
00046
00047
00048
00049
00050
00051
00052
00053 void
00054 EgammaPhotonTkNumIsolationProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00055 {
00056
00057
00058 edm::Handle< edm::View<reco::Candidate> > photonHandle;
00059 iEvent.getByLabel(photonProducer_,photonHandle);
00060
00061
00062 edm::Handle<reco::TrackCollection> tracks;
00063 iEvent.getByLabel(trackProducer_,tracks);
00064 const reco::TrackCollection* trackCollection = tracks.product();
00065
00066
00067 edm::Handle<reco::BeamSpot> beamSpotH;
00068 iEvent.getByLabel(beamspotProducer_,beamSpotH);
00069 reco::TrackBase::Point beamspot = beamSpotH->position();
00070
00071
00072 std::auto_ptr<edm::ValueMap<int> > isoMap(new edm::ValueMap<int>());
00073 edm::ValueMap<int>::Filler filler(*isoMap);
00074 std::vector<int> retV(photonHandle->size(),0);
00075
00076 PhotonTkIsolation myTkIsolation(extRadius_,intRadiusBarrel_,intRadiusEndcap_,stripBarrel_,stripEndcap_,ptMin_,maxVtxDist_,drb_,trackCollection,beamspot) ;
00077
00078 for(unsigned int i = 0 ; i < photonHandle->size(); ++i ){
00079 int isoValue = myTkIsolation.getNumberTracks(&(photonHandle->at(i)));
00080 retV[i] = isoValue;
00081 }
00082
00083
00084
00085
00086 filler.insert(photonHandle,retV.begin(),retV.end());
00087 filler.fill();
00088 iEvent.put(isoMap);
00089
00090
00091 }
00092
00093