CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
CSCAnodeData2006 Class Reference

#include <CSCAnodeData2006.h>

Inheritance diagram for CSCAnodeData2006:
CSCAnodeDataFormat

Public Member Functions

void add (const CSCWireDigi &, int layer) override
 
 CSCAnodeData2006 (const CSCALCTHeader &)
 a blank one, for Monte Carlo More...
 
 CSCAnodeData2006 (const CSCALCTHeader &, const unsigned short *buf)
 fill from a real datastream More...
 
unsigned short * data () override
 
unsigned short int sizeInWords () const override
 the amount of the input binary buffer read, in 16-bit words More...
 
std::vector< CSCWireDigiwireDigis (int layer) const override
 input layer is from 1 to 6 More...
 
- Public Member Functions inherited from CSCAnodeDataFormat
virtual ~CSCAnodeDataFormat ()
 

Static Public Member Functions

static void selfTest ()
 

Private Member Functions

void addHit (int afeb, int tbin, int layer, int halfLayer, unsigned wireBit)
 
int index (int afeb, int tbin, int layer) const
 the index into theDataFrames More...
 
void init ()
 
CSCAnodeDataFrame2006 rawHit (int afeb, int tbin, int layer, int halfLayer) const
 

Private Attributes

unsigned int alctBX_
 
int nAFEBs_
 in 2007 format the max number of frames is 1860 More...
 
int nTimeBins_
 
unsigned short theDataFrames [2700]
 we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2 More...
 

Detailed Description

Definition at line 39 of file CSCAnodeData2006.h.

Constructor & Destructor Documentation

CSCAnodeData2006::CSCAnodeData2006 ( const CSCALCTHeader header)

a blank one, for Monte Carlo

for digi->raw packing

To get BX from ALCT digis

Definition at line 14 of file CSCAnodeData2006.cc.

References alctBX_, CSCALCTHeader::BXNCount(), CSCAnodeDataFrame2006::frame(), index(), phase1PixelTopology::layer, LogTrace, CSCDetId::maxLayerId(), CSCDetId::minLayerId(), nAFEBs_, nTimeBins_, sizeInWords(), and theDataFrames.

15  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) {
16  LogTrace("CSCAnodeData|CSCRawToDigi") << "Making Anode data " << sizeInWords() << " AFEB " << nAFEBs_ << " TBINS "
17  << nTimeBins_;
18  bzero(theDataFrames, sizeInWords() * 2);
19  for (int afeb = 0; afeb < nAFEBs_; ++afeb) {
20  for (int tbin = 0; tbin < nTimeBins_; ++tbin) {
22  for (int halfLayer = 0; halfLayer < 2; ++halfLayer) {
23  theDataFrames[index(afeb, tbin, layer) + halfLayer] = CSCAnodeDataFrame2006(afeb, tbin, 0).frame();
24  }
25  }
26  }
27  }
29  alctBX_ = header.BXNCount();
30 }
unsigned int alctBX_
unsigned short theDataFrames[2700]
we don&#39;t know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
unsigned short int nLCTChipRead() const
for packing
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize > layer
int index(int afeb, int tbin, int layer) const
the index into theDataFrames
static int minLayerId()
Definition: CSCDetId.h:242
int nAFEBs_
in 2007 format the max number of frames is 1860
unsigned short int NTBins() const
Definition: CSCALCTHeader.h:42
unsigned short int sizeInWords() const override
the amount of the input binary buffer read, in 16-bit words
unsigned short int BXNCount() const
Definition: CSCALCTHeader.h:61
unsigned short frame() const
static int maxLayerId()
Definition: CSCDetId.h:243
CSCAnodeData2006::CSCAnodeData2006 ( const CSCALCTHeader header,
const unsigned short *  buf 
)

fill from a real datastream

the sizes of raw words vary depending on type of the ALCT board number of layer parts for various alct board types: 1 2 3 5 6

dont memcpy if not 2006 or 2007

Definition at line 33 of file CSCAnodeData2006.cc.

References CSCALCTHeader::check(), LogTrace, nAFEBs_, nTimeBins_, sizeInWords(), and theDataFrames.

34  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) {
38  LogTrace("CSCAnodeData|CSCRawToDigi") << "nAFEBs = " << nAFEBs_ << " nTimeBins = " << nTimeBins_
39  << " nFrames = " << sizeInWords();
40  LogTrace("CSCAnodeData|CSCRawToDigi") << header << " HEADER CHECK " << header.check();
41 
42  memcpy(theDataFrames, buf, sizeInWords() * 2);
43 }
unsigned short theDataFrames[2700]
we don&#39;t know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
unsigned short int nLCTChipRead() const
for packing
bool check() const
#define LogTrace(id)
int nAFEBs_
in 2007 format the max number of frames is 1860
unsigned short int NTBins() const
Definition: CSCALCTHeader.h:42
unsigned short int sizeInWords() const override
the amount of the input binary buffer read, in 16-bit words

