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.27 2009/10/16 22:12:57 kukartse 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  mService->setData (item.product ());
100  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Pedestals")) != mDumpRequest.end()) {
101  *mDumpStream << "New HCAL Pedestals set" << std::endl;
103  }
104 }
105 
108  fRecord.get (item);
109  mService->setData (item.product ());
110  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PedestalWidths")) != mDumpRequest.end()) {
111  *mDumpStream << "New HCAL PedestalWidths set" << std::endl;
113  }
114 }
115 
116 
119  fRecord.get (item);
120  mService->setData (item.product ());
121  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("Gains")) != mDumpRequest.end()) {
122  *mDumpStream << "New HCAL Gains set" << std::endl;
124  }
125 }
126 
127 
130  fRecord.get (item);
131  mService->setData (item.product ());
132  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("GainWidths")) != mDumpRequest.end()) {
133  *mDumpStream << "New HCAL GainWidths set" << std::endl;
135  }
136 }
137 
140  fRecord.get (item);
141  mService->setData (item.product ());
142  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("QIEData")) != mDumpRequest.end()) {
143  *mDumpStream << "New HCAL QIEData set" << std::endl;
145  }
146 }
147 
150  fRecord.get (item);
151  mService->setData (item.product ());
152  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ChannelQuality")) != mDumpRequest.end()) {
153  *mDumpStream << "New HCAL ChannelQuality set" << std::endl;
155  }
156 }
157 
160  fRecord.get (item);
161  mService->setData (item.product ());
162  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("RespCorrs")) != mDumpRequest.end()) {
163  *mDumpStream << "New HCAL RespCorrs set" << std::endl;
165  }
166 }
167 
170  fRecord.get (item);
171  mService->setData (item.product ());
172  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LUTCorrs")) != mDumpRequest.end()) {
173  *mDumpStream << "New HCAL LUTCorrs set" << std::endl;
175  }
176 }
177 
180  fRecord.get (item);
181  mService->setData (item.product ());
182  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("PFCorrs")) != mDumpRequest.end()) {
183  *mDumpStream << "New HCAL PFCorrs set" << std::endl;
185  }
186 }
187 
190  fRecord.get (item);
191  mService->setData (item.product ());
192  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("TimeCorrs")) != mDumpRequest.end()) {
193  *mDumpStream << "New HCAL TimeCorrs set" << std::endl;
195  }
196 }
197 
200  fRecord.get (item);
201  mService->setData (item.product ());
202  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ZSThresholds")) != mDumpRequest.end()) {
203  *mDumpStream << "New HCAL ZSThresholds set" << std::endl;
205  }
206 }
207 
210  fRecord.get (item);
211  mService->setData (item.product ());
212  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("L1TriggerObjects")) != mDumpRequest.end()) {
213  *mDumpStream << "New HCAL L1TriggerObjects set" << std::endl;
215  }
216 }
217 
220  fRecord.get (item);
221  mService->setData (item.product ());
222  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("ElectronicsMap")) != mDumpRequest.end()) {
223  *mDumpStream << "New HCAL Electronics Map set" << std::endl;
225  }
226 }
227 
230  fRecord.get (item);
231  mService->setData (item.product ());
232  if (std::find (mDumpRequest.begin(), mDumpRequest.end(), std::string ("LutMetadata")) != mDumpRequest.end()) {
233  *mDumpStream << "New HCAL LUT Metadata set" << std::endl;
235  }
236 }
237 
238 
239 
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)