Rev 167 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 167 | Rev 172 | ||
|---|---|---|---|
| Line 595... | Line 595... | ||
| 595 | /* if( (gScopeDaq->scopeUseType == 1) && (sCamaclink->IsDown()) ) |
595 | /* if( (gScopeDaq->scopeUseType == 1) && (sCamaclink->IsDown()) ) |
| 596 | StartScopeAcq();*/ // TODO |
596 | StartScopeAcq();*/ // TODO |
| 597 | } |
597 | } |
| 598 | meas_data->Fill(); |
598 | meas_data->Fill(); |
| 599 | n++; |
599 | n++; |
| 600 | sleep(1); |
- | |
| 601 | 600 | ||
| 602 | // Start making a scope measurement |
601 | // Start making a scope measurement |
| 603 | /* if( (gScopeDaq->scopeUseType == 2) && (sCamaclink->IsDown()) ) |
602 | /* if( (gScopeDaq->scopeUseType == 2) && (sCamaclink->IsDown()) ) |
| 604 | { |
603 | { |
| 605 | StartScopeAcq(); |
604 | StartScopeAcq(); |
| Line 1203... | Line 1202... | ||
| 1203 | 1202 | ||
| 1204 | sprintf(cmd, "sudo %s/src/MIKRO/mikro_ctrl -n 3 -r && sudo %s/src/MIKRO/mikro_ctrl -n 3 -i 3 && sudo %s/src/MIKRO/mikro_ctrl -n 3 -h", rootdir, rootdir, rootdir); // Z-axis |
1203 | sprintf(cmd, "sudo %s/src/MIKRO/mikro_ctrl -n 3 -r && sudo %s/src/MIKRO/mikro_ctrl -n 3 -i 3 && sudo %s/src/MIKRO/mikro_ctrl -n 3 -h", rootdir, rootdir, rootdir); // Z-axis |
| 1205 | #if WORKSTAT == 'I' |
1204 | #if WORKSTAT == 'I' |
| 1206 | retTemp = system(cmd); |
1205 | retTemp = system(cmd); |
| 1207 | printf("Positioning table reset, initialization and homing complete.\n"); |
1206 | printf("Positioning table reset, initialization and homing complete.\n"); |
| - | 1207 | #else |
|
| - | 1208 | printf("Cmd: %s\n",cmd); |
|
| - | 1209 | #endif |
|
| - | 1210 | PositionSet(1); |
|
| - | 1211 | } |
|
| - | 1212 | // Abort any motion |
|
| - | 1213 | else if(opt == 4) |
|
| - | 1214 | { |
|
| - | 1215 | sprintf(cmd, "sudo %s/src/MIKRO/mikro_ctrl -n 1 -c ab", rootdir); // X-axis |
|
| - | 1216 | #if WORKSTAT == 'I' |
|
| - | 1217 | printf("Emergency stop of the current movement of all linear tables.\n"); |
|
| - | 1218 | retTemp = system(cmd); |
|
| - | 1219 | #else |
|
| - | 1220 | printf("Cmd: %s\n",cmd); |
|
| - | 1221 | #endif |
|
| - | 1222 | ||
| - | 1223 | sprintf(cmd, "sudo %s/src/MIKRO/mikro_ctrl -n 2 -c ab", rootdir); // Y-axis |
|
| - | 1224 | #if WORKSTAT == 'I' |
|
| - | 1225 | retTemp = system(cmd); |
|
| - | 1226 | #else |
|
| - | 1227 | printf("Cmd: %s\n",cmd); |
|
| - | 1228 | #endif |
|
| - | 1229 | ||
| - | 1230 | sprintf(cmd, "sudo %s/src/MIKRO/mikro_ctrl -n 3 -c ab", rootdir); // Z-axis |
|
| - | 1231 | #if WORKSTAT == 'I' |
|
| - | 1232 | retTemp = system(cmd); |
|
| 1208 | #else |
1233 | #else |
| 1209 | printf("Cmd: %s\n",cmd); |
1234 | printf("Cmd: %s\n",cmd); |
| 1210 | #endif |
1235 | #endif |
| 1211 | PositionSet(1); |
1236 | PositionSet(1); |
| 1212 | } |
1237 | } |
| Line 1289... | Line 1314... | ||
| 1289 | retTemp = system(cmd); |
1314 | retTemp = system(cmd); |
| 1290 | sleep(15); // wait for the motor to change position from wherever to 0 |
1315 | sleep(15); // wait for the motor to change position from wherever to 0 |
| 1291 | sprintf(cmd, "sudo %s/src/MIKRO/mikro_ctrl -n 4 -r && sudo %s/src/MIKRO/mikro_ctrl -n 4 -i 2", rootdir, rootdir); |
1316 | sprintf(cmd, "sudo %s/src/MIKRO/mikro_ctrl -n 4 -r && sudo %s/src/MIKRO/mikro_ctrl -n 4 -i 2", rootdir, rootdir); |
| 1292 | retTemp = system(cmd); |
1317 | retTemp = system(cmd); |
| 1293 | printf("Rotation platform reset, initalization and homing complete.\n"); |
1318 | printf("Rotation platform reset, initalization and homing complete.\n"); |
| - | 1319 | #else |
|
| - | 1320 | printf("Cmd: %s\n",cmd); |
|
| - | 1321 | #endif |
|
| - | 1322 | RotationSet(1); |
|
| - | 1323 | } |
|
| - | 1324 | // Abort any motion |
|
| - | 1325 | else if(opt == 4) |
|
| - | 1326 | { |
|
| - | 1327 | sprintf(cmd, "sudo %s/src/MIKRO/mikro_ctrl -n 4 -c ab", rootdir); |
|
| - | 1328 | #if WORKSTAT == 'I' |
|
| - | 1329 | printf("Emergency stop of the current movement of the rotation platform.\n"); |
|
| - | 1330 | retTemp = system(cmd); |
|
| 1294 | #else |
1331 | #else |
| 1295 | printf("Cmd: %s\n",cmd); |
1332 | printf("Cmd: %s\n",cmd); |
| 1296 | #endif |
1333 | #endif |
| 1297 | RotationSet(1); |
1334 | RotationSet(1); |
| 1298 | } |
1335 | } |
| 1299 | } |
1336 | } |
| 1300 | 1337 | ||
| 1301 | // File browser for selecting the save file |
1338 | // File browser for selecting the save file |
| 1302 | void TGAppMainFrame::SaveFile() |
1339 | void TGAppMainFrame::SaveFile() |
| 1303 | { |
1340 | { |
| - | 1341 | // char *cTemp; |
|
| - | 1342 | ||
| 1304 | TGFileInfo file_info; |
1343 | TGFileInfo file_info; |
| 1305 | const char *filetypes[] = {"Histograms",histextall,0,0}; |
1344 | const char *filetypes[] = {"Histograms",histextall,0,0}; |
| 1306 | char *cTemp; |
- | |
| 1307 | file_info.fFileTypes = filetypes; |
1345 | file_info.fFileTypes = filetypes; |
| 1308 |
|
1346 | // cTemp = new char[1024]; |
| 1309 |
|
1347 | // sprintf(cTemp, "%s/results", rootdir); |
| 1310 |
|
1348 | // file_info.fIniDir = StrDup(cTemp); |
| - | 1349 | file_info.fIniDir = StrDup(currentMeasDir); |
|
| 1311 | new TGFileDialog(gClient->GetDefaultRoot(), fMain, kFDSave, &file_info); |
1350 | new TGFileDialog(gClient->GetDefaultRoot(), fMain, kFDSave, &file_info); |
| 1312 |
|
1351 | // delete[] cTemp; |
| 1313 | 1352 | ||
| 1314 | if(file_info.fFilename != NULL) |
1353 | if(file_info.fFilename != NULL) |
| - | 1354 | { |
|
| 1315 | fileName->widgetTE->SetText(file_info.fFilename); |
1355 | fileName->widgetTE->SetText(file_info.fFilename); |
| - | 1356 | remove_from_last(file_info.fFilename, '/', currentMeasDir); |
|
| - | 1357 | } |
|
| 1316 | } |
1358 | } |
| 1317 | 1359 | ||
| 1318 | // Start the acquisition |
1360 | // Start the acquisition |
| 1319 | void TGAppMainFrame::StartAcq() |
1361 | void TGAppMainFrame::StartAcq() |
| 1320 | { |
1362 | { |
| Line 1390... | Line 1432... | ||
| 1390 | // If step is not correctly set, stop the acqusition |
1432 | // If step is not correctly set, stop the acqusition |
| 1391 | else |
1433 | else |
| 1392 | { |
1434 | { |
| 1393 | // TODO |
1435 | // TODO |
| 1394 | printf("Stopping current voltage scan...\n"); |
1436 | printf("Stopping current voltage scan...\n"); |
| 1395 | gROOT->SetInterrupt(); |
1437 | gROOT->SetInterrupt(); |
| 1396 | measProgress->widgetTB[0]->SetText("Start acquisition"); |
1438 | measProgress->widgetTB[0]->SetText("Start acquisition"); |
| 1397 | acqStarted = false; |
1439 | acqStarted = false; |
| 1398 | repetition = 0; |
1440 | repetition = 0; |
| 1399 | } |
1441 | } |
| 1400 | } |
1442 | } |
| 1401 | 1443 | ||
| 1402 | if(DBGSIG) printf("StartAcq(): Voltage repetition (%lf,%lf,%lf) = %d\n", minVoltage, maxVoltage, stepVoltage, repetition); |
1444 | if(DBGSIG) printf("StartAcq(): Voltage repetition (%lf,%lf,%lf) = %d\n", minVoltage, maxVoltage, stepVoltage, repetition); |
| Line 1602... | Line 1644... | ||
| 1602 | measProgress->widgetTB[0]->SetText("Stop acquisition"); |
1644 | measProgress->widgetTB[0]->SetText("Stop acquisition"); |
| 1603 | acqStarted = true; |
1645 | acqStarted = true; |
| 1604 | progVal = 0.00; |
1646 | progVal = 0.00; |
| 1605 | measProgress->widgetPB->SetPosition(progVal); |
1647 | measProgress->widgetPB->SetPosition(progVal); |
| 1606 | gVirtualX->Update(1); |
1648 | gVirtualX->Update(1); |
| - | 1649 | ||
| - | 1650 | int nrAverMeas = -1; |
|
| 1607 | 1651 | ||
| 1608 | clkt0 = clock(); |
1652 | clkt0 = clock(); |
| 1609 | timet0 = time(NULL); |
1653 | timet0 = time(NULL); |
| 1610 | 1654 | ||
| 1611 | // Scan over Z axis |
1655 | // Scan over Z axis |
| Line 1666... | Line 1710... | ||
| 1666 | else if( repetX == 0 ) break; |
1710 | else if( repetX == 0 ) break; |
| 1667 | 1711 | ||
| 1668 | progVal = (float)(100.00/(abs(repetX)*abs(repetY)*abs(repetZ)))*(k*abs(repetX)*abs(repetY) + j*abs(repetX) + i); |
1712 | progVal = (float)(100.00/(abs(repetX)*abs(repetY)*abs(repetZ)))*(k*abs(repetX)*abs(repetY) + j*abs(repetX) + i); |
| 1669 | measProgress->widgetPB->SetPosition(progVal); |
1713 | measProgress->widgetPB->SetPosition(progVal); |
| 1670 | 1714 | ||
| 1671 |
|
1715 | // TimeEstimate(clkt0, timet0, progVal, cmd, doublewait*((abs(repetX)+2)*abs(repetY)+2)*abs(repetZ)); |
| 1672 |
|
1716 | // measProgress->widgetTE->SetText(cmd); |
| 1673 | 1717 | ||
| 1674 | gVirtualX->Update(1); |
1718 | gVirtualX->Update(1); |
| 1675 | 1719 | ||
| 1676 | // X-axis change |
1720 | // X-axis change |
| 1677 | if( posUnits->widgetCB->GetSelected() == 0) |
1721 | if( posUnits->widgetCB->GetSelected() == 0) |
| Line 1685... | Line 1729... | ||
| 1685 | #endif |
1729 | #endif |
| 1686 | fflush(stdout); |
1730 | fflush(stdout); |
| 1687 | 1731 | ||
| 1688 | printf("Next X position...\n"); |
1732 | printf("Next X position...\n"); |
| 1689 | fflush(stdout); |
1733 | fflush(stdout); |
| - | 1734 | ||
| - | 1735 | TimeEstimateNew(nrAverMeas, clkt0, timet0, repetX, repetY, repetZ, doublewait, 2*doublewait, 2*doublewait, cmd); |
|
| - | 1736 | measProgress->widgetTE->SetText(cmd); |
|
| 1690 | 1737 | ||
| 1691 | printf("Waiting for position change...\n"); |
1738 | printf("Waiting for position change...\n"); |
| 1692 | sleep(doublewait); |
1739 | sleep(doublewait); |
| 1693 | xPos->widgetNE[0]->SetNumber(minXpos + stepXpos*i); |
1740 | xPos->widgetNE[0]->SetNumber(minXpos + stepXpos*i); |
| 1694 | printf("Continuing...\n"); |
1741 | printf("Continuing...\n"); |
| 1695 | 1742 | ||
| 1696 | // Here comes function to start histogramming <<<<<<<<<<<<<<<<<<<<<<<< |
1743 | // Here comes function to start histogramming <<<<<<<<<<<<<<<<<<<<<<<< |
| - | 1744 | clkt0 = clock(); |
|
| 1697 | RunMeas((void*)0, (j*repetX + i), scanon); |
1745 | RunMeas((void*)0, (j*repetX + i), scanon); |
| 1698 | 1746 | nrAverMeas++; |
|
| 1699 | fflush(stdout); |
1747 | fflush(stdout); |
| 1700 | 1748 | ||
| 1701 | i++; |
1749 | i++; |
| 1702 | } |
1750 | } |
| 1703 | 1751 | ||
| Line 1967... | Line 2015... | ||
| 1967 | const char *filetypes[] = {"Histograms",histextall,0,0}; |
2015 | const char *filetypes[] = {"Histograms",histextall,0,0}; |
| 1968 | file_info.fFileTypes = filetypes; |
2016 | file_info.fFileTypes = filetypes; |
| 1969 | // cTemp = new char[1024]; |
2017 | // cTemp = new char[1024]; |
| 1970 | // sprintf(cTemp, "%s/results", rootdir); |
2018 | // sprintf(cTemp, "%s/results", rootdir); |
| 1971 | // file_info.fIniDir = StrDup(cTemp); |
2019 | // file_info.fIniDir = StrDup(cTemp); |
| 1972 | file_info.fIniDir = StrDup( |
2020 | file_info.fIniDir = StrDup(currentAnalDir); |
| 1973 | file_info.fMultipleSelection = kTRUE; |
2021 | file_info.fMultipleSelection = kTRUE; |
| 1974 | new TGFileDialog(gClient->GetDefaultRoot(), fMain, kFDOpen, &file_info); |
2022 | new TGFileDialog(gClient->GetDefaultRoot(), fMain, kFDOpen, &file_info); |
| 1975 | // delete[] cTemp; |
2023 | // delete[] cTemp; |
| 1976 | 2024 | ||
| 1977 | TList *files = file_info.fFileNamesList; |
2025 | TList *files = file_info.fFileNamesList; |
| Line 1981... | Line 2029... | ||
| 1981 | TString fname; |
2029 | TString fname; |
| 1982 | TIter next(files); |
2030 | TIter next(files); |
| 1983 | while(file=(TSystemFile*)next()) |
2031 | while(file=(TSystemFile*)next()) |
| 1984 | { |
2032 | { |
| 1985 | fname = file->GetName(); |
2033 | fname = file->GetName(); |
| 1986 | remove_from_last((char*)fname.Data(), '/', |
2034 | remove_from_last((char*)fname.Data(), '/', currentAnalDir); |
| 1987 | fileList->AddEntry(fname.Data(), i); |
2035 | fileList->AddEntry(fname.Data(), i); |
| 1988 | i++; |
2036 | i++; |
| 1989 | } |
2037 | } |
| 1990 | } |
2038 | } |
| 1991 | fileList->Layout(); |
2039 | fileList->Layout(); |