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 Member Functions | Private Attributes
CSCAnodeData2006 Class Reference

#include <CSCAnodeData2006.h>

Inheritance diagram for CSCAnodeData2006:
CSCAnodeDataFormat

Public Member Functions

virtual void add (const CSCWireDigi &, int layer)
 
 CSCAnodeData2006 (const CSCALCTHeader &)
 a blank one, for Monte Carlo More...
 
 CSCAnodeData2006 (const CSCALCTHeader &, const unsigned short *buf)
 fill from a real datastream More...
 
virtual unsigned short * data ()
 
virtual unsigned short int sizeInWords () const
 the amount of the input binary buffer read, in 16-bit words More...
 
virtual std::vector< CSCWireDigiwireDigis (int layer) const
 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 44 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 18 of file CSCAnodeData2006.cc.

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

19  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins())
20 {
21  LogTrace ("CSCAnodeData|CSCRawToDigi") << "Making Anode data "
22  << sizeInWords() << " AFEB " << nAFEBs_
23  << " TBINS " << nTimeBins_;
24  bzero(theDataFrames, sizeInWords()*2);
25  for(int afeb = 0; afeb < nAFEBs_; ++afeb) {
26  for(int tbin = 0; tbin < nTimeBins_; ++tbin) {
27  for(int layer = 1; layer <= 6; ++layer) {
28  for(int halfLayer = 0; halfLayer < 2; ++halfLayer) {
29  theDataFrames[index(afeb, tbin, layer)+halfLayer] = CSCAnodeDataFrame2006(afeb, tbin, 0).frame();
30  }
31  }
32  }
33  }
35  alctBX_= header.BXNCount();
36 }
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
virtual unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
#define LogTrace(id)
int index(int afeb, int tbin, int layer) const
the index into theDataFrames
int nAFEBs_
in 2007 format the max number of frames is 1860
unsigned short int NTBins() const
Definition: CSCALCTHeader.h:39
unsigned short int BXNCount() const
Definition: CSCALCTHeader.h:55
unsigned short frame() const
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 39 of file CSCAnodeData2006.cc.

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

41  : nAFEBs_(header.nLCTChipRead()),
42  nTimeBins_(header.NTBins())
43 {
44 
48  LogTrace ("CSCAnodeData|CSCRawToDigi") << "nAFEBs = " << nAFEBs_ << " nTimeBins = "
49  << nTimeBins_ << " nFrames = " << sizeInWords();
50  LogTrace ("CSCAnodeData|CSCRawToDigi") << header << " HEADER CHECK " << header.check();
51 
52  memcpy(theDataFrames, buf, sizeInWords()*2);
53 }
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
virtual unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
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:39

Member Function Documentation

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

Implements CSCAnodeDataFormat.

Definition at line 90 of file CSCAnodeData2006.cc.

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

Referenced by selfTest().

91 {
92 
93  int wireGroup = digi.getWireGroup();
94  int bxn=digi.getBeamCrossingTag();
95  int alctBoard = (wireGroup-1) / 16;
96  int localGroup = (wireGroup-1) % 16;
97 
98  // crash if there's a bad wire number, but don't freak out
99  // if a time bin is out of range
100  // assert(alctBoard < nAFEBs_);
101  if(alctBoard > nAFEBs_)
102  {
103  edm::LogError("CSCAnodeData|CSCRawToDigi") << "Bad Wire Number for this digi.";
104  return;
105  }
106  if(bxn >= 0 && bxn < nTimeBins_)
107  {
108  // 12 16-bit words per time bin, two per layer
109  // wiregroups 0-7 go on the first line, 8-15 go on the 2nd.
110  unsigned halfLayer = (localGroup > 7);
111  unsigned bitNumber = localGroup % 8;
112  // and pack it in the 8 bits allocated
113  addHit(alctBoard, bxn, layer, halfLayer, bitNumber);
114  }
115  else
116  {
117  LogTrace("CSCAnodeData|CSCRawToDigi")<< "warning: not saving anode data in bx " << bxn
118  << ": out of range ";
119  }
120 }
int getBeamCrossingTag() const
return tbin number, (obsolete, use getTimeBin() instead)
Definition: CSCWireDigi.cc:33
#define LogTrace(id)
int getWireGroup() const
default
Definition: CSCWireDigi.h:24
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 123 of file CSCAnodeData2006.cc.

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

Referenced by add().

124 {
125  int i = index(afeb,tbin,layer) + halfLayer;
127  frame.addHit(wireBit);
128  theDataFrames[i] = frame.frame();
129 }
int i
Definition: DBlmapReader.cc:9
unsigned short theDataFrames[2700]
we don&#39;t know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
int index(int afeb, int tbin, int layer) const
the index into theDataFrames
virtual unsigned short* CSCAnodeData2006::data ( )
inlinevirtual

