CMS 3D CMS Logo

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

#include <CalibFormats/CastorDbProducer/interface/CastorDbProducer.h>

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 ()
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer ()(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval) override
 overrides DataProxyProvider method More...
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
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

void setupChannelQuality (const CastorChannelQualityRcd &, CastorDbService *)
 
void setupElectronicsMap (const CastorElectronicsMapRcd &, CastorDbService *)
 
void setupGains (const CastorGainsRcd &, CastorDbService *)
 
void setupGainWidths (const CastorGainWidthsRcd &, CastorDbService *)
 
void setupPedestals (const CastorPedestalsRcd &, CastorDbService *)
 
void setupPedestalWidths (const CastorPedestalWidthsRcd &, CastorDbService *)
 
void setupQIEData (const CastorQIEDataRcd &, CastorDbService *)
 

Private Attributes

edm::ReusableObjectHolder< HostTypeholder_
 
std::vector< std::string > mDumpRequest
 
std::ostream * mDumpStream
 

Additional Inherited Members

- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair< DataKey, edm::propagate_const< std::shared_ptr< DataProxy > > > > KeyedProxies
 
typedef std::vector< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 
- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::ESProducer
 ESProducer (const ESProducer &)=delete
 
ESProducer const & operator= (const ESProducer &)=delete
 
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={})
 
- 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 eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > iFactory, const std::string &iLabel=std::string())
 
void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList) override
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Detailed Description

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

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

Definition at line 21 of file CastorDbProducer.h.

Member Typedef Documentation

Definition at line 37 of file CastorDbProducer.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file CastorDbProducer.cc.

References gather_cfg::cout, edm::ParameterSet::getUntrackedParameter(), mDumpRequest, mDumpStream, edm::ESProducer::setWhatProduced(), and AlCaHLTBitMon_QueryRunRegistry::string.

35  : ESProducer(), mDumpRequest(), mDumpStream(nullptr) {
36  //the following line is needed to tell the framework what
37  // data is being produced
38  setWhatProduced(this);
39 
40  //now do what ever other initialization is needed
41 
42  mDumpRequest = fConfig.getUntrackedParameter<std::vector<std::string> >("dump", std::vector<std::string>());
43  if (!mDumpRequest.empty()) {
44  std::string otputFile = fConfig.getUntrackedParameter<std::string>("file", "");
45  mDumpStream = otputFile.empty() ? &std::cout : new std::ofstream(otputFile.c_str());
46  }
47 }
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > mDumpRequest
std::ostream * mDumpStream
CastorDbProducer::~CastorDbProducer ( )
override

Definition at line 49 of file CastorDbProducer.cc.

References gather_cfg::cout, and mDumpStream.

49  {
50  // do anything here that needs to be done at desctruction time
51  // (e.g. close files, deallocate resources etc.)
52  if (mDumpStream != &std::cout)
53  delete mDumpStream;
54 }
std::ostream * mDumpStream

Member Function Documentation

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

Definition at line 61 of file CastorDbProducer.cc.

References h, holder_, query::host, edm::ReusableObjectHolder< T >::makeOrGet(), record, setupChannelQuality(), setupElectronicsMap(), setupGains(), setupGainWidths(), setupPedestals(), setupPedestalWidths(), and setupQIEData().

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

61  {
62  auto host = holder_.makeOrGet([]() { return new HostType; });
63 
64  bool needBuildCalibrations = false;
65  bool needBuildCalibWidths = false;
66 
67  host->ifRecordChanges<CastorElectronicsMapRcd>(
68  record, [this, h = host.get()](auto const& rec) { setupElectronicsMap(rec, h); });
69  host->ifRecordChanges<CastorChannelQualityRcd>(
70  record, [this, h = host.get()](auto const& rec) { setupChannelQuality(rec, h); });
71  host->ifRecordChanges<CastorGainWidthsRcd>(record, [this, h = host.get(), &needBuildCalibWidths](auto const& rec) {
72  setupGainWidths(rec, h);
73  needBuildCalibWidths = true;
74  });
75  host->ifRecordChanges<CastorQIEDataRcd>(
76  record, [this, h = host.get(), &needBuildCalibrations, &needBuildCalibWidths](auto const& rec) {
77  setupQIEData(rec, h);
78  needBuildCalibrations = true;
79  needBuildCalibWidths = true;
80  });
81  host->ifRecordChanges<CastorPedestalWidthsRcd>(record,
82  [this, h = host.get(), &needBuildCalibWidths](auto const& rec) {
83  setupPedestalWidths(rec, h);
84  needBuildCalibWidths = true;
85  });
86  host->ifRecordChanges<CastorGainsRcd>(record, [this, h = host.get(), &needBuildCalibrations](auto const& rec) {
87  setupGains(rec, h);
88  needBuildCalibrations = true;
89  });
90  host->ifRecordChanges<CastorPedestalsRcd>(record, [this, h = host.get(), &needBuildCalibrations](auto const& rec) {
91  setupPedestals(rec, h);
92  needBuildCalibrations = true;
93  });
94 
95  if (needBuildCalibWidths) {
96  host->buildCalibWidths();
97  }
98 
99  if (needBuildCalibrations) {
100  host->buildCalibrations();
101  }
102 
103  return host; // automatically converts to std::shared_ptr<CastorDbService>
104 }
host
Definition: query.py:115
void setupElectronicsMap(const CastorElectronicsMapRcd &, CastorDbService *)
void setupQIEData(const CastorQIEDataRcd &, CastorDbService *)
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
JetCorrectorParameters::Record record
Definition: classes.h:7
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn&#39;t an object already available, creates a new one using iFunc.
edm::ESProductHost< CastorDbService, CastorPedestalsRcd, CastorPedestalWidthsRcd, CastorGainsRcd, CastorGainWidthsRcd, CastorQIEDataRcd, CastorChannelQualityRcd, CastorElectronicsMapRcd > HostType
void setupGains(const CastorGainsRcd &, CastorDbService *)
void setupChannelQuality(const CastorChannelQualityRcd &, CastorDbService *)
void setupPedestalWidths(const CastorPedestalWidthsRcd &, CastorDbService *)
void setupPedestals(const CastorPedestalsRcd &, CastorDbService *)
edm::ReusableObjectHolder< HostType > holder_
void setupGainWidths(const CastorGainWidthsRcd &, CastorDbService *)
void CastorDbProducer::setupChannelQuality ( const CastorChannelQualityRcd fRecord,
CastorDbService service 
)
private

