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 
25 
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).
63  )
64  );
65 
66  //now do what ever other initialization is needed
67 
68  mDumpRequest = fConfig.getUntrackedParameter <std::vector <std::string> > ("dump", std::vector<std::string>());
69  if (!mDumpRequest.empty()) {
70  std::string otputFile = fConfig.getUntrackedParameter <std::string> ("file", "");
71  mDumpStream = otputFile.empty () ? &std::cout : new std::ofstream (otputFile.c_str());
72  }
73 }
74 
75 
77 {
78 
79  // do anything here that needs to be done at desctruction time
80  // (e.g. close files, deallocate resources etc.)
81  if (mDumpStream != &std::cout) delete mDumpStream;
82 }
83 
84 
85 //
86 // member functions
87 //
88 
89 // ------------ method called to produce the data ------------
90 boost::shared_ptr<HcalDbService> HcalDbProducer::produce( const HcalDbRecord&)
91 {
92  return mService;
93 }
94 
97  fRecord.get (item);
98 
99  if (item->topo()==0) {
101  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
102  const HcalTopology* topo=&(*htopo);
103  item->setTopo(topo);
104  }
105 
106  mService->setData (item.product ());
107  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
108  *mDumpStream << "New HCAL Pedestals set" << std::endl;
110  }
111 }
112 
115  fRecord.get (item);
116 
117  if (item->topo()==0) {
119  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
120  const HcalTopology* topo=&(*htopo);
121  item->setTopo(topo);
122  }
123 
124  mService->setData (item.product ());
125  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
126  *mDumpStream << "New HCAL PedestalWidths set" << std::endl;
128  }
129 }
130 
131 
134  fRecord.get (item);
135 
136  if (item->topo()==0) {
138  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
139  const HcalTopology* topo=&(*htopo);
140  item->setTopo(topo);
141  }
142 
143  mService->setData (item.product ());
144  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
145  *mDumpStream << "New HCAL Gains set" << std::endl;
147  }
148 }
149 
150 
153  fRecord.get (item);
154 
155  if (item->topo()==0) {
157  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
158  const HcalTopology* topo=&(*htopo);
159  item->setTopo(topo);
160  }
161 
162  mService->setData (item.product ());
163  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
164  *mDumpStream << "New HCAL GainWidths set" << std::endl;
166  }
167 }
168 
171  fRecord.get (item);
172 
173  if (item->topo()==0) {
175  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
176  const HcalTopology* topo=&(*htopo);
177  item->setTopo(topo);
178  }
179 
180  mService->setData (item.product ());
181  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
182  *mDumpStream << "New HCAL QIEData set" << std::endl;
184  }
185 }
186 
189  fRecord.get (item);
190 
191  if (item->topo()==0) {
193  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
194  const HcalTopology* topo=&(*htopo);
195  item->setTopo(topo);
196  }
197 
198  mService->setData (item.product ());
199  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
200  *mDumpStream << "New HCAL ChannelQuality set" << std::endl;
202  }
203 }
204 
207  fRecord.get (item);
208 
209  if (item->topo()==0) {
211  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
212  const HcalTopology* topo=&(*htopo);
213  item->setTopo(topo);
214  }
215 
216  mService->setData (item.product ());
217  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RespCorrs")) != mDumpRequest.end()) {
218  *mDumpStream << "New HCAL RespCorrs set" << std::endl;
220  }
221 }
222 
225  fRecord.get (item);
226 
227  if (item->topo()==0) {
229  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
230  const HcalTopology* topo=&(*htopo);
231  item->setTopo(topo);
232  }
233 
234  mService->setData (item.product ());
235  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LUTCorrs")) != mDumpRequest.end()) {
236  *mDumpStream << "New HCAL LUTCorrs set" << std::endl;
238  }
239 }
240 
243  fRecord.get (item);
244 
245  if (item->topo()==0) {
247  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
248  const HcalTopology* topo=&(*htopo);
249  item->setTopo(topo);
250  }
251 
252  mService->setData (item.product ());
253  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PFCorrs")) != mDumpRequest.end()) {
254  *mDumpStream << "New HCAL PFCorrs set" << std::endl;
256  }
257 }
258 
261  fRecord.get (item);
262 
263  if (item->topo()==0) {
265  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
266  const HcalTopology* topo=&(*htopo);
267  item->setTopo(topo);
268  }
269 
270  mService->setData (item.product ());
271  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TimeCorrs")) != mDumpRequest.end()) {
272  *mDumpStream << "New HCAL TimeCorrs set" << std::endl;
274  }
275 }
276 
279  fRecord.get (item);
280 
281  if (item->topo()==0) {
283  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
284  const HcalTopology* topo=&(*htopo);
285  item->setTopo(topo);
286  }
287 
288  mService->setData (item.product ());
289  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ZSThresholds")) != mDumpRequest.end()) {
290  *mDumpStream << "New HCAL ZSThresholds set" << std::endl;
292  }
293 }
294 
297  fRecord.get (item);
298 
299  if (item->topo()==0) {
301  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
302  const HcalTopology* topo=&(*htopo);
303  item->setTopo(topo);
304  }
305 
306  mService->setData (item.product ());
307  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("L1TriggerObjects")) != mDumpRequest.end()) {
308  *mDumpStream << "New HCAL L1TriggerObjects set" << std::endl;
310  }
311 }
312 
315  fRecord.get (item);
316  mService->setData (item.product ());
317  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
318  *mDumpStream << "New HCAL Electronics Map set" << std::endl;
320  }
321 }
322 
325  fRecord.get (item);
326 
327  if (item->topo()==0) {
329  fRecord.getRecord<IdealGeometryRecord>().get(htopo);
330  const HcalTopology* topo=&(*htopo);
331  item->setTopo(topo);
332  }
333 
334  mService->setData (item.product ());
335  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LutMetadata")) != mDumpRequest.end()) {
336  *mDumpStream << "New HCAL LUT Metadata set" << std::endl;
338  }
339 }
340 
341 
342 
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)