File indexing completed on 2025-01-08 03:36:29
0001 #include "RecoMET/METProducers/interface/EcalHaloDataProducer.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 EcalHaloDataProducer::EcalHaloDataProducer(const edm::ParameterSet& iConfig) : EcalAlgo(consumesCollector()) {
0016
0017 IT_EBRecHit = iConfig.getParameter<edm::InputTag>("EBRecHitLabel");
0018 IT_EERecHit = iConfig.getParameter<edm::InputTag>("EERecHitLabel");
0019 IT_ESRecHit = iConfig.getParameter<edm::InputTag>("ESRecHitLabel");
0020 IT_HBHERecHit = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
0021
0022
0023 IT_SuperCluster = iConfig.getParameter<edm::InputTag>("SuperClusterLabel");
0024 IT_Photon = iConfig.getParameter<edm::InputTag>("PhotonLabel");
0025
0026
0027
0028 RoundnessCut = iConfig.getParameter<double>("RoundnessCutParam");
0029 AngleCut = iConfig.getParameter<double>("AngleCutParam");
0030
0031 EBRecHitEnergyThreshold = (float)iConfig.getParameter<double>("EBRecHitEnergyThresholdParam");
0032 EERecHitEnergyThreshold = (float)iConfig.getParameter<double>("EERecHitEnergyThresholdParam");
0033 ESRecHitEnergyThreshold = (float)iConfig.getParameter<double>("ESRecHitEnergyThresholdParam");
0034 SumEcalEnergyThreshold = (float)iConfig.getParameter<double>("SumEcalEnergyThresholdParam");
0035 NHitsEcalThreshold = iConfig.getParameter<int>("NHitsEcalThresholdParam");
0036
0037 ebrechit_token_ = consumes<EBRecHitCollection>(IT_EBRecHit);
0038 eerechit_token_ = consumes<EERecHitCollection>(IT_EERecHit);
0039 esrechit_token_ = consumes<ESRecHitCollection>(IT_ESRecHit);
0040 hbherechit_token_ = consumes<HBHERecHitCollection>(IT_HBHERecHit);
0041 supercluster_token_ = consumes<reco::SuperClusterCollection>(IT_SuperCluster);
0042 photon_token_ = consumes<reco::PhotonCollection>(IT_Photon);
0043 calogeometry_token_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
0044
0045 produces<EcalHaloData>();
0046 }
0047
0048 void EcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup) {
0049
0050 edm::ESHandle<CaloGeometry> TheCaloGeometry = iSetup.getHandle(calogeometry_token_);
0051
0052
0053 edm::Handle<EBRecHitCollection> TheEBRecHits;
0054
0055 iEvent.getByToken(ebrechit_token_, TheEBRecHits);
0056
0057
0058 edm::Handle<EERecHitCollection> TheEERecHits;
0059
0060 iEvent.getByToken(eerechit_token_, TheEERecHits);
0061
0062
0063 edm::Handle<ESRecHitCollection> TheESRecHits;
0064
0065 iEvent.getByToken(esrechit_token_, TheESRecHits);
0066
0067
0068 edm::Handle<HBHERecHitCollection> TheHBHERecHits;
0069 iEvent.getByToken(hbherechit_token_, TheHBHERecHits);
0070
0071
0072 edm::Handle<reco::SuperClusterCollection> TheSuperClusters;
0073
0074 iEvent.getByToken(supercluster_token_, TheSuperClusters);
0075
0076
0077 edm::Handle<reco::PhotonCollection> ThePhotons;
0078
0079 iEvent.getByToken(photon_token_, ThePhotons);
0080
0081
0082 EcalAlgo.SetRoundnessCut(RoundnessCut);
0083 EcalAlgo.SetAngleCut(AngleCut);
0084 EcalAlgo.SetRecHitEnergyThresholds(EBRecHitEnergyThreshold, EERecHitEnergyThreshold, ESRecHitEnergyThreshold);
0085 EcalAlgo.SetPhiWedgeThresholds(SumEcalEnergyThreshold, NHitsEcalThreshold);
0086
0087 iEvent.put(std::make_unique<EcalHaloData>(EcalAlgo.Calculate(
0088 *TheCaloGeometry, ThePhotons, TheSuperClusters, TheEBRecHits, TheEERecHits, TheESRecHits, TheHBHERecHits, iSetup)));
0089
0090 return;
0091 }
0092
0093 void EcalHaloDataProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0094 edm::ParameterSetDescription desc;
0095
0096 desc.add<edm::InputTag>("EBRecHitLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEB"));
0097 desc.add<edm::InputTag>("EERecHitLabel", edm::InputTag("ecalRecHit", "EcalRecHitsEE"));
0098 desc.add<edm::InputTag>("ESRecHitLabel", edm::InputTag("ecalPreshowerRecHit", "EcalRecHitsES"));
0099
0100 desc.add<edm::InputTag>("HBHERecHitLabel", edm::InputTag("hbhereco"));
0101 desc.add<edm::InputTag>("SuperClusterLabel", edm::InputTag("correctedHybridSuperClusters"));
0102 desc.add<edm::InputTag>("PhotonLabel", edm::InputTag(""));
0103 desc.add<double>("EBRecHitEnergyThresholdParam", 0.3);
0104 desc.add<double>("EERecHitEnergyThresholdParam", 0.3);
0105 desc.add<double>("ESRecHitEnergyThresholdParam", 0.3);
0106 desc.add<double>("SumEcalEnergyThresholdParam", 10);
0107 desc.add<int>("NHitsEcalThresholdParam", 4);
0108
0109 desc.add<double>("RoundnessCutParam", 0.41);
0110 desc.add<double>("AngleCutParam", 0.51);
0111 descriptions.addWithDefaultLabel(desc);
0112 }