87 vector<int> DTTFWordContainer;
88 vector<int>::iterator DTTFiterator;
96 int addr1[2] = {3, 3};
97 int addr2[2] = {15, 15};
98 int addr3[2] = {15, 15};
99 int addr4[2] = {15, 15};
109 if (dttfdata.
size() == 0)
112 int *dataWord1 =
new int;
113 int *dataWord2 =
new int;
114 unsigned char *LineFED = dttfdata.
data();
115 *dataWord2 = *((
int *)LineFED);
117 *dataWord1 = *((
int *)LineFED);
120 BOEevTy = ((*dataWord1) & 0xFF000000) >> 24;
121 DTTFId = ((*dataWord2) & 0x000FFF00) >> 8;
123 if ((BOEevTy != 0x50) || (DTTFId != 0x030C)) {
125 edm::LogWarning(
"dttf_unpacker") <<
"Not a DTTF header " << hex << *dataWord1;
137 *dataWord2 = *((
int *)LineFED);
139 *dataWord1 = *((
int *)LineFED);
140 int chkEOE = ((*dataWord1) & 0xFFF00000) >> 20;
143 while (chkEOE != 0xA00) {
146 DTTFWord = *dataWord1;
147 DTTFWordContainer.push_back(DTTFWord);
148 DTTFWord = *dataWord2;
149 DTTFWordContainer.push_back(DTTFWord);
152 *dataWord2 = *((
int *)LineFED);
154 *dataWord1 = *((
int *)LineFED);
155 chkEOE = ((*dataWord1) & 0xFFF00000) >> 20;
160 edm::LogWarning(
"dttf_unpacker") <<
"Warning : number of DTTF lines > 3026 ";
173 evtLgth = ((*dataWord1) & 0x00FFFFFF);
174 CRC = ((*dataWord2) & 0xFFFF0000) >> 16;
180 edm::LogWarning(
"dttf_unpacker") <<
"Calculated CRC " << hex << newCRC <<
" differs from CRC in trailer " << hex
187 if (
lines != evtLgth) {
197 for (DTTFiterator = DTTFWordContainer.begin(); DTTFiterator != DTTFWordContainer.end(); DTTFiterator++) {
198 DTTFChan = ((*DTTFiterator) & 0xFF000000) >> 24;
200 bitsID = ((*DTTFiterator) & 0xF0000000) >> 28;
202 int bxID =
bxNr(DTTFChan);
205 int wheelID =
wheel(DTTFChan);
208 int sectorID =
sector(DTTFChan);
209 if (sectorID == -999)
213 if (wheelID != 0 && bitsID <= 0x9) {
214 int wheelPh = (
abs(wheelID) - 1) * wheelID /
abs(wheelID);
221 if ((bitsID >> 1) == 0) {
224 if ((bitsID >> 1) == 1) {
227 if ((bitsID >> 1) == 4) {
230 if ((bitsID >> 1) == 2) {
234 if (stationID != 3) {
235 ts2tag = (bitsID)&0
x1;
236 tsqual = (~(*DTTFiterator) & 0x07) - 1;
237 ba = (~(*DTTFiterator) & 0x1FF8) >> 3;
240 ra = (~(*DTTFiterator) & 0x1FFE000) >> 13;
244 ts2tag = (bitsID)&0
x1;
245 tsqual = (~(*DTTFiterator) & 0x07) - 1;
246 ra = (~(*DTTFiterator) & 0x7FF8) >> 3;
251 if (tsqual != 7 && wheelID != -1) {
253 L1MuDTChambPhDigi(bxID + ts2tag, wheelPh, sectorID, stationID, ra, ba, tsqual, ts2tag, 0));
259 if (wheelID == 0 && bitsID <= 0x4) {
260 int wheelTh = bitsID - 2;
262 int posALL, posBTI[7];
264 if (wheelTh == -2 || wheelTh == -1 ||
266 (sectorID == 0 || sectorID == 3 || sectorID == 4 || sectorID == 7 || sectorID == 8 || sectorID == 11))) {
267 posALL = ~(*DTTFiterator) & 0x7F;
268 posBTI[0] = ~(*DTTFiterator) & 0x01;
269 posBTI[1] = (~(*DTTFiterator) & 0x02) >> 1;
270 posBTI[2] = (~(*DTTFiterator) & 0x04) >> 2;
271 posBTI[3] = (~(*DTTFiterator) & 0x08) >> 3;
272 posBTI[4] = (~(*DTTFiterator) & 0x10) >> 4;
273 posBTI[5] = (~(*DTTFiterator) & 0x20) >> 5;
274 posBTI[6] = (~(*DTTFiterator) & 0x40) >> 6;
280 posALL = ~(*DTTFiterator) & 0x3F80;
281 posBTI[0] = (~(*DTTFiterator) & 0x0080) >> 7;
282 posBTI[1] = (~(*DTTFiterator) & 0x0100) >> 8;
283 posBTI[2] = (~(*DTTFiterator) & 0x0200) >> 9;
284 posBTI[3] = (~(*DTTFiterator) & 0x0400) >> 10;
285 posBTI[4] = (~(*DTTFiterator) & 0x0800) >> 11;
286 posBTI[5] = (~(*DTTFiterator) & 0x1000) >> 12;
287 posBTI[6] = (~(*DTTFiterator) & 0x2000) >> 13;
293 posALL = ~(*DTTFiterator) & 0x1FC000;
294 posBTI[0] = (~(*DTTFiterator) & 0x004000) >> 14;
295 posBTI[1] = (~(*DTTFiterator) & 0x008000) >> 15;
296 posBTI[2] = (~(*DTTFiterator) & 0x010000) >> 16;
297 posBTI[3] = (~(*DTTFiterator) & 0x020000) >> 17;
298 posBTI[4] = (~(*DTTFiterator) & 0x040000) >> 18;
299 posBTI[5] = (~(*DTTFiterator) & 0x080000) >> 19;
300 posBTI[6] = (~(*DTTFiterator) & 0x100000) >> 20;
308 posALL = ~(*DTTFiterator) & 0x7F;
309 posBTI[6] = ~(*DTTFiterator) & 0x01;
310 posBTI[5] = (~(*DTTFiterator) & 0x02) >> 1;
311 posBTI[4] = (~(*DTTFiterator) & 0x04) >> 2;
312 posBTI[3] = (~(*DTTFiterator) & 0x08) >> 3;
313 posBTI[2] = (~(*DTTFiterator) & 0x10) >> 4;
314 posBTI[1] = (~(*DTTFiterator) & 0x20) >> 5;
315 posBTI[0] = (~(*DTTFiterator) & 0x40) >> 6;
321 posALL = ~(*DTTFiterator) & 0x3F80;
322 posBTI[6] = (~(*DTTFiterator) & 0x0080) >> 7;
323 posBTI[5] = (~(*DTTFiterator) & 0x0100) >> 8;
324 posBTI[4] = (~(*DTTFiterator) & 0x0200) >> 9;
325 posBTI[3] = (~(*DTTFiterator) & 0x0400) >> 10;
326 posBTI[2] = (~(*DTTFiterator) & 0x0800) >> 11;
327 posBTI[1] = (~(*DTTFiterator) & 0x1000) >> 12;
328 posBTI[0] = (~(*DTTFiterator) & 0x2000) >> 13;
334 posALL = ~(*DTTFiterator) & 0x1FC000;
335 posBTI[6] = (~(*DTTFiterator) & 0x004000) >> 14;
336 posBTI[5] = (~(*DTTFiterator) & 0x008000) >> 15;
337 posBTI[4] = (~(*DTTFiterator) & 0x010000) >> 16;
338 posBTI[3] = (~(*DTTFiterator) & 0x020000) >> 17;
339 posBTI[2] = (~(*DTTFiterator) & 0x040000) >> 18;
340 posBTI[1] = (~(*DTTFiterator) & 0x080000) >> 19;
341 posBTI[0] = (~(*DTTFiterator) & 0x100000) >> 20;
351 if (wheelID != 0 && bitsID >= 0xA && bitsID <= 0xB) {
352 int candID = bitsID - 0xA;
354 addr4[candID] = ((*DTTFiterator) & 0x0F);
355 addr3[candID] = ((*DTTFiterator) & 0xF0) >> 4;
356 addr2[candID] = ((*DTTFiterator) & 0xF00) >> 8;
357 addr1[candID] = ((*DTTFiterator) & 0x3000) >> 12;
362 if (wheelID != 0 && bitsID >= 0xC) {
370 qual = (~(*DTTFiterator) & 0x07);
371 phi = ((*DTTFiterator) & 0x7F8) >> 3;
372 ch = (~(*DTTFiterator) & 0x800) >> 11;
373 pt = (~(*DTTFiterator) & 0x1F000) >> 12;
397 if (wheelID == 0 && bitsID >= 0x8) {
398 int wheelTh = bitsID & 0x7;
402 etaALL = ~(*DTTFiterator) & 0x007F;
404 etTrack[bxID + 1][sectorID][wheelTh][0] = (*DTTFiterator) & 0x003F;
405 efTrack[bxID + 1][sectorID][wheelTh][0] = (~(*DTTFiterator) & 0x0040) >> 6;
408 etaALL = (~(*DTTFiterator) & 0x3F80) >> 7;
410 etTrack[bxID + 1][sectorID][wheelTh][1] = ((*DTTFiterator) & 0x1F80) >> 7;
411 efTrack[bxID + 1][sectorID][wheelTh][1] = (~(*DTTFiterator) & 0x2000) >> 13;