File indexing completed on 2024-04-06 12:10:20
0001
0002 #ifndef CastorMergerData_H
0003 #define CastorMergerData_H
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 class CastorMergerData {
0015 public:
0016 CastorMergerData();
0017 ~CastorMergerData() {
0018 if (m_ownData != nullptr)
0019 delete[] m_ownData;
0020 }
0021 CastorMergerData(int version_to_create);
0022 CastorMergerData(const unsigned short* data, int length);
0023 CastorMergerData(const CastorMergerData&);
0024
0025 CastorMergerData& operator=(const CastorMergerData&);
0026 void allocate(int version_to_create = 0);
0027 void adoptData(const unsigned short* data, int length);
0028
0029 unsigned int getFirmwareRevision() const;
0030
0031
0032 inline unsigned int getErrorsWord() const { return m_rawConst[2] & 0xFFFF; }
0033
0034
0035 inline int getFormatVersion() const { return m_formatVersion; }
0036
0037
0038 inline const unsigned short* getRawData() const { return m_rawConst; }
0039
0040
0041 inline const int getRawLength() const { return m_rawLength; }
0042
0043
0044
0045
0046 bool check() const;
0047
0048
0049
0050
0051
0052
0053
0054
0055 void unpack(unsigned char* tp_lengths, unsigned short* tp_samples) const;
0056
0057
0058
0059
0060
0061
0062
0063 void pack(unsigned char* tp_lengths, unsigned short* tp_samples);
0064
0065 void packHeaderTrailer(
0066 int L1Anumber, int bcn, int submodule, int orbitn, int pipeline, int ndd, int nps, int firmwareRev = 0);
0067
0068
0069 inline unsigned int getL1ANumber() const { return (m_rawConst[0] & 0xFF) + (m_rawConst[1] << 8); }
0070
0071 inline unsigned int getBunchNumber() const { return (m_rawConst[4] & 0xFFF); }
0072
0073 unsigned int getOrbitNumber() const;
0074
0075
0076 inline unsigned int getExtHdr1() const { return (m_rawConst[0]); }
0077 inline unsigned int getExtHdr2() const { return (m_rawConst[1]); }
0078 inline unsigned int getExtHdr3() const { return (m_rawConst[2]); }
0079 inline unsigned int getExtHdr4() const { return (m_rawConst[3]); }
0080 inline unsigned int getExtHdr5() const { return (m_rawConst[4]); }
0081 inline unsigned int getExtHdr6() const { return (m_rawConst[5]); }
0082 inline unsigned int getExtHdr7() const { return (m_rawConst[6]); }
0083 inline unsigned int getExtHdr8() const { return (m_rawConst[7]); }
0084
0085 protected:
0086 void determineSectionLengths(int& tpWords, int& headerWords, int& trailerWords) const;
0087 void determineStaticLengths(int& headerWords, int& trailerWords) const;
0088
0089 int m_formatVersion;
0090 int m_rawLength;
0091 const unsigned short* m_rawConst;
0092 unsigned short* m_ownData;
0093 unsigned short* m_unpackedData;
0094 };
0095
0096 #endif