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
CSCCFEBDataWord::overlappedSampleFlag
unsigned short overlappedSampleFlag
Definition: CSCCFEBTimeSlice.h:27
CSCCFEBTimeSlice::crc
unsigned crc
WORD 97.
Definition: CSCCFEBTimeSlice.h:111
CSCCFEBSCAControllerWord::ts_flag
unsigned short ts_flag
Definition: CSCCFEBTimeSlice.h:49
CSCCFEBTimeSlice::buffer_count
unsigned buffer_count
Definition: CSCCFEBTimeSlice.h:124
CSCCFEBTimeSlice::get_l1pipe_empty
unsigned get_l1pipe_empty() const
Definition: CSCCFEBTimeSlice.h:100
CSCCFEBTimeSlice::lctpipe_empty
unsigned lctpipe_empty
Definition: CSCCFEBTimeSlice.h:118
CSCCFEBSCAControllerWord::sca_blk
unsigned short sca_blk
Definition: CSCCFEBTimeSlice.h:45
CSCCFEBTimeSlice
Definition: CSCCFEBTimeSlice.h:52
CSCCFEBTimeSlice::L1A_number
unsigned L1A_number
Definition: CSCCFEBTimeSlice.h:125
CSCCFEBTimeSlice::theSamples
unsigned short theSamples[96]
Definition: CSCCFEBTimeSlice.h:108
CSCCFEBTimeSlice::check
bool check() const
Definition: CSCCFEBTimeSlice.h:79
CSCCFEBTimeSlice::dummy
unsigned dummy
WORD 100.
Definition: CSCCFEBTimeSlice.h:129
CSCCFEBTimeSlice::setCRC
void setCRC()
=VB= Set calculated CRC value for simulated CFEB Time Slice data
Definition: CSCCFEBTimeSlice.h:86
CSCCFEBTimeSlice::blank_space_3
unsigned blank_space_3
Definition: CSCCFEBTimeSlice.h:126
CSCCFEBTimeSlice::get_lctpipe_empty
unsigned get_lctpipe_empty() const
Definition: CSCCFEBTimeSlice.h:99
CSCCFEBTimeSlice::get_lctpipe_count
unsigned get_lctpipe_count() const
Definition: CSCCFEBTimeSlice.h:96
CSCCFEBTimeSlice::get_crc
unsigned get_crc() const
accessors for words 97, 98 and 99
Definition: CSCCFEBTimeSlice.h:94
CSCCFEBTimeSlice::CSCCFEBTimeSlice
CSCCFEBTimeSlice()
Definition: CSCCFEBTimeSlice.cc:13
CSCCFEBDataWord::controllerData
unsigned short controllerData
combined from all 16 strips to make a word
Definition: CSCCFEBTimeSlice.h:24
CSCCFEBTimeSlice::get_lctpipe_full
unsigned get_lctpipe_full() const
Definition: CSCCFEBTimeSlice.h:97
CSCCFEBDataWord
Definition: CSCCFEBTimeSlice.h:20
CSCCFEBTimeSlice::get_l1pipe_full
unsigned get_l1pipe_full() const
Definition: CSCCFEBTimeSlice.h:98
CSCCFEBTimeSlice::get_L1A_number
unsigned get_L1A_number() const
Definition: CSCCFEBTimeSlice.h:103
CSCCFEBTimeSlice::get_buffer_count
unsigned get_buffer_count() const
Definition: CSCCFEBTimeSlice.h:102
CSCCFEBDataWord::errorstat
unsigned short errorstat
Definition: CSCCFEBTimeSlice.h:30
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CSCCFEBTimeSlice::blank_space_1
unsigned blank_space_1
Definition: CSCCFEBTimeSlice.h:120
CSCCFEBSCAControllerWord::lct_phase
unsigned short lct_phase
Definition: CSCCFEBTimeSlice.h:47
CSCCFEBDataWord::adcCounts
unsigned short adcCounts
Definition: CSCCFEBTimeSlice.h:21
CSCCFEBTimeSlice::l1pipe_empty
unsigned l1pipe_empty
Definition: CSCCFEBTimeSlice.h:119
CSCCFEBSCAControllerWord::sca_full
unsigned short sca_full
Definition: CSCCFEBTimeSlice.h:48
CSCCFEBSCAControllerWord::trig_time
unsigned short trig_time
Definition: CSCCFEBTimeSlice.h:44
CSCCFEBTimeSlice::lctpipe_full
unsigned lctpipe_full
Definition: CSCCFEBTimeSlice.h:116
CSCCFEBTimeSlice::setControllerWord
void setControllerWord(const CSCCFEBSCAControllerWord &controllerWord)
Definition: CSCCFEBTimeSlice.cc:52
CSCCFEBTimeSlice::timeSample
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
Definition: CSCCFEBTimeSlice.h:57
CSCCFEBTimeSlice::operator<<
friend std::ostream & operator<<(std::ostream &os, const CSCCFEBTimeSlice &)
Definition: CSCCFEBTimeSlice.cc:69
CSCCFEBTimeSlice::set_L1Anumber
void set_L1Anumber(unsigned l1a)
Definition: CSCCFEBTimeSlice.h:105
CSCCFEBTimeSlice::l1pipe_full
unsigned l1pipe_full
Definition: CSCCFEBTimeSlice.h:117
CSCCFEBTimeSlice::lctpipe_count
unsigned lctpipe_count
Definition: CSCCFEBTimeSlice.h:115
CSCCFEBTimeSlice::checkCRC
bool checkCRC() const
Definition: CSCCFEBTimeSlice.h:81
CSCCFEBTimeSlice::calcCRC
unsigned calcCRC() const
Definition: CSCCFEBTimeSlice.cc:61
CSCCFEBTimeSlice::buffer_warning
unsigned buffer_warning
WORD 99.
Definition: CSCCFEBTimeSlice.h:123
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
CSCCFEBSCAControllerWord::l1a_phase
unsigned short l1a_phase
Definition: CSCCFEBTimeSlice.h:46
CSCCFEBTimeSlice::sizeInWords
unsigned sizeInWords() const
Definition: CSCCFEBTimeSlice.h:70
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
CSCCFEBDataWord::adcOverflow
unsigned short adcOverflow
Definition: CSCCFEBTimeSlice.h:22
CSCCFEBTimeSlice::get_n_free_sca_blocks
unsigned get_n_free_sca_blocks() const
Definition: CSCCFEBTimeSlice.h:95
dummy
Definition: DummySelector.h:38
CSCCFEBTimeSlice::get_buffer_warning
unsigned get_buffer_warning() const
Definition: CSCCFEBTimeSlice.h:101
CSCCFEBSCAControllerWord
Definition: CSCCFEBTimeSlice.h:36
CSCCFEBTimeSlice::n_free_sca_blocks
unsigned n_free_sca_blocks
WORD 98.
Definition: CSCCFEBTimeSlice.h:114
CSCCFEBTimeSlice::scaControllerWord
CSCCFEBSCAControllerWord scaControllerWord(int layer) const
unpacked from the controller words for each channel in the layer
Definition: CSCCFEBTimeSlice.cc:44
CSCCFEBSCAControllerWord::CSCCFEBSCAControllerWord
CSCCFEBSCAControllerWord()
Definition: CSCCFEBTimeSlice.h:42
CSCCFEBTimeSlice::sixteenSamples
bool sixteenSamples() const
whether we keep 8 or 16 time samples
Definition: CSCCFEBTimeSlice.h:67