CMS 3D CMS Logo

DcsStatus.cc
Go to the documentation of this file.
1 /*
2  * File: DataFormats/Scalers/src/DcsStatus.cc (W.Badgett)
3  */
4 
7 #include <cstdio>
8 #include <ostream>
9 
10 const int DcsStatus::partitionList[DcsStatus::nPartitions] = {EBp, EBm, EEp, EEm, HBHEa, HBHEb, HBHEc, HF, HO,
11  RPC, DT0, DTp, DTm, CSCp, CSCm, CASTOR, ZDC, TIBTID,
12  TOB, TECp, TECm, BPIX, FPIX, ESp, ESm};
13 
15  "EBp", "EBm", "EEp", "EEm", "HBHEa", "HBHEb", "HBHEc", "HF", "HO", "RPC", "DT0", "DTp", "DTm",
16  "CSCp", "CSCm", "CASTOR", "ZDC", "TIBTID", "TOB", "TECp", "TECm", "BPIX", "FPIX", "ESp", "ESm"};
17 
19  : trigType_(0),
20  eventID_(0),
21  sourceID_(0),
22  bunchNumber_(0),
23  version_(0),
24  collectionTime_(0, 0),
25  ready_(0),
26  magnetCurrent_((float)0.0),
27  magnetTemperature_((float)0.0) {}
28 
29 DcsStatus::DcsStatus(const unsigned char* rawData) {
30  DcsStatus();
31 
32  struct ScalersEventRecordRaw_v4 const* raw = reinterpret_cast<struct ScalersEventRecordRaw_v4 const*>(rawData);
33  trigType_ = (raw->header >> 56) & 0xFULL;
34  eventID_ = (raw->header >> 32) & 0x00FFFFFFULL;
35  sourceID_ = (raw->header >> 8) & 0x00000FFFULL;
36  bunchNumber_ = (raw->header >> 20) & 0xFFFULL;
37 
38  version_ = raw->version;
39  if (version_ >= 4) {
40  collectionTime_.set_tv_sec(static_cast<long>(raw->dcsStatus.collectionTime_sec));
42  ready_ = raw->dcsStatus.ready;
45  }
46 }
47 
49 
51 std::ostream& operator<<(std::ostream& s, const DcsStatus& c) {
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 }
CastorDigiToRaw_cfi.CASTOR
CASTOR
Definition: CastorDigiToRaw_cfi.py:4
l1t::mtf7::RPC
RPC Data Record : block->header().getID() = 4.
Definition: Block.h:20
DcsStatus::eventID_
unsigned int eventID_
Definition: DcsStatus.h:95
DcsStatus
Definition: DcsStatus.h:28
ScalersEventRecordRaw_v4
Definition: ScalersRaw.h:210
DigiToRawDM_cff.ZDC
ZDC
Definition: DigiToRawDM_cff.py:24
mps_fire.i
i
Definition: mps_fire.py:428
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
DcsStatus::sourceID_
unsigned int sourceID_
Definition: DcsStatus.h:96
DcsStatus.h
DcsStatus::trigType_
unsigned int trigType_
Definition: DcsStatus.h:94
DcsStatus::partitionName
static const char *const partitionName[]
Definition: DcsStatus.h:31
SectorBuilder_Fpix_cff.FPIX
FPIX
Definition: SectorBuilder_Fpix_cff.py:16
DcsStatus::ready_
unsigned int ready_
Definition: DcsStatus.h:102
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:162
TimeSpec::set_tv_nsec
void set_tv_nsec(long value)
Definition: TimeSpec.h:19
DcsStatus::magnetCurrent_
float magnetCurrent_
Definition: DcsStatus.h:103
ScalersRaw.h
watchdog.const
const
Definition: watchdog.py:83
AlignmentPI::PARTITION::TECp
ScalersEventRecordRaw_v4::dcsStatus
struct DcsStatusRaw_v4 dcsStatus
Definition: ScalersRaw.h:216
alignCSCRings.s
s
Definition: alignCSCRings.py:92
TimeSpec::set_tv_sec
void set_tv_sec(long value)
Definition: TimeSpec.h:18
DcsStatus::bunchNumber_
unsigned int bunchNumber_
Definition: DcsStatus.h:97
BPIX
#define BPIX
Definition: PixelCalibConfiguration.cc:22
DcsStatus::collectionTime_
TimeSpec collectionTime_
Definition: DcsStatus.h:101
DigiToRawDM_cff.HO
HO
Definition: DigiToRawDM_cff.py:23
DcsStatus::~DcsStatus
virtual ~DcsStatus()
Definition: DcsStatus.cc:48
DcsStatus::DcsStatus
DcsStatus()
Definition: DcsStatus.cc:18
DcsStatus::nPartitions
Definition: DcsStatus.h:59
DcsStatusRaw_v4::ready
unsigned int ready
Definition: ScalersRaw.h:176
DcsStatusRaw_v4::collectionTime_sec
unsigned int collectionTime_sec
Definition: ScalersRaw.h:174
DcsStatus::version_
int version_
Definition: DcsStatus.h:99
DcsStatus::partitionList
static const int partitionList[]
Definition: DcsStatus.h:30
ScalersEventRecordRaw_v4::header
unsigned long long header
Definition: ScalersRaw.h:211
DcsStatus::magnetTemperature_
float magnetTemperature_
Definition: DcsStatus.h:104
ScalersEventRecordRaw_v4::version
int version
Definition: ScalersRaw.h:212
operator<<
std::ostream & operator<<(std::ostream &s, const DcsStatus &c)
Pretty-print operator for DcsStatus.
Definition: DcsStatus.cc:51
DcsStatusRaw_v4::magnetTemperature
float magnetTemperature
Definition: ScalersRaw.h:178
DcsStatusRaw_v4::magnetCurrent
float magnetCurrent
Definition: ScalersRaw.h:177
DcsStatusRaw_v4::collectionTime_nsec
unsigned int collectionTime_nsec
Definition: ScalersRaw.h:175
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
mps_splice.line
line
Definition: mps_splice.py:76
DigiToRawDM_cff.HF
HF
Definition: DigiToRawDM_cff.py:22
SectorBuilder_Tob_cff.TOB
TOB
Definition: SectorBuilder_Tob_cff.py:16
AlignmentPI::PARTITION::TECm