Go to the documentation of this file.00001
00002 #ifndef CastorMergerData_H
00003 #define CastorMergerData_H
00004
00016 class CastorMergerData {
00017 public:
00018
00019 CastorMergerData();
00020 ~CastorMergerData() { if (m_ownData!=0) delete [] m_ownData; }
00021 CastorMergerData(int version_to_create);
00022 CastorMergerData(const unsigned short* data, int length);
00023 CastorMergerData(const CastorMergerData&);
00024
00025 CastorMergerData& operator=(const CastorMergerData&);
00026 void allocate(int version_to_create=0);
00027 void adoptData(const unsigned short* data, int length);
00029 unsigned int getFirmwareRevision() const;
00030
00032 inline unsigned int getErrorsWord() const {
00033 return m_rawConst[2]&0xFFFF; }
00034
00036 inline int getFormatVersion() const { return m_formatVersion; }
00037
00039 inline const unsigned short* getRawData() const { return m_rawConst; }
00040
00042 inline const int getRawLength() const { return m_rawLength; }
00043
00047 bool check() const;
00048
00049
00057 void unpack(
00058 unsigned char* tp_lengths, unsigned short* tp_samples) const;
00059
00060
00067 void pack(
00068 unsigned char* tp_lengths, unsigned short* tp_samples );
00070 void packHeaderTrailer(int L1Anumber, int bcn, int submodule, int
00071 orbitn, int pipeline, int ndd, int nps, int firmwareRev=0);
00072
00074 inline unsigned int getL1ANumber() const {
00075 return (m_rawConst[0]&0xFF)+(m_rawConst[1]<<8);
00076 }
00078 inline unsigned int getBunchNumber() const {
00079 return (m_rawConst[4]&0xFFF);
00080 }
00082 unsigned int getOrbitNumber() const;
00083
00084
00086 inline unsigned int getExtHdr1() const {
00087 return (m_rawConst[0]);}
00088 inline unsigned int getExtHdr2() const {
00089 return (m_rawConst[1]); }
00090 inline unsigned int getExtHdr3() const {
00091 return (m_rawConst[2]);}
00092 inline unsigned int getExtHdr4() const {
00093 return (m_rawConst[3]); }
00094 inline unsigned int getExtHdr5() const {
00095 return (m_rawConst[4]);}
00096 inline unsigned int getExtHdr6() const {
00097 return (m_rawConst[5]);}
00098 inline unsigned int getExtHdr7() const {
00099 return (m_rawConst[6]);}
00100 inline unsigned int getExtHdr8() const {
00101 return (m_rawConst[7]);}
00102
00103
00104
00105 protected:
00106 void determineSectionLengths(int& tpWords, int& headerWords, int& trailerWords) const;
00107 void determineStaticLengths(int& headerWords, int& trailerWords) const;
00108
00109 int m_formatVersion;
00110 int m_rawLength;
00111 const unsigned short* m_rawConst;
00112 unsigned short* m_ownData;
00113 unsigned short* m_unpackedData;
00114
00115 };
00116
00117 #endif
00118