CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
EcalRecalibRecHitProducer Class Reference
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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 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

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_
 
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcdecalADCToGeVConstantToken_
 
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcdecalIntercalibConstantsToken_
 
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecordecalLaserDBServiceToken_
 
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
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::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<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

produce ECAL rechits from uncalibrated rechits

Author
Federico Ferri, University of Milano Bicocca and INFN

Definition at line 34 of file EcalRecalibRecHitProducer.cc.

Constructor & Destructor Documentation

◆ EcalRecalibRecHitProducer()

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

Definition at line 60 of file EcalRecalibRecHitProducer.cc.

References doEnergyScale_, doIntercalib_, EBRecalibRecHitCollection_, ecalADCToGeVConstantToken_, ecalIntercalibConstantsToken_, and EERecalibRecHitCollection_.

61  : EBRecHitCollection_(ps.getParameter<edm::InputTag>("EBRecHitCollection")),
62  EERecHitCollection_(ps.getParameter<edm::InputTag>("EERecHitCollection")),
63  EBRecHitToken_((not EBRecHitCollection_.label().empty()) ? consumes<EBRecHitCollection>(EBRecHitCollection_)
67  EBRecalibRecHitCollection_(ps.getParameter<std::string>("EBRecalibRecHitCollection")),
68  EERecalibRecHitCollection_(ps.getParameter<std::string>("EERecalibRecHitCollection")),
69  doEnergyScale_(ps.getParameter<bool>("doEnergyScale")),
70  doIntercalib_(ps.getParameter<bool>("doIntercalib")),
71  doLaserCorrections_(ps.getParameter<bool>("doLaserCorrections")),
72 
73  doEnergyScaleInverse_(ps.getParameter<bool>("doEnergyScaleInverse")),
74  doIntercalibInverse_(ps.getParameter<bool>("doIntercalibInverse")),
75  doLaserCorrectionsInverse_(ps.getParameter<bool>("doLaserCorrectionsInverse")),
77  if (doEnergyScale_) {
78  ecalADCToGeVConstantToken_ = esConsumes<EcalADCToGeVConstant, EcalADCToGeVConstantRcd>();
79  }
80  if (doIntercalib_) {
81  ecalIntercalibConstantsToken_ = esConsumes<EcalIntercalibConstants, EcalIntercalibConstantsRcd>();
82  }
83  produces<EBRecHitCollection>(EBRecalibRecHitCollection_);
84  produces<EERecHitCollection>(EERecalibRecHitCollection_);
85 }
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > ecalADCToGeVConstantToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > ecalIntercalibConstantsToken_
std::string const & label() const
Definition: InputTag.h:36
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > ecalLaserDBServiceToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
char const * label
const edm::EDGetTokenT< EERecHitCollection > EERecHitToken_
const std::string EERecalibRecHitCollection_
const edm::EDGetTokenT< EBRecHitCollection > EBRecHitToken_
HLT enums.
const std::string EBRecalibRecHitCollection_

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 87 of file EcalRecalibRecHitProducer.cc.

References doEnergyScale_, doEnergyScaleInverse_, doIntercalib_, doIntercalibInverse_, doLaserCorrections_, doLaserCorrectionsInverse_, EBRecalibRecHitCollection_, EBRecHitCollection_, filterRecHits_cfi::EBRecHits, EBRecHitToken_, ecalADCToGeVConstantToken_, ecalIntercalibConstantsToken_, ecalLaserDBServiceToken_, EERecalibRecHitCollection_, EERecHitCollection_, filterRecHits_cfi::EERecHits, EERecHitToken_, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), dqmMemoryStats::float, edm::Event::getByToken(), EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), edm::EventSetup::getHandle(), 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().

