11 unsigned packedChip = ( (chip&1) + 2*(chip>1) );
12 theFrame = data + ((tbin&0x1F) << 8) + (packedChip<<13);
17 : nAFEBs_(header.nLCTChipRead()), nTimeBins_(header.NTBins())
19 LogTrace (
"CSCAnodeData|CSCRawToDigi") <<
"Making Anode data " 23 for(
int afeb = 0; afeb <
nAFEBs_; ++afeb) {
25 for(
int layer = 1; layer <= 6; ++layer) {
26 for(
int halfLayer = 0; halfLayer < 2; ++halfLayer) {
38 const unsigned short *buf)
39 :
nAFEBs_(header.nLCTChipRead()),
46 LogTrace (
"CSCAnodeData|CSCRawToDigi") <<
"nAFEBs = " <<
nAFEBs_ <<
" nTimeBins = " 48 LogTrace (
"CSCAnodeData|CSCRawToDigi") << header <<
" HEADER CHECK " << header.
check();
55 std::vector<CSCWireDigi> digis;
58 for(
int afeb = 0; afeb <
nAFEBs_; ++afeb) {
59 for(
int halfLayer = 0; halfLayer <2; ++halfLayer) {
60 for (
int j=0;j<8;++j) {
64 if(frame.
data() != 0) {
66 tbinbits=tbinbits + (1<<tbin);
71 wireGroup = (afeb*16+halfLayer*8+j)+1;
73 wireGroup = wireGroup | (wireGroupBX << 16);
75 LogTrace (
"CSCAnodeData|CSCRawToDigi") <<
"Layer " << layer <<
" " << digi;
76 digis.push_back(digi);
92 int alctBoard = (wireGroup-1) / 16;
93 int localGroup = (wireGroup-1) % 16;
100 edm::LogError(
"CSCAnodeData|CSCRawToDigi") <<
"Bad Wire Number for this digi.";
107 unsigned halfLayer = (localGroup > 7);
108 unsigned bitNumber = localGroup % 8;
110 addHit(alctBoard, bxn, layer, halfLayer, bitNumber);
114 LogTrace(
"CSCAnodeData|CSCRawToDigi")<<
"warning: not saving anode data in bx " << bxn
115 <<
": out of range ";
122 int i =
index(afeb,tbin,layer) + halfLayer;
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));
151 assert(frame.
isHit(7));
156 anodeData.
add(wireDigi, 1);
157 anodeData.
add(wireDigi, 6);
159 std::vector<CSCWireDigi> wires1 = anodeData.
wireDigis(1);
160 std::vector<CSCWireDigi> wires6 = anodeData.
wireDigis(6);
162 assert(wires1.size() == 1);
163 assert(wires6.size() == 1);
164 assert(wires1[0].getWireGroup() == 10);
165 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