CMS 3D CMS Logo

TCDSRecord.h
Go to the documentation of this file.
1 #ifndef DATAFORMATS_TCDS_TCDSRECORD_H
2 #define DATAFORMATS_TCDS_TCDSRECORD_H
3 
4 //---------------------------------------------------------------------------
9 //---------------------------------------------------------------------------
10 
11 
12 #include <bitset>
13 #include <ostream>
14 #include <cstdint>
15 #include <vector>
16 
19 
20 
22 {
23 public:
24 
25  enum BGo {
27  BC0 = 1,
31  Resync = 5,
32  HardReset = 6,
33  EC0 = 7,
34  OC0 = 8,
35  Start = 9,
36  Stop = 10,
37  StartOfGap = 11,
39  };
40 
41  enum BSTstatus {
42  Unknown = 0x00000000,
43  Reset = 0x0000dead,
44  Unlocked = 0xfa11010c,
45  NoData = 0xfa110acc,
46  Okay = 0x0000bea0
47  };
48 
49  TCDSRecord();
50  TCDSRecord(const unsigned char* rawData);
51  virtual ~TCDSRecord();
52 
53  // MAC address of the CPM
54  uint64_t getMacAddress() const { return macAddress_; }
55 
56  // Software version of TCDS s/w
57  uint32_t getSwVersion() const { return swVersion_; }
58 
59  // Firmware version of the CPM
60  uint32_t getFwVersion() const { return fwVersion_; }
61 
62  // Version of the TCDS record
63  uint32_t getRecordVersion() const { return recordVersion_; }
64 
65  // Run number
66  uint32_t getRunNumber() const { return runNumber_; }
67 
68  // Lumi section number
69  uint32_t getLumiSection() const { return lumiSection_; }
70 
71  // Lumi nibble number
72  uint32_t getNibble() const { return nibble_; }
73 
74  // Number of nibbles per lumi section
75  uint16_t getNibblesPerLumiSection() const { return nibblesPerLumiSection_; }
76 
77  // The event type corresponding to edm::EventAuxiliary::ExperimentType
78  uint16_t getEventType() const { return eventType_; }
79 
80  // The trigger word contains sixteen boolean flags corresponding to the sixteen trigger types
81  // (see https://twiki.cern.ch/twiki/bin/view/CMS/TcdsEventRecord#TCDS_Event_Trigger_Type_Definiti)
82  // If a given trigger type fired for this event, the corresponding flag will be true.
83  uint16_t getTriggerTypeFlags() const { return triggerTypeFlags_; }
84 
85  // Input state at Triggered BX +/- 3, currently zeros
86  uint16_t getInputs() const { return inputs_; }
87 
88  // Bunch-crossing identified
89  uint16_t getBXID() const { return bxid_; }
90 
91  // Orbit number
92  uint64_t getOrbitNr() const { return orbitNr_; }
93 
94  // Number of triggers since last EC0
96 
97  // Number of events since start of the run (last OC0)
98  uint64_t getEventNumber() const { return eventNumber_; }
99 
100  // BST reception status corresponding to TCDSRecord::BSTstatus
101  uint32_t getBstReceptionStatus() const { return bstReceptionStatus_; }
102 
103  // The BST message as received from the LHC
104  const BSTRecord& getBST() const { return bst_; }
105 
106  // List of active paritions, currently not implemented
107  typedef std::bitset<96> ActivePartitions;
108  ActivePartitions getActivePartitions() const { return activePartitions_; }
109 
110  // History of recent L1 accepts
111  typedef std::vector<L1aInfo> L1aHistory;
112  const L1aHistory& getFullL1aHistory() const { return l1aHistory_; }
113  const L1aInfo& getL1aHistoryEntry(const uint8_t entry) const { return l1aHistory_.at(entry); }
114 
115  // Orbit number when the given Bgo was sent last
116  uint32_t getOrbitOfLastBgo(const uint16_t bgo) const { return lastBgos_.at(bgo); }
117 
118  // Orbit number of last OC0
119  uint32_t getLastOrbitCounter0() const { return lastBgos_.at(BGo::OC0); }
120 
121  // Orbit number of last Test Enable
122  uint32_t getLastTestEnable() const { return lastBgos_.at(BGo::TestEnable); }
123 
124  // Orbit number of last Resync
125  uint32_t getLastResync() const { return lastBgos_.at(BGo::Resync); }
126 
127  // Orbit number of last Start
128  uint32_t getLastStart() const { return lastBgos_.at(BGo::Start); }
129 
130  // Orbit number of last EC0
131  uint32_t getLastEventCounter0() const { return lastBgos_.at(BGo::EC0); }
132 
133  // Orbit number of last Hard Reset
134  uint32_t getLastHardReset() const { return lastBgos_.at(BGo::HardReset); }
135 
136 
137 private:
138 
143  uint32_t swVersion_;
144  uint32_t fwVersion_;
145  uint32_t recordVersion_;
146  uint32_t runNumber_;
148  uint32_t nibble_;
149  uint32_t lumiSection_;
151  uint16_t eventType_;
153  uint16_t inputs_;
154  uint16_t bxid_;
155 
156  ActivePartitions activePartitions_;
157  L1aHistory l1aHistory_;
158 
160 
161  std::vector<uint32_t> lastBgos_;
162 
163 };
164 
166 std::ostream& operator<<(std::ostream&, const TCDSRecord&);
167 
168 #endif // DATAFORMATS_TCDS_TCDSRECORD_H
uint16_t triggerTypeFlags_
Definition: TCDSRecord.h:152
uint32_t getRecordVersion() const
Definition: TCDSRecord.h:63
const BSTRecord & getBST() const
Definition: TCDSRecord.h:104
std::ostream & operator<<(std::ostream &, const TCDSRecord &)
Pretty-print operator for TCDSRecord.
Definition: TCDSRecord.cc:72
uint32_t getLastResync() const
Definition: TCDSRecord.h:125
uint16_t getNibblesPerLumiSection() const
Definition: TCDSRecord.h:75
uint32_t getLastOrbitCounter0() const
Definition: TCDSRecord.h:119
L1aHistory l1aHistory_
Definition: TCDSRecord.h:157
uint64_t getOrbitNr() const
Definition: TCDSRecord.h:92
uint32_t getNibble() const
Definition: TCDSRecord.h:72
uint64_t triggerCount_
Definition: TCDSRecord.h:140
uint32_t bstReceptionStatus_
Definition: TCDSRecord.h:147
uint32_t getLastTestEnable() const
Definition: TCDSRecord.h:122
uint32_t lumiSection_
Definition: TCDSRecord.h:149
uint16_t inputs_
Definition: TCDSRecord.h:153
uint64_t orbitNr_
Definition: TCDSRecord.h:139
uint32_t runNumber_
Definition: TCDSRecord.h:146
Class to contain L1 accept history information from TCDS FED.
Definition: L1aInfo.h:17
Class to contain information from TCDS FED.
Definition: TCDSRecord.h:21
BSTRecord bst_
Definition: TCDSRecord.h:159
std::bitset< 96 > ActivePartitions
Definition: TCDSRecord.h:107
uint64_t getTriggerCount() const
Definition: TCDSRecord.h:95
uint16_t eventType_
Definition: TCDSRecord.h:151
uint16_t bxid_
Definition: TCDSRecord.h:154
Class representing the Beam Synchronous Timing (BST) information included in the TCDS record...
Definition: BSTRecord.h:23
ActivePartitions activePartitions_
Definition: TCDSRecord.h:156
uint32_t getBstReceptionStatus() const
Definition: TCDSRecord.h:101
uint16_t nibblesPerLumiSection_
Definition: TCDSRecord.h:150
std::vector< L1aInfo > L1aHistory
Definition: TCDSRecord.h:111
uint16_t getInputs() const
Definition: TCDSRecord.h:86
std::vector< uint32_t > lastBgos_
Definition: TCDSRecord.h:161
ActivePartitions getActivePartitions() const
Definition: TCDSRecord.h:108
uint32_t getFwVersion() const
Definition: TCDSRecord.h:60
virtual ~TCDSRecord()
Definition: TCDSRecord.cc:69
unsigned long long uint64_t
Definition: Time.h:15
uint16_t getTriggerTypeFlags() const
Definition: TCDSRecord.h:83
uint32_t fwVersion_
Definition: TCDSRecord.h:144
uint32_t getLastHardReset() const
Definition: TCDSRecord.h:134
uint64_t getMacAddress() const
Definition: TCDSRecord.h:54
uint16_t getBXID() const
Definition: TCDSRecord.h:89
uint32_t nibble_
Definition: TCDSRecord.h:148
uint32_t getOrbitOfLastBgo(const uint16_t bgo) const
Definition: TCDSRecord.h:116
const L1aHistory & getFullL1aHistory() const
Definition: TCDSRecord.h:112
uint32_t recordVersion_
Definition: TCDSRecord.h:145
uint32_t getLastEventCounter0() const
Definition: TCDSRecord.h:131
uint64_t getEventNumber() const
Definition: TCDSRecord.h:98
uint16_t getEventType() const
Definition: TCDSRecord.h:78
uint32_t getSwVersion() const
Definition: TCDSRecord.h:57
const L1aInfo & getL1aHistoryEntry(const uint8_t entry) const
Definition: TCDSRecord.h:113
uint32_t getLastStart() const
Definition: TCDSRecord.h:128
uint64_t macAddress_
Definition: TCDSRecord.h:142
uint32_t swVersion_
Definition: TCDSRecord.h:143
uint32_t getRunNumber() const
Definition: TCDSRecord.h:66
uint32_t getLumiSection() const
Definition: TCDSRecord.h:69
uint64_t eventNumber_
Definition: TCDSRecord.h:141