16 std::vector<size_t>
idx(
v.size());
17 std::iota(
idx.begin(),
idx.end(), 0);
25 : xMin_(
Xmin), xMax_(
Xmax), cTerm_(Cterm), aTerm_(Aterm) {
47 if (
type ==
"recHit") {
54 else if (xVal >
xMax_)
67 std::vector<float>&
time, std::vector<float>
weight,
unsigned int minNhits,
float deltaT,
float timeWidthBy) {
68 if (
time.size() < minNhits)
69 return std::pair<float, float>(-99., -1.);
74 std::vector<float>
t(
time.size(), 0.);
75 std::vector<float>
w(
time.size(), 0.);
77 for (std::size_t
i = 0;
i < sortedIndex.size(); ++
i) {
89 const auto startRef = *
start;
90 int c = count_if(
start,
t.end(), [&](
float el) {
return el - startRef <= deltaT +
tolerance; });
91 if (
c > max_elements) {
93 auto last_el = find_if_not(
start,
t.end(), [&](
float el) {
return el - startRef <= deltaT +
tolerance; });
94 auto valTostartDiff = *(--last_el) - startRef;
100 timeW = valTostartDiff;
106 float HalfTimeDiff = timeW * timeWidthBy;
111 for (
int ij = 0; ij <= start_el; ++ij) {
112 if (
t[ij] > (
t[start_el] - HalfTimeDiff)) {
113 for (
int kl = ij; kl <
totSize; ++kl) {
114 if (
t[kl] < (
t[end_el] + HalfTimeDiff)) {
115 sum +=
t[kl] *
w[kl];
125 return std::pair<float, float>(-99., -1.);
127 return std::pair<float, float>(sum /
num, 1. /
sqrt(
num));
float timeResolution(float xVal)
std::pair< float, float > fixSizeHighestDensity(std::vector< float > &time, std::vector< float > weight=std::vector< float >(), unsigned int minNhits=3, float deltaT=0.210, float timeWidthBy=0.5)
Abs< T >::type abs(const T &t)
float getTimeError(std::string type, float xVal)
void setParameters(float Xmix, float Xmax, float Cterm, float Aterm)
std::vector< size_t > decrease_sorted_indices(const std::vector< float > &v)
Power< A, B >::type pow(const A &a, const B &b)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t totSize