87  {
88  using namespace edm;
89  Handle<EBRecHitCollection> pEBRecHits;
90  Handle<EERecHitCollection> pEERecHits;
91 
92  const EBRecHitCollection* EBRecHits = nullptr;
93  const EERecHitCollection* EERecHits = nullptr;
94 
95  if (not EBRecHitCollection_.label().empty()) {
96  evt.getByToken(EBRecHitToken_, pEBRecHits);
97  EBRecHits = pEBRecHits.product(); // get a ptr to the product
98  }
99  if (not EERecHitCollection_.label().empty()) {
100  evt.getByToken(EERecHitToken_, pEERecHits);
101  EERecHits = pEERecHits.product(); // get a ptr to the product
102  }
103 
104  // collection of rechits to put in the event
105  auto EBRecalibRecHits = std::make_unique<EBRecHitCollection>();
106  auto EERecalibRecHits = std::make_unique<EERecHitCollection>();
107 
108  // now fetch all conditions we need to make rechits
109  // ADC to GeV constant
111  const EcalADCToGeVConstant* agc = nullptr;
112  float agc_eb = 1.;
113  float agc_ee = 1.;
114  if (doEnergyScale_) {
116  agc = pAgc.product();
117  // use this value in the algorithm
118  agc_eb = float(agc->getEBValue());
119  agc_ee = float(agc->getEEValue());
120  }
121  // Intercalib constants
123  const EcalIntercalibConstants* ical = nullptr;
124  if (doIntercalib_) {
126  ical = pIcal.product();
127  }
128  // Laser corrections
130 
131  if (doEnergyScaleInverse_) {
132  agc_eb = 1.0 / agc_eb;
133  agc_ee = 1.0 / agc_ee;
134  }
135 
136  if (EBRecHits) {
137  // loop over uncalibrated rechits to make calibrated ones
138  for (EBRecHitCollection::const_iterator it = EBRecHits->begin(); it != EBRecHits->end(); ++it) {
139  EcalIntercalibConstant icalconst = 1.;
140  if (doIntercalib_) {
141  // find intercalib constant for this xtal
142  const EcalIntercalibConstantMap& icalMap = ical->getMap();
143  EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(it->id());
144  if (icalit != icalMap.end()) {
145  icalconst = (*icalit);
146  } else {
147  edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << EBDetId(it->id())
148  << "! something wrong with EcalIntercalibConstants in your DB? ";
149  }
150  }
151  // get laser coefficient
152  float lasercalib = 1;
153  if (doLaserCorrections_) {
154  lasercalib = pLaser->getLaserCorrection(EBDetId(it->id()), evt.time());
155  }
156 
157  // make the rechit and put in the output collection
158  // must implement op= for EcalRecHit
159 
160  if (doIntercalibInverse_) {
161  icalconst = 1.0 / icalconst;
162  }
164  lasercalib = 1.0 / lasercalib;
165  }
166 
167  EcalRecHit aHit((*it).id(), (*it).energy() * agc_eb * icalconst * lasercalib, (*it).time());
168  EBRecalibRecHits->push_back(aHit);
169  }
170  }
171 
172  if (EERecHits) {
173  // loop over uncalibrated rechits to make calibrated ones
174  for (EERecHitCollection::const_iterator it = EERecHits->begin(); it != EERecHits->end(); ++it) {
175  // find intercalib constant for this xtal
176  EcalIntercalibConstant icalconst = 1.;
177  if (doIntercalib_) {
178  const EcalIntercalibConstantMap& icalMap = ical->getMap();
179  EcalIntercalibConstantMap::const_iterator icalit = icalMap.find(it->id());
180  if (icalit != icalMap.end()) {
181  icalconst = (*icalit);
182  } else {
183  edm::LogError("EcalRecHitError") << "No intercalib const found for xtal " << EEDetId(it->id())
184  << "! something wrong with EcalIntercalibConstants in your DB? ";
185  }
186  }
187  // get laser coefficient
188  float lasercalib = 1;
189  if (doLaserCorrections_) {
190  lasercalib = pLaser->getLaserCorrection(EEDetId(it->id()), evt.time());
191  }
192 
193  if (doIntercalibInverse_) {
194  icalconst = 1.0 / icalconst;
195  }
197  lasercalib = 1.0 / lasercalib;
198  }
199 
200  // make the rechit and put in the output collection
201  EcalRecHit aHit((*it).id(), (*it).energy() * agc_ee * icalconst * lasercalib, (*it).time());
202  EERecalibRecHits->push_back(aHit);
203  }
204  }
205  // put the collection of recunstructed hits in the event
206  LogInfo("EcalRecalibRecHitInfo") << "total # EB re-calibrated rechits: " << EBRecalibRecHits->size();
207  LogInfo("EcalRecalibRecHitInfo") << "total # EE re-calibrated rechits: " << EERecalibRecHits->size();
208 
209  evt.put(std::move(EBRecalibRecHits), EBRecalibRecHitCollection_);
210  evt.put(std::move(EERecalibRecHits), EERecalibRecHitCollection_);
211 }
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > ecalADCToGeVConstantToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
T const * product() const
Definition: Handle.h:70
std::vector< EcalRecHit >::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > ecalIntercalibConstantsToken_
std::string const & label() const
Definition: InputTag.h:36
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > ecalLaserDBServiceToken_
Log< level::Error, false > LogError
T const * product() const
Definition: ESHandle.h:86
edm::Timestamp time() const
Definition: EventBase.h:64
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const_iterator find(uint32_t rawId) const
Log< level::Info, false > LogInfo
std::vector< Item >::const_iterator const_iterator
const edm::EDGetTokenT< EERecHitCollection > EERecHitToken_
const std::string EERecalibRecHitCollection_
const edm::EDGetTokenT< EBRecHitCollection > EBRecHitToken_
HLT enums.
const_iterator end() const
const std::string EBRecalibRecHitCollection_
def move(src, dest)
Definition: eostools.py:511
float EcalIntercalibConstant

