CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCCFEBTimeSlice.h
Go to the documentation of this file.
1 #ifndef EventFilter_CSCRawToDigi_CSCCFEBTimeSlice_h
2 #define EventFilter_CSCRawToDigi_CSCCFEBTimeSlice_h
3 
21  unsigned short adcCounts : 12;
22  unsigned short adcOverflow : 1;
24  unsigned short controllerData : 1;
27  unsigned short overlappedSampleFlag : 1;
30  unsigned short errorstat : 1;
31 };
32 
33 #include <iostream>
34 #include <cstring> //for bzero
35 
41  explicit CSCCFEBSCAControllerWord(unsigned short frame);
42  CSCCFEBSCAControllerWord() { bzero(this, 2); }
43 
44  unsigned short trig_time : 8;
45  unsigned short sca_blk : 4;
46  unsigned short l1a_phase : 1;
47  unsigned short lct_phase : 1;
48  unsigned short sca_full : 1;
49  unsigned short ts_flag : 1;
50 };
51 
53 public:
55 
58 
60  // CSCCFEBDataWord * timeSample(int layer, int channel) const;
61 
64  CSCCFEBDataWord *timeSample(int layer, int channel, bool isDCFEB = false) const;
65 
67  bool sixteenSamples() const { /*return scaControllerWord(1).ts_flag;i*/
68  return timeSample(95)->controllerData;
69  }
70  unsigned sizeInWords() const { return 100; }
71 
74 
75  void setControllerWord(const CSCCFEBSCAControllerWord &controllerWord);
76 
79  bool check() const { return ((dummy == 0x7FFF) || ((dummy + crc) == 0x7FFF)); }
80 
81  bool checkCRC() const { return crc == calcCRC(); }
82 
83  unsigned calcCRC() const;
84 
86  void setCRC() {
87  crc = calcCRC();
88  dummy = 0x7FFF - crc;
89  }
90 
91  friend std::ostream &operator<<(std::ostream &os, const CSCCFEBTimeSlice &);
92 
94  unsigned get_crc() const { return crc; }
95  unsigned get_n_free_sca_blocks() const { return n_free_sca_blocks; }
96  unsigned get_lctpipe_count() const { return lctpipe_count; }
97  unsigned get_lctpipe_full() const { return lctpipe_full; }
98  unsigned get_l1pipe_full() const { return l1pipe_full; }
99  unsigned get_lctpipe_empty() const { return lctpipe_empty; }
100  unsigned get_l1pipe_empty() const { return l1pipe_empty; }
101  unsigned get_buffer_warning() const { return buffer_warning; }
102  unsigned get_buffer_count() const { return buffer_count; }
103  unsigned get_L1A_number() const { return L1A_number; }
104 
105  void set_L1Anumber(unsigned l1a) { L1A_number = l1a & 0x3F; }
106 
107 private:
108  unsigned short theSamples[96];
109 
111  unsigned crc : 16;
112 
114  unsigned n_free_sca_blocks : 4;
115  unsigned lctpipe_count : 4;
116  unsigned lctpipe_full : 1;
117  unsigned l1pipe_full : 1;
118  unsigned lctpipe_empty : 1;
119  unsigned l1pipe_empty : 1;
120  unsigned blank_space_1 : 4;
121 
123  unsigned buffer_warning : 1;
124  unsigned buffer_count : 5;
125  unsigned L1A_number : 6;
126  unsigned blank_space_3 : 4;
127 
129  unsigned dummy : 16;
130 };
131 
132 #endif
unsigned calcCRC() const
unsigned short adcOverflow
void set_L1Anumber(unsigned l1a)
unsigned buffer_warning
WORD 99.
unsigned sizeInWords() const
unsigned get_l1pipe_full() const
bool sixteenSamples() const
whether we keep 8 or 16 time samples
void setControllerWord(const CSCCFEBSCAControllerWord &controllerWord)
friend std::ostream & operator<<(std::ostream &os, const CSCCFEBTimeSlice &)
unsigned get_crc() const
accessors for words 97, 98 and 99
CSCCFEBSCAControllerWord scaControllerWord(int layer) const
unpacked from the controller words for each channel in the layer
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned get_buffer_count() const
unsigned n_free_sca_blocks
WORD 98.
unsigned get_L1A_number() const
unsigned get_lctpipe_empty() const
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
bool checkCRC() const
unsigned crc
WORD 97.
unsigned short overlappedSampleFlag
unsigned get_buffer_warning() const
unsigned short controllerData
combined from all 16 strips to make a word
unsigned get_n_free_sca_blocks() const
unsigned get_l1pipe_empty() const
bool check() const
unsigned short theSamples[96]
unsigned short adcCounts
unsigned dummy
WORD 100.
void setCRC()
=VB= Set calculated CRC value for simulated CFEB Time Slice data
unsigned short errorstat
unsigned get_lctpipe_count() const
unsigned get_lctpipe_full() const