25 if (!std::is_sorted(dataVec.begin(), dataVec.end()))
throw std::runtime_error(
"TimeClusterTrigger: unsorted input");
27 xpu::push_timer(
"TimeClusterTrigger");
28 xpu::t_add_bytes(dataVec.size() *
sizeof(
double));
32 vector<double>& triggerVec = result.first;
35 auto winStart = dataVec.begin();
36 auto current = dataVec.begin();
38 while (current != dataVec.end()) {
41 while (*current - *winStart >
fWinSize)
45 if (std::distance(winStart, current) >=
fMinNumData - 1) {
46 triggerVec.push_back(0.5 * (*current + *winStart));
49 monitor.
numInTrigger += std::distance(winStart, current) + 1;
52 winStart = current + 1;
53 while (winStart != dataVec.end() && *winStart - *current <=
fDeadTime)
63 monitor.
num += dataVec.size();
66 monitor.
time = xpu::pop_timer();