Changeset 10100 for fact/FADctrl/FAD.cc
- Timestamp:
- 01/11/11 20:39:47 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/FADctrl/FAD.cc
r10099 r10100 71 71 BoardList = Tokenize(GetConfig("BoardList","129.217.160.119")); 72 72 BoardList = Tokenize("192.33.99.225"); 73 printf("%s ", BoardList[0].c_str()); 73 74 74 for (unsigned int i=0; i<BoardList.size(); i++) { 75 75 Boards.push_back(new class FADBoard(BoardList[i], 5000, this, i)); … … 689 689 690 690 // Switch off SCLK 691 Boards[Brd]->Send(CMD_SCLK_OFF);691 //Boards[Brd]->Send(CMD_SCLK_OFF); 692 692 693 693 // Start accumulation … … 705 705 } 706 706 } 707 printf("Got first average\n");708 707 709 708 for (unsigned int Brd=0; Brd<Boards.size(); Brd++) { 710 709 // Determine baseline 711 710 for (unsigned int i=0; i<NChips; i++) for (unsigned int j=0; j<NChannels; j++) { 712 for (unsigned int k=0; k<NBins; k++) Boards[Brd]->Baseline[i][j][k] = Boards[Brd]->Sum[i][j][k] / NumCalibEvents; 713 } 714 // Switch on SCLK 715 Boards[Brd]->Send(CMD_SCLK_ON); 716 711 for (unsigned int k=0; k<NBins; k++) { 712 Boards[Brd]->Baseline[i][j][k] = Boards[Brd]->Sum[i][j][k] / NumCalibEvents; 713 } 714 } 715 716 // Switch on SCLK 717 Boards[Brd]->Send(CMD_SCLK_ON); 717 718 718 719 // Set second DAC value … … 723 724 724 725 // Switch off SCLK 725 Boards[Brd]->Send(CMD_SCLK_OFF);726 //Boards[Brd]->Send(CMD_SCLK_OFF); 726 727 727 728 // Start accumulation … … 749 750 // Determine gain 750 751 for (unsigned int i=0; i<NChips; i++) for (unsigned int j=0; j<NChannels; j++) { 751 for (unsigned int k=0; k<NBins; k++) Boards[Brd]->Gain[i][j][k] = ((Boards[Brd]->Sum[i][j][k] / NumCalibEvents)-Boards[Brd]->Baseline[i][j][k])/3000; 752 for (unsigned int k=0; k<NBins; k++) { 753 Boards[Brd]->Gain[i][j][k] = (Boards[Brd]->Sum[i][j][k] / NumCalibEvents)-Boards[Brd]->Baseline[i][j][k]; 754 } 752 755 } 753 756 … … 803 806 bool Update; 804 807 struct FADBoard::BoardStatus S; 808 double Temp; 805 809 806 810 gettimeofday(&LastUpdate, NULL); … … 891 895 for (int i=0; i<S.ROI[Chip][Chan]; i++) { 892 896 if (Boards[Brd]->ACalibTime == -1) Data[Count++] = Boards[Brd]->Data[Chip][Chan][i]; 893 else Data[Count++] = (Boards[Brd]->Data[Chip][Chan][i] - Boards[Brd]->Baseline[Chip][Chan][(i+S.TriggerCell[Chip])%NBins]) * Boards[Brd]->Gain[Chip][Chan][(i+S.TriggerCell[Chip])%NBins]; 897 else { 898 //Data[Count++] = (Boards[Brd]->Data[Chip][Chan][i] - Boards[Brd]->Baseline[Chip][Chan][(i+S.TriggerCell[Chip])%NBins]) * Boards[Brd]->Gain[Chip][Chan][(i+S.TriggerCell[Chip])%NBins]; 899 Temp = (Boards[Brd]->Data[Chip][Chan][i] - Boards[Brd]->Baseline[Chip][Chan][(i+S.TriggerCell[Chip])%NBins]); 900 Temp *= Boards[Brd]->Gain[Chip][Chan][0]/Boards[Brd]->Gain[Chip][Chan][(i+S.TriggerCell[Chip])%NBins]; 901 Data[Count++] = (short) Temp; 902 } 894 903 } 895 904 Count += NBins - S.ROI[Chip][Chan];
Note:
See TracChangeset
for help on using the changeset viewer.