Member Data Documentation

◆ doEnergyScale_

const bool EcalRecalibRecHitProducer::doEnergyScale_
private

Definition at line 48 of file EcalRecalibRecHitProducer.cc.

Referenced by EcalRecalibRecHitProducer(), and produce().

◆ doEnergyScaleInverse_

const bool EcalRecalibRecHitProducer::doEnergyScaleInverse_
private

Definition at line 51 of file EcalRecalibRecHitProducer.cc.

Referenced by produce().

◆ doIntercalib_

const bool EcalRecalibRecHitProducer::doIntercalib_
private

Definition at line 49 of file EcalRecalibRecHitProducer.cc.

Referenced by EcalRecalibRecHitProducer(), and produce().

◆ doIntercalibInverse_

const bool EcalRecalibRecHitProducer::doIntercalibInverse_
private

Definition at line 52 of file EcalRecalibRecHitProducer.cc.

Referenced by produce().

◆ doLaserCorrections_

const bool EcalRecalibRecHitProducer::doLaserCorrections_
private

Definition at line 50 of file EcalRecalibRecHitProducer.cc.

Referenced by produce().

◆ doLaserCorrectionsInverse_

const bool EcalRecalibRecHitProducer::doLaserCorrectionsInverse_
private

Definition at line 53 of file EcalRecalibRecHitProducer.cc.

Referenced by produce().

◆ EBRecalibRecHitCollection_

const std::string EcalRecalibRecHitProducer::EBRecalibRecHitCollection_
private

Definition at line 45 of file EcalRecalibRecHitProducer.cc.

Referenced by EcalRecalibRecHitProducer(), and produce().

◆ EBRecHitCollection_

const edm::InputTag EcalRecalibRecHitProducer::EBRecHitCollection_
private

Definition at line 40 of file EcalRecalibRecHitProducer.cc.

Referenced by produce().

◆ EBRecHitToken_

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

Definition at line 42 of file EcalRecalibRecHitProducer.cc.

Referenced by produce().

◆ ecalADCToGeVConstantToken_

edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> EcalRecalibRecHitProducer::ecalADCToGeVConstantToken_
private

Definition at line 55 of file EcalRecalibRecHitProducer.cc.

Referenced by EcalRecalibRecHitProducer(), and produce().

◆ ecalIntercalibConstantsToken_

edm::ESGetToken<EcalIntercalibConstants, EcalIntercalibConstantsRcd> EcalRecalibRecHitProducer::ecalIntercalibConstantsToken_
private

Definition at line 56 of file EcalRecalibRecHitProducer.cc.

Referenced by EcalRecalibRecHitProducer(), and produce().

◆ ecalLaserDBServiceToken_

edm::ESGetToken<EcalLaserDbService, EcalLaserDbRecord> EcalRecalibRecHitProducer::ecalLaserDBServiceToken_
private

Definition at line 57 of file EcalRecalibRecHitProducer.cc.

Referenced by produce().

◆ EERecalibRecHitCollection_

const std::string EcalRecalibRecHitProducer::EERecalibRecHitCollection_
private

Definition at line 46 of file EcalRecalibRecHitProducer.cc.

Referenced by EcalRecalibRecHitProducer(), and produce().

◆ EERecHitCollection_

const edm::InputTag EcalRecalibRecHitProducer::EERecHitCollection_
private

Definition at line 41 of file EcalRecalibRecHitProducer.cc.

Referenced by produce().

◆ EERecHitToken_

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

Definition at line 43 of file EcalRecalibRecHitProducer.cc.

Referenced by produce().