CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CastorDbProducer Class Reference
Inheritance diagram for CastorDbProducer:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Member Functions

 CastorDbProducer (const edm::ParameterSet &)
 
std::shared_ptr< CastorDbServiceproduce (const CastorDbRecord &)
 
 ~CastorDbProducer () override
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESProxyIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 

Private Types

using HostType = edm::ESProductHost< CastorDbService, CastorPedestalsRcd, CastorPedestalWidthsRcd, CastorGainsRcd, CastorGainWidthsRcd, CastorQIEDataRcd, CastorChannelQualityRcd, CastorElectronicsMapRcd >
 

Private Member Functions

template<typename RecordT , typename TokenT >
void setupItem (const RecordT &fRecord, const TokenT &token, const char *name, CastorDbService *service)
 

Private Attributes

edm::ESGetToken< CastorChannelQuality, CastorChannelQualityRcdchannelQualityToken_
 
edm::ESGetToken< CastorElectronicsMap, CastorElectronicsMapRcdelectronicsMapToken_
 
edm::ESGetToken< CastorGains, CastorGainsRcdgainsToken_
 
edm::ESGetToken< CastorGainWidths, CastorGainWidthsRcdgainWidthsToken_
 
edm::ReusableObjectHolder< HostTypeholder_
 
std::vector< std::string > mDumpRequest
 
std::ostream * mDumpStream
 
edm::ESGetToken< CastorPedestals, CastorPedestalsRcdpedestalsToken_
 
edm::ESGetToken< CastorPedestalWidths, CastorPedestalWidthsRcdpedestalWidthsToken_
 
edm::ESGetToken< CastorQIEData, CastorQIEDataRcdqieDataToken_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Types inherited from edm::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy > >>
 
- Protected Member Functions inherited from edm::ESProducer
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 43 of file CastorDbProducer.cc.

Member Typedef Documentation

◆ HostType

Definition at line 59 of file CastorDbProducer.cc.

Constructor & Destructor Documentation

◆ CastorDbProducer()

CastorDbProducer::CastorDbProducer ( const edm::ParameterSet fConfig)

Definition at line 78 of file CastorDbProducer.cc.

References channelQualityToken_, gather_cfg::cout, electronicsMapToken_, gainsToken_, gainWidthsToken_, edm::ParameterSet::getUntrackedParameter(), mDumpRequest, mDumpStream, pedestalsToken_, pedestalWidthsToken_, qieDataToken_, edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.

