File indexing completed on 2024-04-06 12:04:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef DataFormats_CTPPSDigi_TotemVFATStatus
0011 #define DataFormats_CTPPSDigi_TotemVFATStatus
0012
0013 #include <bitset>
0014 #include <map>
0015 #include <cstdint>
0016
0017
0018
0019
0020
0021
0022 class TotemVFATStatus {
0023 public:
0024 TotemVFATStatus(uint8_t cp = 0)
0025 : chipPosition_(cp), status(0), numberOfClustersSpecified(false), numberOfClusters_(0), eventCounter(0) {}
0026
0027
0028 inline uint8_t chipPosition() const { return chipPosition_; }
0029 inline void setChipPosition(uint8_t cp) { chipPosition_ = cp; }
0030
0031
0032 inline bool isMissing() const { return status[0]; }
0033 inline void setMissing(bool val = true) { status[0] = val; }
0034
0035
0036 inline bool isIDMismatch() const { return status[1]; }
0037 inline void setIDMismatch(bool val = true) { status[1] = val; }
0038
0039
0040 inline bool isFootprintError() const { return status[2]; }
0041 inline void setFootprintError(bool val = true) { status[2] = val; }
0042
0043
0044 inline bool isCRCError() const { return status[3]; }
0045 inline void setCRCError(bool val = true) { status[3] = val; }
0046
0047
0048 inline bool isECProgressError() const { return status[4]; }
0049 inline void setECProgressError(bool val = true) { status[4] = val; }
0050
0051
0052 inline bool isBCProgressError() const { return status[5]; }
0053 inline void setBCProgressError(bool val = true) { status[5] = val; }
0054
0055
0056 inline bool isFullyMaskedOut() const { return status[6]; }
0057 inline void setFullyMaskedOut() { status[6] = true; }
0058
0059
0060 inline bool isPartiallyMaskedOut() const { return status[7]; }
0061 inline void setPartiallyMaskedOut() { status[7] = true; }
0062
0063
0064 inline bool isNotMasked() const { return !(status[6] || status[7]); }
0065 inline void setNotMasked() { status[6] = status[7] = false; }
0066
0067 bool isOK() const { return !(status[0] || status[1] || status[2] || status[3] || status[4] || status[5]); }
0068
0069
0070 inline bool isNumberOfClustersSpecified() const { return numberOfClustersSpecified; }
0071 inline void setNumberOfClustersSpecified(bool v) { numberOfClustersSpecified = v; }
0072
0073 inline uint8_t numberOfClusters() const { return numberOfClusters_; }
0074 inline void setNumberOfClusters(uint8_t v) { numberOfClusters_ = v; }
0075
0076 bool operator<(const TotemVFATStatus& cmp) const { return (status.to_ulong() < cmp.status.to_ulong()); }
0077
0078 friend std::ostream& operator<<(std::ostream& s, const TotemVFATStatus& st);
0079
0080
0081 inline uint8_t ec() const { return eventCounter; }
0082 inline void setEC(const uint8_t ec) { eventCounter = ec; }
0083
0084 private:
0085
0086 uint8_t chipPosition_;
0087
0088
0089 std::bitset<8> status;
0090
0091
0092 bool numberOfClustersSpecified;
0093 uint8_t numberOfClusters_;
0094
0095
0096 uint8_t eventCounter;
0097 };
0098
0099 #endif