CMS 3D CMS Logo

EgammaHLTHcalIsolationDoubleConeProducers.cc
Go to the documentation of this file.
1 
12 
15 
22 
24  : conf_(config)
25  , recoEcalCandidateProducer_ (consumes<reco::RecoEcalCandidateCollection>(conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer")))
26  , hbRecHitProducer_ (consumes<HBHERecHitCollection>(conf_.getParameter<edm::InputTag>("hbRecHitProducer")))
27  , hfRecHitProducer_ (consumes<HFRecHitCollection>(conf_.getParameter<edm::InputTag>("hfRecHitProducer")))
28  , egHcalIsoPtMin_ (conf_.getParameter<double>("egHcalIsoPtMin"))
29  , egHcalIsoConeSize_ (conf_.getParameter<double>("egHcalIsoConeSize"))
30  , egHcalExclusion_ (conf_.getParameter<double>("egHcalExclusion"))
31  , test_ (new EgammaHLTHcalIsolationDoubleCone(egHcalIsoPtMin_,egHcalIsoConeSize_,egHcalExclusion_))
32 {
33 
34  //register your products
35  produces < reco::RecoEcalCandidateIsolationMap >();
36 }
37 
38 
40 
43  desc.add<edm::InputTag>(("recoEcalCandidateProducer"), edm::InputTag("hltL1SeededRecoEcalCandidate"));
44  desc.add<edm::InputTag>(("hbRecHitProducer"), edm::InputTag("hltHbhereco"));
45  desc.add<edm::InputTag>(("hfRecHitProducer"), edm::InputTag("hltHfreco"));
46  desc.add<double>(("egHcalIsoPtMin"), 0.);
47  desc.add<double>(("egHcalIsoConeSize"), 0.3);
48  desc.add<double>(("egHcalExclusion"), 0.15);
49  descriptions.add(("hltEgammaHLTHcalIsolationDoubleConeProducers"), desc);
50 }
51 
53  // Get the HLT filtered objects
55  iEvent.getByToken(recoEcalCandidateProducer_,recoecalcandHandle);
56 
57  // Get the barrel hcal hits
58  edm::Handle<HBHERecHitCollection> hhitBarrelHandle;
59  iEvent.getByToken(hbRecHitProducer_, hhitBarrelHandle);
60  const HBHERecHitCollection* hcalhitBarrelCollection = hhitBarrelHandle.product();
61  // Get the forward hcal hits
62  edm::Handle<HFRecHitCollection> hhitEndcapHandle;
63  iEvent.getByToken(hfRecHitProducer_, hhitEndcapHandle);
64  const HFRecHitCollection* hcalhitEndcapCollection = hhitEndcapHandle.product();
65  //Get Calo Geometry
67  iSetup.get<CaloGeometryRecord>().get(pG);
68  const CaloGeometry* caloGeom = pG.product();
69 
71 
72  for(unsigned int iRecoEcalCand=0; iRecoEcalCand<recoecalcandHandle->size(); iRecoEcalCand++) {
73 
74  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle, iRecoEcalCand);
75  float isol = test_->isolPtSum(&(*recoecalcandref), hcalhitBarrelCollection, hcalhitEndcapCollection, caloGeom);
76 
77  isoMap.insert(recoecalcandref, isol);
78  }
79 
80  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(isoMap));
81 
82 }
void produce(edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
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
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< HBHERecHitCollection > hbRecHitProducer_
Definition: config.py:1
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
float isolPtSum(const reco::RecoCandidate *recocandidate, const HBHERecHitCollection *hbhe, const HFRecHitCollection *hf, const CaloGeometry *geometry) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
T const * product() const
Definition: Handle.h:74
void insert(const key_type &k, const data_type &v)
insert an association
EgammaHLTHcalIsolationDoubleCone const *const test_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< RecoEcalCandidate > RecoEcalCandidateCollection
collectin of RecoEcalCandidate objects
const edm::EDGetTokenT< HFRecHitCollection > hfRecHitProducer_
fixed size matrix
HLT enums.
T get() const
Definition: EventSetup.h:71
T const * product() const
Definition: ESHandle.h:86