CMS 3D CMS Logo

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  ~EgammaHLTR9IDProducer() override;
42 
43  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
44  void produce(edm::StreamID sid, edm::Event&, const edm::EventSetup&) const override;
45 
46 private:
47  // ----------member data ---------------------------
48 
52 };
53 
56  consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
57  ecalRechitEBToken_(consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("ecalRechitEB"))),
58  ecalRechitEEToken_(consumes<EcalRecHitCollection>(config.getParameter<edm::InputTag>("ecalRechitEE"))) {
59  //register your products
60  produces<reco::RecoEcalCandidateIsolationMap>();
61  produces<reco::RecoEcalCandidateIsolationMap>("r95x5");
62 }
63 
65 
68  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
69  desc.add<edm::InputTag>(("ecalRechitEB"), edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEB"));
70  desc.add<edm::InputTag>(("ecalRechitEE"), edm::InputTag("hltEcalRegionalEgammaRecHit", "EcalRecHitsEE"));
71  descriptions.add(("hltEgammaHLTR9IDProducer"), desc);
72 }
73 
74 // ------------ method called to produce the data ------------
76  // Get the HLT filtered objects
78  iEvent.getByToken(recoEcalCandidateProducer_, recoecalcandHandle);
79 
82  reco::RecoEcalCandidateIsolationMap r9Map(recoecalcandHandle);
83  reco::RecoEcalCandidateIsolationMap r95x5Map(recoecalcandHandle);
84  for (unsigned int iRecoEcalCand = 0; iRecoEcalCand < recoecalcandHandle->size(); iRecoEcalCand++) {
85  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle, iRecoEcalCand); //-recoecalcandHandle->begin());
86 
87  float r9 = -1;
88  float r95x5 = -1;
89 
90  float e9 = lazyTools.e3x3(*(recoecalcandref->superCluster()->seed()));
91  float e95x5 = lazyTools5x5.e3x3(*(recoecalcandref->superCluster()->seed()));
92 
93  float eraw = recoecalcandref->superCluster()->rawEnergy();
94  if (eraw > 0.) {
95  r9 = e9 / eraw;
96  r95x5 = e95x5 / eraw;
97  }
98 
99  r9Map.insert(recoecalcandref, r9);
100  r95x5Map.insert(recoecalcandref, r95x5);
101  }
102 
103  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(r9Map));
104 
105  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(r95x5Map), "r95x5");
106 }
107 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEEToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
Definition: config.py:1
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEBToken_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void insert(const key_type &k, const data_type &v)
insert an association
EgammaHLTR9IDProducer(const edm::ParameterSet &)
float e3x3(const reco::BasicCluster &cluster)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
fixed size matrix
HLT enums.