CMS 3D CMS Logo

UCTAMCRawData.h
Go to the documentation of this file.
1 #ifndef UCTAMCRawData_hh
2 #define UCTAMCRawData_hh
3 
4 class UCTAMCRawData {
5 public:
6  UCTAMCRawData(const uint32_t *d) : myDataPtr(d) {}
7 
8  // No copy constructor and equality operator are needed
9  UCTAMCRawData(const UCTAMCRawData &) = delete;
10  const UCTAMCRawData &operator=(const UCTAMCRawData &i) = delete;
11 
12  virtual ~UCTAMCRawData() { ; }
13 
14  // Access functions for convenience
15 
16  const uint32_t *dataPtr() const { return myDataPtr; }
17 
18  const uint32_t *header() const { return &myDataPtr[0]; }
19  const uint32_t *payload() const { return &myDataPtr[4]; }
20  const uint32_t *trailer() const { return &myDataPtr[trailerOffset()]; }
21 
22  uint32_t dataLength() const { return (myDataPtr[0] & 0x000FFFFF); }
23 
24  uint32_t BXID() { return ((myDataPtr[0] & 0xFFF00000) >> 20); }
25  uint32_t L1ID() { return (myDataPtr[1] & 0x00FFFFFF); }
26  uint32_t amcNo() { return ((myDataPtr[1] & 0x0F000000) >> 24); }
27  uint32_t layer1Phi() { return (myDataPtr[2] & 0x0000FFFF); }
28  uint32_t orbitNo() { return ((myDataPtr[2] & 0xFFFF0000) >> 16); }
29 
30  uint32_t trailerOffset() const { return (dataLength() - 1) * 2; }
31 
32  uint32_t dataLengthTrailer() { return (myDataPtr[trailerOffset()] & 0x000FFFFF); }
33  uint32_t L1IDTrailer() { return ((myDataPtr[trailerOffset()] & 0xFF000000) >> 24); }
34  uint32_t crc32() { return (myDataPtr[trailerOffset() + 1]); }
35 
36  void print() {
37  using namespace std;
38  cout << "AMC Payload Header:" << endl;
39  cout << "Data Length.. = " << dec << dataLength() << endl;
40  cout << "BXID......... = " << dec << BXID() << endl;
41  cout << "L1ID......... = " << internal << setfill('0') << setw(8) << hex << L1ID() << endl;
42  cout << "AMC No ...... = " << dec << amcNo() << endl;
43  cout << "Layer-1 Phi.. = " << dec << layer1Phi() << endl;
44  cout << "Orbit No..... = " << dec << orbitNo() << endl;
45  cout << "AMC Payload Trailer:" << endl;
46  cout << "Data Length.. = " << dec << dataLengthTrailer() << endl;
47  cout << "L1ID......... = " << internal << setfill('0') << setw(8) << hex << L1IDTrailer() << endl;
48  cout << "CRC32........ = " << internal << setfill('0') << setw(10) << hex << crc32() << endl;
49  }
50 
51 private:
52  // RawData data
53 
54  const uint32_t *myDataPtr;
55 };
56 
57 #endif
const uint32_t * myDataPtr
Definition: UCTAMCRawData.h:54
const uint32_t * dataPtr() const
Definition: UCTAMCRawData.h:16
uint32_t amcNo()
Definition: UCTAMCRawData.h:26
virtual ~UCTAMCRawData()
Definition: UCTAMCRawData.h:12
const uint32_t * header() const
Definition: UCTAMCRawData.h:18
uint32_t dataLength() const
Definition: UCTAMCRawData.h:22
uint32_t BXID()
Definition: UCTAMCRawData.h:24
uint32_t dataLengthTrailer()
Definition: UCTAMCRawData.h:32
d
Definition: ztail.py:151
uint32_t crc32()
Definition: UCTAMCRawData.h:34
uint32_t orbitNo()
Definition: UCTAMCRawData.h:28
const uint32_t * payload() const
Definition: UCTAMCRawData.h:19
UCTAMCRawData(const uint32_t *d)
Definition: UCTAMCRawData.h:6
const uint32_t * trailer() const
Definition: UCTAMCRawData.h:20
uint32_t L1ID()
Definition: UCTAMCRawData.h:25
uint32_t L1IDTrailer()
Definition: UCTAMCRawData.h:33
uint32_t layer1Phi()
Definition: UCTAMCRawData.h:27
const UCTAMCRawData & operator=(const UCTAMCRawData &i)=delete
uint32_t trailerOffset() const
Definition: UCTAMCRawData.h:30