Member Function Documentation

void CSCAnodeData2006::add ( const CSCWireDigi digi,
int  layer 
)
overridevirtual

Implements CSCAnodeDataFormat.

Definition at line 77 of file CSCAnodeData2006.cc.

References addHit(), CSCWireDigi::getBeamCrossingTag(), CSCWireDigi::getWireGroup(), LogTrace, nAFEBs_, and nTimeBins_.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), SequenceTypes.Task::replace(), and selfTest().

77  {
78  int wireGroup = digi.getWireGroup();
79  int bxn = digi.getBeamCrossingTag();
80  int alctBoard = (wireGroup - 1) / 16;
81  int localGroup = (wireGroup - 1) % 16;
82 
83  // crash if there's a bad wire number, but don't freak out
84  // if a time bin is out of range
85  // assert(alctBoard < nAFEBs_);
86  if (alctBoard > nAFEBs_) {
87  edm::LogError("CSCAnodeData|CSCRawToDigi") << "Bad Wire Number for this digi.";
88  return;
89  }
90  if (bxn >= 0 && bxn < nTimeBins_) {
91  // 12 16-bit words per time bin, two per layer
92  // wiregroups 0-7 go on the first line, 8-15 go on the 2nd.
93  unsigned halfLayer = (localGroup > 7);
94  unsigned bitNumber = localGroup % 8;
95  // and pack it in the 8 bits allocated
96  addHit(alctBoard, bxn, layer, halfLayer, bitNumber);
97  } else {
98  LogTrace("CSCAnodeData|CSCRawToDigi") << "warning: not saving anode data in bx " << bxn << ": out of range ";
99  }
100 }
Log< level::Error, false > LogError
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize > layer
int getBeamCrossingTag() const
return tbin number, (obsolete, use getTimeBin() instead)
Definition: CSCWireDigi.cc:33
int getWireGroup() const
default
Definition: CSCWireDigi.h:22
int nAFEBs_
in 2007 format the max number of frames is 1860
void addHit(int afeb, int tbin, int layer, int halfLayer, unsigned wireBit)
void CSCAnodeData2006::addHit ( int  afeb,
int  tbin,
int  layer,
int  halfLayer,
unsigned  wireBit 
)
private

Definition at line 102 of file CSCAnodeData2006.cc.

References CSCAnodeDataFrame2006::addHit(), CSCAnodeDataFrame2006::frame(), mps_fire::i, index(), and theDataFrames.

Referenced by add().

102  {
103  int i = index(afeb, tbin, layer) + halfLayer;
105  frame.addHit(wireBit);
106  theDataFrames[i] = frame.frame();
107 }
unsigned short theDataFrames[2700]
we don&#39;t know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
constexpr std::array< uint8_t, layerIndexSize > layer
int index(int afeb, int tbin, int layer) const
the index into theDataFrames
unsigned short* CSCAnodeData2006::data ( )
inlineoverridevirtual

Implements CSCAnodeDataFormat.

Definition at line 46 of file CSCAnodeData2006.h.

References theDataFrames.

46 { return theDataFrames; }
unsigned short theDataFrames[2700]
we don&#39;t know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
int CSCAnodeData2006::index ( int  afeb,
int  tbin,
int  layer 
) const
private

the index into theDataFrames

Definition at line 113 of file CSCAnodeData2006.cc.

References cms::cuda::assert(), nTimeBins_, mps_fire::result, and sizeInWords().

Referenced by BeautifulSoup.PageElement::_invert(), addHit(), CSCAnodeData2006(), and rawHit().

113  {
114  int result = (layer - 1) * 2 + 12 * tbin + afeb * 12 * nTimeBins_;
115  assert(result < sizeInWords());
116  return result;
117 }
assert(be >=bs)
constexpr std::array< uint8_t, layerIndexSize > layer
tuple result
Definition: mps_fire.py:311
unsigned short int sizeInWords() const override
the amount of the input binary buffer read, in 16-bit words
void CSCAnodeData2006::init ( )
private
CSCAnodeDataFrame2006 CSCAnodeData2006::rawHit ( int  afeb,
int  tbin,
int  layer,
int  halfLayer 
) const
private

Definition at line 109 of file CSCAnodeData2006.cc.

References index(), and theDataFrames.

Referenced by wireDigis().

109  {
110  return CSCAnodeDataFrame2006(theDataFrames[index(afeb, tbin, layer) + halfLayer]);
111 }
unsigned short theDataFrames[2700]
we don&#39;t know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
constexpr std::array< uint8_t, layerIndexSize > layer
int index(int afeb, int tbin, int layer) const
the index into theDataFrames
void CSCAnodeData2006::selfTest ( )
static

Definition at line 120 of file CSCAnodeData2006.cc.

