Changeset 11511 for trunk/FACT++/src
- Timestamp:
- 07/21/11 12:11:30 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilder.c
r11443 r11511 1 1 2 2 3 #define PX8 99 //simulator does not create double-length roi for pixel 84 //for real data, set PX8 = 8 ==> ask for double roi=TM5 3 6 4 … … 80 78 int gi_memStat = +1 ; 81 79 82 uint32_t gi_myRun = 9876789;83 uint32_t actrun ;80 uint32_t gi_myRun = 0 ; 81 uint32_t actrun = 0 ; 84 82 85 83 … … 364 362 } 365 363 366 mBuffer[i].fEvent->PC Time[0] = g_actTime;367 mBuffer[i].fEvent->PCTime [1] = g_actUsec ;364 mBuffer[i].fEvent->PCUsec = g_actUsec ; 365 mBuffer[i].fEvent->PCTime = 368 366 mBuffer[i].pcTime = g_actTime ; 369 367 mBuffer[i].nRoi = nRoi ; … … 410 408 runCtrl[evFree].actEvt = 0; 411 409 runCtrl[evFree].maxEvt = 999999999 ; //max number events allowed 410 runCtrl[evFree].firstUsec=g_actUsec ; 411 runCtrl[evFree].firstTime= 412 412 runCtrl[evFree].lastTime=g_actTime ; 413 413 runCtrl[evFree].closeTime=g_actTime + 3600*24 ; //max time allowed … … 652 652 gettimeofday( tv, NULL); 653 653 g_actTime = tsec = atv.tv_sec ; 654 g_actUsec = tusec= atv.tv_usec ; 654 g_actUsec = tusec= atv.tv_usec ; 655 655 656 656 if (rd[i].sockStat <0 ) { //try to connect if not yet done … … 683 683 debugStream(i,&rd[i].rBuf->B[ rd[i].bufPos],jrd) ; 684 684 memcpy(&rd[i].xBuf->B[ rd[i].bufPos], &rd[i].rBuf->B[ rd[i].bufPos], jrd) ; 685 snprintf(str,MXSTR,"read sock %3d bytes %5d , %5d",i,jrd,rd[i].bufLen); 685 snprintf(str,MXSTR,"read sock %3d bytes %5d len %5d first %d %d",i,jrd,rd[i].bufLen, 686 rd[i].rBuf->B[ rd[i].bufPos ], 687 rd[i].rBuf->B[ rd[i].bufPos +1] ); 686 688 factOut(kDebug,301, str ) ; 687 689 } … … 803 805 roi = mBuffer[evID].nRoi ; 804 806 805 pixS = boardId*36 -1 ; //806 tmS = boardId*4 -1 ; //807 807 src = head_len/2 ; 808 for ( px=0; px<9; px++ ) { //different sort in FAD board..... 809 for ( drs=0; drs<4; drs++ ) { 810 pixH= ntohs(rd[i].rBuf->S[src++]) ; 811 pixC= ntohs(rd[i].rBuf->S[src++]) ; 812 pixR= ntohs(rd[i].rBuf->S[src++]) ; 813 808 for ( px=0; px<9; px++ ) { //different sort in FAD board..... 809 for ( drs=0; drs<4; drs++ ) { 810 pixH= ntohs(rd[i].rBuf->S[src++]) ; // ID 811 pixC= ntohs(rd[i].rBuf->S[src++]) ; // start-cell 812 pixR= ntohs(rd[i].rBuf->S[src++]) ; // roi 813 //here we should check if pixH is correct .... 814 815 pixS = boardId*36 + drs*9 + px ; 814 816 src++ ; 815 pixS++ ; //pixS = pixH2S[pixH] ; 816 if ( ( px < PX8 && pixR == roi ) 817 || ( px ==PX8 && pixR == 2*roi ) 818 || ( px ==PX8 && pixR == roi && roi > 512 ) ) { 819 // correct roi 817 818 if ( ( px != 8 && pixR == roi ) 819 || ( px == 8 && pixR >= roi ) ) { //we have a reasonable roi 820 820 821 mBuffer[evID].fEvent->StartPix[pixS] =pixC; 821 822 dest= pixS * roi ; … … 823 824 &mBuffer[evID].fEvent->Adc_Data[dest], 824 825 &rd[i].rBuf->S[src], roi * 2) ; 825 src+= roi ; 826 if ( px==PX8 ) { 827 tmS++; // tmS = tmH2S[pixH] 828 dest= tmS * roi + NPIX* roi ; 829 if ( roi <=512 ) { 830 mBuffer[evID].fEvent->StartTM[tmS] =(pixC+roi)%1024 ; 826 src+= pixR ; 827 828 if ( px==8 ) { 829 if ( pixR > roi) { //and we have additional TM info 830 tmS =boardId*4 + drs ; 831 dest= tmS * roi + NPIX* roi ; 832 int srcT= src - roi ; 833 mBuffer[evID].fEvent->StartTM[tmS] = (pixC+pixR-roi)%1024 ; 831 834 memcpy( 832 835 &mBuffer[evID].fEvent->Adc_Data[dest], 833 &rd[i].rBuf->S[src], roi * 2) ; 834 src+=roi ; 836 &rd[i].rBuf->S[srcT], roi * 2) ; 835 837 } else { 836 838 mBuffer[evID].fEvent->StartTM[tmS] = -1 ; 837 839 } 838 840 } … … 1397 1399 actRun.Version = 1 ; 1398 1400 actRun.RunType = -1 ; 1401 1402 actRun.RunTime = runCtrl[j].firstTime ; 1403 actRun.RunUsec = runCtrl[j].firstTime ; 1399 1404 actRun.NBoard = NBOARDS ; 1400 1405 actRun.NPix = NPIX ; -
trunk/FACT++/src/FAD.h
r11343 r11511 120 120 121 121 uint32_t SoftTrig ; // SoftTrigger Info (TBD) 122 uint32_t PCTime ; // when did event start to arrive at PC 122 uint32_t PCTime ; // epoch 123 uint32_t PCUsec ; // micro-seconds 123 124 124 125 uint32_t BoardTime[NBOARDS];// … … 142 143 uint32_t Version ; 143 144 uint32_t RunType ; 145 uint32_t RunTime ; //unix epoch for first event 146 uint32_t RunUsec ; //microseconds 144 147 uint16_t NBoard ; 145 148 uint16_t NPix ; … … 173 176 //--------------------------------------------------------------- 174 177 175 #define MAX_RUN 256178 #define MAX_RUN 8 176 179 #define MAX_EVT 32768 //don't worry, for events is MAX_RUN*MAX_EVT 177 180 … … 180 183 typedef struct { 181 184 uint32_t runId ; //run number 185 uint32_t firstTime ; //epoch of first event received 186 uint32_t firstUsec ; //epoch of first event received 182 187 uint32_t lastTime ; //time when last event written so far 183 188 uint32_t closeTime ; //time when run should be closed 184 189 uint32_t maxEvt ; //maximum number of events to write 185 190 uint32_t actEvt ; //actual number of events written so far 186 uint32_t lastEvt ; //last event of this run read so far191 int32_t lastEvt ; //last event of this run read so far 187 192 uint32_t nextEvt ; //next event number to be written 188 193 uint32_t waitEvt ; //event that would be ready to be written
Note:
See TracChangeset
for help on using the changeset viewer.