CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
CSCAnodeData2007 Class Reference

#include <CSCAnodeData2007.h>

Inheritance diagram for CSCAnodeData2007:
CSCAnodeDataFormat

Public Member Functions

void add (const CSCWireDigi &, int layer) override
 
 CSCAnodeData2007 (const CSCALCTHeader &)
 a blank one, for Monte Carlo More...
 
 CSCAnodeData2007 (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 Types

enum  { MAXFRAMES = 2700 }
 we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2 More...
 

Private Member Functions

CSCAnodeDataFrame2007 findFrame (int tbin, int layer, int layerPart) const
 
int index (int tbin, int layer, int layerPart) const
 
void init (const CSCALCTHeader &)
 

Private Attributes

unsigned int alctBX_
 number of wiregroups in the ALCT More...
 
unsigned short int layerParts_
 
unsigned short int maxWireGroups_
 number of layer parts in the ALCT More...
 
unsigned short int nAFEBs_
 
unsigned short int nTimeBins_
 
unsigned short int sizeInWords2007_
 
unsigned short theDataFrames [MAXFRAMES]
 

Detailed Description

Definition at line 30 of file CSCAnodeData2007.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

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

Enumerator
MAXFRAMES 

Definition at line 54 of file CSCAnodeData2007.h.

Constructor & Destructor Documentation

◆ CSCAnodeData2007() [1/2]

CSCAnodeData2007::CSCAnodeData2007 ( const CSCALCTHeader header)
explicit

a blank one, for Monte Carlo

To get BX from ALCT digis

Definition at line 8 of file CSCAnodeData2007.cc.

References alctBX_, RecoTauValidation_cfi::header, init(), sizeInWords(), and theDataFrames.

9  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) {
10  init(header);
11  bzero(theDataFrames, sizeInWords() * 2);
13  alctBX_ = header.BXNCount();
14 }
void init(const CSCALCTHeader &)
unsigned short int sizeInWords() const override
the amount of the input binary buffer read, in 16-bit words
unsigned short int nAFEBs_
unsigned int alctBX_
number of wiregroups in the ALCT
unsigned short theDataFrames[MAXFRAMES]
unsigned short int nTimeBins_

◆ CSCAnodeData2007() [2/2]

CSCAnodeData2007::CSCAnodeData2007 ( const CSCALCTHeader header,
const unsigned short *  buf 
)

fill from a real datastream

dont memcpy if not 2006 or 2007 To get BX from ALCT digis

Definition at line 16 of file CSCAnodeData2007.cc.

References alctBX_, visDQMUpload::buf, RecoTauValidation_cfi::header, init(), sizeInWords(), and theDataFrames.

17  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) {
18  init(header);
19  memcpy(theDataFrames, buf, sizeInWords() * 2);
20  alctBX_ = header.BXNCount();
22 }
void init(const CSCALCTHeader &)
unsigned short int sizeInWords() const override
the amount of the input binary buffer read, in 16-bit words
unsigned short int nAFEBs_
unsigned int alctBX_
number of wiregroups in the ALCT
unsigned short theDataFrames[MAXFRAMES]
unsigned short int nTimeBins_

Member Function Documentation

◆ add()

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

Implements CSCAnodeDataFormat.

Definition at line 84 of file CSCAnodeData2007.cc.

References findFrame(), CSCWireDigi::getTimeBinsOn(), CSCWireDigi::getWireGroup(), index(), pixelTopology::layer, layerParts_, LogTrace, nTimeBins_, and theDataFrames.

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

