CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalRecalibRecHitProducer Class Reference

#include <EcalRecalibRecHitProducer.h>

Inheritance diagram for EcalRecalibRecHitProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalRecalibRecHitProducer (const edm::ParameterSet &ps)
 
void produce (edm::StreamID sid, edm::Event &evt, const edm::EventSetup &es) const override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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

const bool doEnergyScale_
 
const bool doEnergyScaleInverse_
 
const bool doIntercalib_
 
const bool doIntercalibInverse_
 
const bool doLaserCorrections_
 
const bool doLaserCorrectionsInverse_
 
const std::string EBRecalibRecHitCollection_
 
const edm::InputTag EBRecHitCollection_
 
const edm::EDGetTokenT< EBRecHitCollectionEBRecHitToken_
 
const std::string EERecalibRecHitCollection_
 
const edm::InputTag EERecHitCollection_
 
const edm::EDGetTokenT< EERecHitCollectionEERecHitToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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>
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)
 
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

produce ECAL rechits from uncalibrated rechits

Author
Federico Ferri, University of Milano Bicocca and INFN

Definition at line 18 of file EcalRecalibRecHitProducer.h.

Constructor & Destructor Documentation

◆ EcalRecalibRecHitProducer()

EcalRecalibRecHitProducer::EcalRecalibRecHitProducer ( const edm::ParameterSet ps)
explicit

Definition at line 31 of file EcalRecalibRecHitProducer.cc.

32  : EBRecHitCollection_(ps.getParameter<edm::InputTag>("EBRecHitCollection")),
33  EERecHitCollection_(ps.getParameter<edm::InputTag>("EERecHitCollection")),
34  EBRecHitToken_((not EBRecHitCollection_.label().empty()) ? consumes<EBRecHitCollection>(EBRecHitCollection_)
38  EBRecalibRecHitCollection_(ps.getParameter<std::string>("EBRecalibRecHitCollection")),
39  EERecalibRecHitCollection_(ps.getParameter<std::string>("EERecalibRecHitCollection")),
40  doEnergyScale_(ps.getParameter<bool>("doEnergyScale")),
41  doIntercalib_(ps.getParameter<bool>("doIntercalib")),
42  doLaserCorrections_(ps.getParameter<bool>("doLaserCorrections")),
43 
44  doEnergyScaleInverse_(ps.getParameter<bool>("doEnergyScaleInverse")),
45  doIntercalibInverse_(ps.getParameter<bool>("doIntercalibInverse")),
46  doLaserCorrectionsInverse_(ps.getParameter<bool>("doLaserCorrectionsInverse")) {
47  produces<EBRecHitCollection>(EBRecalibRecHitCollection_);
48  produces<EERecHitCollection>(EERecalibRecHitCollection_);
49 }

References EBRecalibRecHitCollection_, and EERecalibRecHitCollection_.

Member Function Documentation

◆ produce()

void EcalRecalibRecHitProducer::produce ( edm::StreamID  sid,
edm::Event evt,
const edm::EventSetup es 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 51 of file EcalRecalibRecHitProducer.cc.

51  {
52  using namespace edm;
53  Handle<EBRecHitCollection> pEBRecHits;
54  Handle<EERecHitCollection> pEERecHits;
55 
56  const EBRecHitCollection* EBRecHits = nullptr;
57  const EERecHitCollection* EERecHits = nullptr;
58 
59  if (not EBRecHitCollection_.label().empty()) {
60  evt.getByToken(EBRecHitToken_, pEBRecHits);
61  EBRecHits = pEBRecHits.product(); // get a ptr to the product
62  }
63  if (not EERecHitCollection_.label().empty()) {
64  evt.getByToken(EERecHitToken_, pEERecHits);
65  EERecHits = pEERecHits.product(); // get a ptr to the product
66  }
67 
68  // collection of rechits to put in the event
69  auto EBRecalibRecHits = std::make_unique<EBRecHitCollection>();
70  auto EERecalibRecHits = std::make_unique<EERecHitCollection>();
71 
72  // now fetch all conditions we need to make rechits
73  // ADC to GeV constant
75  const EcalADCToGeVConstant* agc = nullptr;
76  float agc_eb = 1.;
77  float agc_ee = 1.;
78  if (doEnergyScale_) {
79  es.get<EcalADCToGeVConstantRcd>().get(pAgc);
80  agc = pAgc.product();
81  // use this value in the algorithm
82  agc_eb = float(agc->getEBValue());
83  agc_ee = float(agc->getEEValue());
84  }
85  // Intercalib constants
87  const EcalIntercalibConstants* ical = nullptr;
88  if (doIntercalib_) {
89  es.get<EcalIntercalibConstantsRcd>().get(pIcal);
90  ical = pIcal.product();
91  }
92  // Laser corrections
94  es.get<EcalLaserDbRecord>().get(pLaser);
95 
97  agc_eb = 1.0 / agc_eb;
98  agc_ee = 1.0 / agc_ee;
99  }
100 
101  if (EBRecHits) {
102  // loop over uncalibrated rechits to make calibrated ones
103  for (EBRecHitCollection::const_iterator it = EBRecHits->begin(); it != EBRecHits->end(); ++it) {
104  EcalIntercalibConstant icalconst = 1.;
105  if (doIntercalib_) {
106  // find intercalib constant for this xtal
107  const EcalIntercalibConstantMap& icalMap = ical->getMap();
108  EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(it->id());
109  if (icalit != icalMap.end()) {
110  icalconst = (*icalit);
111  } else {
112  edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << EBDetId(it->id())
113  << "! something wrong with EcalIntercalibConstants in your DB? ";
114  }
115  }
116  // get laser coefficient
117  float lasercalib = 1;
118  if (doLaserCorrections_) {
119  lasercalib = pLaser->getLaserCorrection(EBDetId(it->id()), evt.time());
120  }
121 
122  // make the rechit and put in the output collection
123  // must implement op= for EcalRecHit
124 
125  if (doIntercalibInverse_) {
126  icalconst = 1.0 / icalconst;
127  }
129  lasercalib = 1.0 / lasercalib;
130  }
131 
132  EcalRecHit aHit((*it).id(), (*it).energy() * agc_eb * icalconst * lasercalib, (*it).time());
133  EBRecalibRecHits->push_back(aHit);
134  }
135  }
136 
137  if (EERecHits) {
138  // loop over uncalibrated rechits to make calibrated ones
139  for (EERecHitCollection::const_iterator it = EERecHits->begin(); it != EERecHits->end(); ++it) {
140  // find intercalib constant for this xtal
141  EcalIntercalibConstant icalconst = 1.;
142  if (doIntercalib_) {
143  const EcalIntercalibConstantMap& icalMap = ical->getMap();
144  EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(it->id());
145  if (icalit != icalMap.end()) {
146  icalconst = (*icalit);
147  } else {
148  edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << EEDetId(it->id())
149  << "! something wrong with EcalIntercalibConstants in your DB? ";
150  }
151  }
152  // get laser coefficient
153  float lasercalib = 1;
154  if (doLaserCorrections_) {
155  lasercalib = pLaser->getLaserCorrection(EEDetId(it->id()), evt.time());
156  }
157 
158  if (doIntercalibInverse_) {
159  icalconst = 1.0 / icalconst;
160  }
162  lasercalib = 1.0 / lasercalib;
163  }
164 
165  // make the rechit and put in the output collection
166  EcalRecHit aHit((*it).id(), (*it).energy() * agc_ee * icalconst * lasercalib, (*it).time());
167  EERecalibRecHits->push_back(aHit);
168  }
169  }
170  // put the collection of recunstructed hits in the event
171  LogInfo("EcalRecalibRecHitInfo") << "total # EB re-calibrated rechits: " << EBRecalibRecHits->size();
172  LogInfo("EcalRecalibRecHitInfo") << "total # EE re-calibrated rechits: " << EERecalibRecHits->size();
173 
174  evt.put(std::move(EBRecalibRecHits), EBRecalibRecHitCollection_);
175  evt.put(std::move(EERecalibRecHits), EERecalibRecHitCollection_);
176 }

