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