CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public 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, unsigned short *buf)
 read from an existing data stream. More...
 
 CSCCFEBData (unsigned boardNumber, bool sixteenSamples)
 create, More...
 
unsigned short * data ()
 
void digis (uint32_t idlayer, std::vector< CSCStripDigi > &result)
 faster way to get to digis More...
 
std::vector< CSCStripDigidigis (unsigned idlayer)
 
unsigned errorstat (unsigned layer, unsigned channel, unsigned timeBin) const
 
unsigned nTimeSamples () const
 
unsigned overlappedSampleFlag (unsigned layer, unsigned channel, unsigned timeBin) const
 
void setBoardNumber (int cfeb)
 
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 Attributes

unsigned boardNumber_
 
std::vector< uint16_t > bWords
 
unsigned short theData [1600]
 
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,
unsigned short *  buf 
)

read from an existing data stream.

Definition at line 11 of file CSCCFEBData.cc.

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

12  : theSize(0), boardNumber_(number), theNumberOfSamples(0) {
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  CSCBadCFEBTimeSlice * badSlice
22  = reinterpret_cast<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  CSCCFEBTimeSlice * goodSlice
33  = reinterpret_cast<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  maxSamples = goodSlice->sixteenSamples() ? 16 : 8;
40  pos += goodSlice->sizeInWords();
41  }
42  else {
43  LogTrace ("CSCCFEBData|CSCRawToDigi")
44  << "CORRUPT CFEB DATA slice " << theNumberOfSamples << std::hex << " "
45  << *(buf+pos+3) << " " << *(buf+pos+2) << " " << *(buf+pos+1) << " "<< *(buf+pos);
46  //ok slice is bad but try another one at 100 words after it
47  theSliceStarts.push_back(std::pair<int, bool>(pos, false));
48  pos += 100;
49  }
50  }
52  }
53  theSize = pos;
54  memcpy(theData, buf, theSize*2);
55 }
unsigned sizeInWords() const
std::vector< std::pair< int, bool > > theSliceStarts
Definition: CSCCFEBData.h:61
unsigned sizeInWords() const
int theSize
in words
Definition: CSCCFEBData.h:63
unsigned short theData[1600]
Definition: CSCCFEBData.h:58
CSCBadCFEBWord & word(int i)
count from zero
bool sixteenSamples()
whether we keep 8 or 16 time samples
std::vector< uint16_t > bWords
Definition: CSCCFEBData.h:66
#define LogTrace(id)
unsigned data() const
bool check() const
unsigned boardNumber_
Definition: CSCCFEBData.h:64
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:65
CSCCFEBData::CSCCFEBData ( unsigned  boardNumber,
bool  sixteenSamples 
)

create,

Definition at line 58 of file CSCCFEBData.cc.

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

59 : boardNumber_(number), theNumberOfSamples(sixteenSamples ? 16 : 8)
60 {
62 
63  // fill the SCA controller words
65  scaWord.ts_flag = sixteenSamples;
66 
67  // make a template slice to copy into theData buffer
68  CSCCFEBTimeSlice slice;
69  slice.setControllerWord(scaWord);
70 
71  for(unsigned i = 0; i < theNumberOfSamples; ++i)
72  {
73  unsigned short * pos = theData+i*100;
74  memcpy(pos, &slice, 200);
75  theSliceStarts.push_back(std::pair<int,bool>(i*100, true));
76  }
77  theSize = theNumberOfSamples*100;
78 }
int i
Definition: DBlmapReader.cc:9
void setControllerWord(const CSCCFEBSCAControllerWord &controllerWord)
std::vector< std::pair< int, bool > > theSliceStarts
Definition: CSCCFEBData.h:61
int theSize
in words
Definition: CSCCFEBData.h:63
unsigned short theData[1600]
Definition: CSCCFEBData.h:58
unsigned boardNumber_
Definition: CSCCFEBData.h:64
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:65

Member Function Documentation

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

Definition at line 114 of file CSCCFEBData.cc.

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

Referenced by operator<<().

115 {
116  unsigned result = 0;
117  const CSCCFEBTimeSlice * slice = timeSlice(timeBin);
118  // zero is returned for bad slices
119  if(slice) result = slice->timeSample(layer, channel)->adcCounts;
120  return result;
121 }
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:96
tuple result
Definition: query.py:137
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 122 of file CSCCFEBData.cc.

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

123 {
124  unsigned result = 0;
125  const CSCCFEBTimeSlice * slice = timeSlice(timeBin);
126  // zero is returned for bad slices
127  if(slice) result = slice->timeSample(layer, channel)->adcOverflow;
128  return result;
129 }
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:96
tuple result
Definition: query.py:137
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 80 of file CSCCFEBData.cc.

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