References doEnergyScale_, doEnergyScaleInverse_, doIntercalib_, doIntercalibInverse_, doLaserCorrections_, doLaserCorrectionsInverse_, EBRecalibRecHitCollection_, EBRecHitCollection_, filterRecHits_cfi::EBRecHits, EBRecHitToken_, EERecalibRecHitCollection_, EERecHitCollection_, filterRecHits_cfi::EERecHits, EERecHitToken_, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), dqmMemoryStats::float, edm::EventSetup::get(), get, edm::Event::getByToken(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), EcalLaserDbService::getLaserCorrection(), EcalCondObjectContainer< T >::getMap(), edm::InputTag::label(), eostools::move(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), edm::Event::put(), and edm::EventBase::time().

Member Data Documentation

◆ doEnergyScale_

const bool EcalRecalibRecHitProducer::doEnergyScale_
private

Definition at line 32 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

◆ doEnergyScaleInverse_

const bool EcalRecalibRecHitProducer::doEnergyScaleInverse_
private

Definition at line 35 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

◆ doIntercalib_

const bool EcalRecalibRecHitProducer::doIntercalib_
private

Definition at line 33 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

◆ doIntercalibInverse_

const bool EcalRecalibRecHitProducer::doIntercalibInverse_
private

Definition at line 36 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

◆ doLaserCorrections_

const bool EcalRecalibRecHitProducer::doLaserCorrections_
private

Definition at line 34 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

◆ doLaserCorrectionsInverse_

const bool EcalRecalibRecHitProducer::doLaserCorrectionsInverse_
private

Definition at line 37 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

◆ EBRecalibRecHitCollection_

const std::string EcalRecalibRecHitProducer::EBRecalibRecHitCollection_
private

Definition at line 29 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and produce().

