File indexing completed on 2024-04-06 12:05:18
0001 #ifndef DATAFORMATS_TCDS_TCDSRECORD_H
0002 #define DATAFORMATS_TCDS_TCDSRECORD_H
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <bitset>
0012 #include <ostream>
0013 #include <cstdint>
0014 #include <vector>
0015
0016 #include "DataFormats/TCDS/interface/BSTRecord.h"
0017 #include "DataFormats/TCDS/interface/L1aInfo.h"
0018
0019 class TCDSRecord {
0020 public:
0021 enum BGo {
0022 LumiNibble = 0,
0023 BC0 = 1,
0024 TestEnable = 2,
0025 PrivateGap = 3,
0026 PrivateOrbit = 4,
0027 Resync = 5,
0028 HardReset = 6,
0029 EC0 = 7,
0030 OC0 = 8,
0031 Start = 9,
0032 Stop = 10,
0033 StartOfGap = 11,
0034 WarningTestEnable = 13
0035 };
0036
0037 enum BSTstatus {
0038 Unknown = 0x00000000,
0039 Reset = 0x0000dead,
0040 Unlocked = 0xfa11010c,
0041 NoData = 0xfa110acc,
0042 Okay = 0x0000bea0
0043 };
0044
0045 TCDSRecord();
0046 TCDSRecord(const unsigned char* rawData);
0047 virtual ~TCDSRecord();
0048
0049
0050 uint64_t getMacAddress() const { return macAddress_; }
0051
0052
0053 uint32_t getSwVersion() const { return swVersion_; }
0054
0055
0056 uint32_t getFwVersion() const { return fwVersion_; }
0057
0058
0059 uint32_t getRecordVersion() const { return recordVersion_; }
0060
0061
0062 uint32_t getRunNumber() const { return runNumber_; }
0063
0064
0065 uint32_t getLumiSection() const { return lumiSection_; }
0066
0067
0068 uint32_t getNibble() const { return nibble_; }
0069
0070
0071 uint16_t getNibblesPerLumiSection() const { return nibblesPerLumiSection_; }
0072
0073
0074 uint16_t getEventType() const { return eventType_; }
0075
0076
0077
0078
0079 uint16_t getTriggerTypeFlags() const { return triggerTypeFlags_; }
0080
0081
0082 uint16_t getInputs() const { return inputs_; }
0083
0084
0085 uint16_t getBXID() const { return bxid_; }
0086
0087
0088 uint64_t getOrbitNr() const { return orbitNr_; }
0089
0090
0091 uint64_t getTriggerCount() const { return triggerCount_; }
0092
0093
0094 uint64_t getEventNumber() const { return eventNumber_; }
0095
0096
0097 uint32_t getBstReceptionStatus() const { return bstReceptionStatus_; }
0098
0099
0100 const BSTRecord& getBST() const { return bst_; }
0101
0102
0103 uint16_t getSourceID() const { return sourceid_; }
0104
0105
0106 typedef std::bitset<96> ActivePartitions;
0107 ActivePartitions getActivePartitions() const { return activePartitions_; }
0108
0109
0110 typedef std::vector<L1aInfo> L1aHistory;
0111 const L1aHistory& getFullL1aHistory() const { return l1aHistory_; }
0112 const L1aInfo& getL1aHistoryEntry(const uint8_t entry) const { return l1aHistory_.at(entry); }
0113
0114
0115 uint32_t getOrbitOfLastBgo(const uint16_t bgo) const { return lastBgos_.at(bgo); }
0116
0117
0118 uint32_t getLastOrbitCounter0() const { return lastBgos_.at(BGo::OC0); }
0119
0120
0121 uint32_t getLastTestEnable() const { return lastBgos_.at(BGo::TestEnable); }
0122
0123
0124 uint32_t getLastResync() const { return lastBgos_.at(BGo::Resync); }
0125
0126
0127 uint32_t getLastStart() const { return lastBgos_.at(BGo::Start); }
0128
0129
0130 uint32_t getLastEventCounter0() const { return lastBgos_.at(BGo::EC0); }
0131
0132
0133 uint32_t getLastHardReset() const { return lastBgos_.at(BGo::HardReset); }
0134
0135 private:
0136 uint64_t orbitNr_;
0137 uint64_t triggerCount_;
0138 uint64_t eventNumber_;
0139 uint64_t macAddress_;
0140 uint32_t swVersion_;
0141 uint32_t fwVersion_;
0142 uint32_t recordVersion_;
0143 uint32_t runNumber_;
0144 uint32_t bstReceptionStatus_;
0145 uint32_t nibble_;
0146 uint32_t lumiSection_;
0147 uint16_t nibblesPerLumiSection_;
0148 uint16_t eventType_;
0149 uint16_t triggerTypeFlags_;
0150 uint16_t inputs_;
0151 uint16_t bxid_;
0152 uint16_t sourceid_;
0153
0154 ActivePartitions activePartitions_;
0155 L1aHistory l1aHistory_;
0156
0157 BSTRecord bst_;
0158
0159 std::vector<uint32_t> lastBgos_;
0160 };
0161
0162
0163 std::ostream& operator<<(std::ostream&, const TCDSRecord&);
0164
0165 #endif