CMS 3D CMS Logo

EcalHaloDataProducer.cc
Go to the documentation of this file.
3 
4 /*
5  [class]: EcalHaloDataProducer
6  [authors]: R. Remington, The University of Florida
7  [description]: See EcalHaloDataProducer.h
8  [date]: October 15, 2009
9 */
10 
11 using namespace edm;
12 using namespace std;
13 using namespace reco;
14 
15 EcalHaloDataProducer::EcalHaloDataProducer(const edm::ParameterSet& iConfig)
16 {
17  //RecHit Level
18  IT_EBRecHit = iConfig.getParameter<edm::InputTag>("EBRecHitLabel");
19  IT_EERecHit = iConfig.getParameter<edm::InputTag>("EERecHitLabel");
20  IT_ESRecHit = iConfig.getParameter<edm::InputTag>("ESRecHitLabel");
21  IT_HBHERecHit = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
22 
23  //Higher Level Reco
24  IT_SuperCluster = iConfig.getParameter<edm::InputTag>("SuperClusterLabel");
25  IT_Photon = iConfig.getParameter<edm::InputTag>("PhotonLabel") ;
26 
27  // Shower Shape cuts for EcalAlgo
28 
29  RoundnessCut = iConfig.getParameter<double>("RoundnessCutParam");
30  AngleCut = iConfig.getParameter<double>("AngleCutParam");
31 
32  EBRecHitEnergyThreshold = (float) iConfig.getParameter<double> ("EBRecHitEnergyThresholdParam");
33  EERecHitEnergyThreshold = (float) iConfig.getParameter<double> ("EERecHitEnergyThresholdParam");
34  ESRecHitEnergyThreshold = (float) iConfig.getParameter<double> ("ESRecHitEnergyThresholdParam");
35  SumEcalEnergyThreshold = (float)iConfig.getParameter<double> ("SumEcalEnergyThresholdParam");
36  NHitsEcalThreshold = iConfig.getParameter<int> ("NHitsEcalThresholdParam");
37 
38  RoundnessCut = iConfig.getParameter<double>("RoundnessCutParam");
39  AngleCut = iConfig.getParameter<double>("AngleCutParam");
40 
41  ebrechit_token_ = consumes<EBRecHitCollection>(IT_EBRecHit);
42  eerechit_token_ = consumes<EERecHitCollection>(IT_EERecHit);
43  esrechit_token_ = consumes<ESRecHitCollection>(IT_ESRecHit);
44  hbherechit_token_ = consumes<HBHERecHitCollection>(IT_HBHERecHit);
45  supercluster_token_ = consumes<reco::SuperClusterCollection>(IT_SuperCluster);
46  photon_token_ = consumes<reco::PhotonCollection>(IT_Photon);
47 
48  produces<EcalHaloData>();
49 }
50 
51 void EcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
52 {
53  //Get CaloGeometry
54  edm::ESHandle<CaloGeometry> TheCaloGeometry;
55  iSetup.get<CaloGeometryRecord>().get(TheCaloGeometry);
56 
57  //Get EB RecHits
59  // iEvent.getByLabel(IT_EBRecHit, TheEBRecHits);
60  iEvent.getByToken(ebrechit_token_, TheEBRecHits);
61 
62  //Get EE RecHits
64  // iEvent.getByLabel(IT_EERecHit, TheEERecHits);
65  iEvent.getByToken(eerechit_token_, TheEERecHits);
66 
67  //Get ES RecHits
69  // iEvent.getByLabel(IT_ESRecHit, TheESRecHits);
70  iEvent.getByToken(esrechit_token_, TheESRecHits);
71 
72  //Get HBHE RecHits
73  edm::Handle<HBHERecHitCollection> TheHBHERecHits;
74  iEvent.getByToken(hbherechit_token_, TheHBHERecHits);
75 
76  //Get ECAL Barrel SuperClusters
78  // iEvent.getByLabel(IT_SuperCluster, TheSuperClusters);
79  iEvent.getByToken(supercluster_token_, TheSuperClusters);
80 
81  //Get Photons
83  // iEvent.getByLabel(IT_Photon, ThePhotons);
84  iEvent.getByToken(photon_token_, ThePhotons);
85 
86  //Run the EcalHaloAlgo to reconstruct the EcalHaloData object
87  EcalHaloAlgo EcalAlgo;
88  EcalAlgo.SetRoundnessCut(RoundnessCut);
89  EcalAlgo.SetAngleCut(AngleCut);
90  EcalAlgo.SetRecHitEnergyThresholds(EBRecHitEnergyThreshold, EERecHitEnergyThreshold, ESRecHitEnergyThreshold);
91  EcalAlgo.SetPhiWedgeThresholds(SumEcalEnergyThreshold, NHitsEcalThreshold);
92 
93 
94  iEvent.put(std::make_unique<EcalHaloData>(EcalAlgo.Calculate(*TheCaloGeometry, ThePhotons, TheSuperClusters, TheEBRecHits, TheEERecHits, TheESRecHits, TheHBHERecHits,iSetup)));
95 
96  return;
97 }
98 
99 EcalHaloDataProducer::~EcalHaloDataProducer(){}
100 
T getParameter(std::string const &) const
void SetAngleCut(float a=4.)
Definition: EcalHaloAlgo.h:57
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
void SetRecHitEnergyThresholds(float EB, float EE, float ES)
Definition: EcalHaloAlgo.h:60
int iEvent
Definition: GenABIO.cc:230
void SetPhiWedgeThresholds(float SumE, int nhits)
Definition: EcalHaloAlgo.h:64
const T & get() const
Definition: EventSetup.h:58
reco::EcalHaloData Calculate(const CaloGeometry &TheCaloGeometry, edm::Handle< reco::PhotonCollection > &ThePhotons, edm::Handle< reco::SuperClusterCollection > &TheSuperClusters, edm::Handle< EBRecHitCollection > &TheEBRecHits, edm::Handle< EERecHitCollection > &TheEERecHits, edm::Handle< ESRecHitCollection > &TheESRecHits, edm::Handle< HBHERecHitCollection > &TheHBHERecHits, const edm::EventSetup &TheSetup)
Definition: EcalHaloAlgo.cc:32
fixed size matrix
HLT enums.
void SetRoundnessCut(float r=100.)
Definition: EcalHaloAlgo.h:55