Referenced by CSCEventData::add().

81 {
82  std::vector<int> scaCounts = digi.getADCCounts();
83  for(unsigned itime = 0; itime < theNumberOfSamples; ++itime)
84  {
85  unsigned channel = (digi.getStrip()-1) % 16 + 1;
86  unsigned value = scaCounts[itime] & 0xFFF; // 12-bit
87  // assume it's good, since we're working with simulation
88  const CSCCFEBTimeSlice * slice = timeSlice(itime);
89  assert(slice != 0);
90  slice->timeSample(layer, channel)->adcCounts = value;
92  ((CSCCFEBTimeSlice *)slice)->setCRC();
93  }
94 }
std::vector< int > getADCCounts() const
Get ADC readings.
Definition: CSCStripDigi.cc:39
int getStrip() const
Definition: CSCStripDigi.h:37
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:96
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short adcCounts
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:65
unsigned CSCCFEBData::boardNumber ( ) const
inline

Definition at line 48 of file CSCCFEBData.h.

References boardNumber_.

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

makes sure each time slice has a trailer

Definition at line 290 of file CSCCFEBData.cc.

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

Referenced by cscdqm::EventProcessor::processCSC().

291 {
292  bool result = true;
293  for(unsigned i = 0; i < theNumberOfSamples; ++i)
294  {
295  const CSCCFEBTimeSlice * slice = timeSlice(i);
296  if(slice==0 || !timeSlice(i)->check()) result = false;
297  }
298  return result;
299 }
int i
Definition: DBlmapReader.cc:9
bool check() const
makes sure each time slice has a trailer
Definition: CSCCFEBData.cc:290
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:96
tuple result
Definition: query.py:137
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:65
unsigned CSCCFEBData::controllerData ( unsigned  uglay,
unsigned  ugchan,
unsigned  timeBin 
) const

Definition at line 131 of file CSCCFEBData.cc.

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

Referenced by digis().

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

Definition at line 46 of file CSCCFEBData.h.

References theData.

Referenced by cuy.FindIssue::__init__().

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

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

Definition at line 202 of file CSCCFEBData.cc.

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

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

203 {
204 
205  // assert(layer>0 && layer <= 6);
206 
207  LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples in CSCCFEBData::digis = " << nTimeSamples();
208  if (nTimeSamples()==0) {
209  LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples is zero - CFEB data corrupt?";
210  return;
211  }
212 
213  result.reserve(16);
214 
215  std::vector<int> sca(nTimeSamples());
216  std::vector<uint16_t> overflow(nTimeSamples());
217  std::vector<uint16_t> overlap(nTimeSamples());
218  std::vector<uint16_t> errorfl(nTimeSamples());
219 
220  bool me1a = (CSCDetId::station(idlayer)==1) && (CSCDetId::ring(idlayer)==4);
221  bool zplus = (CSCDetId::endcap(idlayer) == 1);
222  bool me1b = (CSCDetId::station(idlayer)==1) && (CSCDetId::ring(idlayer)==1);
223 
224  unsigned layer = CSCDetId::layer(idlayer);
225 
226  std::vector<uint16_t> l1a_phase(nTimeSamples());
227  for(unsigned itime = 0; itime < nTimeSamples(); ++itime) {
228  l1a_phase[itime] = controllerData(layer, 13, itime); // will be zero if timeslice bad
229  LogTrace("CSCCFEBData|CSCRawToDigi") << CSCDetId(idlayer) << " time sample " << itime+1 << " l1a_phase = " << controllerData(layer, 13, itime);
230  LogTrace("CSCCFEBData|CSCRawToDigi") << CSCDetId(idlayer) << " time sample " << itime+1 << " lct_phase = " << controllerData(layer, 14, itime);
231  LogTrace("CSCCFEBData|CSCRawToDigi") << CSCDetId(idlayer) << " time sample " << itime+1 << " # samples = " << controllerData(layer, 16, itime);
232  };
233 
234  for(unsigned ichannel = 1; ichannel <= 16; ++ichannel)
235  {
236  // What is the point of testing here? Move it outside this loop
237  // if (nTimeSamples()==0)
238  // {
239  // LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples is zero - CFEB data corrupt?";
240  // break;
241  // }
242 
243  for(unsigned itime = 0; itime < nTimeSamples(); ++itime)
244  {
245  const CSCCFEBTimeSlice * slice = timeSlice(itime);
246  if (slice)
247  {
248  CSCCFEBDataWord * word;
249  word = slice->timeSample(layer, ichannel);
250  if (word)
251  {
252  sca[itime] = word->adcCounts;
253  overflow[itime] = word->adcOverflow;
254  overlap[itime] = word->overlappedSampleFlag;
255  errorfl[itime] = word->errorstat;
256 
257  // Stick the l1a_phase bit into 'overlap' too (so we can store it in CSCStripDigi
258  // without changing CSCStripDigi format).
259  // Put it in the 9th bit of the overlap word which is only 1-bit anyway.
260  overlap[itime] = (( l1a_phase[itime] & 0x1 ) << 8 ) | ( word->overlappedSampleFlag & 0x1 );
261  }
262  }
263  }
264  if (sca.empty())
265  {
266  LogTrace("CSCCFEBData|CSCRawToDigi") << "ADC counts empty - CFEB data corrupt?";
267  break;
268  }
269  int strip = ichannel + 16*boardNumber_;
270  if ( me1a ) strip = strip%64; // reset 65-80 to 1-16 digi
271  if ( me1a && zplus ) { strip = 17-strip; } // 1-16 -> 16-1
272  if ( me1b && !zplus) { strip = 65 - strip;} // 1-64 -> 64-1 ...
273  result.push_back(CSCStripDigi(strip, sca, overflow, overlap, errorfl));
274  }
275 }
unsigned short adcOverflow
int layer() const
Definition: CSCDetId.h:63
unsigned controllerData(unsigned uglay, unsigned ugchan, unsigned timeBin) const
Definition: CSCCFEBData.cc:131
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:96
int endcap() const
Definition: CSCDetId.h:95
unsigned nTimeSamples() const
Definition: CSCCFEBData.h:21
tuple result
Definition: query.py:137
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short overlappedSampleFlag
#define LogTrace(id)
int ring() const
Definition: CSCDetId.h:77
int station() const
Definition: CSCDetId.h:88
unsigned short adcCounts
unsigned short errorstat
unsigned boardNumber_
Definition: CSCCFEBData.h:64
std::vector< CSCStripDigi > CSCCFEBData::digis ( unsigned  idlayer)

