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  ecalRechitEBTag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEB");
31  ecalRechitEETag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEE");
32 
33  //register your products
34  produces < reco::RecoEcalCandidateIsolationMap >();
35 }
36 
38 
40 
42  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
43  desc.add<edm::InputTag>(("ecalRechitEB"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEB"));
44  desc.add<edm::InputTag>(("ecalRechitEE"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEE"));
45  descriptions.add(("hltEgammaHLTR9IDProducer"), desc);
46 }
47 
48 
49 // ------------ method called to produce the data ------------
51 
52  // Get the HLT filtered objects
54  iEvent.getByToken(recoEcalCandidateProducer_, recoecalcandHandle);
55 
56  EcalClusterLazyTools lazyTools( iEvent, iSetup, ecalRechitEBTag_, ecalRechitEETag_ );
57 
59 
60  for(unsigned int iRecoEcalCand=0; iRecoEcalCand<recoecalcandHandle->size(); iRecoEcalCand++) {
61 
62  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle, iRecoEcalCand);//-recoecalcandHandle->begin());
63 
64  float r9 = -1;
65 
66  float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
67  float eraw = recoecalcandref->superCluster()->rawEnergy();
68  if (eraw > 0. ) {r9 = e9/eraw;}
69 
70  r9Map.insert(recoecalcandref, r9);
71 
72  }
73 
74  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map));
75  iEvent.put(R9Map);
76 
77 }
78 
79 //define this as a plug-in
80 //DEFINE_FWK_MODULE(EgammaHLTR9IDProducer);
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
T getParameter(std::string const &) const
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:243
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)