CMS 3D CMS Logo

CastorMergerData.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 #ifndef CastorMergerData_H
3 #define CastorMergerData_H
4 
15 public:
18  if (m_ownData != nullptr)
19  delete[] m_ownData;
20  }
21  CastorMergerData(int version_to_create);
22  CastorMergerData(const unsigned short* data, int length);
24 
26  void allocate(int version_to_create = 0);
27  void adoptData(const unsigned short* data, int length);
29  unsigned int getFirmwareRevision() const;
30 
32  inline unsigned int getErrorsWord() const { return m_rawConst[2] & 0xFFFF; }
33 
35  inline int getFormatVersion() const { return m_formatVersion; }
36 
38  inline const unsigned short* getRawData() const { return m_rawConst; }
39 
41  inline const int getRawLength() const { return m_rawLength; }
42 
46  bool check() const;
47 
55  void unpack(unsigned char* tp_lengths, unsigned short* tp_samples) const;
56 
63  void pack(unsigned char* tp_lengths, unsigned short* tp_samples);
65  void packHeaderTrailer(
66  int L1Anumber, int bcn, int submodule, int orbitn, int pipeline, int ndd, int nps, int firmwareRev = 0);
67 
69  inline unsigned int getL1ANumber() const { return (m_rawConst[0] & 0xFF) + (m_rawConst[1] << 8); }
71  inline unsigned int getBunchNumber() const { return (m_rawConst[4] & 0xFFF); }
73  unsigned int getOrbitNumber() const;
74 
76  inline unsigned int getExtHdr1() const { return (m_rawConst[0]); }
77  inline unsigned int getExtHdr2() const { return (m_rawConst[1]); }
78  inline unsigned int getExtHdr3() const { return (m_rawConst[2]); }
79  inline unsigned int getExtHdr4() const { return (m_rawConst[3]); }
80  inline unsigned int getExtHdr5() const { return (m_rawConst[4]); }
81  inline unsigned int getExtHdr6() const { return (m_rawConst[5]); }
82  inline unsigned int getExtHdr7() const { return (m_rawConst[6]); }
83  inline unsigned int getExtHdr8() const { return (m_rawConst[7]); }
84 
85 protected:
86  void determineSectionLengths(int& tpWords, int& headerWords, int& trailerWords) const;
87  void determineStaticLengths(int& headerWords, int& trailerWords) const;
88 
91  const unsigned short* m_rawConst; // pointer to actual raw data
92  unsigned short* m_ownData; // local block in raw data format
93  unsigned short* m_unpackedData; // local data in usable format
94 };
95 
96 #endif
void unpack(unsigned char *tp_lengths, unsigned short *tp_samples) const
Unpack the HTR data into TP and DAQ data sorted by channel.
void adoptData(const unsigned short *data, int length)
unsigned short * m_unpackedData
unsigned int getExtHdr6() const
unsigned int getExtHdr1() const
Get the Merger Ext Header words.
unsigned int getFirmwareRevision() const
Get the Merger firmware version.
void allocate(int version_to_create=0)
unsigned int getExtHdr8() const
unsigned int getErrorsWord() const
Get the errors word.
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
unsigned int getExtHdr3() const
CastorMergerData & operator=(const CastorMergerData &)
unsigned int getExtHdr4() const
unsigned int getExtHdr5() const
const unsigned short * m_rawConst
unsigned int getExtHdr7() const
unsigned int getL1ANumber() const
Get the HTR event number.
void packHeaderTrailer(int L1Anumber, int bcn, int submodule, int orbitn, int pipeline, int ndd, int nps, int firmwareRev=0)
pack header and trailer (call after pack)
unsigned int getExtHdr2() const
const unsigned short * getRawData() const
Get a pointer to the raw data.
unsigned int getOrbitNumber() const
Get the HTR orbit number.
unsigned int getBunchNumber() const
Get the HTR bunch number.
int getFormatVersion() const
Get the version number of this event.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
unsigned short * m_ownData
void determineSectionLengths(int &tpWords, int &headerWords, int &trailerWords) const
void determineStaticLengths(int &headerWords, int &trailerWords) const
void pack(unsigned char *tp_lengths, unsigned short *tp_samples)
Unpack the HTR data into TP and DAQ data sorted by channel.
const int getRawLength() const
Get the length of the raw data.