Back to home page

Project CMSSW displayed by LXR

 
 

    


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   [class]:  HcalHaloDataProducer
0006   [authors]: R. Remington, The University of Florida
0007   [description]: See HcalHaloDataProducer.h
0008   [date]: October 15, 2009
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   //RecHit Level
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   //Get CaloGeometry
0041   edm::ESHandle<CaloGeometry> TheCaloGeometry = iSetup.getHandle(calogeometry_token_);
0042 
0043   //Get CaloTowers
0044   edm::Handle<CaloTowerCollection> TheCaloTowers;
0045   iEvent.getByToken(calotower_token_, TheCaloTowers);
0046 
0047   //Get EB RecHits
0048   edm::Handle<EBRecHitCollection> TheEBRecHits;
0049   iEvent.getByToken(ebrechit_token_, TheEBRecHits);
0050 
0051   //Get EE RecHits
0052   edm::Handle<EERecHitCollection> TheEERecHits;
0053   iEvent.getByToken(eerechit_token_, TheEERecHits);
0054 
0055   //Get HB/HE RecHits
0056   edm::Handle<HBHERecHitCollection> TheHBHERecHits;
0057   //  iEvent.getByLabel(IT_HBHERecHit, TheHBHERecHits);
0058   iEvent.getByToken(hbherechit_token_, TheHBHERecHits);
0059 
0060   //Get HF RecHits
0061   edm::Handle<HFRecHitCollection> TheHFRecHits;
0062   //  iEvent.getByLabel(IT_HFRecHit, TheHFRecHits);
0063   iEvent.getByToken(hfrechit_token_, TheHFRecHits);
0064 
0065   // Run the HcalHaloAlgo to reconstruct the HcalHaloData object
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() {}