CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
CSCCFEBData Class Reference

#include <CSCCFEBData.h>

Public Member Functions

unsigned adcCounts (unsigned layer, unsigned channel, unsigned timeBin) const
 
unsigned adcOverflow (unsigned layer, unsigned channel, unsigned timeBin) const
 
void add (const CSCStripDigi &, int layer)
 
unsigned boardNumber () const
 
bool check () const
 makes sure each time slice has a trailer More...
 
unsigned controllerData (unsigned uglay, unsigned ugchan, unsigned timeBin) const
 
 CSCCFEBData (unsigned boardNumber, const uint16_t *buf, uint16_t theFormatVersion=2005, bool fDCFEB=false)
 read from an existing data stream. More...
 
 CSCCFEBData (unsigned boardNumber, bool sixteenSamples, uint16_t theFormatVersion=2005, bool fDCFEB=false)
 create, More...
 
uint16_t * data ()
 
void digis (uint32_t idlayer, std::vector< CSCStripDigi > &result) const
 faster way to get to digis More...
 
std::vector< CSCStripDigidigis (unsigned idlayer) const
 
unsigned errorstat (unsigned layer, unsigned channel, unsigned timeBin) const
 
bool isDCFEB () const
 
unsigned nTimeSamples () const
 
unsigned overlappedSampleFlag (unsigned layer, unsigned channel, unsigned timeBin) const
 
void setBoardNumber (int cfeb)
 
void setL1A (unsigned l1a)
 
void setL1A (unsigned sample, unsigned l1a)
 
unsigned sizeInWords () const
 
CSCCFEBStatusDigi statusDigi () const
 returns one status digi per cfeb More...
 
std::vector< std::vector< CSCStripDigi > > stripDigis ()
 deprecated. Use the above method. More...
 
const CSCCFEBTimeSlicetimeSlice (unsigned i) const
 count from 0. User should check if it's a bad slice More...
 

Static Public Member Functions

static void selfTest ()
 

Private Member Functions

CSCCFEBTimeSlicetimeSlice (unsigned i)
 

Private Attributes

unsigned boardNumber_
 
std::vector< uint16_t > bWords
 
bool fDCFEB
 
uint16_t theData [1600]
 
uint16_t theFormatVersion
 
unsigned theNumberOfSamples
 
int theSize
 in words More...
 
std::vector< std::pair< int, bool > > theSliceStarts
 

Friends

std::ostream & operator<< (std::ostream &os, const CSCCFEBData &)
 

Detailed Description

Definition at line 14 of file CSCCFEBData.h.

Constructor & Destructor Documentation

CSCCFEBData::CSCCFEBData ( unsigned  boardNumber,
const uint16_t *  buf,
uint16_t  theFormatVersion = 2005,
bool  fDCFEB = false 
)

read from an existing data stream.

Definition at line 11 of file CSCCFEBData.cc.

References bWords, CSCBadCFEBTimeSlice::check(), CSCCFEBTimeSlice::check(), CSCBadCFEBWord::data(), LogTrace, HcalConst::maxSamples, CSCCFEBTimeSlice::sixteenSamples(), CSCBadCFEBTimeSlice::sizeInWords(), CSCCFEBTimeSlice::sizeInWords(), theData, theNumberOfSamples, theSize, theSliceStarts, and CSCBadCFEBTimeSlice::word().

