CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EgammaHLTR9IDProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaHLTProducers
4 // Class: EgammaHLTR9IDProducer
5 //
8 //
9 // Original Author: Roberto Covarelli (CERN)
10 // Created: Tue Jun 13 14:48:33 CEST 2006
11 // $Id: EgammaHLTR9Producer.h,v 1.2 2010/06/10 16:19:31 ghezzi Exp $
12 // modified by Chris Tully (Princeton)
13 //
14 //
15 
16 // system include files
17 #include <memory>
18 
19 // user include files
25 
28 
30 
31 // Framework
34 
37 
39 public:
41 
42  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
43  void produce(edm::StreamID sid, edm::Event&, const edm::EventSetup&) const override;
44 
45 private:
46  // ----------member data ---------------------------
47 
52 };
53 
55  : recoEcalCandidateProducer_(consumes(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
56  ecalRechitEBToken_(consumes(config.getParameter<edm::InputTag>("ecalRechitEB"))),
57  ecalRechitEEToken_(consumes(config.getParameter<edm::InputTag>("ecalRechitEE"))),
58  ecalClusterToolsESGetTokens_{consumesCollector()} {
59  //register your products
60  produces<reco::RecoEcalCandidateIsolationMap>();
61  produces<reco::RecoEcalCandidateIsolationMap>("r95x5");
62 }
63 
66  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
67  desc.add<edm::InputTag>(("ecalRechitEB"), edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEB"));
68  desc.add<edm::InputTag>(("ecalRechitEE"), edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEE"));
69  descriptions.add(("hltEgammaHLTR9IDProducer"), desc);
70 }
71 
72 // ------------ method called to produce the data ------------
74  // Get the HLT filtered objects
76  iEvent.getByToken(recoEcalCandidateProducer_, recoecalcandHandle);
77 
78  auto const& ecalClusterToolsESData = ecalClusterToolsESGetTokens_.get(iSetup);
79  EcalClusterLazyTools lazyTools(iEvent, ecalClusterToolsESData, ecalRechitEBToken_, ecalRechitEEToken_);
80  noZS::EcalClusterLazyTools lazyTools5x5(iEvent, ecalClusterToolsESData, ecalRechitEBToken_, ecalRechitEEToken_);
81  reco::RecoEcalCandidateIsolationMap r9Map(recoecalcandHandle);
82  reco::RecoEcalCandidateIsolationMap r95x5Map(recoecalcandHandle);
83  for (unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoecalcandHandle->size(); iRecoEcalCand++) {
84  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle, iRecoEcalCand); //-recoecalcandHandle->begin());
85 
86  float r9 = -1;
87  float r95x5 = -1;
88 
89  float e9 = lazyTools.e3x3(*(recoecalcandref->superCluster()->seed()));
90  float e95x5 = lazyTools5x5.e3x3(*(recoecalcandref->superCluster()->seed()));
91 
92  float eraw = recoecalcandref->superCluster()->rawEnergy();
93  if (eraw > 0.) {
94  r9 = e9 / eraw;
95  r95x5 = e95x5 / eraw;
96  }
97 
98  r9Map.insert(recoecalcandref, r9);
99  r95x5Map.insert(recoecalcandref, r95x5);
100  }
101 
102  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(r9Map));
103 
104  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(r95x5Map), "r95x5");
105 }
106 
float e3x3(const reco::BasicCluster &cluster) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEEToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEBToken_
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
ESData get(edm::EventSetup const &eventSetup) const
void insert(const key_type &k, const data_type &v)
insert an association
EgammaHLTR9IDProducer(const edm::ParameterSet &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
tuple config
parse the configuration file
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override