Changeset 13704
- Timestamp:
- 05/13/12 22:40:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r13699 r13704 82 82 float fDriveControlTrackingDev; 83 83 string fDriveControlSourceName; 84 85 int64_t fFadControlNumEvents; 84 86 85 87 float fFtmControlTriggerRateCam; … … 192 194 DimStampedInfo fDimBiasControlCurrent; 193 195 196 DimStampedInfo fDimFadConnections; 197 DimStampedInfo fDimFadEvents; 198 194 199 DimStampedInfo fDimFtmControlTriggerRates; 195 200 DimStampedInfo fDimFtmControlStaticData; … … 454 459 void HandleFeedbackDeviation(const DimData &d) 455 460 { 456 if (!CheckDataSize(d, "Feedback:Deviation", 2*4*416+ 2))461 if (!CheckDataSize(d, "Feedback:Deviation", 2*4*416+8)) 457 462 return; 458 463 … … 467 472 468 473 // Write the 160 patch values to a file 469 WriteBinary("feedback-deviation", dev, 2000, -1000);474 WriteBinary("feedback-deviation", dev, 1); 470 475 471 476 const Statistics stat(dev, 3); … … 480 485 out << kHtmlWhite << '\t' << stat.avg << '\n'; 481 486 out << kHtmlWhite << '\t' << stat.max << '\n'; 482 ofstream( "www/feedback.txt") << out.str();487 ofstream(fPath+"/feedback.txt") << out.str(); 483 488 } 484 489 … … 603 608 } 604 609 610 void HandleFadEvents(const DimData &d) 611 { 612 if (!CheckDataSize(d, "FadControl:Events", 4*4)) 613 { 614 fFadControlNumEvents = -1; 615 return; 616 } 617 618 fFadControlNumEvents = d.get<uint32_t>(); 619 } 620 621 void HandleFadConnections(const DimData &d) 622 { 623 if (!CheckDataSize(d, "FadControl:Connections", 41)) 624 { 625 //fStatusEventBuilderLabel->setText("Offline"); 626 return; 627 } 628 629 string rc(40, '-'); // orange/red [45] 630 631 const uint8_t *ptr = d.ptr<uint8_t>(); 632 633 int c[4] = { '.', '.', '.', '.' }; 634 635 for (int i=0; i<40; i++) 636 { 637 const uint8_t stat1 = ptr[i]&3; 638 const uint8_t stat2 = ptr[i]>>3; 639 640 if (stat1==0 && stat2==0) 641 rc[i] = '.'; // gray [46] 642 else 643 if (stat1>=2 && stat2==8) 644 rc[i] = stat1==2?'+':'*'; // green [43] : check [42] 645 646 if (rc[i]<c[i/10]) 647 c[i/10] = rc[i]; 648 } 649 650 string col[4]; 651 for (int i=0; i<4; i++) 652 switch (c[i]) 653 { 654 case '.': col[i]=kHtmlWhite; break; 655 case '-': col[i]=kHtmlRed; break; 656 case '+': col[i]=kHtmlYellow; break; 657 case '*': col[i]=kHtmlGreen; break; 658 } 659 660 ostringstream out; 661 out << setprecision(3); 662 out << d.time.JavaDate() << '\n'; 663 out << col[0] << '\t' << rc.substr( 0, 10) << '\n'; 664 out << col[1] << '\t' << rc.substr(10, 10) << '\n'; 665 out << col[2] << '\t' << rc.substr(20, 10) << '\n'; 666 out << col[3] << '\t' << rc.substr(30, 10) << '\n'; 667 ofstream(fPath+"/fad.txt") << out.str(); 668 } 669 605 670 void HandleFtmControlTriggerRates(const DimData &d) 606 671 { … … 829 894 return; 830 895 if (HandleService(curr, fDimBiasControlCurrent, &StateMachineSmartFACT::HandleBiasControlCurrent)) 896 return; 897 if (HandleService(curr, fDimFadConnections, &StateMachineSmartFACT::HandleFadConnections)) 898 return; 899 if (HandleService(curr, fDimFadEvents, &StateMachineSmartFACT::HandleFadEvents)) 831 900 return; 832 901 if (HandleService(curr, fDimFtmControlTriggerRates, &StateMachineSmartFACT::HandleFtmControlTriggerRates)) … … 953 1022 out << " ["; 954 1023 if (fMcpConfigurationMaxEvents>0) 955 out << fMcpConfigurationMaxEvents; 1024 { 1025 if (fFadControlNumEvents>0 && fMcpConfigurationState==12) 1026 out << fMcpConfigurationMaxEvents-fFadControlNumEvents; 1027 else 1028 out << fMcpConfigurationMaxEvents; 1029 } 956 1030 if (fMcpConfigurationMaxEvents>0 && (fMcpConfigurationMaxTime>0 || fMcpConfigurationState==12)) 957 1031 out << '/'; … … 968 1042 } 969 1043 else 970 out << "[" << fMcpConfigurationMaxTime << "s]";1044 out << fMcpConfigurationMaxTime << 's'; 971 1045 } 972 1046 else … … 1081 1155 // and Bias not in "data-taking state' => Red 1082 1156 if (fDimMcp.state()>5 && 1083 (fDimBiasControl.state()==BIAS::kVoltageOn ||1084 fDimBiasControl.state()==BIAS::kVoltageOff))1157 fDimBiasControl.state()!=BIAS::kVoltageOn && 1158 fDimBiasControl.state()!=BIAS::kVoltageOff) 1085 1159 col = kHtmlRed; 1086 1160 … … 1183 1257 fDimBiasControlCurrent ("BIAS_CONTROL/CURRENT", (void*)NULL, 0, this), 1184 1258 //--- 1259 fDimFadConnections ("FAD_CONTROL/CONNECTIONS", (void*)NULL, 0, this), 1260 fDimFadEvents ("FAD_CONTROL/EVENTS", (void*)NULL, 0, this), 1261 //--- 1185 1262 fDimFtmControlTriggerRates("FTM_CONTROL/TRIGGER_RATES", (void*)NULL, 0, this), 1186 1263 fDimFtmControlStaticData ("FTM_CONTROL/STATIC_DATA", (void*)NULL, 0, this), … … 1243 1320 po::options_description control("Smart FACT"); 1244 1321 control.add_options() 1245 ("pixel-map-file", var<string>("FACTmapV5a.txt"), "Pixel mapping file. Used here to get the default reference voltage")1246 ("path", var<string>("www/smartfact "),"Output path for the data-files")1322 ("pixel-map-file", var<string>("FACTmapV5a.txt"), "Pixel mapping file. Used here to get the default reference voltage") 1323 ("path", var<string>("www/smartfact/data"), "Output path for the data-files") 1247 1324 ; 1248 1325
Note:
See TracChangeset
for help on using the changeset viewer.