12  : theSize(0), boardNumber_(number), theNumberOfSamples(0), theFormatVersion(format_version), fDCFEB(f_dcfeb) {
13  // I may be grabbing too many words, but that's OK
14  // parse for time slices
15  unsigned pos = 0;
16  // to be set later
17  unsigned maxSamples = 8;
18  theSliceStarts.reserve(8);
19  while(theNumberOfSamples < maxSamples) {
20  // first see if it's a bad slice
21  const CSCBadCFEBTimeSlice * badSlice
22  = reinterpret_cast<const CSCBadCFEBTimeSlice *>(buf+pos);
23  if(badSlice->check()) {
24  //show that a bad slice starts here
25  theSliceStarts.push_back(std::pair<int, bool>(pos, false));
26  pos += badSlice->sizeInWords();
27  //store bad word for status digis
28  bWords.push_back(badSlice->word(1).data()); //all 4 words are assumed identical so saving #1 only
29  }
30  else {
31  // OK. Maybe it's good.
32  const CSCCFEBTimeSlice * goodSlice
33  = reinterpret_cast<const CSCCFEBTimeSlice *>(buf+pos);
34  if(goodSlice->check()) {
35  // show that a good slice starts here
36  theSliceStarts.push_back(std::pair<int, bool>(pos, true));
37  // it will just be an array of CSCCFEBTimeSlices, so we'll
38  // grab the number of time slices from the first good one
39  // !!! VB - Limit maximum number of CFEB samples to 8.
40  // !!! In Run2 rare CFEB data corruptions were causing RECO problems with mistakenly setting 16 samples flags
41  // !!! Will need another fix in case of CSC switch to 16 samples readout
42  // maxSamples = goodSlice->sixteenSamples() ? 16 : 8;
43  if (goodSlice->sixteenSamples()) LogTrace ("CSCCFEBData|CSCRawToDigi")
44  << "CFEB DATA slice " << theNumberOfSamples << " 16 samples flag is detected";
45  pos += goodSlice->sizeInWords();
46  }
47  else {
48  LogTrace ("CSCCFEBData|CSCRawToDigi")
49  << "CORRUPT CFEB DATA slice " << theNumberOfSamples << std::hex << " "
50  << *(buf+pos+3) << " " << *(buf+pos+2) << " " << *(buf+pos+1) << " "<< *(buf+pos);
51  //ok slice is bad but try another one at 100 words after it
52  theSliceStarts.push_back(std::pair<int, bool>(pos, false));
53  pos += 100;
54  }
55  }
57  }
58  theSize = pos;
59  memcpy(theData, buf, theSize*2);
60 }
unsigned sizeInWords() const
bool sixteenSamples() const
whether we keep 8 or 16 time samples
std::vector< std::pair< int, bool > > theSliceStarts
Definition: CSCCFEBData.h:68
unsigned sizeInWords() const
int theSize
in words
Definition: CSCCFEBData.h:70
std::vector< uint16_t > bWords
Definition: CSCCFEBData.h:73
#define LogTrace(id)
unsigned data() const
bool check() const
uint16_t theData[1600]
Definition: CSCCFEBData.h:65
uint16_t theFormatVersion
Definition: CSCCFEBData.h:74
const CSCBadCFEBWord & word(int i) const
count from zero
unsigned boardNumber_
Definition: CSCCFEBData.h:71
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:72
CSCCFEBData::CSCCFEBData ( unsigned  boardNumber,
bool  sixteenSamples,
uint16_t  theFormatVersion = 2005,
bool  fDCFEB = false 
)

create,

Definition at line 63 of file CSCCFEBData.cc.

References mps_fire::i, CSCCFEBTimeSlice::setControllerWord(), theData, theNumberOfSamples, theSize, theSliceStarts, and CSCCFEBSCAControllerWord::ts_flag.

64 : boardNumber_(number), theNumberOfSamples(sixteenSamples ? 16 : 8), theFormatVersion(format_version), fDCFEB(f_dcfeb)
65 {
67 
68  // fill the SCA controller words
70  scaWord.ts_flag = sixteenSamples;
71 
72  // make a template slice to copy into theData buffer
73  CSCCFEBTimeSlice slice;
74  slice.setControllerWord(scaWord);
75 
76  for(unsigned i = 0; i < theNumberOfSamples; ++i)
77  {
78  unsigned short * pos = theData+i*100;
79  memcpy(pos, &slice, 200);
80  theSliceStarts.push_back(std::pair<int,bool>(i*100, true));
81  }
82  theSize = theNumberOfSamples*100;
83 }
void setControllerWord(const CSCCFEBSCAControllerWord &controllerWord)
std::vector< std::pair< int, bool > > theSliceStarts
Definition: CSCCFEBData.h:68
int theSize
in words
Definition: CSCCFEBData.h:70
uint16_t theData[1600]
Definition: CSCCFEBData.h:65
uint16_t theFormatVersion
Definition: CSCCFEBData.h:74
unsigned boardNumber_
Definition: CSCCFEBData.h:71
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:72

Member Function Documentation

unsigned CSCCFEBData::adcCounts ( unsigned  layer,
unsigned  channel,
unsigned  timeBin 
) const

Definition at line 117 of file CSCCFEBData.cc.

References CSCCFEBDataWord::adcCounts, fDCFEB, mps_fire::result, CSCCFEBTimeSlice::timeSample(), and timeSlice().