Definition at line 279 of file CSCCFEBData.cc.

References digis(), and query::result.

280 {
281  //assert(layer>0 && layer <= 6);
282  std::vector<CSCStripDigi> result;
283  uint32_t layer= idlayer;
284  digis(layer, result);
285  return result;
286 }
void digis(uint32_t idlayer, std::vector< CSCStripDigi > &result)
faster way to get to digis
Definition: CSCCFEBData.cc:202
tuple result
Definition: query.py:137
unsigned CSCCFEBData::errorstat ( unsigned  layer,
unsigned  channel,
unsigned  timeBin 
) const

Definition at line 155 of file CSCCFEBData.cc.

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

156 {
157  unsigned result = 0;
158  const CSCCFEBTimeSlice * slice = timeSlice(timeBin);
159  // zero is returned for bad slices
160  if(slice) result = slice->timeSample(layer, channel)->errorstat;
161  return result;
162 }
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:96
tuple result
Definition: query.py:137
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short errorstat
unsigned CSCCFEBData::nTimeSamples ( ) const
inline

Definition at line 21 of file CSCCFEBData.h.

References theNumberOfSamples.

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

21 { return theNumberOfSamples;}
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:65
unsigned CSCCFEBData::overlappedSampleFlag ( unsigned  layer,
unsigned  channel,
unsigned  timeBin 
) const

Definition at line 147 of file CSCCFEBData.cc.

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

148 {
149  unsigned result = 0;
150  const CSCCFEBTimeSlice * slice = timeSlice(timeBin);
151  // zero is returned for bad slices
152  if(slice) result = slice->timeSample(layer, channel)->overlappedSampleFlag;
153  return result;
154 }
const CSCCFEBTimeSlice * timeSlice(unsigned i) const
count from 0. User should check if it&#39;s a bad slice
Definition: CSCCFEBData.cc:96
tuple result
Definition: query.py:137
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
unsigned short overlappedSampleFlag
static void CSCCFEBData::selfTest ( )
static
void CSCCFEBData::setBoardNumber ( int  cfeb)
inline

Definition at line 49 of file CSCCFEBData.h.

References boardNumber_.

49 {boardNumber_=cfeb;}
unsigned boardNumber_
Definition: CSCCFEBData.h:64
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:63
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 165 of file CSCCFEBData.cc.

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

