#include <CSCAnodeData2006.h>
Public Member Functions | |
virtual void | add (const CSCWireDigi &, int layer) |
CSCAnodeData2006 (const CSCALCTHeader &, const unsigned short *buf) | |
fill from a real datastream | |
CSCAnodeData2006 (const CSCALCTHeader &) | |
a blank one, for Monte Carlo | |
virtual unsigned short * | data () |
virtual unsigned short int | sizeInWords () const |
the amount of the input binary buffer read, in 16-bit words | |
virtual std::vector< CSCWireDigi > | wireDigis (int layer) const |
input layer is from 1 to 6 | |
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 | |
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 | |
int | nTimeBins_ |
unsigned short | theDataFrames [2700] |
we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2 |
Definition at line 44 of file CSCAnodeData2006.h.
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.
: nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) { LogTrace ("CSCAnodeData|CSCRawToDigi") << "Making Anode data " << sizeInWords() << " AFEB " << nAFEBs_ << " TBINS " << nTimeBins_; bzero(theDataFrames, sizeInWords()*2); for(int afeb = 0; afeb < nAFEBs_; ++afeb) { for(int tbin = 0; tbin < nTimeBins_; ++tbin) { for(int layer = 1; layer <= 6; ++layer) { for(int halfLayer = 0; halfLayer < 2; ++halfLayer) { theDataFrames[index(afeb, tbin, layer)+halfLayer] = CSCAnodeDataFrame2006(afeb, tbin, 0).frame(); } } } } alctBX_= header.BXNCount(); }
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.
: nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins()) { LogTrace ("CSCAnodeData|CSCRawToDigi") << "nAFEBs = " << nAFEBs_ << " nTimeBins = " << nTimeBins_ << " nFrames = " << sizeInWords(); LogTrace ("CSCAnodeData|CSCRawToDigi") << header << " HEADER CHECK " << header.check(); memcpy(theDataFrames, buf, sizeInWords()*2); }
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().
{ int wireGroup = digi.getWireGroup(); int bxn=digi.getBeamCrossingTag(); int alctBoard = (wireGroup-1) / 16; int localGroup = (wireGroup-1) % 16; // crash if there's a bad wire number, but don't freak out // if a time bin is out of range // assert(alctBoard < nAFEBs_); if(alctBoard > nAFEBs_) { edm::LogError("CSCAnodeData|CSCRawToDigi") << "Bad Wire Number for this digi."; return; } if(bxn >= 0 && bxn < nTimeBins_) { // 12 16-bit words per time bin, two per layer // wiregroups 0-7 go on the first line, 8-15 go on the 2nd. unsigned halfLayer = (localGroup > 7); unsigned bitNumber = localGroup % 8; // and pack it in the 8 bits allocated addHit(alctBoard, bxn, layer, halfLayer, bitNumber); } else { LogTrace("CSCAnodeData|CSCRawToDigi")<< "warning: not saving anode data in bx " << bxn << ": out of range "; } }
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().
{ int i = index(afeb,tbin,layer) + halfLayer; CSCAnodeDataFrame2006 frame(theDataFrames[i]); frame.addHit(wireBit); theDataFrames[i] = frame.frame(); }
virtual unsigned short* CSCAnodeData2006::data | ( | ) | [inline, virtual] |
Implements CSCAnodeDataFormat.
Definition at line 52 of file CSCAnodeData2006.h.
References theDataFrames.
{return theDataFrames;}
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 addHit(), CSCAnodeData2006(), and rawHit().
{ int result = (layer-1)*2 + 12*tbin + afeb*12*nTimeBins_; assert(result < sizeInWords()); return result; }
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().
{ return CSCAnodeDataFrame2006(theDataFrames[index(afeb, tbin, layer)+halfLayer]); }
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().
{ CSCAnodeDataFrame2006 frame(2, 15, 32); assert(frame.chip() == 2); assert(frame.tbin() == 15); assert(frame.data() == 32); assert(frame.isHit(5)); assert(!frame.isHit(7)); frame.addHit(7); assert(frame.isHit(7)); CSCWireDigi wireDigi(10, (1 << 4)); CSCALCTHeader header(7); CSCAnodeData2006 anodeData(header); anodeData.add(wireDigi, 1); anodeData.add(wireDigi, 6); std::vector<CSCWireDigi> wires1 = anodeData.wireDigis(1); std::vector<CSCWireDigi> wires6 = anodeData.wireDigis(6); assert(wires1.size() == 1); assert(wires6.size() == 1); assert(wires1[0].getWireGroup() == 10); assert(wires6[0].getWireGroup() == 10); }
virtual unsigned short int CSCAnodeData2006::sizeInWords | ( | ) | const [inline, virtual] |
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().
{return nAFEBs_ * nTimeBins_ * 6 * 2;}
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().
{ std::vector<CSCWireDigi> digis; uint32_t tbinbits=0; uint16_t wireGroup=0; for(int afeb = 0; afeb < nAFEBs_; ++afeb) { for(int halfLayer = 0; halfLayer <2; ++halfLayer) { for (int j=0;j<8;++j) { for(int tbin = 0; tbin < nTimeBins_; ++tbin) { CSCAnodeDataFrame2006 frame(rawHit(afeb,tbin,layer, halfLayer)); // see if there's anything in 1st 8 bits. Usually zero if(frame.data() != 0) { if(frame.isHit(j)) { tbinbits=tbinbits + (1<<tbin); } } }//end of tbin loop if (tbinbits !=0 ) { wireGroup = (afeb*16+halfLayer*8+j)+1; uint32_t wireGroupBX=alctBX_; wireGroup = wireGroup | (wireGroupBX << 16); CSCWireDigi digi(wireGroup, tbinbits); if (debug) LogTrace ("CSCAnodeData|CSCRawToDigi") << "Layer " << layer << " " << digi; digis.push_back(digi); tbinbits=0; } } } } return digis; }
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().