CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/RecoMET/METProducers/src/HcalHaloDataProducer.cc

Go to the documentation of this file.
00001 #include "RecoMET/METProducers/interface/HcalHaloDataProducer.h"
00002 
00003 /*
00004   [class]:  HcalHaloDataProducer
00005   [authors]: R. Remington, The University of Florida
00006   [description]: See HcalHaloDataProducer.h
00007   [date]: October 15, 2009
00008 */
00009 
00010 using namespace edm;
00011 using namespace std;
00012 using namespace reco;
00013 
00014 HcalHaloDataProducer::HcalHaloDataProducer(const edm::ParameterSet& iConfig)
00015 {
00016   //RecHit Level
00017   IT_HBHERecHit  = iConfig.getParameter<edm::InputTag>("HBHERecHitLabel");
00018   IT_HFRecHit    = iConfig.getParameter<edm::InputTag>("HFRecHitLabel");
00019   IT_HORecHit    = iConfig.getParameter<edm::InputTag>("HORecHitLabel");
00020 
00021   HBRecHitEnergyThreshold = (float)iConfig.getParameter<double>("HBRecHitEnergyThresholdParam");
00022   HERecHitEnergyThreshold = (float)iConfig.getParameter<double>("HERecHitEnergyThresholdParam");
00023   SumHcalEnergyThreshold = (float) iConfig.getParameter<double>("SumHcalEnergyThresholdParam");
00024   NHitsHcalThreshold =  iConfig.getParameter<int>("NHitsHcalThresholdParam");
00025 
00026   produces<HcalHaloData>();
00027 }
00028 
00029 void HcalHaloDataProducer::produce(Event& iEvent, const EventSetup& iSetup)
00030 {
00031   //Get CaloGeometry
00032   edm::ESHandle<CaloGeometry> TheCaloGeometry;
00033   iSetup.get<CaloGeometryRecord>().get(TheCaloGeometry);
00034   
00035   //Get HB/HE RecHits
00036   edm::Handle<HBHERecHitCollection> TheHBHERecHits;
00037   iEvent.getByLabel(IT_HBHERecHit, TheHBHERecHits);
00038 
00039   //Get HF RecHits
00040   edm::Handle<HFRecHitCollection> TheHFRecHits;
00041   iEvent.getByLabel(IT_HFRecHit, TheHFRecHits);
00042 
00043   // Run the HcalHaloAlgo to reconstruct the HcalHaloData object
00044   HcalHaloAlgo HcalAlgo;
00045   HcalAlgo.SetRecHitEnergyThresholds( HBRecHitEnergyThreshold, HERecHitEnergyThreshold );
00046   HcalAlgo.SetPhiWedgeThresholds( SumHcalEnergyThreshold, NHitsHcalThreshold );
00047 
00048   HcalHaloData HcalData;
00049   if( TheCaloGeometry.isValid() && TheHBHERecHits.isValid() )
00050     {
00051       std::auto_ptr<HcalHaloData> HcalData( new HcalHaloData( HcalAlgo.Calculate(*TheCaloGeometry, TheHBHERecHits)  ) ) ;
00052       iEvent.put ( HcalData ) ;
00053     }
00054   else 
00055     {
00056       std::auto_ptr<HcalHaloData> HcalData( new HcalHaloData() ) ;
00057       iEvent.put( HcalData ) ;
00058     }
00059   return;
00060 }
00061 
00062 void HcalHaloDataProducer::beginJob(){return;}
00063 void HcalHaloDataProducer::endJob(){return;}
00064 void HcalHaloDataProducer::beginRun(edm::Run&, const edm::EventSetup&){return;}
00065 void HcalHaloDataProducer::endRun(edm::Run&, const edm::EventSetup&){return;}
00066 HcalHaloDataProducer::~HcalHaloDataProducer(){}