ATLAS Offline Software
Loading...
Searching...
No Matches
MdtCsmReadOut.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONBYTESTREAM_MDTCSMREADOUT_H
6#define MUONBYTESTREAM_MDTCSMREADOUT_H
7
8#include <stdint.h>
9
10#include "MdtReadOut.h"
11
12// Decoding methods for an MDT Csm block
13// S. Rosati Feb 2003
14
15class MdtCsmReadOut : public MdtReadOut {
16private:
17 // Raw data word and word header
18 uint32_t m_dataWord;
19 uint16_t m_wordHeader;
20
21 // Decoded data
22 uint32_t m_lvl1Id; // Lvl1 Id
23 uint32_t m_clwc; // Link word count
24 uint16_t m_ftyp; // flag type
25 uint32_t m_flags; // flags
26
27 uint16_t m_ecnt; // Event counter
28 uint16_t m_ctwc; // Trailer word count
29
30 uint16_t m_mrodId; // MROD number
31 uint16_t m_csmId; // CSM Link number
32 bool m_error; // Error flag
33 bool m_zeroSupp; // TDC zero-suppressed flag
34
35 // Word header Position and values
36 // The word header occupies the 8 highest bits of each CSM word
37 static constexpr uint16_t s_headerPos = 24;
38 static constexpr uint16_t s_headerBits = 0xff;
39
40 // Beginning of buffer
41 static constexpr uint16_t s_BOBvalue = 0x80;
42 // Link Word Count: first word of a CSM link block
43 static constexpr uint16_t s_LWCvalue = 0x81;
44 // Beginning of Link: signals which CSM link is giving its data
45 static constexpr uint16_t s_BOLvalue = 0x18;
46 // TDC Link Present
47 static constexpr uint16_t s_TLPvalue = 0x89;
48 // Trailer Word Count: last word of a CSM link block
49 static constexpr uint16_t s_TWCvalue = 0x8a;
50 // End of Block (end of data from the CSMs)
51 static constexpr uint16_t s_EOBvalue = 0xf0;
52
53public:
55 ~MdtCsmReadOut() = default;
56
57 void decodeWord(uint32_t dataWord);
58
59 bool is_BOB() const { return m_wordHeader == s_BOBvalue; };
60 bool is_LWC() const { return m_wordHeader == s_LWCvalue; };
61 bool is_BOL() const { return m_wordHeader == s_BOLvalue; };
62 bool is_TLP() const { return m_wordHeader == s_TLPvalue; };
63 bool is_TWC() const { return m_wordHeader == s_TWCvalue; };
64 bool is_EOB() const { return m_wordHeader == s_EOBvalue; };
65
66 // Methods to access the decoded information
67 uint32_t lvl1Id() const { return m_lvl1Id; }
68 uint32_t clwc() const { return m_clwc; }
69 uint16_t ftyp() const { return m_ftyp; }
70 uint32_t flags() const { return m_flags; }
71 uint16_t ecnt() const { return m_ecnt; }
72 uint16_t ctwc() const { return m_ctwc; }
73 uint16_t mrodId() const { return m_mrodId; }
74 uint16_t csmId() const { return m_csmId; }
75
76 // Word encoders
77 uint32_t makeBOB(uint32_t lvl1Id);
78 uint32_t makeLWC(uint32_t clwc);
79 uint32_t makeBOL(uint16_t mrodId, uint16_t csmId);
80 uint32_t makeTLP(uint32_t flags);
81 uint32_t makeTWC(uint16_t ecnt, uint16_t ctwc);
82 uint32_t makeEOB(uint32_t wcnt);
83
84private:
85 // Private methods
86 void setZero();
87};
88
89#endif // MUONBYTESTREAM_MDTCSMREADOUT_H
uint32_t m_clwc
static constexpr uint16_t s_BOLvalue
uint32_t makeEOB(uint32_t wcnt)
static constexpr uint16_t s_TWCvalue
bool is_TWC() const
static constexpr uint16_t s_EOBvalue
uint16_t ftyp() const
uint16_t m_ftyp
uint16_t ctwc() const
bool is_BOB() const
uint32_t flags() const
static constexpr uint16_t s_TLPvalue
uint32_t makeBOB(uint32_t lvl1Id)
uint32_t makeTLP(uint32_t flags)
bool is_EOB() const
~MdtCsmReadOut()=default
uint16_t m_csmId
static constexpr uint16_t s_headerPos
uint16_t csmId() const
uint16_t m_mrodId
static constexpr uint16_t s_LWCvalue
bool is_TLP() const
void decodeWord(uint32_t dataWord)
uint16_t m_ctwc
uint16_t ecnt() const
static constexpr uint16_t s_BOBvalue
bool is_BOL() const
uint32_t m_dataWord
bool is_LWC() const
uint32_t makeLWC(uint32_t clwc)
uint16_t m_wordHeader
uint32_t makeBOL(uint16_t mrodId, uint16_t csmId)
static constexpr uint16_t s_headerBits
uint16_t mrodId() const
uint32_t clwc() const
uint32_t lvl1Id() const
uint32_t makeTWC(uint16_t ecnt, uint16_t ctwc)
uint32_t m_flags
uint16_t m_ecnt
uint32_t m_lvl1Id