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
12 //#include "FWCore/Framework/interface/Event.h"
13 //#include "FWCore/Framework/interface/EventSetup.h"
14 //#include "DataFormats/Common/interface/Handle.h"
15 //#include "FWCore/Framework/interface/ESHandle.h"
16 //#include "FWCore/MessageLogger/interface/MessageLogger.h"
17 //#include "FWCore/Utilities/interface/Exception.h"
20 
21 //#include "DataFormats/EgammaReco/interface/SuperCluster.h"
24 
26 {
27  // use configuration file to setup input/output collection names
28  recoEcalCandidateProducer_ = consumes<reco::RecoEcalCandidateCollection>(conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer"));
29 
30  ecalRechitEBToken_ = consumes<EcalRecHitCollection>(conf_.getParameter< edm::InputTag > ("ecalRechitEB"));
31  ecalRechitEEToken_ = consumes<EcalRecHitCollection>(conf_.getParameter< edm::InputTag > ("ecalRechitEE"));
32 
33 
34  //register your products
35  produces < reco::RecoEcalCandidateIsolationMap >();
36  produces < reco::RecoEcalCandidateIsolationMap >("r95x5");
37 }
38 
40 
42 
44  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
45  desc.add<edm::InputTag>(("ecalRechitEB"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEB"));
46  desc.add<edm::InputTag>(("ecalRechitEE"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEE"));
47  descriptions.add(("hltEgammaHLTR9IDProducer"), desc);
48 }
49 
50 
51 // ------------ method called to produce the data ------------
53 
54  // Get the HLT filtered objects
56  iEvent.getByToken(recoEcalCandidateProducer_, recoecalcandHandle);
57 
58  EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBToken_, ecalRechitEEToken_ );
62  for(unsigned int iRecoEcalCand=0; iRecoEcalCand<recoecalcandHandle->size(); iRecoEcalCand++) {
63 
64  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle, iRecoEcalCand);//-recoecalcandHandle->begin());
65 
66  float r9 = -1;
67  float r95x5 = -1;
68 
69  float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
70  float e95x5 = lazyTools5x5.e3x3( *(recoecalcandref->superCluster()->seed()) );
71 
72  float eraw = recoecalcandref->superCluster()->rawEnergy();
73  if (eraw > 0. ) {
74  r9 = e9/eraw;
75  r95x5 = e95x5/eraw;
76  }
77 
78  r9Map.insert(recoecalcandref, r9);
79  r95x5Map.insert(recoecalcandref,r95x5);
80 
81  }
82 
83  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map));
84  iEvent.put(R9Map);
85 
86  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R95x5Map(new reco::RecoEcalCandidateIsolationMap(r95x5Map));
87  iEvent.put(R95x5Map,"r95x5");
88 }
89 
90 //define this as a plug-in
91 //DEFINE_FWK_MODULE(EgammaHLTR9IDProducer);
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEBToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
virtual void produce(edm::Event &, const edm::EventSetup &)
float e3x3(const reco::BasicCluster &cluster)
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
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)
edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEEToken_