CMS 3D CMS Logo

CTPPSRecord.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_ONLINEMETADATA_CTPPSRECORD_H
2 #define DATAFORMATS_ONLINEMETADATA_CTPPSRECORD_H
3 
4 //---------------------------------------------------------------------------
9 //---------------------------------------------------------------------------
10 
11 
12 #include <array>
13 #include <bitset>
14 #include <cstdint>
15 #include <ostream>
16 #include <string>
17 
20 
21 
23 {
24 public:
25 
26  enum RomanPot {
46  };
47 
48  enum Status {
50  bad,
53  };
54 
55  CTPPSRecord();
56  explicit CTPPSRecord(const online::CTPPS_v1&);
57  virtual ~CTPPSRecord();
58 
60  const edm::Timestamp& timestamp() const { return timestamp_; }
61 
63  typedef std::array<std::string,Last> RomanPotNames;
64  const RomanPotNames& romanPotNames() const { return romanPotNames_; }
65 
67  const std::string& romanPotName(const uint8_t rp) const { return romanPotNames_.at(rp); }
68 
70  Status status(const uint8_t rp) const { return Status((status_ >> (rp*2)) & 0x3); }
71 
73  const std::string& statusName(const uint8_t rp) const { return statusNames_.at( status(rp) ); }
74 
75 
76 private:
77 
80  static const std::array<std::string,4> statusNames_;
81  static const RomanPotNames romanPotNames_;
82 
83 };
84 
86 std::ostream& operator<<(std::ostream&, const CTPPSRecord&);
87 
88 #endif // DATAFORMATS_ONLINEMETADATA_CTPPSRECORD_H
const std::string & statusName(const uint8_t rp) const
Return the status as string.
Definition: CTPPSRecord.h:73
static const RomanPotNames romanPotNames_
Definition: CTPPSRecord.h:81
std::ostream & operator<<(std::ostream &, const CTPPSRecord &)
Pretty-print operator for CTPPSRecord.
Definition: CTPPSRecord.cc:53
const RomanPotNames & romanPotNames() const
Definition: CTPPSRecord.h:64
const std::string & romanPotName(const uint8_t rp) const
Return the name of the roman pot.
Definition: CTPPSRecord.h:67
const edm::Timestamp & timestamp() const
Return the time of the last change.
Definition: CTPPSRecord.h:60
Status status(const uint8_t rp) const
Return the status of the given roman pot.
Definition: CTPPSRecord.h:70
unsigned long long uint64_t
Definition: Time.h:15
uint64_t status_
Definition: CTPPSRecord.h:79
virtual ~CTPPSRecord()
Definition: CTPPSRecord.cc:50
std::array< std::string, Last > RomanPotNames
Get the names of all roman pots.
Definition: CTPPSRecord.h:63
Class to contain CTPPS information from soft FED 1022.
Definition: CTPPSRecord.h:22
static const std::array< std::string, 4 > statusNames_
Definition: CTPPSRecord.h:80
edm::Timestamp timestamp_
Definition: CTPPSRecord.h:78