CMS 3D CMS Logo

Functions
DcsStatus.cc File Reference
#include "DataFormats/Scalers/interface/DcsStatus.h"
#include "DataFormats/Scalers/interface/ScalersRaw.h"
#include <cstdio>
#include <ostream>

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &s, const DcsStatus &c)
 Pretty-print operator for DcsStatus. More...
 

Function Documentation

◆ operator<<()

std::ostream& operator<< ( std::ostream &  s,
const DcsStatus c 
)

Pretty-print operator for DcsStatus.

Definition at line 51 of file DcsStatus.cc.

References HltBtagPostValidation_cff::c, mps_fire::i, mps_splice::line, DcsStatus::nPartitions, DcsStatus::partitionList, DcsStatus::partitionName, and alignCSCRings::s.

51  {
52  constexpr size_t kZeitBufferSize = 128;
53  char zeit[kZeitBufferSize];
54  constexpr size_t kLineBufferSize = 157;
55  char line[kLineBufferSize];
56  struct tm* hora;
57 
58  s << "DcsStatus Version: " << c.version() << " SourceID: " << c.sourceID() << std::endl;
59 
60  timespec ts = c.collectionTime();
61  hora = gmtime(&ts.tv_sec);
62  strftime(zeit, kZeitBufferSize, "%Y.%m.%d %H:%M:%S", hora);
63  snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeit, (int)ts.tv_nsec);
64  s << line << std::endl;
65 
66  snprintf(line,
67  kLineBufferSize,
68  " TrigType: %d EventID: %d BunchNumber: %d",
69  c.trigType(),
70  c.eventID(),
71  c.bunchNumber());
72  s << line << std::endl;
73 
74  snprintf(
75  line, kLineBufferSize, " MagnetCurrent: %e MagnetTemperature: %e", c.magnetCurrent(), c.magnetTemperature());
76  s << line << std::endl;
77 
78  snprintf(line, kLineBufferSize, " Ready: %d 0x%8.8X", c.ready(), c.ready());
79  s << line << std::endl;
80 
81  for (int i = 0; i < DcsStatus::nPartitions; i++) {
82  if (c.ready(DcsStatus::partitionList[i])) {
83  snprintf(line, kLineBufferSize, " %2d %6s: READY", i, DcsStatus::partitionName[i]);
84  } else {
85  snprintf(line, kLineBufferSize, " %2d %6s: NOT READY", i, DcsStatus::partitionName[i]);
86  }
87  s << line << std::endl;
88  }
89  return s;
90 }
static const char *const partitionName[]
Definition: DcsStatus.h:31
static const int partitionList[]
Definition: DcsStatus.h:30