LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
TruncMean.h
Go to the documentation of this file.
1 
12 #ifndef TRUNCMEAN_H
13 #define TRUNCMEAN_H
14 
15 #include <cstddef>
16 #include <limits>
17 #include <vector>
18 
32 static constexpr float kINVALID_FLOAT = std::numeric_limits<float>::max();
33 
34 class TruncMean {
35 
36 public:
54  void CalcTruncMeanProfile(const std::vector<float>& rr_v,
55  const std::vector<float>& dq_v,
56  std::vector<float>& dq_trunc_v,
57  const float& nsigma = 1);
58 
70  float CalcIterativeTruncMean(std::vector<float> v,
71  const size_t& nmin,
72  const size_t& nmax,
73  const size_t& currentiteration,
74  const size_t& lmin,
75  const float& convergencelimit,
76  const float& nsigma,
77  const float& oldmed = kINVALID_FLOAT);
78 
82  void setRadius(const float& rad) { _rad = rad; }
83 
84 private:
85  float Mean(const std::vector<float>& v);
86  float Median(const std::vector<float>& v);
87  float RMS(const std::vector<float>& v);
88 
93  double _rad;
94 };
95 
96 #endif
97  // end of doxygen group
static constexpr float kINVALID_FLOAT
Definition: TruncMean.h:32
float Median(const std::vector< float > &v)
Definition: TruncMean.cxx:121
void setRadius(const float &rad)
Set the smearing radius over which to take hits for truncated mean computaton.
Definition: TruncMean.h:82
double _rad
Definition: TruncMean.h:93
float RMS(const std::vector< float > &v)
Definition: TruncMean.cxx:135
float CalcIterativeTruncMean(std::vector< float > v, const size_t &nmin, const size_t &nmax, const size_t &currentiteration, const size_t &lmin, const float &convergencelimit, const float &nsigma, const float &oldmed=kINVALID_FLOAT)
Iteratively calculate the truncated mean of a distribution std::vector<float> v -> vector of values ...
Definition: TruncMean.cxx:7
float Mean(const std::vector< float > &v)
Definition: TruncMean.cxx:110
void CalcTruncMeanProfile(const std::vector< float > &rr_v, const std::vector< float > &dq_v, std::vector< float > &dq_trunc_v, const float &nsigma=1)
Given residual range and dq vectors return truncated local dq. Input vectors are assumed to be match ...
Definition: TruncMean.cxx:47