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 ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

bool allowMissingInputs_
 
edm::EDGetTokenT< HBHERecHitCollectiontok_hbhe_
 
edm::EDGetTokenT< HFRecHitCollectiontok_hf_
 
edm::EDGetTokenT< HORecHitCollectiontok_ho_
 
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcdtok_resp_
 

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)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 36 of file HitReCalibrator.h.

Constructor & Destructor Documentation

◆ HitReCalibrator()

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

Definition at line 13 of file HitReCalibrator.cc.

13  {
14  tok_hbhe_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInput"));
15  tok_ho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInput"));
16  tok_hf_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInput"));
17  allowMissingInputs_ = true;
18  tok_resp_ = esConsumes<HcalRespCorrs, HcalRespCorrsRcd>();
19 
20  //register your products
21 
22  produces<HBHERecHitCollection>("DiJetsHBHEReRecHitCollection");
23  produces<HORecHitCollection>("DiJetsHOReRecHitCollection");
24  produces<HFRecHitCollection>("DiJetsHFReRecHitCollection");
25  }

References allowMissingInputs_, edm::ParameterSet::getParameter(), tok_hbhe_, tok_hf_, tok_ho_, and tok_resp_.

◆ ~HitReCalibrator()

cms::HitReCalibrator::~HitReCalibrator ( )
override

Definition at line 28 of file HitReCalibrator.cc.

28 {}

Member Function Documentation

◆ beginJob()

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

Reimplemented from edm::EDProducer.

Definition at line 26 of file HitReCalibrator.cc.

26 {}

◆ produce()

void cms::HitReCalibrator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 31 of file HitReCalibrator.cc.

31  {
32  auto miniDiJetsHBHERecHitCollection = std::make_unique<HBHERecHitCollection>();
33  auto miniDiJetsHORecHitCollection = std::make_unique<HORecHitCollection>();
34  auto miniDiJetsHFRecHitCollection = std::make_unique<HFRecHitCollection>();
35 
36  const HcalRespCorrs* jetRecalib = &iSetup.getData(tok_resp_);
37 
38  try {
40  iEvent.getByToken(tok_hbhe_, hbhe);
41  const HBHERecHitCollection Hithbhe = *(hbhe.product());
42  for (HBHERecHitCollection::const_iterator hbheItr = Hithbhe.begin(); hbheItr != Hithbhe.end(); hbheItr++) {
43  DetId id = hbheItr->detid();
44  float recal;
45  if (jetRecalib->exists(id))
46  recal = jetRecalib->getValues(id)->getValue();
47  else
48  recal = 1.;
49  float energy = hbheItr->energy();
50  float time = hbheItr->time();
51  HBHERecHit* hbhehit = new HBHERecHit(id, recal * energy, time);
52  miniDiJetsHBHERecHitCollection->push_back(*hbhehit);
53  }
54  } catch (cms::Exception& e) { // can't find it!
55  if (!allowMissingInputs_) {
56  edm::LogError("HitCalib") << "No HBHE collection ";
57  throw e;
58  }
59  }
60 
61  try {
63  iEvent.getByToken(tok_ho_, ho);
64  const HORecHitCollection Hitho = *(ho.product());
65  for (HORecHitCollection::const_iterator hoItr = Hitho.begin(); hoItr != Hitho.end(); hoItr++) {
66  DetId id = hoItr->detid();
67  float recal;
68  if (jetRecalib->exists(id))
69  recal = jetRecalib->getValues(id)->getValue();
70  else
71  recal = 1.;
72  float energy = hoItr->energy();
73  float time = hoItr->time();
74  HORecHit* hohit = new HORecHit(id, recal * energy, time);
75  miniDiJetsHORecHitCollection->push_back(*hohit);
76  }
77  } catch (cms::Exception& e) { // can't find it!
78  if (!allowMissingInputs_) {
79  edm::LogError("HitCalib") << " No HO collection ";
80  throw e;
81  }
82  }
83 
84  try {
86  iEvent.getByToken(tok_hf_, hf);
87  const HFRecHitCollection Hithf = *(hf.product());
88  for (HFRecHitCollection::const_iterator hfItr = Hithf.begin(); hfItr != Hithf.end(); hfItr++) {
89  DetId id = hfItr->detid();
90  float recal;
91  if (jetRecalib->exists(id))
92  recal = jetRecalib->getValues(id)->getValue();
93  else
94  recal = 1.;
95  float energy = hfItr->energy();
96  float time = hfItr->time();
97  HFRecHit* hfhit = new HFRecHit(id, recal * energy, time);
98  miniDiJetsHFRecHitCollection->push_back(*hfhit);
99  }
100  } catch (cms::Exception& e) { // can't find it!
101  if (!allowMissingInputs_)
102  throw e;
103  }
104 
105  //Put selected information in the event
106 
107  iEvent.put(std::move(miniDiJetsHBHERecHitCollection), "DiJetsHBHEReRecHitCollection");
108 
109  iEvent.put(std::move(miniDiJetsHORecHitCollection), "DiJetsHOReRecHitCollection");
110 
111  iEvent.put(std::move(miniDiJetsHFRecHitCollection), "DiJetsHFReRecHitCollection");
112  }

