CMS 3D CMS Logo

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