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 ()
 
 ~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 >
ESConsumesCollector 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 36 of file CastorDbProducer.cc.

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

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

Definition at line 55 of file CastorDbProducer.cc.

References gather_cfg::cout, and mDumpStream.

56 {
57 
58  // do anything here that needs to be done at desctruction time
59  // (e.g. close files, deallocate resources etc.)
60  if (mDumpStream != &std::cout) delete mDumpStream;
61 }
std::ostream * mDumpStream

Member Function Documentation

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

Definition at line 69 of file CastorDbProducer.cc.

References h, holder_, query::host, record, setupChannelQuality(), setupElectronicsMap(), setupGains(), setupGainWidths(), setupPedestals(), setupPedestalWidths(), and setupQIEData().

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

70 {
71  auto host = holder_.makeOrGet([]() {
72  return new HostType;
73  });
74 
75  bool needBuildCalibrations = false;
76  bool needBuildCalibWidths = false;
77 
78  host->ifRecordChanges<CastorElectronicsMapRcd>(record,
79  [this, h=host.get()](auto const& rec) {
80  setupElectronicsMap(rec, h);
81  });
82  host->ifRecordChanges<CastorChannelQualityRcd>(record,
83  [this, h=host.get()](auto const& rec) {
84  setupChannelQuality(rec, h);
85  });
86  host->ifRecordChanges<CastorGainWidthsRcd>(record,
87  [this, h=host.get(),
88  &needBuildCalibWidths](auto const& rec) {
89  setupGainWidths(rec, h);
90  needBuildCalibWidths = true;
91  });
92  host->ifRecordChanges<CastorQIEDataRcd>(record,
93  [this, h=host.get(),
94  &needBuildCalibrations,
95  &needBuildCalibWidths](auto const& rec) {
96  setupQIEData(rec, h);
97  needBuildCalibrations = true;
98  needBuildCalibWidths = true;
99  });
100  host->ifRecordChanges<CastorPedestalWidthsRcd>(record,
101  [this, h=host.get(),
102  &needBuildCalibWidths](auto const& rec) {
103  setupPedestalWidths(rec, h);
104  needBuildCalibWidths = true;
105  });
106  host->ifRecordChanges<CastorGainsRcd>(record,
107  [this, h=host.get(),
108  &needBuildCalibrations](auto const& rec) {
109  setupGains(rec, h);
110  needBuildCalibrations = true;
111  });
112  host->ifRecordChanges<CastorPedestalsRcd>(record,
113  [this, h=host.get(),
114  &needBuildCalibrations](auto const& rec) {
115  setupPedestals(rec, h);
116  needBuildCalibrations = true;
117  });
118 
119  if (needBuildCalibWidths) {
120  host->buildCalibWidths();
121  }
122 
123  if (needBuildCalibrations) {
124  host->buildCalibrations();
125  }
126 
127  return host; // automatically converts to std::shared_ptr<CastorDbService>
128 }
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
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 189 of file CastorDbProducer.cc.

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

Referenced by produce().

190  {
192  fRecord.get (item);
193  service->setData(item.product());
194  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
195  *mDumpStream << "New HCAL/CASTOR ChannelQuality set" << std::endl;
197  }
198 }
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
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:84
bool get(HolderT &iHolder) const
void CastorDbProducer::setupElectronicsMap ( const CastorElectronicsMapRcd fRecord,
CastorDbService service 
)
private

Definition at line 200 of file CastorDbProducer.cc.

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

Referenced by produce().

201  {
203  fRecord.get (item);
204  service->setData(item.product());
205  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
206  *mDumpStream << "New HCAL/CASTOR Electronics Map set" << std::endl;
208  }
209 }
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
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:84
bool get(HolderT &iHolder) const
void CastorDbProducer::setupGains ( const CastorGainsRcd fRecord,
CastorDbService service 
)
private

Definition at line 155 of file CastorDbProducer.cc.

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

Referenced by produce().

156  {
158  fRecord.get (item);
159  service->setData(item.product());
160  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
161  *mDumpStream << "New HCAL/CASTOR Gains set" << std::endl;
163  }
164 }
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
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:84
bool get(HolderT &iHolder) const
void CastorDbProducer::setupGainWidths ( const CastorGainWidthsRcd fRecord,
CastorDbService service 
)
private

Definition at line 167 of file CastorDbProducer.cc.

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

Referenced by produce().

168  {
170  fRecord.get (item);
171  service->setData(item.product());
172  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
173  *mDumpStream << "New HCAL/CASTOR GainWidths set" << std::endl;
175  }
176 }
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
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:84
bool get(HolderT &iHolder) const
void CastorDbProducer::setupPedestals ( const CastorPedestalsRcd fRecord,
CastorDbService service 
)
private

Definition at line 130 of file CastorDbProducer.cc.

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

Referenced by produce().

131  {
132 
134  fRecord.get (item);
135 
136  service->setData(item.product());
137  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
138  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
140  }
141 }
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
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:84
bool get(HolderT &iHolder) const
void CastorDbProducer::setupPedestalWidths ( const CastorPedestalWidthsRcd fRecord,
CastorDbService service 
)
private

Definition at line 143 of file CastorDbProducer.cc.

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

Referenced by produce().

144  {
146  fRecord.get (item);
147  service->setData(item.product());
148  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
149  *mDumpStream << "New HCAL/CASTOR Pedestals set" << std::endl;
151  }
152 }
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
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:84
bool get(HolderT &iHolder) const
void CastorDbProducer::setupQIEData ( const CastorQIEDataRcd fRecord,
CastorDbService service 
)
private

Definition at line 178 of file CastorDbProducer.cc.

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

Referenced by produce().

179  {
181  fRecord.get (item);
182  service->setData(item.product());
183  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
184  *mDumpStream << "New HCAL/CASTOR QIEData set" << std::endl;
186  }
187 }
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
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
void setData(const CastorPedestals *fItem)
std::ostream * mDumpStream
T const * product() const
Definition: ESHandle.h:84
bool get(HolderT &iHolder) const

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