CMS 3D CMS Logo

CSCCFEBTimeSlice.h
Go to the documentation of this file.
1 #ifndef CSCCFEBTimeSlice_h
2 #define CSCCFEBTimeSlice_h
3 
4 
22  unsigned short adcCounts : 12;
23  unsigned short adcOverflow : 1;
25  unsigned short controllerData : 1;
28  unsigned short overlappedSampleFlag : 1;
31  unsigned short errorstat : 1;
32 };
33 
34 #include <iostream>
35 #include <string.h> //for bzero
36 
42  explicit CSCCFEBSCAControllerWord(unsigned short frame);
43  CSCCFEBSCAControllerWord() {bzero(this, 2);}
44 
45  unsigned short trig_time : 8;
46  unsigned short sca_blk : 4;
47  unsigned short l1a_phase : 1;
48  unsigned short lct_phase : 1;
49  unsigned short sca_full : 1;
50  unsigned short ts_flag : 1;
51 };
52 
53 
54 
55 
57  public:
59 
62  return (CSCCFEBDataWord *)(theSamples+index);
63  }
64 
66  // CSCCFEBDataWord * timeSample(int layer, int channel) const;
67 
70  CSCCFEBDataWord * timeSample(int layer, int channel, bool isDCFEB=false) const;
71 
73  bool sixteenSamples() {/*return scaControllerWord(1).ts_flag;i*/
74  return timeSample(95)->controllerData;}
75  unsigned sizeInWords() const {return 100;}
76 
77 
79  CSCCFEBSCAControllerWord scaControllerWord(int layer) const ;
80 
81  void setControllerWord(const CSCCFEBSCAControllerWord & controllerWord);
82 
85  bool check() const {return ((dummy == 0x7FFF)||((dummy+crc)== 0x7FFF));}
86 
87  bool checkCRC() const {return crc==calcCRC();}
88 
89  unsigned calcCRC() const;
90 
92  void setCRC() { crc=calcCRC(); dummy=0x7FFF-crc;}
93 
94  friend std::ostream & operator<<(std::ostream & os, const CSCCFEBTimeSlice &);
95 
96 
98  unsigned get_crc() const {return crc;}
99  unsigned get_n_free_sca_blocks() const {return n_free_sca_blocks;}
100  unsigned get_lctpipe_count() const {return lctpipe_count;}
101  unsigned get_lctpipe_full() const {return lctpipe_full;}
102  unsigned get_l1pipe_full() const {return l1pipe_full;}
103  unsigned get_lctpipe_empty() const {return lctpipe_empty;}
104  unsigned get_l1pipe_empty() const {return l1pipe_empty;}
105  unsigned get_buffer_warning() const {return buffer_warning;}
106  unsigned get_buffer_count() const {return buffer_count;}
107  unsigned get_L1A_number() const {return L1A_number;}
108 
109  void set_L1Anumber(unsigned l1a) {L1A_number = l1a & 0x3F;}
110 
111  private:
112  unsigned short theSamples[96];
113 
115  unsigned crc : 16;
116 
118  unsigned n_free_sca_blocks : 4;
119  unsigned lctpipe_count : 4;
120  unsigned lctpipe_full : 1;
121  unsigned l1pipe_full : 1;
122  unsigned lctpipe_empty : 1;
123  unsigned l1pipe_empty : 1;
124  unsigned blank_space_1 : 4;
125 
126 
128  unsigned buffer_warning : 1;
129  unsigned buffer_count : 5;
130  unsigned L1A_number :6;
131  unsigned blank_space_3 : 4;
132 
134  unsigned dummy : 16;
135 };
136 
137 #endif
unsigned short adcOverflow
void set_L1Anumber(unsigned l1a)
unsigned sizeInWords() const
unsigned get_l1pipe_full() const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
unsigned get_crc() const
accessors for words 97, 98 and 99
unsigned get_buffer_count() const
unsigned get_L1A_number() const
bool sixteenSamples()
whether we keep 8 or 16 time samples
unsigned get_lctpipe_empty() const
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
bool checkCRC() const
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
CSCCFEBDataWord const *const timeSample(T const &data, int nCFEB, int nSample, int nLayer, int nStrip)
unsigned short adcCounts
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