79  : ESProducer(), mDumpRequest(), mDumpStream(nullptr) {
80  //the following line is needed to tell the framework what
81  // data is being produced
82  auto cc = setWhatProduced(this);
83  pedestalsToken_ = cc.consumes();
84  pedestalWidthsToken_ = cc.consumes();
85  gainsToken_ = cc.consumes();
86  gainWidthsToken_ = cc.consumes();
87  qieDataToken_ = cc.consumes();
88  channelQualityToken_ = cc.consumes();
89  electronicsMapToken_ = cc.consumes();
90 
91  //now do what ever other initialization is needed
92 
93  mDumpRequest = fConfig.getUntrackedParameter<std::vector<std::string> >("dump", std::vector<std::string>());
94  if (!mDumpRequest.empty()) {
95  std::string otputFile = fConfig.getUntrackedParameter<std::string>("file", "");
96  mDumpStream = otputFile.empty() ? &std::cout : new std::ofstream(otputFile.c_str());
97  }
98 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
std::vector< std::string > mDumpRequest
edm::ESGetToken< CastorPedestals, CastorPedestalsRcd > pedestalsToken_
edm::ESGetToken< CastorQIEData, CastorQIEDataRcd > qieDataToken_
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< CastorChannelQuality, CastorChannelQualityRcd > channelQualityToken_
edm::ESGetToken< CastorPedestalWidths, CastorPedestalWidthsRcd > pedestalWidthsToken_
edm::ESGetToken< CastorGainWidths, CastorGainWidthsRcd > gainWidthsToken_
edm::ESGetToken< CastorElectronicsMap, CastorElectronicsMapRcd > electronicsMapToken_
std::ostream * mDumpStream
edm::ESGetToken< CastorGains, CastorGainsRcd > gainsToken_

◆ ~CastorDbProducer()

CastorDbProducer::~CastorDbProducer ( )
override

Definition at line 100 of file CastorDbProducer.cc.

References gather_cfg::cout, and mDumpStream.

100  {
101  // do anything here that needs to be done at desctruction time
102  // (e.g. close files, deallocate resources etc.)
103  if (mDumpStream != &std::cout)
104  delete mDumpStream;
105 }
std::ostream * mDumpStream

Member Function Documentation

◆ produce()

std::shared_ptr< CastorDbService > CastorDbProducer::produce ( const CastorDbRecord record)

Definition at line 112 of file CastorDbProducer.cc.

References channelQualityToken_, electronicsMapToken_, gainsToken_, gainWidthsToken_, h, holder_, query::host, edm::ReusableObjectHolder< T, Deleter >::makeOrGet(), pedestalsToken_, pedestalWidthsToken_, qieDataToken_, AlCaHarvesting_cff::record, and setupItem().

112  {
113  auto host = holder_.makeOrGet([]() { return new HostType; });
114 
115  bool needBuildCalibrations = false;
116  bool needBuildCalibWidths = false;
117 
118  host->ifRecordChanges<CastorElectronicsMapRcd>(
119  record, [this, h = host.get()](auto const& rec) { setupItem(rec, electronicsMapToken_, "ElectronicsMap", h); });
120  host->ifRecordChanges<CastorChannelQualityRcd>(
121  record, [this, h = host.get()](auto const& rec) { setupItem(rec, channelQualityToken_, "ChannelQuality", h); });
122  host->ifRecordChanges<CastorGainWidthsRcd>(record, [this, h = host.get(), &needBuildCalibWidths](auto const& rec) {
123  setupItem(rec, gainWidthsToken_, "GainWidths", h);
124  needBuildCalibWidths = true;
125  });
126  host->ifRecordChanges<CastorQIEDataRcd>(
127  record, [this, h = host.get(), &needBuildCalibrations, &needBuildCalibWidths](auto const& rec) {
128  setupItem(rec, qieDataToken_, "QIEData", h);
129  needBuildCalibrations = true;
130  needBuildCalibWidths = true;
131  });
132  host->ifRecordChanges<CastorPedestalWidthsRcd>(record,
133  [this, h = host.get(), &needBuildCalibWidths](auto const& rec) {
134  setupItem(rec, pedestalWidthsToken_, "PedestalWidths", h);
135  needBuildCalibWidths = true;
136  });
137  host->ifRecordChanges<CastorGainsRcd>(record, [this, h = host.get(), &needBuildCalibrations](auto const& rec) {
138  setupItem(rec, gainsToken_, "Gains", h);
139  needBuildCalibrations = true;
140  });
141  host->ifRecordChanges<CastorPedestalsRcd>(record, [this, h = host.get(), &needBuildCalibrations](auto const& rec) {
142  setupItem(rec, pedestalsToken_, "Pedestals", h);
143  needBuildCalibrations = true;
144  });
145 
146  if (needBuildCalibWidths) {
147  host->buildCalibWidths();
148  }
149 
150  if (needBuildCalibrations) {
151  host->buildCalibrations();
152  }
153 
154  return host; // automatically converts to std::shared_ptr<CastorDbService>
155 }
void setupItem(const RecordT &fRecord, const TokenT &token, const char *name, CastorDbService *service)
string host
Definition: query.py:115
edm::ESGetToken< CastorPedestals, CastorPedestalsRcd > pedestalsToken_
edm::ESGetToken< CastorQIEData, CastorQIEDataRcd > qieDataToken_
edm::ESProductHost< CastorDbService, CastorPedestalsRcd, CastorPedestalWidthsRcd, CastorGainsRcd, CastorGainWidthsRcd, CastorQIEDataRcd, CastorChannelQualityRcd, CastorElectronicsMapRcd > HostType
edm::ESGetToken< CastorChannelQuality, CastorChannelQualityRcd > channelQualityToken_
edm::ESGetToken< CastorPedestalWidths, CastorPedestalWidthsRcd > pedestalWidthsToken_
edm::ESGetToken< CastorGainWidths, CastorGainWidthsRcd > gainWidthsToken_
std::shared_ptr< T > makeOrGet(FM &&iMakeFunc)
Takes an object from the queue if one is available, or creates one using iMakeFunc.
edm::ESGetToken< CastorElectronicsMap, CastorElectronicsMapRcd > electronicsMapToken_
edm::ReusableObjectHolder< HostType > holder_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
edm::ESGetToken< CastorGains, CastorGainsRcd > gainsToken_

◆ setupItem()

template<typename RecordT , typename TokenT >
void CastorDbProducer::setupItem ( const RecordT &  fRecord,
const TokenT &  token,
const char *  name,
CastorDbService service 
)
private

Definition at line 158 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), B2GTnPMonitor_cfi::item, mDumpRequest, mDumpStream, Skims_PA_cff::name, and unpackBuffers-CaloStage2::token.

