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
CastorMergerData::~CastorMergerData
~CastorMergerData()
Definition: CastorMergerData.h:17
CastorMergerData::getExtHdr5
unsigned int getExtHdr5() const
Definition: CastorMergerData.h:80
CastorMergerData
Definition: CastorMergerData.h:14
CastorMergerData::getRawData
const unsigned short * getRawData() const
Get a pointer to the raw data.
Definition: CastorMergerData.h:38
CastorMergerData::getExtHdr2
unsigned int getExtHdr2() const
Definition: CastorMergerData.h:77
CastorMergerData::m_rawLength
int m_rawLength
Definition: CastorMergerData.h:90
CastorMergerData::m_ownData
unsigned short * m_ownData
Definition: CastorMergerData.h:92
CastorMergerData::getFormatVersion
int getFormatVersion() const
Get the version number of this event.
Definition: CastorMergerData.h:35
CastorMergerData::determineSectionLengths
void determineSectionLengths(int &tpWords, int &headerWords, int &trailerWords) const
Definition: CastorMergerData.cc:86
CastorMergerData::determineStaticLengths
void determineStaticLengths(int &headerWords, int &trailerWords) const
Definition: CastorMergerData.cc:92
CastorMergerData::getRawLength
const int getRawLength() const
Get the length of the raw data.
Definition: CastorMergerData.h:41
CastorMergerData::getOrbitNumber
unsigned int getOrbitNumber() const
Get the HTR orbit number.
Definition: CastorMergerData.cc:139
CastorMergerData::CastorMergerData
CastorMergerData()
Definition: CastorMergerData.cc:13
CastorMergerData::getBunchNumber
unsigned int getBunchNumber() const
Get the HTR bunch number.
Definition: CastorMergerData.h:71
CastorMergerData::pack
void pack(unsigned char *tp_lengths, unsigned short *tp_samples)
Unpack the HTR data into TP and DAQ data sorted by channel.
Definition: CastorMergerData.cc:96
CastorMergerData::adoptData
void adoptData(const unsigned short *data, int length)
Definition: CastorMergerData.cc:44
CastorMergerData::getExtHdr6
unsigned int getExtHdr6() const
Definition: CastorMergerData.h:81
CastorMergerData::getExtHdr1
unsigned int getExtHdr1() const
Get the Merger Ext Header words.
Definition: CastorMergerData.h:76
CastorMergerData::getFirmwareRevision
unsigned int getFirmwareRevision() const
Get the Merger firmware version.
Definition: CastorMergerData.cc:141
CastorMergerData::allocate
void allocate(int version_to_create=0)
Definition: CastorMergerData.cc:25
CastorMergerData::getErrorsWord
unsigned int getErrorsWord() const
Get the errors word.
Definition: CastorMergerData.h:32
CastorMergerData::unpack
void unpack(unsigned char *tp_lengths, unsigned short *tp_samples) const
Unpack the HTR data into TP and DAQ data sorted by channel.
Definition: CastorMergerData.cc:69
CastorMergerData::getExtHdr3
unsigned int getExtHdr3() const
Definition: CastorMergerData.h:78
CastorMergerData::m_unpackedData
unsigned short * m_unpackedData
Definition: CastorMergerData.h:93
CastorMergerData::operator=
CastorMergerData & operator=(const CastorMergerData &)
Definition: CastorMergerData.cc:35
CastorMergerData::getExtHdr4
unsigned int getExtHdr4() const
Definition: CastorMergerData.h:79
CastorMergerData::getExtHdr8
unsigned int getExtHdr8() const
Definition: CastorMergerData.h:83
CastorMergerData::check
bool check() const
Check for a good event Requires a minimum length, matching wordcount and length, not an empty event.
Definition: CastorMergerData.cc:57
CastorMergerData::m_rawConst
const unsigned short * m_rawConst
Definition: CastorMergerData.h:91
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
CastorMergerData::m_formatVersion
int m_formatVersion
Definition: CastorMergerData.h:89
CastorMergerData::packHeaderTrailer
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)
Definition: CastorMergerData.cc:121
CastorMergerData::getExtHdr7
unsigned int getExtHdr7() const
Definition: CastorMergerData.h:82
CastorMergerData::getL1ANumber
unsigned int getL1ANumber() const
Get the HTR event number.
Definition: CastorMergerData.h:69