16 std::vector<size_t>
idx(
v.size());
17 std::iota(
idx.begin(),
idx.end(), 0);
20 std::sort(
idx.begin(),
idx.end(), [&
v](
size_t i1,
size_t i2) {
return v[
i1] <
v[
i2]; });
25 : xMin_(
Xmin), xMax_(
Xmax), cTerm_(Cterm), aTerm_(Aterm) {
47 if (
type ==
"recHit") {
52 else if (xVal >
xMax_)
65 std::vector<float>&
time, std::vector<float>
weight,
unsigned int minNhits,
float deltaT,
float timeWidthBy) {
66 if (
time.size() < minNhits)
67 return std::pair<float, float>(-99., -1.);
72 std::vector<float>
t(
time.size(), 0.);
73 std::vector<float>
w(
time.size(), 0.);
75 for (std::size_t
i = 0;
i < sortedIndex.size(); ++
i) {
87 const auto startRef = *
start;
88 int c = count_if(
start,
t.end(), [&](
float el) {
return el - startRef <= deltaT +
tolerance; });
89 if (
c > max_elements) {
91 auto last_el = find_if_not(
start,
t.end(), [&](
float el) {
return el - startRef <= deltaT +
tolerance; });
92 auto valTostartDiff = *(--last_el) - startRef;
98 timeW = valTostartDiff;
104 float HalfTimeDiff = timeW * timeWidthBy;
109 for (
int ij = 0; ij <= start_el; ++ij) {
110 if (
t[ij] > (
t[start_el] - HalfTimeDiff)) {
111 for (
int kl = ij; kl <
totSize; ++kl) {
112 if (
t[kl] < (
t[end_el] + HalfTimeDiff)) {
113 sum +=
t[kl] *
w[kl];
123 return std::pair<float, float>(-99., -1.);
125 return std::pair<float, float>(sum /
num, 1. /
sqrt(
num));