Referenced by nTimeSamples(), and operator<<().

118 {
119  unsigned result = 0;
120  const CSCCFEBTimeSlice * slice = timeSlice(timeBin);
121  // zero is returned for bad slices
122  if(slice) result = slice->timeSample(layer, channel,fDCFEB)->adcCounts;
123  return result;
124 }
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:101
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short adcCounts
unsigned CSCCFEBData::adcOverflow ( unsigned  layer,
unsigned  channel,
unsigned  timeBin 
) const

Definition at line 125 of file CSCCFEBData.cc.

References CSCCFEBDataWord::adcOverflow, fDCFEB, mps_fire::result, CSCCFEBTimeSlice::timeSample(), and timeSlice().

Referenced by nTimeSamples().

126 {
127  unsigned result = 0;
128  const CSCCFEBTimeSlice * slice = timeSlice(timeBin);
129  // zero is returned for bad slices
130  if(slice) result = slice->timeSample(layer, channel,fDCFEB)->adcOverflow;
131  return result;
132 }
unsigned short adcOverflow
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:101
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
void CSCCFEBData::add ( const CSCStripDigi digi,
int  layer 
)

=VB= Set CRC value for simulated data

Definition at line 85 of file CSCCFEBData.cc.

References CSCCFEBDataWord::adcCounts, fDCFEB, CSCStripDigi::getADCCounts(), CSCStripDigi::getStrip(), CSCCFEBTimeSlice::setCRC(), theNumberOfSamples, CSCCFEBTimeSlice::timeSample(), timeSlice(), and relativeConstraints::value.

