CMS 3D CMS Logo

CSCTMBData.h
Go to the documentation of this file.
1 //_______________________________________
2 //
3 // Class to group TMB data
4 // CSCTMBData 9/18/03 B.Mohr
5 //_______________________________________
6 //
7 
8 #ifndef CSCTMBData_h
9 #define CSCTMBData_h
10 
18 #include <bitset>
19 #include <boost/dynamic_bitset.hpp>
20 #ifndef LOCAL_UNPACK
21 #include <atomic>
22 #endif
23 
24 
25 class CSCTMBData {
26 
27  public:
28 
29  CSCTMBData();
30  CSCTMBData(int firmwareVersion, int firmwareRevision, int ncfebs=5);
31  ~CSCTMBData();
32  CSCTMBData(const uint16_t *buf);
33  CSCTMBData(const CSCTMBData& data);
34  int UnpackTMB(const uint16_t *buf);
36  bool checkSize() const;
37  static void setDebug(const bool value) {debug = value;}
38  short unsigned int CWordCnt() const {return cWordCnt;}
39  int getCRC() const {return theTMBTrailer.crc22();}
40  const unsigned short size() const {return size_;}
41 
45  bool hasTMBScope() const { return theTMBScopeIsPresent;}
46  CSCTMBScope & tmbScope() const;
48  bool hasTMBMiniScope() const { return theTMBMiniScopeIsPresent; }
49  CSCTMBMiniScope & tmbMiniScope() const;
51  bool hasTMBBlockedCFEB() const { return theBlockedCFEBIsPresent; }
55  bool hasRPC() const {return theRPCDataIsPresent;}
56  CSCRPCData * rpcData() {return &theRPCData;}
57 
59 
61  boost::dynamic_bitset<> pack();
62 
63 
64  std::bitset<22> calCRC22(const std::vector< std::bitset<16> >& datain);
65  std::bitset<22> nextCRC22_D16(const std::bitset<16>& D, const std::bitset<22>& C);
66  int TMBCRCcalc();
67 
69  static void selfTest();
70 
71  private:
72 
75  const uint16_t * theOriginalBuffer;
78  unsigned theB0CLine;
79  unsigned theE0FLine;
80 
87 
92 
95 
97 #ifdef LOCAL_UNPACK
98  static bool debug;
99 #else
100  static std::atomic<bool> debug;
101 #endif
102  unsigned short size_;
103  unsigned short cWordCnt;
105 };
106 
107 #endif
bool hasTMBMiniScope() const
check this before using TMB mini scope
Definition: CSCTMBData.h:48
CSCTMBTrailer * tmbTrailer()
Definition: CSCTMBData.h:53
unsigned theE0FLine
Definition: CSCTMBData.h:79
CSCCLCTData * clctData()
Definition: CSCTMBData.h:43
bool theRPCDataIsPresent
Definition: CSCTMBData.h:104
CSCTMBTrailer theTMBTrailer
Definition: CSCTMBData.h:96
static void selfTest()
tests packing
Definition: CSCTMBData.cc:468
int TMBCRCcalc()
Definition: CSCTMBData.cc:147
short unsigned int CWordCnt() const
Definition: CSCTMBData.h:38
boost::dynamic_bitset pack()
not const because it sets size int TMBTrailer
Definition: CSCTMBData.cc:433
bool theBlockedCFEBIsPresent
Definition: CSCTMBData.h:93
const unsigned short size() const
Definition: CSCTMBData.h:40
std::bitset< 22 > nextCRC22_D16(const std::bitset< 16 > &D, const std::bitset< 22 > &C)
Definition: CSCTMBData.cc:401
unsigned short size_
Definition: CSCTMBData.h:102
bool theTMBMiniScopeIsPresent
Definition: CSCTMBData.h:90
unsigned theB0CLine
Definition: CSCTMBData.h:78
CSCRPCData theRPCData
Definition: CSCTMBData.h:83
bool hasTMBBlockedCFEB() const
check this before TMB Block CFEB
Definition: CSCTMBData.h:51
CSCTMBBlockedCFEB & tmbBlockedCFEB() const
Definition: CSCTMBData.cc:394
bool hasTMBScope() const
check this before using TMB Scope
Definition: CSCTMBData.h:45
int getCRC() const
Definition: CSCTMBData.h:39
std::bitset< 22 > calCRC22(const std::vector< std::bitset< 16 > > &datain)
Definition: CSCTMBData.cc:370
unsigned int crc22() const
static void setDebug(const bool value)
Definition: CSCTMBData.h:37
CSCTMBHeader theTMBHeader
Definition: CSCTMBData.h:81
static std::atomic< bool > debug
Definition: CSCTMBData.h:100
CSCTMBBlockedCFEB * theTMBBlockedCFEB
Definition: CSCTMBData.h:94
const uint16_t * theOriginalBuffer
Definition: CSCTMBData.h:75
CSCTMBScope & tmbScope() const
Definition: CSCTMBData.cc:381
Definition: value.py:1
unsigned short cWordCnt
Definition: CSCTMBData.h:103
CSCTMBMiniScope * theTMBMiniScope
Definition: CSCTMBData.h:91
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:151
bool theTMBScopeIsPresent
The TMB scope is not present in most of data hence its dynamic.
Definition: CSCTMBData.h:85
CSCTMBScope * theTMBScope
Definition: CSCTMBData.h:86
CSCRPCData * rpcData()
Definition: CSCTMBData.h:56
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:42
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool hasRPC() const
check this before using RPC
Definition: CSCTMBData.h:55
bool checkSize() const
sees if the size adds up to the word count
Definition: CSCTMBData.cc:364
int UnpackTMB(const uint16_t *buf)
Definition: CSCTMBData.cc:165
CSCCLCTData theCLCTData
Definition: CSCTMBData.h:82
CSCTMBMiniScope & tmbMiniScope() const
Definition: CSCTMBData.cc:387