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.
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 
22  //Higher Level Reco
23  IT_SuperCluster = iConfig.getParameter<edm::InputTag>("SuperClusterLabel");
24  IT_Photon = iConfig.getParameter<edm::InputTag>("PhotonLabel") ;
25 
26  // Shower Shape cuts for EcalAlgo
27 
28  RoundnessCut = iConfig.getParameter<double>("RoundnessCutParam");
29  AngleCut = iConfig.getParameter<double>("AngleCutParam");
30 
31  EBRecHitEnergyThreshold = (float) iConfig.getParameter<double> ("EBRecHitEnergyThresholdParam");
32  EERecHitEnergyThreshold = (float) iConfig.getParameter<double> ("EERecHitEnergyThresholdParam");
33  ESRecHitEnergyThreshold = (float) iConfig.getParameter<double> ("ESRecHitEnergyThresholdParam");
34  SumEcalEnergyThreshold = (float)iConfig.getParameter<double> ("SumEcalEnergyThresholdParam");
35  NHitsEcalThreshold = iConfig.getParameter<int> ("NHitsEcalThresholdParam");
36 
37  RoundnessCut = iConfig.getParameter<double>("RoundnessCutParam");
38  AngleCut = iConfig.getParameter<double>("AngleCutParam");
39 
40  ebrechit_token_ = consumes<EBRecHitCollection>(IT_EBRecHit);
41  eerechit_token_ = consumes<EERecHitCollection>(IT_EERecHit);
42  esrechit_token_ = consumes<ESRecHitCollection>(IT_ESRecHit);
43  supercluster_token_ = consumes<reco::SuperClusterCollection>(IT_SuperCluster);
44  photon_token_ = consumes<reco::PhotonCollection>(IT_Photon);
45 
46  produces<EcalHaloData>();
47 }
48 
49 void EcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
50 {
51  //Get CaloGeometry
52  edm::ESHandle<CaloGeometry> TheCaloGeometry;
53  iSetup.get<CaloGeometryRecord>().get(TheCaloGeometry);
54 
55  //Get EB RecHits
57  // iEvent.getByLabel(IT_EBRecHit, TheEBRecHits);
58  iEvent.getByToken(ebrechit_token_, TheEBRecHits);
59 
60  //Get EE RecHits
62  // iEvent.getByLabel(IT_EERecHit, TheEERecHits);
63  iEvent.getByToken(eerechit_token_, TheEERecHits);
64 
65  //Get ES RecHits
67  // iEvent.getByLabel(IT_ESRecHit, TheESRecHits);
68  iEvent.getByToken(esrechit_token_, TheESRecHits);
69 
70  //Get ECAL Barrel SuperClusters
72  // iEvent.getByLabel(IT_SuperCluster, TheSuperClusters);
73  iEvent.getByToken(supercluster_token_, TheSuperClusters);
74 
75  //Get Photons
77  // iEvent.getByLabel(IT_Photon, ThePhotons);
78  iEvent.getByToken(photon_token_, ThePhotons);
79 
80  //Run the EcalHaloAlgo to reconstruct the EcalHaloData object
81  EcalHaloAlgo EcalAlgo;
82  EcalAlgo.SetRoundnessCut(RoundnessCut);
83  EcalAlgo.SetAngleCut(AngleCut);
84  EcalAlgo.SetRecHitEnergyThresholds(EBRecHitEnergyThreshold, EERecHitEnergyThreshold, ESRecHitEnergyThreshold);
85  EcalAlgo.SetPhiWedgeThresholds(SumEcalEnergyThreshold, NHitsEcalThreshold);
86 
87  if( TheCaloGeometry.isValid() && ThePhotons.isValid() && TheSuperClusters.isValid() && TheEBRecHits.isValid() && TheEERecHits.isValid() && TheESRecHits.isValid() )
88  {
89  std::auto_ptr<EcalHaloData> EcalData( new EcalHaloData( EcalAlgo.Calculate(*TheCaloGeometry, ThePhotons, TheSuperClusters, TheEBRecHits, TheEERecHits, TheESRecHits)));
90  iEvent.put( EcalData ) ;
91  }
92  else
93  {
94  std::auto_ptr<EcalHaloData> EcalData( new EcalHaloData() ) ;
95  iEvent.put(EcalData);
96  }
97  return;
98 }
99 
100 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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void SetRecHitEnergyThresholds(float EB, float EE, float ES)
Definition: EcalHaloAlgo.h:58
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
void SetPhiWedgeThresholds(float SumE, int nhits)
Definition: EcalHaloAlgo.h:62
bool isValid() const
Definition: HandleBase.h:75
const T & get() const
Definition: EventSetup.h:55
bool isValid() const
Definition: ESHandle.h:47
void SetRoundnessCut(float r=100.)
Definition: EcalHaloAlgo.h:53