Referenced by produce().

161  {
162  const auto& item = fRecord.get(token);
163  service->setData(&item);
164  if (std::find(mDumpRequest.begin(), mDumpRequest.end(), name) != mDumpRequest.end()) {
165  *mDumpStream << "New HCAL/CASTOR " << name << " set" << std::endl;
167  }
168 }
std::vector< std::string > mDumpRequest
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
std::ostream * mDumpStream

Member Data Documentation

◆ channelQualityToken_

edm::ESGetToken<CastorChannelQuality, CastorChannelQualityRcd> CastorDbProducer::channelQualityToken_
private

Definition at line 71 of file CastorDbProducer.cc.

Referenced by CastorDbProducer(), and produce().

◆ electronicsMapToken_

edm::ESGetToken<CastorElectronicsMap, CastorElectronicsMapRcd> CastorDbProducer::electronicsMapToken_
private

Definition at line 72 of file CastorDbProducer.cc.

Referenced by CastorDbProducer(), and produce().

◆ gainsToken_

edm::ESGetToken<CastorGains, CastorGainsRcd> CastorDbProducer::gainsToken_
private

Definition at line 68 of file CastorDbProducer.cc.

Referenced by CastorDbProducer(), and produce().

◆ gainWidthsToken_

edm::ESGetToken<CastorGainWidths, CastorGainWidthsRcd> CastorDbProducer::gainWidthsToken_
private

Definition at line 69 of file CastorDbProducer.cc.

Referenced by CastorDbProducer(), and produce().

◆ holder_

edm::ReusableObjectHolder<HostType> CastorDbProducer::holder_
private

Definition at line 64 of file CastorDbProducer.cc.

Referenced by produce().

◆ mDumpRequest

std::vector<std::string> CastorDbProducer::mDumpRequest
private

Definition at line 74 of file CastorDbProducer.cc.

Referenced by CastorDbProducer(), and setupItem().

◆ mDumpStream

std::ostream* CastorDbProducer::mDumpStream
private

Definition at line 75 of file CastorDbProducer.cc.

Referenced by CastorDbProducer(), setupItem(), and ~CastorDbProducer().

◆ pedestalsToken_

edm::ESGetToken<CastorPedestals, CastorPedestalsRcd> CastorDbProducer::pedestalsToken_
private

Definition at line 66 of file CastorDbProducer.cc.

Referenced by CastorDbProducer(), and produce().

◆ pedestalWidthsToken_

edm::ESGetToken<CastorPedestalWidths, CastorPedestalWidthsRcd> CastorDbProducer::pedestalWidthsToken_
private

Definition at line 67 of file CastorDbProducer.cc.

Referenced by CastorDbProducer(), and produce().

◆ qieDataToken_

edm::ESGetToken<CastorQIEData, CastorQIEDataRcd> CastorDbProducer::qieDataToken_
private

Definition at line 70 of file CastorDbProducer.cc.

Referenced by CastorDbProducer(), and produce().