CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaHLTR9Producer.cc
Go to the documentation of this file.
1 
11 
16 
18 {
19  // use configuration file to setup input/output collection names
20  recoEcalCandidateProducer_ = consumes<reco::RecoEcalCandidateCollection>(conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer"));
21  ecalRechitEBTag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEB");
22  ecalRechitEETag_ = conf_.getParameter< edm::InputTag > ("ecalRechitEE");
23  ecalRechitEBToken_ = consumes<EcalRecHitCollection>(ecalRechitEBTag_);
24  ecalRechitEEToken_ = consumes<EcalRecHitCollection>(ecalRechitEETag_);
25 
26  useSwissCross_ = conf_.getParameter< bool > ("useSwissCross");
27 
28  //register your products
29  produces < reco::RecoEcalCandidateIsolationMap >();
30 }
31 
33 {}
34 
35 // ------------ method called to produce the data ------------
36 
38 
40  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
41  desc.add<edm::InputTag>(("ecalRechitEB"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEB"));
42  desc.add<edm::InputTag>(("ecalRechitEE"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEE"));
43  desc.add<bool> (("useSwissCross"), false);
44  descriptions.add(("hltEgammaHLTR9Producer"), desc);
45 }
46 
47 
49 
50  // Get the HLT filtered objects
52  iEvent.getByToken(recoEcalCandidateProducer_,recoecalcandHandle);
53 
54  EcalClusterLazyTools lazyTools(iEvent, iSetup, ecalRechitEBTag_, ecalRechitEETag_);
55 
57 
58  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
59 
60  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
61 
62  float r9 = -1;
63 
64  if (useSwissCross_){
66  iEvent.getByToken(ecalRechitEBToken_, pEBRecHits);
67  r9 = -1;
68  }
69  else{
70  float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
71  if (e9 != 0 ) {r9 = lazyTools.eMax(*(recoecalcandref->superCluster()->seed()) )/e9;}
72  }
73 
74  r9Map.insert(recoecalcandref, r9);
75 
76  }
77 
78  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> R9Map(new reco::RecoEcalCandidateIsolationMap(r9Map));
79  iEvent.put(R9Map);
80 
81 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEBToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::InputTag ecalRechitEBTag_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
float e3x3(const reco::BasicCluster &cluster)
float eMax(const reco::BasicCluster &cluster)
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEEToken_
edm::ParameterSet conf_
EgammaHLTR9Producer(const edm::ParameterSet &)
virtual void produce(edm::Event &, const edm::EventSetup &)
void insert(const key_type &k, const data_type &v)
insert an association
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::InputTag ecalRechitEETag_