13 unsigned packedChip = ( (chip&1) + 2*(chip>1) );
14 theFrame = data + ((tbin&0x1F) << 8) + (packedChip<<13);
19 : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins())
21 LogTrace (
"CSCAnodeData|CSCRawToDigi") <<
"Making Anode data "
25 for(
int afeb = 0; afeb <
nAFEBs_; ++afeb) {
27 for(
int layer = 1; layer <= 6; ++layer) {
28 for(
int halfLayer = 0; halfLayer < 2; ++halfLayer) {
40 const unsigned short *buf)
41 : nAFEBs_(header.nLCTChipRead()),
42 nTimeBins_(header.NTBins())
48 LogTrace (
"CSCAnodeData|CSCRawToDigi") <<
"nAFEBs = " <<
nAFEBs_ <<
" nTimeBins = "
50 LogTrace (
"CSCAnodeData|CSCRawToDigi") << header <<
" HEADER CHECK " << header.
check();
57 std::vector<CSCWireDigi> digis;
60 for(
int afeb = 0; afeb <
nAFEBs_; ++afeb) {
61 for(
int halfLayer = 0; halfLayer <2; ++halfLayer) {
62 for (
int j=0;
j<8;++
j) {
66 if(frame.
data() != 0) {
68 tbinbits=tbinbits + (1<<tbin);
73 wireGroup = (afeb*16+halfLayer*8+
j)+1;
75 wireGroup = wireGroup | (wireGroupBX << 16);
78 LogTrace (
"CSCAnodeData|CSCRawToDigi") <<
"Layer " << layer <<
" " << digi;
79 digis.push_back(digi);
95 int alctBoard = (wireGroup-1) / 16;
96 int localGroup = (wireGroup-1) % 16;
103 edm::LogError(
"CSCAnodeData|CSCRawToDigi") <<
"Bad Wire Number for this digi.";
110 unsigned halfLayer = (localGroup > 7);
111 unsigned bitNumber = localGroup % 8;
113 addHit(alctBoard, bxn, layer, halfLayer, bitNumber);
117 LogTrace(
"CSCAnodeData|CSCRawToDigi")<<
"warning: not saving anode data in bx " << bxn
118 <<
": out of range ";
125 int i =
index(afeb,tbin,layer) + halfLayer;
159 anodeData.
add(wireDigi, 1);
160 anodeData.
add(wireDigi, 6);
162 std::vector<CSCWireDigi> wires1 = anodeData.
wireDigis(1);
163 std::vector<CSCWireDigi> wires6 = anodeData.
wireDigis(6);
165 assert(wires1.size() == 1);
166 assert(wires6.size() == 1);
167 assert(wires1[0].getWireGroup() == 10);
168 assert(wires6[0].getWireGroup() == 10);
void addHit(unsigned wireBit)
sets a bit, from 0 to 7
CSCAnodeDataFrame2006 rawHit(int afeb, int tbin, int layer, int halfLayer) const
unsigned short theDataFrames[2700]
we don't know the size at first. Max should be 7 boards * 32 bins * 6 layers * 2
virtual std::vector< CSCWireDigi > wireDigis(int layer) const
input layer is from 1 to 6
virtual unsigned short int sizeInWords() const
the amount of the input binary buffer read, in 16-bit words
int getBeamCrossingTag() const
return tbin number, (obsolete, use getTimeBin() instead)
int index(int afeb, int tbin, int layer) const
the index into theDataFrames
unsigned tbin() const
time bin
CSCAnodeData2006(const CSCALCTHeader &)
a blank one, for Monte Carlo
virtual void add(const CSCWireDigi &, int layer)
int getWireGroup() const
default
unsigned short data() const
int nAFEBs_
in 2007 format the max number of frames is 1860
char data[epos_bytes_allocation]
bool isHit(unsigned wireGroup) const
given a wiregroup between 0 and 7, it tells whether this bit was on
void addHit(int afeb, int tbin, int layer, int halfLayer, unsigned wireBit)
unsigned short frame() const