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 // $Id: HcalDbProducer.cc,v 1.28 2012/11/12 20:42:39 dlange Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <iostream>
23 #include <fstream>
24 
26 
30 
31 
33 
34 #include "HcalDbProducer.h"
35 
37  : ESProducer(),
38  mService (new HcalDbService (fConfig)),
39  mDumpRequest (),
40  mDumpStream(0)
41 {
42  //the following line is needed to tell the framework what data is being produced
43  // comments of dependsOn:
44  // 1) There are two ways one can use 'dependsOn' the first is passing it up to three arguments.
45  // However, one can also extend the dependencies by first calling 'dependsOn() and then using '&' to add additional dependencies. So
46  // dependsOn(&FooProd::func1, &FooProd::func2, &FooProd::func3)
47  // gives the same result as
48  // dependsOn(&FooProd::func1) & (&FooProd::func2) & (&FooProd::func3)
49  // 2) Upon IOV change, all callbacks are called, in the inverse order of their specification below (tested).
64  )
65  );
66 
67  //now do what ever other initialization is needed
68 
69  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
70  if (!mDumpRequest.empty()) {
71  std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
72  mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
73  }
74 }
75 
76 
78 {
79 
80  // do anything here that needs to be done at desctruction time
81  // (e.g. close files, deallocate resources etc.)
82  if (mDumpStream != &std::cout) delete mDumpStream;
83 }
84 
85 
86 //
87 // member functions
88 //
89 
90 // ------------ method called to produce the data ------------
91 boost::shared_ptr<HcalDbService> HcalDbProducer::produce( const HcalDbRecord&)
92 {
93  return mService;
94 }
95 
98  fRecord.get (item);
99 
100  if (item->topo()==0) {
102  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
103  const HcalTopology* topo=&(*htopo);
104  item->setTopo(topo);
105  }
106 
107  mService->setData (item.product ());
108  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
109  *mDumpStream << "New HCAL Pedestals set" << std::endl;
111  }
112 }
113 
116  fRecord.get (item);
117 
118  if (item->topo()==0) {
120  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
121  const HcalTopology* topo=&(*htopo);
122  item->setTopo(topo);
123  }
124 
125  mService->setData (item.product ());
126  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
127  *mDumpStream << "New HCAL PedestalWidths set" << std::endl;
129  }
130 }
131 
132 
135  fRecord.get (item);
136 
137  if (item->topo()==0) {
139  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
140  const HcalTopology* topo=&(*htopo);
141  item->setTopo(topo);
142  }
143 
144  mService->setData (item.product ());
145  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
146  *mDumpStream << "New HCAL Gains set" << std::endl;
148  }
149 }
150 
151 
154  fRecord.get (item);
155 
156  if (item->topo()==0) {
158  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
159  const HcalTopology* topo=&(*htopo);
160  item->setTopo(topo);
161  }
162 
163  mService->setData (item.product ());
164  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
165  *mDumpStream << "New HCAL GainWidths set" << std::endl;
167  }
168 }
169 
172  fRecord.get (item);
173 
174  if (item->topo()==0) {
176  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
177  const HcalTopology* topo=&(*htopo);
178  item->setTopo(topo);
179  }
180 
181  mService->setData (item.product ());
182  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
183  *mDumpStream << "New HCAL QIEData set" << std::endl;
185  }
186 }
187 
190  fRecord.get (item);
191 
192  if (item->topo()==0) {
194  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
195  const HcalTopology* topo=&(*htopo);
196  item->setTopo(topo);
197  }
198 
199  mService->setData (item.product ());
200  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
201  *mDumpStream << "New HCAL ChannelQuality set" << std::endl;
203  }
204 }
205 
208  fRecord.get (item);
209 
210  if (item->topo()==0) {
212  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
213  const HcalTopology* topo=&(*htopo);
214  item->setTopo(topo);
215  }
216 
217  mService->setData (item.product ());
218  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RespCorrs")) != mDumpRequest.end()) {
219  *mDumpStream << "New HCAL RespCorrs set" << std::endl;
221  }
222 }
223 
226  fRecord.get (item);
227 
228  if (item->topo()==0) {
230  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
231  const HcalTopology* topo=&(*htopo);
232  item->setTopo(topo);
233  }
234 
235  mService->setData (item.product ());
236  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LUTCorrs")) != mDumpRequest.end()) {
237  *mDumpStream << "New HCAL LUTCorrs set" << std::endl;
239  }
240 }
241 
244  fRecord.get (item);
245 
246  if (item->topo()==0) {
248  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
249  const HcalTopology* topo=&(*htopo);
250  item->setTopo(topo);
251  }
252 
253  mService->setData (item.product ());
254  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PFCorrs")) != mDumpRequest.end()) {
255  *mDumpStream << "New HCAL PFCorrs set" << std::endl;
257  }
258 }
259 
262  fRecord.get (item);
263 
264  if (item->topo()==0) {
266  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
267  const HcalTopology* topo=&(*htopo);
268  item->setTopo(topo);
269  }
270 
271  mService->setData (item.product ());
272  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TimeCorrs")) != mDumpRequest.end()) {
273  *mDumpStream << "New HCAL TimeCorrs set" << std::endl;
275  }
276 }
277 
280  fRecord.get (item);
281 
282  if (item->topo()==0) {
284  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
285  const HcalTopology* topo=&(*htopo);
286  item->setTopo(topo);
287  }
288 
289  mService->setData (item.product ());
290  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ZSThresholds")) != mDumpRequest.end()) {
291  *mDumpStream << "New HCAL ZSThresholds set" << std::endl;
293  }
294 }
295 
298  fRecord.get (item);
299 
300  if (item->topo()==0) {
302  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
303  const HcalTopology* topo=&(*htopo);
304  item->setTopo(topo);
305  }
306 
307  mService->setData (item.product ());
308  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("L1TriggerObjects")) != mDumpRequest.end()) {
309  *mDumpStream << "New HCAL L1TriggerObjects set" << std::endl;
311  }
312 }
313 
316  fRecord.get (item);
317  mService->setData (item.product ());
318  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
319  *mDumpStream << "New HCAL Electronics Map set" << std::endl;
321  }
322 }
323 
326  fRecord.get (item);
327 
328  if (item->topo()==0) {
330  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
331  const HcalTopology* topo=&(*htopo);
332  item->setTopo(topo);
333  }
334 
335  mService->setData (item.product ());
336  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LutMetadata")) != mDumpRequest.end()) {
337  *mDumpStream << "New HCAL LUT Metadata set" << std::endl;
339  }
340 }
341 
342 
343 
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)
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
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)
void get(HolderT &iHolder) const
void PFCorrsCallback(const HcalPFCorrsRcd &fRecord)
void channelQualityCallback(const HcalChannelQualityRcd &fRecord)
boost::shared_ptr< HcalDbService > mService
void respCorrsCallback(const HcalRespCorrsRcd &fRecord)
void gainsCallback(const HcalGainsRcd &fRecord)
void zsThresholdsCallback(const HcalZSThresholdsRcd &fRecord)
T const * product() const
Definition: ESHandle.h:62
void timeCorrsCallback(const HcalTimeCorrsRcd &fRecord)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
boost::shared_ptr< HcalDbService > produce(const HcalDbRecord &)
tuple cout
Definition: gather_cfg.py:121
std::ostream * mDumpStream
void pedestalWidthsCallback(const HcalPedestalWidthsRcd &fRecord)
void lutMetadataCallback(const HcalLutMetadataRcd &fRecord)