CMS 3D CMS Logo

DCSRecord.cc
Go to the documentation of this file.
1 #include <iomanip>
2 #include <ctime>
3 
6 
7 
9 {{
10  "EBp","EBm","EEp","EEm","HBHEa","HBHEb","HBHEc","HF","HO",
11  "RPC","DT0","DTp","DTm","CSCp","CSCm","CASTOR","ZDC",
12  "TIBTID","TOB","TECp","TECm","BPIX","FPIX","ESp","ESm"
13  }};
14 
15 
17  timestamp_(edm::Timestamp::invalidTimestamp()),
18  magnetCurrent_(-1)
19 {}
20 
21 
23 {
24  // DIP timestamp is in milliseconds
25  const uint64_t seconds = dcs.timestamp / 1000;
26  const uint32_t microseconds = (dcs.timestamp % 1000) * 1000;
27  timestamp_ = edm::Timestamp((seconds<<32) | microseconds );
30 }
31 
32 
34 
35 
36 std::ostream& operator<<(std::ostream& s, const DCSRecord& dcs)
37 {
38  const time_t ts = dcs.timestamp().unixTime();
39 
40  s << "timeStamp: " << asctime(localtime(&ts));
41 
42  std::streamsize ss = s.precision();
43  s.setf(std::ios::fixed);
44  s.precision(3);
45  s << "Magnet current (A): " << std::fixed << std::setprecision(3) << dcs.magnetCurrent() << std::endl;
46  s.unsetf(std::ios::fixed);
47  s.precision(ss);
48 
49  s << "HV state per partition:" << std::endl;
50 
51  for (unsigned int i = 0; i < DCSRecord::Partition::Last; ++i) {
52  s << " " << std::setw(7) << std::left << dcs.partitionName(i)
53  << ": " << (dcs.highVoltageReady(i)?"READY":"OFF")
54  << std::endl;
55  }
56 
57  return s;
58 }
const uint32_t highVoltageReady
std::bitset< Partition::Last > highVoltageReady_
Definition: DCSRecord.h:57
double seconds()
float magnetCurrent() const
Return the current of the CMS magnet in A.
Definition: DCSRecord.h:51
Class to contain DCS information from soft FED 1022.
Definition: DCSRecord.h:22
static const ParitionNames partitionNames_
Definition: DCSRecord.h:59
std::array< std::string, Last > ParitionNames
Get the names of all high-voltage partitions.
Definition: DCSRecord.h:41
float magnetCurrent_
Definition: DCSRecord.h:58
unsigned int unixTime() const
Time in seconds since January 1, 1970.
Definition: Timestamp.h:46
virtual ~DCSRecord()
Definition: DCSRecord.cc:33
const std::string & partitionName(const uint8_t partitionNumber) const
Return the name of the high voltage of the given parition.
Definition: DCSRecord.h:45
unsigned long long uint64_t
Definition: Time.h:15
const edm::Timestamp & timestamp() const
Return the time of the last change.
Definition: DCSRecord.h:38
HLT enums.
const uint64_t timestamp
bool highVoltageReady(const uint8_t partitionNumber) const
Return true if the high voltage of the given parition is ready.
Definition: DCSRecord.h:48
const float magnetCurrent
std::ostream & operator<<(std::ostream &s, const DCSRecord &dcs)
Pretty-print operator for DCSRecord.
Definition: DCSRecord.cc:36
edm::Timestamp timestamp_
Definition: DCSRecord.h:56