Changeset 13609 for trunk/FACT++/src/smartfact.cc
- Timestamp:
- 05/09/12 00:38:56 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r13589 r13609 55 55 56 56 uint32_t fMcpConfigurationState; 57 uint64_t fMcpConfigurationMaxTime;58 uint64_t fMcpConfigurationMaxEvents;57 int64_t fMcpConfigurationMaxTime; 58 int64_t fMcpConfigurationMaxEvents; 59 59 string fMcpConfigurationName; 60 Time fMcpConfigurationRunStart; 60 61 61 62 enum weather_t { kWeatherBegin=0, kTemp = kWeatherBegin, kDew, kHum, kPress, kWind, kGusts, kDir, kWeatherEnd = kDir }; … … 91 92 public: 92 93 DimState(const string &n, const string s="STATE") : 93 server(n), info(make_pair(Time( -1), -2)),94 server(n), info(make_pair(Time(), -2)), 94 95 dim((n+"/"+s).c_str(), (void*)NULL, 0, this) { } 95 96 … … 248 249 fMcpConfigurationMaxEvents = d.get<uint64_t>(8); 249 250 fMcpConfigurationName = d.ptr<char>(16); 251 252 if (d.qos==12) 253 fMcpConfigurationRunStart = Time(); 250 254 } 251 255 … … 343 347 344 348 // Simplified: 345 const double dev = cos(dzd) - sin(zd )*sin(zd)*(1.-cos(daz));349 const double dev = cos(dzd) - sin(zd+dzd)*sin(zd)*(1.-cos(daz)); 346 350 fDriveControlTrackingDev = acos(dev) * 180 / M_PI * 3600; 347 351 if (fDriveControlTrackingDev<0.01) … … 405 409 fBiasControlVoltageMed = (v[159]+v[160])/2; 406 410 407 const char *ptr = d.ptr<char>(); 408 409 ofstream fout("www/biascontrol-voltage.bin"); 410 fout.write(ptr, 320*sizeof(float)); 411 //const char *ptr = d.ptr<char>(); 412 //ofstream fout("www/biascontrol-voltage.bin"); 413 //fout.write(ptr, 320*sizeof(float)); 414 415 vector<float> val(320, 0); 416 for (int i=0; i<320; i++) 417 { 418 const int idx = (fPixelMap.hv(i).hw()/9)*2+fPixelMap.hv(i).group(); 419 val[i] = v[i]; 420 } 421 422 WriteBinary("biascontrol-voltage", val, 75); 411 423 } 412 424 … … 427 439 428 440 // Get the maximum of each patch 429 vector<float> val(160, 0); 430 for (int i=0; i<160; i++) 431 val[i] = max(v[i*2], v[i*2+1]); 441 vector<float> val(320, 0); 442 for (int i=0; i<320; i++) 443 { 444 const int idx = (fPixelMap.hv(i).hw()/9)*2+fPixelMap.hv(i).group(); 445 val[idx] = v[i];//max(v[i*2], v[i*2+1]); 446 } 432 447 433 448 // Write the 160 patch values to a file … … 465 480 fFtmControlTriggerRateHist.pop_front(); 466 481 482 // FIXME: Add statistics for all kind of rates 483 467 484 WriteBinary("ftmcontrol-triggerrate-hist", 468 485 fFtmControlTriggerRateHist, 100); 469 486 WriteBinary("ftmcontrol-boardrates", 470 vector<float>(brates, brates+40), 50);487 vector<float>(brates, brates+40), 10); 471 488 WriteBinary("ftmcontrol-patchrates", 472 489 vector<float>(prates, prates+160), 10); 473 474 // for (int i=0; i<160; i++) cout << prates[i] << endl;475 490 476 491 ostringstream out; … … 493 508 //const float *pos = d.ptr<float>(1440*sizeof(float)*3); 494 509 495 vector<float> max( 160, -2000);510 vector<float> max(320, -2000); 496 511 for (int i=0; i<1440; i++) 497 512 { 498 const int idx = fPixelMap.index(i).hw()/9; 513 if (i%9==8) 514 continue; 515 516 const int idx = (fPixelMap.hw(i).hw()/9)*2+fPixelMap.hw(i).group(); 499 517 if (dat[i]>max[idx]) 500 518 max[idx]=dat[i]; … … 505 523 case 0: WriteBinary("fadcontrol-eventdata", max, 2000, 1000); break; 506 524 case 1: WriteBinary("fadcontrol-eventdata", max, 2000, 0); break; 507 default: WriteBinary("fadcontrol-eventdata", max, 1000, 500); break;525 default: WriteBinary("fadcontrol-eventdata", max, 250, 0); break; 508 526 } 509 527 } … … 715 733 { 716 734 string col = kHtmlBlue; 717 if (fMcpConfigurationState!=5) 735 if (fMcpConfigurationState!= 5 && 736 fMcpConfigurationState!=11 && 737 fMcpConfigurationState!=12) // 9 e.g. Configuring3 718 738 col = kHtmlYellow; 719 739 else … … 721 741 col = kHtmlGreen; 722 742 723 out << fMcpConfigurationName; 724 if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationMaxTime>0) 743 out << col << '\t' << fMcpConfigurationName; 744 745 if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationState==12) 725 746 out << " ["; 726 747 if (fMcpConfigurationMaxEvents>0) 727 748 out << fMcpConfigurationMaxEvents; 728 if (fMcpConfigurationMaxEvents>0 && fMcpConfigurationMaxTime>0)729 out << "/";749 if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationState==12) 750 out << '/'; 730 751 if (fMcpConfigurationMaxTime>0) 731 out << fMcpConfigurationMaxTime << "s"; 732 if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationMaxTime>0) 733 out << "]"; 752 { 753 if (fMcpConfigurationState==12) 754 out << fMcpConfigurationMaxTime-(Time()-fMcpConfigurationRunStart).total_seconds() << 's'; 755 else 756 out << fMcpConfigurationMaxTime << 's'; 757 } 758 else 759 { 760 if (fMcpConfigurationState==12) 761 { 762 ostringstream d; 763 d << Time()-fMcpConfigurationRunStart; 764 out << d.str().substr(3, 5); 765 } 766 } 767 768 if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationState==12) 769 out << ']'; 770 771 734 772 } 735 773 else 736 out << kHtmlWhite << '\n'; 774 out << kHtmlWhite; 775 out << '\n'; 737 776 738 777 // ------------------ Drive ----------------- … … 740 779 { 741 780 const State rc = GetState(fDimDriveControl); 742 out << kHtmlWhite << '\t'; 781 string col = kHtmlGreen; 782 if (rc.index==6) // Moving 783 col = kHtmlBlue; 784 if (rc.index==5) // Armed 785 col = kHtmlWhite; 786 out << col << '\t'; 743 787 out << rc.name << '\t'; 744 788 out << fDriveControlPointingZd << '\t'; … … 746 790 if (fDimDriveControl.state()==7) 747 791 { 792 out << setprecision(2); 748 793 out << fDriveControlTrackingDev << '\t'; 794 out << setprecision(3); 749 795 out << fDriveControlSourceName << '\n'; 750 796 } … … 818 864 col = kHtmlBlue; 819 865 820 out << col << '\t'; 821 out << fBiasControlCurrentMed << '\t'; 822 out << fBiasControlCurrentMax << '\t'; 823 out << fBiasControlVoltageMed << '\n'; 866 if (fDimFeedback.state()==13) 867 { 868 out << kHtmlBlue << '\t'; 869 out << "***\t"; 870 out << "***\t"; 871 out << "---\n"; 872 } 873 else 874 { 875 out << col << '\t'; 876 out << fBiasControlCurrentMed << '\t'; 877 out << fBiasControlCurrentMax << '\t'; 878 out << fBiasControlVoltageMed << '\n'; 879 } 824 880 } 825 881 else … … 895 951 fDimFtmControlTriggerRates("FTM_CONTROL/TRIGGER_RATES", (void*)NULL, 0, this), 896 952 //- 953 fMcpConfigurationMaxEvents(0), 954 fMcpConfigurationMaxTime(0), 897 955 fDimFadControlEventData(0) 898 956 {
Note:
See TracChangeset
for help on using the changeset viewer.