- Timestamp:
- 06/09/11 19:42:29 (13 years ago)
- Location:
- trunk/FACT++/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r10953 r10959 278 278 } 279 279 280 char *GetObjectInfo(Int_t px, Int_t py) const280 char *GetObjectInfo(Int_t px, Int_t py) const 281 281 { 282 282 static stringstream stream; … … 290 290 stream.seekp(0); 291 291 if (idx>=0) 292 stream << "Pixel=" << idx << "(" <</* fMapHW[idx] <<*/ ") Data=" << fData[idx] << '\0'; 292 { 293 stream << "Pixel=" << idx << " Data=" << fData[idx] << '\0'; 294 } 293 295 294 296 str = stream.str(); … … 330 332 valarray<int8_t> fFtuStatus; 331 333 332 // vector<int> fMapHW; // Software -> Hardware 333 // map<int,int> fMapSW; // Hardware -> Software 334 vector<int> fPixelMapHW; // Software -> Hardware 335 vector<int> fPatchMapHW; // Software -> Hardware 336 337 bool fInChoosePatch; // FIXME. Find a better solution 334 338 335 339 DimStampedInfo fDimDNS; … … 1152 1156 1153 1157 if (fThresholdIdx->value()>=0) 1154 fPatchRate->setValue(sdata.fRatePatch[fThresholdIdx->value()]); 1158 { 1159 const int isw = fThresholdIdx->value(); 1160 const int ihw = fPatchMapHW[isw]; 1161 fPatchRate->setValue(sdata.fRatePatch[ihw]); 1162 } 1155 1163 1156 1164 valarray<double> dat(0., 1440); 1157 1165 1166 // fPatch converts from software id to software patch id 1158 1167 for (int i=0; i<1440; i++) 1159 1168 dat[i] = sdata.fRatePatch[fPatch[i]]; … … 1321 1330 #ifdef HAVE_ROOT 1322 1331 Camera *cam = (Camera*)fRatesCanv->GetCanvas()->FindObject("Camera"); 1323 for (int i=0; i<1440; i++) 1324 cam->SetEnable(i, sdata.IsEnabled(i)); 1332 for (int isw=0; isw<1440; isw++) 1333 { 1334 const int ihw = fPixelMapHW[isw]; 1335 cam->SetEnable(isw, sdata.IsEnabled(ihw)); 1336 } 1325 1337 1326 1338 fRatesCanv->GetCanvas()->Modified(); … … 1328 1340 #endif 1329 1341 1330 fPixelEnable->setChecked(sdata.IsEnabled(fPixelIdx->value())); 1331 1332 1333 1334 const int patch1 = fThresholdIdx->value(); 1335 if (patch1>=0) 1336 fThresholdVal->setValue(sdata.fThreshold[patch1]); 1342 { 1343 const int isw = fPixelIdx->value(); 1344 const int ihw = fPixelMapHW[isw]; 1345 const bool on = sdata.IsEnabled(ihw); 1346 fPixelEnable->setChecked(on); 1347 } 1348 1349 if (fThresholdIdx->value()>=0) 1350 { 1351 const int isw = fThresholdIdx->value(); 1352 const int ihw = fPatchMapHW[isw]; 1353 fThresholdVal->setValue(sdata.fThreshold[ihw]); 1354 } 1337 1355 1338 1356 fPrescalingVal->setValue(sdata.fPrescaling[0]); … … 1837 1855 1838 1856 Camera *cam = static_cast<Camera*>(obj); 1839 const int idx = cam->GetIdx(xx, yy); 1840 1841 cout << "Select: " << idx << endl; 1842 1843 fPixelIdx->setValue(idx); 1844 ChoosePixel(*cam, idx); 1845 1857 const int isw = cam->GetIdx(xx, yy); 1858 1859 fPixelIdx->setValue(isw); 1860 ChoosePixel(*cam, isw); 1846 1861 } 1847 1862 return; … … 1856 1871 1857 1872 Camera *cam = static_cast<Camera*>(obj); 1858 const int i dx= cam->GetIdx(xx, yy);1859 1860 cout << "Toggle: " << idx << endl;1861 1862 ChoosePixel(*cam, idx);1863 1864 fPixelIdx->setValue(idx);1865 1866 Dim::SendCommand("FTM_CONTROL/TOGGLE_PIXEL", uint16_t(idx));1873 const int isw = cam->GetIdx(xx, yy); 1874 1875 ChoosePixel(*cam, isw); 1876 1877 fPixelIdx->setValue(isw); 1878 1879 const uint16_t ihw = fPixelMapHW[isw]; 1880 1881 Dim::SendCommand("FTM_CONTROL/TOGGLE_PIXEL", ihw); 1867 1882 } 1868 1883 … … 1899 1914 1900 1915 Camera *cam = static_cast<Camera*>(obj); 1901 int idx = fPatch[cam->GetIdx(xx, yy)]; 1902 1903 tipText+=" Patch="; 1904 tipText+=QString::number(idx); 1916 1917 const int isw = cam->GetIdx(xx, yy); 1918 const int ihw = fPixelMapHW[isw]; 1919 1920 const int idx = fPatch[isw]; 1921 1922 const int patch = ihw%4; 1923 const int board = (ihw/4)%10; 1924 const int crate = (ihw/4)/10; 1925 1926 ostringstream str; 1927 str << " HW=" << ihw << " Patch=" << idx << " (Crate=" << crate << " Board=" << board << " Patch=" << patch << ")"; 1928 1929 tipText += str.str().c_str(); 1905 1930 } 1906 1931 … … 1918 1943 } 1919 1944 1920 void ChoosePatch(Camera &cam, int i dx)1945 void ChoosePatch(Camera &cam, int isw) 1921 1946 { 1922 1947 cam.Reset(); 1923 1948 1924 fThresholdIdx->setValue(idx); 1925 1926 const int patch = idx%4; 1927 const int board = (idx/4)%10; 1928 const int crate = (idx/4)/10; 1949 fThresholdIdx->setValue(isw); 1950 1951 const int ihw = isw<0 ? 0 : fPatchMapHW[isw]; 1952 1953 fPatchRate->setEnabled(isw>=0); 1954 fThresholdCrate->setEnabled(isw>=0); 1955 fThresholdBoard->setEnabled(isw>=0); 1956 fThresholdPatch->setEnabled(isw>=0); 1957 1958 if (isw<0) 1959 return; 1960 1961 const int patch = ihw%4; 1962 const int board = (ihw/4)%10; 1963 const int crate = (ihw/4)/10; 1964 1965 fInChoosePatch = true; 1929 1966 1930 1967 fThresholdCrate->setValue(crate); … … 1932 1969 fThresholdPatch->setValue(patch); 1933 1970 1934 //fThresholdVal->setEnabled(idx>=0); 1935 //fThresholdVolt->setEnabled(idx>=0); 1936 fPatchRate->setEnabled(idx>=0); 1937 if (idx<0) 1938 return; 1939 1940 fThresholdVal->setValue(fFtmStaticData.fThreshold[idx]); 1941 fPatchRate->setValue(cam.GetData(idx)); 1971 fInChoosePatch = false; 1972 1973 fThresholdVal->setValue(fFtmStaticData.fThreshold[ihw]); 1974 fPatchRate->setValue(cam.GetData(isw)); 1942 1975 1943 1976 for (unsigned int i=0; i<fPatch.size(); i++) 1944 if (fPatch[i]==i dx)1977 if (fPatch[i]==isw) 1945 1978 cam.SetBold(i); 1946 1979 } 1947 1980 1948 void ChoosePixel(Camera &cam, int idx) 1949 { 1950 cam.SetWhite(idx); 1951 ChoosePatch(cam, fPatch[idx]); 1952 1953 fPixelEnable->setChecked(fFtmStaticData.IsEnabled(idx)); 1954 } 1955 1956 void UpdatePatch(int idx) 1981 void ChoosePixel(Camera &cam, int isw) 1982 { 1983 cam.SetWhite(isw); 1984 ChoosePatch(cam, fPatch[isw]); 1985 1986 const int ihw = fPixelMapHW[isw]; 1987 const bool on = fFtmStaticData.IsEnabled(ihw); 1988 fPixelEnable->setChecked(on); 1989 } 1990 1991 void UpdatePatch(int isw) 1957 1992 { 1958 1993 Camera *cam = (Camera*)fRatesCanv->GetCanvas()->FindObject("Camera"); 1959 ChoosePatch(*cam, idx); 1960 } 1961 1962 void on_fThresholdIdx_valueChanged(int idx) 1963 { 1964 UpdatePatch(idx); 1994 ChoosePatch(*cam, isw); 1995 } 1996 1997 void on_fThresholdIdx_valueChanged(int isw) 1998 { 1999 UpdatePatch(isw); 2000 2001 fRatesCanv->GetCanvas()->Modified(); 2002 fRatesCanv->GetCanvas()->Update(); 1965 2003 } 1966 2004 1967 2005 void UpdateThresholdIdx() 1968 2006 { 2007 if (fInChoosePatch) 2008 return; 2009 1969 2010 const int crate = fThresholdCrate->value(); 1970 2011 const int board = fThresholdBoard->value(); 1971 2012 const int patch = fThresholdPatch->value(); 1972 2013 1973 const int id = patch + board*4 + crate*40; 1974 1975 UpdatePatch(id); 2014 const int ihw = patch + board*4 + crate*40; 2015 2016 int isw = 0; 2017 for (; isw<160; isw++) 2018 if (ihw==fPatchMapHW[isw]) 2019 break; 2020 2021 UpdatePatch(isw); 1976 2022 } 1977 2023 … … 1989 2035 } 1990 2036 1991 void on_fPixelIdx_valueChanged(int i dx)2037 void on_fPixelIdx_valueChanged(int isw) 1992 2038 { 1993 2039 Camera *cam = (Camera*)fRatesCanv->GetCanvas()->FindObject("Camera"); 1994 ChoosePixel(*cam, i dx);2040 ChoosePixel(*cam, isw); 1995 2041 1996 2042 fRatesCanv->GetCanvas()->Modified(); … … 1998 2044 } 1999 2045 #endif 2046 2047 void on_fPixelEnable_stateChanged(int b) 2048 { 2049 if (fInHandler) 2050 return; 2051 2052 const uint16_t isw = fPixelIdx->value(); 2053 const uint16_t ihw = fPixelMapHW[isw]; 2054 2055 Dim::SendCommand(b==Qt::Unchecked ? 2056 "FTM_CONTROL/DISABLE_PIXEL" : "FTM_CONTROL/ENABLE_PIXEL", 2057 ihw); 2058 } 2059 2060 void on_fPixelDisableOthers_clicked() 2061 { 2062 const uint16_t isw = fPixelIdx->value(); 2063 const uint16_t ihw = fPixelMapHW[isw]; 2064 2065 Dim::SendCommand("FTM_CONTROL/DISABLE_ALL_PIXELS_EXCEPT", ihw); 2066 } 2067 2068 void on_fThresholdVal_valueChanged(int v) 2069 { 2070 fThresholdVolt->setValue(2500./4095*v); 2071 2072 const int32_t isw = fThresholdIdx->value(); 2073 const int32_t ihw = fPatchMapHW[isw]; 2074 2075 const int32_t d[2] = { ihw, v }; 2076 2077 if (!fInHandler) 2078 Dim::SendCommand("FTM_CONTROL/SET_THRESHOLD", d); 2079 } 2000 2080 2001 2081 TGraph fGraphFtmTemp[4]; … … 2033 2113 public: 2034 2114 FactGui() : 2035 fFtuStatus(40), //fMapHW(1440) 2115 fFtuStatus(40), fPixelMapHW(1440), fPatchMapHW(160), 2116 fInChoosePatch(false), 2036 2117 fDimDNS("DIS_DNS/VERSION_NUMBER", 1, int(0), this), 2037 2118 … … 2091 2172 2092 2173 // -------------------------------------------------------------------------- 2093 /* 2094 ifstream fin2(" FACTmapV3.txt");2174 2175 ifstream fin2("MasterList-v3.txt"); 2095 2176 2096 2177 l = 0; … … 2102 2183 continue; 2103 2184 2104 int softid, hardid, geom_i, geom_j, gapd; 2185 int softid, hardid, dummy; 2186 2187 stringstream str(buf); 2188 2189 str >> softid; 2190 str >> dummy; 2191 str >> hardid; 2192 2193 fPixelMapHW[softid] = hardid; 2194 2195 l++; 2196 } 2197 2198 // -------------------------------------------------------------------------- 2199 2200 ifstream fin3("PatchList.txt"); 2201 2202 l = 0; 2203 2204 while (getline(fin3, buf, '\n')) 2205 { 2206 buf = Tools::Trim(buf); 2207 if (buf[0]=='#') 2208 continue; 2209 2210 int softid, hardid; 2105 2211 2106 2212 stringstream str(buf); … … 2108 2214 str >> softid; 2109 2215 str >> hardid; 2110 str >> geom_i; 2111 str >> geom_j; 2112 str >> gapd; 2113 2114 fMapHW[softid] = hardid; 2115 fMapSW[hardid] = softid; 2216 2217 fPatchMapHW[softid] = hardid-1; 2116 2218 2117 2219 l++; 2118 2220 } 2119 */ 2221 2120 2222 // -------------------------------------------------------------------------- 2121 2223 #ifdef HAVE_ROOT … … 2201 2303 cam->Draw(); 2202 2304 2203 ChoosePixel(*cam, 1);2305 ChoosePixel(*cam, 0); 2204 2306 2205 2307 // QTimer::singleShot(0, this, SLOT(slot_RootUpdate())); -
trunk/FACT++/gui/MainWindow.cc
r10953 r10959 205 205 } 206 206 207 void MainWindow::on_fThresholdVal_valueChanged(int v)208 {209 fThresholdVolt->setValue(2500./4095*v);210 211 const int32_t d[2] = { fThresholdIdx->value(), v };212 213 if (!fInHandler)214 Dim::SendCommand("FTM_CONTROL/SET_THRESHOLD", d);215 }216 217 207 void MainWindow::on_fTriggerInterval_valueChanged(int val) 218 208 { … … 245 235 } 246 236 247 void MainWindow::on_fPixelEnable_stateChanged(int b) 248 { 249 if (!fInHandler) 250 Dim::SendCommand(b==Qt::Unchecked ? 251 "FTM_CONTROL/DISABLE_PIXEL" : "FTM_CONTROL/ENABLE_PIXEL", 252 uint16_t(fPixelIdx->value())); 253 } 254 255 void MainWindow::on_fPixelDisableOthers_clicked() 256 { 257 Dim::SendCommand("FTM_CONTROL/DISABLE_ALL_PIXELS_EXCEPT", 258 uint16_t(fPixelIdx->value())); 237 void MainWindow::on_fPixelEnableAll_clicked() 238 { 239 Dim::SendCommand("FTM_CONTROL/ENABLE_PIXEL", int16_t(-1)); 240 } 241 242 void MainWindow::on_fPixelDisableAll_clicked() 243 { 244 Dim::SendCommand("FTM_CONTROL/DISABLE_PIXEL", int16_t(-1)); 259 245 } 260 246 -
trunk/FACT++/gui/design.ui
r10953 r10959 2491 2491 </item> 2492 2492 <item> 2493 <layout class="QHBoxLayout" name="horizontalLayout_24"> 2494 <property name="topMargin"> 2495 <number>0</number> 2496 </property> 2497 <item> 2498 <widget class="QPushButton" name="fPixelEnableAll"> 2499 <property name="text"> 2500 <string>Enable all</string> 2501 </property> 2502 </widget> 2503 </item> 2504 <item> 2505 <widget class="QPushButton" name="fPixelDisableAll"> 2506 <property name="text"> 2507 <string>Disable all</string> 2508 </property> 2509 </widget> 2510 </item> 2511 </layout> 2512 </item> 2513 <item> 2493 2514 <layout class="QHBoxLayout" name="horizontalLayout_22"> 2494 2515 <property name="topMargin"> 2495 2516 <number>0</number> 2496 2517 </property> 2497 <item>2498 <spacer name="horizontalSpacer_29">2499 <property name="orientation">2500 <enum>Qt::Horizontal</enum>2501 </property>2502 <property name="sizeType">2503 <enum>QSizePolicy::Minimum</enum>2504 </property>2505 <property name="sizeHint" stdset="0">2506 <size>2507 <width>40</width>2508 <height>20</height>2509 </size>2510 </property>2511 </spacer>2512 </item>2513 2518 <item> 2514 2519 <widget class="QPushButton" name="fPixelDisableOthers"> … … 2558 2563 </property> 2559 2564 <property name="maximum"> 2560 <number>1 438</number>2565 <number>159</number> 2561 2566 </property> 2562 2567 <property name="value"> … … 2570 2575 <number>0</number> 2571 2576 </property> 2572 <item>2573 <spacer name="horizontalSpacer_31">2574 <property name="orientation">2575 <enum>Qt::Horizontal</enum>2576 </property>2577 <property name="sizeType">2578 <enum>QSizePolicy::Minimum</enum>2579 </property>2580 <property name="sizeHint" stdset="0">2581 <size>2582 <width>40</width>2583 <height>20</height>2584 </size>2585 </property>2586 </spacer>2587 </item>2588 2577 <item> 2589 2578 <widget class="QPushButton" name="fThresholdDisableOthers">
Note:
See TracChangeset
for help on using the changeset viewer.