Referenced by CSCEventData::add(), nTimeSamples(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

86 {
87  std::vector<int> scaCounts = digi.getADCCounts();
88  for(unsigned itime = 0; itime < theNumberOfSamples; ++itime)
89  {
90  unsigned channel = (digi.getStrip()-1) % 16 + 1;
91  unsigned value = scaCounts[itime] & 0xFFF; // 12-bit
92  // assume it's good, since we're working with simulation
93  CSCCFEBTimeSlice * slice = timeSlice(itime);
94  assert(slice != nullptr);
95  slice->timeSample(layer, channel,fDCFEB)->adcCounts = value;
97  slice->setCRC();
98  }
99 }
std::vector< int > const & getADCCounts() const
Get ADC readings.
Definition: CSCStripDigi.h:54
int getStrip() const
Definition: CSCStripDigi.h:51
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:101
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
Definition: value.py:1
unsigned short adcCounts
void setCRC()
=VB= Set calculated CRC value for simulated CFEB Time Slice data
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:72
unsigned CSCCFEBData::boardNumber ( ) const
inline

Definition at line 48 of file CSCCFEBData.h.

References boardNumber_.

48 {return boardNumber_;}
unsigned boardNumber_
Definition: CSCCFEBData.h:71
bool CSCCFEBData::check ( ) const

makes sure each time slice has a trailer

Definition at line 319 of file CSCCFEBData.cc.

References mps_fire::i, mps_fire::result, theNumberOfSamples, and timeSlice().

Referenced by cscdqm::EventProcessor::processCSC(), and setBoardNumber().

320 {
321  bool result = true;
322  for(unsigned i = 0; i < theNumberOfSamples; ++i)
323  {
324  const CSCCFEBTimeSlice * slice = timeSlice(i);
325  if(slice==nullptr || !timeSlice(i)->check()) result = false;
326  }
327  return result;
328 }
bool check() const
makes sure each time slice has a trailer
Definition: CSCCFEBData.cc:319
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:101
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:72
unsigned CSCCFEBData::controllerData ( unsigned  uglay,
unsigned  ugchan,
unsigned  timeBin 
) const

Definition at line 134 of file CSCCFEBData.cc.

References CSCCFEBDataWord::controllerData, mps_fire::result, CSCCFEBTimeSlice::timeSample(), and timeSlice().

Referenced by digis(), and nTimeSamples().

135 {
136 
137 // The argument notation is
138 // uglay = un-Gray Coded layer index 1-6
139 // ugchan = un-Gray Coded channel index 1-16
140 // The point being that the SCAC is serially encoded directly in the data stream (without Gray Coding)
141 // so the layer and channel indexes here are just the direct ordering into the data stream.
142 
143  unsigned result = 0;
144  const CSCCFEBTimeSlice * slice = timeSlice(timeBin);
145  // zero is returned for bad slices
146  if(slice) result = slice->timeSample( (ugchan-1)*6+uglay-1 )->controllerData;
147  return result;
148 }
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:101
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short controllerData
combined from all 16 strips to make a word
uint16_t* CSCCFEBData::data ( )
inline

Definition at line 46 of file CSCCFEBData.h.

References theData.

46 {return theData;}
uint16_t theData[1600]
Definition: CSCCFEBData.h:65
void CSCCFEBData::digis ( uint32_t  idlayer,
std::vector< CSCStripDigi > &  result 
) const

faster way to get to digis

Fill strip digis for layer with raw detid = idlayer WARNING: these digis have no comparator information.

for bad or missing data word will be zero

Handle 2013 Format

Definition at line 221 of file CSCCFEBData.cc.

References CSCCFEBDataWord::adcCounts, CSCCFEBDataWord::adcOverflow, boardNumber_, controllerData(), CSCDetId::endcap(), CSCCFEBDataWord::errorstat, fDCFEB, CSCDetId::layer(), LogTrace, nTimeSamples(), muon::overlap(), CSCCFEBDataWord::overlappedSampleFlag, CSCDetId::ring(), CSCDetId::station(), digitizers_cfi::strip, theFormatVersion, CSCCFEBTimeSlice::timeSample(), timeSlice(), and SurfaceOrientation::zplus.

Referenced by digis(), nTimeSamples(), stripDigis(), and CSCEventData::stripDigis().

222 {
223 
224  // assert(layer>0 && layer <= 6);
225 
226  LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples in CSCCFEBData::digis = " << nTimeSamples();
227  if (nTimeSamples()==0) {
228  LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples is zero - CFEB data corrupt?";
229  return;
230  }
231 
232  result.reserve(16);
233 
234  std::vector<int> sca(nTimeSamples());
235  std::vector<uint16_t> overflow(nTimeSamples());
236  std::vector<uint16_t> overlap(nTimeSamples());
237  std::vector<uint16_t> errorfl(nTimeSamples());
238 
239  bool me1a = (CSCDetId::station(idlayer)==1) && (CSCDetId::ring(idlayer)==4);
240  bool zplus = (CSCDetId::endcap(idlayer) == 1);
241  bool me1b = (CSCDetId::station(idlayer)==1) && (CSCDetId::ring(idlayer)==1);
242 
243  unsigned layer = CSCDetId::layer(idlayer);
244 
245  std::vector<uint16_t> l1a_phase(nTimeSamples());
246  for(unsigned itime = 0; itime < nTimeSamples(); ++itime) {
247  l1a_phase[itime] = controllerData(layer, 13, itime); // will be zero if timeslice bad
248  LogTrace("CSCCFEBData|CSCRawToDigi") << CSCDetId(idlayer) << " time sample " << itime+1 << " l1a_phase = " << controllerData(layer, 13, itime);
249  LogTrace("CSCCFEBData|CSCRawToDigi") << CSCDetId(idlayer) << " time sample " << itime+1 << " lct_phase = " << controllerData(layer, 14, itime);
250  LogTrace("CSCCFEBData|CSCRawToDigi") << CSCDetId(idlayer) << " time sample " << itime+1 << " # samples = " << controllerData(layer, 16, itime);
251  };
252 
253  for(unsigned ichannel = 1; ichannel <= 16; ++ichannel)
254  {
255  // What is the point of testing here? Move it outside this loop
256  // if (nTimeSamples()==0)
257  // {
258  // LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples is zero - CFEB data corrupt?";
259  // break;
260  // }
261 
262  for(unsigned itime = 0; itime < nTimeSamples(); ++itime)
263  {
264  const CSCCFEBTimeSlice * slice = timeSlice(itime);
265  if (slice)
266  {
267  CSCCFEBDataWord * word;
268  word = slice->timeSample(layer, ichannel,fDCFEB);
269  if (word)
270  {
271  sca[itime] = word->adcCounts;
272  overflow[itime] = word->adcOverflow;
273  overlap[itime] = word->overlappedSampleFlag;
274  errorfl[itime] = word->errorstat;
275 
276  // Stick the l1a_phase bit into 'overlap' too (so we can store it in CSCStripDigi
277  // without changing CSCStripDigi format).
278  // Put it in the 9th bit of the overlap word which is only 1-bit anyway.
279  overlap[itime] = (( l1a_phase[itime] & 0x1 ) << 8 ) | ( word->overlappedSampleFlag & 0x1 );
280  }
281  }
282  }
283  if (sca.empty())
284  {
285  LogTrace("CSCCFEBData|CSCRawToDigi") << "ADC counts empty - CFEB data corrupt?";
286  break;
287  }
288  int strip = ichannel + 16*boardNumber_;
289 
290  if (theFormatVersion == 2013) {
291 
292  if ( me1a ) strip = strip%64; // reset 65-112/ to 1-48 digi
293  if ( me1a && zplus ) { strip = 49 - strip; } // 1-48 -> 48-1
294  if ( me1b && !zplus) { strip = 65 - strip;} // 1-64 -> 64-1 ...
295 
296  } else { // Handle original 2005 format
297 
298  if ( me1a ) strip = strip%64; // reset 65-80 to 1-16 digi
299  if ( me1a && zplus ) { strip = 17 - strip; } // 1-16 -> 16-1
300  if ( me1b && !zplus) { strip = 65 - strip;} // 1-64 -> 64-1 ...
301  }
302  result.push_back(CSCStripDigi(strip, sca, overflow, overlap, errorfl));
303  }
304 }
unsigned short adcOverflow
int layer() const
Definition: CSCDetId.h:61
unsigned controllerData(unsigned uglay, unsigned ugchan, unsigned timeBin) const
Definition: CSCCFEBData.cc:134
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:101
int endcap() const
Definition: CSCDetId.h:93
unsigned nTimeSamples() const
Definition: CSCCFEBData.h:21
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short overlappedSampleFlag
#define LogTrace(id)
int ring() const
Definition: CSCDetId.h:75
uint16_t theFormatVersion
Definition: CSCCFEBData.h:74
int station() const
Definition: CSCDetId.h:86
unsigned short adcCounts
unsigned short errorstat
unsigned boardNumber_
Definition: CSCCFEBData.h:71
std::vector< CSCStripDigi > CSCCFEBData::digis ( unsigned  idlayer) const

Definition at line 308 of file CSCCFEBData.cc.

References digis(), and mps_fire::result.

309 {
310  //assert(layer>0 && layer <= 6);
311  std::vector<CSCStripDigi> result;
312  uint32_t layer= idlayer;
313  digis(layer, result);
314  return result;
315 }
void digis(uint32_t idlayer, std::vector< CSCStripDigi > &result) const
faster way to get to digis
Definition: CSCCFEBData.cc:221
unsigned CSCCFEBData::errorstat ( unsigned  layer,
unsigned  channel,
unsigned  timeBin 
) const

Definition at line 158 of file CSCCFEBData.cc.

References CSCCFEBDataWord::errorstat, fDCFEB, mps_fire::result, CSCCFEBTimeSlice::timeSample(), and timeSlice().

Referenced by nTimeSamples().

159 {
160  unsigned result = 0;
161  const CSCCFEBTimeSlice * slice = timeSlice(timeBin);
162  // zero is returned for bad slices
163  if(slice) result = slice->timeSample(layer, channel,fDCFEB)->errorstat;
164  return result;
165 }
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:101
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short errorstat
bool CSCCFEBData::isDCFEB ( ) const
inline

Definition at line 59 of file CSCCFEBData.h.

References fDCFEB, and timeSlice().

59 {return fDCFEB;}
unsigned CSCCFEBData::nTimeSamples ( ) const
inline
unsigned CSCCFEBData::overlappedSampleFlag ( unsigned  layer,
unsigned  channel,
unsigned  timeBin 
) const

Definition at line 150 of file CSCCFEBData.cc.

References fDCFEB, CSCCFEBDataWord::overlappedSampleFlag, mps_fire::result, CSCCFEBTimeSlice::timeSample(), and timeSlice().

Referenced by nTimeSamples().

151 {
152  unsigned result = 0;
153  const CSCCFEBTimeSlice * slice = timeSlice(timeBin);
154  // zero is returned for bad slices
155  if(slice) result = slice->timeSample(layer, channel,fDCFEB)->overlappedSampleFlag;
156  return result;
157 }
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:101
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short overlappedSampleFlag
static void CSCCFEBData::selfTest ( )
static

Referenced by setBoardNumber().

void CSCCFEBData::setBoardNumber ( int  cfeb)
inline

Definition at line 49 of file CSCCFEBData.h.

References boardNumber_, check(), operator<<, simplePhotonAnalyzer_cfi::sample, selfTest(), and setL1A().

49 {boardNumber_=cfeb;}
unsigned boardNumber_
Definition: CSCCFEBData.h:71
void CSCCFEBData::setL1A ( unsigned  l1a)

Definition at line 168 of file CSCCFEBData.cc.

References mps_fire::i, and theNumberOfSamples.

Referenced by setBoardNumber(), and CSCEventData::setEventInformation().

169 {
170  for (unsigned i=0; i < theNumberOfSamples; i++) setL1A(i, l1a);
171 }
void setL1A(unsigned l1a)
Definition: CSCCFEBData.cc:168
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:72
void CSCCFEBData::setL1A ( unsigned  sample,
unsigned  l1a 
)

Definition at line 173 of file CSCCFEBData.cc.

References mps_fire::i, theData, theNumberOfSamples, and theSliceStarts.

174 {
175  assert(i < theNumberOfSamples);
176  std::pair<int,bool> start = theSliceStarts[i];
177  // give a NULL pointer if this is a bad slice
178  if(start.second)
179  {
180  (reinterpret_cast<CSCCFEBTimeSlice *>(theData+start.first))->set_L1Anumber(l1a);
181  }
182 }
Definition: start.py:1
std::vector< std::pair< int, bool > > theSliceStarts
Definition: CSCCFEBData.h:68
uint16_t theData[1600]
Definition: CSCCFEBData.h:65
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:72
unsigned CSCCFEBData::sizeInWords ( ) const
inline

Definition at line 47 of file CSCCFEBData.h.

References theSize.

Referenced by CSCEventData::unpack_data().

47 {return theSize;}
int theSize
in words
Definition: CSCCFEBData.h:70
CSCCFEBStatusDigi CSCCFEBData::statusDigi ( ) const

returns one status digi per cfeb

returns one status digi per cfeb contains bWord if slice is bad also contains crc word and controller word

here layer=1 bec this word repeats 6 times for each layer

Definition at line 184 of file CSCCFEBData.cc.

References boardNumber_, bWords, CSCCFEBDataWord::controllerData, CSCCFEBTimeSlice::get_crc(), mps_fire::i, LogTrace, nTimeSamples(), mps_fire::result, CSCCFEBTimeSlice::timeSample(), and timeSlice().

Referenced by nTimeSamples().

185 {
189 
190  std::vector<uint16_t> crcWords(nTimeSamples());
191  std::vector<uint16_t> contrWords(nTimeSamples());
192 
193  if (nTimeSamples()==0)
194  {
195  LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples is zero - CFEB data corrupt?";
196  }
197  else
198  {
199  for(unsigned itime = 0; itime < nTimeSamples(); ++itime) {
200  const CSCCFEBTimeSlice * slice = timeSlice(itime);
201  // zero is returned for bad slices
202  if (slice) crcWords[itime] = slice->get_crc();
203  if (slice)
204  {
205  int layer=1;
206  for(unsigned i = 0; i < 16; ++i)
207  {
208  contrWords[itime] |= slice->timeSample(i*6+layer-1)->controllerData << i;
209  }
210  }
211 
212  }
213  }
214 
215  CSCCFEBStatusDigi result(boardNumber_+1, crcWords, contrWords, bWords);
216  return result;
217 }
unsigned get_crc() const
accessors for words 97, 98 and 99
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:101
unsigned nTimeSamples() const
Definition: CSCCFEBData.h:21
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
std::vector< uint16_t > bWords
Definition: CSCCFEBData.h:73
#define LogTrace(id)
unsigned short controllerData
combined from all 16 strips to make a word
unsigned boardNumber_
Definition: CSCCFEBData.h:71
std::vector< std::vector< CSCStripDigi > > CSCCFEBData::stripDigis ( )

deprecated. Use the above method.

Definition at line 349 of file CSCCFEBData.cc.

References digis(), and mps_fire::result.

Referenced by nTimeSamples().

350 {
351  std::vector < std::vector<CSCStripDigi> > result;
352  for (int layer = 1; layer <= 6; ++layer)
353  {
354  result.push_back(digis(layer));
355  }
356  return result;
357 }
void digis(uint32_t idlayer, std::vector< CSCStripDigi > &result) const
faster way to get to digis
Definition: CSCCFEBData.cc:221
const CSCCFEBTimeSlice * CSCCFEBData::timeSlice ( unsigned  i) const

count from 0. User should check if it's a bad slice

Definition at line 101 of file CSCCFEBData.cc.

References mps_fire::i, theData, theNumberOfSamples, and theSliceStarts.

Referenced by adcCounts(), adcOverflow(), add(), check(), controllerData(), digis(), errorstat(), isDCFEB(), nTimeSamples(), overlappedSampleFlag(), and statusDigi().

102 {
103  assert(i < theNumberOfSamples);
104  std::pair<int,bool> start = theSliceStarts[i];
105  // give a NULL pointer if this is a bad slice
106  return start.second ? reinterpret_cast<const CSCCFEBTimeSlice *>(theData+start.first) : nullptr;
107 }
Definition: start.py:1
std::vector< std::pair< int, bool > > theSliceStarts
Definition: CSCCFEBData.h:68
uint16_t theData[1600]
Definition: CSCCFEBData.h:65
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:72
CSCCFEBTimeSlice * CSCCFEBData::timeSlice ( unsigned  i)
private

Definition at line 109 of file CSCCFEBData.cc.

References mps_fire::i, theData, theNumberOfSamples, and theSliceStarts.

110 {
111  assert(i < theNumberOfSamples);
112  std::pair<int,bool> start = theSliceStarts[i];
113  // give a NULL pointer if this is a bad slice
114  return start.second ? reinterpret_cast<CSCCFEBTimeSlice *>(theData+start.first) : nullptr;
115 }
Definition: start.py:1
std::vector< std::pair< int, bool > > theSliceStarts
Definition: CSCCFEBData.h:68
uint16_t theData[1600]
Definition: CSCCFEBData.h:65
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:72

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CSCCFEBData data 
)
friend

