CMS 3D CMS Logo

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() [1/2]

CSCAnodeData2006::CSCAnodeData2006 ( const CSCALCTHeader header)

a blank one, for Monte Carlo

for digi->raw packing

To get BX from ALCT digis

Definition at line 13 of file CSCAnodeData2006.cc.

14  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) {
15  LogTrace("CSCAnodeData|CSCRawToDigi") << "Making Anode data " << sizeInWords() << " AFEB " << nAFEBs_ << " TBINS "
16  << nTimeBins_;
17  bzero(theDataFrames, sizeInWords() * 2);
18  for (int afeb = 0; afeb < nAFEBs_; ++afeb) {
19  for (int tbin = 0; tbin < nTimeBins_; ++tbin) {
20  for (int layer = 1; layer <= 6; ++layer) {
21  for (int halfLayer = 0; halfLayer < 2; ++halfLayer) {
22  theDataFrames[index(afeb, tbin, layer) + halfLayer] = CSCAnodeDataFrame2006(afeb, tbin, 0).frame();
23  }
24  }
25  }
26  }
28  alctBX_ = header.BXNCount();
29 }

References alctBX_, CSCAnodeDataFrame2006::frame(), RecoTauValidation_cfi::header, index(), LogTrace, nAFEBs_, nTimeBins_, sizeInWords(), and theDataFrames.

◆ CSCAnodeData2006() [2/2]

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 32 of file CSCAnodeData2006.cc.

33  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) {
37  LogTrace("CSCAnodeData|CSCRawToDigi") << "nAFEBs = " << nAFEBs_ << " nTimeBins = " << nTimeBins_
38  << " nFrames = " << sizeInWords();
39  LogTrace("CSCAnodeData|CSCRawToDigi") << header << " HEADER CHECK " << header.check();
40 
41  memcpy(theDataFrames, buf, sizeInWords() * 2);
42 }

References visDQMUpload::buf, RecoTauValidation_cfi::header, LogTrace, nAFEBs_, nTimeBins_, sizeInWords(), and theDataFrames.

Member Function Documentation

◆ add()

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

Implements CSCAnodeDataFormat.

Definition at line 76 of file CSCAnodeData2006.cc.

76  {
77  int wireGroup = digi.getWireGroup();
78  int bxn = digi.getBeamCrossingTag();
79  int alctBoard = (wireGroup - 1) / 16;
80  int localGroup = (wireGroup - 1) % 16;
81 
82  // crash if there's a bad wire number, but don't freak out
83  // if a time bin is out of range
84  // assert(alctBoard < nAFEBs_);
85  if (alctBoard > nAFEBs_) {
86  edm::LogError("CSCAnodeData|CSCRawToDigi") << "Bad Wire Number for this digi.";
87  return;
88  }
89  if (bxn >= 0 && bxn < nTimeBins_) {
90  // 12 16-bit words per time bin, two per layer
91  // wiregroups 0-7 go on the first line, 8-15 go on the 2nd.
92  unsigned halfLayer = (localGroup > 7);
93  unsigned bitNumber = localGroup % 8;
94  // and pack it in the 8 bits allocated
95  addHit(alctBoard, bxn, layer, halfLayer, bitNumber);
96  } else {
97  LogTrace("CSCAnodeData|CSCRawToDigi") << "warning: not saving anode data in bx " << bxn << ": out of range ";
98  }
99 }

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

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

◆ addHit()

void CSCAnodeData2006::addHit ( int  afeb,
int  tbin,
int  layer,
int  halfLayer,
unsigned  wireBit 
)
private

Definition at line 101 of file CSCAnodeData2006.cc.

101  {
102  int i = index(afeb, tbin, layer) + halfLayer;
104  frame.addHit(wireBit);
105  theDataFrames[i] = frame.frame();
106 }

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

Referenced by add().

◆ data()

unsigned short* CSCAnodeData2006::data ( )
inlineoverridevirtual

Implements CSCAnodeDataFormat.

Definition at line 46 of file CSCAnodeData2006.h.

46 { return theDataFrames; }

References theDataFrames.

◆ index()

int CSCAnodeData2006::index ( int  afeb,
int  tbin,
int  layer 
) const
private

the index into theDataFrames

Definition at line 112 of file CSCAnodeData2006.cc.

