CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
cms::HitReCalibrator Class Reference

#include <HitReCalibrator.h>

Inheritance diagram for cms::HitReCalibrator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
 HitReCalibrator (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~HitReCalibrator ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

bool allowMissingInputs_
 
edm::InputTag hbheInput_
 
edm::InputTag hfInput_
 
edm::InputTag hoInput_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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 edm::ParameterSet::getParameter().

23 {
24  hbheInput_ = iConfig.getParameter<edm::InputTag>("hbheInput");
25  hoInput_ = iConfig.getParameter<edm::InputTag>("hoInput");
26  hfInput_ = iConfig.getParameter<edm::InputTag>("hfInput");
27  allowMissingInputs_ = true;
28 //register your products
29 
30  produces<HBHERecHitCollection>("DiJetsHBHEReRecHitCollection");
31  produces<HORecHitCollection>("DiJetsHOReRecHitCollection");
32  produces<HFRecHitCollection>("DiJetsHFReRecHitCollection");
33 
34 }
T getParameter(std::string const &) const
edm::InputTag hfInput_
edm::InputTag hbheInput_
edm::InputTag hoInput_
cms::HitReCalibrator::~HitReCalibrator ( )

Definition at line 39 of file HitReCalibrator.cc.

40 {
41 
42 }

Member Function Documentation

void cms::HitReCalibrator::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 35 of file HitReCalibrator.cc.

36 {
37 }
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, alignCSCRings::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::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), and cond::rpcobgas::time.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

48 {
49 
50  std::auto_ptr<HBHERecHitCollection> miniDiJetsHBHERecHitCollection(new HBHERecHitCollection);
51  std::auto_ptr<HORecHitCollection> miniDiJetsHORecHitCollection(new HORecHitCollection);
52  std::auto_ptr<HFRecHitCollection> miniDiJetsHFRecHitCollection(new HFRecHitCollection);
53 
54 
55  edm::ESHandle <HcalRespCorrs> recalibCorrs;
56  iSetup.get<HcalRespCorrsRcd>().get("recalibrate",recalibCorrs);
57  const HcalRespCorrs* jetRecalib = recalibCorrs.product();
58 
59 
60  try {
62  iEvent.getByLabel(hbheInput_,hbhe);
63  const HBHERecHitCollection Hithbhe = *(hbhe.product());
64  for(HBHERecHitCollection::const_iterator hbheItr=Hithbhe.begin(); hbheItr!=Hithbhe.end(); hbheItr++)
65  {
66  DetId id = hbheItr->detid();
67  float recal;
68  if (jetRecalib->exists(id))
69  recal = jetRecalib->getValues(id)->getValue();
70  else recal = 1.;
71  float energy = hbheItr->energy();
72  float time = hbheItr->time();
73  HBHERecHit* hbhehit = new HBHERecHit(id,recal*energy,time);
74  miniDiJetsHBHERecHitCollection->push_back(*hbhehit);
75  }
76  } catch (cms::Exception& e) { // can't find it!
77  if (!allowMissingInputs_) {cout<<"No HBHE collection "<<endl; throw e;}
78  }
79 
80  try{
82  iEvent.getByLabel(hoInput_,ho);
83  const HORecHitCollection Hitho = *(ho.product());
84  for(HORecHitCollection::const_iterator hoItr=Hitho.begin(); hoItr!=Hitho.end(); hoItr++)
85  {
86  DetId id = hoItr->detid();
87  float recal;
88  if (jetRecalib->exists(id))
89  recal = jetRecalib->getValues(id)->getValue();
90  else recal = 1.;
91  float energy = hoItr->energy();
92  float time = hoItr->time();
93  HORecHit* hohit = new HORecHit(id,recal*energy,time);
94  miniDiJetsHORecHitCollection->push_back(*hohit);
95  }
96  } catch (cms::Exception& e) { // can't find it!
97  if (!allowMissingInputs_) {cout<<" No HO collection "<<endl; throw e;}
98  }
99 
100  try {
102  iEvent.getByLabel(hfInput_,hf);
103  const HFRecHitCollection Hithf = *(hf.product());
104  for(HFRecHitCollection::const_iterator hfItr=Hithf.begin(); hfItr!=Hithf.end(); hfItr++)
105  {
106  DetId id = hfItr->detid();
107  float recal;
108  if (jetRecalib->exists(id))
109  recal = jetRecalib->getValues(id)->getValue();
110  else recal = 1.;
111  float energy = hfItr->energy();
112  float time = hfItr->time();
113  HFRecHit* hfhit = new HFRecHit(id,recal*energy,time);
114  miniDiJetsHFRecHitCollection->push_back(*hfhit);
115  }
116  } catch (cms::Exception& e) { // can't find it!
117  if (!allowMissingInputs_) throw e;
118  }
119 
120  //Put selected information in the event
121 
122  iEvent.put( miniDiJetsHBHERecHitCollection, "DiJetsHBHEReRecHitCollection");
123 
124  iEvent.put( miniDiJetsHORecHitCollection, "DiJetsHOReRecHitCollection");
125 
126  iEvent.put( miniDiJetsHFRecHitCollection, "DiJetsHFReRecHitCollection");
127 
128 }
edm::InputTag hfInput_
std::vector< T >::const_iterator const_iterator
edm::InputTag hbheInput_
const bool exists(DetId fId) const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
const_iterator end() const
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
T const * product() const
Definition: Handle.h:74
float getValue() const
Definition: HcalRespCorr.h:18
tuple cout
Definition: gather_cfg.py:121
edm::InputTag hoInput_
const Item * getValues(DetId fId) const
const_iterator begin() const

Member Data Documentation

bool cms::HitReCalibrator::allowMissingInputs_
private

Definition at line 49 of file HitReCalibrator.h.

edm::InputTag cms::HitReCalibrator::hbheInput_
private

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.