CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTR9IDProducer.cc
Go to the documentation of this file.
1 
10 
11 // Framework
14 
17 
19  recoEcalCandidateProducer_(consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
20  ecalRechitEBToken_(consumes<EcalRecHitCollection>(config.getParameter< edm::InputTag > ("ecalRechitEB"))),
21  ecalRechitEEToken_(consumes<EcalRecHitCollection>(config.getParameter< edm::InputTag > ("ecalRechitEE"))) {
22 
23  //register your products
24  produces < reco::RecoEcalCandidateIsolationMap >();
25  produces < reco::RecoEcalCandidateIsolationMap >("r95x5");
26 }
27 
29 {}
30 
32 
34  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
35  desc.add<edm::InputTag>(("ecalRechitEB"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEB"));
36  desc.add<edm::InputTag>(("ecalRechitEE"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEE"));
37  descriptions.add(("hltEgammaHLTR9IDProducer"), desc);
38 }
39 
40 
41 // ------------ method called to produce the data ------------
43 
44  // Get the HLT filtered objects
46  iEvent.getByToken(recoEcalCandidateProducer_, recoecalcandHandle);
47 
48  EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBToken_, ecalRechitEEToken_ );
50  reco::RecoEcalCandidateIsolationMap r9Map(recoecalcandHandle);
51  reco::RecoEcalCandidateIsolationMap r95x5Map(recoecalcandHandle);
52  for(unsigned int iRecoEcalCand=0; iRecoEcalCand<recoecalcandHandle->size(); iRecoEcalCand++) {
53 
54  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle, iRecoEcalCand);//-recoecalcandHandle->begin());
55 
56  float r9 = -1;
57  float r95x5 = -1;
58 
59  float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
60  float e95x5 = lazyTools5x5.e3x3( *(recoecalcandref->superCluster()->seed()) );
61 
62  float eraw = recoecalcandref->superCluster()->rawEnergy();
63  if (eraw > 0. ) {
64  r9 = e9/eraw;
65  r95x5 = e95x5/eraw;
66  }
67 
68  r9Map.insert(recoecalcandref, r9);
69  r95x5Map.insert(recoecalcandref,r95x5);
70 
71  }
72 
73  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map));
74  iEvent.put(R9Map);
75 
76  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R95x5Map(new reco::RecoEcalCandidateIsolationMap(r95x5Map));
77  iEvent.put(R95x5Map,"r95x5");
78 }
79 
80 //define this as a plug-in
81 //DEFINE_FWK_MODULE(EgammaHLTR9IDProducer);
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEEToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
float e3x3(const reco::BasicCluster &cluster)
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEBToken_
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
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 &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override