Changeset 10750
- Timestamp:
- 05/19/11 08:55:18 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r10733 r10750 14 14 #include "CheckBoxDelegate.h" 15 15 16 #include "src/Dim.h" 16 17 #include "src/Converter.h" 17 18 #include "src/HeadersFTM.h" 19 #include "src/HeadersFAD.h" 18 20 #include "src/DimNetwork.h" 19 21 #include "src/tools.h" … … 143 145 void SetEnable(int idx, bool b) { fEnable[idx]=b; } 144 146 void Toggle(int idx) { fEnable[idx]=!fEnable[idx]; } 147 double GetData(int idx) const { return fData[idx]; } 145 148 146 149 const char *GetName() const { return "Camera"; } … … 341 344 DimStampedInfo fDimFtmDynamicData; 342 345 DimStampedInfo fDimFtmCounter; 346 347 DimStampedInfo fDimFadPassport; 348 DimStampedInfo fDimFadTemperatures; 349 DimStampedInfo fDimFadSetup; 343 350 344 351 map<string, DimInfo*> fServices; … … 849 856 } 850 857 858 // ===================== FAD ============================================ 859 860 void handleFadPassport(const DimData &d) 861 { 862 if (d.size()==0) 863 return; 864 865 if (d.size()!=sizeof(FAD::DimPassport)) 866 { 867 cout << "Size mismatch: " << d.size() << " " << sizeof(FAD::DimPassport) << endl; 868 return; 869 } 870 871 const FAD::DimPassport &sdata = *reinterpret_cast<const FAD::DimPassport*>(d.ptr()); 872 873 stringstream str1; 874 str1 << hex << "0x" << setfill('0') << setw(16) << sdata.fDNA; 875 876 fFadVersion->setValue(sdata.fVersion); 877 fFadBoardId->setValue(sdata.fBoardId); 878 fFadDNA->setText(str1.str().c_str()); 879 } 880 881 void handleFadTemperatures(const DimData &d) 882 { 883 if (d.size()==0) 884 return; 885 886 if (d.size()!=sizeof(FAD::DimTemperatures)) 887 { 888 cout << "Size mismatch: " << d.size() << " " << sizeof(FAD::DimTemperatures) << endl; 889 return; 890 } 891 892 const FAD::DimTemperatures &sdata = *reinterpret_cast<const FAD::DimTemperatures*>(d.ptr()); 893 894 fFadTemp0->setValue(sdata.fTempDrs[0]); 895 fFadTemp1->setValue(sdata.fTempDrs[1]); 896 fFadTemp2->setValue(sdata.fTempDrs[2]); 897 fFadTemp3->setValue(sdata.fTempDrs[3]); 898 } 899 900 void handleFadSetup(const DimData &d) 901 { 902 if (d.size()==0) 903 return; 904 905 if (d.size()!=sizeof(FAD::DimSetup)) 906 { 907 cout << "Size mismatch: " << d.size() << " " << sizeof(FAD::DimSetup) << endl; 908 return; 909 } 910 911 912 } 913 851 914 // ===================== FTM ============================================ 852 915 … … 904 967 const double t0 = h->GetXaxis()->GetXmin(); 905 968 906 h->SetBins(h->GetNbinsX()+1, t0, t0+sdata.fT riggerCounter+1);969 h->SetBins(h->GetNbinsX()+1, t0, t0+sdata.fTimeStamp+1); 907 970 fGraphFtmRate.SetPoint(fGraphFtmRate.GetN(), 908 t0+sdata.fT riggerCounter, rate);971 t0+sdata.fTimeStamp, rate); 909 972 910 973 if (t1-t0>60) … … 945 1008 946 1009 int64_t fTriggerCounter0; 1010 int64_t fTimeStamp0; 947 1011 948 1012 void handleFtmDynamicData(const DimData &d) … … 992 1056 // ---------------------------------------------- 993 1057 1058 if (fTimeStamp0<0) 1059 { 1060 fTimeStamp0 = sdata.fTimeStamp; 1061 return; 1062 } 1063 1064 TCanvas *c = fFtmRateCanv->GetCanvas(); 1065 1066 TH1 *h = (TH1*)c->FindObject("TimeFrame"); 1067 1068 const double tdiff = sdata.fTimeStamp-fTimeStamp0; 1069 fTimeStamp0 = sdata.fTimeStamp; 1070 1071 if (tdiff<0) 1072 { 1073 for (int i=0; i<160; i++) 1074 fGraphPatchRate[i].Set(0); 1075 for (int i=0; i<40; i++) 1076 fGraphBoardRate[i].Set(0); 1077 1078 return; 1079 } 1080 1081 const double t1 = h->GetXaxis()->GetXmax(); 1082 const double t0 = h->GetXaxis()->GetXmin(); 1083 1084 for (int i=0; i<160; i++) 1085 fGraphPatchRate[i].SetPoint(fGraphPatchRate[i].GetN(), 1086 t0+sdata.fTimeStamp, float(sdata.fRatePatch[i])/fFtmStaticData.fPrescaling[i]/1000); 1087 for (int i=0; i<40; i++) 1088 fGraphBoardRate[i].SetPoint(fGraphBoardRate[i].GetN(), 1089 t0+sdata.fTimeStamp, float(sdata.fRateBoard[i])/fFtmStaticData.fPrescaling[i]/1000); 1090 1091 c->Modified(); 1092 c->Update(); 1093 1094 // ---------------------------------------------- 1095 1096 if (fThresholdIdx->value()>=0) 1097 fPatchRate->setValue(sdata.fRatePatch[fThresholdIdx->value()]); 1098 994 1099 valarray<double> dat(0., 1440); 995 1100 … … 997 1102 dat[i] = sdata.fRatePatch[fPatch[i]]; 998 1103 999 TCanvas *c = fRatesCanv->GetCanvas();1104 c = fRatesCanv->GetCanvas(); 1000 1105 Camera *cam = (Camera*)c->FindObject("Camera"); 1001 1106 … … 1005 1110 c->Update(); 1006 1111 #endif 1112 } 1113 1114 void DisplayRates() 1115 { 1116 #ifdef HAVE_ROOT 1117 TCanvas *c = fFtmRateCanv->GetCanvas(); 1118 1119 while (c->FindObject("PatchRate")) 1120 c->GetListOfPrimitives()->Remove(c->FindObject("PatchRate")); 1121 1122 while (c->FindObject("BoardRate")) 1123 c->GetListOfPrimitives()->Remove(c->FindObject("BoardRate")); 1124 1125 if (fRatePatch1->value()>=0) 1126 fGraphPatchRate[fRatePatch1->value()].Draw("PL"); 1127 if (fRatePatch2->value()>=0) 1128 fGraphPatchRate[fRatePatch2->value()].Draw("PL"); 1129 if (fRateBoard1->value()>=0) 1130 fGraphBoardRate[fRateBoard1->value()].Draw("PL"); 1131 if (fRateBoard2->value()>=0) 1132 fGraphBoardRate[fRateBoard2->value()].Draw("PL"); 1133 #endif 1134 } 1135 1136 void on_fRatePatch1_valueChanged(int idx) 1137 { 1138 DisplayRates(); 1139 } 1140 1141 void on_fRatePatch2_valueChanged(int idx) 1142 { 1143 DisplayRates(); 1144 } 1145 1146 void on_fRateBoard1_valueChanged(int idx) 1147 { 1148 DisplayRates(); 1149 } 1150 1151 void on_fRateBoard2_valueChanged(int idx) 1152 { 1153 DisplayRates(); 1007 1154 } 1008 1155 … … 1096 1243 fEnableExt1->setChecked(sdata.HasExt1()); 1097 1244 fEnableExt2->setChecked(sdata.HasExt2()); 1098 fEnable TimeMarker->setChecked(sdata.HasTimeMarker());1245 fEnableClockCond->setChecked(sdata.HasClockConditioner()); 1099 1246 1100 1247 for (int i=0; i<40; i++) … … 1120 1267 1121 1268 const int patch1 = fThresholdIdx->value(); 1122 fThresholdVal->setValue(sdata.fThreshold[patch1<0?0:patch1]); 1269 if (patch1>=0) 1270 fThresholdVal->setValue(sdata.fThreshold[patch1]); 1123 1271 1124 1272 fPrescalingVal->setValue(sdata.fPrescaling[0]); … … 1249 1397 fStatusFADLabel->setToolTip(s.comment.c_str()); 1250 1398 1251 if (s.index<FTM::kDisconnected) // No Dim connection 1399 bool enable = false; 1400 1401 if (s.index<FAD::kDisconnected) // No Dim connection 1252 1402 SetLedColor(fStatusFADLed, kLedGray, time); 1253 if (s.index==F TM::kDisconnected) // Dim connection / FTM disconnected1403 if (s.index==FAD::kDisconnected) // Dim connection / FTM disconnected 1254 1404 SetLedColor(fStatusFADLed, kLedYellow, time); 1255 if (s.index==FTM::kConnected) // Dim connection / FTM connected 1405 if (s.index==FAD::kConnected) // Dim connection / FTM connected 1406 { 1256 1407 SetLedColor(fStatusFADLed, kLedGreen, time); 1408 enable = true; 1409 } 1410 1411 fFadWidget->setEnabled(enable); 1257 1412 } 1258 1413 … … 1476 1631 return PostInfoHandler(&FactGui::handleLoggerStats); 1477 1632 1633 if (getInfo()==&fDimFadTemperatures) 1634 return PostInfoHandler(&FactGui::handleFadTemperatures); 1635 1636 if (getInfo()==&fDimFadSetup) 1637 return PostInfoHandler(&FactGui::handleFadSetup); 1638 1478 1639 if (getInfo()==&fDimLoggerFilenameNight) 1479 1640 return PostInfoHandler(&FactGui::handleLoggerFilenameNight); … … 1574 1735 1575 1736 fThresholdIdx->setValue(idx); 1576 fThresholdVal->setValue(fFtmStaticData.fThreshold[idx<0?0:idx]); 1577 1737 1738 //fThresholdVal->setEnabled(idx>=0); 1739 //fThresholdVolt->setEnabled(idx>=0); 1740 fPatchRate->setEnabled(idx>=0); 1578 1741 if (idx<0) 1579 1742 return; 1743 1744 fThresholdVal->setValue(fFtmStaticData.fThreshold[idx]); 1745 fPatchRate->setValue(cam.GetData(idx)); 1580 1746 1581 1747 for (unsigned int i=0; i<fPatch.size(); i++) … … 1634 1800 const int idx = cam->GetIdx(xx, yy); 1635 1801 1636 cam->Toggle(idx); 1802 //cam->Toggle(idx); 1803 1804 Dim::SendCommand("FTM_CONTROL/TOGGLE_PIXEL", uint16_t(idx)); 1637 1805 } 1638 1806 return; … … 1699 1867 TGraph fGraphFtmTemp[4]; 1700 1868 TGraph fGraphFtmRate; 1869 TGraph fGraphPatchRate[160]; 1870 TGraph fGraphBoardRate[40]; 1701 1871 1702 1872 map<int, int> fPatch; … … 1723 1893 h.GetYaxis()->SetTitleOffset(1.2); 1724 1894 // h.GetYaxis()->SetTitleSize(1.2); 1725 h.DrawCopy() ;1895 h.DrawCopy()->SetDirectory(0); 1726 1896 } 1727 1897 #endif … … 1743 1913 fDimFtmStaticData ("FTM_CONTROL/STATIC_DATA", (void*)NULL, 0, this), 1744 1914 fDimFtmDynamicData ("FTM_CONTROL/DYNAMIC_DATA", (void*)NULL, 0, this), 1745 fDimFtmCounter ("FTM_CONTROL/COUNTER", (void*)NULL, 0, this) 1915 fDimFtmCounter ("FTM_CONTROL/COUNTER", (void*)NULL, 0, this), 1916 fDimFadPassport ("FAD_CONTROL/PASSPORT", (void*)NULL, 0, this), 1917 fDimFadTemperatures ("FAD_CONTROL/TEMPERATURES", (void*)NULL, 0, this), 1918 fDimFadSetup ("FAD_CONTROL/SETUP", (void*)NULL, 0, this) 1746 1919 { 1747 1920 fTriggerWidget->setEnabled(false); 1748 1921 fFtuWidget->setEnabled(false); 1749 1922 fRatesWidget->setEnabled(false); 1923 fFadWidget->setEnabled(false); 1750 1924 fLoggerWidget->setEnabled(false); 1751 1925 … … 1782 1956 // -------------------------------------------------------------------------- 1783 1957 #ifdef HAVE_ROOT 1958 1959 for (int i=0; i<160; i++) 1960 fGraphPatchRate[i].SetName("PatchRate"); 1961 for (int i=0; i<40; i++) 1962 fGraphBoardRate[i].SetName("BoardRate"); 1784 1963 /* 1785 1964 TCanvas *c = fFtmTempCanv->GetCanvas();
Note:
See TracChangeset
for help on using the changeset viewer.