CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
 ~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_
 
edm::EDGetTokenT
< HBHERecHitCollection
tok_hbhe_
 
edm::EDGetTokenT
< HFRecHitCollection
tok_hf_
 
edm::EDGetTokenT
< HORecHitCollection
tok_ho_
 
edm::ESGetToken< HcalRespCorrs,
HcalRespCorrsRcd
tok_resp_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase 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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
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< B > consumes (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 () noexcept
 
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...
 
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

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

Definition at line 59 of file HitReCalibrator.cc.

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

59  {
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  allowMissingInputs_ = true;
64  tok_resp_ = esConsumes<HcalRespCorrs, HcalRespCorrsRcd>();
65 
66  //register your products
67 
68  produces<HBHERecHitCollection>("DiJetsHBHEReRecHitCollection");
69  produces<HORecHitCollection>("DiJetsHOReRecHitCollection");
70  produces<HFRecHitCollection>("DiJetsHFReRecHitCollection");
71  }
edm::EDGetTokenT< HORecHitCollection > tok_ho_
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_resp_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
cms::HitReCalibrator::~HitReCalibrator ( )
override

Definition at line 74 of file HitReCalibrator.cc.

74 {}

Member Function Documentation

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

Reimplemented from edm::one::EDProducerBase.

Definition at line 72 of file HitReCalibrator.cc.

72 {}
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(), alignCSCRings::e, edm::SortedCollection< T, SORT >::end(), relval_parameters_module::energy, edm::Event::getByToken(), edm::EventSetup::getData(), hcalSimParameters_cfi::ho, eostools::move(), edm::Handle< T >::product(), edm::Event::put(), 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  iEvent.getByToken(tok_hbhe_, hbhe);
87  const HBHERecHitCollection Hithbhe = *(hbhe.product());
88  for (HBHERecHitCollection::const_iterator hbheItr = Hithbhe.begin(); hbheItr != Hithbhe.end(); hbheItr++) {
89  DetId id = hbheItr->detid();
90  float recal;
91  if (jetRecalib->exists(id))
92  recal = jetRecalib->getValues(id)->getValue();
93  else
94  recal = 1.;
95  float energy = hbheItr->energy();
96  float time = hbheItr->time();
97  HBHERecHit* hbhehit = new HBHERecHit(id, recal * energy, time);
98  miniDiJetsHBHERecHitCollection->push_back(*hbhehit);
99  }
100  } catch (cms::Exception& e) { // can't find it!
101  if (!allowMissingInputs_) {
102  edm::LogError("HitCalib") << "No HBHE collection ";
103  throw e;
104  }
105  }
106 
107  try {
109  iEvent.getByToken(tok_ho_, ho);
110  const HORecHitCollection Hitho = *(ho.product());
111  for (HORecHitCollection::const_iterator hoItr = Hitho.begin(); hoItr != Hitho.end(); hoItr++) {
112  DetId id = hoItr->detid();
113  float recal;
114  if (jetRecalib->exists(id))
115  recal = jetRecalib->getValues(id)->getValue();
116  else
117  recal = 1.;
118  float energy = hoItr->energy();
119  float time = hoItr->time();
120  HORecHit* hohit = new HORecHit(id, recal * energy, time);
121  miniDiJetsHORecHitCollection->push_back(*hohit);
122  }
123  } catch (cms::Exception& e) { // can't find it!
124  if (!allowMissingInputs_) {
125  edm::LogError("HitCalib") << " No HO collection ";
126  throw e;
127  }
128  }
129 
130  try {
132  iEvent.getByToken(tok_hf_, hf);
133  const HFRecHitCollection Hithf = *(hf.product());
134  for (HFRecHitCollection::const_iterator hfItr = Hithf.begin(); hfItr != Hithf.end(); hfItr++) {
135  DetId id = hfItr->detid();
136  float recal;
137  if (jetRecalib->exists(id))
138  recal = jetRecalib->getValues(id)->getValue();
139  else
140  recal = 1.;
141  float energy = hfItr->energy();
142  float time = hfItr->time();
143  HFRecHit* hfhit = new HFRecHit(id, recal * energy, time);
144  miniDiJetsHFRecHitCollection->push_back(*hfhit);
145  }
146  } catch (cms::Exception& e) { // can't find it!
147  if (!allowMissingInputs_)
148  throw e;
149  }
150 
151  //Put selected information in the event
152 
153  iEvent.put(std::move(miniDiJetsHBHERecHitCollection), "DiJetsHBHEReRecHitCollection");
154 
155  iEvent.put(std::move(miniDiJetsHORecHitCollection), "DiJetsHOReRecHitCollection");
156 
157  iEvent.put(std::move(miniDiJetsHFRecHitCollection), "DiJetsHFReRecHitCollection");
158  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::vector< T >::const_iterator const_iterator
Log< level::Error, false > LogError
bool getData(T &iHolder) const
Definition: EventSetup.h:128
edm::EDGetTokenT< HORecHitCollection > tok_ho_
def move
Definition: eostools.py:511
const_iterator end() const
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
Definition: DetId.h:17
T const * product() const
Definition: Handle.h:70
edm::ESGetToken< HcalRespCorrs, HcalRespCorrsRcd > tok_resp_
const_iterator begin() const
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_

Member Data Documentation

bool cms::HitReCalibrator::allowMissingInputs_
private

Definition at line 47 of file HitReCalibrator.cc.

Referenced by HitReCalibrator(), and produce().

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

Definition at line 49 of file HitReCalibrator.cc.

Referenced by HitReCalibrator(), and produce().

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

Definition at line 51 of file HitReCalibrator.cc.

Referenced by HitReCalibrator(), and produce().

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

Definition at line 50 of file HitReCalibrator.cc.

Referenced by HitReCalibrator(), and produce().

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

Definition at line 53 of file HitReCalibrator.cc.

Referenced by HitReCalibrator(), and produce().