3 #include "FWCore/Framework/interface/Event.h"
4 #include "FWCore/Framework/interface/EventSetup.h"
5 #include "FWCore/Framework/interface/MakerMacros.h"
6 #include "FWCore/ParameterSet/interface/ParameterSet.h"
7 #include "FWCore/Utilities/interface/InputTag.h"
8 #include "DataFormats/Common/interface/Handle.h"
9 #include "DataFormats/Common/interface/ValueMap.h"
11 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
12 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
13 #include "DataFormats/CaloTowers/interface/CaloTower.h"
14 #include "DataFormats/CaloTowers/interface/CaloTowerFwd.h"
15 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h"
19 const edm::ParameterSet& config)
20 : input_(config.getParameter<
edm::InputTag>(
"input")) {
21 consumes<reco::GsfElectronCollection>(input_);
22 consumes<CaloTowerCollection>({
"towerMaker"});
23 produces<edm::ValueMap<float> >();
28 void ICElectronHcalDepthCalculator::produce(edm::Event& event,
29 const edm::EventSetup& setup) {
30 std::auto_ptr<edm::ValueMap<float> > product(
new edm::ValueMap<float>());
31 edm::Handle<reco::GsfElectronCollection> elecs_handle;
32 event.getByLabel(input_, elecs_handle);
34 edm::Handle<CaloTowerCollection> tower_handle;
35 event.getByLabel(
"towerMaker", tower_handle);
36 EgammaTowerIsolation had_depth1_iso03(0.3, 0.0, 0.0, 1,
37 tower_handle.product());
38 EgammaTowerIsolation had_depth2_iso03(0.3, 0.0, 0.0, 2,
39 tower_handle.product());
41 std::vector<float> values(elecs_handle->size(), 0.);
42 for (
unsigned i = 0; i < elecs_handle->size(); ++i) {
43 reco::GsfElectron
const& src = elecs_handle->at(i);
44 float had_depth1_sum_et_03 = had_depth1_iso03.getTowerEtSum(&src);
45 float had_depth2_sum_et_03 = had_depth2_iso03.getTowerEtSum(&src);
46 values[i] = had_depth1_sum_et_03 + had_depth2_sum_et_03;
49 edm::ValueMap<float>::Filler filler(*product);
50 filler.insert(elecs_handle, values.begin(), values.end());
56 void ICElectronHcalDepthCalculator::beginJob() {}
58 void ICElectronHcalDepthCalculator::endJob() {}
ICElectronHcalDepthCalculator(const edm::ParameterSet &)
~ICElectronHcalDepthCalculator()
Produces an edm::ValueMap for the electron HCAL energy depth sum.
DEFINE_FWK_MODULE(ICElectronHcalDepthCalculator)