CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalTextCalibrations.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Original Author: Fedor Ratnikov
3 // $Id: HcalTextCalibrations.cc,v 1.21 2011/10/26 14:00:29 xiezhen Exp $
4 //
5 //
6 
7 #include <memory>
8 #include <iostream>
9 #include <fstream>
10 
13 
15 
17 
19 
20 #include "HcalTextCalibrations.h"
21 //
22 // class declaration
23 //
24 
25 using namespace cms;
26 
28 
29 {
30  //parsing parameters
31  std::vector<edm::ParameterSet> data = iConfig.getParameter<std::vector<edm::ParameterSet> >("input");
32  std::vector<edm::ParameterSet>::iterator request = data.begin ();
33  for (; request != data.end (); request++) {
34  std::string objectName = request->getParameter<std::string> ("object");
35  edm::FileInPath fp = request->getParameter<edm::FileInPath>("file");
36  mInputs [objectName] = fp.fullPath();
37  if (objectName == "Pedestals") {
38  setWhatProduced (this, &HcalTextCalibrations::producePedestals);
39  findingRecord <HcalPedestalsRcd> ();
40  }
41  else if (objectName == "PedestalWidths") {
42  setWhatProduced (this, &HcalTextCalibrations::producePedestalWidths);
43  findingRecord <HcalPedestalWidthsRcd> ();
44  }
45  else if (objectName == "Gains") {
46  setWhatProduced (this, &HcalTextCalibrations::produceGains);
47  findingRecord <HcalGainsRcd> ();
48  }
49  else if (objectName == "GainWidths") {
50  setWhatProduced (this, &HcalTextCalibrations::produceGainWidths);
51  findingRecord <HcalGainWidthsRcd> ();
52  }
53  else if (objectName == "QIEData") {
54  setWhatProduced (this, &HcalTextCalibrations::produceQIEData);
55  findingRecord <HcalQIEDataRcd> ();
56  }
57  else if (objectName == "ChannelQuality") {
58  setWhatProduced (this, &HcalTextCalibrations::produceChannelQuality);
59  findingRecord <HcalChannelQualityRcd> ();
60  }
61  else if (objectName == "ZSThresholds") {
62  setWhatProduced (this, &HcalTextCalibrations::produceZSThresholds);
63  findingRecord <HcalZSThresholdsRcd> ();
64  }
65  else if (objectName == "RespCorrs") {
66  setWhatProduced (this, &HcalTextCalibrations::produceRespCorrs);
67  findingRecord <HcalRespCorrsRcd> ();
68  }
69  else if (objectName == "LUTCorrs") {
70  setWhatProduced (this, &HcalTextCalibrations::produceLUTCorrs);
71  findingRecord <HcalLUTCorrsRcd> ();
72  }
73  else if (objectName == "PFCorrs") {
74  setWhatProduced (this, &HcalTextCalibrations::producePFCorrs);
75  findingRecord <HcalPFCorrsRcd> ();
76  }
77  else if (objectName == "TimeCorrs") {
78  setWhatProduced (this, &HcalTextCalibrations::produceTimeCorrs);
79  findingRecord <HcalTimeCorrsRcd> ();
80  }
81  else if (objectName == "L1TriggerObjects") {
82  setWhatProduced (this, &HcalTextCalibrations::produceL1TriggerObjects);
83  findingRecord <HcalL1TriggerObjectsRcd> ();
84  }
85  else if (objectName == "ElectronicsMap") {
86  setWhatProduced (this, &HcalTextCalibrations::produceElectronicsMap);
87  findingRecord <HcalElectronicsMapRcd> ();
88  }
89  else if (objectName == "ValidationCorrs") {
90  setWhatProduced (this, &HcalTextCalibrations::produceValidationCorrs);
91  findingRecord <HcalValidationCorrsRcd> ();
92  }
93  else if (objectName == "LutMetadata") {
94  setWhatProduced (this, &HcalTextCalibrations::produceLutMetadata);
95  findingRecord <HcalLutMetadataRcd> ();
96  }
97  else if (objectName == "DcsValues") {
98  setWhatProduced (this, &HcalTextCalibrations::produceDcsValues);
99  findingRecord <HcalDcsRcd> ();
100  }
101  else if (objectName == "DcsMap") {
102  setWhatProduced (this, &HcalTextCalibrations::produceDcsMap);
103  findingRecord <HcalDcsMapRcd> ();
104  }
105  else if (objectName == "CholeskyMatrices") {
106  setWhatProduced (this, &HcalTextCalibrations::produceCholeskyMatrices);
107  findingRecord <HcalCholeskyMatricesRcd> ();
108  }
109  else if (objectName == "CovarianceMatrices") {
110  setWhatProduced (this, &HcalTextCalibrations::produceCovarianceMatrices);
111  findingRecord <HcalCovarianceMatricesRcd> ();
112  }
113  else if (objectName == "RecoParams") {
114  setWhatProduced (this, &HcalTextCalibrations::produceRecoParams);
115  findingRecord <HcalRecoParamsRcd> ();
116  }
117  else if (objectName == "TimingParams") {
118  setWhatProduced (this, &HcalTextCalibrations::produceTimingParams);
119  findingRecord <HcalTimingParamsRcd> ();
120  }
121  else if (objectName == "LongRecoParams") {
122  setWhatProduced (this, &HcalTextCalibrations::produceLongRecoParams);
123  findingRecord <HcalLongRecoParamsRcd> ();
124  }
125  else if (objectName == "MCParams") {
126  setWhatProduced (this, &HcalTextCalibrations::produceMCParams);
127  findingRecord <HcalMCParamsRcd> ();
128  }
129  else if (objectName == "FlagHFDigiTimeParams") {
130  setWhatProduced (this, &HcalTextCalibrations::produceFlagHFDigiTimeParams);
131  findingRecord <HcalFlagHFDigiTimeParamsRcd> ();
132  }
133  else {
134  std::cerr << "HcalTextCalibrations-> Unknown object name '" << objectName
135  << "', known names are: "
136  << "Pedestals PedestalWidths Gains GainWidths QIEData ChannelQuality ElectronicsMap "
137  << "ZSThresholds RespCorrs LUTCorrs PFCorrs TimeCorrs L1TriggerObjects "
138  << "ValidationCorrs LutMetadata DcsValues DcsMap CholeskyMatrices CovarianceMatrices "
139  << "RecoParams LongRecoParams FlagHFDigiTimeParams MCParams "
140  << std::endl;
141  }
142  }
143  // setWhatProduced(this);
144 }
145 
146 
148 {
149 }
150 
151 
152 //
153 // member functions
154 //
155 void
157  std::string record = iKey.name ();
159 }
160 
161 template <class T>
162 std::auto_ptr<T> produce_impl (const std::string& fFile) {
163  std::auto_ptr<T> result (new T ());
164  // std::auto_ptr<T> result;
165  std::ifstream inStream (fFile.c_str ());
166  if (!inStream.good ()) {
167  std::cerr << "HcalTextCalibrations-> Unable to open file '" << fFile << "'" << std::endl;
168  throw cms::Exception("FileNotFound") << "Unable to open '" << fFile << "'" << std::endl;
169  }
170  if (!HcalDbASCIIIO::getObject (inStream, &*result)) {
171  std::cerr << "HcalTextCalibrations-> Can not read object from file '" << fFile << "'" << std::endl;
172  throw cms::Exception("ReadError") << "Can not read object from file '" << fFile << "'" << std::endl;
173  }
174  return result;
175 }
176 
177 
178 
179 std::auto_ptr<HcalPedestals> HcalTextCalibrations::producePedestals (const HcalPedestalsRcd&) {
180  return produce_impl<HcalPedestals> (mInputs ["Pedestals"]);
181 }
182 
183 std::auto_ptr<HcalPedestalWidths> HcalTextCalibrations::producePedestalWidths (const HcalPedestalWidthsRcd&) {
184  return produce_impl<HcalPedestalWidths> (mInputs ["PedestalWidths"]);
185 }
186 
187 std::auto_ptr<HcalGains> HcalTextCalibrations::produceGains (const HcalGainsRcd&) {
188  return produce_impl<HcalGains> (mInputs ["Gains"]);
189 }
190 
191 std::auto_ptr<HcalGainWidths> HcalTextCalibrations::produceGainWidths (const HcalGainWidthsRcd&) {
192  return produce_impl<HcalGainWidths> (mInputs ["GainWidths"]);
193 }
194 
195 std::auto_ptr<HcalQIEData> HcalTextCalibrations::produceQIEData (const HcalQIEDataRcd& rcd) {
196  return produce_impl<HcalQIEData> (mInputs ["QIEData"]);
197 }
198 
199 std::auto_ptr<HcalChannelQuality> HcalTextCalibrations::produceChannelQuality (const HcalChannelQualityRcd& rcd) {
200  return produce_impl<HcalChannelQuality> (mInputs ["ChannelQuality"]);
201 }
202 
203 std::auto_ptr<HcalZSThresholds> HcalTextCalibrations::produceZSThresholds (const HcalZSThresholdsRcd& rcd) {
204  return produce_impl<HcalZSThresholds> (mInputs ["ZSThresholds"]);
205 }
206 
207 std::auto_ptr<HcalRespCorrs> HcalTextCalibrations::produceRespCorrs (const HcalRespCorrsRcd& rcd) {
208  return produce_impl<HcalRespCorrs> (mInputs ["RespCorrs"]);
209 }
210 
211 std::auto_ptr<HcalLUTCorrs> HcalTextCalibrations::produceLUTCorrs (const HcalLUTCorrsRcd& rcd) {
212  return produce_impl<HcalLUTCorrs> (mInputs ["LUTCorrs"]);
213 }
214 
215 std::auto_ptr<HcalPFCorrs> HcalTextCalibrations::producePFCorrs (const HcalPFCorrsRcd& rcd) {
216  return produce_impl<HcalPFCorrs> (mInputs ["PFCorrs"]);
217 }
218 
219 std::auto_ptr<HcalTimeCorrs> HcalTextCalibrations::produceTimeCorrs (const HcalTimeCorrsRcd& rcd) {
220  return produce_impl<HcalTimeCorrs> (mInputs ["TimeCorrs"]);
221 }
222 
223 std::auto_ptr<HcalL1TriggerObjects> HcalTextCalibrations::produceL1TriggerObjects (const HcalL1TriggerObjectsRcd& rcd) {
224  return produce_impl<HcalL1TriggerObjects> (mInputs ["L1TriggerObjects"]);
225 }
226 
227 std::auto_ptr<HcalElectronicsMap> HcalTextCalibrations::produceElectronicsMap (const HcalElectronicsMapRcd& rcd) {
228  return produce_impl<HcalElectronicsMap> (mInputs ["ElectronicsMap"]);
229 }
230 
231 std::auto_ptr<HcalValidationCorrs> HcalTextCalibrations::produceValidationCorrs (const HcalValidationCorrsRcd& rcd) {
232  return produce_impl<HcalValidationCorrs> (mInputs ["ValidationCorrs"]);
233 }
234 
235 std::auto_ptr<HcalLutMetadata> HcalTextCalibrations::produceLutMetadata (const HcalLutMetadataRcd& rcd) {
236  return produce_impl<HcalLutMetadata> (mInputs ["LutMetadata"]);
237 }
238 
239 std::auto_ptr<HcalDcsValues>
241  return produce_impl<HcalDcsValues> (mInputs ["DcsValues"]);
242 }
243 
244 std::auto_ptr<HcalDcsMap> HcalTextCalibrations::produceDcsMap (const HcalDcsMapRcd& rcd) {
245  return produce_impl<HcalDcsMap> (mInputs ["DcsMap"]);
246 }
247 
248 std::auto_ptr<HcalCovarianceMatrices> HcalTextCalibrations::produceCovarianceMatrices (const HcalCovarianceMatricesRcd& rcd) {
249  return produce_impl<HcalCovarianceMatrices> (mInputs ["CovarianceMatrices"]);
250 }
251 
252 std::auto_ptr<HcalCholeskyMatrices> HcalTextCalibrations::produceCholeskyMatrices (const HcalCholeskyMatricesRcd& rcd) {
253  return produce_impl<HcalCholeskyMatrices> (mInputs ["CholeskyMatrices"]);
254 }
255 
256 std::auto_ptr<HcalRecoParams> HcalTextCalibrations::produceRecoParams (const HcalRecoParamsRcd&) {
257  return produce_impl<HcalRecoParams> (mInputs ["RecoParams"]);
258 }
259 
260 std::auto_ptr<HcalLongRecoParams> HcalTextCalibrations::produceLongRecoParams (const HcalLongRecoParamsRcd&) {
261  return produce_impl<HcalLongRecoParams> (mInputs ["LongRecoParams"]);
262 }
263 std::auto_ptr<HcalTimingParams> HcalTextCalibrations::produceTimingParams (const HcalTimingParamsRcd&) {
264  return produce_impl<HcalTimingParams> (mInputs ["TimingParams"]);
265 }
266 std::auto_ptr<HcalMCParams> HcalTextCalibrations::produceMCParams (const HcalMCParamsRcd&) {
267  return produce_impl<HcalMCParams> (mInputs ["MCParams"]);
268 }
269 
270 std::auto_ptr<HcalFlagHFDigiTimeParams> HcalTextCalibrations::produceFlagHFDigiTimeParams (const HcalFlagHFDigiTimeParamsRcd&) {
271  return produce_impl<HcalFlagHFDigiTimeParams> (mInputs ["FlagHFDigiTimeParams"]);
272 }
T getParameter(std::string const &) const
std::auto_ptr< HcalDcsValues > produceDcsValues(HcalDcsRcd const &rcd)
std::auto_ptr< HcalQIEData > produceQIEData(const HcalQIEDataRcd &rcd)
std::auto_ptr< HcalLongRecoParams > produceLongRecoParams(const HcalLongRecoParamsRcd &rcd)
JetCorrectorParameters::Record record
Definition: classes.h:11
std::auto_ptr< HcalPedestals > producePedestals(const HcalPedestalsRcd &rcd)
std::auto_ptr< HcalCovarianceMatrices > produceCovarianceMatrices(const HcalCovarianceMatricesRcd &rcd)
static const IOVSyncValue & endOfTime()
Definition: IOVSyncValue.cc:97
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
std::auto_ptr< HcalMCParams > produceMCParams(const HcalMCParamsRcd &rcd)
std::auto_ptr< HcalGainWidths > produceGainWidths(const HcalGainWidthsRcd &rcd)
static const IOVSyncValue & beginOfTime()
std::auto_ptr< HcalZSThresholds > produceZSThresholds(const HcalZSThresholdsRcd &rcd)
std::auto_ptr< HcalValidationCorrs > produceValidationCorrs(const HcalValidationCorrsRcd &rcd)
std::auto_ptr< HcalFlagHFDigiTimeParams > produceFlagHFDigiTimeParams(const HcalFlagHFDigiTimeParamsRcd &rcd)
tuple result
Definition: query.py:137
HcalTextCalibrations(const edm::ParameterSet &)
std::auto_ptr< HcalRespCorrs > produceRespCorrs(const HcalRespCorrsRcd &rcd)
std::auto_ptr< HcalL1TriggerObjects > produceL1TriggerObjects(const HcalL1TriggerObjectsRcd &rcd)
std::auto_ptr< HcalRecoParams > produceRecoParams(const HcalRecoParamsRcd &rcd)
std::auto_ptr< HcalTimeCorrs > produceTimeCorrs(const HcalTimeCorrsRcd &rcd)
std::auto_ptr< HcalTimingParams > produceTimingParams(const HcalTimingParamsRcd &rcd)
std::auto_ptr< HcalCholeskyMatrices > produceCholeskyMatrices(const HcalCholeskyMatricesRcd &rcd)
std::auto_ptr< HcalChannelQuality > produceChannelQuality(const HcalChannelQualityRcd &rcd)
bool getObject(std::istream &fInput, HcalPedestals *fObject)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::auto_ptr< HcalGains > produceGains(const HcalGainsRcd &rcd)
std::auto_ptr< HcalLUTCorrs > produceLUTCorrs(const HcalLUTCorrsRcd &rcd)
std::auto_ptr< HcalLutMetadata > produceLutMetadata(const HcalLutMetadataRcd &rcd)
std::string fullPath() const
Definition: FileInPath.cc:171
std::auto_ptr< T > produce_impl(const std::string &fFile)
long double T
std::auto_ptr< HcalElectronicsMap > produceElectronicsMap(const HcalElectronicsMapRcd &rcd)
std::auto_ptr< HcalPedestalWidths > producePedestalWidths(const HcalPedestalWidthsRcd &rcd)
std::auto_ptr< HcalPFCorrs > producePFCorrs(const HcalPFCorrsRcd &rcd)
std::auto_ptr< HcalDcsMap > produceDcsMap(const HcalDcsMapRcd &rcd)