Go to the documentation of this file.00001
00008 #include <iostream>
00009 #include <vector>
00010 #include <memory>
00011
00012
00013 #include "RecoEgamma/EgammaHLTProducers/interface/EgammaHLTEcalIsolationProducersRegional.h"
00014
00015
00016
00017 #include "FWCore/Framework/interface/Event.h"
00018 #include "FWCore/Framework/interface/EventSetup.h"
00019 #include "DataFormats/Common/interface/Handle.h"
00020
00021 #include "FWCore/Framework/interface/ESHandle.h"
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023 #include "FWCore/Utilities/interface/Exception.h"
00024
00025
00026 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00027 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00028 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00029
00030 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
00031 #include "DataFormats/RecoCandidate/interface/RecoEcalCandidateIsolation.h"
00032
00033
00034 #include "DataFormats/Common/interface/RefToBase.h"
00035 #include "DataFormats/Common/interface/Ref.h"
00036 #include "DataFormats/Common/interface/RefProd.h"
00037
00038 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00039
00040
00041 EgammaHLTEcalIsolationProducersRegional::EgammaHLTEcalIsolationProducersRegional(const edm::ParameterSet& config) : conf_(config)
00042 {
00043
00044
00045
00046 bcBarrelProducer_ = conf_.getParameter<edm::InputTag>("bcBarrelProducer");
00047 bcEndcapProducer_ = conf_.getParameter<edm::InputTag>("bcEndcapProducer");
00048
00049 scIslandBarrelProducer_ = conf_.getParameter<edm::InputTag>("scIslandBarrelProducer");
00050 scIslandEndcapProducer_ = conf_.getParameter<edm::InputTag>("scIslandEndcapProducer");
00051
00052 recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
00053
00054 egEcalIsoEtMin_ = conf_.getParameter<double>("egEcalIsoEtMin");
00055 egEcalIsoConeSize_ = conf_.getParameter<double>("egEcalIsoConeSize");
00056 algoType_ = conf_.getParameter<int>("SCAlgoType");
00057 test_ = new EgammaHLTEcalIsolation(egEcalIsoEtMin_,egEcalIsoConeSize_,algoType_);
00058
00059
00060
00061 produces < reco::RecoEcalCandidateIsolationMap >();
00062 }
00063
00064 EgammaHLTEcalIsolationProducersRegional::~EgammaHLTEcalIsolationProducersRegional(){delete test_;}
00065
00066
00067
00068 void EgammaHLTEcalIsolationProducersRegional::produce(edm::Event& iEvent, const edm::EventSetup& iSetup){
00069
00070
00071 edm::Handle<reco::BasicClusterCollection> bcBarrelHandle;
00072 iEvent.getByLabel(bcBarrelProducer_, bcBarrelHandle);
00073 const reco::BasicClusterCollection* clusterBarrelCollection = bcBarrelHandle.product();
00074
00075 edm::Handle<reco::BasicClusterCollection> bcEndcapHandle;
00076 iEvent.getByLabel(bcEndcapProducer_, bcEndcapHandle);
00077 const reco::BasicClusterCollection* clusterEndcapCollection = (bcEndcapHandle.product());
00078
00079 edm::Handle<reco::SuperClusterCollection> scBarrelHandle;
00080 iEvent.getByLabel(scIslandBarrelProducer_,scBarrelHandle);
00081 const reco::SuperClusterCollection* scBarrelCollection = (scBarrelHandle.product());
00082
00083 edm::Handle<reco::SuperClusterCollection> scEndcapHandle;
00084 iEvent.getByLabel(scIslandEndcapProducer_,scEndcapHandle);
00085 const reco::SuperClusterCollection* scEndcapCollection = (scEndcapHandle.product());
00086
00087 edm::Handle<reco::RecoEcalCandidateCollection> recoecalcandHandle;
00088 iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
00089
00090 std::vector<const reco::BasicCluster*> clusterCollection;
00091 for (reco::BasicClusterCollection::const_iterator ibc = clusterBarrelCollection->begin();
00092 ibc < clusterBarrelCollection->end(); ibc++ ){clusterCollection.push_back(&(*ibc));}
00093 for (reco::BasicClusterCollection::const_iterator iec = clusterEndcapCollection->begin();
00094 iec < clusterEndcapCollection->end(); iec++ ){clusterCollection.push_back(&(*iec));}
00095 std::vector<const reco::SuperCluster*> scCollection;
00096 for (reco::SuperClusterCollection::const_iterator ibsc = scBarrelCollection->begin();
00097 ibsc < scBarrelCollection->end(); ibsc++ ){scCollection.push_back(&(*ibsc));}
00098 for (reco::SuperClusterCollection::const_iterator iesc = scEndcapCollection->begin();
00099 iesc < scEndcapCollection->end(); iesc++ ){scCollection.push_back(&(*iesc));}
00100
00101 reco::RecoEcalCandidateIsolationMap isoMap;
00102
00103
00104
00105 for (reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand= recoecalcandHandle->begin(); iRecoEcalCand!=recoecalcandHandle->end(); iRecoEcalCand++) {
00106
00107
00108 reco::RecoEcalCandidateRef recoecalcandref(reco::RecoEcalCandidateRef(recoecalcandHandle,iRecoEcalCand -recoecalcandHandle ->begin()));
00109
00110
00111 const reco::RecoCandidate *tempiRecoEcalCand = &(*recoecalcandref);
00112 float isol = test_->isolPtSum(tempiRecoEcalCand,scCollection, clusterCollection);
00113
00114 isoMap.insert(recoecalcandref, isol);
00115
00116 }
00117
00118 std::auto_ptr<reco::RecoEcalCandidateIsolationMap> isolMap(new reco::RecoEcalCandidateIsolationMap(isoMap));
00119 iEvent.put(isolMap);
00120
00121 }
00122
00123
00124