12 : theSize(0), boardNumber_(number), theNumberOfSamples(0), theFormatVersion(format_version), fDCFEB(f_dcfeb) {
22 if (badSlice->
check()) {
31 if (goodSlice->
check()) {
46 <<
"CORRUPT CFEB DATA slice " <<
theNumberOfSamples << std::hex <<
" " << *(buf + pos + 3) <<
" " 47 << *(buf + pos + 2) <<
" " << *(buf + pos + 1) <<
" " << *(buf + pos);
68 scaWord.
ts_flag = sixteenSamples;
76 memcpy(pos, &slice, 200);
79 theSize = theNumberOfSamples * 100;
85 unsigned channel = (digi.
getStrip() - 1) % 16 + 1;
86 unsigned value = scaCounts[itime] & 0xFFF;
89 assert(slice !=
nullptr);
182 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
"nTimeSamples is zero - CFEB data corrupt?";
184 for (
unsigned itime = 0; itime <
nTimeSamples(); ++itime) {
188 crcWords[itime] = slice->
get_crc();
191 for (
unsigned i = 0;
i < 16; ++
i) {
205 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
"nTimeSamples in CSCCFEBData::digis = " <<
nTimeSamples();
207 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
"nTimeSamples is zero - CFEB data corrupt?";
225 for (
unsigned itime = 0; itime <
nTimeSamples(); ++itime) {
227 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
CSCDetId(idlayer) <<
" time sample " << itime + 1
229 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
CSCDetId(idlayer) <<
" time sample " << itime + 1
231 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
CSCDetId(idlayer) <<
" time sample " << itime + 1
235 for (
unsigned ichannel = 1; ichannel <= 16; ++ichannel) {
243 for (
unsigned itime = 0; itime <
nTimeSamples(); ++itime) {
262 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
"ADC counts empty - CFEB data corrupt?";
274 if (me1b && !zplus) {
285 if (me1b && !zplus) {
289 result.push_back(
CSCStripDigi(strip, sca, overflow, overlap, errorfl));
295 std::vector<CSCStripDigi>
result;
296 uint32_t layer = idlayer;
297 digis(layer, result);
312 os <<
"printing CFEB data sample by sample " << std::endl;
313 for (
unsigned ilayer = 1; ilayer <= 6; ++ilayer) {
314 for (
unsigned channel = 1; channel <= 16; ++channel) {
316 os <<
"Strip " << strip <<
" ";
317 for (
unsigned timeBin = 0; timeBin < data.
nTimeSamples(); ++timeBin) {
318 os << data.
adcCounts(ilayer, channel, timeBin) <<
" ";
327 std::vector<std::vector<CSCStripDigi> >
result;
328 for (
int layer = 1; layer <= 6; ++layer) {
329 result.push_back(
digis(layer));
unsigned adcOverflow(unsigned layer, unsigned channel, unsigned timeBin) const
unsigned overlappedSampleFlag(unsigned layer, unsigned channel, unsigned timeBin) const
std::vector< int > const & getADCCounts() const
Get ADC readings.
unsigned short adcOverflow
unsigned sizeInWords() const
void add(const CSCStripDigi &, int layer)
void setL1A(unsigned l1a)
bool sixteenSamples() const
whether we keep 8 or 16 time samples
unsigned adcCounts(unsigned layer, unsigned channel, unsigned timeBin) const
void setControllerWord(const CSCCFEBSCAControllerWord &controllerWord)
unsigned errorstat(unsigned layer, unsigned channel, unsigned timeBin) const
CSCCFEBStatusDigi statusDigi() const
returns one status digi per cfeb
unsigned get_crc() const
accessors for words 97, 98 and 99
unsigned sizeInWords() const
std::vector< std::pair< int, bool > > theSliceStarts
bool check() const
makes sure each time slice has a trailer
unsigned controllerData(unsigned uglay, unsigned ugchan, unsigned timeBin) const
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it's a bad slice
unsigned nTimeSamples() const
void digis(uint32_t idlayer, std::vector< CSCStripDigi > &result) const
faster way to get to digis
std::vector< std::vector< CSCStripDigi > > stripDigis()
deprecated. Use the above method.
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short overlappedSampleFlag
std::vector< uint16_t > bWords
friend std::ostream & operator<<(std::ostream &os, const CSCCFEBData &)
unsigned short controllerData
combined from all 16 strips to make a word
uint16_t theFormatVersion
const CSCBadCFEBWord & word(int i) const
count from zero
CSCCFEBData(unsigned boardNumber, const uint16_t *buf, uint16_t theFormatVersion=2005, bool fDCFEB=false)
read from an existing data stream.
void setCRC()
=VB= Set calculated CRC value for simulated CFEB Time Slice data
unsigned theNumberOfSamples