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*/ return timeSample(95)->controllerData; }
68  unsigned sizeInWords() const { return 100; }
69 
72 
73  void setControllerWord(const CSCCFEBSCAControllerWord &controllerWord);
74 
77  bool check() const { return ((dummy == 0x7FFF) || ((dummy + crc) == 0x7FFF)); }
78 
79  bool checkCRC() const { return crc == calcCRC(); }
80 
81  unsigned calcCRC() const;
82 
84  void setCRC() {
85  crc = calcCRC();
86  dummy = 0x7FFF - crc;
87  }
88 
89  friend std::ostream &operator<<(std::ostream &os, const CSCCFEBTimeSlice &);
90 
92  unsigned get_crc() const { return crc; }
93  unsigned get_n_free_sca_blocks() const { return n_free_sca_blocks; }
94  unsigned get_lctpipe_count() const { return lctpipe_count; }
95  unsigned get_lctpipe_full() const { return lctpipe_full; }
96  unsigned get_l1pipe_full() const { return l1pipe_full; }
97  unsigned get_lctpipe_empty() const { return lctpipe_empty; }
98  unsigned get_l1pipe_empty() const { return l1pipe_empty; }
99  unsigned get_buffer_warning() const { return buffer_warning; }
100  unsigned get_buffer_count() const { return buffer_count; }
101  unsigned get_L1A_number() const { return L1A_number; }
102 
103  void set_L1Anumber(unsigned l1a) { L1A_number = l1a & 0x3F; }
104 
105 private:
106  unsigned short theSamples[96];
107 
109  unsigned crc : 16;
110 
112  unsigned n_free_sca_blocks : 4;
113  unsigned lctpipe_count : 4;
114  unsigned lctpipe_full : 1;
115  unsigned l1pipe_full : 1;
116  unsigned lctpipe_empty : 1;
117  unsigned l1pipe_empty : 1;
118  unsigned blank_space_1 : 4;
119 
121  unsigned buffer_warning : 1;
122  unsigned buffer_count : 5;
123  unsigned L1A_number : 6;
124  unsigned blank_space_3 : 4;
125 
127  unsigned dummy : 16;
128 };
129 
130 #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