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