CMS 3D CMS Logo

HcalDbASCIIIO.cc
Go to the documentation of this file.
1 //
2 // F.Ratnikov (UMd), Oct 28, 2005
3 //
4 #include <vector>
5 #include <string>
6 #include <cstdio>
7 #include <sstream>
8 #include <memory>
9 #include <iostream>
10 
15 
19 
20 namespace {
21  class DetIdLess {
22  public:
23  bool operator()(DetId fFirst, DetId fSecond) const {
24  HcalGenericDetId first(fFirst);
25  HcalGenericDetId second(fSecond);
26  if (first.genericSubdet() != second.genericSubdet())
27  return first.genericSubdet() < second.genericSubdet();
28  if (first.isHcalDetId()) {
30  HcalDetId s1(second);
31  return f1.zside() != s1.zside()
32  ? f1.zside() < s1.zside()
33  : f1.iphi() != s1.iphi()
34  ? f1.iphi() < s1.iphi()
35  : f1.ietaAbs() != s1.ietaAbs() ? f1.ietaAbs() < s1.ietaAbs() : f1.depth() < s1.depth();
36  } else {
37  return first.rawId() < second.rawId();
38  }
39  }
40  };
41  class HcalElectronicsIdLess {
42  public:
43  bool operator()(HcalElectronicsId first, HcalElectronicsId second) const {
44  return first.readoutVMECrateId() != second.readoutVMECrateId()
45  ? first.readoutVMECrateId() < second.readoutVMECrateId()
46  : first.htrSlot() != second.htrSlot()
47  ? first.htrSlot() < second.htrSlot()
48  : first.htrTopBottom() != second.htrTopBottom()
49  ? first.htrTopBottom() < second.htrTopBottom()
50  : first.fiberIndex() != second.fiberIndex() ? first.fiberIndex() < second.fiberIndex()
51  : first.fiberChanId() < second.fiberChanId();
52  }
53  };
54 } // namespace
55 
56 // ------------------------------ some little helpers ------------------------------
57 
58 std::vector<std::string> splitString(const std::string& fLine) {
59  std::vector<std::string> result;
60  int start = 0;
61  bool empty = true;
62  for (unsigned i = 0; i <= fLine.size(); i++) {
63  if (fLine[i] == ' ' || i == fLine.size()) {
64  if (!empty) {
65  std::string item(fLine, start, i - start);
66  result.push_back(item);
67  empty = true;
68  }
69  start = i + 1;
70  } else {
71  if (empty)
72  empty = false;
73  }
74  }
75  return result;
76 }
77 
78 std::vector<unsigned int> splitStringToIntByComma(const std::string& fLine) {
79  std::vector<unsigned int> result;
80  int start = 0;
81  bool empty = true;
82  for (unsigned i = 0; i <= fLine.size(); i++) {
83  if (fLine[i] == ',' || i == fLine.size()) {
84  if (!empty) {
85  std::string itemString(fLine, start, i - start);
86  result.push_back(atoi(itemString.c_str()));
87  empty = true;
88  }
89  start = i + 1;
90  } else {
91  if (empty)
92  empty = false;
93  }
94  }
95  return result;
96 }
97 
98 std::vector<float> splitStringToFloatByComma(const std::string& fLine) {
99  std::vector<float> result;
100  int start = 0;
101  bool empty = true;
102  for (unsigned i = 0; i <= fLine.size(); i++) {
103  if (fLine[i] == ',' || i == fLine.size()) {
104  if (!empty) {
105  std::string itemString(fLine, start, i - start);
106  result.push_back(atof(itemString.c_str()));
107  empty = true;
108  }
109  start = i + 1;
110  } else {
111  if (empty)
112  empty = false;
113  }
114  }
115  return result;
116 }
117 
118 std::vector<double> splitStringToDoubleByComma(const std::string& fLine) {
119  std::vector<double> result;
120  int start = 0;
121  bool empty = true;
122  for (unsigned i = 0; i <= fLine.size(); i++) {
123  if (fLine[i] == ',' || i == fLine.size()) {
124  if (!empty) {
125  std::string itemString(fLine, start, i - start);
126  result.push_back(atof(itemString.c_str()));
127  empty = true;
128  }
129  start = i + 1;
130  } else {
131  if (empty)
132  empty = false;
133  }
134  }
135  return result;
136 }
137 
138 DetId HcalDbASCIIIO::getId(const std::vector<std::string>& items) {
140  return converter.getId();
141 }
142 
143 void HcalDbASCIIIO::dumpId(std::ostream& fOutput, DetId id) {
145  char buffer[1024];
146  sprintf(buffer,
147  " %15s %15s %15s %15s",
148  converter.getField1().c_str(),
149  converter.getField2().c_str(),
150  converter.getField3().c_str(),
151  converter.getFlavor().c_str());
152  fOutput << buffer;
153 }
154 
155 void HcalDbASCIIIO::dumpIdShort(std::ostream& fOutput, DetId id) {
157  char buffer[1024];
158  sprintf(buffer,
159  " %5s %4s %4s %10s",
160  converter.getField1().c_str(),
161  converter.getField2().c_str(),
162  converter.getField3().c_str(),
163  converter.getFlavor().c_str());
164  fOutput << buffer;
165 }
166 
167 // ------------------------------ start templates ------------------------------
168 
169 template <class T>
170 bool from_string(T& t, const std::string& s, std::ios_base& (*f)(std::ios_base&)) {
171  std::istringstream iss(s);
172  return !(iss >> f >> t).fail();
173 }
174 
175 template <class S, class T>
176 bool getHcalObject(std::istream& fInput, T* fObject) {
177  if (!fObject)
178  return false; //fObject = new T;
179  char buffer[1024];
180  while (fInput.getline(buffer, 1024)) {
181  if (buffer[0] == '#')
182  continue; //ignore comment
183  std::vector<std::string> items = splitString(std::string(buffer));
184  if (items.empty())
185  continue; // blank line
186  if (items.size() < 8) {
187  edm::LogWarning("Format Error") << "Bad line: " << buffer
188  << "\n line must contain 8 items: eta, phi, depth, subdet, 4x values"
189  << std::endl;
190  continue;
191  }
193 
194  // if (fObject->exists(id) )
195  // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
196  // else
197  // {
198  S fCondObject(id, atof(items[4].c_str()), atof(items[5].c_str()), atof(items[6].c_str()), atof(items[7].c_str()));
199  fObject->addValues(fCondObject);
200  // }
201  }
202 
203  return true;
204 }
205 
206 template <class T>
207 bool dumpHcalObject(std::ostream& fOutput, const T& fObject) {
208  char buffer[1024];
209  sprintf(buffer,
210  "# %15s %15s %15s %15s %8s %8s %8s %8s %10s\n",
211  "eta",
212  "phi",
213  "dep",
214  "det",
215  "cap0",
216  "cap1",
217  "cap2",
218  "cap3",
219  "DetId");
220  fOutput << buffer;
221  std::vector<DetId> channels = fObject.getAllChannels();
222  std::sort(channels.begin(), channels.end(), DetIdLess());
223  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
224  const float* values = fObject.getValues(*channel)->getValues();
225  if (values) {
226  HcalDbASCIIIO::dumpId(fOutput, *channel);
227  sprintf(
228  buffer, " %10.7f %10.7f %10.7f %10.7f %10X\n", values[0], values[1], values[2], values[3], channel->rawId());
229  fOutput << buffer;
230  }
231  }
232  return true;
233 }
234 
235 template <class ObjectPrimitiveType, class S, class T>
236 bool getHcalSingleObject(std::istream& fInput, T* fObject) {
237  if (!fObject)
238  return false; //fObject = new T;
239  char buffer[1024];
240  while (fInput.getline(buffer, 1024)) {
241  if (buffer[0] == '#')
242  continue; //ignore comment
243  std::vector<std::string> items = splitString(std::string(buffer));
244  if (items.empty())
245  continue; // blank line
246  if (items.size() < 5) {
247  edm::LogWarning("Format Error") << "Bad line: " << buffer
248  << "\n line must contain 5 items: eta, phi, depth, subdet, value" << std::endl;
249  continue;
250  }
252 
253  // if (fObject->exists(id) )
254  // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
255  // else
256  // {
257  std::stringstream ss(items[4]);
258  ObjectPrimitiveType x = 0; // usually int or float
259  ss >> x;
260  S fCondObject(id, x);
261  fObject->addValues(fCondObject);
262  // }
263  }
264  return true;
265 }
266 
267 template <class T>
268 bool dumpHcalSingleFloatObject(std::ostream& fOutput, const T& fObject) {
269  char buffer[1024];
270  sprintf(buffer, "# %15s %15s %15s %15s %8s %10s\n", "eta", "phi", "dep", "det", "value", "DetId");
271  fOutput << buffer;
272  std::vector<DetId> channels = fObject.getAllChannels();
273  std::sort(channels.begin(), channels.end(), DetIdLess());
274  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
275  const float value = fObject.getValues(*channel)->getValue();
276  HcalDbASCIIIO::dumpId(fOutput, *channel);
277  sprintf(buffer, " %8.5f %10X\n", value, channel->rawId());
278  fOutput << buffer;
279  }
280  return true;
281 }
282 
283 template <class T>
284 bool dumpHcalSingleIntObject(std::ostream& fOutput, const T& fObject) {
285  char buffer[1024];
286  sprintf(buffer, "# %15s %15s %15s %15s %8s %10s\n", "eta", "phi", "dep", "det", "value", "DetId");
287  fOutput << buffer;
288  std::vector<DetId> channels = fObject.getAllChannels();
289  std::sort(channels.begin(), channels.end(), DetIdLess());
290  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
291  const int value = fObject.getValues(*channel)->getValue();
292  HcalDbASCIIIO::dumpId(fOutput, *channel);
293  sprintf(buffer, " %15d %10X\n", value, channel->rawId());
294  fOutput << buffer;
295  }
296  return true;
297 }
298 
299 template <class S, class T>
300 bool getHcalMatrixObject(std::istream& fInput, T* fObject, S* fCondObject) {
301  if (!fObject)
302  return false; //fObject = new T;
303  char buffer[1024];
304  while (fInput.getline(buffer, 1024)) {
305  if (buffer[0] == '#')
306  continue; //ignore comment
307  std::vector<std::string> items = splitString(std::string(buffer));
308  if (items.empty())
309  continue; // blank line
310  DetId firstid = HcalDbASCIIIO::getId(items);
311  fCondObject = new S(firstid.rawId());
312  for (int j = 0; j != 10; j++)
313  fCondObject->setValue(atoi(items[4].c_str()), 0, j, atof(items[j + 5].c_str()));
314  for (int i = 1; i != 40; i++) {
315  fInput.getline(buffer, 1024);
318  if (id.rawId() != firstid.rawId())
319  break; //throw cms::Exception("Wrong number of elements");
320  for (int j = 0; j != 10; j++)
321  fCondObject->setValue(atoi(items[4].c_str()), i % 10, j, atof(items[j + 5].c_str()));
322  }
323  fObject->addValues(*fCondObject);
324  delete fCondObject;
325  }
326  return true;
327 }
328 
329 template <class T>
330 bool dumpHcalMatrixObject(std::ostream& fOutput, const T& fObject) {
331  char buffer[1024];
332  sprintf(buffer,
333  "# %5s %5s %5s %5s %5s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
334  "eta",
335  "phi",
336  "dep",
337  "det",
338  "capid",
339  "c0",
340  "c1",
341  "c2",
342  "c3",
343  "c4",
344  "c5",
345  "c6",
346  "c7",
347  "c8",
348  "c9",
349  "DetId");
350  fOutput << buffer;
351  std::vector<DetId> channels = fObject.getAllChannels();
352  std::sort(channels.begin(), channels.end(), DetIdLess());
353  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
354  float thisline[10];
355  for (int m = 0; m != 4; m++) {
356  for (int i = 0; i != 10; i++) {
357  for (int j = 0; j != 10; j++) {
358  // std::cout <<"test "<<(fObject.getValues(*channel))->getValue(0,0,0);
359  thisline[j] = fObject.getValues(*channel)->getValue(m, i, j);
360  // thisline[j] = fObject.getValues(*channel)->getValue(1,1,1);
361  }
362  HcalDbASCIIIO::dumpId(fOutput, *channel);
363  sprintf(buffer,
364  " %5i %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %10X\n",
365  m,
366  thisline[0],
367  thisline[1],
368  thisline[2],
369  thisline[3],
370  thisline[4],
371  thisline[5],
372  thisline[6],
373  thisline[7],
374  thisline[8],
375  thisline[9],
376  channel->rawId());
377  fOutput << buffer;
378  }
379  }
380  }
381 
382  return true;
383 }
384 
385 // ------------------------------ end templates ------------------------------
386 
387 namespace HcalDbASCIIIO {
388  bool getObject(std::istream& fInput, HcalGains* fObject) { return getHcalObject<HcalGain>(fInput, fObject); }
389  bool dumpObject(std::ostream& fOutput, const HcalGains& fObject) { return dumpHcalObject(fOutput, fObject); }
390  bool getObject(std::istream& fInput, HcalGainWidths* fObject) {
391  return getHcalObject<HcalGainWidth>(fInput, fObject);
392  }
393  bool dumpObject(std::ostream& fOutput, const HcalGainWidths& fObject) { return dumpHcalObject(fOutput, fObject); }
394 
395  bool getObject(std::istream& fInput, HcalRespCorrs* fObject) {
396  return getHcalSingleObject<float, HcalRespCorr>(fInput, fObject);
397  }
398  bool dumpObject(std::ostream& fOutput, const HcalRespCorrs& fObject) {
399  return dumpHcalSingleFloatObject(fOutput, fObject);
400  }
401 
402  bool getObject(std::istream& fInput, HcalLUTCorrs* fObject) {
403  return getHcalSingleObject<float, HcalLUTCorr>(fInput, fObject);
404  }
405  bool dumpObject(std::ostream& fOutput, const HcalLUTCorrs& fObject) {
406  return dumpHcalSingleFloatObject(fOutput, fObject);
407  }
408 
409  bool getObject(std::istream& fInput, HcalPFCorrs* fObject) {
410  return getHcalSingleObject<float, HcalPFCorr>(fInput, fObject);
411  }
412  bool dumpObject(std::ostream& fOutput, const HcalPFCorrs& fObject) {
413  return dumpHcalSingleFloatObject(fOutput, fObject);
414  }
415 
416  bool getObject(std::istream& fInput, HcalTimeCorrs* fObject) {
417  return getHcalSingleObject<float, HcalTimeCorr>(fInput, fObject);
418  }
419  bool dumpObject(std::ostream& fOutput, const HcalTimeCorrs& fObject) {
420  return dumpHcalSingleFloatObject(fOutput, fObject);
421  }
422 
423  bool getObject(std::istream& fInput, HcalZSThresholds* fObject) {
424  return getHcalSingleObject<int, HcalZSThreshold>(fInput, fObject);
425  }
426  bool dumpObject(std::ostream& fOutput, const HcalZSThresholds& fObject) {
427  return dumpHcalSingleIntObject(fOutput, fObject);
428  }
429 
430  bool getObject(std::istream& fInput, HcalZDCLowGainFractions* fObject) {
431  return getHcalSingleObject<float, HcalZDCLowGainFraction>(fInput, fObject);
432  }
433  bool dumpObject(std::ostream& fOutput, const HcalZDCLowGainFractions& fObject) {
434  return dumpHcalSingleFloatObject(fOutput, fObject);
435  }
436 
437  bool getObject(std::istream& fInput, HcalValidationCorrs* fObject) {
438  return getHcalSingleObject<float, HcalValidationCorr>(fInput, fObject);
439  }
440  bool dumpObject(std::ostream& fOutput, const HcalValidationCorrs& fObject) {
441  return dumpHcalSingleFloatObject(fOutput, fObject);
442  }
443 
444  bool getObject(std::istream& fInput, HcalQIETypes* fObject) {
445  return getHcalSingleObject<int, HcalQIEType>(fInput, fObject);
446  }
447  bool dumpObject(std::ostream& fOutput, const HcalQIETypes& fObject) {
448  return dumpHcalSingleIntObject(fOutput, fObject);
449  }
450 } // namespace HcalDbASCIIIO
451 
452 // ------------------------------ start specific implementations ------------------------------
453 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalRecoParams* fObject) {
454  if (!fObject)
455  return false; // fObject = new HcalRecoParams(); This was always useless...
456  char buffer[1024];
457  while (fInput.getline(buffer, 1024)) {
458  if (buffer[0] == '#')
459  continue; //ignore comment
460  std::vector<std::string> items = splitString(std::string(buffer));
461  if (items.empty())
462  continue; // blank line
463  if (items.size() < 6) {
464  edm::LogWarning("Format Error") << "Bad line: " << buffer
465  << "\n line must contain 6 items: eta, phi, depth, subdet, param1, param2"
466  << std::endl;
467  continue;
468  }
470 
471  int packingScheme = 0;
472  if (items.size() > 22) {
473  packingScheme = atoi(items[22].c_str());
474  }
475 
476  int param1 = 0;
477  int param2 = 0;
478  if (packingScheme == 0) {
479  param1 = atoi(items[4].c_str());
480  param2 = atoi(items[5].c_str());
481  } // packing scheme 0 (old format).
482 
483  if (packingScheme == 1) {
484  // 0 1 2 3 4 5 6 7 8 9
485  int aabits[6] = {1, 1, 8, 4, 4, 9};
486  int aamax[6] = {1, 1, 255, 15, 15, 511};
487 
488  int bbbits[10] = {1, 4, 1, 4, 1, 4, 4, 4, 4, 4};
489  int bbmax[10] = {1, 15, 1, 15, 1, 15, 15, 15, 15, 15};
490 
491  // param 1
492  int j = 0;
493  int aa;
494  int aashift = 0;
495  for (int i = 0; i < 6; i++) {
496  j = i + 7;
497  if (i == 2) {
498  float phase = atof(items[j].c_str());
499  float xphase = (phase + 32.0) * 4.0; // range of phase [-30.0,30.0]
500  aa = xphase;
501  } else {
502  aa = atoi(items[j].c_str());
503  }
504  if (aa > aamax[i] || aa < 0) {
505  edm::LogWarning("Format Error")
506  << "Bad line: " << buffer << "\n value for a" << i << " should be less than" << aamax[i] << std::endl;
507  }
508  param1 = param1 | aa << aashift;
509  aashift = aashift + aabits[i];
510  }
511 
512  // param 2
513  int bb;
514  int bbshift = 0;
515  for (int i = 0; i < 10; i++) {
516  j = i + 13;
517  bb = atoi(items[j].c_str());
518  if (bb > bbmax[i]) {
519  edm::LogWarning("Format Error")
520  << "Bad line: " << buffer << "\n value for b" << i << " should be less than" << bbmax[i] << std::endl;
521  }
522  param2 = param2 | bb << bbshift;
523  bbshift = bbshift + bbbits[i];
524  }
525  } // packing sheme 1.
526 
527  // HcalRecoParam* fCondObject = new HcalRecoParam(id, atoi (items [4].c_str()), atoi (items [5].c_str()) );
528 
529  // std::cout<<" buffer "<<buffer<<std::endl;
530  // std::cout<<" param1, param2 "<<param1<<" "<<param2<<std::endl;
531 
532  HcalRecoParam* fCondObject = new HcalRecoParam(id, param1, param2);
533  fObject->addValues(*fCondObject);
534  delete fCondObject;
535  }
536  return true;
537 }
538 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalRecoParams& fObject) {
539  char buffer[1024];
540  // sprintf (buffer, "# %15s %15s %15s %15s %18s %15s %10s\n", "eta", "phi", "dep", "det", "firstSample", "samplesToAdd", "DetId");
541  // fOutput << buffer;
542  std::vector<DetId> channels = fObject.getAllChannels();
543  std::sort(channels.begin(), channels.end(), DetIdLess());
544  int myCounter = 0;
545  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
546  myCounter++;
547  int param1 = fObject.getValues(*channel)->param1();
548  int param2 = fObject.getValues(*channel)->param2();
549  int packingScheme = fObject.getValues(*channel)->packingScheme();
550 
551  // std::cout<<" Param1 "<<Param1<<" Param2 "<<Param2<<" packing "<<packingScheme<<std::endl;
552 
553  if (packingScheme == 0) {
554  // old format
555  if (myCounter == 1) {
556  sprintf(buffer,
557  "# %15s %15s %15s %15s %18s %15s %10s\n",
558  "eta",
559  "phi",
560  "dep",
561  "det",
562  "firstSample",
563  "samplesToAdd",
564  "DetId");
565  }
566  HcalDbASCIIIO::dumpId(fOutput, *channel);
567  sprintf(buffer,
568  " %15d %15d %16X\n",
569  fObject.getValues(*channel)->firstSample(),
570  fObject.getValues(*channel)->samplesToAdd(),
571  channel->rawId());
572  fOutput << buffer;
573  }
574 
575  if (packingScheme == 1) {
576  if (myCounter == 1) {
577  char lineT[100], lineA[200], lineB[200];
578  //
579  sprintf(lineT, "#%50s", " ");
580  fOutput << lineT;
581  sprintf(lineA, " %31s", "a0: correctForPhaseContainment");
582  fOutput << lineA;
583  sprintf(lineB, " %36s", "b0: useLeakCorrection\n");
584  fOutput << lineB;
585  //
586  sprintf(lineT, "#%50s", " ");
587  fOutput << lineT;
588  sprintf(lineA, " %31s", "a1: correctForLeadingEdge");
589  fOutput << lineA;
590  sprintf(lineB, " %36s", "b1: leakCorrectionID\n");
591  fOutput << lineB;
592  //
593  sprintf(lineT, "#%50s", " ");
594  fOutput << lineT;
595  sprintf(lineA, " %31s", "a2: correctionPhaseNS");
596  fOutput << lineA;
597  sprintf(lineB, " %36s", "b2: correctForTimeslew\n");
598  fOutput << lineB;
599  //
600  sprintf(lineT, "#%50s", " ");
601  fOutput << lineT;
602  sprintf(lineA, " %31s", "a3: firstSample");
603  fOutput << lineA;
604  sprintf(lineB, " %36s", "b3: timeslewCorrectionID\n");
605  fOutput << lineB;
606  //
607  sprintf(lineT, "#%50s", " ");
608  fOutput << lineT;
609  sprintf(lineA, " %31s", "a4: samplesToAdd");
610  fOutput << lineA;
611  sprintf(lineB, " %36s", "b4: correctTiming\n");
612  fOutput << lineB;
613  //
614  sprintf(lineT, "#%50s", " ");
615  fOutput << lineT;
616  sprintf(lineA, " %31s", "a5: pulseShapeID");
617  fOutput << lineA;
618  sprintf(lineB, " %36s", "b5: firstAuxTS\n");
619  fOutput << lineB;
620  //
621  sprintf(lineT, "#%50s", " ");
622  fOutput << lineT;
623  sprintf(lineA, " %31s", " ");
624  fOutput << lineA;
625  sprintf(lineB, " %36s", "b6: specialCaseID\n");
626  fOutput << lineB;
627  //
628  sprintf(lineT, "#%50s", " ");
629  fOutput << lineT;
630  sprintf(lineA, " %31s", " ");
631  fOutput << lineA;
632  sprintf(lineB, " %36s", "b7: noiseFlaggingID\n");
633  fOutput << lineB;
634  //
635  sprintf(lineT, "#%50s", " ");
636  fOutput << lineT;
637  sprintf(lineA, " %31s", " ");
638  fOutput << lineA;
639  sprintf(lineB, " %36s", "b8: pileupCleaningID\n");
640  fOutput << lineB;
641 
642  sprintf(lineT, "#%50s", " ");
643  fOutput << lineT;
644  sprintf(lineA, " %31s", " ");
645  fOutput << lineA;
646  sprintf(lineB, " %36s", "b9: packingScheme\n");
647  fOutput << lineB;
648 
649  //
650  sprintf(lineT, "# %5s %4s %4s %10s %11s %10s %10s", "eta", "phi", "dep", "det", "param1", "param2", "DetId");
651  fOutput << lineT;
652 
653  sprintf(lineA, " %6s %4s %6s %4s %4s %4s", "a0", "a1", "a2", "a3", "a4", "a5");
654  fOutput << lineA;
655 
656  sprintf(lineB, " %6s %3s %3s %3s %3s %3s %3s %3s %3s\n", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8");
657  fOutput << lineB;
658  }
659 
660  HcalDbASCIIIO::dumpIdShort(fOutput, *channel);
661  sprintf(buffer, " %11d %10d %10X", param1, param2, channel->rawId());
662  fOutput << buffer;
663 
664  bool aa0 = fObject.getValues(*channel)->correctForPhaseContainment();
665  bool aa1 = fObject.getValues(*channel)->correctForLeadingEdge();
666  float aa2 = fObject.getValues(*channel)->correctionPhaseNS();
667  int aa3 = fObject.getValues(*channel)->firstSample();
668  int aa4 = fObject.getValues(*channel)->samplesToAdd();
669  int aa5 = fObject.getValues(*channel)->pulseShapeID();
670  sprintf(buffer, " %6d %4d %6.1f %4d %4d %4d", aa0, aa1, aa2, aa3, aa4, aa5);
671  fOutput << buffer;
672 
673  bool bb0 = fObject.getValues(*channel)->useLeakCorrection();
674  int bb1 = fObject.getValues(*channel)->leakCorrectionID();
675  bool bb2 = fObject.getValues(*channel)->correctForTimeslew();
676  int bb3 = fObject.getValues(*channel)->timeslewCorrectionID();
677  bool bb4 = fObject.getValues(*channel)->correctTiming();
678  int bb5 = fObject.getValues(*channel)->firstAuxTS();
679  int bb6 = fObject.getValues(*channel)->specialCaseID();
680  int bb7 = fObject.getValues(*channel)->noiseFlaggingID();
681  int bb8 = fObject.getValues(*channel)->pileupCleaningID();
682  int bb9 = fObject.getValues(*channel)->packingScheme();
683  sprintf(buffer, " %6d %3d %3d %3d %3d %3d %3d %3d %3d %3d\n", bb0, bb1, bb2, bb3, bb4, bb5, bb6, bb7, bb8, bb9);
684  fOutput << buffer;
685  } // packingScheme 1.
686 
687  } // loop ever channels
688  return true;
689 }
690 
691 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalLongRecoParams* fObject) {
692  if (!fObject)
693  return false; // fObject = new HcalLongRecoParams();
694  char buffer[1024];
695  while (fInput.getline(buffer, 1024)) {
696  if (buffer[0] == '#')
697  continue; //ignore comment
698  std::vector<std::string> items = splitString(std::string(buffer));
699  if (items.empty())
700  continue; // blank line
701  if (items.size() < 5) {
702  edm::LogWarning("Format Error") << "Bad line: " << buffer
703  << "\n line must contain 6 items: eta, phi, depth, subdet, signalTSs, noiseTSs"
704  << std::endl;
705  continue;
706  }
707  if (items.size() > 7) {
708  edm::LogWarning("Format Error")
709  << "Check line: " << buffer << "\n line must contain 6 items: eta, phi, depth, subdet, signalTSs, noiseTSs. "
710  << "\n ! signalTS and noiseTS must be of format <ts1,ts2,ts3,...> withOUT spaces. Ignoring line for safety"
711  << std::endl;
712  continue;
713  }
715 
716  std::vector<unsigned int> mySignalTS = splitStringToIntByComma(items[4]);
717  std::vector<unsigned int> myNoiseTS = splitStringToIntByComma(items[5]);
718 
719  HcalLongRecoParam* fCondObject = new HcalLongRecoParam(id, mySignalTS, myNoiseTS);
720  fObject->addValues(*fCondObject);
721  delete fCondObject;
722  }
723  return true;
724 }
725 
726 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalTimingParams* fObject) {
727  if (!fObject)
728  return false; // fObject = new HcalTimingParams();
729  char buffer[1024];
730  while (fInput.getline(buffer, 1024)) {
731  if (buffer[0] == '#')
732  continue; //ignore comment
733  std::vector<std::string> items = splitString(std::string(buffer));
734  if (items.empty())
735  continue; // blank line
736  if (items.size() < 7) {
737  edm::LogWarning("Format Error") << "Bad line: " << buffer
738  << "\n line must contain 7 items: eta, phi, depth, subdet, nhit, phase, rms,detid"
739  << std::endl;
740  continue;
741  }
742  //std::cout<<"items[3] "<<items [3]<<std::endl;
743  //std::cout<<"items[0] "<<items [0]<<std::endl;
744  //std::cout<<"items[1] "<<items [1]<<std::endl;
745  //std::cout<<"items[2] "<<items [2]<<std::endl;
746 
747  //std::cout<<"items[4] "<<items [4]<<std::endl;
748  //std::cout<<"items[5] "<<items [5]<<std::endl;
749  //std::cout<<"items[6] "<<items [6]<<std::endl;
751  //std::cout<<"calculated id "<<id.rawId()<<std::endl;
752  HcalTimingParam* fCondObject =
753  new HcalTimingParam(id, atoi(items[4].c_str()), atof(items[5].c_str()), atof(items[6].c_str()));
754  fObject->addValues(*fCondObject);
755  delete fCondObject;
756  }
757  return true;
758 }
759 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalTimingParams& fObject) {
760  char buffer[1024];
761  sprintf(
762  buffer, "# %15s %15s %15s %15s %15s %15s %15s %15s\n", "eta", "phi", "dep", "det", "nhit", "mean", "rms", "DetId");
763  fOutput << buffer;
764  std::vector<DetId> channels = fObject.getAllChannels();
765  std::sort(channels.begin(), channels.end(), DetIdLess());
766  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
767  HcalDbASCIIIO::dumpId(fOutput, *channel);
768  sprintf(buffer,
769  " %15d %8.5f %8.5f %16X\n",
770  fObject.getValues(*channel)->nhits(),
771  fObject.getValues(*channel)->phase(),
772  fObject.getValues(*channel)->rms(),
773  channel->rawId());
774  fOutput << buffer;
775  }
776  return true;
777 }
778 
779 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalLongRecoParams& fObject) {
780  char buffer[1024];
781  sprintf(
782  buffer, "# %15s %15s %15s %15s %10s %10s %10s\n", "eta", "phi", "dep", "det", "signalTSs", "noiseTSs", "DetId");
783  fOutput << buffer;
784  std::vector<DetId> channels = fObject.getAllChannels();
785  std::sort(channels.begin(), channels.end(), DetIdLess());
786  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
787  HcalGenericDetId fId(*channel);
788  if (fId.isHcalZDCDetId()) {
789  std::vector<unsigned int> vSignalTS = fObject.getValues(*channel)->signalTS();
790  std::vector<unsigned int> vNoiseTS = fObject.getValues(*channel)->noiseTS();
791  HcalDbASCIIIO::dumpId(fOutput, *channel);
792  sprintf(buffer, " ");
793  fOutput << buffer;
794  for (unsigned int i = 0; i < vSignalTS.size(); i++) {
795  if (i > 0) {
796  sprintf(buffer, ",");
797  fOutput << buffer;
798  }
799  sprintf(buffer, "%u", vSignalTS.at(i));
800  fOutput << buffer;
801  }
802  sprintf(buffer, " ");
803  fOutput << buffer;
804  for (unsigned int i = 0; i < vNoiseTS.size(); i++) {
805  if (i > 0) {
806  sprintf(buffer, ",");
807  fOutput << buffer;
808  }
809  sprintf(buffer, "%u", vNoiseTS.at(i));
810  fOutput << buffer;
811  }
812  sprintf(buffer, " %10X\n", channel->rawId());
813  fOutput << buffer;
814  }
815  }
816  return true;
817 }
818 
819 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalMCParams* fObject) {
820  if (!fObject)
821  return false; // fObject = new HcalMCParams();
822  char buffer[1024];
823  while (fInput.getline(buffer, 1024)) {
824  if (buffer[0] == '#')
825  continue; //ignore comment
826  std::vector<std::string> items = splitString(std::string(buffer));
827  if (items.empty())
828  continue; // blank line
829  if (items.size() < 5) {
830  edm::LogWarning("Format Error") << "Bad line: " << buffer
831  << "\n line must contain 5 items: eta, phi, depth, subdet, signalShape"
832  << std::endl;
833  continue;
834  }
836 
837  int packingScheme = 0;
838  if (items.size() > 11) {
839  packingScheme = atoi(items[11].c_str());
840  }
841 
842  int param1 = 0;
843  if (packingScheme == 0) {
844  param1 = atoi(items[4].c_str());
845  }
846 
847  if (packingScheme == 1) {
848  int aabits[6] = {9, 1, 4, 8, 5, 4}; // 4 spear bits added to aabits[5]
849  int aamax[6] = {511, 1, 15, 255, 1, 16};
850  int j = 0;
851  int aa;
852  int aashift = 0;
853  for (int i = 0; i < 6; i++) {
854  j = i + 6;
855  if (i == 3) {
856  float phase = atof(items[j].c_str());
857  float xphase = (phase + 32.0) * 4.0; // range of phase [-30.0,30.0]
858  aa = xphase;
859  } else {
860  aa = atoi(items[j].c_str());
861  }
862  if (aa > aamax[i] || aa < 0) {
863  edm::LogWarning("Format Error")
864  << "Bad line: " << buffer << "\n value for a" << i << " should be less than" << aamax[i] << std::endl;
865  }
866 
867  param1 = param1 | aa << aashift;
868  aashift = aashift + aabits[i];
869  }
870  }
871 
872  HcalMCParam* fCondObject = new HcalMCParam(id, param1);
873  fObject->addValues(*fCondObject);
874  delete fCondObject;
875  }
876  return true;
877 }
878 
879 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalMCParams& fObject) {
880  char buffer[1024];
881  // sprintf (buffer, "# %15s %15s %15s %15s %14s %10s\n", "eta", "phi", "dep", "det", "signalShape", "DetId");
882  // fOutput << buffer;
883  std::vector<DetId> channels = fObject.getAllChannels();
884  std::sort(channels.begin(), channels.end(), DetIdLess());
885  int myCounter = 0;
886  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
887  myCounter++;
888  ;
889  int packingScheme = fObject.getValues(*channel)->packingScheme();
890  if (packingScheme == 0) {
891  if (myCounter == 1) {
892  sprintf(buffer, "# %15s %15s %15s %15s %14s %10s\n", "eta", "phi", "dep", "det", "signalShape", "DetId");
893  fOutput << buffer;
894  }
895  const int value = fObject.getValues(*channel)->signalShape();
896  HcalDbASCIIIO::dumpId(fOutput, *channel);
897  sprintf(buffer, " %10d %17X\n", value, channel->rawId());
898  fOutput << buffer;
899  } // packingScheme 0
900  if (packingScheme == 1) {
901  if (myCounter == 1) {
902  char lineT[100], lineA[200];
903  //
904  sprintf(lineT, "#%40s", " ");
905  fOutput << lineT;
906  sprintf(lineA, " %31s", "a0: signalShape\n");
907  fOutput << lineA;
908  sprintf(lineT, "#%40s", " ");
909  fOutput << lineT;
910  sprintf(lineA, " %31s", "a1: syncPhase\n");
911  fOutput << lineA;
912  sprintf(lineT, "#%40s", " ");
913  fOutput << lineT;
914  sprintf(lineA, " %31s", "a2: binOfMaximum\n");
915  fOutput << lineA;
916  sprintf(lineT, "#%40s", " ");
917  fOutput << lineT;
918  sprintf(lineA, " %31s", "a3: timePhase\n");
919  fOutput << lineA;
920  sprintf(lineT, "#%40s", " ");
921  fOutput << lineT;
922  sprintf(lineA, " %31s", "a4: timeSmearing\n");
923  fOutput << lineA;
924  sprintf(lineT, "#%40s", " ");
925  fOutput << lineT;
926  sprintf(lineA, " %31s", "a5: packingScheme\n");
927  fOutput << lineA;
928  sprintf(lineT, "# %5s %4s %4s %10s %11s %10s", "eta", "phi", "dep", "det", "param1", "DetId");
929  fOutput << lineT;
930  sprintf(lineA, " %6s %4s %4s %6s %4s %4s\n", "a0", "a1", "a2", "a3", "a4", "a5");
931  fOutput << lineA;
932  }
933  int param1 = fObject.getValues(*channel)->param1();
934  HcalDbASCIIIO::dumpIdShort(fOutput, *channel);
935  sprintf(buffer, " %11d %10X", param1, channel->rawId());
936  fOutput << buffer;
937  int aa0 = fObject.getValues(*channel)->signalShape();
938  bool aa1 = fObject.getValues(*channel)->syncPhase();
939  int aa2 = fObject.getValues(*channel)->binOfMaximum();
940  float aa3 = fObject.getValues(*channel)->timePhase();
941  bool aa4 = fObject.getValues(*channel)->timeSmearing();
942  int aa5 = fObject.getValues(*channel)->packingScheme();
943  sprintf(buffer, "%6d %4d %4d %6.1f %4d %4d\n", aa0, aa1, aa2, aa3, aa4, aa5);
944  fOutput << buffer;
945  }
946  }
947  return true;
948 }
949 
950 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalPedestals* fObject) {
951  char buffer[1024];
952 
953  while (fInput.getline(buffer, 1024)) {
954  std::vector<std::string> items = splitString(std::string(buffer));
955  if (items.empty())
956  continue; // blank line
957  else {
958  if (items[0] == "#U") {
959  if (items[1] == (std::string) "ADC")
960  fObject->setUnitADC(true);
961  else if (items[1] == (std::string) "fC")
962  fObject->setUnitADC(false);
963  else {
964  edm::LogWarning("Pedestal Unit Error") << "Unrecognized unit for pedestals. Assuming fC." << std::endl;
965  fObject->setUnitADC(false);
966  }
967  break;
968  } else {
969  edm::LogWarning("Pedestal Unit Missing")
970  << "The unit for the pedestals is missing in the txt file." << std::endl;
971  return false;
972  }
973  }
974  }
975  while (fInput.getline(buffer, 1024)) {
976  if (buffer[0] == '#')
977  continue;
978  std::vector<std::string> items = splitString(std::string(buffer));
979  if (items.empty())
980  continue; // blank line
981  if (items.size() < 8) {
982  edm::LogWarning("Format Error")
983  << "Bad line: " << buffer << "\n line must contain 8 items: eta, phi, depth, subdet, 4x values"
984  << " or 12 items: eta, phi, depth, subdet, 4x values for mean, 4x values for width" << std::endl;
985  continue;
986  }
987  DetId id = getId(items);
988 
989  // if (fObject->exists(id) )
990  // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
991  // else
992  // {
993 
994  if (items.size() < 12) // old format without widths
995  {
996  HcalPedestal* fCondObject = new HcalPedestal(id,
997  atof(items[4].c_str()),
998  atof(items[5].c_str()),
999  atof(items[6].c_str()),
1000  atof(items[7].c_str()),
1001  0.,
1002  0.,
1003  0.,
1004  0.);
1005  fObject->addValues(*fCondObject);
1006  delete fCondObject;
1007  } else // new format with widths
1008  {
1009  HcalPedestal* fCondObject = new HcalPedestal(id,
1010  atof(items[4].c_str()),
1011  atof(items[5].c_str()),
1012  atof(items[6].c_str()),
1013  atof(items[7].c_str()),
1014  atof(items[8].c_str()),
1015  atof(items[9].c_str()),
1016  atof(items[10].c_str()),
1017  atof(items[11].c_str()));
1018  fObject->addValues(*fCondObject);
1019  delete fCondObject;
1020  }
1021 
1022  // }
1023  }
1024  return true;
1025 }
1026 
1027 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalPedestals& fObject) {
1028  char buffer[1024];
1029  if (fObject.isADC())
1030  sprintf(buffer, "#U ADC << this is the unit \n");
1031  else
1032  sprintf(buffer, "#U fC << this is the unit \n");
1033  fOutput << buffer;
1034 
1035  sprintf(buffer,
1036  "# %15s %15s %15s %15s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
1037  "eta",
1038  "phi",
1039  "dep",
1040  "det",
1041  "cap0",
1042  "cap1",
1043  "cap2",
1044  "cap3",
1045  "widthcap0",
1046  "widthcap1",
1047  "widthcap2",
1048  "widthcap3",
1049  "DetId");
1050  fOutput << buffer;
1051 
1052  std::vector<DetId> channels = fObject.getAllChannels();
1053  std::sort(channels.begin(), channels.end(), DetIdLess());
1054  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
1055  const float* values = fObject.getValues(*channel)->getValues();
1056  if (values) {
1057  dumpId(fOutput, *channel);
1058  sprintf(buffer,
1059  " %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %10X\n",
1060  values[0],
1061  values[1],
1062  values[2],
1063  values[3],
1064  values[4],
1065  values[5],
1066  values[6],
1067  values[7],
1068  channel->rawId());
1069  fOutput << buffer;
1070  }
1071  }
1072  return true;
1073 }
1074 
1075 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1076 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalChannelQuality* fObject) {
1077  if (!fObject)
1078  return false; //fObject = new HcalChannelQuality;
1079  char buffer[1024];
1080  while (fInput.getline(buffer, 1024)) {
1081  if (buffer[0] == '#')
1082  continue; //ignore comment
1083  std::vector<std::string> items = splitString(std::string(buffer));
1084  if (items.empty())
1085  continue; // blank line
1086  if (items.size() < 6) {
1087  edm::LogWarning("Format Error")
1088  << "Bad line: " << buffer
1089  << "\n line must contain 6 items: eta, phi, depth, subdet, base - either (hex) or (dec), value" << std::endl;
1090  continue;
1091  }
1092  DetId id = getId(items);
1093 
1094  // if (fObject->exists(id) )
1095  // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
1096  // else
1097  // {
1098  uint32_t mystatus;
1099  if (items[4] == "(hex)")
1100  sscanf(items[5].c_str(), "%X", &mystatus);
1101  else if (items[4] == "(dec)")
1102  sscanf(items[5].c_str(), "%u", &mystatus);
1103  else {
1104  edm::LogWarning("Format Error") << "Bad line: " << buffer
1105  << "\n value field must contain the base: one of (hex), (dec)" << std::endl;
1106  continue;
1107  }
1108 
1109  HcalChannelStatus* fCondObject = new HcalChannelStatus(id, mystatus); //atoi (items [4].c_str()) );
1110  fObject->addValues(*fCondObject);
1111  delete fCondObject;
1112  // }
1113  }
1114  return true;
1115 }
1116 
1117 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalChannelQuality& fObject) {
1118  char buffer[1024];
1119  sprintf(buffer, "# %15s %15s %15s %15s %15s %10s\n", "eta", "phi", "dep", "det", "(base) value", "DetId");
1120  fOutput << buffer;
1121  std::vector<DetId> channels = fObject.getAllChannels();
1122  std::sort(channels.begin(), channels.end(), DetIdLess());
1123  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
1124  const int value = fObject.getValues(*channel)->getValue();
1125  dumpId(fOutput, *channel);
1126  sprintf(buffer, "%6s %15X %10X\n", "(hex)", value, channel->rawId());
1127  fOutput << buffer;
1128  }
1129  return true;
1130 }
1131 
1132 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1133 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalL1TriggerObjects* fObject) {
1134  char buffer[1024];
1135 
1136  while (fInput.getline(buffer, 1024)) {
1137  if (buffer[0] == '#') {
1138  if (buffer[1] == 'T') // contains tag name
1139  {
1140  std::vector<std::string> items = splitString(std::string(buffer));
1141  fObject->setTagString(items[1]);
1142  continue;
1143  }
1144  if (buffer[1] == 'A') // contains algo name
1145  {
1146  std::vector<std::string> items = splitString(std::string(buffer));
1147  fObject->setAlgoString(items[1]);
1148  continue;
1149  } else
1150  continue; //ignore comment
1151  }
1152  std::vector<std::string> items = splitString(std::string(buffer));
1153  if (items.empty())
1154  continue; // blank line
1155  if (items.size() < 7) {
1156  edm::LogWarning("Format Error")
1157  << "Bad line: " << buffer
1158  << "\n line must contain 7 items: eta, phi, depth, subdet, pedestal, resp.corr.gain, flag" << std::endl;
1159  continue;
1160  }
1161  DetId id = getId(items);
1162 
1163  HcalL1TriggerObject* fCondObject =
1164  new HcalL1TriggerObject(id, atof(items[4].c_str()), atof(items[5].c_str()), atoi(items[6].c_str()));
1165 
1166  fObject->addValues(*fCondObject);
1167  delete fCondObject;
1168  }
1169  return true;
1170 }
1171 
1172 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalL1TriggerObjects& fObject) {
1173  char buffer[1024];
1174  //first print tag and algo
1175  sprintf(buffer, "#T %s << this is the tag name \n", fObject.getTagString().c_str());
1176  fOutput << buffer;
1177  sprintf(buffer, "#A %s << this is the algorithm name \n", fObject.getAlgoString().c_str());
1178  fOutput << buffer;
1179 
1180  //then the values
1181  sprintf(buffer,
1182  "# %15s %15s %15s %15s %8s %13s %8s %10s\n",
1183  "eta",
1184  "phi",
1185  "dep",
1186  "det",
1187  "ped",
1188  "respcorrgain",
1189  "flag",
1190  "DetId");
1191  fOutput << buffer;
1192  std::vector<DetId> channels = fObject.getAllChannels();
1193  // std::sort (channels.begin(), channels.end(), DetIdLess ());
1194  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
1195  const HcalL1TriggerObject* item = fObject.getValues(*channel);
1196  if (item) {
1197  dumpId(fOutput, *channel);
1198  sprintf(buffer,
1199  " %12.7f %13.10f %12d %10X\n",
1200  item->getPedestal(),
1201  item->getRespGain(),
1202  item->getFlag(),
1203  channel->rawId());
1204  fOutput << buffer;
1205  }
1206  }
1207  return true;
1208 }
1209 
1210 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1211 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalPedestalWidths* fObject) {
1212  char buffer[1024];
1213  int linecounter = 0;
1214 
1215  while (fInput.getline(buffer, 1024)) {
1216  linecounter++;
1217  std::vector<std::string> items = splitString(std::string(buffer));
1218  if (items.empty())
1219  continue; // blank line
1220  else {
1221  if (items[0] == (std::string) "#U") {
1222  if (items[1] == (std::string) "ADC")
1223  fObject->setUnitADC(true);
1224  else if (items[1] == (std::string) "fC")
1225  fObject->setUnitADC(false);
1226  else {
1227  edm::LogWarning("Pedestal Width Unit Error")
1228  << "Unrecognized unit for pedestal widths. Assuming fC." << std::endl;
1229  fObject->setUnitADC(false);
1230  }
1231  break;
1232  } else {
1233  edm::LogWarning("Pedestal Width Unit Missing")
1234  << "The unit for the pedestal widths is missing in the txt file." << std::endl;
1235  return false;
1236  }
1237  }
1238  }
1239 
1240  while (fInput.getline(buffer, 1024)) {
1241  linecounter++;
1242  if (buffer[0] == '#')
1243  continue; //ignore comment
1244  std::vector<std::string> items = splitString(std::string(buffer));
1245  if (items.empty())
1246  continue; // blank line
1247  if (items.size() < 14) {
1248  edm::LogWarning("Format Error") << "Bad line: " << buffer << "\n line number: " << linecounter
1249  << "\n line must contain 14 items: eta, phi, depth, subdet, 10x correlations"
1250  << " or 20 items: eta, phi, depth, subdet, 16x correlations" << std::endl;
1251  continue;
1252  }
1253  DetId id = getId(items);
1254 
1255  // if (fObject->exists(id) )
1256  // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
1257  // else
1258  // {
1259 
1260  if (items.size() < 20) //old format
1261  {
1263  values.setSigma(0, 0, atof(items[4].c_str()));
1264  values.setSigma(1, 0, atof(items[5].c_str()));
1265  values.setSigma(1, 1, atof(items[6].c_str()));
1266  values.setSigma(2, 0, atof(items[7].c_str()));
1267  values.setSigma(2, 1, atof(items[8].c_str()));
1268  values.setSigma(2, 2, atof(items[9].c_str()));
1269  values.setSigma(3, 0, atof(items[10].c_str()));
1270  values.setSigma(3, 1, atof(items[11].c_str()));
1271  values.setSigma(3, 2, atof(items[12].c_str()));
1272  values.setSigma(3, 3, atof(items[13].c_str()));
1273  values.setSigma(0, 1, 0.);
1274  values.setSigma(0, 2, 0.);
1275  values.setSigma(0, 3, 0.);
1276  values.setSigma(1, 2, 0.);
1277  values.setSigma(1, 3, 0.);
1278  values.setSigma(2, 3, 0.);
1279  fObject->addValues(values);
1280  } else // new format
1281  {
1283  values.setSigma(0, 0, atof(items[4].c_str()));
1284  values.setSigma(0, 1, atof(items[5].c_str()));
1285  values.setSigma(0, 2, atof(items[6].c_str()));
1286  values.setSigma(0, 3, atof(items[7].c_str()));
1287  values.setSigma(1, 0, atof(items[8].c_str()));
1288  values.setSigma(1, 1, atof(items[9].c_str()));
1289  values.setSigma(1, 2, atof(items[10].c_str()));
1290  values.setSigma(1, 3, atof(items[11].c_str()));
1291  values.setSigma(2, 0, atof(items[12].c_str()));
1292  values.setSigma(2, 1, atof(items[13].c_str()));
1293  values.setSigma(2, 2, atof(items[14].c_str()));
1294  values.setSigma(2, 3, atof(items[15].c_str()));
1295  values.setSigma(3, 0, atof(items[16].c_str()));
1296  values.setSigma(3, 1, atof(items[17].c_str()));
1297  values.setSigma(3, 2, atof(items[18].c_str()));
1298  values.setSigma(3, 3, atof(items[19].c_str()));
1299  fObject->addValues(values);
1300  }
1301 
1302  // }
1303  }
1304  return true;
1305 }
1306 
1307 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalPedestalWidths& fObject) {
1308  char buffer[1024];
1309  if (fObject.isADC())
1310  sprintf(buffer, "#U ADC << this is the unit \n");
1311  else
1312  sprintf(buffer, "#U fC << this is the unit \n");
1313  fOutput << buffer;
1314 
1315  sprintf(buffer,
1316  "# %15s %15s %15s %15s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %8s %10s\n",
1317  "eta",
1318  "phi",
1319  "dep",
1320  "det",
1321  "cov_0_0",
1322  "cov_0_1",
1323  "cov_0_2",
1324  "cov_0_3",
1325  "cov_1_0",
1326  "cov_1_1",
1327  "cov_1_2",
1328  "cov_1_3",
1329  "cov_2_0",
1330  "cov_2_1",
1331  "cov_2_2",
1332  "cov_2_3",
1333  "cov_3_0",
1334  "cov_3_1",
1335  "cov_3_2",
1336  "cov_3_3",
1337  "DetId");
1338  fOutput << buffer;
1339  std::vector<DetId> channels = fObject.getAllChannels();
1340  std::sort(channels.begin(), channels.end(), DetIdLess());
1341  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
1342  const HcalPedestalWidth* item = fObject.getValues(*channel);
1343  if (item) {
1344  dumpId(fOutput, *channel);
1345  sprintf(buffer,
1346  " %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %8.5f %10X\n",
1347  item->getSigma(0, 0),
1348  item->getSigma(0, 1),
1349  item->getSigma(0, 2),
1350  item->getSigma(0, 3),
1351  item->getSigma(1, 0),
1352  item->getSigma(1, 1),
1353  item->getSigma(1, 2),
1354  item->getSigma(1, 3),
1355  item->getSigma(2, 0),
1356  item->getSigma(2, 1),
1357  item->getSigma(2, 2),
1358  item->getSigma(2, 3),
1359  item->getSigma(3, 0),
1360  item->getSigma(3, 1),
1361  item->getSigma(3, 2),
1362  item->getSigma(3, 3),
1363  channel->rawId());
1364  fOutput << buffer;
1365  }
1366  }
1367  return true;
1368 }
1369 
1370 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1371 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalQIEData* fObject) {
1372  char buffer[1024];
1373  while (fInput.getline(buffer, 1024)) {
1374  if (buffer[0] == '#')
1375  continue; //ignore comment
1376  std::vector<std::string> items = splitString(std::string(buffer));
1377  if (items.empty())
1378  continue;
1379  if (items[0] == "SHAPE") { // basic shape
1380  //this shape keyword is obsolete
1381  } else { // QIE parameters
1382  if (items.size() < 36) {
1383  edm::LogWarning("Format Error") << "Bad line: " << buffer
1384  << "\n line must contain 36 items: eta, phi, depth, subdet, 4 capId x 4 Ranges "
1385  "x offsets, 4 capId x 4 Ranges x slopes"
1386  << std::endl;
1387  continue;
1388  }
1389  DetId id = getId(items);
1390  fObject->sort();
1391  // try {
1392  // fObject->getCoder (id);
1393  // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
1394  // }
1395  // catch (cms::Exception& e) {
1396  HcalQIECoder coder(id.rawId());
1397  int index = 4;
1398  for (unsigned capid = 0; capid < 4; capid++) {
1399  for (unsigned range = 0; range < 4; range++) {
1400  coder.setOffset(capid, range, atof(items[index++].c_str()));
1401  }
1402  }
1403  for (unsigned capid = 0; capid < 4; capid++) {
1404  for (unsigned range = 0; range < 4; range++) {
1405  coder.setSlope(capid, range, atof(items[index++].c_str()));
1406  }
1407  }
1408 
1409  fObject->addCoder(coder);
1410  // }
1411  }
1412  }
1413  fObject->sort();
1414  return true;
1415 }
1416 
1417 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalQIEData& fObject) {
1418  char buffer[1024];
1419 
1420  fOutput << "# QIE data" << std::endl;
1421  sprintf(buffer,
1422  "# %15s %15s %15s %15s %36s %36s %36s %36s %36s %36s %36s %36s\n",
1423  "eta",
1424  "phi",
1425  "dep",
1426  "det",
1427  "4 x offsets cap0",
1428  "4 x offsets cap1",
1429  "4 x offsets cap2",
1430  "4 x offsets cap3",
1431  "4 x slopes cap0",
1432  "4 x slopes cap1",
1433  "4 x slopes cap2",
1434  "4 x slopes cap3");
1435  fOutput << buffer;
1436  std::vector<DetId> channels = fObject.getAllChannels();
1437  std::sort(channels.begin(), channels.end(), DetIdLess());
1438  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
1439  const HcalQIECoder* coder = fObject.getCoder(*channel);
1440  dumpId(fOutput, *channel);
1441  for (unsigned capid = 0; capid < 4; capid++) {
1442  for (unsigned range = 0; range < 4; range++) {
1443  sprintf(buffer, " %8.5f", coder->offset(capid, range));
1444  fOutput << buffer;
1445  }
1446  }
1447  for (unsigned capid = 0; capid < 4; capid++) {
1448  for (unsigned range = 0; range < 4; range++) {
1449  sprintf(buffer, " %8.5f", coder->slope(capid, range));
1450  fOutput << buffer;
1451  }
1452  }
1453  fOutput << std::endl;
1454  }
1455  return true;
1456 }
1457 
1458 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1459 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalCalibrationQIEData* fObject) {
1460  char buffer[1024];
1461  while (fInput.getline(buffer, 1024)) {
1462  if (buffer[0] == '#')
1463  continue; //ignore comment
1464  std::vector<std::string> items = splitString(std::string(buffer));
1465  if (items.size() < 36) {
1466  edm::LogWarning("Format Error") << "Bad line: " << buffer
1467  << "\n line must contain 36 items: eta, phi, depth, subdet, 32 bin values"
1468  << std::endl;
1469  continue;
1470  }
1471  DetId id = getId(items);
1472  fObject->sort();
1473  // try {
1474  // fObject->getCoder (id);
1475  // edm::LogWarning("Redefining Channel") << "line: " << buffer << "\n attempts to redefine data. Ignored" << std::endl;
1476  // }
1477  // catch (cms::Exception& e) {
1478  HcalCalibrationQIECoder coder(id.rawId());
1479  int index = 4;
1480  float values[32];
1481  for (unsigned bin = 0; bin < 32; bin++) {
1482  values[bin] = atof(items[index++].c_str());
1483  }
1484  coder.setMinCharges(values);
1485  fObject->addCoder(coder);
1486  // }
1487  }
1488  fObject->sort();
1489  return true;
1490 }
1491 
1492 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalCalibrationQIEData& fObject) {
1493  char buffer[1024];
1494  fOutput << "# QIE data in calibration mode" << std::endl;
1495  sprintf(buffer, "# %15s %15s %15s %15s %288s\n", "eta", "phi", "dep", "det", "32 x charges");
1496  fOutput << buffer;
1497  std::vector<DetId> channels = fObject.getAllChannels();
1498  std::sort(channels.begin(), channels.end(), DetIdLess());
1499  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
1500  const HcalCalibrationQIECoder* coder = fObject.getCoder(*channel);
1501  if (coder) {
1502  dumpId(fOutput, *channel);
1503  const float* lowEdge = coder->minCharges();
1504  for (unsigned bin = 0; bin < 32; bin++) {
1505  sprintf(buffer, " %8.5f", lowEdge[bin]);
1506  fOutput << buffer;
1507  }
1508  fOutput << std::endl;
1509  }
1510  }
1511  return true;
1512 }
1513 
1514 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1515 namespace HcalDbASCIIIO {
1516  template <>
1517  std::unique_ptr<HcalElectronicsMap> createObject<HcalElectronicsMap>(std::istream& fInput) {
1518  HcalElectronicsMapAddons::Helper fObjectHelper;
1519  char buffer[1024];
1520  while (fInput.getline(buffer, 1024)) {
1521  if (buffer[0] == '#')
1522  continue; //ignore comment
1523  std::vector<std::string> items = splitString(std::string(buffer));
1524  if (items.size() < 12) {
1525  if (items.empty())
1526  continue; // no warning here
1527  if (items.size() < 9) {
1528  edm::LogError("MapFormat") << "HcalElectronicsMap-> line too short: " << buffer;
1529  continue;
1530  }
1531  if (items[8] == "NA" || items[8] == "NT") {
1532  while (items.size() < 12)
1533  items.push_back(""); // don't worry here
1534  } else if (items[8] == "HT") {
1535  if (items.size() == 11)
1536  items.push_back("");
1537  else {
1538  edm::LogError("MapFormat") << "HcalElectronicsMap-> Bad line: " << buffer
1539  << "\n HT line must contain at least 11 items: i cr sl tb dcc spigot fiber "
1540  "fiberchan subdet=HT ieta iphi";
1541  continue;
1542  }
1543  } else {
1544  edm::LogError("MapFormat")
1545  << "HcalElectronicsMap-> Bad line: " << buffer
1546  << "\n line must contain 12 items: i cr sl tb dcc spigot fiber fiberchan subdet ieta iphi depth";
1547  continue;
1548  }
1549  }
1550  int crate = atoi(items[1].c_str());
1551  int slot = atoi(items[2].c_str());
1552  int top = 1;
1553  if (items[3] == "b")
1554  top = 0;
1555  int dcc = atoi(items[4].c_str());
1556  int spigot = atoi(items[5].c_str());
1557  HcalElectronicsId elId;
1558  if (items[3][0] == 'u') { // uTCA!
1559  int fiber = atoi(items[6].c_str());
1560  int fiberCh = atoi(items[7].c_str());
1561  bool isTrig = (items[8] == "HT" || items[8] == "NT");
1562  elId = HcalElectronicsId(crate, slot, fiber, fiberCh, isTrig);
1563  } else if (items[8] == "HT" || items[8] == "NT") {
1564  int slb = atoi(items[6].c_str());
1565  int slbCh = atoi(items[7].c_str());
1566  elId = HcalElectronicsId(slbCh, slb, spigot, dcc, crate, slot, top);
1567  } else {
1568  int fiber = atoi(items[6].c_str());
1569  int fiberCh = atoi(items[7].c_str());
1570 
1571  elId = HcalElectronicsId(fiberCh, fiber, spigot, dcc);
1572  elId.setHTR(crate, slot, top);
1573  }
1574 
1575  // first, handle undefined cases
1576  if (items[8] == "NA") { // undefined channel
1577  fObjectHelper.mapEId2chId(elId, DetId(HcalDetId::Undefined));
1578  } else if (items[8] == "NT") { // undefined trigger channel
1579  fObjectHelper.mapEId2tId(elId, DetId(HcalTrigTowerDetId::Undefined));
1580  } else {
1582  if (converter.isHcalDetId() or converter.isHcalCalibDetId() or converter.isHcalZDCDetId()) {
1583  fObjectHelper.mapEId2chId(elId, converter.getId());
1584  } else if (converter.isHcalTrigTowerDetId()) {
1585  fObjectHelper.mapEId2tId(elId, converter.getId());
1586  } else {
1587  edm::LogWarning("Format Error") << "HcalElectronicsMap-> Unknown subdetector: " << items[8] << '/' << items[9]
1588  << '/' << items[10] << '/' << items[11] << std::endl;
1589  }
1590  }
1591  }
1592  auto fObject = std::make_unique<HcalElectronicsMap>(fObjectHelper);
1593  return fObject;
1594  }
1595 } // namespace HcalDbASCIIIO
1596 
1597 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalElectronicsMap& fObject) {
1598  std::vector<HcalElectronicsId> eids = fObject.allElectronicsId();
1599  char buf[1024];
1600  // changes by Jared, 6.03.09/(included 25.03.09)
1601  // sprintf (buf, "#%10s %6s %6s %6s %6s %6s %6s %6s %15s %15s %15s %15s",
1602  sprintf(buf,
1603  "# %7s %3s %3s %3s %4s %7s %10s %14s %7s %5s %5s %6s",
1604  "i",
1605  "cr",
1606  "sl",
1607  "tb",
1608  "dcc",
1609  "spigot",
1610  "fiber/slb",
1611  "fibcha/slbcha",
1612  "subdet",
1613  "ieta",
1614  "iphi",
1615  "depth");
1616  fOutput << buf << std::endl;
1617 
1618  for (unsigned i = 0; i < eids.size(); i++) {
1619  HcalElectronicsId eid = eids[i];
1620  if (eid.isTriggerChainId()) {
1621  DetId trigger = fObject.lookupTrigger(eid);
1622  if (trigger.rawId()) {
1624  if (eid.isVMEid()) {
1625  // changes by Jared, 6.03.09/(included 25.03.09)
1626  // sprintf (buf, " %10X %6d %6d %6c %6d %6d %6d %6d %15s %15s %15s %15s",
1627  sprintf(
1628  buf,
1629  " %7X %3d %3d %3c %4d %7d %10d %14d %7s %5s %5s %6s",
1630  // i,
1631  converter.getId().rawId(),
1632  // changes by Jared, 6.03.09/(included 25.03.09)
1633  // eid.readoutVMECrateId(), eid.htrSlot(), eid.htrTopBottom()>0?'t':'b', eid.dccid(), eid.spigot(), eid.fiberIndex(), eid.fiberChanId(),
1634  eid.readoutVMECrateId(),
1635  eid.htrSlot(),
1636  eid.htrTopBottom() > 0 ? 't' : 'b',
1637  eid.dccid(),
1638  eid.spigot(),
1639  eid.slbSiteNumber(),
1640  eid.slbChannelIndex(),
1641  converter.getFlavor().c_str(),
1642  converter.getField1().c_str(),
1643  converter.getField2().c_str(),
1644  converter.getField3().c_str());
1645  fOutput << buf << std::endl;
1646  } else if (eid.isUTCAid()) {
1647  sprintf(buf,
1648  " %7X %3d %3d u %4d %7d %10d %14d %7s %5s %5s %6s",
1649  converter.getId().rawId(),
1650  // eid.crateId(), eid.slot(), 0, eid.spigot(), eid.fiberIndex(), eid.fiberChanId(),
1651  eid.crateId(),
1652  eid.slot(),
1653  0,
1654  0,
1655  eid.fiberIndex(),
1656  eid.fiberChanId(),
1657  converter.getFlavor().c_str(),
1658  converter.getField1().c_str(),
1659  converter.getField2().c_str(),
1660  converter.getField3().c_str());
1661  fOutput << buf << std::endl;
1662  } else {
1663  sprintf(buf, "NOT SUPPORTED!");
1664  fOutput << buf << std::endl;
1665  }
1666  }
1667  } else {
1668  DetId channel = fObject.lookup(eid);
1669  if (channel.rawId()) {
1671  if (eid.isVMEid()) {
1672  // changes by Jared, 6.03.09/(included 25.03.09)
1673  // sprintf (buf, " %10X %6d %6d %6c %6d %6d %6d %6d %15s %15s %15s %15s",
1674  sprintf(buf,
1675  " %7X %3d %3d %3c %4d %7d %10d %14d %7s %5s %5s %6s",
1676  // i,
1677  converter.getId().rawId(),
1678  eid.readoutVMECrateId(),
1679  eid.htrSlot(),
1680  eid.htrTopBottom() > 0 ? 't' : 'b',
1681  eid.dccid(),
1682  eid.spigot(),
1683  eid.fiberIndex(),
1684  eid.fiberChanId(),
1685  converter.getFlavor().c_str(),
1686  converter.getField1().c_str(),
1687  converter.getField2().c_str(),
1688  converter.getField3().c_str());
1689  } else {
1690  sprintf(buf,
1691  " %7X %3d %3d u %4d %7d %10d %14d %7s %5s %5s %6s",
1692  // i,
1693  converter.getId().rawId(),
1694  // eid.crateId(), eid.slot(), 0, eid.slot(), eid.fiberIndex(), eid.fiberChanId(),
1695  eid.crateId(),
1696  eid.slot(),
1697  0,
1698  0,
1699  eid.fiberIndex(),
1700  eid.fiberChanId(),
1701  converter.getFlavor().c_str(),
1702  converter.getField1().c_str(),
1703  converter.getField2().c_str(),
1704  converter.getField3().c_str());
1705  }
1706  fOutput << buf << std::endl;
1707  }
1708  }
1709  }
1710  return true;
1711 }
1712 
1713 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalLutMetadata* fObject) {
1714  if (!fObject)
1715  return false; //fObject = new HcalLutMetadata;
1716  char buffer[1024];
1717  while (fInput.getline(buffer, 1024)) {
1718  if (buffer[0] == '#')
1719  continue; //ignore comment
1720  std::vector<std::string> items = splitString(std::string(buffer));
1721  if (items.empty())
1722  continue; // blank line
1723  // now get non-channel data
1724  if (items.size() > 1 && items[0].find("RctLsb") != std::string::npos) {
1725  fObject->setRctLsb(atof(items[1].c_str()));
1726  continue;
1727  }
1728  if (items.size() > 1 && items[0].find("Gain") != std::string::npos) {
1729  fObject->setNominalGain(atof(items[1].c_str()));
1730  continue;
1731  }
1732  // now proceeed to per-channel data
1733  if (items.size() < 7) {
1734  edm::LogWarning("Format Error")
1735  << "Bad line: " << buffer
1736  << "\n line must contain 7 items: eta, phi, depth, subdet, Rcalib, LutGranularity, OutputLutThreshold"
1737  << std::endl;
1738  continue;
1739  }
1740  DetId id = getId(items);
1741 
1742  HcalLutMetadatum* fCondObject =
1743  new HcalLutMetadatum(id, atof(items[4].c_str()), atoi(items[5].c_str()), atoi(items[6].c_str()));
1744  fObject->addValues(*fCondObject);
1745  delete fCondObject;
1746  }
1747  return true;
1748 }
1749 
1750 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalLutMetadata& fObject) {
1751  char buffer[1024];
1752  const float _rctLsb = fObject.getRctLsb();
1753  const float _gain = fObject.getNominalGain();
1754  sprintf(buffer, "# %20s\n", "Non-channel data");
1755  fOutput << buffer;
1756  sprintf(buffer, "%8s %8.5f\n", "RctLsb", _rctLsb);
1757  fOutput << buffer;
1758  sprintf(buffer, "%8s %8.5f\n", "Gain", _gain);
1759  fOutput << buffer;
1760  sprintf(buffer,
1761  "# %15s %15s %15s %15s %8s %15s %19s %10s\n",
1762  "eta",
1763  "phi",
1764  "dep",
1765  "det",
1766  "Rcalib",
1767  "LutGranularity",
1768  "OutputLutThreshold",
1769  "DetId");
1770  fOutput << buffer;
1771  std::vector<DetId> channels = fObject.getAllChannels();
1772  std::sort(channels.begin(), channels.end(), DetIdLess());
1773  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
1774  const float _rCalib = fObject.getValues(*channel)->getRCalib();
1775  const uint8_t _lutGranularity = fObject.getValues(*channel)->getLutGranularity();
1776  const uint8_t _outputLutThreshold = fObject.getValues(*channel)->getOutputLutThreshold();
1777  dumpId(fOutput, *channel);
1778  sprintf(buffer, " %8.5f %15d %19d %10X\n", _rCalib, _lutGranularity, _outputLutThreshold, channel->rawId());
1779  fOutput << buffer;
1780  }
1781  return true;
1782 }
1783 
1784 //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1785 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalDcsValues* fObject) {
1786  if (!fObject)
1787  return false; //fObject = new HcalDcsValues;
1789  while (getline(fInput, buffer)) {
1790  if (buffer.at(0) == '#')
1791  continue; //ignore comment
1792  std::vector<std::string> items = splitString(buffer);
1793  if (items.empty())
1794  continue; // blank line
1795 
1796  if (items.size() < 9) {
1797  edm::LogWarning("Format Error") << "Bad line: " << buffer
1798  << "\n line must contain 9 items: subDet, side_ring, slice, type, subChannel, "
1799  "LS, Value, UpperLimit, LowerLimit"
1800  << std::endl;
1801  continue;
1802  }
1803 
1804  HcalOtherSubdetector subd;
1805  int sidering;
1806  unsigned int slice, subchan;
1807  switch (items[0].at(1)) {
1808  case 'B':
1809  subd = HcalDcsBarrel;
1810  break;
1811  case 'E':
1812  subd = HcalDcsEndcap;
1813  break;
1814  case 'F':
1815  subd = HcalDcsForward;
1816  break;
1817  case 'O':
1818  subd = HcalDcsOuter;
1819  break;
1820  default:
1821  continue;
1822  }
1823  //from_string<int>(subd, items[0], std::dec);
1824  from_string<int>(sidering, items[1], std::dec);
1825  from_string<unsigned int>(slice, items[2], std::dec);
1826  //from_string<int>(ty, items[3], std::dec);
1827  from_string<unsigned int>(subchan, items[4], std::dec);
1828 
1829  HcalDcsDetId newId(subd, sidering, slice, HcalDcsDetId::DcsTypeFromString(items[3]), subchan);
1830 
1831  int LS;
1832  float val, upper, lower;
1833  from_string<int>(LS, items[5], std::dec);
1834  from_string<float>(val, items[6], std::dec);
1835  from_string<float>(upper, items[7], std::dec);
1836  from_string<float>(lower, items[8], std::dec);
1837 
1838  HcalDcsValue newVal(newId.rawId(), LS, val, upper, lower);
1839  // std::cout << buffer << '\n';
1840  // std::cout << subd << ' ' << sidering << ' ' << slice << ' '
1841  // << ty << ' ' << subchan << ' ' << LS << ' '
1842  // << val << ' ' << upper << ' ' << lower << '\n';
1843  // std::cout << newId ;
1844  if (!(fObject->addValue(newVal))) {
1845  edm::LogWarning("Data Error") << "Data from line " << buffer << "\nwas not added to the HcalDcsValues object."
1846  << std::endl;
1847  }
1848  // std::cout << std::endl;
1849  }
1850  fObject->sortAll();
1851  return true;
1852 }
1853 
1854 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, HcalDcsValues const& fObject) {
1855  fOutput << "# subDet side_ring slice type subChan LS Value UpperLimit LowerLimit DcsId\n";
1856  for (int subd = HcalDcsValues::HcalHB; subd <= HcalDcsValues::HcalHF; ++subd) {
1857  // std::cout << "subd: " << subd << '\n';
1859  for (HcalDcsValues::DcsSet::const_iterator val = vals.begin(); val != vals.end(); ++val) {
1860  HcalDcsDetId valId(val->DcsId());
1861 
1862  switch (valId.subdet()) {
1863  case HcalDcsBarrel:
1864  fOutput << "HB ";
1865  break;
1866  case HcalDcsEndcap:
1867  fOutput << "HE ";
1868  break;
1869  case HcalDcsOuter:
1870  fOutput << "HO ";
1871  break;
1872  case HcalDcsForward:
1873  fOutput << "HF ";
1874  break;
1875  default:
1876  fOutput << valId.subdet() << ' ';
1877  }
1878 
1879  if (valId.subdet() == HcalDcsOuter)
1880  fOutput << valId.ring() << ' ';
1881  else
1882  fOutput << valId.zside() << ' ';
1883 
1884  fOutput << valId.slice() << ' ' << valId.typeString(valId.type()) << ' ' << valId.subchannel() << ' ';
1885  fOutput << val->LS() << ' ' << val->getValue() << ' ' << val->getUpperLimit() << ' ' << val->getLowerLimit()
1886  << ' ';
1887  fOutput << std::hex << val->DcsId() << std::dec << '\n';
1888 
1889  // std::cout << valId << ' '
1890  // << valId.subdet() << ' '
1891  // << val->LS() << ' ' << val->getValue() << ' '
1892  // << val->getUpperLimit() << ' ' << val->getLowerLimit()
1893  // << std::endl;
1894  }
1895  }
1896 
1897  return true;
1898 }
1899 
1900 // Format of the ASCII file:
1901 // line# Ring Slice Subchannel Subdetector Eta Phi Depth
1902 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1903 namespace HcalDbASCIIIO {
1904  template <>
1905  std::unique_ptr<HcalDcsMap> createObject<HcalDcsMap>(std::istream& fInput) {
1906  char buffer[1024];
1907  HcalDcsMapAddons::Helper fObjectHelper;
1908  while (fInput.getline(buffer, 1024)) {
1909  if (buffer[0] == '#')
1910  continue; //ignore comment
1911  std::vector<std::string> items = splitString(std::string(buffer));
1912  if (items.size() < 8) {
1913  if (items.empty())
1914  continue; // no warning here
1915  else {
1916  edm::LogError("MapFormat")
1917  << "HcalDcsMap-> Bad line: " << buffer
1918  << "\n line must contain 8 items: line side_ring slice subchannel subdet ieta iphi depth";
1919  continue;
1920  }
1921  }
1922  int ring = atoi(items[1].c_str());
1923  unsigned int slice = atoi(items[2].c_str());
1924  unsigned int subchannel = atoi(items[3].c_str());
1927  if (items[4].find("CALIB") != std::string::npos) {
1928  subdet = HcalCalibration;
1929  } else if (items[4].find("HB") != std::string::npos) {
1930  subdet = HcalDcsBarrel;
1931  } else if (items[4].find("HE") != std::string::npos) {
1932  subdet = HcalDcsEndcap;
1933  } else if (items[4].find("HO") != std::string::npos) {
1934  subdet = HcalDcsOuter;
1935  } else if (items[4].find("HF") != std::string::npos) {
1936  subdet = HcalDcsForward;
1937  } else {
1938  edm::LogError("MapFormat") << "HcalDcsMap-> Unknown subdetector, line is not accepted: " << items[5];
1939  continue;
1940  }
1941  HcalDcsDetId dcsId(subdet, ring, slice, type, subchannel);
1943  HcalDetId id(0);
1944  if (converter.isHcalDetId()) {
1945  id = converter.getId();
1946  } else {
1947  edm::LogWarning("Invalid HCAL channel") << "HcalDcsMap-> invalid channel: " << items[4] << '/' << items[5]
1948  << '/' << items[6] << '/' << items[7] << std::endl;
1949  continue;
1950  }
1951  fObjectHelper.mapGeomId2DcsId(id, dcsId);
1952  }
1953  auto fObject = std::make_unique<HcalDcsMap>(fObjectHelper);
1954  return fObject;
1955  }
1956 } // namespace HcalDbASCIIIO
1957 
1958 // Format of the ASCII file:
1959 // line# Ring Slice Subchannel Subdetector Eta Phi Depth
1960 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1961 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalDcsMap& fObject) {
1962  char buf[1024];
1963  sprintf(buf,
1964  "# %7s %10s %6s %8s %7s %5s %5s %6s",
1965  "i",
1966  "side_ring",
1967  "slice",
1968  "subchan",
1969  "subdet",
1970  "ieta",
1971  "iphi",
1972  "depth");
1973  fOutput << buf << std::endl;
1975  unsigned int line_counter = 0;
1976  for (_line = fObject.beginById(); _line != fObject.endById(); ++_line) {
1977  HcalDcsDetId dcsId = _line.getHcalDcsDetId();
1978  //std::string _dcs_type = "DCSUNKNOWN";
1979  HcalText2DetIdConverter _converter(_line.getHcalDetId());
1980  sprintf(buf,
1981  " %8X %10d %6d %8d %7s %5s %5s %6s",
1982  line_counter,
1983  dcsId.ring(), // contains zside() already
1984  dcsId.slice(),
1985  dcsId.subchannel(),
1986  _converter.getFlavor().c_str(),
1987  _converter.getField1().c_str(),
1988  _converter.getField2().c_str(),
1989  _converter.getField3().c_str());
1990  fOutput << buf << std::endl;
1991  ++line_counter;
1992  }
1993  return true;
1994 }
1995 
1996 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalFlagHFDigiTimeParams* fObject) {
1997  if (!fObject)
1998  return false; //fObject = new HcalFlagHFDigiTimeParams();
1999  char buffer[1024];
2000  while (fInput.getline(buffer, 1024)) {
2001  if (buffer[0] == '#')
2002  continue; //ignore comment
2003  std::vector<std::string> items = splitString(std::string(buffer));
2004  if (items.empty())
2005  continue; // blank line
2006  if (items.size() != 9) {
2007  edm::LogWarning("Format Error")
2008  << "Bad line: " << buffer
2009  << "\n line must contain at 9 least items: eta, phi, depth, subdet, firstSample, samplesToAdd, ExpectedPeak, "
2010  "MinEnergy, and a set of comma-separated coefficients"
2011  << std::endl;
2012  continue;
2013  }
2014  // expects (ieta, iphi, depth, subdet) as first four arguments
2016  std::vector<double> coef = splitStringToDoubleByComma(items[8]);
2017 
2018  HcalFlagHFDigiTimeParam* fCondObject = new HcalFlagHFDigiTimeParam(id,
2019  atoi(items[4].c_str()), //firstSample
2020  atoi(items[5].c_str()), //samplesToAdd
2021  atoi(items[6].c_str()), //expectedPeak
2022  atof(items[7].c_str()), // minEThreshold
2023  coef // coefficients
2024  );
2025  fObject->addValues(*fCondObject);
2026  delete fCondObject;
2027  }
2028  return true;
2029 } // getObject (HcalFlagHFDigiTime)
2030 
2031 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalFlagHFDigiTimeParams& fObject) {
2032  char buffer[1024];
2033  sprintf(buffer,
2034  "# %15s %15s %15s %15s %15s %15s %15s %15s %30s\n",
2035  "eta",
2036  "phi",
2037  "dep",
2038  "det",
2039  "FirstSample",
2040  "SamplesToAdd",
2041  "ExpectedPeak",
2042  "MinEnergy",
2043  "Coefficients");
2044  fOutput << buffer;
2045  std::vector<DetId> channels = fObject.getAllChannels();
2046  std::sort(channels.begin(), channels.end(), DetIdLess());
2047  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
2048  // Dump out channel (ieta,iphi,depth,subdet) info
2049  HcalDbASCIIIO::dumpId(fOutput, *channel);
2050  // Dump out values for channel
2051  sprintf(buffer,
2052  " %15u %15u %15u %15f",
2053  fObject.getValues(*channel)->HFdigiflagFirstSample(),
2054  fObject.getValues(*channel)->HFdigiflagSamplesToAdd(),
2055  fObject.getValues(*channel)->HFdigiflagExpectedPeak(),
2056  fObject.getValues(*channel)->HFdigiflagMinEThreshold());
2057 
2058  fOutput << buffer; // dump flag reco values to buffer
2059  fOutput << " "; // simple spacer
2060 
2061  std::vector<double> coef = fObject.getValues(*channel)->HFdigiflagCoefficients();
2062  for (std::vector<double>::size_type x = 0; x < coef.size(); ++x) {
2063  // dump comma-separated list of coefficients
2064  fOutput << coef[x];
2065  if (x < coef.size() - 1) // add commas where necessary
2066  fOutput << ",";
2067  }
2068  sprintf(buffer, "\n");
2069  fOutput << buffer;
2070  }
2071  return true;
2072 }
2073 
2074 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2075 namespace HcalDbASCIIIO {
2076  template <>
2077  std::unique_ptr<HcalFrontEndMap> createObject<HcalFrontEndMap>(std::istream& fInput) {
2078  char buffer[1024];
2079  HcalFrontEndMapAddons::Helper fObjectHelper;
2080  unsigned int all(0), good(0);
2081  while (fInput.getline(buffer, 1024)) {
2082  ++all;
2083  if (buffer[0] == '#')
2084  continue; //ignore comment
2085  std::vector<std::string> items = splitString(std::string(buffer));
2086  if (items.size() != 6) {
2087  edm::LogError("Format Error") << "HcalFrontEndMap-> line ignored: " << buffer;
2088  continue;
2089  }
2090  ++good;
2092  int rm = atoi(items[5].c_str());
2093  fObjectHelper.loadObject(id, rm, items[4]);
2094  }
2095  edm::LogInfo("MapFormat") << "HcalFrontEndMap:: processed " << good << " records in " << all << " record"
2096  << std::endl;
2097  auto fObject = std::make_unique<HcalFrontEndMap>(fObjectHelper);
2098  return fObject;
2099  }
2100 } // namespace HcalDbASCIIIO
2101 
2102 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalFrontEndMap& fObject) {
2103  char buffer[1024];
2104  sprintf(buffer, "# %15s %15s %15s %15s %8s %8s\n", "eta", "phi", "dep", "det", "rbx", "rm");
2105  fOutput << buffer;
2106 
2107  std::vector<DetId> channels = fObject.allDetIds();
2108  std::sort(channels.begin(), channels.end(), DetIdLess());
2109  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
2110  const std::string rbx = fObject.lookupRBX(*channel);
2111  const int rm = fObject.lookupRM(*channel);
2112  dumpId(fOutput, *channel);
2113  sprintf(buffer, " %8s %8d \n", rbx.c_str(), rm);
2114  fOutput << buffer;
2115  }
2116  return true;
2117 }
2118 
2119 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2120 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalSiPMParameters* fObject) {
2121  if (!fObject)
2122  return false;
2123  char buffer[1024];
2124  while (fInput.getline(buffer, 1024)) {
2125  if (buffer[0] == '#')
2126  continue; //ignore comment
2127  std::vector<std::string> items = splitString(std::string(buffer));
2128  if (items.empty())
2129  continue; // blank line
2130  if (items.size() < 9) {
2131  edm::LogWarning("Format Error") << "Bad line: " << buffer
2132  << "\n line must contain 9 items: eta, phi, depth, subdet, 5x values"
2133  << std::endl;
2134  continue;
2135  }
2137 
2139  atoi(items[4].c_str()),
2140  atof(items[5].c_str()),
2141  atof(items[6].c_str()),
2142  atoi(items[7].c_str()),
2143  atof(items[8].c_str()));
2144  fObject->addValues(*obj);
2145  delete obj;
2146  }
2147  return true;
2148 }
2149 
2150 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalSiPMParameters& fObject) {
2151  char buffer[1024];
2152  sprintf(buffer,
2153  "# %15s %15s %15s %15s %8s %15s %15s %8s %15s\n",
2154  "eta",
2155  "phi",
2156  "dep",
2157  "det",
2158  "type",
2159  "fcByPE",
2160  "darkCurrent",
2161  "auxi1",
2162  "auxi2");
2163  fOutput << buffer;
2164  std::vector<DetId> channels = fObject.getAllChannels();
2165  std::sort(channels.begin(), channels.end(), DetIdLess());
2166  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
2167  const int type = fObject.getValues(*channel)->getType();
2168  const float fcByPE = fObject.getValues(*channel)->getFCByPE();
2169  const float darkC = fObject.getValues(*channel)->getDarkCurrent();
2170  const int auxi1 = fObject.getValues(*channel)->getauxi1();
2171  const float auxi2 = fObject.getValues(*channel)->getauxi2();
2172  HcalDbASCIIIO::dumpId(fOutput, *channel);
2173  sprintf(buffer, " %8d %15.6f %15.6f %8d %15.6f\n", type, fcByPE, darkC, auxi1, auxi2);
2174  fOutput << buffer;
2175  }
2176  return true;
2177 }
2178 
2179 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2180 namespace HcalDbASCIIIO {
2181  template <>
2182  std::unique_ptr<HcalSiPMCharacteristics> createObject<HcalSiPMCharacteristics>(std::istream& fInput) {
2183  char buffer[1024];
2185  unsigned int all(0), good(0);
2186  while (fInput.getline(buffer, 1024)) {
2187  ++all;
2188  if (buffer[0] == '#')
2189  continue; //ignore comment
2190  std::vector<std::string> items = splitString(std::string(buffer));
2191  if (items.size() != 8) {
2192  edm::LogError("MapFormat") << "HcalSiPMCharacteristics-> line ignored: " << buffer;
2193  continue;
2194  }
2195  ++good;
2196  // std::cout << "HcalSiPMCharacteristics-> processing line: " << buffer << std::endl;
2197  int type = atoi(items[0].c_str());
2198  int pixels = atoi(items[1].c_str());
2199  float parL0 = atof(items[2].c_str());
2200  float parL1 = atof(items[3].c_str());
2201  float parL2 = atof(items[4].c_str());
2202  float cTalk = atof(items[5].c_str());
2203  int auxi1 = atoi(items[6].c_str());
2204  float auxi2 = atof(items[7].c_str());
2205  fObjectHelper.loadObject(type, pixels, parL0, parL1, parL2, cTalk, auxi1, auxi2);
2206  }
2207  edm::LogInfo("MapFormat") << "HcalSiPMCharacteristics:: processed " << good << " records in " << all << " record"
2208  << std::endl;
2209  auto fObject = std::make_unique<HcalSiPMCharacteristics>(fObjectHelper);
2210  return fObject;
2211  }
2212 } // namespace HcalDbASCIIIO
2213 
2214 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalSiPMCharacteristics& fObject) {
2215  char buffer[1024];
2216  sprintf(buffer,
2217  "# %8s %8s %15s %15s %15s %15s %8s %15s\n",
2218  "type",
2219  "pixels",
2220  "parLin1",
2221  "parLin2",
2222  "parLin3",
2223  "crossTalk",
2224  "auxi1",
2225  "auxi2");
2226  fOutput << buffer;
2227 
2228  unsigned int size = fObject.getTypes();
2229  for (unsigned int k = 0; k < size; ++k) {
2230  const int type = fObject.getType(k);
2231  const int pixels = fObject.getPixels(type);
2232  const std::vector<float> pars = fObject.getNonLinearities(type);
2233  const float cTalk = fObject.getCrossTalk(type);
2234  const int auxi1 = fObject.getAuxi1(type);
2235  const float auxi2 = fObject.getAuxi2(type);
2236  const float par0 = (!pars.empty()) ? pars[0] : 0;
2237  const float par1 = (pars.size() > 1) ? pars[1] : 0;
2238  const float par2 = (pars.size() > 2) ? pars[2] : 0;
2239  sprintf(
2240  buffer, " %8d %8d %15.6e %15.6e %15.6e %15.6f %8d %15.6f\n", type, pixels, par0, par1, par2, cTalk, auxi1, auxi2);
2241  fOutput << buffer;
2242  }
2243  return true;
2244 }
2245 
2246 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2247 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalTPChannelParameters* fObject) {
2248  if (!fObject)
2249  return false;
2250  char buffer[1024];
2251  while (fInput.getline(buffer, 1024)) {
2252  if (buffer[0] == '#')
2253  continue; //ignore comment
2254  std::vector<std::string> items = splitString(std::string(buffer));
2255  if (items.empty())
2256  continue; // blank line
2257  if (items.size() < 8) {
2258  edm::LogWarning("Format Error") << "Bad line: " << buffer
2259  << "\n line must contain 8 items: eta, phi, depth, subdet, 4x values"
2260  << std::endl;
2261  continue;
2262  }
2264 
2266  id.rawId(), atoi(items[4].c_str()), atoi(items[5].c_str()), atoi(items[6].c_str()), atoi(items[7].c_str()));
2267  fObject->addValues(*obj);
2268  delete obj;
2269  }
2270  return true;
2271 }
2272 
2273 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalTPChannelParameters& fObject) {
2274  char buffer[1024];
2275  sprintf(buffer,
2276  "# %15s %15s %15s %15s %15s %15s %15s %15s\n",
2277  "eta",
2278  "phi",
2279  "dep",
2280  "det",
2281  "Mask",
2282  "FGBitInfo",
2283  "auxi1",
2284  "auxi2");
2285  fOutput << buffer;
2286  std::vector<DetId> channels = fObject.getAllChannels();
2287  std::sort(channels.begin(), channels.end(), DetIdLess());
2288  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
2289  const uint32_t mask = fObject.getValues(*channel)->getMask();
2290  const uint32_t fgBitInfo = fObject.getValues(*channel)->getFGBitInfo();
2291  const int auxi1 = fObject.getValues(*channel)->getauxi1();
2292  const int auxi2 = fObject.getValues(*channel)->getauxi2();
2293  HcalDbASCIIIO::dumpId(fOutput, *channel);
2294  sprintf(buffer, " %15d %15d %15d %15d \n", mask, fgBitInfo, auxi1, auxi2);
2295  fOutput << buffer;
2296  }
2297  return true;
2298 }
2299 
2300 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2301 bool HcalDbASCIIIO::getObject(std::istream& fInput, HcalTPParameters* fObject) {
2302  char buffer[1024];
2303  unsigned int all(0), good(0);
2304  while (fInput.getline(buffer, 1024)) {
2305  ++all;
2306  if (buffer[0] == '#')
2307  continue; //ignore comment
2308  std::vector<std::string> items = splitString(std::string(buffer));
2309  if (items.size() != 6) {
2310  edm::LogError("Format Error") << "HcalTPParameters-> line ignored: " << buffer;
2311  continue;
2312  }
2313  ++good;
2314  // std::cout << "HcalTPParameters-> processing line: " << buffer << std::endl;
2315  int version = atoi(items[0].c_str());
2316  int adcCut = atoi(items[1].c_str());
2317  uint64_t tdcMask = strtoull(items[2].c_str(), nullptr, 16);
2318  uint32_t tbits = atoi(items[3].c_str());
2319  int auxi1 = atoi(items[4].c_str());
2320  int auxi2 = atoi(items[5].c_str());
2321  fObject->loadObject(version, adcCut, tdcMask, tbits, auxi1, auxi2);
2322  break;
2323  }
2324  edm::LogInfo("MapFormat") << "HcalTPParameters:: processed " << good << " records in " << all << " record"
2325  << std::endl;
2326  return true;
2327 }
2328 
2329 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalTPParameters& fObject) {
2330  char buffer[1024];
2331  sprintf(
2332  buffer, "# %15s %15s %16s %15s %15s %15s\n", "FGAlgo_HBHE", "ADCThrHF", "TDCMaskHF", "STBitsHF", "auxi1", "auxi2");
2333  fOutput << buffer;
2334 
2335  const int version = fObject.getFGVersionHBHE();
2336  const int adcCut = fObject.getADCThresholdHF();
2337  const uint64_t tdcMask = fObject.getTDCMaskHF();
2338  const uint32_t tbits = fObject.getHFTriggerInfo();
2339  const int auxi1 = fObject.getAuxi1();
2340  const int auxi2 = fObject.getAuxi2();
2341 
2342  sprintf(buffer, " %15d %15d %16jx %15x %15d %15d\n", version, adcCut, tdcMask, tbits, auxi1, auxi2);
2343  fOutput << buffer;
2344 
2345  return true;
2346 }
2347 
2348 // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2349 
2350 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalCalibrationsSet& fObject) {
2351  char buffer[1024];
2352  sprintf(buffer,
2353  "# %15s %15s %15s %15s %8s %8s %8s %8s %11s %11s %11s %11s %9s %9s %9s %9s %10s\n",
2354  "eta",
2355  "phi",
2356  "dep",
2357  "det",
2358  "pedcap0",
2359  "pedcap1",
2360  "pedcap2",
2361  "pedcap3",
2362  "effpedcap0",
2363  "effpedcap1",
2364  "effpedcap2",
2365  "effpedcap3",
2366  "gaincap0",
2367  "gaincap1",
2368  "gaincap2",
2369  "gaincap3",
2370  "DetId");
2371  fOutput << buffer;
2372 
2373  std::vector<DetId> channels = fObject.getAllChannels();
2374  std::sort(channels.begin(), channels.end(), DetIdLess());
2375  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
2376  dumpId(fOutput, *channel);
2377  const HcalCalibrations& values = fObject.getCalibrations(*channel);
2378  sprintf(buffer,
2379  " %8.5f %8.5f %8.5f %8.5f %11.5f %11.5f %11.5f %11.5f %9.5f %9.5f %9.5f %9.5f %10X\n",
2380  values.pedestal(0),
2381  values.pedestal(1),
2382  values.pedestal(2),
2383  values.pedestal(3),
2384  values.effpedestal(0),
2385  values.effpedestal(1),
2386  values.effpedestal(2),
2387  values.effpedestal(3),
2388  values.respcorrgain(0),
2389  values.respcorrgain(1),
2390  values.respcorrgain(2),
2391  values.respcorrgain(3),
2392  channel->rawId());
2393  fOutput << buffer;
2394  }
2395  return true;
2396 }
2397 
2398 bool HcalDbASCIIIO::dumpObject(std::ostream& fOutput, const HcalCalibrationWidthsSet& fObject) {
2399  char buffer[1024];
2400  sprintf(buffer,
2401  "# %15s %15s %15s %15s %9s %9s %9s %9s %12s %12s %12s %12s %10s %10s %10s %10s %10s\n",
2402  "eta",
2403  "phi",
2404  "dep",
2405  "det",
2406  "pedwcap0",
2407  "pedwcap1",
2408  "pedwcap2",
2409  "pedwcap3",
2410  "effpedwcap0",
2411  "effpedwcap1",
2412  "effpedwcap2",
2413  "effpedwcap3",
2414  "gainwcap0",
2415  "gainwcap1",
2416  "gainwcap2",
2417  "gainwcap3",
2418  "DetId");
2419  fOutput << buffer;
2420 
2421  std::vector<DetId> channels = fObject.getAllChannels();
2422  std::sort(channels.begin(), channels.end(), DetIdLess());
2423  for (std::vector<DetId>::iterator channel = channels.begin(); channel != channels.end(); ++channel) {
2424  dumpId(fOutput, *channel);
2425  const HcalCalibrationWidths& values = fObject.getCalibrationWidths(*channel);
2426  sprintf(buffer,
2427  " %9.5f %9.5f %9.5f %9.5f %12.5f %12.5f %12.5f %12.5f %10.5f %10.5f %10.5f %10.5f %10X\n",
2428  values.pedestal(0),
2429  values.pedestal(1),
2430  values.pedestal(2),
2431  values.pedestal(3),
2432  values.effpedestal(0),
2433  values.effpedestal(1),
2434  values.effpedestal(2),
2435  values.effpedestal(3),
2436  values.gain(0),
2437  values.gain(1),
2438  values.gain(2),
2439  values.gain(3),
2440  channel->rawId());
2441  fOutput << buffer;
2442  }
2443  return true;
2444 }
HcalDcsDetId::DCSUNKNOWN
Definition: HcalDcsDetId.h:42
HcalLutMetadatum
Definition: HcalLutMetadatum.h:12
HcalMCParam::packingScheme
unsigned int packingScheme() const
Definition: HcalMCParam.h:43
HcalTPParameters::getADCThresholdHF
int getADCThresholdHF() const
get ADC threshold fof TDC mask of HF
Definition: HcalTPParameters.h:21
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
HcalCalibrationQIECoder
Definition: HcalCalibrationQIECoder.h:17
HcalRecoParam::noiseFlaggingID
constexpr unsigned int noiseFlaggingID() const
Definition: HcalRecoParam.h:42
HcalTimingParam::nhits
unsigned int nhits() const
Definition: HcalTimingParam.h:15
HcalDetId::Undefined
static const HcalDetId Undefined
Definition: HcalDetId.h:273
HcalDcsValue
Definition: HcalDcsValue.h:10
HcalTPChannelParameter::getauxi2
int getauxi2() const
Definition: HcalTPChannelParameter.h:16
HcalRecoParam::correctionPhaseNS
constexpr float correctionPhaseNS() const
Definition: HcalRecoParam.h:30
HcalMCParam::binOfMaximum
unsigned int binOfMaximum() const
Definition: HcalMCParam.h:40
HcalRespCorrs
Definition: HcalRespCorrs.h:17
mps_fire.i
i
Definition: mps_fire.py:355
start
Definition: start.py:1
HcalFlagHFDigiTimeParam::HFdigiflagCoefficients
std::vector< double > HFdigiflagCoefficients() const
Definition: HcalFlagHFDigiTimeParam.h:62
HcalDbASCIIIO::dumpIdShort
void dumpIdShort(std::ostream &fOutput, DetId id)
HcalMCParams
Definition: HcalMCParams.h:9
MessageLogger.h
HcalElectronicsId::setHTR
constexpr void setHTR(int crate, int slot, int tb)
Definition: HcalElectronicsId.h:66
HcalLutMetadata::setNominalGain
bool setNominalGain(float gain)
Definition: HcalLutMetadata.cc:21
HcalCalibrationQIECoder::minCharges
const float * minCharges() const
Definition: HcalCalibrationQIECoder.cc:34
HcalTimingParam::phase
float phase() const
Definition: HcalTimingParam.h:13
HcalDcsDetId
Definition: HcalDcsDetId.h:27
HcalElectronicsMap::allElectronicsId
std::vector< HcalElectronicsId > allElectronicsId() const
Definition: HcalElectronicsMap.cc:110
HcalGenericDetId
Definition: HcalGenericDetId.h:15
dumpHcalObject
bool dumpHcalObject(std::ostream &fOutput, const T &fObject)
Definition: HcalDbASCIIIO.cc:207
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HcalCalibrationsSet
Definition: HcalCalibrationsSet.h:16
HcalLongRecoParam::noiseTS
std::vector< unsigned int > noiseTS() const
Definition: HcalLongRecoParam.h:27
HcalDcsMapAddons::Helper::mapGeomId2DcsId
bool mapGeomId2DcsId(HcalDetId fId, HcalDcsDetId fDcsId)
Definition: HcalDcsMap.cc:143
HcalDcsEndcap
Definition: HcalSubdetector.h:18
converter
Definition: CandidateProducer.h:25
HcalFlagHFDigiTimeParam::HFdigiflagSamplesToAdd
uint32_t HFdigiflagSamplesToAdd() const
Definition: HcalFlagHFDigiTimeParam.h:59
getHcalObject
bool getHcalObject(std::istream &fInput, T *fObject)
Definition: HcalDbASCIIIO.cc:176
HcalSiPMCharacteristics::getAuxi2
float getAuxi2(int type) const
Definition: HcalSiPMCharacteristics.cc:98
HcalTPParameters
Definition: HcalTPParameters.h:10
HcalTPChannelParameters
Definition: HcalTPChannelParameters.h:8
HcalPedestal::getValues
const float * getValues() const
get value for all capId = 0..3
Definition: HcalPedestal.h:18
HcalMCParam::timeSmearing
bool timeSmearing() const
Definition: HcalMCParam.h:42
AllObjects.h
HcalRecoParam::param1
constexpr unsigned int param1() const
Definition: HcalRecoParam.h:25
edm::LogInfo
Definition: MessageLogger.h:254
HcalFrontEndMapAddons::Helper::loadObject
bool loadObject(DetId fId, int rm, std::string rbx)
load a new entry
Definition: HcalFrontEndMap.cc:44
HcalSiPMParameter::getFCByPE
float getFCByPE() const
get fcByPE
Definition: HcalSiPMParameter.h:12
HcalTimingParam::rms
float rms() const
Definition: HcalTimingParam.h:14
HcalDcsDetId::ring
int ring() const
Definition: HcalDcsDetId.h:55
HcalDcsMap
Definition: HcalDcsMap.h:34
HcalSiPMCharacteristics::getNonLinearities
std::vector< float > getNonLinearities(int type) const
get nonlinearity constants
Definition: HcalSiPMCharacteristics.cc:77
HcalLutMetadata::setRctLsb
bool setRctLsb(float rctlsb)
Definition: HcalLutMetadata.cc:12
HcalSiPMParameter::getDarkCurrent
float getDarkCurrent() const
get dark current
Definition: HcalSiPMParameter.h:14
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
HcalRecoParam::leakCorrectionID
constexpr unsigned int leakCorrectionID() const
Definition: HcalRecoParam.h:36
splitString
std::vector< std::string > splitString(const std::string &fLine)
Definition: HcalDbASCIIIO.cc:58
HcalGenericDetId.h
HcalTPChannelParameter::getMask
uint32_t getMask() const
get mask for channel validity and self trigger information
Definition: HcalTPChannelParameter.h:10
HcalPedestalWidths::setUnitADC
void setUnitADC(bool isADC)
Definition: HcalPedestalWidths.h:30
HcalElectronicsMapAddons::Helper::mapEId2tId
bool mapEId2tId(HcalElectronicsId fElectronicsId, HcalTrigTowerDetId fTriggerId)
Definition: HcalElectronicsMap.cc:166
HcalChannelQuality
Definition: HcalChannelQuality.h:17
HLT_2018_cff.phase
phase
Definition: HLT_2018_cff.py:5346
HcalCalibrationWidthsSet::getCalibrationWidths
const HcalCalibrationWidths & getCalibrationWidths(const DetId id) const
Definition: HcalCalibrationWidthsSet.cc:10
pfMETCorrectionType0_cfi.par1
par1
Definition: pfMETCorrectionType0_cfi.py:48
HcalDcsMap::const_iterator
Definition: HcalDcsMap.h:85
HcalDcsValues::addValue
bool addValue(HcalDcsValue const &newVal)
Definition: HcalDcsValues.cc:10
HcalL1TriggerObjects::getAlgoString
std::string getAlgoString() const
Definition: HcalL1TriggerObjects.h:41
HcalSiPMCharacteristics::getAuxi1
int getAuxi1(int type) const
get auxiliary words
Definition: HcalSiPMCharacteristics.cc:93
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
HcalDcsValues::DcsSet
std::vector< HcalDcsValue > DcsSet
Definition: HcalDcsValues.h:27
HcalSiPMCharacteristics::getCrossTalk
float getCrossTalk(int type) const
get cross talk
Definition: HcalSiPMCharacteristics.cc:88
dqmdumpme.first
first
Definition: dqmdumpme.py:55
splitStringToDoubleByComma
std::vector< double > splitStringToDoubleByComma(const std::string &fLine)
Definition: HcalDbASCIIIO.cc:118
HcalCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition: HcalCondObjectContainer.h:159
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:26
HcalQIECoder::offset
float offset(unsigned fCapId, unsigned fRange) const
Definition: HcalQIECoder.cc:47
HcalDcsMap::beginById
const_iterator beginById(void) const
Definition: HcalDcsMap.cc:41
HcalRecoParam::correctForLeadingEdge
constexpr bool correctForLeadingEdge() const
Definition: HcalRecoParam.h:29
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
HcalOtherEmpty
Definition: HcalAssistant.h:40
HcalDcsDetId::DcsType
DcsType
Definition: HcalDcsDetId.h:29
HcalCalibrationWidthsSet::getAllChannels
std::vector< DetId > getAllChannels() const
Definition: HcalCalibrationWidthsSet.cc:32
HcalCalibrationsSet::getCalibrations
const HcalCalibrations & getCalibrations(const DetId id) const
Definition: HcalCalibrationsSet.cc:10
dumpHcalMatrixObject
bool dumpHcalMatrixObject(std::ostream &fOutput, const T &fObject)
Definition: HcalDbASCIIIO.cc:330
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
slb
static int slb(const HcalTriggerPrimitiveSample &theSample)
Definition: CastorUnpacker.cc:71
HcalElectronicsMap::lookupTrigger
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
Definition: HcalElectronicsMap.cc:80
HcalMCParam::param1
unsigned int param1() const
Definition: HcalMCParam.h:37
HcalFlagHFDigiTimeParam::HFdigiflagExpectedPeak
uint32_t HFdigiflagExpectedPeak() const
Definition: HcalFlagHFDigiTimeParam.h:60
HcalQIEData::getCoder
const HcalQIECoder * getCoder(DetId fId) const
get QIE parameters
Definition: HcalQIEData.h:37
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
HcalPedestalWidths
Definition: HcalPedestalWidths.h:17
DetId
Definition: DetId.h:17
HcalPFCorrs
Definition: HcalPFCorrs.h:17
HcalTPChannelParameter::getauxi1
int getauxi1() const
Definition: HcalTPChannelParameter.h:15
HcalPedestals
Definition: HcalPedestals.h:20
HcalLutMetadata::getRctLsb
float getRctLsb() const
Definition: HcalLutMetadata.h:25
alignCSCRings.s
s
Definition: alignCSCRings.py:92
HcalTPParameters::getHFTriggerInfo
uint32_t getHFTriggerInfo() const
get Self Trigger bits
Definition: HcalTPParameters.h:25
HcalTPParameters::getFGVersionHBHE
int getFGVersionHBHE() const
get FineGrain Algorithm Version for HBHE
Definition: HcalTPParameters.h:19
HcalLUTCorrs
Definition: HcalLUTCorrs.h:20
HcalL1TriggerObjects
Definition: HcalL1TriggerObjects.h:14
HcalCalibrationQIEData::addCoder
bool addCoder(const HcalCalibrationQIECoder &fCoder)
Definition: HcalCalibrationQIEData.h:30
HcalDbASCIIIO::createObject< HcalSiPMCharacteristics >
std::unique_ptr< HcalSiPMCharacteristics > createObject< HcalSiPMCharacteristics >(std::istream &fInput)
Definition: HcalDbASCIIIO.cc:2182
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
HcalValidationCorrs
Definition: HcalValidationCorrs.h:17
HcalQIEData::addCoder
bool addCoder(const HcalQIECoder &fCoder)
Definition: HcalQIEData.h:41
HcalRecoParam
Definition: HcalRecoParam.h:16
HcalDcsDetId.h
HcalCalibrationsSet::getAllChannels
std::vector< DetId > getAllChannels() const
Definition: HcalCalibrationsSet.cc:31
HcalSiPMCharacteristics::getType
int getType(unsigned int k) const
Definition: HcalSiPMCharacteristics.h:66
HcalDbASCIIIO::dumpId
void dumpId(std::ostream &fOutput, DetId id)
Definition: CastorDbASCIIIO.cc:76
HcalRecoParam::correctForPhaseContainment
constexpr bool correctForPhaseContainment() const
Definition: HcalRecoParam.h:28
HcalChannelStatus
Definition: HcalChannelStatus.h:13
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
HcalRecoParam::specialCaseID
constexpr unsigned int specialCaseID() const
Definition: HcalRecoParam.h:41
HcalMCParam::timePhase
float timePhase() const
Definition: HcalMCParam.h:41
HcalRecoParam::useLeakCorrection
constexpr bool useLeakCorrection() const
Definition: HcalRecoParam.h:35
HcalDcsDetId::DcsTypeFromString
static DcsType DcsTypeFromString(const std::string &str)
Definition: HcalDcsDetId.cc:25
vertices_cff.x
x
Definition: vertices_cff.py:29
dumpHcalSingleIntObject
bool dumpHcalSingleIntObject(std::ostream &fOutput, const T &fObject)
Definition: HcalDbASCIIIO.cc:284
HcalFrontEndMap::allDetIds
std::vector< DetId > allDetIds() const
Definition: HcalFrontEndMap.cc:84
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
HcalTimingParams
Definition: HcalTimingParams.h:9
splitStringToIntByComma
std::vector< unsigned int > splitStringToIntByComma(const std::string &fLine)
Definition: HcalDbASCIIIO.cc:78
HcalTPParameters::getTDCMaskHF
uint64_t getTDCMaskHF() const
get TDC mask for HF
Definition: HcalTPParameters.h:23
HcalRecoParam::packingScheme
constexpr unsigned int packingScheme() const
Definition: HcalRecoParam.h:44
submit.rm
rm
Definition: submit.py:77
HcalCalibration
Definition: HcalAssistant.h:40
HcalPedestal
Definition: HcalPedestal.h:15
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HcalDcsMap::const_iterator::getHcalDetId
HcalDetId getHcalDetId(void)
Definition: HcalDcsMap.cc:88
HcalCalibrations
Definition: HcalCalibrations.h:9
HcalRecoParam::param2
constexpr unsigned int param2() const
Definition: HcalRecoParam.h:26
OrderedSet.t
t
Definition: OrderedSet.py:90
HcalRecoParam::samplesToAdd
constexpr unsigned int samplesToAdd() const
Definition: HcalRecoParam.h:32
HcalDcsOuter
Definition: HcalSubdetector.h:19
HcalTPChannelParameter
Definition: HcalTPChannelParameter.h:7
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:97
edm::LogWarning
Definition: MessageLogger.h:141
HcalLutMetadatum::getOutputLutThreshold
uint8_t getOutputLutThreshold() const
Definition: HcalLutMetadatum.h:22
HcalL1TriggerObject
Definition: HcalL1TriggerObject.h:13
HcalFrontEndMap::lookupRBX
const std::string lookupRBX(DetId fId) const
brief lookup the RBX associated with the given logical id
Definition: HcalFrontEndMap.cc:71
HcalChannelStatus::getValue
uint32_t getValue() const
Definition: HcalChannelStatus.h:60
HcalTPParameters::getAuxi2
int getAuxi2() const
Definition: HcalTPParameters.h:28
HcalRecoParam::correctTiming
constexpr bool correctTiming() const
Definition: HcalRecoParam.h:39
edm::LogError
Definition: MessageLogger.h:183
HcalOtherSubdetector
HcalOtherSubdetector
Definition: HcalAssistant.h:40
HcalPedestalWidths::isADC
bool isADC() const
Definition: HcalPedestalWidths.h:28
HcalQIEData::sort
void sort()
Definition: HcalQIEData.h:43
HcalDcsMap::const_iterator::getHcalDcsDetId
HcalDcsDetId getHcalDcsDetId(void)
Definition: HcalDcsMap.cc:86
HcalDcsValues
Definition: HcalDcsValues.h:25
HcalDcsValues::DcsSubDet
DcsSubDet
Definition: HcalDcsValues.h:30
HcalDcsValues::getAllSubdetValues
DcsSet const & getAllSubdetValues(DcsSubDet subd) const
Definition: HcalDcsValues.cc:163
HcalFlagHFDigiTimeParam
Definition: HcalFlagHFDigiTimeParam.h:25
HcalL1TriggerObjects::getTagString
std::string getTagString() const
Definition: HcalL1TriggerObjects.h:40
HcalL1TriggerObjects::setAlgoString
void setAlgoString(std::string const &fAlgo)
Definition: HcalL1TriggerObjects.h:31
HcalRecoParam::pulseShapeID
constexpr unsigned int pulseShapeID() const
Definition: HcalRecoParam.h:33
HcalCondObjectContainer::getAllChannels
std::vector< DetId > getAllChannels() const
Definition: HcalCondObjectContainer.h:312
pfMETCorrectionType0_cfi.par2
par2
Definition: pfMETCorrectionType0_cfi.py:49
HcalTrigTowerDetId::Undefined
static const HcalTrigTowerDetId Undefined
Definition: HcalTrigTowerDetId.h:62
HcalL1TriggerObjects::setTagString
void setTagString(std::string const &fTag)
Definition: HcalL1TriggerObjects.h:22
HcalGainWidths
Definition: HcalGainWidths.h:17
HcalDetId
Definition: HcalDetId.h:12
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
HcalLongRecoParam
Definition: HcalLongRecoParam.h:15
HcalSiPMParameter::getType
int getType() const
get SiPM type
Definition: HcalSiPMParameter.h:10
value
Definition: value.py:1
HcalTimeCorrs
Definition: HcalTimeCorrs.h:17
HcalLutMetadatum::getRCalib
float getRCalib() const
Definition: HcalLutMetadatum.h:20
HcalCalibrationQIEData::getCoder
const HcalCalibrationQIECoder * getCoder(DetId fId) const
get QIE parameters
Definition: HcalCalibrationQIEData.h:26
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
HcalDcsMapAddons::Helper
Definition: HcalDcsMap.h:144
HcalQIETypes
Definition: HcalQIETypes.h:17
HcalDcsDetId::subchannel
int subchannel() const
Definition: HcalDcsDetId.h:58
HcalDbASCIIIO
Definition: HcalDbASCIIIO.h:54
getHcalSingleObject
bool getHcalSingleObject(std::istream &fInput, T *fObject)
Definition: HcalDbASCIIIO.cc:236
HcalElectronicsId.h
HcalSiPMParameter::getauxi2
float getauxi2() const
Definition: HcalSiPMParameter.h:25
HcalPedestals::isADC
bool isADC() const
Definition: HcalPedestals.h:30
HcalLongRecoParam::signalTS
std::vector< unsigned int > signalTS() const
Definition: HcalLongRecoParam.h:26
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
HcalQIEData
Definition: HcalQIEData.h:24
HcalQIECoder
Definition: HcalQIECoder.h:20
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
HcalElectronicsMap
Definition: HcalElectronicsMap.h:31
HcalDbASCIIIO::getId
DetId getId(const std::vector< std::string > &items)
Definition: CastorDbASCIIIO.cc:71
dumpHcalSingleFloatObject
bool dumpHcalSingleFloatObject(std::ostream &fOutput, const T &fObject)
Definition: HcalDbASCIIIO.cc:268
HcalDbASCIIIO::dumpObject
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
HcalMCParam
Definition: HcalMCParam.h:29
HcalFrontEndMapAddons::Helper
Definition: HcalFrontEndMap.h:96
HcalQIECoder::slope
float slope(unsigned fCapId, unsigned fRange) const
Definition: HcalQIECoder.cc:49
HcalTPParameters::loadObject
void loadObject(int version, int adcCut, uint64_t tdcMask, uint32_t tbits, int auxi1, int auxi2)
Definition: HcalTPParameters.cc:12
HcalCalibrationQIEData
Definition: HcalCalibrationQIEData.h:22
HcalMCParam::signalShape
unsigned int signalShape() const
Definition: HcalMCParam.h:38
HcalSiPMCharacteristicsAddons::Helper::loadObject
bool loadObject(int type, int pixels, float parLin1, float parLin2, float parLin3, float crossTalk, int auxi1=0, float auxi2=0)
Definition: HcalSiPMCharacteristics.cc:55
HcalDcsValues::sortAll
void sortAll()
Definition: HcalDcsValues.cc:39
HcalRecoParam::firstSample
constexpr unsigned int firstSample() const
Definition: HcalRecoParam.h:31
getHcalMatrixObject
bool getHcalMatrixObject(std::istream &fInput, T *fObject, S *fCondObject)
Definition: HcalDbASCIIIO.cc:300
HcalDcsDetId::slice
int slice() const
Definition: HcalDcsDetId.h:56
HcalFlagHFDigiTimeParams
Definition: HcalFlagHFDigiTimeParams.h:9
type
type
Definition: HCALResponse.h:21
heppy_batch.val
val
Definition: heppy_batch.py:351
HcalMCParam::syncPhase
bool syncPhase() const
Definition: HcalMCParam.h:39
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HcalLutMetadata
Definition: HcalLutMetadata.h:15
HcalDbASCIIIO.h
HcalCalibrationQIEData::sort
void sort()
Definition: HcalCalibrationQIEData.h:32
HcalElectronicsMap::lookup
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
Definition: HcalElectronicsMap.cc:70
HcalDcsBarrel
Definition: HcalSubdetector.h:17
DetIdLess::operator()
bool operator()(const SiStripRecHit2D *a, const SiStripRecHit2D *b) const
Definition: SiStripLAProfileBooker.cc:54
fitWZ.par0
par0
Definition: fitWZ.py:52
HcalRecoParam::timeslewCorrectionID
constexpr unsigned int timeslewCorrectionID() const
Definition: HcalRecoParam.h:38
es_hardcode_cfi.pixels
pixels
Definition: es_hardcode_cfi.py:40
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
T
long double T
Definition: Basic3DVectorLD.h:48
HcalZDCLowGainFractions
Definition: HcalZDCLowGainFractions.h:9
HcalElectronicsMapAddons::Helper
Definition: HcalElectronicsMap.h:137
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
HcalTPChannelParameter::getFGBitInfo
uint32_t getFGBitInfo() const
get FG bit information
Definition: HcalTPChannelParameter.h:12
HcalDbASCIIIO::getObject
bool getObject(std::istream &fInput, HcalPedestals *fObject)
ewkTauDQM_cfi.channels
channels
Definition: ewkTauDQM_cfi.py:14
HcalGains
Definition: HcalGains.h:17
HcalFrontEndMap::lookupRM
const int lookupRM(DetId fId) const
brief lookup the RM associated with the given logical id
Definition: HcalFrontEndMap.cc:58
HcalElectronicsMapAddons::Helper::mapEId2chId
bool mapEId2chId(HcalElectronicsId fElectronicsId, DetId fId)
Definition: HcalElectronicsMap.cc:182
HcalRecoParams
Definition: HcalRecoParams.h:9
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
HcalRecoParam::firstAuxTS
constexpr unsigned int firstAuxTS() const
Definition: HcalRecoParam.h:40
HcalDbASCIIIO::createObject< HcalDcsMap >
std::unique_ptr< HcalDcsMap > createObject< HcalDcsMap >(std::istream &fInput)
Definition: HcalDbASCIIIO.cc:1905
HcalFrontEndMap
Definition: HcalFrontEndMap.h:23
pileupCalc.upper
upper
Definition: pileupCalc.py:214
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
HcalLutMetadata::getNominalGain
float getNominalGain() const
Definition: HcalLutMetadata.h:28
from_string
bool from_string(T &t, const std::string &s, std::ios_base &(*f)(std::ios_base &))
Definition: HcalDbASCIIIO.cc:170
HcalDcsValues::HcalHF
Definition: HcalDcsValues.h:30
HcalFlagHFDigiTimeParam::HFdigiflagFirstSample
uint32_t HFdigiflagFirstSample() const
Definition: HcalFlagHFDigiTimeParam.h:58
S
Definition: CSCDBL1TPParametersExtended.h:16
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HcalCondObjectContainer::addValues
bool addValues(const Item &myItem)
Definition: HcalCondObjectContainer.h:234
HcalTimingParam
Definition: HcalTimingParam.h:7
trigger
Definition: HLTPrescaleTableCond.h:8
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
HcalDcsValues::HcalHB
Definition: HcalDcsValues.h:30
HcalDbASCIIIO::createObject< HcalFrontEndMap >
std::unique_ptr< HcalFrontEndMap > createObject< HcalFrontEndMap >(std::istream &fInput)
Definition: HcalDbASCIIIO.cc:2077
HcalFlagHFDigiTimeParam::HFdigiflagMinEThreshold
double HFdigiflagMinEThreshold() const
Definition: HcalFlagHFDigiTimeParam.h:61
mps_fire.result
result
Definition: mps_fire.py:303
HcalTPParameters::getAuxi1
int getAuxi1() const
get Axiliary words
Definition: HcalTPParameters.h:27
HcalLongRecoParams
Definition: HcalLongRecoParams.h:9
HcalPedestalWidth
Definition: HcalPedestalWidth.h:15
HcalText2DetIdConverter
Definition: HcalText2DetIdConverter.h:21
HcalDbASCIIIO::createObject< HcalElectronicsMap >
std::unique_ptr< HcalElectronicsMap > createObject< HcalElectronicsMap >(std::istream &fInput)
Definition: HcalDbASCIIIO.cc:1517
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
HcalZSThresholds
Definition: HcalZSThresholds.h:17
HcalLutMetadatum::getLutGranularity
uint8_t getLutGranularity() const
Definition: HcalLutMetadatum.h:21
HcalCalibrationWidths
Definition: HcalCalibrationWidths.h:9
HcalSiPMParameter::getauxi1
int getauxi1() const
Definition: HcalSiPMParameter.h:24
HcalCalibrationWidthsSet
Definition: HcalCalibrationWidthsSet.h:16
HcalRecoParam::pileupCleaningID
constexpr unsigned int pileupCleaningID() const
Definition: HcalRecoParam.h:43
DeadROC_duringRun.f1
f1
Definition: DeadROC_duringRun.py:219
HcalDcsForward
Definition: HcalSubdetector.h:20
HcalSiPMParameters
Definition: HcalSiPMParameters.h:8
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
HcalSiPMCharacteristicsAddons::Helper
Definition: HcalSiPMCharacteristics.h:106
HcalDcsMap::endById
const_iterator endById(void) const
Definition: HcalDcsMap.cc:53
splitStringToFloatByComma
std::vector< float > splitStringToFloatByComma(const std::string &fLine)
Definition: HcalDbASCIIIO.cc:98
HcalSiPMCharacteristics::getPixels
int getPixels(int type) const
get # of pixels
Definition: HcalSiPMCharacteristics.cc:72
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
HcalSiPMParameter
Definition: HcalSiPMParameter.h:7
mergeAndRegister.slice
slice
Definition: mergeAndRegister.py:121
HcalSiPMCharacteristics::getTypes
unsigned int getTypes() const
get # of types
Definition: HcalSiPMCharacteristics.h:65
HcalRecoParam::correctForTimeslew
constexpr bool correctForTimeslew() const
Definition: HcalRecoParam.h:37
HcalText2DetIdConverter.h
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
HcalPedestals::setUnitADC
void setUnitADC(bool isADC)
Definition: HcalPedestals.h:32
HcalSiPMCharacteristics
Definition: HcalSiPMCharacteristics.h:18