test_most_frequent.cxx
Go to the documentation of this file.
2 #include <iostream>
3 
4 using namespace WireCell;
5 using namespace std;
6 
7 int main()
8 {
9  {
10  std::vector<short> adcv{-1,0,0,1,1,2,3,4,4,4,5,6,4,3,4,5,6,7,7,6,5};
11  auto mf = Waveform::most_frequent(adcv);
12  cerr << mf << endl;
13  }
14  {
15  std::vector<short> adcv{-1,0,0,-1,-1,2,3,4,4,-1,-1,5,6,4,3,4,5,6,7,7,6,5};
16  auto mf = Waveform::most_frequent(adcv);
17  cerr << mf << endl;
18  }
19  {
20  std::vector<short> adcv{5,5,5,5,1,1,1,2,2,2,2};
21  auto mf = Waveform::most_frequent(adcv);
22  cerr << mf << endl;
23  }
24 }
STL namespace.
short most_frequent(const std::vector< short > &vals)
Return the smallest, most frequent value to appear in vector.
Definition: Waveform.cxx:289
int main()
Definition: Main.h:22
QTextStream & endl(QTextStream &s)