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 
15  public:
16 
18  ~CastorMergerData() { if (m_ownData!=0) delete [] m_ownData; }
19  CastorMergerData(int version_to_create);
20  CastorMergerData(const unsigned short* data, int length);
22 
24  void allocate(int version_to_create=0);
25  void adoptData(const unsigned short* data, int length);
27  unsigned int getFirmwareRevision() const;
28 
30  inline unsigned int getErrorsWord() const {
31  return m_rawConst[2]&0xFFFF; }
32 
34  inline int getFormatVersion() const { return m_formatVersion; }
35 
37  inline const unsigned short* getRawData() const { return m_rawConst; }
38 
40  inline const int getRawLength() const { return m_rawLength; }
41 
45  bool check() const;
46 
47 
55  void unpack(
56  unsigned char* tp_lengths, unsigned short* tp_samples) const;
57 
58 
65  void pack(
66  unsigned char* tp_lengths, unsigned short* tp_samples );
68  void packHeaderTrailer(int L1Anumber, int bcn, int submodule, int
69  orbitn, int pipeline, int ndd, int nps, int firmwareRev=0);
70 
72  inline unsigned int getL1ANumber() const {
73  return (m_rawConst[0]&0xFF)+(m_rawConst[1]<<8);
74  }
76  inline unsigned int getBunchNumber() const {
77  return (m_rawConst[4]&0xFFF);
78  }
80  unsigned int getOrbitNumber() const;
81 
82 
84  inline unsigned int getExtHdr1() const {
85  return (m_rawConst[0]);}
86  inline unsigned int getExtHdr2() const {
87  return (m_rawConst[1]); }
88  inline unsigned int getExtHdr3() const {
89  return (m_rawConst[2]);}
90  inline unsigned int getExtHdr4() const {
91  return (m_rawConst[3]); }
92  inline unsigned int getExtHdr5() const {
93  return (m_rawConst[4]);}
94  inline unsigned int getExtHdr6() const {
95  return (m_rawConst[5]);}
96  inline unsigned int getExtHdr7() const {
97  return (m_rawConst[6]);}
98  inline unsigned int getExtHdr8() const {
99  return (m_rawConst[7]);}
100 
101 
102 
103 protected:
104  void determineSectionLengths(int& tpWords, int& headerWords, int& trailerWords) const;
105  void determineStaticLengths(int& headerWords, int& trailerWords) const;
106 
109  const unsigned short* m_rawConst; // pointer to actual raw data
110  unsigned short* m_ownData; // local block in raw data format
111  unsigned short* m_unpackedData; // local data in usable format
112 
113 };
114 
115 #endif
116 
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.
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