CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cms::HitReCalibrator Class Reference
Inheritance diagram for cms::HitReCalibrator:
edm::one::EDProducer<> edm::one::EDProducerBase 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::one::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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_
 
const edm::EDGetTokenT< HBHERecHitCollectiontok_hbhe_
 
const edm::EDGetTokenT< HFRecHitCollectiontok_hf_
 
const edm::EDGetTokenT< HORecHitCollectiontok_ho_
 
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcdtok_resp_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 35 of file HitReCalibrator.cc.

Constructor & Destructor Documentation

◆ HitReCalibrator()

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

Definition at line 59 of file HitReCalibrator.cc.

References allowMissingInputs_.

60  : tok_hbhe_(consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInput"))),
61  tok_ho_(consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInput"))),
62  tok_hf_(consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("hfInput"))),
63  tok_resp_(esConsumes<HcalRespCorrs, HcalRespCorrsRcd>()) {
64  allowMissingInputs_ = true;
65 
66  //register your products
67 
68  produces<HBHERecHitCollection>("DiJetsHBHEReRecHitCollection");
69  produces<HORecHitCollection>("DiJetsHOReRecHitCollection");
70  produces<HFRecHitCollection>("DiJetsHFReRecHitCollection");
71  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< HORecHitCollection > tok_ho_
const edm::EDGetTokenT< HFRecHitCollection > tok_hf_
const edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_resp_

◆ ~HitReCalibrator()

cms::HitReCalibrator::~HitReCalibrator ( )
override

Definition at line 74 of file HitReCalibrator.cc.

74 {}

Member Function Documentation

◆ beginJob()

void cms::HitReCalibrator::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 72 of file HitReCalibrator.cc.

72 {}

◆ produce()

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

Implements edm::one::EDProducerBase.

Definition at line 77 of file HitReCalibrator.cc.

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

77  {
78  auto miniDiJetsHBHERecHitCollection = std::make_unique<HBHERecHitCollection>();
79  auto miniDiJetsHORecHitCollection = std::make_unique<HORecHitCollection>();
80  auto miniDiJetsHFRecHitCollection = std::make_unique<HFRecHitCollection>();
81 
82  const HcalRespCorrs* jetRecalib = &iSetup.getData(tok_resp_);
83 
84  try {
86  const HBHERecHitCollection Hithbhe = *(hbhe.product());
87  for (HBHERecHitCollection::const_iterator hbheItr = Hithbhe.begin(); hbheItr != Hithbhe.end(); hbheItr++) {
88  DetId id = hbheItr->detid();
89  float recal;
90  if (jetRecalib->exists(id))
91  recal = jetRecalib->getValues(id)->getValue();
92  else
93  recal = 1.;
94  float energy = hbheItr->energy();
95  float time = hbheItr->time();
96  HBHERecHit* hbhehit = new HBHERecHit(id, recal * energy, time);
97  miniDiJetsHBHERecHitCollection->push_back(*hbhehit);
98  }
99  } catch (cms::Exception& e) { // can't find it!
100  if (!allowMissingInputs_) {
101  edm::LogError("HitCalib") << "No HBHE collection ";
102  throw e;
103  }
104  }
105 
106  try {
107  const edm::Handle<HORecHitCollection>& ho = iEvent.getHandle(tok_ho_);
108  const HORecHitCollection Hitho = *(ho.product());
109  for (HORecHitCollection::const_iterator hoItr = Hitho.begin(); hoItr != Hitho.end(); hoItr++) {
110  DetId id = hoItr->detid();
111  float recal;
112  if (jetRecalib->exists(id))
113  recal = jetRecalib->getValues(id)->getValue();
114  else
115  recal = 1.;
116  float energy = hoItr->energy();
117  float time = hoItr->time();
118  HORecHit* hohit = new HORecHit(id, recal * energy, time);
119  miniDiJetsHORecHitCollection->push_back(*hohit);
120  }
121  } catch (cms::Exception& e) { // can't find it!
122  if (!allowMissingInputs_) {
123  edm::LogError("HitCalib") << " No HO collection ";
124  throw e;
125  }
126  }
127 
128  try {
129  const edm::Handle<HFRecHitCollection>& hf = iEvent.getHandle(tok_hf_);
130  const HFRecHitCollection Hithf = *(hf.product());
131  for (HFRecHitCollection::const_iterator hfItr = Hithf.begin(); hfItr != Hithf.end(); hfItr++) {
132  DetId id = hfItr->detid();
133  float recal;
134  if (jetRecalib->exists(id))
135  recal = jetRecalib->getValues(id)->getValue();
136  else
137  recal = 1.;
138  float energy = hfItr->energy();
139  float time = hfItr->time();
140  HFRecHit* hfhit = new HFRecHit(id, recal * energy, time);
141  miniDiJetsHFRecHitCollection->push_back(*hfhit);
142  }
143  } catch (cms::Exception& e) { // can't find it!
144  if (!allowMissingInputs_)
145  throw e;
146  }
147 
148  //Put selected information in the event
149 
150  iEvent.put(std::move(miniDiJetsHBHERecHitCollection), "DiJetsHBHEReRecHitCollection");
151 
152  iEvent.put(std::move(miniDiJetsHORecHitCollection), "DiJetsHOReRecHitCollection");
153 
154  iEvent.put(std::move(miniDiJetsHFRecHitCollection), "DiJetsHFReRecHitCollection");
155  }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::EDGetTokenT< HORecHitCollection > tok_ho_
std::vector< T >::const_iterator const_iterator
Log< level::Error, false > LogError
const edm::EDGetTokenT< HFRecHitCollection > tok_hf_
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
const_iterator begin() const
const_iterator end() const
Definition: DetId.h:17
const edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_resp_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ allowMissingInputs_

bool cms::HitReCalibrator::allowMissingInputs_
private

Definition at line 47 of file HitReCalibrator.cc.

Referenced by HitReCalibrator(), and produce().

◆ tok_hbhe_

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

Definition at line 49 of file HitReCalibrator.cc.

Referenced by produce().

◆ tok_hf_

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

Definition at line 51 of file HitReCalibrator.cc.

Referenced by produce().

◆ tok_ho_

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

Definition at line 50 of file HitReCalibrator.cc.

Referenced by produce().

◆ tok_resp_

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

Definition at line 53 of file HitReCalibrator.cc.

Referenced by produce().