Changeset 11091 for trunk/FACT++/src/EventBuilder.c
- Timestamp:
- 06/21/11 20:54:18 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilder.c
r11090 r11091 43 43 extern void factStat(int severity, int err, char* message ) ; 44 44 45 extern int eventCheck( PEVNT_HEADER *fadhd, EVENT *event) ; 45 46 46 47 extern void debugRead(int isock, int ibyte, int32_t event, int state, … … 295 296 296 297 297 needmem = sizeof(EVENT) + NPIX*nRoi*2 + NTMARK*nRoi*2 ;298 needmem = sizeof(EVENT) + NPIX*nRoi*2 + NTMARK*nRoi*2; // 298 299 299 300 headmem = NBOARDS* sizeof(PEVNT_HEADER) ; … … 576 577 snprintf(str,MXSTR,"Socket %d closed by FAD",i); 577 578 factOut(kInfo,441, str ) ; 578 j =GenSock(1, i, 0,NULL, &rd[i]) ;579 GenSock(1, i, 0,NULL, &rd[i]) ; 579 580 gi_ErrCnt[i]++ ; 580 581 gi_NumConnect[ b ]-- ; … … 852 853 snprintf(str,MXSTR,"close all sockets ..."); 853 854 factOut(kInfo,-1, str ) ; 854 for (i=0; i<MAX_SOCK; i++) 855 if (rd[i].sockStat ==0 ) { 856 j=close(rd[i].socket) ; 857 if (j>0) { 858 snprintf(str,MXSTR,"Error closing socket %d | %m",i); 859 factOut(kFatal,771, str ) ; 860 } 861 rd[i].sockStat = -1 ; //flag (try to reopen next round) 862 gi_NumConnect[ i/7 ]-- ; 863 } 855 for (i=0; i<MAX_SOCK; i++) { 856 GenSock(-1, i, 0, NULL, &rd[i]) ; //close and destroy socket 857 gi_NumConnect[ i/7 ]-- ; 858 } 864 859 865 860 xwait.tv_sec = 0; … … 944 939 if (evtCtrl.evtStat[k0] > 90 && evtCtrl.evtStat[k0] <500) { 945 940 int id = evtCtrl.evtBuf[k0] ; 946 uint32_t irun = mBuffer[id].runNum ;947 941 int ievt = mBuffer[id].evNum ; 948 942 int roi = mBuffer[id].nRoi ; 943 // uint32_t irun = mBuffer[id].runNum ; 949 944 //snprintf(str,MXSTR,"P processing %d %d %d %d",ievt,k,id,evtCtrl.evtStat[k0]) ; 950 945 //factOut(kDebug,-1, str ) ; … … 964 959 } 965 960 } 966 //and set correct event header ; also check for consistency in event 967 mBuffer[id].fEvent->Roi = roi ; 968 mBuffer[id].fEvent->EventNum = ievt ; 969 mBuffer[id].fEvent->TriggerType = 0 ; // TBD 970 mBuffer[id].fEvent->SoftTrig = 0 ; 971 for (ib=0; ib<NBOARDS; ib++) { 972 mBuffer[id].fEvent->BoardTime[ib] = 123 ; 973 974 975 976 961 962 963 //and set correct event header ; also check for consistency in event (not yet) 964 mBuffer[id].fEvent->Roi = roi ; 965 mBuffer[id].fEvent->EventNum = ievt ; 966 mBuffer[id].fEvent->TriggerType = 0 ; // TBD 967 mBuffer[id].fEvent->SoftTrig = 0 ; 968 for (ib=0; ib<NBOARDS; ib++) { 969 if (mBuffer[id].board[ib] == -1 ) { //board is not read 970 mBuffer[id].FADhead[ib].start_package_flag = 0 ; 971 mBuffer[id].fEvent->BoardTime[ib] = 0 ; 972 } else { 973 mBuffer[id].fEvent->BoardTime[ib] = 974 ntohl(mBuffer[id].FADhead[ib].time) ; 975 } 977 976 } 977 978 int i=eventCheck(mBuffer[id].FADhead,mBuffer[id].fEvent) ; 979 980 if (i<0) evtCtrl.evtStat[k0] = 999 ; //flag event to be skipped 981 978 982 numProc++ ; 979 983 evtCtrl.evtStat[k0] = 520 ; … … 1306 1310 1307 1311 1308 1312 /* 1309 1313 xwait.tv_sec = 20;; 1310 1314 xwait.tv_nsec= 0 ; // sleep for ~20sec … … 1324 1328 1325 1329 g_runStat = -1 ; 1326 1330 */ 1327 1331 1328 1332 … … 1371 1375 1372 1376 1377 1378 int eventCheck( PEVNT_HEADER *fadhd, EVENT *event) 1379 { 1380 int i=0; 1381 1382 printf("------------%d\n",ntohl(fadhd[7].fad_evt_counter) ); 1383 for (i=0; i<NBOARDS; i++) { 1384 printf("b=%2d,=%5d\n",i,fadhd[i].board_id); 1385 } 1386 return 0; 1387 } 1388 1389 1373 1390 void factStat(int severity, int err, char* message ) { 1374 1391 printf("%3d %3d : %s\n",severity,err,message) ; … … 1377 1394 1378 1395 void debugRead(int isock, int ibyte, int32_t event, int state, uint32_t tsec, uint32_t tusec ) { 1379 printf("%3d %5d %9d %3d %12d\n",isock, ibyte, event, state, tusec) ;1396 // printf("%3d %5d %9d %3d %12d\n",isock, ibyte, event, state, tusec) ; 1380 1397 } 1381 1398
Note:
See TracChangeset
for help on using the changeset viewer.