Implements CSCAnodeDataFormat.

Definition at line 52 of file CSCAnodeData2006.h.

References theDataFrames.

Referenced by cuy.FindIssue::__init__().

52 {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 138 of file CSCAnodeData2006.cc.

References nTimeBins_, query::result, and sizeInWords().

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

138  {
139  int result = (layer-1)*2 + 12*tbin + afeb*12*nTimeBins_;
140  assert(result < sizeInWords());
141  return result;
142 }
virtual unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
tuple result
Definition: query.py:137
void CSCAnodeData2006::init ( )
private
CSCAnodeDataFrame2006 CSCAnodeData2006::rawHit ( int  afeb,
int  tbin,
int  layer,
int  halfLayer 
) const
private

Definition at line 132 of file CSCAnodeData2006.cc.

References index(), and theDataFrames.

Referenced by wireDigis().

133 {
134  return CSCAnodeDataFrame2006(theDataFrames[index(afeb, tbin, layer)+halfLayer]);
135 }
unsigned short theDataFrames[2700]
we don&#39;t know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
int index(int afeb, int tbin, int layer) const
the index into theDataFrames
void CSCAnodeData2006::selfTest ( )
static

Definition at line 145 of file CSCAnodeData2006.cc.

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

146 {
147  CSCAnodeDataFrame2006 frame(2, 15, 32);
148  assert(frame.chip() == 2);
149  assert(frame.tbin() == 15);
150  assert(frame.data() == 32);
151  assert(frame.isHit(5));
152  assert(!frame.isHit(7));
153  frame.addHit(7);
154  assert(frame.isHit(7));
155 
156  CSCWireDigi wireDigi(10, (1 << 4));
157  CSCALCTHeader header(7);
158  CSCAnodeData2006 anodeData(header);
159  anodeData.add(wireDigi, 1);
160  anodeData.add(wireDigi, 6);
161 
162  std::vector<CSCWireDigi> wires1 = anodeData.wireDigis(1);
163  std::vector<CSCWireDigi> wires6 = anodeData.wireDigis(6);
164 
165  assert(wires1.size() == 1);
166  assert(wires6.size() == 1);
167  assert(wires1[0].getWireGroup() == 10);
168  assert(wires6[0].getWireGroup() == 10);
169 }
virtual unsigned short int CSCAnodeData2006::sizeInWords ( ) const
inlinevirtual

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

Implements CSCAnodeDataFormat.

Definition at line 54 of file CSCAnodeData2006.h.

References nAFEBs_, and nTimeBins_.

Referenced by CSCAnodeData2006(), and index().

54 {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
virtual

input layer is from 1 to 6

Implements CSCAnodeDataFormat.

Definition at line 56 of file CSCAnodeData2006.cc.

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

Referenced by selfTest().

56  {
57  std::vector<CSCWireDigi> digis;
58  uint32_t tbinbits=0;
59  uint16_t wireGroup=0;
60  for(int afeb = 0; afeb < nAFEBs_; ++afeb) {
61  for(int halfLayer = 0; halfLayer <2; ++halfLayer) {
62  for (int j=0;j<8;++j) {
63  for(int tbin = 0; tbin < nTimeBins_; ++tbin) {
64  CSCAnodeDataFrame2006 frame(rawHit(afeb,tbin,layer, halfLayer));
65  // see if there's anything in 1st 8 bits. Usually zero
66  if(frame.data() != 0) {
67  if(frame.isHit(j)) {
68  tbinbits=tbinbits + (1<<tbin);
69  }
70  }
71  }//end of tbin loop
72  if (tbinbits !=0 ) {
73  wireGroup = (afeb*16+halfLayer*8+j)+1;
74  uint32_t wireGroupBX=alctBX_;
75  wireGroup = wireGroup | (wireGroupBX << 16);
76  CSCWireDigi digi(wireGroup, tbinbits);
77  if (debug)
78  LogTrace ("CSCAnodeData|CSCRawToDigi") << "Layer " << layer << " " << digi;
79  digis.push_back(digi);
80  tbinbits=0;
81  }
82  }
83  }
84  }
85 
86  return digis;
87 }
CSCAnodeDataFrame2006 rawHit(int afeb, int tbin, int layer, int halfLayer) const
unsigned int alctBX_
int j
Definition: DBlmapReader.cc:9
#define LogTrace(id)
#define debug
Definition: HDRShower.cc:19
int nAFEBs_
in 2007 format the max number of frames is 1860

Member Data Documentation

unsigned int CSCAnodeData2006::alctBX_
private

Definition at line 78 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 76 of file CSCAnodeData2006.h.

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

int CSCAnodeData2006::nTimeBins_
private

Definition at line 77 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 74 of file CSCAnodeData2006.h.

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