test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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).
64  )
65  );
66 
68  //now do what ever other initialization is needed
69 
70  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
71  if (!mDumpRequest.empty()) {
72  std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
73  mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
74  }
75 }
76 
77 
79 {
80 
81  // do anything here that needs to be done at desctruction time
82  // (e.g. close files, deallocate resources etc.)
83  if (mDumpStream != &std::cout) delete mDumpStream;
84 }
85 
86 
87 //
88 // member functions
89 //
90 
91 // ------------ method called to produce the data ------------
92 boost::shared_ptr<HcalDbService> HcalDbProducer::produce( const HcalDbRecord&)
93 {
94  return mService;
95 }
96 
99  fRecord.get (item);
100 
101  mPedestals.reset( new HcalPedestals(*item) );
102 
104  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
105  const HcalTopology* topo=&(*htopo);
106  mPedestals->setTopo(topo);
107 
108 
109  mService->setData (mPedestals.get());
110  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
111  *mDumpStream << "New HCAL Pedestals set" << std::endl;
113  }
114 }
115 
116 boost::shared_ptr<HcalChannelQuality> HcalDbProducer::produceChannelQualityWithTopo(const HcalChannelQualityRcd& fRecord)
117 {
119  fRecord.get (item);
120 
121  boost::shared_ptr<HcalChannelQuality> channelQuality( new HcalChannelQuality(*item) );
122 
124  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
125  const HcalTopology* topo=&(*htopo);
126  channelQuality->setTopo(topo);
127 
128  return channelQuality;
129 }
130 
133  fRecord.get (item);
134 
135  mPedestalWidths.reset( new HcalPedestalWidths(*item));
136 
138  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
139  const HcalTopology* topo=&(*htopo);
140  mPedestalWidths->setTopo(topo);
141 
142  mService->setData (mPedestalWidths.get());
143  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
144  *mDumpStream << "New HCAL PedestalWidths set" << std::endl;
146  }
147 }
148 
149 
152  fRecord.get (item);
153 
154  mGains.reset( new HcalGains(*item) );
156  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
157  const HcalTopology* topo=&(*htopo);
158  mGains->setTopo(topo);
159 
160 
161  mService->setData (mGains.get());
162  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
163  *mDumpStream << "New HCAL Gains set" << std::endl;
165  }
166 }
167 
168 
171  fRecord.get (item);
172 
173  mGainWidths.reset( new HcalGainWidths(*item));
175  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
176  const HcalTopology* topo=&(*htopo);
177  mGainWidths->setTopo(topo);
178 
179 
180  mService->setData (mGainWidths.get());
181  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
182  *mDumpStream << "New HCAL GainWidths set" << std::endl;
184  }
185 }
186 
189  fRecord.get (item);
190 
191  mQIEData.reset( new HcalQIEData(*item));
192 
193 
195  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
196  const HcalTopology* topo=&(*htopo);
197  mQIEData->setTopo(topo);
198 
199  mService->setData (mQIEData.get());
200  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
201  *mDumpStream << "New HCAL QIEData set" << std::endl;
203  }
204 }
205 
208  fRecord.get (item);
209 
210  mQIETypes.reset( new HcalQIETypes(*item) );
211 
213  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
214  const HcalTopology* topo=&(*htopo);
215  mQIETypes->setTopo(topo);
216 
217  mService->setData (mQIETypes.get());
218  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIETypes")) != mDumpRequest.end()) {
219  *mDumpStream << "New HCAL QIETypes set" << std::endl;
221  }
222 }
223 
226  fRecord.get ("withTopo", item );
227 
228  mService->setData (item.product());
229  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
230  *mDumpStream << "New HCAL ChannelQuality set" << std::endl;
232  }
233 }
234 
237  fRecord.get (item);
238 
239  mRespCorrs.reset( new HcalRespCorrs(*item) );
240 
242  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
243  const HcalTopology* topo=&(*htopo);
244  mRespCorrs->setTopo(topo);
245 
246  mService->setData (mRespCorrs.get());
247  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RespCorrs")) != mDumpRequest.end()) {
248  *mDumpStream << "New HCAL RespCorrs set" << std::endl;
250  }
251 }
252 
255  fRecord.get (item);
256 
257  mLUTCorrs.reset( new HcalLUTCorrs(*item) );
258 
260  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
261  const HcalTopology* topo=&(*htopo);
262  mLUTCorrs->setTopo(topo);
263 
264  mService->setData (mLUTCorrs.get());
265  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LUTCorrs")) != mDumpRequest.end()) {
266  *mDumpStream << "New HCAL LUTCorrs set" << std::endl;
268  }
269 }
270 
273  fRecord.get (item);
274 
275  mPFCorrs.reset( new HcalPFCorrs(*item) );
276 
278  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
279  const HcalTopology* topo=&(*htopo);
280  mPFCorrs->setTopo(topo);
281 
282  mService->setData (mPFCorrs.get());
283  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PFCorrs")) != mDumpRequest.end()) {
284  *mDumpStream << "New HCAL PFCorrs set" << std::endl;
286  }
287 }
288 
291  fRecord.get (item);
292 
293  mTimeCorrs.reset( new HcalTimeCorrs(*item) );
294 
296  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
297  const HcalTopology* topo=&(*htopo);
298  mTimeCorrs->setTopo(topo);
299 
300  mService->setData (mTimeCorrs.get());
301  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TimeCorrs")) != mDumpRequest.end()) {
302  *mDumpStream << "New HCAL TimeCorrs set" << std::endl;
304  }
305 }
306 
309  fRecord.get (item);
310 
311  mZSThresholds.reset( new HcalZSThresholds(*item) );
312 
314  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
315  const HcalTopology* topo=&(*htopo);
316  mZSThresholds->setTopo(topo);
317 
318  mService->setData (mZSThresholds.get());
319  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ZSThresholds")) != mDumpRequest.end()) {
320  *mDumpStream << "New HCAL ZSThresholds set" << std::endl;
322  }
323 }
324 
327  fRecord.get (item);
328 
329  mL1TriggerObjects.reset( new HcalL1TriggerObjects(*item) );
330 
332  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
333  const HcalTopology* topo=&(*htopo);
334  mL1TriggerObjects->setTopo(topo);
335 
336  mService->setData (mL1TriggerObjects.get());
337  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("L1TriggerObjects")) != mDumpRequest.end()) {
338  *mDumpStream << "New HCAL L1TriggerObjects set" << std::endl;
340  }
341 }
342 
345  fRecord.get (item);
346  mService->setData (item.product ());
347  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
348  *mDumpStream << "New HCAL Electronics Map set" << std::endl;
350  }
351 }
352 
355  fRecord.get (item);
356 
357  mLutMetadata.reset( new HcalLutMetadata(*item) );
358 
360  fRecord.getRecord<HcalRecNumberingRecord>().get(htopo);
361  const HcalTopology* topo=&(*htopo);
362  mLutMetadata->setTopo(topo);
363 
364  mService->setData (mLutMetadata.get());
365  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LutMetadata")) != mDumpRequest.end()) {
366  *mDumpStream << "New HCAL LUT Metadata set" << std::endl;
368  }
369 }
370 
371 
372 
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 electronicsMapCallback(const HcalElectronicsMapRcd &fRecord)
std::unique_ptr< HcalZSThresholds > mZSThresholds
std::unique_ptr< HcalRespCorrs > mRespCorrs
std::unique_ptr< HcalGainWidths > mGainWidths
HcalDbProducer(const edm::ParameterSet &)
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:7
std::unique_ptr< HcalPedestals > mPedestals
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
void gainWidthsCallback(const HcalGainWidthsRcd &fRecord)
void QIEDataCallback(const HcalQIEDataRcd &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
boost::shared_ptr< HcalDbService > mService
std::unique_ptr< HcalTimeCorrs > mTimeCorrs
void respCorrsCallback(const HcalRespCorrsRcd &fRecord)
void QIETypesCallback(const HcalQIETypesRcd &fRecord)
std::unique_ptr< HcalQIETypes > mQIETypes
std::unique_ptr< HcalLUTCorrs > mLUTCorrs
std::unique_ptr< HcalPedestalWidths > mPedestalWidths
void gainsCallback(const HcalGainsRcd &fRecord)
std::unique_ptr< HcalLutMetadata > mLutMetadata
void zsThresholdsCallback(const HcalZSThresholdsRcd &fRecord)
T const * product() const
Definition: ESHandle.h:86
void timeCorrsCallback(const HcalTimeCorrsRcd &fRecord)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
boost::shared_ptr< HcalDbService > produce(const HcalDbRecord &)
std::unique_ptr< HcalL1TriggerObjects > mL1TriggerObjects
tuple cout
Definition: gather_cfg.py:145
std::ostream * mDumpStream
void pedestalWidthsCallback(const HcalPedestalWidthsRcd &fRecord)
boost::shared_ptr< HcalChannelQuality > produceChannelQualityWithTopo(const HcalChannelQualityRcd &)
void lutMetadataCallback(const HcalLutMetadataRcd &fRecord)