84  {
85  int wireGroup = digi.getWireGroup();
86  // wireGroup = (layerPart*12+j)+1;
87  unsigned layerPart = (wireGroup - 1) / 12;
88  unsigned wireInPart = (wireGroup - 1) % 12;
89 
90  std::vector<int> timeBinsOn = digi.getTimeBinsOn();
91  for (std::vector<int>::const_iterator timeBinOn = timeBinsOn.begin(); timeBinOn != timeBinsOn.end(); ++timeBinOn) {
92  // crash if there's a bad wire number, but don't freak out
93  // if a time bin is out of range
94  // assert(alctBoard < nAFEBs_);
95  if (layerPart >= layerParts_) {
96  edm::LogError("CSCAnodeData|CSCRawToDigi") << "Bad Wire Number for this digi.";
97  return;
98  }
99 
100  if ((*timeBinOn) >= 0 && (*timeBinOn) < nTimeBins_) {
101  CSCAnodeDataFrame2007 frame = findFrame(*timeBinOn, layer, layerPart);
102  frame.addHit(wireInPart);
103  // FIXME doesn't carry over the (currently 0) leading bits
104  theDataFrames[index(*timeBinOn, layer, layerPart)] = frame.data();
105  } else {
106  LogTrace("CSCAnodeData|CSCRawToDigi")
107  << "warning: not saving anode data in bx " << *timeBinOn << ": out of range ";
108  }
109  }
110 }
Log< level::Error, false > LogError
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::vector< int > getTimeBinsOn() const
return vector of time bins ON
Definition: CSCWireDigi.cc:48
CSCAnodeDataFrame2007 findFrame(int tbin, int layer, int layerPart) const
unsigned short theDataFrames[MAXFRAMES]
int index(int tbin, int layer, int layerPart) const
unsigned short int nTimeBins_
unsigned short int layerParts_
int getWireGroup() const
default
Definition: CSCWireDigi.h:22

◆ data()

unsigned short* CSCAnodeData2007::data ( )
inlineoverridevirtual

Implements CSCAnodeDataFormat.

Definition at line 37 of file CSCAnodeData2007.h.

References theDataFrames.

37 { return theDataFrames; }
unsigned short theDataFrames[MAXFRAMES]

◆ findFrame()

CSCAnodeDataFrame2007 CSCAnodeData2007::findFrame ( int  tbin,
int  layer,
int  layerPart 
) const
private

Definition at line 71 of file CSCAnodeData2007.cc.

References index(), pixelTopology::layer, and theDataFrames.

Referenced by add(), and wireDigis().

71  {
72  return CSCAnodeDataFrame2007(theDataFrames[index(tbin, layer, layerPart)]);
73 }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
unsigned short theDataFrames[MAXFRAMES]
int index(int tbin, int layer, int layerPart) const

◆ index()

int CSCAnodeData2007::index ( int  tbin,
int  layer,
int  layerPart 
) const
private

Definition at line 75 of file CSCAnodeData2007.cc.

References cms::cuda::assert(), pixelTopology::layer, layerParts_, MAXFRAMES, CSCDetId::maxLayerId(), nTimeBins_, and mps_fire::result.

Referenced by add(), and findFrame().

75  {
76  assert(tbin < nTimeBins_);
78  assert(layerPart < layerParts_);
79  int result = tbin * 6 * layerParts_ + (layer - 1) * layerParts_ + layerPart;
81  return result;
82 }
assert(be >=bs)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
static int maxLayerId()
Definition: CSCDetId.h:243
unsigned short int nTimeBins_
unsigned short int layerParts_

◆ init()

void CSCAnodeData2007::init ( const CSCALCTHeader header)
private

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

Definition at line 24 of file CSCAnodeData2007.cc.

References RecoTauValidation_cfi::header, layerParts_, maxWireGroups_, and sizeInWords2007_.

Referenced by CSCAnodeData2007().

24  {
28  static const unsigned short int layerParts[7] = {3, 3, 4, 6, 6, 8, 10};
29  static const unsigned short int wireGroups[7] = {32, 32, 48, 64, 64, 96, 112};
30  //header.ALCTDigis();
31  sizeInWords2007_ = (1 - header.alctHeader2007().rawOverflow) * 6 * header.alctHeader2007().rawBins *
32  layerParts[header.alctHeader2007().boardType];
33  layerParts_ = layerParts[header.alctHeader2007().boardType];
34  maxWireGroups_ = wireGroups[header.alctHeader2007().boardType];
35 }
unsigned short int sizeInWords2007_
unsigned short int maxWireGroups_
number of layer parts in the ALCT
unsigned short int layerParts_

◆ selfTest()

void CSCAnodeData2007::selfTest ( )
static

Definition at line 112 of file CSCAnodeData2007.cc.

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

112  {
113  int wireGroup = 12;
114  int timeBin = 6;
115  CSCWireDigi wireDigi(wireGroup, (1 << timeBin));
117  CSCAnodeData2007 anodeData(header);
118  anodeData.add(wireDigi, 1);
119  anodeData.add(wireDigi, 6);
120 
121  std::vector<CSCWireDigi> wires1 = anodeData.wireDigis(1);
122  std::vector<CSCWireDigi> wires6 = anodeData.wireDigis(6);
123 
124  assert(wires1.size() == 1);
125  assert(wires6.size() == 1);
126  assert(wires1[0].getWireGroup() == wireGroup);
127  assert(wires6[0].getWireGroup() == wireGroup);
128  assert(wires1[0].getTimeBin() == timeBin);
129  assert(wires6[0].getTimeBin() == timeBin);
130 }
assert(be >=bs)

