Changeset 13944 for trunk/FACT++/src
- Timestamp:
- 05/27/12 18:54:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r13936 r13944 40 40 41 41 // ------------------------------------------------------------------------ 42 43 const static string kHtmlWhite = "#ffffff"; 44 const static string kHtmlYellow = "#fffff0"; 45 const static string kHtmlRed = "#fff8f0"; 46 const static string kHtmlGreen = "#f0fff0"; 47 const static string kHtmlBlue = "#f0f0ff"; 42 /* 43 template<class T> 44 class buffer : public deque<T> 45 { 46 int32_t max_size; 47 48 public: 49 buffer(int32_t max=-1) : max_size(max) { } 50 const T &operator=(const T &t) const { push_back(t); if (max_size>0 && deque<T>::size()>max_size) deque<T>::pop_front(); } 51 operator T() const { return deque<T>::size()>0 ? deque<T>::back() : T(); } 52 bool valid() const { return deque<T>::size()>0; } 53 }; 54 */ 55 56 // ------------------------------------------------------------------------ 57 58 namespace HTML 59 { 60 const static string kWhite = "#ffffff"; 61 const static string kYellow = "#fffff0"; 62 const static string kRed = "#fff8f0"; 63 const static string kGreen = "#f0fff0"; 64 const static string kBlue = "#f0f0ff"; 65 }; 48 66 49 67 // ======================================================================== … … 190 208 switch (state) 191 209 { 192 case 0: case 1: color = kHtmlGreen; break;193 case 2: case 3: color = kHtmlYellow; break;194 case 4: color = kHtmlRed; break;195 case 5: case 6: color = kHtmlYellow; break;196 case 7: case 8: color = kHtmlGreen; break;210 case 0: case 1: color = HTML::kGreen; break; 211 case 2: case 3: color = HTML::kYellow; break; 212 case 4: color = HTML::kRed; break; 213 case 5: case 6: color = HTML::kYellow; break; 214 case 7: case 8: color = HTML::kGreen; break; 197 215 } 198 216 #endif … … 260 278 261 279 if (!visible || disk<25) 262 color = kHtmlGreen;280 color = HTML::kGreen; 263 281 else 264 color = disk>75 ? kHtmlRed : kHtmlYellow;282 color = disk>75 ? HTML::kRed : HTML::kYellow; 265 283 266 284 string arr; … … 523 541 out << setprecision(3); 524 542 out << d.GetJavaDate() << '\n'; 525 out << "#ffffff\t";543 out << HTML::kWhite << '\t'; 526 544 527 545 for (auto it=fControlMessageHist.begin(); it!=fControlMessageHist.end(); it++) … … 535 553 int HandleDimControlMessage(const EventImp &d) 536 554 { 555 if (d.GetSize()==0) 556 return GetCurrentState(); 557 537 558 if (d.GetQoS()==90) 538 559 HandleControlMessageImp(d); … … 543 564 void HandleControlStateChange(const EventImp &d) 544 565 { 545 DimControl ctrl;546 ctrl.Handler(d);547 548 if (d.GetQoS()==-2 && ctrl.scriptdepth==0)566 if (d.GetSize()==0) 567 return; 568 569 if (d.GetQoS()==-2 && fDimControl.scriptdepth==0) 549 570 fControlMessageHist.clear(); 550 571 … … 553 574 554 575 #if BOOST_VERSION < 104600 555 const string file = boost::filesystem::path( ctrl.file).filename();576 const string file = boost::filesystem::path(fDimControl.file).filename(); 556 577 #else 557 const string file = boost::filesystem::path( ctrl.file).filename().string();578 const string file = boost::filesystem::path(fDimControl.file).filename().string(); 558 579 #endif 559 580 560 HandleControlMessageImp(Event(d, ctrl.shortmsg.data(), ctrl.shortmsg.length()+1));581 HandleControlMessageImp(Event(d, fDimControl.shortmsg.data(), fDimControl.shortmsg.length()+1)); 561 582 if (!file.empty()) 562 583 HandleControlMessageImp(Event(d, file.data(), file.length()+1)); … … 594 615 out << d.GetJavaDate() << '\n'; 595 616 596 out << "#ffffff\t"<< fMagicWeatherHist[i].back() << '\n';597 out << "#ffffff\t"<< stat.min << '\n';598 out << "#ffffff\t"<< stat.avg << '\n';599 out << "#ffffff\t"<< stat.max << '\n';617 out << HTML::kWhite << '\t' << fMagicWeatherHist[i].back() << '\n'; 618 out << HTML::kWhite << '\t' << stat.min << '\n'; 619 out << HTML::kWhite << '\t' << stat.avg << '\n'; 620 out << HTML::kWhite << '\t' << stat.max << '\n'; 600 621 601 622 ofstream(fPath+"/"+name+".data") << out.str(); … … 636 657 out << astro.color << '\t' << astro.description << '\n'; 637 658 out << setprecision(2); 638 out << (astro.isday? kHtmlWhite:moon.color) << '\t' << moon.description << '\n';659 out << (astro.isday?HTML::kWhite:moon.color) << '\t' << moon.description << '\n'; 639 660 out << setprecision(3); 640 661 for (int i=0; i<6; i++) 641 out << "#ffffff\t"<< fMagicWeatherHist[i].back() << '\n';642 out << "#ffffff\t"<< dir[idx] << '\n';643 out << "#ffffff\t";662 out << HTML::kWhite << '\t' << fMagicWeatherHist[i].back() << '\n'; 663 out << HTML::kWhite << '\t' << dir[idx] << '\n'; 664 out << HTML::kWhite << '\t'; 644 665 if (fTngWeatherDustHist.size()>0) 645 666 out << fTngWeatherDustHist.back() << '\t' << fTngWeatherDustTime.GetAsStr("%H:%M") << '\n'; … … 651 672 out.str(""); 652 673 out << astro.time.JavaDate() << '\n'; 653 out << kHtmlWhite << '\t' << astro.fSunRiseDarkTime.GetAsStr("%H:%M") << '\n';654 out << kHtmlWhite << '\t' << astro.fSunRiseAstronomical.GetAsStr("%H:%M") << '\n';655 out << kHtmlWhite << '\t' << astro.fSunRiseCivil.GetAsStr("%H:%M") << '\n';656 out << kHtmlWhite << '\t' << astro.fSunRiseDayTime.GetAsStr("%H:%M") << '\n';657 658 out << kHtmlWhite << '\t' << astro.fSunSetDayTime.GetAsStr("%H:%M") << '\n';659 out << kHtmlWhite << '\t' << astro.fSunSetCivil.GetAsStr("%H:%M") << '\n';660 out << kHtmlWhite << '\t' << astro.fSunSetAstronomical.GetAsStr("%H:%M") << '\n';661 out << kHtmlWhite << '\t' << astro.fSunSetDarkTime.GetAsStr("%H:%M") << '\n';662 663 out << kHtmlWhite << '\t' << moon.fMoonRise.GetAsStr("%H:%M") << '\n';664 out << kHtmlWhite << '\t' << moon.fMoonTransit.GetAsStr("%H:%M") << '\n';665 out << kHtmlWhite << '\t' << moon.fMoonSet.GetAsStr("%H:%M") << '\n';666 out << kHtmlWhite << '\t';674 out << HTML::kWhite << '\t' << astro.fSunRiseDarkTime.GetAsStr("%H:%M") << '\n'; 675 out << HTML::kWhite << '\t' << astro.fSunRiseAstronomical.GetAsStr("%H:%M") << '\n'; 676 out << HTML::kWhite << '\t' << astro.fSunRiseCivil.GetAsStr("%H:%M") << '\n'; 677 out << HTML::kWhite << '\t' << astro.fSunRiseDayTime.GetAsStr("%H:%M") << '\n'; 678 679 out << HTML::kWhite << '\t' << astro.fSunSetDayTime.GetAsStr("%H:%M") << '\n'; 680 out << HTML::kWhite << '\t' << astro.fSunSetCivil.GetAsStr("%H:%M") << '\n'; 681 out << HTML::kWhite << '\t' << astro.fSunSetAstronomical.GetAsStr("%H:%M") << '\n'; 682 out << HTML::kWhite << '\t' << astro.fSunSetDarkTime.GetAsStr("%H:%M") << '\n'; 683 684 out << HTML::kWhite << '\t' << moon.fMoonRise.GetAsStr("%H:%M") << '\n'; 685 out << HTML::kWhite << '\t' << moon.fMoonTransit.GetAsStr("%H:%M") << '\n'; 686 out << HTML::kWhite << '\t' << moon.fMoonSet.GetAsStr("%H:%M") << '\n'; 687 out << HTML::kWhite << '\t'; 667 688 668 689 ofstream(fPath+"/astro.data") << out.str(); … … 765 786 out << d.GetJavaDate() << '\n'; 766 787 767 out << kHtmlWhite << '\t' << fDriveControlSourceName << '\n';788 out << HTML::kWhite << '\t' << fDriveControlSourceName << '\n'; 768 789 out << setprecision(5); 769 out << kHtmlWhite << '\t' << Ra << '\n';770 out << kHtmlWhite << '\t' << Dec << '\n';790 out << HTML::kWhite << '\t' << Ra << '\n'; 791 out << HTML::kWhite << '\t' << Dec << '\n'; 771 792 out << setprecision(3); 772 out << kHtmlWhite << '\t' << Zd << '\n';773 out << kHtmlWhite << '\t' << Az << '\n';774 out << kHtmlWhite << '\t' << dev << '\n';793 out << HTML::kWhite << '\t' << Zd << '\n'; 794 out << HTML::kWhite << '\t' << Az << '\n'; 795 out << HTML::kWhite << '\t' << dev << '\n'; 775 796 776 797 fDriveControlMoonDist = -1; … … 781 802 const double angle = moon.Angle(Ra, Dec); 782 803 783 string col = kHtmlGreen;804 string col = HTML::kGreen; 784 805 if (angle<20 || angle>140) 785 col = kHtmlYellow;806 col = HTML::kYellow; 786 807 if (angle<10 || angle>150) 787 col = kHtmlRed;808 col = HTML::kRed; 788 809 out << col << '\t' << setprecision(3) << angle << '\n'; 789 810 … … 791 812 } 792 813 else 793 out << kHtmlWhite << "\t— \n";814 out << HTML::kWhite << "\t— \n"; 794 815 795 816 ofstream(fPath+"/tracking.data") << out.str(); … … 815 836 out << d.GetJavaDate() << '\n'; 816 837 817 out << "#ffffff\t"<< fDriveControlSourceName << '\n';838 out << HTML::kWhite << '\t' << fDriveControlSourceName << '\n'; 818 839 out << setprecision(5); 819 out << "#ffffff\t"<< ra << '\n';820 out << "#ffffff\t"<< dec << '\n';840 out << HTML::kWhite << '\t' << ra << '\n'; 841 out << HTML::kWhite << '\t' << dec << '\n'; 821 842 out << setprecision(3); 822 out << "#ffffff\t"<< woff << '\n';823 out << "#ffffff\t"<< wang << '\n';843 out << HTML::kWhite << '\t' << woff << '\n'; 844 out << HTML::kWhite << '\t' << wang << '\n'; 824 845 825 846 ofstream(fPath+"/source.data") << out.str(); … … 863 884 ostringstream out; 864 885 out << d.GetJavaDate() << '\n'; 865 out << kHtmlWhite << '\t' << fFeedbackUserOffset << '\n';886 out << HTML::kWhite << '\t' << fFeedbackUserOffset << '\n'; 866 887 out << setprecision(3); 867 out << kHtmlWhite << '\t' << fFeedbackTempOffset << '\n';868 out << kHtmlWhite << '\t' << stat.min << '\n';869 out << kHtmlWhite << '\t' << stat.med << '\n';870 out << kHtmlWhite << '\t' << stat.avg << '\n';871 out << kHtmlWhite << '\t' << stat.max << '\n';888 out << HTML::kWhite << '\t' << fFeedbackTempOffset << '\n'; 889 out << HTML::kWhite << '\t' << stat.min << '\n'; 890 out << HTML::kWhite << '\t' << stat.med << '\n'; 891 out << HTML::kWhite << '\t' << stat.avg << '\n'; 892 out << HTML::kWhite << '\t' << stat.max << '\n'; 872 893 ofstream(fPath+"/feedback.data") << out.str(); 873 894 … … 904 925 out << setprecision(3); 905 926 out << d.GetJavaDate() << '\n'; 906 out << kHtmlWhite << '\t' << stat.min << '\n';907 out << kHtmlWhite << '\t' << stat.med << '\n';908 out << kHtmlWhite << '\t' << stat.avg << '\n';909 out << kHtmlWhite << '\t' << stat.max << '\n';927 out << HTML::kWhite << '\t' << stat.min << '\n'; 928 out << HTML::kWhite << '\t' << stat.med << '\n'; 929 out << HTML::kWhite << '\t' << stat.avg << '\n'; 930 out << HTML::kWhite << '\t' << stat.max << '\n'; 910 931 ofstream(fPath+"/voltage.data") << out.str(); 911 932 … … 954 975 } 955 976 956 // Divide by number of summed channels, con cert to mW977 // Divide by number of summed channels, convert to mW 957 978 power_apd /= 317e-3; // [mW] 958 979 … … 989 1010 WriteBinary(d, "biascontrol-current-hist", fBiasControlCurrentHist, 100); 990 1011 991 const string col0 = cal ? kHtmlGreen : kHtmlWhite;1012 const string col0 = cal ? HTML::kGreen : HTML::kWhite; 992 1013 993 1014 string col1 = col0; … … 1024 1045 out << col3 << '\t' << stat.avg << '\n'; 1025 1046 out << col4 << '\t' << stat.max << '\n'; 1026 out << kHtmlWhite << '\t' << power_tot << "W [" << power_apd << "mW]\n";1047 out << HTML::kWhite << '\t' << power_tot << "W [" << power_apd << "mW]\n"; 1027 1048 ofstream(fPath+"/current.data") << out.str(); 1028 1049 … … 1093 1114 switch (c[i]) 1094 1115 { 1095 case '.': col[i]= kHtmlWhite; break;1096 case '-': col[i]= kHtmlRed; break;1097 case '+': col[i]= kHtmlYellow; break;1098 case '*': col[i]= kHtmlGreen; break;1116 case '.': col[i]=HTML::kWhite; break; 1117 case '-': col[i]=HTML::kRed; break; 1118 case '+': col[i]=HTML::kYellow; break; 1119 case '*': col[i]=HTML::kGreen; break; 1099 1120 } 1100 1121 … … 1142 1163 out << setprecision(3); 1143 1164 out << d.GetJavaDate() << '\n'; 1144 out << "#ffffff\t"<< fFtmControlTriggerRateCam << '\n';1165 out << HTML::kWhite << '\t' << fFtmControlTriggerRateCam << '\n'; 1145 1166 1146 1167 ofstream(fPath+"/trigger.data") << out.str(); … … 1151 1172 out.str(""); 1152 1173 out << d.GetJavaDate() << '\n'; 1153 out << kHtmlWhite << '\t' << bstat.min << '\n';1154 out << kHtmlWhite << '\t' << bstat.med << '\n';1155 out << kHtmlWhite << '\t' << bstat.avg << '\n';1156 out << kHtmlWhite << '\t' << bstat.max << '\n';1174 out << HTML::kWhite << '\t' << bstat.min << '\n'; 1175 out << HTML::kWhite << '\t' << bstat.med << '\n'; 1176 out << HTML::kWhite << '\t' << bstat.avg << '\n'; 1177 out << HTML::kWhite << '\t' << bstat.max << '\n'; 1157 1178 ofstream(fPath+"/boardrates.data") << out.str(); 1158 1179 1159 1180 out.str(""); 1160 1181 out << d.GetJavaDate() << '\n'; 1161 out << kHtmlWhite << '\t' << pstat.min << '\n';1162 out << kHtmlWhite << '\t' << pstat.med << '\n';1163 out << kHtmlWhite << '\t' << pstat.avg << '\n';1164 out << kHtmlWhite << '\t' << pstat.max << '\n';1182 out << HTML::kWhite << '\t' << pstat.min << '\n'; 1183 out << HTML::kWhite << '\t' << pstat.med << '\n'; 1184 out << HTML::kWhite << '\t' << pstat.avg << '\n'; 1185 out << HTML::kWhite << '\t' << pstat.max << '\n'; 1165 1186 ofstream(fPath+"/patchrates.data") << out.str(); 1166 1187 … … 1189 1210 ostringstream out; 1190 1211 out << d.GetJavaDate() << '\n'; 1191 out << kHtmlWhite << '\t' << statb.min << '\n';1192 out << kHtmlWhite << '\t' << statb.med << '\n';1193 //out << kHtmlWhite << '\t' << statb.avg << '\n';1194 out << kHtmlWhite << '\t' << statb.max << '\n';1195 out << kHtmlWhite << '\t' << statp.min << '\n';1196 out << kHtmlWhite << '\t' << statp.med << '\n';1197 //out << kHtmlWhite << '\t' << statp.avg << '\n';1198 out << kHtmlWhite << '\t' << statp.max << '\n';1212 out << HTML::kWhite << '\t' << statb.min << '\n'; 1213 out << HTML::kWhite << '\t' << statb.med << '\n'; 1214 //out << HTML::kWhite << '\t' << statb.avg << '\n'; 1215 out << HTML::kWhite << '\t' << statb.max << '\n'; 1216 out << HTML::kWhite << '\t' << statp.min << '\n'; 1217 out << HTML::kWhite << '\t' << statp.med << '\n'; 1218 //out << HTML::kWhite << '\t' << statp.avg << '\n'; 1219 out << HTML::kWhite << '\t' << statp.max << '\n'; 1199 1220 ofstream(fPath+"/thresholds.data") << out.str(); 1200 1221 1201 1222 out.str(""); 1202 1223 out << d.GetJavaDate() << '\n'; 1203 out << kHtmlWhite << '\t' << dat.fTriggerInterval << '\n';1204 out << kHtmlWhite << '\t';1224 out << HTML::kWhite << '\t' << dat.fTriggerInterval << '\n'; 1225 out << HTML::kWhite << '\t'; 1205 1226 if (dat.HasPedestal()) 1206 1227 out << dat.fTriggerSeqPed; … … 1219 1240 out << '\n'; 1220 1241 1221 out << kHtmlWhite << '\t' << (dat.HasTrigger()?"on":"off") << " / " << (dat.HasExt1()?"on":"off") << " / " << (dat.HasExt2()?"on":"off") << '\n';1222 out << kHtmlWhite << '\t' << (dat.HasVeto()?"on":"off") << " / " << (dat.HasClockConditioner()?"time cal":"marker") << '\n';1223 out << kHtmlWhite << '\t' << dat.fMultiplicityPhysics << " / " << dat.fMultiplicityCalib << '\n';1224 out << kHtmlWhite << '\t' << dat.fWindowPhysics << '\t' << dat.fWindowCalib << '\n';1225 out << kHtmlWhite << '\t' << dat.fDelayTrigger << '\t' << dat.fDelayTimeMarker << '\n';1226 out << kHtmlWhite << '\t' << dat.fDeadTime << '\n';1242 out << HTML::kWhite << '\t' << (dat.HasTrigger()?"on":"off") << " / " << (dat.HasExt1()?"on":"off") << " / " << (dat.HasExt2()?"on":"off") << '\n'; 1243 out << HTML::kWhite << '\t' << (dat.HasVeto()?"on":"off") << " / " << (dat.HasClockConditioner()?"time cal":"marker") << '\n'; 1244 out << HTML::kWhite << '\t' << dat.fMultiplicityPhysics << " / " << dat.fMultiplicityCalib << '\n'; 1245 out << HTML::kWhite << '\t' << dat.fWindowPhysics << '\t' << dat.fWindowCalib << '\n'; 1246 out << HTML::kWhite << '\t' << dat.fDelayTrigger << '\t' << dat.fDelayTimeMarker << '\n'; 1247 out << HTML::kWhite << '\t' << dat.fDeadTime << '\n'; 1227 1248 1228 1249 int64_t vp = dat.fPrescaling[0]; … … 1232 1253 1233 1254 if (vp<0) 1234 out << kHtmlYellow << "\tdifferent\n";1255 out << HTML::kYellow << "\tdifferent\n"; 1235 1256 else 1236 out << kHtmlWhite << "\t"<< 0.5*vp << "\n";1257 out << HTML::kWhite << '\t' << 0.5*vp << "\n"; 1237 1258 1238 1259 ofstream(fPath+"/ftm.data") << out.str(); … … 1257 1278 for (int i=0; i<4; i++) 1258 1279 { 1259 out << kHtmlWhite << '\t';1280 out << HTML::kWhite << '\t'; 1260 1281 for (int j=0; j<10; j++) 1261 1282 if (sdata.IsActive(i*10+j)) … … 1358 1379 out << setprecision(3); 1359 1380 out << d.GetJavaDate() << '\n'; 1360 out << "#ffffff\t"<< fFscControlHumidityAvg << '\n';1361 out << "#ffffff\t"<< min << '\n';1362 out << "#ffffff\t"<< avg << '\n';1363 out << "#ffffff\t"<< max << '\n';1364 out << "#ffffff\t"<< stat.min << '\n';1365 out << "#ffffff\t"<< stat.avg << '\n';1366 out << "#ffffff\t"<< stat.max << '\n';1381 out << HTML::kWhite << '\t' << fFscControlHumidityAvg << '\n'; 1382 out << HTML::kWhite << '\t' << min << '\n'; 1383 out << HTML::kWhite << '\t' << avg << '\n'; 1384 out << HTML::kWhite << '\t' << max << '\n'; 1385 out << HTML::kWhite << '\t' << stat.min << '\n'; 1386 out << HTML::kWhite << '\t' << stat.avg << '\n'; 1387 out << HTML::kWhite << '\t' << stat.max << '\n'; 1367 1388 1368 1389 ofstream(fPath+"/fsc.data") << out.str(); … … 1430 1451 out << setprecision(3); 1431 1452 out << d.GetJavaDate() << '\n'; 1432 out << "#ffffff\t"<< fFtmBoardThresholdMed << '\n';1433 out << "#ffffff\t"<< fFtmPatchThresholdMed << '\n';1434 out << "#ffffff\t"<< pow(10, fRateScanDataHist[0].back()) << '\n';1435 out << "#ffffff\t"<< max << '\n';1453 out << HTML::kWhite << '\t' << fFtmBoardThresholdMed << '\n'; 1454 out << HTML::kWhite << '\t' << fFtmPatchThresholdMed << '\n'; 1455 out << HTML::kWhite << '\t' << pow(10, fRateScanDataHist[0].back()) << '\n'; 1456 out << HTML::kWhite << '\t' << max << '\n'; 1436 1457 1437 1458 ofstream(fPath+"/ratescan.data") << out.str(); … … 1439 1460 out.str(""); 1440 1461 out << d.GetJavaDate() << '\n'; 1441 out << "#ffffff\t"<< int(fRateScanBoard) << '\n';1442 out << "#ffffff\t"<< pow(10, fRateScanDataHist[fRateScanBoard+1].back()) << '\n';1462 out << HTML::kWhite << '\t' << int(fRateScanBoard) << '\n'; 1463 out << HTML::kWhite << '\t' << pow(10, fRateScanDataHist[fRateScanBoard+1].back()) << '\n'; 1443 1464 1444 1465 ofstream(fPath+"/ratescan_board.data") << out.str(); … … 1452 1473 { 1453 1474 ostringstream out; 1454 out << d.GetJavaDate() << '\t' << fHasError << '\n'; 1475 out << d.GetJavaDate() << '\n'; 1476 1455 1477 switch (d.GetQoS()) 1456 1478 { 1457 case -3: out << kHtmlWhite << "\tNot running\n";break;1458 case -2: out << kHtmlBlue << "\tLoading\n";break;1459 case -1: out << kHtmlBlue << "\tStarted\n";break;1460 default: out << kHtmlGreen << "\tRunning [" << d.GetQoS() << "]\n"; break;1479 case -3: out << HTML::kWhite << "\tNot running\n"; break; 1480 case -2: out << HTML::kBlue << "\tLoading\n"; break; 1481 case -1: out << HTML::kBlue << "\tStarted\n"; break; 1482 default: out << HTML::kGreen << "\tRunning [" << d.GetQoS() << "]\n"; break; 1461 1483 } 1462 1484 … … 1466 1488 // ------------------------------------------------------------------- 1467 1489 1490 /* 1468 1491 bool CheckEventSize(size_t has, const char *name, size_t size) 1469 1492 { … … 1475 1498 Fatal(msg); 1476 1499 return false; 1477 } 1500 }*/ 1478 1501 1479 1502 int Print() const … … 1501 1524 { 1502 1525 if (!state.online()) 1503 return kHtmlWhite+"\t—\n";1526 return HTML::kWhite+"\t—\n"; 1504 1527 1505 1528 if (&state==&fDimControl) 1506 return kHtmlGreen +'\t'+(state.state()<-2?"Idle":fDimControl.shortmsg)+'\n';1529 return HTML::kGreen +'\t'+(state.state()<-2?"Idle":fDimControl.shortmsg)+'\n'; 1507 1530 1508 1531 const State rc = state.description(); … … 1512 1535 { 1513 1536 ostringstream out; 1514 out << kHtmlWhite << '\t' << state.state() << '\n';1537 out << HTML::kWhite << '\t' << state.state() << '\n'; 1515 1538 return out.str(); 1516 1539 } 1517 1540 1518 1541 //ostringstream msg; 1519 //msg << kHtmlWhite << '\t' << rc.name << " [" << rc.index << "]\n";1542 //msg << HTML::kWhite << '\t' << rc.name << " [" << rc.index << "]\n"; 1520 1543 //return msg.str(); 1521 1544 1522 1545 if (rc.index<1) 1523 return kHtmlWhite + "\t—\n";1524 1525 1526 return (rc.index<green? kHtmlYellow:kHtmlGreen) + '\t' + rc.name + '\n';1546 return HTML::kWhite + "\t—\n"; 1547 1548 1549 return (rc.index<green?HTML::kYellow:HTML::kGreen) + '\t' + rc.name + '\n'; 1527 1550 } 1528 1551 … … 1618 1641 out << now.JavaDate() << '\t' << haserror << '\t' << (fDimControl.state()>-3) << '\n'; 1619 1642 out << setprecision(3); 1620 out << kHtmlWhite << '\t' << msg.str() << '\n';1643 out << HTML::kWhite << '\t' << msg.str() << '\n'; 1621 1644 1622 1645 if (haserror || fHasError) … … 1637 1660 if (fDimMcp.state()>=MCP::State::kIdle) // Idle 1638 1661 { 1639 string col = kHtmlBlue;1662 string col = HTML::kBlue; 1640 1663 if (fMcpConfigurationState!=MCP::State::kIdle && // Idle 1641 1664 fMcpConfigurationState!=MCP::State::kTriggerOn && // Trigger On 1642 1665 fMcpConfigurationState!=MCP::State::kTakingData) // Taking Data 1643 col = kHtmlYellow;1666 col = HTML::kYellow; 1644 1667 else 1645 1668 if (fDimFadControl.state()==FAD::State::kWritingData) 1646 col = kHtmlGreen;1669 col = HTML::kGreen; 1647 1670 1648 1671 out << col << '\t'; … … 1735 1758 } 1736 1759 else 1737 out << kHtmlWhite;1760 out << HTML::kWhite; 1738 1761 out << '\n'; 1739 1762 … … 1743 1766 const double dev = fDriveControlTrackingDevHist.size()>0 ? fDriveControlTrackingDevHist.back() : 0; 1744 1767 const State rc = fDimDriveControl.description(); 1745 string col = kHtmlGreen;1768 string col = HTML::kGreen; 1746 1769 if (rc.index==6) // Moving 1747 col = kHtmlBlue;1770 col = HTML::kBlue; 1748 1771 if (rc.index==5) // Armed 1749 col = kHtmlWhite;1772 col = HTML::kWhite; 1750 1773 if (rc.index==7) // Tracking 1751 1774 { 1752 1775 if (dev>60) // ~1.5mm 1753 col = kHtmlYellow;1776 col = HTML::kYellow; 1754 1777 if (dev>100) // ~1/4 of a pixel ~ 2.5mm 1755 col = kHtmlRed;1778 col = HTML::kRed; 1756 1779 } 1757 1780 out << col << '\t'; … … 1771 1794 } 1772 1795 else 1773 out << kHtmlWhite << '\n';1796 out << HTML::kWhite << '\n'; 1774 1797 1775 1798 // ------------------- FSC ------------------ 1776 1799 if (fDimFscControl.state()>FSC::State::kDisconnected && fFscControlTemperatureHist.size()>0) 1777 1800 { 1778 out << kHtmlGreen << '\t' << fFscControlTemperatureHist.back() << '\n';1801 out << HTML::kGreen << '\t' << fFscControlTemperatureHist.back() << '\n'; 1779 1802 } 1780 1803 else 1781 out << kHtmlWhite << '\n';1804 out << HTML::kWhite << '\n'; 1782 1805 1783 1806 // --------------- MagicWeather ------------- … … 1786 1809 /* 1787 1810 const float diff = fMagicWeatherHist[kTemp].back()-fMagicWeatherHist[kDew].back(); 1788 string col1 = kHtmlRed;1811 string col1 = HTML::kRed; 1789 1812 if (diff>0.3) 1790 col1 = kHtmlYellow;1813 col1 = HTML::kYellow; 1791 1814 if (diff>0.7) 1792 col1 = kHtmlGreen;1815 col1 = HTML::kGreen; 1793 1816 */ 1794 1817 1795 1818 const float wind = fMagicWeatherHist[kGusts].back(); 1796 1819 const float hum = fMagicWeatherHist[kHum].back(); 1797 string col = kHtmlGreen;1820 string col = HTML::kGreen; 1798 1821 if (wind>35 || hum>95) 1799 col = kHtmlYellow;1822 col = HTML::kYellow; 1800 1823 if (wind>50 || hum>98) 1801 col = kHtmlRed;1824 col = HTML::kRed; 1802 1825 1803 1826 out << col << '\t'; … … 1808 1831 } 1809 1832 else 1810 out << kHtmlWhite << "\n";1833 out << HTML::kWhite << "\n"; 1811 1834 1812 1835 // --------------- FtmControl ------------- 1813 1836 if (fDimFtmControl.state()==FTM::State::kTriggerOn) 1814 1837 { 1815 string col = kHtmlGreen;1838 string col = HTML::kGreen; 1816 1839 if (fFtmControlTriggerRateCam<15) 1817 col = kHtmlYellow;1840 col = HTML::kYellow; 1818 1841 if (fFtmControlTriggerRateCam>100) 1819 col = kHtmlRed;1842 col = HTML::kRed; 1820 1843 1821 1844 out << col << '\t' << fFtmControlTriggerRateCam << '\t'; … … 1823 1846 } 1824 1847 else 1825 out << kHtmlWhite << '\n';1848 out << HTML::kWhite << '\n'; 1826 1849 1827 1850 // --------------- BiasControl ------------- … … 1834 1857 const bool oc = fDimBiasControl.state()==BIAS::State::kOverCurrent; 1835 1858 1836 string col = fBiasControlVoltageMed>3? kHtmlGreen:kHtmlWhite;1859 string col = fBiasControlVoltageMed>3?HTML::kGreen:HTML::kWhite; 1837 1860 if (fBiasControlCurrentMax>65) 1838 col = kHtmlYellow;1861 col = HTML::kYellow; 1839 1862 if (fBiasControlCurrentMax>80) 1840 col = kHtmlRed;1863 col = HTML::kRed; 1841 1864 1842 1865 // Bias in overcurrent => Red 1843 1866 if (fDimBiasControl.state()==BIAS::State::kOverCurrent) 1844 col = kHtmlRed;1867 col = HTML::kRed; 1845 1868 1846 1869 // MCP in ReadyForDatataking/Configuring/Configured/TriggerOn/TakingData … … 1849 1872 fDimBiasControl.state()!=BIAS::State::kVoltageOn && 1850 1873 fDimBiasControl.state()!=BIAS::State::kVoltageOff) 1851 col = kHtmlRed;1874 col = HTML::kRed; 1852 1875 1853 1876 const bool cal = fFeedbackCalibration.size(); … … 1856 1879 if (fDimFeedback.state()==13) 1857 1880 { 1858 out << kHtmlBlue << '\t';1881 out << HTML::kBlue << '\t'; 1859 1882 out << "***\t"; 1860 1883 out << "***\t"; … … 1884 1907 } 1885 1908 else 1886 out << kHtmlWhite << '\n';1909 out << HTML::kWhite << '\n'; 1887 1910 1888 1911 ofstream(fPath+"/fact.data") << out.str(); … … 1894 1917 1895 1918 if (!fDimDNS.online()) 1896 out << kHtmlWhite << "\tOffline\n\n\n\n\n\n\n\n\n\n\n\n\n";1919 out << HTML::kWhite << "\tOffline\n\n\n\n\n\n\n\n\n\n\n\n\n"; 1897 1920 else 1898 1921 { … … 1900 1923 dt << (Time()-fRunTime); 1901 1924 1902 out << kHtmlGreen << '\t' << fDimDNS.version() << '\n';1925 out << HTML::kGreen << '\t' << fDimDNS.version() << '\n'; 1903 1926 1904 1927 out << GetStateHtml(fDimControl, 0); … … 1917 1940 out << GetStateHtml(fDimChatServer, 1); 1918 1941 1919 out << kHtmlGreen << '\t' << dt.str().substr(0, dt.str().length()-7) << '\n';1942 out << HTML::kGreen << '\t' << dt.str().substr(0, dt.str().length()-7) << '\n'; 1920 1943 } 1921 1944 … … 2135 2158 return -1; 2136 2159 2137 //try 2138 { 2139 // No console access at all 2140 if (!conf.Has("console")) 2141 { 2142 // if (conf.Get<bool>("no-dim")) 2143 // return RunShell<LocalStream, StateMachine, ConnectionFSC>(conf); 2144 // else 2145 return RunShell<LocalStream>(conf); 2146 } 2147 // Cosole access w/ and w/o Dim 2148 /* if (conf.Get<bool>("no-dim")) 2149 { 2150 if (conf.Get<int>("console")==0) 2151 return RunShell<LocalShell, StateMachine, ConnectionFSC>(conf); 2152 else 2153 return RunShell<LocalConsole, StateMachine, ConnectionFSC>(conf); 2154 } 2155 else 2156 */ { 2157 if (conf.Get<int>("console")==0) 2158 return RunShell<LocalShell>(conf); 2159 else 2160 return RunShell<LocalConsole>(conf); 2161 } 2162 } 2163 /*catch (std::exception& e) 2164 { 2165 cerr << "Exception: " << e.what() << endl; 2166 return -1; 2167 }*/ 2160 if (!conf.Has("console")) 2161 return RunShell<LocalStream>(conf); 2162 2163 if (conf.Get<int>("console")==0) 2164 return RunShell<LocalShell>(conf); 2165 else 2166 return RunShell<LocalConsole>(conf); 2168 2167 2169 2168 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.