CMS 3D CMS Logo

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