CMS 3D CMS Logo

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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginJob () override
 
 HitReCalibrator (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HitReCalibrator () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

bool allowMissingInputs_
 
edm::EDGetTokenT< HBHERecHitCollectiontok_hbhe_
 
edm::EDGetTokenT< HFRecHitCollectiontok_hf_
 
edm::EDGetTokenT< HORecHitCollectiontok_ho_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 40 of file HitReCalibrator.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file HitReCalibrator.cc.

References edm::ParameterSet::getParameter().

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

Definition at line 38 of file HitReCalibrator.cc.

39 {
40 
41 }

Member Function Documentation

void cms::HitReCalibrator::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 34 of file HitReCalibrator.cc.

35 {
36 }
void cms::HitReCalibrator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 46 of file HitReCalibrator.cc.

References edm::SortedCollection< T, SORT >::begin(), gather_cfg::cout, DEFINE_FWK_MODULE, MillePedeFileConverter_cfg::e, edm::SortedCollection< T, SORT >::end(), HcalCondObjectContainer< Item >::exists(), edm::EventSetup::get(), edm::Event::getByToken(), HcalRespCorr::getValue(), HcalCondObjectContainer< Item >::getValues(), photonIsolationHIProducer_cfi::hbhe, photonIsolationHIProducer_cfi::hf, photonIsolationHIProducer_cfi::ho, eostools::move(), edm::Handle< T >::product(), edm::Event::put(), and ntuplemaker::time.

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

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

Member Data Documentation

bool cms::HitReCalibrator::allowMissingInputs_
private

Definition at line 51 of file HitReCalibrator.h.

edm::EDGetTokenT<HBHERecHitCollection> cms::HitReCalibrator::tok_hbhe_
private

Definition at line 53 of file HitReCalibrator.h.

edm::EDGetTokenT<HFRecHitCollection> cms::HitReCalibrator::tok_hf_
private

Definition at line 55 of file HitReCalibrator.h.

edm::EDGetTokenT<HORecHitCollection> cms::HitReCalibrator::tok_ho_
private

Definition at line 54 of file HitReCalibrator.h.