CMS 3D CMS Logo

HcalDbProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalDbProducer
4 // Class: HcalDbProducer
5 //
13 //
14 // Original Author: Fedor Ratnikov
15 // Created: Tue Aug 9 19:10:10 CDT 2005
16 //
17 //
18 
19 
20 // system include files
21 #include <iostream>
22 #include <fstream>
23 
26 
29 
30 
32 
33 #include "HcalDbProducer.h"
34 
36  : ESProducer(),
37  mService (new HcalDbService (fConfig)),
38  mDumpRequest (),
39  mDumpStream(nullptr)
40 {
41  //the following line is needed to tell the framework what data is being produced
42  // comments of dependsOn:
43  // 1) There are two ways one can use 'dependsOn' the first is passing it up to three arguments.
44  // However, one can also extend the dependencies by first calling 'dependsOn() and then using '&' to add additional dependencies. So
45  // dependsOn(&FooProd::func1, &FooProd::func2, &FooProd::func3)
46  // gives the same result as
47  // dependsOn(&FooProd::func1) & (&FooProd::func2) & (&FooProd::func3)
48  // 2) Upon IOV change, all callbacks are called, in the inverse order of their specification below (tested).
73  )
74  );
75 
77  //now do what ever other initialization is needed
78 
79  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
80  if (!mDumpRequest.empty()) {
81  std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
82  mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
83  }
84 }
85 
86 
88 
89  // do anything here that needs to be done at desctruction time
90  // (e.g. close files, deallocate resources etc.)
91  if (mDumpStream != &std::cout) delete mDumpStream;
92 }
93 
94 
95 //
96 // member functions
97 //
98 
99 // ------------ method called to produce the data ------------
100 std::shared_ptr<HcalDbService> HcalDbProducer::produce( const HcalDbRecord&)
101 {
102  return mService;
103 }
104 
107  fRecord.get (item);
108 
109  mPedestals.reset( new HcalPedestals(*item) );
110 
112  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
113  const HcalTopology* topo=&(*htopo);
114  mPedestals->setTopo(topo);
115 
116 
117  mService->setData (mPedestals.get());
118  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
119  *mDumpStream << "New HCAL Pedestals set" << std::endl;
121  }
122 }
123 
126  fRecord.get ("effective",item);
127 
128  mEffectivePedestals.reset( new HcalPedestals(*item) );
129 
131  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
132  const HcalTopology* topo=&(*htopo);
133  mEffectivePedestals->setTopo(topo);
134 
135 
136  mService->setData (mEffectivePedestals.get(),true);
137  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("EffectivePedestals")) != mDumpRequest.end()) {
138  *mDumpStream << "New HCAL EffectivePedestals set" << std::endl;
140  }
141 }
142 
143 std::shared_ptr<HcalChannelQuality> HcalDbProducer::produceChannelQualityWithTopo(const HcalChannelQualityRcd& fRecord)
144 {
146  fRecord.get (item);
147 
148  auto channelQuality = std::make_shared<HcalChannelQuality>(*item);
149 
151  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
152  const HcalTopology* topo=&(*htopo);
153  channelQuality->setTopo(topo);
154 
155  return channelQuality;
156 }
157 
160  fRecord.get (item);
161 
162  mPedestalWidths.reset( new HcalPedestalWidths(*item));
163 
165  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
166  const HcalTopology* topo=&(*htopo);
167  mPedestalWidths->setTopo(topo);
168 
169  mService->setData (mPedestalWidths.get());
170  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
171  *mDumpStream << "New HCAL PedestalWidths set" << std::endl;
173  }
174 }
175 
178  fRecord.get ("effective",item);
179 
180  mEffectivePedestalWidths.reset( new HcalPedestalWidths(*item));
181 
183  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
184  const HcalTopology* topo=&(*htopo);
185  mEffectivePedestalWidths->setTopo(topo);
186 
187  mService->setData (mEffectivePedestalWidths.get(),true);
188  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("EffectivePedestalWidths")) != mDumpRequest.end()) {
189  *mDumpStream << "New HCAL EffectivePedestalWidths set" << std::endl;
191  }
192 }
193 
194 
197  fRecord.get (item);
198 
199  mGains.reset( new HcalGains(*item) );
201  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
202  const HcalTopology* topo=&(*htopo);
203  mGains->setTopo(topo);
204 
205 
206  mService->setData (mGains.get());
207  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
208  *mDumpStream << "New HCAL Gains set" << std::endl;
210  }
211 }
212 
213 
216  fRecord.get (item);
217 
218  mGainWidths.reset( new HcalGainWidths(*item));
220  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
221  const HcalTopology* topo=&(*htopo);
222  mGainWidths->setTopo(topo);
223 
224 
225  mService->setData (mGainWidths.get());
226  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
227  *mDumpStream << "New HCAL GainWidths set" << std::endl;
229  }
230 }
231 
234  fRecord.get (item);
235 
236  mQIEData.reset( new HcalQIEData(*item));
237 
238 
240  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
241  const HcalTopology* topo=&(*htopo);
242  mQIEData->setTopo(topo);
243 
244  mService->setData (mQIEData.get());
245  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
246  *mDumpStream << "New HCAL QIEData set" << std::endl;
248  }
249 }
250 
253  fRecord.get (item);
254 
255  mQIETypes.reset( new HcalQIETypes(*item) );
256 
258  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
259  const HcalTopology* topo=&(*htopo);
260  mQIETypes->setTopo(topo);
261 
262  mService->setData (mQIETypes.get());
263  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIETypes")) != mDumpRequest.end()) {
264  *mDumpStream << "New HCAL QIETypes set" << std::endl;
266  }
267 }
268 
271  fRecord.get ("withTopo", item );
272 
273  mService->setData (item.product());
274  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
275  *mDumpStream << "New HCAL ChannelQuality set" << std::endl;
277  }
278 }
279 
282  fRecord.get (item);
283 
284  mRespCorrs.reset( new HcalRespCorrs(*item) );
285 
287  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
288  const HcalTopology* topo=&(*htopo);
289  mRespCorrs->setTopo(topo);
290 
291  mService->setData (mRespCorrs.get());
292  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RespCorrs")) != mDumpRequest.end()) {
293  *mDumpStream << "New HCAL RespCorrs set" << std::endl;
295  }
296 }
297 
300  fRecord.get (item);
301 
302  mLUTCorrs.reset( new HcalLUTCorrs(*item) );
303 
305  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
306  const HcalTopology* topo=&(*htopo);
307  mLUTCorrs->setTopo(topo);
308 
309  mService->setData (mLUTCorrs.get());
310  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LUTCorrs")) != mDumpRequest.end()) {
311  *mDumpStream << "New HCAL LUTCorrs set" << std::endl;
313  }
314 }
315 
318  fRecord.get (item);
319 
320  mPFCorrs.reset( new HcalPFCorrs(*item) );
321 
323  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
324  const HcalTopology* topo=&(*htopo);
325  mPFCorrs->setTopo(topo);
326 
327  mService->setData (mPFCorrs.get());
328  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PFCorrs")) != mDumpRequest.end()) {
329  *mDumpStream << "New HCAL PFCorrs set" << std::endl;
331  }
332 }
333 
336  fRecord.get (item);
337 
338  mTimeCorrs.reset( new HcalTimeCorrs(*item) );
339 
341  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
342  const HcalTopology* topo=&(*htopo);
343  mTimeCorrs->setTopo(topo);
344 
345  mService->setData (mTimeCorrs.get());
346  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TimeCorrs")) != mDumpRequest.end()) {
347  *mDumpStream << "New HCAL TimeCorrs set" << std::endl;
349  }
350 }
351 
354  fRecord.get (item);
355 
356  mZSThresholds.reset( new HcalZSThresholds(*item) );
357 
359  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
360  const HcalTopology* topo=&(*htopo);
361  mZSThresholds->setTopo(topo);
362 
363  mService->setData (mZSThresholds.get());
364  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ZSThresholds")) != mDumpRequest.end()) {
365  *mDumpStream << "New HCAL ZSThresholds set" << std::endl;
367  }
368 }
369 
372  fRecord.get (item);
373 
374  mL1TriggerObjects.reset( new HcalL1TriggerObjects(*item) );
375 
377  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
378  const HcalTopology* topo=&(*htopo);
379  mL1TriggerObjects->setTopo(topo);
380 
381  mService->setData (mL1TriggerObjects.get());
382  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("L1TriggerObjects")) != mDumpRequest.end()) {
383  *mDumpStream << "New HCAL L1TriggerObjects set" << std::endl;
385  }
386 }
387 
390  fRecord.get (item);
391  mService->setData (item.product ());
392  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
393  *mDumpStream << "New HCAL Electronics Map set" << std::endl;
395  }
396 }
397 
400  fRecord.get (item);
401  mService->setData (item.product ());
402  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("FrontEndMap")) != mDumpRequest.end()) {
403  *mDumpStream << "New HCAL FrontEnd Map set" << std::endl;
405  }
406 }
407 
410  fRecord.get (item);
411 
412  mLutMetadata.reset( new HcalLutMetadata(*item) );
413 
415  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
416  const HcalTopology* topo=&(*htopo);
417  mLutMetadata->setTopo(topo);
418 
419  mService->setData (mLutMetadata.get());
420  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LutMetadata")) != mDumpRequest.end()) {
421  *mDumpStream << "New HCAL LUT Metadata set" << std::endl;
423  }
424 }
425 
428  fRecord.get (item);
429 
430  mSiPMParameters.reset( new HcalSiPMParameters(*item) );
431 
433  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
434  const HcalTopology* topo=&(*htopo);
435  mSiPMParameters->setTopo(topo);
436 
437  mService->setData (mSiPMParameters.get());
438  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("SiPMParameters")) != mDumpRequest.end()) {
439  *mDumpStream << "New HCAL SiPMParameters set" << std::endl;
441  }
442 }
443 
446  fRecord.get (item);
447  mService->setData (item.product ());
448  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("SiPMCharacteristics")) != mDumpRequest.end()) {
449  *mDumpStream << "New HCAL SiPMCharacteristics set" << std::endl;
451  }
452 }
453 
456  fRecord.get (item);
457 
458  mTPChannelParameters.reset( new HcalTPChannelParameters(*item) );
459 
461  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
462  const HcalTopology* topo=&(*htopo);
463  mTPChannelParameters->setTopo(topo);
464 
465  mService->setData (mTPChannelParameters.get());
466  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TPChannelParameters")) != mDumpRequest.end()) {
467  *mDumpStream << "New HCAL TPChannelParameters set" << std::endl;
469  }
470 }
471 
473 
475  fRecord.get (item);
476  mService->setData (item.product ());
477  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TPParameters")) != mDumpRequest.end()) {
478  *mDumpStream << "New HCAL TPParameters set" << std::endl;
480  }
481 }
482 
483 
486  fRecord.get (item);
487 
488  mMCParams.reset( new HcalMCParams(*item) );
489 
491  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
492  const HcalTopology* topo=&(*htopo);
493  mMCParams->setTopo(topo);
494 
495  mService->setData (mMCParams.get());
496  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("MCParams")) != mDumpRequest.end()) {
497  *mDumpStream << "New HCAL MCParams set" << std::endl;
499  }
500 }
501 
504  fRecord.get (item);
505 
506  mRecoParams.reset( new HcalRecoParams(*item) );
507 
509  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
510  const HcalTopology* topo=&(*htopo);
511  mRecoParams->setTopo(topo);
512 
513  mService->setData (mRecoParams.get());
514  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RecoParams")) != mDumpRequest.end()) {
515  *mDumpStream << "New HCAL RecoParams set" << std::endl;
517  }
518 }
519 
std::unique_ptr< HcalPFCorrs > mPFCorrs
T getUntrackedParameter(std::string const &, T const &) const
void LUTCorrsCallback(const HcalLUTCorrsRcd &fRecord)
depends_on::OneHolder< T, TDependsOnRecord > dependsOn(void(T::*iT)(const TDependsOnRecord &))
void TPParametersCallback(const HcalTPParametersRcd &fRecord)
void electronicsMapCallback(const HcalElectronicsMapRcd &fRecord)
std::unique_ptr< HcalZSThresholds > mZSThresholds
std::unique_ptr< HcalRespCorrs > mRespCorrs
std::unique_ptr< HcalRecoParams > mRecoParams
std::unique_ptr< HcalGainWidths > mGainWidths
HcalDbProducer(const edm::ParameterSet &)
void RecoParamsCallback(const HcalRecoParamsRcd &fRecord)
void frontEndMapCallback(const HcalFrontEndMapRcd &fRecord)
void pedestalsCallback(const HcalPedestalsRcd &fRecord)
std::unique_ptr< HcalPedestalWidths > mEffectivePedestalWidths
std::unique_ptr< HcalPedestals > mEffectivePedestals
#define nullptr
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
void TPChannelParametersCallback(const HcalTPChannelParametersRcd &fRecord)
std::unique_ptr< HcalPedestals > mPedestals
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
void gainWidthsCallback(const HcalGainWidthsRcd &fRecord)
std::unique_ptr< HcalMCParams > mMCParams
void QIEDataCallback(const HcalQIEDataRcd &fRecord)
std::shared_ptr< HcalDbService > mService
void SiPMParametersCallback(const HcalSiPMParametersRcd &fRecord)
std::vector< std::string > mDumpRequest
void L1triggerObjectsCallback(const HcalL1TriggerObjectsRcd &fRecord)
std::unique_ptr< HcalGains > mGains
void get(HolderT &iHolder) const
void PFCorrsCallback(const HcalPFCorrsRcd &fRecord)
void channelQualityCallback(const HcalChannelQualityRcd &fRecord)
std::unique_ptr< HcalQIEData > mQIEData
void MCParamsCallback(const HcalMCParamsRcd &fRecord)
std::unique_ptr< HcalTimeCorrs > mTimeCorrs
void respCorrsCallback(const HcalRespCorrsRcd &fRecord)
std::shared_ptr< HcalChannelQuality > produceChannelQualityWithTopo(const HcalChannelQualityRcd &)
void QIETypesCallback(const HcalQIETypesRcd &fRecord)
std::unique_ptr< HcalQIETypes > mQIETypes
void effectivePedestalWidthsCallback(const HcalPedestalWidthsRcd &fRecord)
std::unique_ptr< HcalLUTCorrs > mLUTCorrs
std::unique_ptr< HcalTPChannelParameters > mTPChannelParameters
std::unique_ptr< HcalPedestalWidths > mPedestalWidths
void gainsCallback(const HcalGainsRcd &fRecord)
std::unique_ptr< HcalLutMetadata > mLutMetadata
void zsThresholdsCallback(const HcalZSThresholdsRcd &fRecord)
~HcalDbProducer() override
void SiPMCharacteristicsCallback(const HcalSiPMCharacteristicsRcd &fRecord)
void timeCorrsCallback(const HcalTimeCorrsRcd &fRecord)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
std::unique_ptr< HcalL1TriggerObjects > mL1TriggerObjects
std::ostream * mDumpStream
void pedestalWidthsCallback(const HcalPedestalWidthsRcd &fRecord)
std::shared_ptr< HcalDbService > produce(const HcalDbRecord &)
void effectivePedestalsCallback(const HcalPedestalsRcd &fRecord)
T const * product() const
Definition: ESHandle.h:86
std::unique_ptr< HcalSiPMParameters > mSiPMParameters
void lutMetadataCallback(const HcalLutMetadataRcd &fRecord)