◆ sizeInWords()

unsigned short int CSCAnodeData2007::sizeInWords ( ) const
inlineoverridevirtual

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

Implements CSCAnodeDataFormat.

Definition at line 39 of file CSCAnodeData2007.h.

References sizeInWords2007_.

Referenced by CSCAnodeData2007().

39 { return sizeInWords2007_; }
unsigned short int sizeInWords2007_

◆ wireDigis()

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

input layer is from 1 to 6

BX from ACT (first component)

we know how many layer parts are there from ALCT header

loop over 12 bits in each word (each bit is one wiregroup) we want to stop if we reached the maxWireGroups



loop over tbins

BX from ALCT encoded in wireGroup

end of the loop over bits in the data frame

end of the loop over layer parts

Implements CSCAnodeDataFormat.

Definition at line 37 of file CSCAnodeData2007.cc.

References alctBX_, findFrame(), dqmiolumiharvest::j, pixelTopology::layer, layerParts_, LogTrace, maxWireGroups_, and nTimeBins_.

Referenced by selfTest().

37  {
38  std::vector<CSCWireDigi> digis;
39  uint32_t tbinbits = 0;
40  uint32_t wireGroup = 0;
42  for (int layerPart = 0; layerPart < layerParts_; ++layerPart) {
44  for (int j = 0; (j < 12) && ((layerPart * 12 + j) < maxWireGroups_); ++j) {
47  for (int tbin = 0; tbin < nTimeBins_; ++tbin) {
48  CSCAnodeDataFrame2007 frame = findFrame(tbin, layer, layerPart);
49  if (frame.data() != 0) {
50  if (frame.isHit(j)) {
51  tbinbits = tbinbits + (1 << tbin);
52  }
53  }
54  } //end of tbin loop
55  if (tbinbits != 0) {
56  wireGroup = (layerPart * 12 + j) + 1;
58  uint32_t wireGroupBX = alctBX_;
59  wireGroup = wireGroup | (wireGroupBX << 16);
60  CSCWireDigi digi(wireGroup, tbinbits);
61  LogTrace("CSCAnodeData|CSCRawToDigi") << "Layer " << layer << " " << digi;
62  digis.push_back(digi);
63  tbinbits = 0;
64  }
65  }
66  }
67 
68  return digis;
69 }
#define LogTrace(id)
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
CSCAnodeDataFrame2007 findFrame(int tbin, int layer, int layerPart) const
unsigned int alctBX_
number of wiregroups in the ALCT
unsigned short int maxWireGroups_
number of layer parts in the ALCT
unsigned short int nTimeBins_
unsigned short int layerParts_

Member Data Documentation

◆ alctBX_

unsigned int CSCAnodeData2007::alctBX_
private

number of wiregroups in the ALCT

Definition at line 62 of file CSCAnodeData2007.h.

Referenced by CSCAnodeData2007(), and wireDigis().

◆ layerParts_

unsigned short int CSCAnodeData2007::layerParts_
private

Definition at line 60 of file CSCAnodeData2007.h.

Referenced by add(), index(), init(), and wireDigis().

◆ maxWireGroups_

unsigned short int CSCAnodeData2007::maxWireGroups_
private

number of layer parts in the ALCT

Definition at line 61 of file CSCAnodeData2007.h.

Referenced by init(), and wireDigis().

◆ nAFEBs_

unsigned short int CSCAnodeData2007::nAFEBs_
private

Definition at line 57 of file CSCAnodeData2007.h.

◆ nTimeBins_

unsigned short int CSCAnodeData2007::nTimeBins_
private

Definition at line 58 of file CSCAnodeData2007.h.

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

◆ sizeInWords2007_

unsigned short int CSCAnodeData2007::sizeInWords2007_
private

Definition at line 56 of file CSCAnodeData2007.h.

Referenced by init(), and sizeInWords().

◆ theDataFrames

unsigned short CSCAnodeData2007::theDataFrames[MAXFRAMES]
private

Definition at line 55 of file CSCAnodeData2007.h.

Referenced by add(), CSCAnodeData2007(), data(), and findFrame().