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

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

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

17  : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins())
18 {
19  LogTrace ("CSCAnodeData|CSCRawToDigi") << "Making Anode data "
20  << sizeInWords() << " AFEB " << nAFEBs_
21  << " TBINS " << nTimeBins_;
22  bzero(theDataFrames, sizeInWords()*2);
23  for(int afeb = 0; afeb < nAFEBs_; ++afeb) {
24  for(int tbin = 0; tbin < nTimeBins_; ++tbin) {
25  for(int layer = 1; layer <= 6; ++layer) {
26  for(int halfLayer = 0; halfLayer < 2; ++halfLayer) {
27  theDataFrames[index(afeb, tbin, layer)+halfLayer] = CSCAnodeDataFrame2006(afeb, tbin, 0).frame();
28  }
29  }
30  }
31  }
33  alctBX_= header.BXNCount();
34 }
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:42
unsigned short int BXNCount() const
Definition: CSCALCTHeader.h:61
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 37 of file CSCAnodeData2006.cc.

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

39  : nAFEBs_(header.nLCTChipRead()),
40  nTimeBins_(header.NTBins())
41 {
42 
46  LogTrace ("CSCAnodeData|CSCRawToDigi") << "nAFEBs = " << nAFEBs_ << " nTimeBins = "
47  << nTimeBins_ << " nFrames = " << sizeInWords();
48  LogTrace ("CSCAnodeData|CSCRawToDigi") << header << " HEADER CHECK " << header.check();
49 
50  memcpy(theDataFrames, buf, sizeInWords()*2);
51 }
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:42

Member Function Documentation

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

Implements CSCAnodeDataFormat.

Definition at line 87 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().

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

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

Referenced by add().

121 {
122  int i = index(afeb,tbin,layer) + halfLayer;
124  frame.addHit(wireBit);
125  theDataFrames[i] = frame.frame();
126 }
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.

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

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

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

135  {
136  int result = (layer-1)*2 + 12*tbin + afeb*12*nTimeBins_;
137  assert(result < sizeInWords());
138  return result;
139 }
virtual unsigned short int sizeInWords() const
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 129 of file CSCAnodeData2006.cc.

References index(), and theDataFrames.

Referenced by wireDigis().

130 {
131  return CSCAnodeDataFrame2006(theDataFrames[index(afeb, tbin, layer)+halfLayer]);
132 }
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 142 of file CSCAnodeData2006.cc.

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

143 {
144  CSCAnodeDataFrame2006 frame(2, 15, 32);
145  assert(frame.chip() == 2);
146  assert(frame.tbin() == 15);
147  assert(frame.data() == 32);
148  assert(frame.isHit(5));
149  assert(!frame.isHit(7));
150  frame.addHit(7);
151  assert(frame.isHit(7));
152 
153  CSCWireDigi wireDigi(10, (1 << 4));
155  CSCAnodeData2006 anodeData(header);
156  anodeData.add(wireDigi, 1);
157  anodeData.add(wireDigi, 6);
158 
159  std::vector<CSCWireDigi> wires1 = anodeData.wireDigis(1);
160  std::vector<CSCWireDigi> wires6 = anodeData.wireDigis(6);
161 
162  assert(wires1.size() == 1);
163  assert(wires6.size() == 1);
164  assert(wires1[0].getWireGroup() == 10);
165  assert(wires6[0].getWireGroup() == 10);
166 }
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 Clusterizer1DCommons::add(), CSCAnodeDataFrame2006::addHit(), diffTreeTool::index, init, and CSCAnodeDataFrame2006::tbin().

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

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

Referenced by selfTest().

54  {
55  std::vector<CSCWireDigi> digis;
56  uint32_t tbinbits=0;
57  uint16_t wireGroup=0;
58  for(int afeb = 0; afeb < nAFEBs_; ++afeb) {
59  for(int halfLayer = 0; halfLayer <2; ++halfLayer) {
60  for (int j=0;j<8;++j) {
61  for(int tbin = 0; tbin < nTimeBins_; ++tbin) {
62  CSCAnodeDataFrame2006 frame(rawHit(afeb,tbin,layer, halfLayer));
63  // see if there's anything in 1st 8 bits. Usually zero
64  if(frame.data() != 0) {
65  if(frame.isHit(j)) {
66  tbinbits=tbinbits + (1<<tbin);
67  }
68  }
69  }//end of tbin loop
70  if (tbinbits !=0 ) {
71  wireGroup = (afeb*16+halfLayer*8+j)+1;
72  uint32_t wireGroupBX=alctBX_;
73  wireGroup = wireGroup | (wireGroupBX << 16);
74  CSCWireDigi digi(wireGroup, tbinbits);
75  LogTrace ("CSCAnodeData|CSCRawToDigi") << "Layer " << layer << " " << digi;
76  digis.push_back(digi);
77  tbinbits=0;
78  }
79  }
80  }
81  }
82 
83  return digis;
84 }
CSCAnodeDataFrame2006 rawHit(int afeb, int tbin, int layer, int halfLayer) const
unsigned int alctBX_
#define LogTrace(id)
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(), and wireDigis().

int CSCAnodeData2006::nTimeBins_
private

Definition at line 77 of file CSCAnodeData2006.h.

Referenced by add(), CSCAnodeData2006(), index(), 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(), and rawHit().