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 char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &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.

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 }

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

◆ ~CastorDbProducer()

CastorDbProducer::~CastorDbProducer ( )
override

Definition at line 100 of file CastorDbProducer.cc.

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 }

References gather_cfg::cout, and mDumpStream.

Member Function Documentation

◆ produce()

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

Definition at line 112 of file CastorDbProducer.cc.

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 }

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

◆ 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.

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 }

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

Referenced by produce().

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().

service
Definition: service.py:1
CastorDbProducer::gainWidthsToken_
edm::ESGetToken< CastorGainWidths, CastorGainWidthsRcd > gainWidthsToken_
Definition: CastorDbProducer.cc:69
CastorDbProducer::pedestalWidthsToken_
edm::ESGetToken< CastorPedestalWidths, CastorPedestalWidthsRcd > pedestalWidthsToken_
Definition: CastorDbProducer.cc:67
CastorDbProducer::electronicsMapToken_
edm::ESGetToken< CastorElectronicsMap, CastorElectronicsMapRcd > electronicsMapToken_
Definition: CastorDbProducer.cc:72
CastorQIEDataRcd
Definition: CastorQIEDataRcd.h:24
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
CastorPedestalWidthsRcd
Definition: CastorPedestalWidthsRcd.h:24
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
query.host
string host
Definition: query.py:115
CastorDbProducer::holder_
edm::ReusableObjectHolder< HostType > holder_
Definition: CastorDbProducer.cc:64
edm::ReusableObjectHolder::makeOrGet
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn't an object already available, creates a new one using iFunc.
Definition: ReusableObjectHolder.h:126
CastorDbProducer::mDumpStream
std::ostream * mDumpStream
Definition: CastorDbProducer.cc:75
edm::ESProducer::ESProducer
ESProducer()
Definition: ESProducer.cc:30
h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CastorDbProducer::gainsToken_
edm::ESGetToken< CastorGains, CastorGainsRcd > gainsToken_
Definition: CastorDbProducer.cc:68
CastorDbProducer::mDumpRequest
std::vector< std::string > mDumpRequest
Definition: CastorDbProducer.cc:74
CastorDbASCIIIO::dumpObject
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
Definition: CastorDbASCIIIO.cc:323
CastorChannelQualityRcd
Definition: CastorChannelQualityRcd.h:24
CastorDbProducer::setupItem
void setupItem(const RecordT &fRecord, const TokenT &token, const char *name, CastorDbService *service)
Definition: CastorDbProducer.cc:158
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
cc
CastorDbProducer::pedestalsToken_
edm::ESGetToken< CastorPedestals, CastorPedestalsRcd > pedestalsToken_
Definition: CastorDbProducer.cc:66
CastorDbProducer::qieDataToken_
edm::ESGetToken< CastorQIEData, CastorQIEDataRcd > qieDataToken_
Definition: CastorDbProducer.cc:70
CastorElectronicsMapRcd
Definition: CastorElectronicsMapRcd.h:4
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
CastorGainsRcd
Definition: CastorGainsRcd.h:24
CastorDbProducer::HostType
edm::ESProductHost< CastorDbService, CastorPedestalsRcd, CastorPedestalWidthsRcd, CastorGainsRcd, CastorGainWidthsRcd, CastorQIEDataRcd, CastorChannelQualityRcd, CastorElectronicsMapRcd > HostType
Definition: CastorDbProducer.cc:59
CastorDbProducer::channelQualityToken_
edm::ESGetToken< CastorChannelQuality, CastorChannelQualityRcd > channelQualityToken_
Definition: CastorDbProducer.cc:71
CastorPedestalsRcd
Definition: CastorPedestalsRcd.h:24
CastorGainWidthsRcd
Definition: CastorGainWidthsRcd.h:24
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316