CMS 3D CMS Logo

EgammaHLTR9Producer.cc
Go to the documentation of this file.
1 
11 
16 
18  recoEcalCandidateProducer_(consumes<reco::RecoEcalCandidateCollection> (config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
19  ecalRechitEBToken_(consumes<EcalRecHitCollection>(config.getParameter< edm::InputTag > ("ecalRechitEB"))),
20  ecalRechitEEToken_(consumes<EcalRecHitCollection>(config.getParameter< edm::InputTag > ("ecalRechitEE"))),
21  useSwissCross_(config.getParameter< bool > ("useSwissCross")) {
22 
23  //register your products
24  produces < reco::RecoEcalCandidateIsolationMap >();
25 }
26 
28 {}
29 
30 // ------------ method called to produce the data ------------
31 
33 
35  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltRecoEcalCandidate"));
36  desc.add<edm::InputTag>(("ecalRechitEB"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEB"));
37  desc.add<edm::InputTag>(("ecalRechitEE"), edm::InputTag("hltEcalRegionalEgammaRecHit","EcalRecHitsEE"));
38  desc.add<bool> (("useSwissCross"), false);
39  descriptions.add(("hltEgammaHLTR9Producer"), desc);
40 }
41 
42 
44 
45  // Get the HLT filtered objects
47  iEvent.getByToken(recoEcalCandidateProducer_,recoecalcandHandle);
48 
50 
52 
53  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
54 
55  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
56 
57  float r9 = -1;
58 
59  if (useSwissCross_){
61  iEvent.getByToken(ecalRechitEBToken_, pEBRecHits);
62  r9 = -1;
63  }
64  else{
65  float e9 = lazyTools.e3x3( *(recoecalcandref->superCluster()->seed()) );
66  if (e9 != 0 ) {r9 = lazyTools.eMax(*(recoecalcandref->superCluster()->seed()) )/e9;}
67  }
68 
69  r9Map.insert(recoecalcandref, r9);
70 
71  }
72 
73  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(r9Map));
74 
75 }
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
Definition: config.py:1
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEBToken_
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< EcalRecHitCollection > ecalRechitEEToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
EgammaHLTR9Producer(const edm::ParameterSet &)
void insert(const key_type &k, const data_type &v)
insert an association
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
fixed size matrix
HLT enums.
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override