Changeset 10642 for fact/FADctrl
- Timestamp:
- 05/10/11 13:11:19 (14 years ago)
- Location:
- fact/FADctrl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/FADctrl/FAD.cc
r10617 r10642 653 653 } 654 654 655 PrintMessage("\n Last trigger: ID %d Type %d CRC %d Run number %d\n", S.TriggerID, S.TriggerType, S.TriggerCRC, S.Runnumber);655 PrintMessage("\nTrigger ID: Num %d Type %d CRC %d Run number %d\n", S.TriggerNum, S.TriggerType, S.TriggerCRC, S.Runnumber); 656 656 } // for() 657 657 } … … 786 786 // Open calibration data file 787 787 string Filename = string(getenv("HOME"))+"/FAD_ACal"; 788 FILE *File = fopen(Filename.c_str(), " ab");788 FILE *File = fopen(Filename.c_str(), "wb"); 789 789 790 790 if (File == NULL) { … … 806 806 if (fclose(File) != 0) PrintMessage("Could not close calibration file '%s'\n", Filename.c_str()); 807 807 808 PrintMessage(" Appendedamplitude calibration to file '%s'\n", Filename.c_str());808 PrintMessage("Wrote amplitude calibration to file '%s'\n", Filename.c_str()); 809 809 } 810 810 … … 952 952 953 953 // Update event header with ID and Type of current board 954 EHeader->EventNumber = S.Trigger ID;954 EHeader->EventNumber = S.TriggerNum; 955 955 EHeader->TriggerType = S.TriggerType; 956 956 957 957 // Register event number for data writing below 958 EventNumbers[Brd] = S.Trigger ID;958 EventNumbers[Brd] = S.TriggerNum; 959 959 960 960 // Write trigger cells -
fact/FADctrl/FADBoard.cc
r10504 r10642 54 54 DIM_Rate = new DimService((ID.str()+"RateHz").c_str(), Status.Rate); 55 55 DIM_Frequency = new DimService((ID.str()+"Frequency").c_str(), Status.Frequency); 56 DIM_TriggerNum = new DimService((ID.str()+"TriggerNum").c_str(), (char *) "I", &Status.TriggerNum, sizeof(Status.TriggerNum)); 56 57 DIM_Temp = new DimService((ID.str()+"Temperature").c_str(), (char *) "F", NULL, 0); 57 58 DIM_DAC = new DimService((ID.str()+"DAC").c_str(), (char *) "S", NULL, 0); 58 59 DIM_ROI = new DimService((ID.str()+"ROI").c_str(), (char *) "S", NULL, 0); 60 DIM_ACalData = new DimService((ID.str()+"ACalData").c_str(), (char *) "F", NULL, 0); 59 61 60 62 // Create thread that connects and receives data … … 99 101 delete DIM_Rate; 100 102 delete DIM_Frequency; 103 delete DIM_TriggerNum; 101 104 delete DIM_Temp; 102 105 delete DIM_DAC; 103 delete DIM_ROI; 106 delete DIM_ROI; 107 delete DIM_ACalData; 104 108 delete[] Name; 105 109 } … … 334 338 Send(DACCmd, sizeof(DACCmd)); 335 339 340 // Update DIM service with calibration information 341 for (unsigned int i=0; i<NChips; i++) { 342 for (unsigned int j=0; j<NChannels; j++) { 343 for (unsigned int k=0; k<NBins; k++) { 344 ACalData[0][i][j][k] = ACalib.Baseline[i][j][k]; 345 ACalData[1][i][j][k] = ACalib.Gain[i][j][k]; 346 ACalData[2][i][j][k] = ACalib.Secondary[i][j][k]; 347 } 348 } 349 } 350 DIM_ACalData->updateService(ACalData, 3*NChips*NChannels*NBins*sizeof(float)); 351 336 352 State = wait; 337 353 break; … … 456 472 Status.BoardTime = ntohl(Header->time); 457 473 Status.EventCounter = ntohl(Header->fad_evt_counter); 458 Status.Trigger ID= ntohl(Header->trigger_id);474 Status.TriggerNum = ntohl(Header->trigger_id); 459 475 Status.Runnumber = ntohl(Header->runnumber); 460 476 Status.TriggerType = ntohs(Header->trigger_type); … … 521 537 522 538 if (PrevStatus.Frequency != Status.Frequency) DIM_Frequency->updateService(); 523 539 if (PrevStatus.TriggerNum != Status.TriggerNum) DIM_TriggerNum->updateService(); 524 540 if (PrevStatus.Rate != Status.Rate) DIM_Rate->updateService(); 525 541 -
fact/FADctrl/FADBoard.h
r10504 r10642 28 28 int Socket; 29 29 pthread_mutex_t Mutex; 30 DimService *DIM_Name, *DIM_Status, *DIM_ID, *DIM_Frequency ;31 DimService *DIM_Rate, *DIM_Temp, *DIM_ROI, *DIM_DAC ;30 DimService *DIM_Name, *DIM_Status, *DIM_ID, *DIM_Frequency, *DIM_TriggerNum; 31 DimService *DIM_Rate, *DIM_Temp, *DIM_ROI, *DIM_DAC, *DIM_ACalData; 32 32 33 33 void ReadLoop(); … … 51 51 float Rate; 52 52 53 uint32_t Trigger ID;53 uint32_t TriggerNum; 54 54 uint32_t Runnumber; 55 55 uint16_t TriggerType; … … 85 85 } ACalib; 86 86 87 float ACalData[3][NChips][NChannels][NBins]; // for DIM service 88 87 89 void Send(const void *, size_t); 88 90 void Send(unsigned short);
Note:
See TracChangeset
for help on using the changeset viewer.