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.
3 
4 /*
5  [class]: HcalHaloDataProducer
6  [authors]: R. Remington, The University of Florida
7  [description]: See HcalHaloDataProducer.h
8  [date]: October 15, 2009
9 */
10 
11 using namespace edm;
12 using namespace std;
13 using namespace reco;
14 
15 HcalHaloDataProducer::HcalHaloDataProducer(const edm::ParameterSet& iConfig)
16 {
17  //RecHit Level
18  IT_HBHERecHit = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
19  IT_HFRecHit = iConfig.getParameter<edm::InputTag>("HFRecHitLabel");
20  IT_HORecHit = iConfig.getParameter<edm::InputTag>("HORecHitLabel");
21 
22  HBRecHitEnergyThreshold = (float)iConfig.getParameter<double>("HBRecHitEnergyThresholdParam");
23  HERecHitEnergyThreshold = (float)iConfig.getParameter<double>("HERecHitEnergyThresholdParam");
24  SumHcalEnergyThreshold = (float) iConfig.getParameter<double>("SumHcalEnergyThresholdParam");
25  NHitsHcalThreshold = iConfig.getParameter<int>("NHitsHcalThresholdParam");
26 
27  hbherechit_token_ = consumes<HBHERecHitCollection>(IT_HBHERecHit);
28  hfrechit_token_ = consumes<HFRecHitCollection>(IT_HFRecHit);
29 
30  produces<HcalHaloData>();
31 }
32 
33 void HcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
34 {
35  //Get CaloGeometry
36  edm::ESHandle<CaloGeometry> TheCaloGeometry;
37  iSetup.get<CaloGeometryRecord>().get(TheCaloGeometry);
38 
39  //Get HB/HE RecHits
40  edm::Handle<HBHERecHitCollection> TheHBHERecHits;
41  // iEvent.getByLabel(IT_HBHERecHit, TheHBHERecHits);
42  iEvent.getByToken(hbherechit_token_, TheHBHERecHits);
43 
44  //Get HF RecHits
46  // iEvent.getByLabel(IT_HFRecHit, TheHFRecHits);
47  iEvent.getByToken(hfrechit_token_, TheHFRecHits);
48 
49  // Run the HcalHaloAlgo to reconstruct the HcalHaloData object
50  HcalHaloAlgo HcalAlgo;
51  HcalAlgo.SetRecHitEnergyThresholds( HBRecHitEnergyThreshold, HERecHitEnergyThreshold );
52  HcalAlgo.SetPhiWedgeThresholds( SumHcalEnergyThreshold, NHitsHcalThreshold );
53 
54  HcalHaloData HcalData;
55  if( TheCaloGeometry.isValid() && TheHBHERecHits.isValid() )
56  {
57  std::auto_ptr<HcalHaloData> HcalData( new HcalHaloData( HcalAlgo.Calculate(*TheCaloGeometry, TheHBHERecHits) ) ) ;
58  iEvent.put ( HcalData ) ;
59  }
60  else
61  {
62  std::auto_ptr<HcalHaloData> HcalData( new HcalHaloData() ) ;
63  iEvent.put( HcalData ) ;
64  }
65  return;
66 }
67 
68 HcalHaloDataProducer::~HcalHaloDataProducer(){}
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
void SetRecHitEnergyThresholds(float HB, float HE)
Definition: HcalHaloAlgo.h:38
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
reco::HcalHaloData Calculate(const CaloGeometry &TheCaloGeometry, edm::Handle< HBHERecHitCollection > &TheHBHERecHits)
Definition: HcalHaloAlgo.cc:25
bool isValid() const
Definition: HandleBase.h:75
void SetPhiWedgeThresholds(float SumE, int nhits)
Definition: HcalHaloAlgo.h:43
const T & get() const
Definition: EventSetup.h:55
bool isValid() const
Definition: ESHandle.h:47