CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorMergerData.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 #ifndef CastorMergerData_H
3 #define CastorMergerData_H
4 
17  public:
18 
20  ~CastorMergerData() { if (m_ownData!=0) delete [] m_ownData; }
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 {
33  return m_rawConst[2]&0xFFFF; }
34 
36  inline int getFormatVersion() const { return m_formatVersion; }
37 
39  inline const unsigned short* getRawData() const { return m_rawConst; }
40 
42  inline const int getRawLength() const { return m_rawLength; }
43 
47  bool check() const;
48 
49 
57  void unpack(
58  unsigned char* tp_lengths, unsigned short* tp_samples) const;
59 
60 
67  void pack(
68  unsigned char* tp_lengths, unsigned short* tp_samples );
70  void packHeaderTrailer(int L1Anumber, int bcn, int submodule, int
71  orbitn, int pipeline, int ndd, int nps, int firmwareRev=0);
72 
74  inline unsigned int getL1ANumber() const {
75  return (m_rawConst[0]&0xFF)+(m_rawConst[1]<<8);
76  }
78  inline unsigned int getBunchNumber() const {
79  return (m_rawConst[4]&0xFFF);
80  }
82  unsigned int getOrbitNumber() const;
83 
84 
86  inline unsigned int getExtHdr1() const {
87  return (m_rawConst[0]);}
88  inline unsigned int getExtHdr2() const {
89  return (m_rawConst[1]); }
90  inline unsigned int getExtHdr3() const {
91  return (m_rawConst[2]);}
92  inline unsigned int getExtHdr4() const {
93  return (m_rawConst[3]); }
94  inline unsigned int getExtHdr5() const {
95  return (m_rawConst[4]);}
96  inline unsigned int getExtHdr6() const {
97  return (m_rawConst[5]);}
98  inline unsigned int getExtHdr7() const {
99  return (m_rawConst[6]);}
100  inline unsigned int getExtHdr8() const {
101  return (m_rawConst[7]);}
102 
103 
104 
105 protected:
106  void determineSectionLengths(int& tpWords, int& headerWords, int& trailerWords) const;
107  void determineStaticLengths(int& headerWords, int& trailerWords) const;
108 
111  const unsigned short* m_rawConst; // pointer to actual raw data
112  unsigned short* m_ownData; // local block in raw data format
113  unsigned short* m_unpackedData; // local data in usable format
114 
115 };
116 
117 #endif
118 
void adoptData(const unsigned short *data, int length)
unsigned short * m_unpackedData
unsigned int getExtHdr3() const
void allocate(int version_to_create=0)
const int getRawLength() const
Get the length of the raw data.
unsigned int getExtHdr7() const
unsigned int getErrorsWord() const
Get the errors word.
unsigned int getExtHdr1() const
Get the Merger Ext Header words.
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event...
CastorMergerData & operator=(const CastorMergerData &)
const unsigned short * m_rawConst
unsigned int getExtHdr4() const
unsigned int getExtHdr5() const
unsigned int getBunchNumber() const
Get the HTR bunch number.
void unpack(unsigned char *tp_lengths, unsigned short *tp_samples) const
Unpack the HTR data into TP and DAQ data sorted by channel.
unsigned int getExtHdr6() const
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 getL1ANumber() const
Get the HTR event number.
unsigned int getOrbitNumber() const
Get the HTR orbit number.
const unsigned short * getRawData() const
Get a pointer to the raw data.
unsigned int getExtHdr2() const
unsigned int getFirmwareRevision() const
Get the Merger firmware version.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int getFormatVersion() const
Get the version number of this event.
unsigned short * m_ownData
void pack(unsigned char *tp_lengths, unsigned short *tp_samples)
Unpack the HTR data into TP and DAQ data sorted by channel.
void determineSectionLengths(int &tpWords, int &headerWords, int &trailerWords) const
void determineStaticLengths(int &headerWords, int &trailerWords) const
unsigned int getExtHdr8() const