Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:46

0001 #include "RecoMET/METProducers/interface/EcalHaloDataProducer.h"
0002 #include "FWCore/Framework/interface/ConsumesCollector.h"
0003 
0004 /*
0005   [class]:  EcalHaloDataProducer
0006   [authors]: R. Remington, The University of Florida
0007   [description]: See EcalHaloDataProducer.h
0008   [date]: October 15, 2009
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   //RecHit Level
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   //Higher Level Reco
0023   IT_SuperCluster = iConfig.getParameter<edm::InputTag>("SuperClusterLabel");
0024   IT_Photon = iConfig.getParameter<edm::InputTag>("PhotonLabel");
0025 
0026   // Shower Shape cuts for EcalAlgo
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   RoundnessCut = iConfig.getParameter<double>("RoundnessCutParam");
0038   AngleCut = iConfig.getParameter<double>("AngleCutParam");
0039 
0040   ebrechit_token_ = consumes<EBRecHitCollection>(IT_EBRecHit);
0041   eerechit_token_ = consumes<EERecHitCollection>(IT_EERecHit);
0042   esrechit_token_ = consumes<ESRecHitCollection>(IT_ESRecHit);
0043   hbherechit_token_ = consumes<HBHERecHitCollection>(IT_HBHERecHit);
0044   supercluster_token_ = consumes<reco::SuperClusterCollection>(IT_SuperCluster);
0045   photon_token_ = consumes<reco::PhotonCollection>(IT_Photon);
0046   calogeometry_token_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
0047 
0048   produces<EcalHaloData>();
0049 }
0050 
0051 void EcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup) {
0052   //Get CaloGeometry
0053   edm::ESHandle<CaloGeometry> TheCaloGeometry = iSetup.getHandle(calogeometry_token_);
0054 
0055   //Get  EB RecHits
0056   edm::Handle<EBRecHitCollection> TheEBRecHits;
0057   //  iEvent.getByLabel(IT_EBRecHit, TheEBRecHits);
0058   iEvent.getByToken(ebrechit_token_, TheEBRecHits);
0059 
0060   //Get EE RecHits
0061   edm::Handle<EERecHitCollection> TheEERecHits;
0062   //  iEvent.getByLabel(IT_EERecHit, TheEERecHits);
0063   iEvent.getByToken(eerechit_token_, TheEERecHits);
0064 
0065   //Get ES RecHits
0066   edm::Handle<ESRecHitCollection> TheESRecHits;
0067   //  iEvent.getByLabel(IT_ESRecHit, TheESRecHits);
0068   iEvent.getByToken(esrechit_token_, TheESRecHits);
0069 
0070   //Get HBHE RecHits
0071   edm::Handle<HBHERecHitCollection> TheHBHERecHits;
0072   iEvent.getByToken(hbherechit_token_, TheHBHERecHits);
0073 
0074   //Get ECAL Barrel SuperClusters
0075   edm::Handle<reco::SuperClusterCollection> TheSuperClusters;
0076   //  iEvent.getByLabel(IT_SuperCluster, TheSuperClusters);
0077   iEvent.getByToken(supercluster_token_, TheSuperClusters);
0078 
0079   //Get Photons
0080   edm::Handle<reco::PhotonCollection> ThePhotons;
0081   //  iEvent.getByLabel(IT_Photon, ThePhotons);
0082   iEvent.getByToken(photon_token_, ThePhotons);
0083 
0084   //Run the EcalHaloAlgo to reconstruct the EcalHaloData object
0085   EcalAlgo.SetRoundnessCut(RoundnessCut);
0086   EcalAlgo.SetAngleCut(AngleCut);
0087   EcalAlgo.SetRecHitEnergyThresholds(EBRecHitEnergyThreshold, EERecHitEnergyThreshold, ESRecHitEnergyThreshold);
0088   EcalAlgo.SetPhiWedgeThresholds(SumEcalEnergyThreshold, NHitsEcalThreshold);
0089 
0090   iEvent.put(std::make_unique<EcalHaloData>(EcalAlgo.Calculate(
0091       *TheCaloGeometry, ThePhotons, TheSuperClusters, TheEBRecHits, TheEERecHits, TheESRecHits, TheHBHERecHits, iSetup)));
0092 
0093   return;
0094 }
0095 
0096 EcalHaloDataProducer::~EcalHaloDataProducer() {}