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).
72  )
73  );
74 
76  //now do what ever other initialization is needed
77 
78  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
79  if (!mDumpRequest.empty()) {
80  std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
81  mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
82  }
83 }
84 
85 
87 
88  // do anything here that needs to be done at desctruction time
89  // (e.g. close files, deallocate resources etc.)
90  if (mDumpStream != &std::cout) delete mDumpStream;
91 }
92 
93 
94 //
95 // member functions
96 //
97 
98 // ------------ method called to produce the data ------------
99 std::shared_ptr<HcalDbService> HcalDbProducer::produce( const HcalDbRecord&)
100 {
101  return mService;
102 }
103 
106  fRecord.get (item);
107 
108  mPedestals.reset( new HcalPedestals(*item) );
109 
111  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
112  const HcalTopology* topo=&(*htopo);
113  mPedestals->setTopo(topo);
114 
115 
116  mService->setData (mPedestals.get());
117  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
118  *mDumpStream << "New HCAL Pedestals set" << std::endl;
120  }
121 }
122 
125  fRecord.get ("effective",item);
126 
127  mEffectivePedestals.reset( new HcalPedestals(*item) );
128 
130  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
131  const HcalTopology* topo=&(*htopo);
132  mEffectivePedestals->setTopo(topo);
133 
134 
135  mService->setData (mEffectivePedestals.get(),true);
136  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("EffectivePedestals")) != mDumpRequest.end()) {
137  *mDumpStream << "New HCAL EffectivePedestals set" << std::endl;
139  }
140 }
141 
142 std::shared_ptr<HcalChannelQuality> HcalDbProducer::produceChannelQualityWithTopo(const HcalChannelQualityRcd& fRecord)
143 {
145  fRecord.get (item);
146 
147  auto channelQuality = std::make_shared<HcalChannelQuality>(*item);
148 
150  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
151  const HcalTopology* topo=&(*htopo);
152  channelQuality->setTopo(topo);
153 
154  return channelQuality;
155 }
156 
159  fRecord.get (item);
160 
161  mPedestalWidths.reset( new HcalPedestalWidths(*item));
162 
164  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
165  const HcalTopology* topo=&(*htopo);
166  mPedestalWidths->setTopo(topo);
167 
168  mService->setData (mPedestalWidths.get());
169  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
170  *mDumpStream << "New HCAL PedestalWidths set" << std::endl;
172  }
173 }
174 
177  fRecord.get ("effective",item);
178 
179  mEffectivePedestalWidths.reset( new HcalPedestalWidths(*item));
180 
182  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
183  const HcalTopology* topo=&(*htopo);
184  mEffectivePedestalWidths->setTopo(topo);
185 
186  mService->setData (mEffectivePedestalWidths.get(),true);
187  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("EffectivePedestalWidths")) != mDumpRequest.end()) {
188  *mDumpStream << "New HCAL EffectivePedestalWidths set" << std::endl;
190  }
191 }
192 
193 
196  fRecord.get (item);
197 
198  mGains.reset( new HcalGains(*item) );
200  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
201  const HcalTopology* topo=&(*htopo);
202  mGains->setTopo(topo);
203 
204 
205  mService->setData (mGains.get());
206  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
207  *mDumpStream << "New HCAL Gains set" << std::endl;
209  }
210 }
211 
212 
215  fRecord.get (item);
216 
217  mGainWidths.reset( new HcalGainWidths(*item));
219  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
220  const HcalTopology* topo=&(*htopo);
221  mGainWidths->setTopo(topo);
222 
223 
224  mService->setData (mGainWidths.get());
225  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
226  *mDumpStream << "New HCAL GainWidths set" << std::endl;
228  }
229 }
230 
233  fRecord.get (item);
234 
235  mQIEData.reset( new HcalQIEData(*item));
236 
237 
239  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
240  const HcalTopology* topo=&(*htopo);
241  mQIEData->setTopo(topo);
242 
243  mService->setData (mQIEData.get());
244  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
245  *mDumpStream << "New HCAL QIEData set" << std::endl;
247  }
248 }
249 
252  fRecord.get (item);
253 
254  mQIETypes.reset( new HcalQIETypes(*item) );
255 
257  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
258  const HcalTopology* topo=&(*htopo);
259  mQIETypes->setTopo(topo);
260 
261  mService->setData (mQIETypes.get());
262  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIETypes")) != mDumpRequest.end()) {
263  *mDumpStream << "New HCAL QIETypes set" << std::endl;
265  }
266 }
267 
270  fRecord.get ("withTopo", item );
271 
272  mService->setData (item.product());
273  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
274  *mDumpStream << "New HCAL ChannelQuality set" << std::endl;
276  }
277 }
278 
281  fRecord.get (item);
282 
283  mRespCorrs.reset( new HcalRespCorrs(*item) );
284 
286  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
287  const HcalTopology* topo=&(*htopo);
288  mRespCorrs->setTopo(topo);
289 
290  mService->setData (mRespCorrs.get());
291  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RespCorrs")) != mDumpRequest.end()) {
292  *mDumpStream << "New HCAL RespCorrs set" << std::endl;
294  }
295 }
296 
299  fRecord.get (item);
300 
301  mLUTCorrs.reset( new HcalLUTCorrs(*item) );
302 
304  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
305  const HcalTopology* topo=&(*htopo);
306  mLUTCorrs->setTopo(topo);
307 
308  mService->setData (mLUTCorrs.get());
309  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LUTCorrs")) != mDumpRequest.end()) {
310  *mDumpStream << "New HCAL LUTCorrs set" << std::endl;
312  }
313 }
314 
317  fRecord.get (item);
318 
319  mPFCorrs.reset( new HcalPFCorrs(*item) );
320 
322  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
323  const HcalTopology* topo=&(*htopo);
324  mPFCorrs->setTopo(topo);
325 
326  mService->setData (mPFCorrs.get());
327  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PFCorrs")) != mDumpRequest.end()) {
328  *mDumpStream << "New HCAL PFCorrs set" << std::endl;
330  }
331 }
332 
335  fRecord.get (item);
336 
337  mTimeCorrs.reset( new HcalTimeCorrs(*item) );
338 
340  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
341  const HcalTopology* topo=&(*htopo);
342  mTimeCorrs->setTopo(topo);
343 
344  mService->setData (mTimeCorrs.get());
345  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TimeCorrs")) != mDumpRequest.end()) {
346  *mDumpStream << "New HCAL TimeCorrs set" << std::endl;
348  }
349 }
350 
353  fRecord.get (item);
354 
355  mZSThresholds.reset( new HcalZSThresholds(*item) );
356 
358  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
359  const HcalTopology* topo=&(*htopo);
360  mZSThresholds->setTopo(topo);
361 
362  mService->setData (mZSThresholds.get());
363  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ZSThresholds")) != mDumpRequest.end()) {
364  *mDumpStream << "New HCAL ZSThresholds set" << std::endl;
366  }
367 }
368 
371  fRecord.get (item);
372 
373  mL1TriggerObjects.reset( new HcalL1TriggerObjects(*item) );
374 
376  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
377  const HcalTopology* topo=&(*htopo);
378  mL1TriggerObjects->setTopo(topo);
379 
380  mService->setData (mL1TriggerObjects.get());
381  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("L1TriggerObjects")) != mDumpRequest.end()) {
382  *mDumpStream << "New HCAL L1TriggerObjects set" << std::endl;
384  }
385 }
386 
389  fRecord.get (item);
390  mService->setData (item.product ());
391  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
392  *mDumpStream << "New HCAL Electronics Map set" << std::endl;
394  }
395 }
396 
399  fRecord.get (item);
400  mService->setData (item.product ());
401  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("FrontEndMap")) != mDumpRequest.end()) {
402  *mDumpStream << "New HCAL FrontEnd Map set" << std::endl;
404  }
405 }
406 
409  fRecord.get (item);
410 
411  mLutMetadata.reset( new HcalLutMetadata(*item) );
412 
414  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
415  const HcalTopology* topo=&(*htopo);
416  mLutMetadata->setTopo(topo);
417 
418  mService->setData (mLutMetadata.get());
419  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LutMetadata")) != mDumpRequest.end()) {
420  *mDumpStream << "New HCAL LUT Metadata set" << std::endl;
422  }
423 }
424 
427  fRecord.get (item);
428 
429  mSiPMParameters.reset( new HcalSiPMParameters(*item) );
430 
432  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
433  const HcalTopology* topo=&(*htopo);
434  mSiPMParameters->setTopo(topo);
435 
436  mService->setData (mSiPMParameters.get());
437  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("SiPMParameters")) != mDumpRequest.end()) {
438  *mDumpStream << "New HCAL SiPMParameters set" << std::endl;
440  }
441 }
442 
445  fRecord.get (item);
446  mService->setData (item.product ());
447  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("SiPMCharacteristics")) != mDumpRequest.end()) {
448  *mDumpStream << "New HCAL SiPMCharacteristics set" << std::endl;
450  }
451 }
452 
455  fRecord.get (item);
456 
457  mTPChannelParameters.reset( new HcalTPChannelParameters(*item) );
458 
460  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
461  const HcalTopology* topo=&(*htopo);
462  mTPChannelParameters->setTopo(topo);
463 
464  mService->setData (mTPChannelParameters.get());
465  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TPChannelParameters")) != mDumpRequest.end()) {
466  *mDumpStream << "New HCAL TPChannelParameters set" << std::endl;
468  }
469 }
470 
472 
474  fRecord.get (item);
475  mService->setData (item.product ());
476  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TPParameters")) != mDumpRequest.end()) {
477  *mDumpStream << "New HCAL TPParameters set" << std::endl;
479  }
480 }
481 
482 
485  fRecord.get (item);
486 
487  mMCParams.reset( new HcalMCParams(*item) );
488 
490  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
491  const HcalTopology* topo=&(*htopo);
492  mMCParams->setTopo(topo);
493 
494  mService->setData (mMCParams.get());
495  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("MCParams")) != mDumpRequest.end()) {
496  *mDumpStream << "New HCAL MCParams set" << std::endl;
498  }
499 }
500 
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< HcalGainWidths > mGainWidths
HcalDbProducer(const edm::ParameterSet &)
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)