Changeset 12485 for trunk/FACT++
- Timestamp:
- 11/10/11 04:33:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilder.c
r12474 r12485 1109 1109 maxread, MSG_DONTWAIT); 1110 1110 // rd[i].bufLen, MSG_DONTWAIT); 1111 1112 1111 if (jrd > 0) { 1113 1112 debugStream (i, &rd[i].rBuf->B[rd[i].bufPos], jrd); … … 1226 1225 */ 1227 1226 //we have a complete buffer, copy to WORK area 1227 1228 1229 //End of the header. to channels now 1230 int eCount = 0; 1231 int eStart = 36; 1232 int ePatchesCount = 0; 1233 int currentRoi; 1234 for (;ePatchesCount<4*9;ePatchesCount++) 1235 { 1236 rd[i].rBuf->S[eStart+eCount] = ntohs(rd[i].rBuf->S[eStart+eCount]);//id 1237 eCount++; 1238 rd[i].rBuf->S[eStart+eCount] = ntohs(rd[i].rBuf->S[eStart+eCount]);//start_cell 1239 eCount++; 1240 rd[i].rBuf->S[eStart+eCount] = ntohs(rd[i].rBuf->S[eStart+eCount]);//roi 1241 currentRoi = rd[i].rBuf->S[eStart+eCount]; 1242 eCount++; 1243 rd[i].rBuf->S[eStart+eCount] = ntohs(rd[i].rBuf->S[eStart+eCount]);//filling 1244 eCount++; 1245 eCount+=currentRoi;//skip the pixel data 1246 } 1247 // snprintf(str, MXSTR, "Swapped %d bytes", eCount*2); 1248 // factOut(kError, 000, str); 1249 1250 //channels done. footer now 1251 // rd[i].rBuf->S[eStart+eCount] = ntohs(rd[i].rBuf->S[eStart+eCount]);//package_crc 1252 // eCount++; 1253 // rd[i].rBuf->S[eStart+eCount] = ntohs(rd[i].rBuf->S[eStart+eCount]);//end_package_flag 1254 // snprintf(str, MXSTR, "Bytes read %d bytes swapped %d", jrd, eCount*2); 1255 // factOut(kInfo, 000, str); 1256 //ETIENNE end of bytes swapping already 1257 1258 1228 1259 int jr, kr; 1229 1260 int checkRoi; 1230 1261 int roiHopper = head_len/2 + 2; //points to the very first roi 1231 roi[0] = ntohs (rd[i].rBuf->S[roiHopper]);1262 roi[0] = rd[i].rBuf->S[roiHopper]; 1232 1263 roiHopper += roi[0]+4;//skip to the second roi (i.e. next board, same patch-pixel) 1233 1264 for (kr = 1; kr < 4; kr++) 1234 1265 { 1235 checkRoi = ntohs(rd[i].rBuf->S[roiHopper]);1266 checkRoi = rd[i].rBuf->S[roiHopper]; 1236 1267 if (checkRoi != roi[0]) 1237 1268 { … … 1244 1275 //roiHopper now points to the first pixel of board 2. Do the 8 remaining pixels 1245 1276 for (jr = 1; jr < 9; jr++) { 1246 roi[jr] = ntohs(rd[i].rBuf->S[roiHopper]);1277 roi[jr] = rd[i].rBuf->S[roiHopper]; 1247 1278 checkRoi = roi[jr]; 1248 1279 for (kr = 1; kr < 4; kr++) 1249 1280 { 1250 1281 roiHopper += checkRoi+4; 1251 checkRoi = ntohs(rd[i].rBuf->S[roiHopper]);1282 checkRoi = rd[i].rBuf->S[roiHopper]; 1252 1283 if (checkRoi != roi[jr]) 1253 1284 { … … 1307 1338 int qncpy = 0; 1308 1339 boardId = b; 1309 int fadBoard = ntohs (rd[i].rBuf->S[12]);1340 int fadBoard = rd[i].rBuf->S[12]; 1310 1341 int fadCrate = fadBoard / 256; 1311 1342 if (boardId != (fadCrate * 10 + fadBoard % 256)) { … … 1334 1365 for (px = 0; px < 9; px++) { //different sort in FAD board..... 1335 1366 for (drs = 0; drs < 4; drs++) { 1336 pixH = ntohs (rd[i].rBuf->S[src++]); // ID1337 pixC = ntohs (rd[i].rBuf->S[src++]); // start-cell1338 pixR = ntohs (rd[i].rBuf->S[src++]); // roi1367 pixH = rd[i].rBuf->S[src++]; // ID 1368 pixC = rd[i].rBuf->S[src++]; // start-cell 1369 pixR = rd[i].rBuf->S[src++]; // roi 1339 1370 //here we should check if pixH is correct .... 1340 1371 … … 1449 1480 } 1450 1481 goodhed++; 1451 rd[i].fadLen = ntohs (rd[i].rBuf->S[1]) * 2; 1452 rd[i].fadVers = ntohs (rd[i].rBuf->S[2]); 1453 rd[i].ftmTyp = ntohs (rd[i].rBuf->S[5]); 1454 rd[i].ftmID = ntohl (rd[i].rBuf->I[3]); //(FTMevt) 1455 rd[i].evtID = ntohl (rd[i].rBuf->I[4]); //(FADevt) 1456 rd[i].runID = ntohl (rd[i].rBuf->I[11]); 1482 //ETIENNE swap the header bytes already 1483 int eStart = 0; 1484 rd[i].rBuf->S[eStart+0] = ntohs(rd[i].rBuf->S[eStart+0]);//start_package_flag 1485 rd[i].rBuf->S[eStart+1] = ntohs(rd[i].rBuf->S[eStart+1]);//package_length 1486 rd[i].rBuf->S[eStart+2] = ntohs(rd[i].rBuf->S[eStart+2]);//version_no 1487 rd[i].rBuf->S[eStart+3] = ntohs(rd[i].rBuf->S[eStart+3]);//PLLLCK 1488 rd[i].rBuf->S[eStart+4] = ntohs(rd[i].rBuf->S[eStart+4]);//trigger_crc 1489 rd[i].rBuf->S[eStart+5] = ntohs(rd[i].rBuf->S[eStart+5]);//trigger_type 1490 rd[i].rBuf->I[eStart+3] = ntohl(rd[i].rBuf->I[eStart+3]);//trigger_id 1491 rd[i].rBuf->I[eStart+4] = ntohl(rd[i].rBuf->I[eStart+4]);//fad_evt_counter 1492 rd[i].rBuf->I[eStart+5] = ntohl(rd[i].rBuf->I[eStart+5]);//REFCLK_frequency 1493 rd[i].rBuf->S[eStart+12] = ntohs(rd[i].rBuf->S[eStart+12]);//board_id 1494 rd[i].rBuf->S[eStart+14] = ntohs(rd[i].rBuf->S[eStart+14]);//number_of_triggers_to_generate 1495 rd[i].rBuf->S[eStart+15] = ntohs(rd[i].rBuf->S[eStart+15]);//trigger_generator_prescaler 1496 // int eInter = ntohl(rd[i].rBuf->I[eStart+8]);//DNA 1497 // rd[i].rBuf->I[eStart+8] = ntohl(rd[i].rBuf->I[eStart+9]); 1498 //rd[i].rBuf->I[eStart+9] = eInter; 1499 rd[i].rBuf->I[eStart+10] = ntohl(rd[i].rBuf->I[eStart+10]);//time 1500 rd[i].rBuf->I[eStart+11] = ntohl(rd[i].rBuf->I[eStart+11]);//runnumber; 1501 int eCount = 24; 1502 for (;eCount<24+NTemp;eCount++) 1503 rd[i].rBuf->S[eStart+eCount] = ntohs(rd[i].rBuf->S[eStart+eCount]);//drs_temperature 1504 for (; eCount < 24+NTemp+NDAC; eCount++) 1505 rd[i].rBuf->S[eStart+eCount] = ntohs(rd[i].rBuf->S[eStart+eCount]);//dac 1506 1507 1508 // rd[i].fadLen = rd[i].rBuf->S[1] * 2; 1509 // snprintf(str, MXSTR, "Size of the fad buffer: %d", rd[i].fadLen); 1510 // factOut(kError, 000, str); 1511 1512 rd[i].fadVers = rd[i].rBuf->S[2]; 1513 rd[i].ftmTyp = rd[i].rBuf->S[5]; 1514 rd[i].ftmID = rd[i].rBuf->I[3]; //(FTMevt) 1515 rd[i].evtID = rd[i].rBuf->I[4]; //(FADevt) 1516 rd[i].runID = rd[i].rBuf->I[11]; 1457 1517 rd[i].bufTyp = 1; //ready to read full record 1458 1518 rd[i].bufLen = rd[i].fadLen - rd[i].bufPos; 1459 1519 1460 int fadboard = ntohs (rd[i].rBuf->S[12]);1520 int fadboard = rd[i].rBuf->S[12]; 1461 1521 int fadcrate = fadboard / 256; 1462 1522 fadboard = (fadcrate * 10 + fadboard % 256); … … 1478 1538 rd[i].bufLen = 100000; //? 1479 1539 } 1480 int fadBoard = ntohs (rd[i].rBuf->S[12]);1540 int fadBoard = rd[i].rBuf->S[12]; 1481 1541 debugHead (i, fadBoard, rd[i].rBuf); 1482 1542 debugRead (i, jrd, rd[i].evtID, rd[i].ftmID, rd[i].runID, -1, tsec, tusec); // i=socket; jrd=#bytes; ievt=eventid;-1=start event … … 2021 2081 } else { 2022 2082 mBuffer[id].fEvent->BoardTime[ib] = 2023 ntohl (mBuffer[id].FADhead[ib].time);2083 mBuffer[id].FADhead[ib].time; 2024 2084 } 2025 2085 }
Note:
See TracChangeset
for help on using the changeset viewer.