Definition at line 157 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), mDumpRequest, mDumpStream, edm::ESHandle< T >::product(), CastorDbService::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

157  {
159  fRecord.get(item);
160  service->setData(item.product());
161  if (std::find(mDumpRequest.begin(), mDumpRequest.end(), std::string("ChannelQuality")) != mDumpRequest.end()) {
162  *mDumpStream << "New HCAL/CASTOR ChannelQuality set" << std::endl;
164  }
165 }
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:20
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:86
void CastorDbProducer::setupElectronicsMap ( const CastorElectronicsMapRcd fRecord,
CastorDbService service 
)
private

Definition at line 167 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), mDumpRequest, mDumpStream, edm::ESHandle< T >::product(), CastorDbService::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

167  {
169  fRecord.get(item);
170  service->setData(item.product());
171  if (std::find(mDumpRequest.begin(), mDumpRequest.end(), std::string("ElectronicsMap")) != mDumpRequest.end()) {
172  *mDumpStream << "New HCAL/CASTOR Electronics Map set" << std::endl;
174  }
175 }
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:20
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:86
void CastorDbProducer::setupGains ( const CastorGainsRcd fRecord,
CastorDbService service 
)
private

Definition at line 127 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), mDumpRequest, mDumpStream, edm::ESHandle< T >::product(), CastorDbService::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

127  {
129  fRecord.get(item);
130  service->setData(item.product());
131  if (std::find(mDumpRequest.begin(), mDumpRequest.end(), std::string("Gains")) != mDumpRequest.end()) {
132  *mDumpStream << "New HCAL/CASTOR Gains set" << std::endl;
134  }
135 }
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:20
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:86
void CastorDbProducer::setupGainWidths ( const CastorGainWidthsRcd fRecord,
CastorDbService service 
)
private

Definition at line 137 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), mDumpRequest, mDumpStream, edm::ESHandle< T >::product(), CastorDbService::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

137  {
139  fRecord.get(item);
140  service->setData(item.product());
141  if (std::find(mDumpRequest.begin(), mDumpRequest.end(), std::string("GainWidths")) != mDumpRequest.end()) {
142  *mDumpStream << "New HCAL/CASTOR GainWidths set" << std::endl;
144  }
145 }
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:20
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:86
void CastorDbProducer::setupPedestals ( const CastorPedestalsRcd fRecord,
CastorDbService service 
)
private

Definition at line 106 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), mDumpRequest, mDumpStream, edm::ESHandle< T >::product(), CastorDbService::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

106  {
108  fRecord.get(item);
109 
110  service->setData(item.product());
111  if (std::find(mDumpRequest.begin(), mDumpRequest.end(), std::string("Pedestals")) != mDumpRequest.end()) {
112  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
114  }
115 }
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:20
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:86
void CastorDbProducer::setupPedestalWidths ( const CastorPedestalWidthsRcd fRecord,
CastorDbService service 
)
private

Definition at line 117 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), mDumpRequest, mDumpStream, edm::ESHandle< T >::product(), CastorDbService::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

117  {
119  fRecord.get(item);
120  service->setData(item.product());
121  if (std::find(mDumpRequest.begin(), mDumpRequest.end(), std::string("PedestalWidths")) != mDumpRequest.end()) {
122  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
124  }
125 }
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:20
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:86
void CastorDbProducer::setupQIEData ( const CastorQIEDataRcd fRecord,
CastorDbService service 
)
private

Definition at line 147 of file CastorDbProducer.cc.

References CastorDbASCIIIO::dumpObject(), spr::find(), edm::eventsetup::EventSetupRecordImplementation< T >::get(), mDumpRequest, mDumpStream, edm::ESHandle< T >::product(), CastorDbService::setData(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by produce().

147  {
149  fRecord.get(item);
150  service->setData(item.product());
151  if (std::find(mDumpRequest.begin(), mDumpRequest.end(), std::string("QIEData")) != mDumpRequest.end()) {
152  *mDumpStream << "New HCAL/CASTOR QIEData set" << std::endl;
154  }
155 }
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:20
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

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

Definition at line 47 of file CastorDbProducer.h.

Referenced by produce().

std::vector<std::string> CastorDbProducer::mDumpRequest
private
std::ostream* CastorDbProducer::mDumpStream
private