CMS 3D CMS Logo

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.
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
void setControllerWord(const CSCCFEBSCAControllerWord &controllerWord)
CSCCFEBSCAControllerWord scaControllerWord(int layer) const
unpacked from the controller words for each channel in the layer
friend std::ostream & operator<<(std::ostream &os, const CSCCFEBTimeSlice &)
bool checkCRC() const
unsigned n_free_sca_blocks
WORD 98.
unsigned sizeInWords() const
unsigned get_l1pipe_empty() const
bool sixteenSamples() const
whether we keep 8 or 16 time samples
unsigned crc
WORD 97.
unsigned get_buffer_warning() const
unsigned get_n_free_sca_blocks() const
unsigned short overlappedSampleFlag
unsigned short controllerData
combined from all 16 strips to make a word
bool check() const
unsigned get_lctpipe_full() const
unsigned get_l1pipe_full() const
unsigned short theSamples[96]
unsigned get_lctpipe_count() const
unsigned get_buffer_count() const
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_L1A_number() const
unsigned get_lctpipe_empty() const
unsigned get_crc() const
accessors for words 97, 98 and 99