LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
TruncMean.h
Go to the documentation of this file.
1 
12 #ifndef TRUNCMEAN_H
13 #define TRUNCMEAN_H
14 
15 #include <iostream>
16 #include <algorithm>
17 #include <cmath>
18 #include <vector>
19 #include <climits>
20 #include <limits>
21 
36 
37 class TruncMean{
38 
39  public:
40 
43 
46 
64  void CalcTruncMeanProfile(const std::vector<float>& rr_v, const std::vector<float>& dq_v,
65  std::vector<float>& dq_trunc_v, const float& nsigma = 1);
66 
78  float CalcIterativeTruncMean(std::vector<float> v, const size_t& nmin,
79  const size_t& nmax, const size_t& currentiteration,
80  const size_t& lmin,
81  const float& convergencelimit,
82  const float& nsigma, const float& oldmed = kINVALID_FLOAT);
83 
87  void setRadius(const float& rad) { _rad = rad; }
88 
89  private:
90 
91  float Mean (const std::vector<float>& v);
92  float Median(const std::vector<float>& v);
93  float RMS (const std::vector<float>& v);
94 
99  double _rad;
100 
101 };
102 
103 #endif
104  // end of doxygen group
static const float kINVALID_FLOAT
Definition: TruncMean.h:35
Int_t max
Definition: plot.C:27
float Median(const std::vector< float > &v)
Definition: TruncMean.cxx:114
void setRadius(const float &rad)
Set the smearing radius over which to take hits for truncated mean computaton.
Definition: TruncMean.h:87
double _rad
Definition: TruncMean.h:99
float RMS(const std::vector< float > &v)
Definition: TruncMean.cxx:128
~TruncMean()
Default destructor.
Definition: TruncMean.h:45
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:104
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:43
TruncMean()
Default constructor.
Definition: TruncMean.h:42