◆ EBRecHitCollection_

const edm::InputTag EcalRecalibRecHitProducer::EBRecHitCollection_
private

Definition at line 24 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

◆ EBRecHitToken_

const edm::EDGetTokenT<EBRecHitCollection> EcalRecalibRecHitProducer::EBRecHitToken_
private

Definition at line 26 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

◆ EERecalibRecHitCollection_

const std::string EcalRecalibRecHitProducer::EERecalibRecHitCollection_
private

Definition at line 30 of file EcalRecalibRecHitProducer.h.

Referenced by EcalRecalibRecHitProducer(), and produce().

◆ EERecHitCollection_

const edm::InputTag EcalRecalibRecHitProducer::EERecHitCollection_
private

Definition at line 25 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

◆ EERecHitToken_

const edm::EDGetTokenT<EERecHitCollection> EcalRecalibRecHitProducer::EERecHitToken_
private

Definition at line 27 of file EcalRecalibRecHitProducer.h.

Referenced by produce().

EcalCondObjectContainer::getMap
const self & getMap() const
Definition: EcalCondObjectContainer.h:80
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:76
EcalRecHit
Definition: EcalRecHit.h:15
electrons_cff.bool
bool
Definition: electrons_cff.py:372
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
EcalRecalibRecHitProducer::doIntercalib_
const bool doIntercalib_
Definition: EcalRecalibRecHitProducer.h:33
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT
Definition: EDGetToken.h:33
EBDetId
Definition: EBDetId.h:17
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::LogInfo
Definition: MessageLogger.h:254
EcalRecalibRecHitProducer::doIntercalibInverse_
const bool doIntercalibInverse_
Definition: EcalRecalibRecHitProducer.h:36
edm::SortedCollection< EcalRecHit >
EcalADCToGeVConstant
Definition: EcalADCToGeVConstant.h:13
edm::EventBase::time
edm::Timestamp time() const
Definition: EventBase.h:60
EcalCondObjectContainer< float >
edm::Handle
Definition: AssociativeIterator.h:50
filterRecHits_cfi.EERecHits
EERecHits
Definition: filterRecHits_cfi.py:9
EcalIntercalibConstant
float EcalIntercalibConstant
Definition: EcalIntercalibConstants.h:10
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
EcalRecalibRecHitProducer::EBRecHitCollection_
const edm::InputTag EBRecHitCollection_
Definition: EcalRecalibRecHitProducer.h:24
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
EcalRecalibRecHitProducer::EBRecalibRecHitCollection_
const std::string EBRecalibRecHitCollection_
Definition: EcalRecalibRecHitProducer.h:29
EcalRecalibRecHitProducer::doLaserCorrectionsInverse_
const bool doLaserCorrectionsInverse_
Definition: EcalRecalibRecHitProducer.h:37
edm::ESHandle< EcalADCToGeVConstant >
EcalRecalibRecHitProducer::EERecalibRecHitCollection_
const std::string EERecalibRecHitCollection_
Definition: EcalRecalibRecHitProducer.h:30
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
EcalLaserDbRecord
Definition: EcalLaserDbRecord.h:19
EEDetId
Definition: EEDetId.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalRecalibRecHitProducer::doLaserCorrections_
const bool doLaserCorrections_
Definition: EcalRecalibRecHitProducer.h:34
EcalRecalibRecHitProducer::EBRecHitToken_
const edm::EDGetTokenT< EBRecHitCollection > EBRecHitToken_
Definition: EcalRecalibRecHitProducer.h:26
EcalADCToGeVConstant::getEEValue
float getEEValue() const
Definition: EcalADCToGeVConstant.h:21
edm::LogError
Definition: MessageLogger.h:183
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EcalLaserDbService::getLaserCorrection
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
Definition: EcalLaserDbService.cc:26
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
EcalRecalibRecHitProducer::EERecHitCollection_
const edm::InputTag EERecHitCollection_
Definition: EcalRecalibRecHitProducer.h:25
EcalRecalibRecHitProducer::doEnergyScaleInverse_
const bool doEnergyScaleInverse_
Definition: EcalRecalibRecHitProducer.h:35
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
EcalCondObjectContainer< float >::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
EcalRecalibRecHitProducer::EERecHitToken_
const edm::EDGetTokenT< EERecHitCollection > EERecHitToken_
Definition: EcalRecalibRecHitProducer.h:27
EcalRecalibRecHitProducer::doEnergyScale_
const bool doEnergyScale_
Definition: EcalRecalibRecHitProducer.h:32
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
EcalADCToGeVConstant::getEBValue
float getEBValue() const
Definition: EcalADCToGeVConstant.h:20
EcalIntercalibConstantsRcd
Definition: EcalIntercalibConstantsRcd.h:5
EcalADCToGeVConstantRcd
Definition: EcalADCToGeVConstantRcd.h:5
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
filterRecHits_cfi.EBRecHits
EBRecHits
Definition: filterRecHits_cfi.py:8