Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-04 02:02:34

0001 #ifndef UCTAMCRawData_hh
0002 #define UCTAMCRawData_hh
0003 
0004 class UCTAMCRawData {
0005 public:
0006   UCTAMCRawData(const uint32_t *d) : myDataPtr(d) {}
0007 
0008   // No copy constructor and equality operator are needed
0009   UCTAMCRawData(const UCTAMCRawData &) = delete;
0010   const UCTAMCRawData &operator=(const UCTAMCRawData &i) = delete;
0011 
0012   virtual ~UCTAMCRawData() { ; }
0013 
0014   // Access functions for convenience
0015 
0016   const uint32_t *dataPtr() const { return myDataPtr; }
0017 
0018   const uint32_t *header() const { return &myDataPtr[0]; }
0019   const uint32_t *payload() const { return &myDataPtr[4]; }
0020   const uint32_t *trailer() const { return &myDataPtr[trailerOffset()]; }
0021 
0022   uint32_t dataLength() const { return (myDataPtr[0] & 0x000FFFFF); }
0023 
0024   uint32_t BXID() { return ((myDataPtr[0] & 0xFFF00000) >> 20); }
0025   uint32_t L1ID() { return (myDataPtr[1] & 0x00FFFFFF); }
0026   uint32_t amcNo() { return ((myDataPtr[1] & 0x0F000000) >> 24); }
0027   uint32_t layer1Phi() { return (myDataPtr[2] & 0x0000FFFF); }
0028   uint32_t orbitNo() { return ((myDataPtr[2] & 0xFFFF0000) >> 16); }
0029 
0030   uint32_t trailerOffset() const { return (dataLength() - 1) * 2; }
0031 
0032   uint32_t dataLengthTrailer() { return (myDataPtr[trailerOffset()] & 0x000FFFFF); }
0033   uint32_t L1IDTrailer() { return ((myDataPtr[trailerOffset()] & 0xFF000000) >> 24); }
0034   uint32_t crc32() { return (myDataPtr[trailerOffset() + 1]); }
0035 
0036   void print() {
0037     using namespace std;
0038     cout << "AMC Payload Header:" << endl;
0039     cout << "Data Length.. = " << dec << dataLength() << endl;
0040     cout << "BXID......... = " << dec << BXID() << endl;
0041     cout << "L1ID......... = " << internal << setfill('0') << setw(8) << hex << L1ID() << endl;
0042     cout << "AMC No ...... = " << dec << amcNo() << endl;
0043     cout << "Layer-1 Phi.. = " << dec << layer1Phi() << endl;
0044     cout << "Orbit No..... = " << dec << orbitNo() << endl;
0045     cout << "AMC Payload Trailer:" << endl;
0046     cout << "Data Length.. = " << dec << dataLengthTrailer() << endl;
0047     cout << "L1ID......... = " << internal << setfill('0') << setw(8) << hex << L1IDTrailer() << endl;
0048     cout << "CRC32........ = " << internal << setfill('0') << setw(10) << hex << crc32() << endl;
0049   }
0050 
0051 private:
0052   // RawData data
0053 
0054   const uint32_t *myDataPtr;
0055 };
0056 
0057 #endif