166 {
170 
171  std::vector<uint16_t> crcWords(nTimeSamples());
172  std::vector<uint16_t> contrWords(nTimeSamples());
173 
174  if (nTimeSamples()==0)
175  {
176  LogTrace("CSCCFEBData|CSCRawToDigi") << "nTimeSamples is zero - CFEB data corrupt?";
177  }
178  else
179  {
180  for(unsigned itime = 0; itime < nTimeSamples(); ++itime) {
181  const CSCCFEBTimeSlice * slice = timeSlice(itime);
182  // zero is returned for bad slices
183  if (slice) crcWords[itime] = slice->get_crc();
184  if (slice)
185  {
186  int layer=1;
187  for(unsigned i = 0; i < 16; ++i)
188  {
189  contrWords[itime] |= slice->timeSample(i*6+layer-1)->controllerData << i;
190  }
191  }
192 
193  }
194  }
195 
196  CSCCFEBStatusDigi result(boardNumber_+1, crcWords, contrWords, bWords);
197  return result;
198 }
int i
Definition: DBlmapReader.cc:9
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:96
unsigned nTimeSamples() const
Definition: CSCCFEBData.h:21
tuple result
Definition: query.py:137
CSCCFEBDataWord * timeSample(int index) const
input from 0 to 95
std::vector< uint16_t > bWords
Definition: CSCCFEBData.h:66
#define LogTrace(id)
unsigned short controllerData
combined from all 16 strips to make a word
unsigned boardNumber_
Definition: CSCCFEBData.h:64
std::vector< std::vector< CSCStripDigi > > CSCCFEBData::stripDigis ( )

deprecated. Use the above method.

Definition at line 320 of file CSCCFEBData.cc.

References digis(), and query::result.

321 {
322  std::vector < std::vector<CSCStripDigi> > result;
323  for (int layer = 1; layer <= 6; ++layer)
324  {
325  result.push_back(digis(layer));
326  }
327  return result;
328 }
void digis(uint32_t idlayer, std::vector< CSCStripDigi > &result)
faster way to get to digis
Definition: CSCCFEBData.cc:202
tuple result
Definition: query.py:137
const CSCCFEBTimeSlice * CSCCFEBData::timeSlice ( unsigned  i) const

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

Definition at line 96 of file CSCCFEBData.cc.

References i, query::result, dqm_diff::start, theData, theNumberOfSamples, and theSliceStarts.

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

97 {
98  const CSCCFEBTimeSlice * result;
99  assert(i < theNumberOfSamples);
100  std::pair<int,bool> start = theSliceStarts[i];
101  // give a NULL pointer if this is a bad slice
102  if(!start.second)
103  {
104  result = 0;
105  }
106  else
107  {
108  result = reinterpret_cast<const CSCCFEBTimeSlice *>(theData+start.first);
109  }
110  return result;
111 }
int i
Definition: DBlmapReader.cc:9
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
std::vector< std::pair< int, bool > > theSliceStarts
Definition: CSCCFEBData.h:61
unsigned short theData[1600]
Definition: CSCCFEBData.h:58
tuple result
Definition: query.py:137
unsigned theNumberOfSamples
Definition: CSCCFEBData.h:65

Friends And Related Function Documentation

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

Definition at line 301 of file CSCCFEBData.cc.

302 {
303  os << "printing CFEB data sample by sample " << std::endl;
304  for(unsigned ilayer = 1; ilayer <= 6; ++ilayer)
305  {
306  for(unsigned channel = 1; channel <= 16; ++channel)
307  {
308  unsigned strip = channel + data.boardNumber_*16;
309  os << "Strip " << strip << " ";
310  for(unsigned timeBin = 0; timeBin < data.nTimeSamples(); ++timeBin)
311  {
312  os << data.adcCounts(ilayer, channel, timeBin) << " " ;
313  }
314  os << std::endl;
315  }
316  }
317  return os;
318 }
unsigned adcCounts(unsigned layer, unsigned channel, unsigned timeBin) const
Definition: CSCCFEBData.cc:114
unsigned nTimeSamples() const
Definition: CSCCFEBData.h:21
unsigned boardNumber_
Definition: CSCCFEBData.h:64

Member Data Documentation

unsigned CSCCFEBData::boardNumber_
private

Definition at line 64 of file CSCCFEBData.h.

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

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

Definition at line 66 of file CSCCFEBData.h.

Referenced by CSCCFEBData(), and statusDigi().

unsigned short CSCCFEBData::theData[1600]
private

Definition at line 58 of file CSCCFEBData.h.

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

unsigned CSCCFEBData::theNumberOfSamples
private

Definition at line 65 of file CSCCFEBData.h.

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

int CSCCFEBData::theSize
private

in words

Definition at line 63 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 61 of file CSCCFEBData.h.

Referenced by CSCCFEBData(), and timeSlice().