CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  }
65  CSCCFEBDataWord * timeSample(int layer, int channel) const;
66 
68  bool sixteenSamples() {/*return scaControllerWord(1).ts_flag;i*/
69  return timeSample(95)->controllerData;}
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() { crc=calcCRC(); dummy=0x7FFF-crc;}
87 
88  friend std::ostream & operator<<(std::ostream & os, const CSCCFEBTimeSlice &);
89 
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  private:
104  unsigned short theSamples[96];
105 
107  unsigned crc : 16;
108 
110  unsigned n_free_sca_blocks : 4;
111  unsigned lctpipe_count : 4;
112  unsigned lctpipe_full : 1;
113  unsigned l1pipe_full : 1;
114  unsigned lctpipe_empty : 1;
115  unsigned l1pipe_empty : 1;
116  unsigned blank_space_1 : 4;
117 
118 
120  unsigned buffer_warning : 1;
121  unsigned buffer_count : 5;
122  unsigned L1A_number :6;
123  unsigned blank_space_3 : 4;
124 
126  unsigned dummy : 16;
127 };
128 
129 #endif
unsigned calcCRC() const
unsigned short adcOverflow
unsigned buffer_warning
WORD 99.
unsigned sizeInWords() const
unsigned get_l1pipe_full() const
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
unsigned get_buffer_count() const
unsigned n_free_sca_blocks
WORD 98.
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 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