12 : theSize(0), boardNumber_(
number), theNumberOfSamples(0), theFormatVersion(format_version), fDCFEB(f_dcfeb) {
22 if (badSlice->
check()) {
31 if (goodSlice->
check()) {
61 theNumberOfSamples(sixteenSamples ? 16 : 8),
62 theFormatVersion(format_version),
68 scaWord.
ts_flag = sixteenSamples;
72 slice.setControllerWord(scaWord);
85 unsigned channel = (digi.
getStrip() - 1) % 16 + 1;
86 unsigned value = scaCounts[itime] & 0xFFF;
138 result =
slice->timeSample((ugchan - 1) * 6 + uglay - 1)->controllerData;
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) {
192 contrWords[itime] |=
slice->timeSample(
i * 6 +
layer - 1)->controllerData <<
i;
203 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
"nTimeSamples in CSCCFEBData::digis = " <<
nTimeSamples();
205 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
"nTimeSamples is zero - CFEB data corrupt?";
223 for (
unsigned itime = 0; itime <
nTimeSamples(); ++itime) {
225 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
CSCDetId(idlayer) <<
" time sample " << itime + 1
227 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
CSCDetId(idlayer) <<
" time sample " << itime + 1
229 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
CSCDetId(idlayer) <<
" time sample " << itime + 1
233 for (
unsigned ichannel = 1; ichannel <= 16; ++ichannel) {
241 for (
unsigned itime = 0; itime <
nTimeSamples(); ++itime) {
247 sca[itime] =
word->adcCounts;
248 overflow[itime] =
word->adcOverflow;
250 errorfl[itime] =
word->errorstat;
255 overlap[itime] = ((l1a_phase[itime] & 0x1) << 8) | (
word->overlappedSampleFlag & 0x1);
260 LogTrace(
"CSCCFEBData|CSCRawToDigi") <<
"ADC counts empty - CFEB data corrupt?";
272 if (me1b && !
zplus) {
283 if (me1b && !
zplus) {
292 std::vector<CSCStripDigi>
result;
293 uint32_t
layer = idlayer;
309 os <<
"printing CFEB data sample by sample " << std::endl;
311 for (
unsigned channel = 1; channel <= 16; ++channel) {
312 unsigned strip = channel +
data.boardNumber_ * 16;
313 os <<
"Strip " <<
strip <<
" ";
314 for (
unsigned timeBin = 0; timeBin <
data.nTimeSamples(); ++timeBin) {
315 os <<
data.adcCounts(ilayer, channel, timeBin) <<
" ";
324 std::vector<std::vector<CSCStripDigi> >
result;
CSCCFEBStatusDigi statusDigi() const
returns one status digi per cfeb
unsigned sizeInWords() const
unsigned controllerData(unsigned uglay, unsigned ugchan, unsigned timeBin) const
void add(const CSCStripDigi &, int layer)
void setL1A(unsigned l1a)
std::ostream & operator<<(std::ostream &os, const CSCCFEBData &data)
unsigned adcCounts(unsigned layer, unsigned channel, unsigned timeBin) const
std::vector< std::pair< int, bool > > theSliceStarts
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned sizeInWords() const
std::vector< std::vector< CSCStripDigi > > stripDigis()
deprecated. Use the above method.
bool sixteenSamples() const
whether we keep 8 or 16 time samples
unsigned overlappedSampleFlag(unsigned layer, unsigned channel, unsigned timeBin) const
std::vector< uint16_t > bWords
unsigned errorstat(unsigned layer, unsigned channel, unsigned timeBin) const
unsigned adcOverflow(unsigned layer, unsigned channel, unsigned timeBin) const
const CSCBadCFEBWord & word(int i) const
count from zero
unsigned nTimeSamples() const
void digis(uint32_t idlayer, std::vector< CSCStripDigi > &result) const
faster way to get to digis
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it's a bad slice
char data[epos_bytes_allocation]
uint16_t theFormatVersion
CSCCFEBData(unsigned boardNumber, const uint16_t *buf, uint16_t theFormatVersion=2005, bool fDCFEB=false)
read from an existing data stream.
bool check() const
makes sure each time slice has a trailer
std::vector< int > const & getADCCounts() const
Get ADC readings.
unsigned theNumberOfSamples