Changeset 10113 for fact/FADctrl/FADBoard.cc
- Timestamp:
- 01/21/11 15:46:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/FADctrl/FADBoard.cc
r10101 r10113 89 89 int Ret; 90 90 91 // Cancel thread and wait for it to quit91 // Cancel thread (if it did not quit already) and wait for it to quit 92 92 if (pthread_equal(Thread, pthread_self()) == 0) { 93 if ((Ret = pthread_cancel(Thread)) != 0 ) m->Message(m->ERROR, "pthread_cancel() failed in ~FADBoard() (%s)", strerror(Ret));93 if ((Ret = pthread_cancel(Thread)) != 0 && Ret != ESRCH) m->Message(m->ERROR, "pthread_cancel() failed in ~FADBoard() (%s)", strerror(Ret)); 94 94 if ((Ret = pthread_join(Thread, NULL)) != 0) m->Message(m->ERROR, "pthread_join() failed in ~FADBoard (%s)", strerror(Ret)); 95 95 } … … 164 164 // Initiate average 165 165 // 166 void FADBoard::AccumulateSum(unsigned int n ) {166 void FADBoard::AccumulateSum(unsigned int n, bool Rotate) { 167 167 168 168 if (!Active) return; 169 169 170 170 Lock(); 171 SumPhysPipeline = Rotate; 171 172 memset(Sum, 0, sizeof(Sum)); 172 173 NumForSum = n; … … 253 254 // Extract ID and type information 254 255 Status.BoardID = ntohl(Header->board_id); 256 Status.FirmwareRevision = ntohl(Header->version_no); 255 257 Status.TriggerID = ntohl(Header->local_trigger_id); 256 258 Status.TriggerType = ntohs(Header->local_trigger_type); … … 287 289 for (unsigned int Chip=0; Chip<NChips; Chip++) for (unsigned int Chan=0; Chan<NChannels; Chan++) { 288 290 for (int i=0; i<Status.ROI[Chip][Chan]; i++) { 289 Sum[Chip][Chan][(i+Status.TriggerCell[Chip]) % NBins] += Data[Chip][Chan][i]; 291 if (SumPhysPipeline) Sum[Chip][Chan][(i+Status.TriggerCell[Chip]) % NBins] += Data[Chip][Chan][i]; 292 else Sum[Chip][Chan][i] = Data[Chip][Chan][i]-Baseline[Chip][Chan][(i-Status.TriggerCell[Chip]) % NBins]; 290 293 } 291 294 } … … 312 315 else printf("End package flag incorrect, removing corrupt event\n"); 313 316 317 // Inform event thread of new data 318 if (write(m->Pipe[1], Name, strlen(Name)+1) == -1) { 319 m->Message(m->ERROR, "write() to Pipe[1] failed in class FADBoard (%s)", strerror(errno)); 320 m->ExitRequest = true; 321 } 322 314 323 // Remove event data from internal buffer 315 324 memmove(Buffer, Buffer+Length, Pos-Length);
Note:
See TracChangeset
for help on using the changeset viewer.