Changeset 13643 for trunk/FACT++
- Timestamp:
- 05/10/12 17:18:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r13621 r13643 254 254 255 255 template<class T> 256 Statistics(const T &t) 257 { 258 min = *min_element(t.begin(), t.end()); 259 max = *max_element(t.begin(), t.end()); 260 avg = accumulate (t.begin(), t.end(), 0.)/t.size(); 256 Statistics(const T &t, size_t offset_min=0, size_t offset_max=0) 257 { 258 T copy(t); 259 sort(copy.begin(), copy.end()); 260 261 if (offset_min>t.size()) 262 offset_min = 0; 263 if (offset_max>t.size()) 264 offset_max = 0; 265 266 min = copy[offset_min]; 267 max = copy[copy.size()-1-offset_max]; 268 avg = accumulate (t.begin(), t.end(), 0.)/t.size(); 261 269 262 270 const size_t p = t.size()/2; 263 271 264 T copy(t);265 nth_element(copy.begin(), copy.begin()+p, copy.end());266 272 med = copy[p]; 267 273 } … … 489 495 490 496 // Write the 160 patch values to a file 491 WriteBinary("biascontrol-current", val, 1000);492 493 const Statistics stat(v );497 WriteBinary("biascontrol-current", val, 500); 498 499 const Statistics stat(v, 0, 3); 494 500 495 501 // Exclude the three crazy channels … … 503 509 504 510 // write the history to a file 505 WriteBinary("biascontrol-current-hist", fBiasControlCurrentHist, 1000);511 WriteBinary("biascontrol-current-hist", fBiasControlCurrentHist, 500); 506 512 507 513 ostringstream out; … … 700 706 return; 701 707 702 if (HandleService(curr, fDimMcpConfiguration, &StateMachineSmartFACT:: configuHandleMcpConfiguration))708 if (HandleService(curr, fDimMcpConfiguration, &StateMachineSmartFACT::HandleMcpConfiguration)) 703 709 return; 704 710 if (HandleService(curr, fDimMagicWeatherData, &StateMachineSmartFACT::HandleMagicWeatherData)) … … 826 832 out << col << '\t' << fMcpConfigurationName; 827 833 828 if (fMcpConfigurationMaxEvents>0 || fMcpConfiguration State==12)834 if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationMaxTime>0 || fMcpConfigurationState==12) 829 835 out << " ["; 830 836 if (fMcpConfigurationMaxEvents>0) 831 837 out << fMcpConfigurationMaxEvents; 832 if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationState==12)838 if (fMcpConfigurationMaxEvents>0 && (fMcpConfigurationMaxTime>0 || fMcpConfigurationState==12)) 833 839 out << '/'; 834 840 if (fMcpConfigurationMaxTime>0) … … 837 843 out << fMcpConfigurationMaxTime-(Time()-fMcpConfigurationRunStart).total_seconds() << 's'; 838 844 else 839 out << fMcpConfigurationMaxTime << 's';845 out << "[" << fMcpConfigurationMaxTime << "s]"; 840 846 } 841 847 else … … 849 855 } 850 856 851 if (fMcpConfigurationMaxEvents>0 || fMcpConfiguration State==12)857 if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationMaxTime>0 || fMcpConfigurationState==12) 852 858 out << ']'; 853 859 }
Note:
See TracChangeset
for help on using the changeset viewer.