Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "RecoEgamma/EgammaIsolationAlgos/plugins/EgammaEcalRecHitIsolationProducer.h"
00011
00012
00013 #include "FWCore/Framework/interface/EventSetup.h"
00014 #include "DataFormats/Common/interface/Handle.h"
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016
00017 #include "DataFormats/Candidate/interface/Candidate.h"
00018 #include "DataFormats/Candidate/interface/CandAssociation.h"
00019 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00020 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00021 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00022
00023 #include "DataFormats/DetId/interface/DetId.h"
00024 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00025
00026 #include "Geometry/Records/interface/CaloGeometryRecord.h"
00027
00028 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
00029 #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h"
00030
00031 EgammaEcalRecHitIsolationProducer::EgammaEcalRecHitIsolationProducer(const edm::ParameterSet& config) : conf_(config)
00032 {
00033
00034
00035 emObjectProducer_ = conf_.getParameter<edm::InputTag>("emObjectProducer");
00036 ecalBarrelRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitProducer");
00037 ecalBarrelRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalBarrelRecHitCollection");
00038 ecalEndcapRecHitProducer_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitProducer");
00039 ecalEndcapRecHitCollection_ = conf_.getParameter<edm::InputTag>("ecalEndcapRecHitCollection");
00040
00041
00042 egIsoPtMinBarrel_ = conf_.getParameter<double>("etMinBarrel");
00043 egIsoEMinBarrel_ = conf_.getParameter<double>("eMinBarrel");
00044 egIsoPtMinEndcap_ = conf_.getParameter<double>("etMinEndcap");
00045 egIsoEMinEndcap_ = conf_.getParameter<double>("eMinEndcap");
00046 egIsoConeSizeInBarrel_ = conf_.getParameter<double>("intRadiusBarrel");
00047 egIsoConeSizeInEndcap_ = conf_.getParameter<double>("intRadiusEndcap");
00048 egIsoConeSizeOut_ = conf_.getParameter<double>("extRadius");
00049 egIsoJurassicWidth_ = conf_.getParameter<double>("jurassicWidth");
00050
00051
00052
00053
00054 useIsolEt_ = conf_.getParameter<bool>("useIsolEt");
00055 tryBoth_ = conf_.getParameter<bool>("tryBoth");
00056 subtract_ = conf_.getParameter<bool>("subtract");
00057 useNumCrystals_ = conf_.getParameter<bool>("useNumCrystals");
00058 vetoClustered_ = conf_.getParameter<bool>("vetoClustered");
00059
00060
00061 produces < edm::ValueMap<double> >();
00062 }
00063
00064
00065 EgammaEcalRecHitIsolationProducer::~EgammaEcalRecHitIsolationProducer(){}
00066
00067
00068
00069
00070
00071
00072
00073 void
00074 EgammaEcalRecHitIsolationProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00075 {
00076
00077
00078
00079 edm::Handle< edm::View<reco::Candidate> > emObjectHandle;
00080 iEvent.getByLabel(emObjectProducer_,emObjectHandle);
00081
00082
00083 edm::Handle<EcalRecHitCollection> ecalBarrelRecHitHandle;
00084 iEvent.getByLabel(ecalBarrelRecHitProducer_.label(),ecalBarrelRecHitCollection_.label(), ecalBarrelRecHitHandle);
00085
00086
00087 edm::Handle<EcalRecHitCollection> ecalEndcapRecHitHandle;
00088 iEvent.getByLabel(ecalEndcapRecHitProducer_.label(), ecalEndcapRecHitCollection_.label(),ecalEndcapRecHitHandle);
00089
00090 edm::ESHandle<EcalSeverityLevelAlgo> sevlv;
00091 iSetup.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
00092 const EcalSeverityLevelAlgo* sevLevel = sevlv.product();
00093
00094
00095 EcalRecHitMetaCollection ecalBarrelHits(*ecalBarrelRecHitHandle);
00096 EcalRecHitMetaCollection ecalEndcapHits(*ecalEndcapRecHitHandle);
00097
00098
00099 edm::ESHandle<CaloGeometry> pG;
00100 iSetup.get<CaloGeometryRecord>().get(pG);
00101 const CaloGeometry* caloGeom = pG.product();
00102
00103
00104 std::auto_ptr<edm::ValueMap<double> > isoMap(new edm::ValueMap<double>());
00105 edm::ValueMap<double>::Filler filler(*isoMap);
00106 std::vector<double> retV(emObjectHandle->size(),0);
00107
00108 EgammaRecHitIsolation ecalBarrelIsol(egIsoConeSizeOut_,egIsoConeSizeInBarrel_,egIsoJurassicWidth_,egIsoPtMinBarrel_,egIsoEMinBarrel_,caloGeom,&ecalBarrelHits,sevLevel,DetId::Ecal);
00109 ecalBarrelIsol.setUseNumCrystals(useNumCrystals_);
00110 ecalBarrelIsol.setVetoClustered(vetoClustered_);
00111
00112 EgammaRecHitIsolation ecalEndcapIsol(egIsoConeSizeOut_,egIsoConeSizeInEndcap_,egIsoJurassicWidth_,egIsoPtMinEndcap_,egIsoEMinEndcap_,caloGeom,&ecalEndcapHits,sevLevel,DetId::Ecal);
00113 ecalEndcapIsol.setUseNumCrystals(useNumCrystals_);
00114 ecalEndcapIsol.setVetoClustered(vetoClustered_);
00115
00116
00117 for( size_t i = 0 ; i < emObjectHandle->size(); ++i) {
00118
00119
00120
00121
00122
00123 double isoValue =0.;
00124
00125 reco::SuperClusterRef superClus = emObjectHandle->at(i).get<reco::SuperClusterRef>();
00126
00127 if(tryBoth_){
00128 if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
00129 else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i))) + ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
00130 }
00131 else if( fabs(superClus->eta())<1.479) {
00132 if(useIsolEt_) isoValue = ecalBarrelIsol.getEtSum(&(emObjectHandle->at(i)));
00133 else isoValue = ecalBarrelIsol.getEnergySum(&(emObjectHandle->at(i)));
00134 }
00135 else{
00136 if(useIsolEt_) isoValue = ecalEndcapIsol.getEtSum(&(emObjectHandle->at(i)));
00137 else isoValue = ecalEndcapIsol.getEnergySum(&(emObjectHandle->at(i)));
00138 }
00139
00140
00141 double subtractVal=0;
00142
00143 if(useIsolEt_) subtractVal = superClus.get()->rawEnergy()*sin(2*atan(exp(-superClus.get()->eta())));
00144 else subtractVal = superClus.get()->rawEnergy();
00145
00146 if(subtract_) isoValue-= subtractVal;
00147
00148 retV[i]=isoValue;
00149
00150
00151 }
00152
00153 filler.insert(emObjectHandle,retV.begin(),retV.end());
00154 filler.fill();
00155
00156
00157 iEvent.put(isoMap);
00158
00159 }
00160
00161
00162