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 EventFilter_CSCRawToDigi_CSCTMBData_h
9 #define EventFilter_CSCRawToDigi_CSCTMBData_h
10 
19 #include <bitset>
20 #include <boost/dynamic_bitset.hpp>
21 #ifndef LOCAL_UNPACK
22 #include <atomic>
23 #endif
24 
25 class CSCTMBData {
26 public:
27  CSCTMBData();
28  CSCTMBData(int firmwareVersion, int firmwareRevision, int ncfebs = 5);
29  ~CSCTMBData();
30  CSCTMBData(const uint16_t* buf);
31  CSCTMBData(const CSCTMBData& data);
32  int UnpackTMB(const uint16_t* buf);
34  bool checkSize() const;
35  static void setDebug(const bool value) { debug = value; }
36  short unsigned int CWordCnt() const { return cWordCnt; }
37  int getCRC() const { return theTMBTrailer.crc22(); }
38  const unsigned short size() const { return size_; }
39 
43  bool hasTMBScope() const { return theTMBScopeIsPresent; }
44  CSCTMBScope& tmbScope() const;
46  bool hasTMBMiniScope() const { return theTMBMiniScopeIsPresent; }
49  bool hasTMBBlockedCFEB() const { return theBlockedCFEBIsPresent; }
53  bool hasRPC() const { return theRPCDataIsPresent; }
54  CSCRPCData* rpcData() { return &theRPCData; }
55  bool hasGEM() const { return theGEMDataIsPresent; }
57 
59 
61  boost::dynamic_bitset<> pack();
62 
63  std::bitset<22> calCRC22(const std::vector<std::bitset<16> >& datain);
64  std::bitset<22> nextCRC22_D16(const std::bitset<16>& D, const std::bitset<22>& C);
65  int TMBCRCcalc();
66 
68  static void selfTest();
69 
70 private:
73  const uint16_t* theOriginalBuffer;
76  unsigned theB0CLine;
77  unsigned theE0FLine;
78 
86 
91 
94 
96 #ifdef LOCAL_UNPACK
97  static bool debug;
98 #else
99  static std::atomic<bool> debug;
100 #endif
101  unsigned short size_;
102  unsigned short cWordCnt;
105 };
106 
107 #endif
CSCTMBMiniScope & tmbMiniScope() const
Definition: CSCTMBData.cc:403
CSCTMBTrailer * tmbTrailer()
Definition: CSCTMBData.h:51
unsigned theE0FLine
Definition: CSCTMBData.h:77
bool theRPCDataIsPresent
Definition: CSCTMBData.h:103
CSCTMBBlockedCFEB & tmbBlockedCFEB() const
CSCTMBTrailer theTMBTrailer
Definition: CSCTMBData.h:95
CSCGEMData * gemData()
Definition: CSCTMBData.cc:409
static void selfTest()
tests packing
Definition: CSCTMBData.cc:481
int TMBCRCcalc()
Definition: CSCTMBData.cc:150
CSCTMBScope & tmbScope() const
Definition: CSCTMBData.cc:397
boost::dynamic_bitset pack()
not const because it sets size int TMBTrailer
Definition: CSCTMBData.cc:444
bool theBlockedCFEBIsPresent
Definition: CSCTMBData.h:92
std::bitset< 22 > nextCRC22_D16(const std::bitset< 16 > &D, const std::bitset< 22 > &C)
Definition: CSCTMBData.cc:415
unsigned short size_
Definition: CSCTMBData.h:101
bool theTMBMiniScopeIsPresent
Definition: CSCTMBData.h:89
unsigned theB0CLine
Definition: CSCTMBData.h:76
CSCRPCData theRPCData
Definition: CSCTMBData.h:81
bool theGEMDataIsPresent
Definition: CSCTMBData.h:104
const unsigned short size() const
Definition: CSCTMBData.h:38
std::bitset< 22 > calCRC22(const std::vector< std::bitset< 16 > > &datain)
Definition: CSCTMBData.cc:388
static void setDebug(const bool value)
Definition: CSCTMBData.h:35
CSCTMBHeader theTMBHeader
Definition: CSCTMBData.h:79
static std::atomic< bool > debug
Definition: CSCTMBData.h:99
CSCTMBBlockedCFEB * theTMBBlockedCFEB
Definition: CSCTMBData.h:93
const uint16_t * theOriginalBuffer
Definition: CSCTMBData.h:73
bool checkSize() const
sees if the size adds up to the word count
Definition: CSCTMBData.cc:383
Definition: value.py:1
bool hasRPC() const
check this before using RPC
Definition: CSCTMBData.h:53
unsigned short cWordCnt
Definition: CSCTMBData.h:102
short unsigned int CWordCnt() const
Definition: CSCTMBData.h:36
CSCGEMData theGEMData
Definition: CSCTMBData.h:82
CSCComparatorData theComparatorData
Definition: CSCTMBData.h:80
CSCTMBMiniScope * theTMBMiniScope
Definition: CSCTMBData.h:90
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
CSCComparatorData * comparatorData()
Definition: CSCTMBData.h:41
bool theTMBScopeIsPresent
The TMB scope is not present in most of data hence its dynamic.
Definition: CSCTMBData.h:84
CSCTMBScope * theTMBScope
Definition: CSCTMBData.h:85
CSCRPCData * rpcData()
Definition: CSCTMBData.h:54
int getCRC() const
Definition: CSCTMBData.h:37
CSCTMBHeader * tmbHeader()
Definition: CSCTMBData.h:40
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
unsigned int crc22() const
bool hasGEM() const
Definition: CSCTMBData.h:55
bool hasTMBScope() const
check this before using TMB Scope
Definition: CSCTMBData.h:43
bool hasTMBBlockedCFEB() const
check this before TMB Block CFEB
Definition: CSCTMBData.h:49
int UnpackTMB(const uint16_t *buf)
Definition: CSCTMBData.cc:167
bool hasTMBMiniScope() const
check this before using TMB mini scope
Definition: CSCTMBData.h:46