File indexing completed on 2024-04-06 12:26:46
0001 #include "RecoMET/METProducers/interface/HcalHaloDataProducer.h"
0002 #include "FWCore/Framework/interface/ConsumesCollector.h"
0003
0004
0005
0006
0007
0008
0009
0010
0011 using namespace edm;
0012 using namespace std;
0013 using namespace reco;
0014
0015 HcalHaloDataProducer::HcalHaloDataProducer(const edm::ParameterSet& iConfig) : HcalAlgo(consumesCollector()) {
0016
0017 IT_EBRecHit = iConfig.getParameter<edm::InputTag>("EBRecHitLabel");
0018 IT_EERecHit = iConfig.getParameter<edm::InputTag>("EERecHitLabel");
0019 IT_HBHERecHit = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
0020 IT_HFRecHit = iConfig.getParameter<edm::InputTag>("HFRecHitLabel");
0021 IT_HORecHit = iConfig.getParameter<edm::InputTag>("HORecHitLabel");
0022 IT_CaloTowers = iConfig.getParameter<edm::InputTag>("caloTowerCollName");
0023
0024 HBRecHitEnergyThreshold = (float)iConfig.getParameter<double>("HBRecHitEnergyThresholdParam");
0025 HERecHitEnergyThreshold = (float)iConfig.getParameter<double>("HERecHitEnergyThresholdParam");
0026 SumHcalEnergyThreshold = (float)iConfig.getParameter<double>("SumHcalEnergyThresholdParam");
0027 NHitsHcalThreshold = iConfig.getParameter<int>("NHitsHcalThresholdParam");
0028
0029 ebrechit_token_ = consumes<EBRecHitCollection>(IT_EBRecHit);
0030 eerechit_token_ = consumes<EERecHitCollection>(IT_EERecHit);
0031 hbherechit_token_ = consumes<HBHERecHitCollection>(IT_HBHERecHit);
0032 hfrechit_token_ = consumes<HFRecHitCollection>(IT_HFRecHit);
0033 calotower_token_ = consumes<CaloTowerCollection>(IT_CaloTowers);
0034 calogeometry_token_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
0035
0036 produces<HcalHaloData>();
0037 }
0038
0039 void HcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup) {
0040
0041 edm::ESHandle<CaloGeometry> TheCaloGeometry = iSetup.getHandle(calogeometry_token_);
0042
0043
0044 edm::Handle<CaloTowerCollection> TheCaloTowers;
0045 iEvent.getByToken(calotower_token_, TheCaloTowers);
0046
0047
0048 edm::Handle<EBRecHitCollection> TheEBRecHits;
0049 iEvent.getByToken(ebrechit_token_, TheEBRecHits);
0050
0051
0052 edm::Handle<EERecHitCollection> TheEERecHits;
0053 iEvent.getByToken(eerechit_token_, TheEERecHits);
0054
0055
0056 edm::Handle<HBHERecHitCollection> TheHBHERecHits;
0057
0058 iEvent.getByToken(hbherechit_token_, TheHBHERecHits);
0059
0060
0061 edm::Handle<HFRecHitCollection> TheHFRecHits;
0062
0063 iEvent.getByToken(hfrechit_token_, TheHFRecHits);
0064
0065
0066 HcalAlgo.SetRecHitEnergyThresholds(HBRecHitEnergyThreshold, HERecHitEnergyThreshold);
0067 HcalAlgo.SetPhiWedgeThresholds(SumHcalEnergyThreshold, NHitsHcalThreshold);
0068
0069 iEvent.put(std::make_unique<HcalHaloData>(
0070 HcalAlgo.Calculate(*TheCaloGeometry, TheHBHERecHits, TheCaloTowers, TheEBRecHits, TheEERecHits, iSetup)));
0071 return;
0072 }
0073
0074 HcalHaloDataProducer::~HcalHaloDataProducer() {}