References allowMissingInputs_, edm::SortedCollection< T, SORT >::begin(), MillePedeFileConverter_cfg::e, edm::SortedCollection< T, SORT >::end(), HCALHighEnergyHPDFilter_cfi::energy, HcalCondObjectContainer< Item >::exists(), edm::EventSetup::getData(), HcalRespCorr::getValue(), HcalCondObjectContainer< Item >::getValues(), photonIsolationHIProducer_cfi::hbhe, photonIsolationHIProducer_cfi::hf, photonIsolationHIProducer_cfi::ho, iEvent, eostools::move(), protons_cff::time, tok_hbhe_, tok_hf_, tok_ho_, and tok_resp_.

Member Data Documentation

◆ allowMissingInputs_

bool cms::HitReCalibrator::allowMissingInputs_
private

Definition at line 48 of file HitReCalibrator.h.

Referenced by HitReCalibrator(), and produce().

◆ tok_hbhe_

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

Definition at line 50 of file HitReCalibrator.h.

Referenced by HitReCalibrator(), and produce().

◆ tok_hf_

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

Definition at line 52 of file HitReCalibrator.h.

Referenced by HitReCalibrator(), and produce().

◆ tok_ho_

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

Definition at line 51 of file HitReCalibrator.h.

Referenced by HitReCalibrator(), and produce().

◆ tok_resp_

edm::ESGetToken<HcalRespCorrs, HcalRespCorrsRcd> cms::HitReCalibrator::tok_resp_
private

Definition at line 54 of file HitReCalibrator.h.

Referenced by HitReCalibrator(), and produce().

HcalRespCorrs
Definition: HcalRespCorrs.h:17
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
HORecHit
Definition: HORecHit.h:11
HBHERecHit
Definition: HBHERecHit.h:13
protons_cff.time
time
Definition: protons_cff.py:39
edm::SortedCollection
Definition: SortedCollection.h:49
cms::HitReCalibrator::tok_hbhe_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
Definition: HitReCalibrator.h:50
cms::HitReCalibrator::tok_resp_
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_resp_
Definition: HitReCalibrator.h:54
edm::Handle
Definition: AssociativeIterator.h:50
HcalCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition: HcalCondObjectContainer.h:159
DetId
Definition: DetId.h:17
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
HFRecHit
Definition: HFRecHit.h:11
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
cms::HitReCalibrator::allowMissingInputs_
bool allowMissingInputs_
Definition: HitReCalibrator.h:48
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HcalCondObjectContainer::exists
bool exists(DetId fId) const
Definition: HcalCondObjectContainer.h:223
cms::HitReCalibrator::tok_hf_
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
Definition: HitReCalibrator.h:52
HcalRespCorr::getValue
float getValue() const
Definition: HcalRespCorr.h:19
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
iEvent
int iEvent
Definition: GenABIO.cc:224
photonIsolationHIProducer_cfi.ho
ho
Definition: photonIsolationHIProducer_cfi.py:10
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cms::HitReCalibrator::tok_ho_
edm::EDGetTokenT< HORecHitCollection > tok_ho_
Definition: HitReCalibrator.h:51
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
cms::Exception
Definition: Exception.h:70
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37