112  {
113  int result = (layer - 1) * 2 + 12 * tbin + afeb * 12 * nTimeBins_;
115  return result;
116 }

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

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

◆ init()

void CSCAnodeData2006::init ( )
private

◆ rawHit()

CSCAnodeDataFrame2006 CSCAnodeData2006::rawHit ( int  afeb,
int  tbin,
int  layer,
int  halfLayer 
) const
private

Definition at line 108 of file CSCAnodeData2006.cc.

108  {
109  return CSCAnodeDataFrame2006(theDataFrames[index(afeb, tbin, layer) + halfLayer]);
110 }

References index(), and theDataFrames.

Referenced by wireDigis().

◆ selfTest()

void CSCAnodeData2006::selfTest ( )
static

Definition at line 119 of file CSCAnodeData2006.cc.

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

References add(), cms::cuda::assert(), amptDefault_cfi::frame, RecoTauValidation_cfi::header, and wireDigis().

◆ sizeInWords()

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.

48 { return nAFEBs_ * nTimeBins_ * 6 * 2; }

References nAFEBs_, and nTimeBins_.

Referenced by CSCAnodeData2006(), and index().

◆ wireDigis()

std::vector< CSCWireDigi > CSCAnodeData2006::wireDigis ( int  layer) const
overridevirtual

input layer is from 1 to 6

Implements CSCAnodeDataFormat.

Definition at line 44 of file CSCAnodeData2006.cc.

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

References alctBX_, amptDefault_cfi::frame, dqmiolumiharvest::j, LogTrace, nAFEBs_, nTimeBins_, and rawHit().

Referenced by selfTest().

Member Data Documentation

◆ alctBX_

unsigned int CSCAnodeData2006::alctBX_
private

Definition at line 72 of file CSCAnodeData2006.h.

Referenced by CSCAnodeData2006(), and wireDigis().

◆ nAFEBs_

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().

◆ nTimeBins_

int CSCAnodeData2006::nTimeBins_
private

Definition at line 71 of file CSCAnodeData2006.h.

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

◆ theDataFrames

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().

mps_fire.i
i
Definition: mps_fire.py:428
CSCWireDigi::getWireGroup
int getWireGroup() const
default
Definition: CSCWireDigi.h:22
cms::cuda::assert
assert(be >=bs)
CSCAnodeData2006::addHit
void addHit(int afeb, int tbin, int layer, int halfLayer, unsigned wireBit)
Definition: CSCAnodeData2006.cc:101
CSCALCTHeader
Definition: CSCALCTHeader.h:21
CSCAnodeData2006::nAFEBs_
int nAFEBs_
in 2007 format the max number of frames is 1860
Definition: CSCAnodeData2006.h:70
CSCAnodeDataFrame2006
Definition: CSCAnodeData2006.h:8
CSCAnodeData2006::theDataFrames
unsigned short theDataFrames[2700]
we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
Definition: CSCAnodeData2006.h:68
CSCAnodeData2006::sizeInWords
unsigned short int sizeInWords() const override
the amount of the input binary buffer read, in 16-bit words
Definition: CSCAnodeData2006.h:48
CSCAnodeData2006::index
int index(int afeb, int tbin, int layer) const
the index into theDataFrames
Definition: CSCAnodeData2006.cc:112
CSCWireDigi
Definition: CSCWireDigi.h:14
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCAnodeData2006::alctBX_
unsigned int alctBX_
Definition: CSCAnodeData2006.h:72
CSCAnodeData2006::nTimeBins_
int nTimeBins_
Definition: CSCAnodeData2006.h:71
CSCAnodeData2006
Definition: CSCAnodeData2006.h:39
CSCAnodeData2006::rawHit
CSCAnodeDataFrame2006 rawHit(int afeb, int tbin, int layer, int halfLayer) const
Definition: CSCAnodeData2006.cc:108
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
CSCAnodeDataFrame2006::frame
unsigned short frame() const
Definition: CSCAnodeData2006.h:29
CSCWireDigi::getBeamCrossingTag
int getBeamCrossingTag() const
return tbin number, (obsolete, use getTimeBin() instead)
Definition: CSCWireDigi.cc:33
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
L1TBPTX_cfi.bitNumber
bitNumber
Definition: L1TBPTX_cfi.py:26
mps_fire.result
result
Definition: mps_fire.py:311
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66