Definition at line 330 of file CSCCFEBData.cc.

Referenced by setBoardNumber().

331 {
332  os << "printing CFEB data sample by sample " << std::endl;
333  for(unsigned ilayer = 1; ilayer <= 6; ++ilayer)
334  {
335  for(unsigned channel = 1; channel <= 16; ++channel)
336  {
337  unsigned strip = channel + data.boardNumber_*16;
338  os << "Strip " << strip << " ";
339  for(unsigned timeBin = 0; timeBin < data.nTimeSamples(); ++timeBin)
340  {
341  os << data.adcCounts(ilayer, channel, timeBin) << " " ;
342  }
343  os << std::endl;
344  }
345  }
346  return os;
347 }
unsigned adcCounts(unsigned layer, unsigned channel, unsigned timeBin) const
Definition: CSCCFEBData.cc:117
unsigned nTimeSamples() const
Definition: CSCCFEBData.h:21
unsigned boardNumber_
Definition: CSCCFEBData.h:71

Member Data Documentation

unsigned CSCCFEBData::boardNumber_
private

Definition at line 71 of file CSCCFEBData.h.

Referenced by boardNumber(), digis(), operator<<(), setBoardNumber(), and statusDigi().

std::vector<uint16_t> CSCCFEBData::bWords
private

