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(0)
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).
70  )
71  );
72 
74  //now do what ever other initialization is needed
75 
76  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
77  if (!mDumpRequest.empty()) {
78  std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
79  mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
80  }
81 }
82 
83 
85 
86  // do anything here that needs to be done at desctruction time
87  // (e.g. close files, deallocate resources etc.)
88  if (mDumpStream != &std::cout) delete mDumpStream;
89 }
90 
91 
92 //
93 // member functions
94 //
95 
96 // ------------ method called to produce the data ------------
97 std::shared_ptr<HcalDbService> HcalDbProducer::produce( const HcalDbRecord&)
98 {
99  return mService;
100 }
101 
104  fRecord.get (item);
105 
106  mPedestals.reset( new HcalPedestals(*item) );
107 
109  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
110  const HcalTopology* topo=&(*htopo);
111  mPedestals->setTopo(topo);
112 
113 
114  mService->setData (mPedestals.get());
115  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
116  *mDumpStream << "New HCAL Pedestals set" << std::endl;
118  }
119 }
120 
121 std::shared_ptr<HcalChannelQuality> HcalDbProducer::produceChannelQualityWithTopo(const HcalChannelQualityRcd& fRecord)
122 {
124  fRecord.get (item);
125 
126  auto channelQuality = std::make_shared<HcalChannelQuality>(*item);
127 
129  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
130  const HcalTopology* topo=&(*htopo);
131  channelQuality->setTopo(topo);
132 
133  return channelQuality;
134 }
135 
138  fRecord.get (item);
139 
140  mPedestalWidths.reset( new HcalPedestalWidths(*item));
141 
143  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
144  const HcalTopology* topo=&(*htopo);
145  mPedestalWidths->setTopo(topo);
146 
147  mService->setData (mPedestalWidths.get());
148  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
149  *mDumpStream << "New HCAL PedestalWidths set" << std::endl;
151  }
152 }
153 
154 
157  fRecord.get (item);
158 
159  mGains.reset( new HcalGains(*item) );
161  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
162  const HcalTopology* topo=&(*htopo);
163  mGains->setTopo(topo);
164 
165 
166  mService->setData (mGains.get());
167  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
168  *mDumpStream << "New HCAL Gains set" << std::endl;
170  }
171 }
172 
173 
176  fRecord.get (item);
177 
178  mGainWidths.reset( new HcalGainWidths(*item));
180  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
181  const HcalTopology* topo=&(*htopo);
182  mGainWidths->setTopo(topo);
183 
184 
185  mService->setData (mGainWidths.get());
186  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
187  *mDumpStream << "New HCAL GainWidths set" << std::endl;
189  }
190 }
191 
194  fRecord.get (item);
195 
196  mQIEData.reset( new HcalQIEData(*item));
197 
198 
200  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
201  const HcalTopology* topo=&(*htopo);
202  mQIEData->setTopo(topo);
203 
204  mService->setData (mQIEData.get());
205  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
206  *mDumpStream << "New HCAL QIEData set" << std::endl;
208  }
209 }
210 
213  fRecord.get (item);
214 
215  mQIETypes.reset( new HcalQIETypes(*item) );
216 
218  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
219  const HcalTopology* topo=&(*htopo);
220  mQIETypes->setTopo(topo);
221 
222  mService->setData (mQIETypes.get());
223  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIETypes")) != mDumpRequest.end()) {
224  *mDumpStream << "New HCAL QIETypes set" << std::endl;
226  }
227 }
228 
231  fRecord.get ("withTopo", item );
232 
233  mService->setData (item.product());
234  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
235  *mDumpStream << "New HCAL ChannelQuality set" << std::endl;
237  }
238 }
239 
242  fRecord.get (item);
243 
244  mRespCorrs.reset( new HcalRespCorrs(*item) );
245 
247  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
248  const HcalTopology* topo=&(*htopo);
249  mRespCorrs->setTopo(topo);
250 
251  mService->setData (mRespCorrs.get());
252  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RespCorrs")) != mDumpRequest.end()) {
253  *mDumpStream << "New HCAL RespCorrs set" << std::endl;
255  }
256 }
257 
260  fRecord.get (item);
261 
262  mLUTCorrs.reset( new HcalLUTCorrs(*item) );
263 
265  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
266  const HcalTopology* topo=&(*htopo);
267  mLUTCorrs->setTopo(topo);
268 
269  mService->setData (mLUTCorrs.get());
270  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LUTCorrs")) != mDumpRequest.end()) {
271  *mDumpStream << "New HCAL LUTCorrs set" << std::endl;
273  }
274 }
275 
278  fRecord.get (item);
279 
280  mPFCorrs.reset( new HcalPFCorrs(*item) );
281 
283  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
284  const HcalTopology* topo=&(*htopo);
285  mPFCorrs->setTopo(topo);
286 
287  mService->setData (mPFCorrs.get());
288  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PFCorrs")) != mDumpRequest.end()) {
289  *mDumpStream << "New HCAL PFCorrs set" << std::endl;
291  }
292 }
293 
296  fRecord.get (item);
297 
298  mTimeCorrs.reset( new HcalTimeCorrs(*item) );
299 
301  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
302  const HcalTopology* topo=&(*htopo);
303  mTimeCorrs->setTopo(topo);
304 
305  mService->setData (mTimeCorrs.get());
306  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TimeCorrs")) != mDumpRequest.end()) {
307  *mDumpStream << "New HCAL TimeCorrs set" << std::endl;
309  }
310 }
311 
314  fRecord.get (item);
315 
316  mZSThresholds.reset( new HcalZSThresholds(*item) );
317 
319  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
320  const HcalTopology* topo=&(*htopo);
321  mZSThresholds->setTopo(topo);
322 
323  mService->setData (mZSThresholds.get());
324  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ZSThresholds")) != mDumpRequest.end()) {
325  *mDumpStream << "New HCAL ZSThresholds set" << std::endl;
327  }
328 }
329 
332  fRecord.get (item);
333 
334  mL1TriggerObjects.reset( new HcalL1TriggerObjects(*item) );
335 
337  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
338  const HcalTopology* topo=&(*htopo);
339  mL1TriggerObjects->setTopo(topo);
340 
341  mService->setData (mL1TriggerObjects.get());
342  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("L1TriggerObjects")) != mDumpRequest.end()) {
343  *mDumpStream << "New HCAL L1TriggerObjects set" << std::endl;
345  }
346 }
347 
350  fRecord.get (item);
351  mService->setData (item.product ());
352  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
353  *mDumpStream << "New HCAL Electronics Map set" << std::endl;
355  }
356 }
357 
360  fRecord.get (item);
361  mService->setData (item.product ());
362  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("FrontEndMap")) != mDumpRequest.end()) {
363  *mDumpStream << "New HCAL FrontEnd Map set" << std::endl;
365  }
366 }
367 
370  fRecord.get (item);
371 
372  mLutMetadata.reset( new HcalLutMetadata(*item) );
373 
375  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
376  const HcalTopology* topo=&(*htopo);
377  mLutMetadata->setTopo(topo);
378 
379  mService->setData (mLutMetadata.get());
380  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LutMetadata")) != mDumpRequest.end()) {
381  *mDumpStream << "New HCAL LUT Metadata set" << std::endl;
383  }
384 }
385 
388  fRecord.get (item);
389 
390  mSiPMParameters.reset( new HcalSiPMParameters(*item) );
391 
393  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
394  const HcalTopology* topo=&(*htopo);
395  mSiPMParameters->setTopo(topo);
396 
397  mService->setData (mSiPMParameters.get());
398  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("SiPMParameters")) != mDumpRequest.end()) {
399  *mDumpStream << "New HCAL SiPMParameters set" << std::endl;
401  }
402 }
403 
406  fRecord.get (item);
407  mService->setData (item.product ());
408  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("SiPMCharacteristics")) != mDumpRequest.end()) {
409  *mDumpStream << "New HCAL SiPMCharacteristics set" << std::endl;
411  }
412 }
413 
416  fRecord.get (item);
417 
418  mTPChannelParameters.reset( new HcalTPChannelParameters(*item) );
419 
421  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
422  const HcalTopology* topo=&(*htopo);
423  mTPChannelParameters->setTopo(topo);
424 
425  mService->setData (mTPChannelParameters.get());
426  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TPChannelParameters")) != mDumpRequest.end()) {
427  *mDumpStream << "New HCAL TPChannelParameters set" << std::endl;
429  }
430 }
431 
433 
435  fRecord.get (item);
436  mService->setData (item.product ());
437  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TPParameters")) != mDumpRequest.end()) {
438  *mDumpStream << "New HCAL TPParameters set" << std::endl;
440  }
441 }
442 
443 
446  fRecord.get (item);
447 
448  mMCParams.reset( new HcalMCParams(*item) );
449 
451  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
452  const HcalTopology* topo=&(*htopo);
453  mMCParams->setTopo(topo);
454 
455  mService->setData (mMCParams.get());
456  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("MCParams")) != mDumpRequest.end()) {
457  *mDumpStream << "New HCAL MCParams set" << std::endl;
459  }
460 }
461 
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)
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
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)
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 &)
T const * product() const
Definition: ESHandle.h:86
std::unique_ptr< HcalSiPMParameters > mSiPMParameters
void lutMetadataCallback(const HcalLutMetadataRcd &fRecord)