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 }
37 
39 
41 
43  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
44  desc.add<edm::InputTag>(("ecalRechitEB"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEB"));
45  desc.add<edm::InputTag>(("ecalRechitEE"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEE"));
46  descriptions.add(("hltEgammaHLTR9IDProducer"), desc);
47 }
48 
49 
50 // ------------ method called to produce the data ------------
52 
53  // Get the HLT filtered objects
55  iEvent.getByToken(recoEcalCandidateProducer_, recoecalcandHandle);
56 
57  EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBToken_, ecalRechitEEToken_ );
58 
60 
61  for(unsigned int iRecoEcalCand=0; iRecoEcalCand<recoecalcandHandle->size(); iRecoEcalCand++) {
62 
63  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle, iRecoEcalCand);//-recoecalcandHandle->begin());
64 
65  float r9 = -1;
66 
67  float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
68  float eraw = recoecalcandref->superCluster()->rawEnergy();
69  if (eraw > 0. ) {r9 = e9/eraw;}
70 
71  r9Map.insert(recoecalcandref, r9);
72 
73  }
74 
75  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map));
76  iEvent.put(R9Map);
77 
78 }
79 
80 //define this as a plug-in
81 //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:434
virtual void produce(edm::Event &, const edm::EventSetup &)
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
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_