Changeset 10980
- Timestamp:
- 06/10/11 13:17:04 (14 years ago)
- Location:
- fact/FADctrl
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/FADctrl/FAD.cc
r10969 r10980 62 62 Datafile = -1; 63 63 EventUpdateDelay = atof(GetConfig("EventUpdateDelay", "0.5").c_str()); 64 TimeForDIMUpdate = 0; 64 65 65 66 // Create pipe for data exchange … … 633 634 else if (Mode == acalib) PrintMessage("Current mode is ACALIB (3x%d events, slowest board %d has %d events)\n", NumEventsRequested, SlowestBoard, MinCount); 634 635 else if (Mode == datarun) PrintMessage("Current mode is DATARUN (%d events requested, %d events taken)\n", NumEventsRequested, NumEvents); 635 636 PrintMessage("Execution time of last DIM event update %d seconds\n", TimeForDIMUpdate); 636 637 return; 637 638 } … … 999 1000 } 1000 1001 1001 // Check if DIM service should be updated 1002 if ((Time.tv_sec-LastUpdate.tv_sec)*1e6 + Time.tv_usec-LastUpdate.tv_usec > EventUpdateDelay*1e6) {1002 // Check if DIM service should be updated (delay between updates at least 10xtime to update) 1003 if ((Time.tv_sec-LastUpdate.tv_sec)*1e6 + Time.tv_usec-LastUpdate.tv_usec > max(10*TimeForDIMUpdate, EventUpdateDelay)*1e6) { 1003 1004 gettimeofday(&LastUpdate, NULL); 1005 1004 1006 EventService.updateService(EventData, sizeof(RunHeader) + sizeof(EventHeader) + ActiveBoards.size()*(sizeof(BoardStructure) + NChips*NChannels*NBins*sizeof(short) + NChips*sizeof(int))); 1005 1007 EventNumService.updateService(); 1008 1009 TimeForDIMUpdate = time(NULL) - LastUpdate.tv_sec; 1006 1010 if (Mode == datarun) FileSizeService.updateService(); 1007 1011 } … … 1043 1047 NumEvents++; 1044 1048 1045 // Write event header to file1046 //if(write(Datafile, EHeader, sizeof(EventHeader)) != sizeof(EventHeader)) Error = true;1047 1048 // Write trigger cells1049 //for (unsigned int i=0; i<ActiveBoards.size(); i++) {1050 //if(write(Datafile, TriggerCell + i*NChips, NChips*sizeof(int)) != NChips*sizeof(int)) Error = true;1051 //}1052 1053 // Write ADC data1054 //unsigned int Bins = NChips*NChannels*NBins;1055 //for (unsigned int i=0; i<ActiveBoards.size(); i++) {1056 //if(write(Datafile, Data+i*Bins, Bins*sizeof(short)) != (ssize_t) (Bins*sizeof(short))) Error = true;1057 //}1058 1059 1049 // Update file size 1060 1050 if (fstat(Datafile, &FileStat) == -1) Error = errno; -
fact/FADctrl/FAD.h
r10969 r10980 46 46 static void LaunchEventThread(class FAD *); 47 47 pthread_t Thread; 48 float TimeForDIMUpdate; 48 49 49 50 int Datafile; -
fact/FADctrl/FADBoard.cc
r10969 r10980 470 470 while (!Continue) { 471 471 struct timespec Wakeup; 472 Wakeup.tv_sec = time(NULL)+ 5;472 Wakeup.tv_sec = time(NULL)+MAX_WAIT_FOR_CONDITION; 473 473 Wakeup.tv_nsec = 0; 474 474 if ((Ret = pthread_cond_timedwait(&CondVar, &Mutex, &Wakeup)) != 0) { 475 if (Ret == ETIMEDOUT) printf("Board %s timed out (5 s) waiting for condition\n", Name);475 if (Ret == ETIMEDOUT) SetStatus("Board %s timed out (%d s) waiting for condition\n", Name, MAX_WAIT_FOR_CONDITION); 476 476 else m->Message(m->ERROR, "pthread_cond_wait() failed (%s)", strerror(Ret)); 477 477 } -
fact/FADctrl/FADBoard.h
r10813 r10980 22 22 const unsigned int READ_BUFFER_SIZE = 1000000; 23 23 const unsigned int STATUS_SIZE = 200; 24 const int MAX_WAIT_FOR_CONDITION = 10; 24 25 25 26 class FADBoard: public DimThread { -
fact/FADctrl/History.txt
r10913 r10980 31 31 25/5/2011 dcm_lock and dcm_ready bits were incorrectly evaluated. 32 32 3/6/2011 Raw data files will only contain boards active at the start of the run. 33 7/6/2011 DIM event service only contains active boards
Note:
See TracChangeset
for help on using the changeset viewer.