#include <HitReCalibrator.h>
Public Member Functions | |
virtual void | beginJob () |
HitReCalibrator (const edm::ParameterSet &) | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
~HitReCalibrator () | |
Private Attributes | |
bool | allowMissingInputs_ |
edm::InputTag | hbheInput_ |
edm::InputTag | hfInput_ |
edm::InputTag | hoInput_ |
Definition at line 38 of file HitReCalibrator.h.
cms::HitReCalibrator::HitReCalibrator | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 22 of file HitReCalibrator.cc.
References edm::ParameterSet::getParameter().
{ hbheInput_ = iConfig.getParameter<edm::InputTag>("hbheInput"); hoInput_ = iConfig.getParameter<edm::InputTag>("hoInput"); hfInput_ = iConfig.getParameter<edm::InputTag>("hfInput"); allowMissingInputs_ = true; //register your products produces<HBHERecHitCollection>("DiJetsHBHEReRecHitCollection"); produces<HORecHitCollection>("DiJetsHOReRecHitCollection"); produces<HFRecHitCollection>("DiJetsHFReRecHitCollection"); }
cms::HitReCalibrator::~HitReCalibrator | ( | ) |
Definition at line 39 of file HitReCalibrator.cc.
{ }
void cms::HitReCalibrator::beginJob | ( | void | ) | [virtual] |
void cms::HitReCalibrator::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 47 of file HitReCalibrator.cc.
References edm::SortedCollection< T, SORT >::begin(), gather_cfg::cout, ExpressReco_HICollisions_FallBack::e, edm::SortedCollection< T, SORT >::end(), relval_parameters_module::energy, HcalCondObjectContainer< Item >::exists(), edm::EventSetup::get(), edm::Event::getByLabel(), HcalRespCorr::getValue(), HcalCondObjectContainer< Item >::getValues(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), edm::Event::put(), and cond::rpcobgas::time.
{ std::auto_ptr<HBHERecHitCollection> miniDiJetsHBHERecHitCollection(new HBHERecHitCollection); std::auto_ptr<HORecHitCollection> miniDiJetsHORecHitCollection(new HORecHitCollection); std::auto_ptr<HFRecHitCollection> miniDiJetsHFRecHitCollection(new HFRecHitCollection); edm::ESHandle <HcalRespCorrs> recalibCorrs; iSetup.get<HcalRespCorrsRcd>().get("recalibrate",recalibCorrs); const HcalRespCorrs* jetRecalib = recalibCorrs.product(); try { edm::Handle<HBHERecHitCollection> hbhe; iEvent.getByLabel(hbheInput_,hbhe); const HBHERecHitCollection Hithbhe = *(hbhe.product()); for(HBHERecHitCollection::const_iterator hbheItr=Hithbhe.begin(); hbheItr!=Hithbhe.end(); hbheItr++) { DetId id = hbheItr->detid(); float recal; if (jetRecalib->exists(id)) recal = jetRecalib->getValues(id)->getValue(); else recal = 1.; float energy = hbheItr->energy(); float time = hbheItr->time(); HBHERecHit* hbhehit = new HBHERecHit(id,recal*energy,time); miniDiJetsHBHERecHitCollection->push_back(*hbhehit); } } catch (cms::Exception& e) { // can't find it! if (!allowMissingInputs_) {cout<<"No HBHE collection "<<endl; throw e;} } try{ edm::Handle<HORecHitCollection> ho; iEvent.getByLabel(hoInput_,ho); const HORecHitCollection Hitho = *(ho.product()); for(HORecHitCollection::const_iterator hoItr=Hitho.begin(); hoItr!=Hitho.end(); hoItr++) { DetId id = hoItr->detid(); float recal; if (jetRecalib->exists(id)) recal = jetRecalib->getValues(id)->getValue(); else recal = 1.; float energy = hoItr->energy(); float time = hoItr->time(); HORecHit* hohit = new HORecHit(id,recal*energy,time); miniDiJetsHORecHitCollection->push_back(*hohit); } } catch (cms::Exception& e) { // can't find it! if (!allowMissingInputs_) {cout<<" No HO collection "<<endl; throw e;} } try { edm::Handle<HFRecHitCollection> hf; iEvent.getByLabel(hfInput_,hf); const HFRecHitCollection Hithf = *(hf.product()); for(HFRecHitCollection::const_iterator hfItr=Hithf.begin(); hfItr!=Hithf.end(); hfItr++) { DetId id = hfItr->detid(); float recal; if (jetRecalib->exists(id)) recal = jetRecalib->getValues(id)->getValue(); else recal = 1.; float energy = hfItr->energy(); float time = hfItr->time(); HFRecHit* hfhit = new HFRecHit(id,recal*energy,time); miniDiJetsHFRecHitCollection->push_back(*hfhit); } } catch (cms::Exception& e) { // can't find it! if (!allowMissingInputs_) throw e; } //Put selected information in the event iEvent.put( miniDiJetsHBHERecHitCollection, "DiJetsHBHEReRecHitCollection"); iEvent.put( miniDiJetsHORecHitCollection, "DiJetsHOReRecHitCollection"); iEvent.put( miniDiJetsHFRecHitCollection, "DiJetsHFReRecHitCollection"); }
bool cms::HitReCalibrator::allowMissingInputs_ [private] |
Definition at line 49 of file HitReCalibrator.h.
Definition at line 50 of file HitReCalibrator.h.
edm::InputTag cms::HitReCalibrator::hfInput_ [private] |
Definition at line 52 of file HitReCalibrator.h.
edm::InputTag cms::HitReCalibrator::hoInput_ [private] |
Definition at line 51 of file HitReCalibrator.h.