CMS 3D CMS Logo

cms::HitReCalibrator Class Reference

#include <Calibration/HcalCalibAlgos/src/HitReCalibrator.h>

Inheritance diagram for cms::HitReCalibrator:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob (const edm::EventSetup &)
 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_


Detailed Description

Definition at line 38 of file HitReCalibrator.h.


Constructor & Destructor Documentation

cms::HitReCalibrator::HitReCalibrator ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 22 of file HitReCalibrator.cc.

References allowMissingInputs_, edm::ParameterSet::getParameter(), hbheInput_, hfInput_, and hoInput_.

00023 {
00024    hbheInput_ = iConfig.getParameter<edm::InputTag>("hbheInput");
00025    hoInput_ = iConfig.getParameter<edm::InputTag>("hoInput");
00026    hfInput_ = iConfig.getParameter<edm::InputTag>("hfInput"); 
00027    allowMissingInputs_ = true;
00028 //register your products
00029 
00030    produces<HBHERecHitCollection>("DiJetsHBHEReRecHitCollection");
00031    produces<HORecHitCollection>("DiJetsHOReRecHitCollection");
00032    produces<HFRecHitCollection>("DiJetsHFReRecHitCollection");
00033 
00034 }

cms::HitReCalibrator::~HitReCalibrator (  ) 

Definition at line 39 of file HitReCalibrator.cc.

00040 {
00041 
00042 }


Member Function Documentation

void cms::HitReCalibrator::beginJob ( const edm::EventSetup iSetup  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 35 of file HitReCalibrator.cc.

00036 {
00037 }

void cms::HitReCalibrator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDProducer.

Definition at line 47 of file HitReCalibrator.cc.

References allowMissingInputs_, edm::SortedCollection< T, SORT >::begin(), GenMuonPlsPt100GeV_cfg::cout, e, edm::SortedCollection< T, SORT >::end(), lat::endl(), relval_parameters_module::energy, HcalCondObjectContainer< Item >::exists(), edm::EventSetup::get(), edm::Event::getByLabel(), HcalCondObjectContainer< Item >::getValues(), hbheInput_, hfInput_, hoInput_, edm::ESHandle< T >::product(), edm::Handle< T >::product(), and edm::Event::put().

00048 {
00049 
00050   std::auto_ptr<HBHERecHitCollection> miniDiJetsHBHERecHitCollection(new HBHERecHitCollection);
00051   std::auto_ptr<HORecHitCollection> miniDiJetsHORecHitCollection(new HORecHitCollection);
00052   std::auto_ptr<HFRecHitCollection> miniDiJetsHFRecHitCollection(new HFRecHitCollection);
00053 
00054  
00055   edm::ESHandle <HcalRespCorrs> recalibCorrs;
00056   iSetup.get<HcalRespCorrsRcd>().get("recalibrate",recalibCorrs);
00057   const HcalRespCorrs* jetRecalib = recalibCorrs.product();
00058  
00059    
00060   try {
00061   edm::Handle<HBHERecHitCollection> hbhe;
00062   iEvent.getByLabel(hbheInput_,hbhe);
00063   const HBHERecHitCollection Hithbhe = *(hbhe.product());
00064   for(HBHERecHitCollection::const_iterator hbheItr=Hithbhe.begin(); hbheItr!=Hithbhe.end(); hbheItr++)
00065         {
00066            DetId id = hbheItr->detid();
00067            float recal; 
00068            if (jetRecalib->exists(id))
00069              recal = jetRecalib->getValues(id)->getValue();
00070            else recal = 1.; 
00071            float energy = hbheItr->energy(); 
00072            float time = hbheItr->time();
00073            HBHERecHit* hbhehit = new HBHERecHit(id,recal*energy,time);  
00074            miniDiJetsHBHERecHitCollection->push_back(*hbhehit);
00075         }
00076   } catch (cms::Exception& e) { // can't find it!
00077   if (!allowMissingInputs_) {cout<<"No HBHE collection "<<endl; throw e;}
00078   }
00079 
00080   try{  
00081   edm::Handle<HORecHitCollection> ho;
00082   iEvent.getByLabel(hoInput_,ho);
00083   const HORecHitCollection Hitho = *(ho.product());
00084   for(HORecHitCollection::const_iterator hoItr=Hitho.begin(); hoItr!=Hitho.end(); hoItr++)
00085         {
00086            DetId id = hoItr->detid();
00087            float recal; 
00088            if (jetRecalib->exists(id))
00089              recal = jetRecalib->getValues(id)->getValue();
00090            else recal = 1.; 
00091            float energy = hoItr->energy(); 
00092            float time = hoItr->time();
00093            HORecHit* hohit = new HORecHit(id,recal*energy,time); 
00094            miniDiJetsHORecHitCollection->push_back(*hohit);
00095         }
00096   } catch (cms::Exception& e) { // can't find it!
00097   if (!allowMissingInputs_) {cout<<" No HO collection "<<endl; throw e;}
00098   }
00099 
00100   try {
00101   edm::Handle<HFRecHitCollection> hf;
00102   iEvent.getByLabel(hfInput_,hf);
00103   const HFRecHitCollection Hithf = *(hf.product());
00104   for(HFRecHitCollection::const_iterator hfItr=Hithf.begin(); hfItr!=Hithf.end(); hfItr++)
00105       {
00106            DetId id = hfItr->detid();
00107            float recal; 
00108            if (jetRecalib->exists(id))
00109              recal = jetRecalib->getValues(id)->getValue();
00110            else recal = 1.; 
00111            float energy = hfItr->energy(); 
00112            float time = hfItr->time();
00113            HFRecHit* hfhit = new HFRecHit(id,recal*energy,time); 
00114            miniDiJetsHFRecHitCollection->push_back(*hfhit);
00115       }
00116   } catch (cms::Exception& e) { // can't find it!
00117   if (!allowMissingInputs_) throw e;
00118   }
00119 
00120   //Put selected information in the event
00121 
00122   iEvent.put( miniDiJetsHBHERecHitCollection, "DiJetsHBHEReRecHitCollection");
00123 
00124   iEvent.put( miniDiJetsHORecHitCollection, "DiJetsHOReRecHitCollection");
00125 
00126   iEvent.put( miniDiJetsHFRecHitCollection, "DiJetsHFReRecHitCollection");
00127 
00128 }


Member Data Documentation

bool cms::HitReCalibrator::allowMissingInputs_ [private]

Definition at line 49 of file HitReCalibrator.h.

Referenced by HitReCalibrator(), and produce().

edm::InputTag cms::HitReCalibrator::hbheInput_ [private]

Definition at line 50 of file HitReCalibrator.h.

Referenced by HitReCalibrator(), and produce().

edm::InputTag cms::HitReCalibrator::hfInput_ [private]

Definition at line 52 of file HitReCalibrator.h.

Referenced by HitReCalibrator(), and produce().

edm::InputTag cms::HitReCalibrator::hoInput_ [private]

Definition at line 51 of file HitReCalibrator.h.

Referenced by HitReCalibrator(), and produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:36:33 2009 for CMSSW by  doxygen 1.5.4