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