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

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

Pretty-print operator for DcsStatus.

Definition at line 103 of file DcsStatus.cc.

References DcsStatus::bunchNumber(), DcsStatus::collectionTime(), constexpr, DcsStatus::eventID(), mps_fire::i, mps_splice::line, DcsStatus::magnetCurrent(), DcsStatus::magnetTemperature(), DcsStatus::nPartitions, DcsStatus::partitionList, DcsStatus::partitionName, DcsStatus::ready(), alignCSCRings::s, DcsStatus::sourceID(), DcsStatus::trigType(), and DcsStatus::version().

104 {
105  constexpr size_t kZeitBufferSize = 128;
106  char zeit[kZeitBufferSize];
107  constexpr size_t kLineBufferSize = 157;
108  char line[kLineBufferSize];
109  struct tm * hora;
110 
111  s << "DcsStatus Version: " << c.version() <<
112  " SourceID: "<< c.sourceID() << std::endl;
113 
114  timespec ts = c.collectionTime();
115  hora = gmtime(&ts.tv_sec);
116  strftime(zeit, kZeitBufferSize, "%Y.%m.%d %H:%M:%S", hora);
117  snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeit,
118  (int)ts.tv_nsec);
119  s << line << std::endl;
120 
121  snprintf(line, kLineBufferSize, " TrigType: %d EventID: %d BunchNumber: %d",
122  c.trigType(), c.eventID(), c.bunchNumber());
123  s << line << std::endl;
124 
125  snprintf(line, kLineBufferSize, " MagnetCurrent: %e MagnetTemperature: %e",
127  s << line << std::endl;
128 
129  snprintf(line,kLineBufferSize," Ready: %d 0x%8.8X", c.ready(), c.ready());
130  s << line << std::endl;
131 
132  for ( int i=0; i<DcsStatus::nPartitions; i++)
133  {
135  {
136  snprintf(line,kLineBufferSize," %2d %6s: READY", i, DcsStatus::partitionName[i]);
137  }
138  else
139  {
140  snprintf(line,kLineBufferSize," %2d %6s: NOT READY", i, DcsStatus::partitionName[i]);
141  }
142  s << line << std::endl;
143  }
144  return s;
145 }
unsigned int trigType() const
Definition: DcsStatus.h:76
timespec collectionTime() const
Definition: DcsStatus.h:82
unsigned int bunchNumber() const
Definition: DcsStatus.h:79
float magnetTemperature() const
Definition: DcsStatus.h:90
#define constexpr
int version() const
Definition: DcsStatus.h:81
unsigned int ready() const
Definition: DcsStatus.h:84
unsigned int sourceID() const
Definition: DcsStatus.h:78
static const char *const partitionName[]
Definition: DcsStatus.h:33
float magnetCurrent() const
Definition: DcsStatus.h:89
unsigned int eventID() const
Definition: DcsStatus.h:77
static const int partitionList[]
Definition: DcsStatus.h:32