CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalHaloDataProducer.cc
Go to the documentation of this file.
2 
3 /*
4  [class]: EcalHaloDataProducer
5  [authors]: R. Remington, The University of Florida
6  [description]: See EcalHaloDataProducer.h
7  [date]: October 15, 2009
8 */
9 
10 using namespace edm;
11 using namespace std;
12 using namespace reco;
13 
14 EcalHaloDataProducer::EcalHaloDataProducer(const edm::ParameterSet& iConfig)
15 {
16  //RecHit Level
17  IT_EBRecHit = iConfig.getParameter<edm::InputTag>("EBRecHitLabel");
18  IT_EERecHit = iConfig.getParameter<edm::InputTag>("EERecHitLabel");
19  IT_ESRecHit = iConfig.getParameter<edm::InputTag>("ESRecHitLabel");
20 
21  //Higher Level Reco
22  IT_SuperCluster = iConfig.getParameter<edm::InputTag>("SuperClusterLabel");
23  IT_Photon = iConfig.getParameter<edm::InputTag>("PhotonLabel") ;
24 
25  // Shower Shape cuts for EcalAlgo
26 
27  RoundnessCut = iConfig.getParameter<double>("RoundnessCutParam");
28  AngleCut = iConfig.getParameter<double>("AngleCutParam");
29 
30  EBRecHitEnergyThreshold = (float) iConfig.getParameter<double> ("EBRecHitEnergyThresholdParam");
31  EERecHitEnergyThreshold = (float) iConfig.getParameter<double> ("EERecHitEnergyThresholdParam");
32  ESRecHitEnergyThreshold = (float) iConfig.getParameter<double> ("ESRecHitEnergyThresholdParam");
33  SumEcalEnergyThreshold = (float)iConfig.getParameter<double> ("SumEcalEnergyThresholdParam");
34  NHitsEcalThreshold = iConfig.getParameter<int> ("NHitsEcalThresholdParam");
35 
36  RoundnessCut = iConfig.getParameter<double>("RoundnessCutParam");
37  AngleCut = iConfig.getParameter<double>("AngleCutParam");
38 
39  produces<EcalHaloData>();
40 }
41 
42 void EcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
43 {
44  //Get CaloGeometry
45  edm::ESHandle<CaloGeometry> TheCaloGeometry;
46  iSetup.get<CaloGeometryRecord>().get(TheCaloGeometry);
47 
48  //Get EB RecHits
50  iEvent.getByLabel(IT_EBRecHit, TheEBRecHits);
51 
52  //Get EE RecHits
54  iEvent.getByLabel(IT_EERecHit, TheEERecHits);
55 
56  //Get ES RecHits
58  iEvent.getByLabel(IT_ESRecHit, TheESRecHits);
59 
60  //Get ECAL Barrel SuperClusters
62  iEvent.getByLabel(IT_SuperCluster, TheSuperClusters);
63 
64  //Get Photons
66  iEvent.getByLabel(IT_Photon, ThePhotons);
67 
68  //Run the EcalHaloAlgo to reconstruct the EcalHaloData object
69  EcalHaloAlgo EcalAlgo;
70  EcalAlgo.SetRoundnessCut(RoundnessCut);
71  EcalAlgo.SetAngleCut(AngleCut);
72  EcalAlgo.SetRecHitEnergyThresholds(EBRecHitEnergyThreshold, EERecHitEnergyThreshold, ESRecHitEnergyThreshold);
73  EcalAlgo.SetPhiWedgeThresholds(SumEcalEnergyThreshold, NHitsEcalThreshold);
74 
75  if( TheCaloGeometry.isValid() && ThePhotons.isValid() && TheSuperClusters.isValid() && TheEBRecHits.isValid() && TheEERecHits.isValid() && TheESRecHits.isValid() )
76  {
77  std::auto_ptr<EcalHaloData> EcalData( new EcalHaloData( EcalAlgo.Calculate(*TheCaloGeometry, ThePhotons, TheSuperClusters, TheEBRecHits, TheEERecHits, TheESRecHits)));
78  iEvent.put( EcalData ) ;
79  }
80  else
81  {
82  std::auto_ptr<EcalHaloData> EcalData( new EcalHaloData() ) ;
83  iEvent.put(EcalData);
84  }
85  return;
86 }
87 
89 void EcalHaloDataProducer::endJob(){return;}
90 void EcalHaloDataProducer::beginRun(edm::Run&, const edm::EventSetup&){return;}
91 void EcalHaloDataProducer::endRun(edm::Run&, const edm::EventSetup&){return;}
92 EcalHaloDataProducer::~EcalHaloDataProducer(){}
T getParameter(std::string const &) const
void SetAngleCut(float a=4.)
Definition: EcalHaloAlgo.h:55
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)
Definition: EcalHaloAlgo.cc:28
void beginJob()
Definition: Breakpoints.cc:15
void SetRecHitEnergyThresholds(float EB, float EE, float ES)
Definition: EcalHaloAlgo.h:58
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
void SetPhiWedgeThresholds(float SumE, int nhits)
Definition: EcalHaloAlgo.h:62
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const T & get() const
Definition: EventSetup.h:55
bool isValid() const
Definition: ESHandle.h:37
Definition: Run.h:33
void SetRoundnessCut(float r=100.)
Definition: EcalHaloAlgo.h:53