References add(), CSCAnodeDataFrame2006::addHit(), cms::cuda::assert(), CSCAnodeDataFrame2006::chip(), CSCAnodeDataFrame2006::data(), CSCAnodeDataFrame2006::isHit(), CSCAnodeDataFrame2006::tbin(), and wireDigis().

120  {
121  CSCAnodeDataFrame2006 frame(2, 15, 32);
122  assert(frame.chip() == 2);
123  assert(frame.tbin() == 15);
124  assert(frame.data() == 32);
125  assert(frame.isHit(5));
126  assert(!frame.isHit(7));
127  frame.addHit(7);
128  assert(frame.isHit(7));
129 
130  CSCWireDigi wireDigi(10, (1 << 4));
131  CSCALCTHeader header(7);
132  CSCAnodeData2006 anodeData(header);
133  anodeData.add(wireDigi, 1);
134  anodeData.add(wireDigi, 6);
135 
136  std::vector<CSCWireDigi> wires1 = anodeData.wireDigis(1);
137  std::vector<CSCWireDigi> wires6 = anodeData.wireDigis(6);
138 
139  assert(wires1.size() == 1);
140  assert(wires6.size() == 1);
141  assert(wires1[0].getWireGroup() == 10);
142  assert(wires6[0].getWireGroup() == 10);
143 }
assert(be >=bs)
unsigned short int CSCAnodeData2006::sizeInWords ( ) const
inlineoverridevirtual

the amount of the input binary buffer read, in 16-bit words

Implements CSCAnodeDataFormat.

Definition at line 48 of file CSCAnodeData2006.h.

References nAFEBs_, and nTimeBins_.

Referenced by CSCAnodeData2006(), and index().

48 { return nAFEBs_ * nTimeBins_ * 6 * 2; }
int nAFEBs_
in 2007 format the max number of frames is 1860
std::vector< CSCWireDigi > CSCAnodeData2006::wireDigis ( int  layer) const
overridevirtual

input layer is from 1 to 6

Implements CSCAnodeDataFormat.

Definition at line 45 of file CSCAnodeData2006.cc.

References alctBX_, CSCAnodeDataFrame2006::data(), CSCAnodeDataFrame2006::isHit(), dqmiolumiharvest::j, LogTrace, nAFEBs_, nTimeBins_, and rawHit().

Referenced by selfTest().

45  {
46  std::vector<CSCWireDigi> digis;
47  uint32_t tbinbits = 0;
48  uint16_t wireGroup = 0;
49  for (int afeb = 0; afeb < nAFEBs_; ++afeb) {
50  for (int halfLayer = 0; halfLayer < 2; ++halfLayer) {
51  for (int j = 0; j < 8; ++j) {
52  for (int tbin = 0; tbin < nTimeBins_; ++tbin) {
53  CSCAnodeDataFrame2006 frame(rawHit(afeb, tbin, layer, halfLayer));
54  // see if there's anything in 1st 8 bits. Usually zero
55  if (frame.data() != 0) {
56  if (frame.isHit(j)) {
57  tbinbits = tbinbits + (1 << tbin);
58  }
59  }
60  } //end of tbin loop
61  if (tbinbits != 0) {
62  wireGroup = (afeb * 16 + halfLayer * 8 + j) + 1;
63  uint32_t wireGroupBX = alctBX_;
64  wireGroup = wireGroup | (wireGroupBX << 16);
65  CSCWireDigi digi(wireGroup, tbinbits);
66  LogTrace("CSCAnodeData|CSCRawToDigi") << "Layer " << layer << " " << digi;
67  digis.push_back(digi);
68  tbinbits = 0;
69  }
70  }
71  }
72  }
73 
74  return digis;
75 }
CSCAnodeDataFrame2006 rawHit(int afeb, int tbin, int layer, int halfLayer) const
unsigned int alctBX_
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize > layer
int nAFEBs_
in 2007 format the max number of frames is 1860

Member Data Documentation

unsigned int CSCAnodeData2006::alctBX_
private

Definition at line 72 of file CSCAnodeData2006.h.

Referenced by CSCAnodeData2006(), and wireDigis().

int CSCAnodeData2006::nAFEBs_
private

in 2007 format the max number of frames is 1860

Definition at line 70 of file CSCAnodeData2006.h.

Referenced by add(), CSCAnodeData2006(), sizeInWords(), and wireDigis().

int CSCAnodeData2006::nTimeBins_
private

Definition at line 71 of file CSCAnodeData2006.h.

Referenced by add(), CSCAnodeData2006(), index(), sizeInWords(), and wireDigis().

unsigned short CSCAnodeData2006::theDataFrames[2700]
private

we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2

Definition at line 68 of file CSCAnodeData2006.h.

Referenced by addHit(), CSCAnodeData2006(), data(), and rawHit().