CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalHaloDataProducer.cc
Go to the documentation of this file.
2 
3 /*
4  [class]: HcalHaloDataProducer
5  [authors]: R. Remington, The University of Florida
6  [description]: See HcalHaloDataProducer.h
7  [date]: October 15, 2009
8 */
9 
10 using namespace edm;
11 using namespace std;
12 using namespace reco;
13 
14 HcalHaloDataProducer::HcalHaloDataProducer(const edm::ParameterSet& iConfig)
15 {
16  //RecHit Level
17  IT_HBHERecHit = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
18  IT_HFRecHit = iConfig.getParameter<edm::InputTag>("HFRecHitLabel");
19  IT_HORecHit = iConfig.getParameter<edm::InputTag>("HORecHitLabel");
20 
21  HBRecHitEnergyThreshold = (float)iConfig.getParameter<double>("HBRecHitEnergyThresholdParam");
22  HERecHitEnergyThreshold = (float)iConfig.getParameter<double>("HERecHitEnergyThresholdParam");
23  SumHcalEnergyThreshold = (float) iConfig.getParameter<double>("SumHcalEnergyThresholdParam");
24  NHitsHcalThreshold = iConfig.getParameter<int>("NHitsHcalThresholdParam");
25 
26  produces<HcalHaloData>();
27 }
28 
29 void HcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
30 {
31  //Get CaloGeometry
32  edm::ESHandle<CaloGeometry> TheCaloGeometry;
33  iSetup.get<CaloGeometryRecord>().get(TheCaloGeometry);
34 
35  //Get HB/HE RecHits
36  edm::Handle<HBHERecHitCollection> TheHBHERecHits;
37  iEvent.getByLabel(IT_HBHERecHit, TheHBHERecHits);
38 
39  //Get HF RecHits
41  iEvent.getByLabel(IT_HFRecHit, TheHFRecHits);
42 
43  // Run the HcalHaloAlgo to reconstruct the HcalHaloData object
44  HcalHaloAlgo HcalAlgo;
45  HcalAlgo.SetRecHitEnergyThresholds( HBRecHitEnergyThreshold, HERecHitEnergyThreshold );
46  HcalAlgo.SetPhiWedgeThresholds( SumHcalEnergyThreshold, NHitsHcalThreshold );
47 
48  HcalHaloData HcalData;
49  if( TheCaloGeometry.isValid() && TheHBHERecHits.isValid() )
50  {
51  std::auto_ptr<HcalHaloData> HcalData( new HcalHaloData( HcalAlgo.Calculate(*TheCaloGeometry, TheHBHERecHits) ) ) ;
52  iEvent.put ( HcalData ) ;
53  }
54  else
55  {
56  std::auto_ptr<HcalHaloData> HcalData( new HcalHaloData() ) ;
57  iEvent.put( HcalData ) ;
58  }
59  return;
60 }
61 
62 HcalHaloDataProducer::~HcalHaloDataProducer(){}
T getParameter(std::string const &) const
void SetRecHitEnergyThresholds(float HB, float HE)
Definition: HcalHaloAlgo.h:38
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
reco::HcalHaloData Calculate(const CaloGeometry &TheCaloGeometry, edm::Handle< HBHERecHitCollection > &TheHBHERecHits)
Definition: HcalHaloAlgo.cc:25
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
void SetPhiWedgeThresholds(float SumE, int nhits)
Definition: HcalHaloAlgo.h:43
const T & get() const
Definition: EventSetup.h:55
bool isValid() const
Definition: ESHandle.h:37