Definition at line 73 of file CSCCFEBData.h.

Referenced by CSCCFEBData(), and statusDigi().

bool CSCCFEBData::fDCFEB
private

Definition at line 75 of file CSCCFEBData.h.

Referenced by adcCounts(), adcOverflow(), add(), digis(), errorstat(), isDCFEB(), and overlappedSampleFlag().

uint16_t CSCCFEBData::theData[1600]
private

Definition at line 65 of file CSCCFEBData.h.

Referenced by CSCCFEBData(), data(), setL1A(), and timeSlice().

uint16_t CSCCFEBData::theFormatVersion
private

Definition at line 74 of file CSCCFEBData.h.

Referenced by digis().

unsigned CSCCFEBData::theNumberOfSamples
private

Definition at line 72 of file CSCCFEBData.h.

Referenced by add(), check(), CSCCFEBData(), nTimeSamples(), setL1A(), and timeSlice().

int CSCCFEBData::theSize
private

in words

Definition at line 70 of file CSCCFEBData.h.

Referenced by CSCCFEBData(), and sizeInWords().

std::vector<std::pair<int,bool> > CSCCFEBData::theSliceStarts
private

Shows where in theData the words start. A bad slice will be tagged with a false

Definition at line 68 of file CSCCFEBData.h.

Referenced by CSCCFEBData(), setL1A(), and timeSlice().