LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
#include "TruncMean.h"
Public Member Functions | |
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 pair-wise (nth entry in rr_v corresponds to nth entry in dq_v vector). Input rr_v values are also assumed to be ordered: monotonically increasing or decreasing. For every dq value a truncated linear dq value is calculated as follows: 0) all dq values within a rr range set by the class variable _rad are selected. 1) the median and rms of these values is calculated. 2) the subset of local dq values within the range [median-rms, median+rms] is selected. 3) the resulting local truncated dq is the average of this truncated subset. std::vector<float> rr_v -> vector of x-axis coordinates (i.e. position for track profile) std::vector<float> dq_v -> vector of measured values for which truncated profile is requested (i.e. charge profile of a track) std::vector<float> dq_trunc_v -> passed by reference -> output stored here float nsigma -> optional parameter, number of sigma to keep around RMS for TM calculation. More... | |
float | CalcIterativeTruncMean (std::vector< float > v, const size_t &nmin, const size_t &nmax, const size_t ¤titeration, 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 for which truncated mean is asked size_t nmin -> minimum number of iterations to converge on truncated mean size_t nmax -> maximum number of iterations to converge on truncated mean size_t lmin -> minimum number of entries in vector before exiting and returning current value size_t currentiteration -> current iteration float convergencelimit -> fractional difference between successive iterations under which the iteration is completed, provided nmin iterations have occurred. nsigma -> number of sigma around the median value to keep when the distribution is trimmed. More... | |
void | setRadius (const float &rad) |
Set the smearing radius over which to take hits for truncated mean computaton. More... | |
Private Member Functions | |
float | Mean (const std::vector< float > &v) |
float | Median (const std::vector< float > &v) |
float | RMS (const std::vector< float > &v) |
Private Attributes | |
double | _rad |
The truncated mean class allows to compute the following quantities 1) the truncated mean profile of an ordered vector of values, such as the charge profile along a particle's track. To create such a profile use the function CalcTruncMeanProfile() 2) Get the truncated mean value of a distribution. This function iteratively hones in on the truncated mean of a distribution by updating the mean and cutting the tails after each iteration. For this functionality use CalcIterativeTruncMean() doxygen documentation!
Definition at line 34 of file TruncMean.h.
float TruncMean::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 for which truncated mean is asked size_t nmin -> minimum number of iterations to converge on truncated mean size_t nmax -> maximum number of iterations to converge on truncated mean size_t lmin -> minimum number of entries in vector before exiting and returning current value size_t currentiteration -> current iteration float convergencelimit -> fractional difference between successive iterations under which the iteration is completed, provided nmin iterations have occurred. nsigma -> number of sigma around the median value to keep when the distribution is trimmed.
Definition at line 7 of file TruncMean.cxx.
References pmtana::mean(), Mean(), Median(), RMS(), and x.
void TruncMean::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 pair-wise (nth entry in rr_v corresponds to nth entry in dq_v vector). Input rr_v values are also assumed to be ordered: monotonically increasing or decreasing. For every dq value a truncated linear dq value is calculated as follows: 0) all dq values within a rr range set by the class variable _rad are selected. 1) the median and rms of these values is calculated. 2) the subset of local dq values within the range [median-rms, median+rms] is selected. 3) the resulting local truncated dq is the average of this truncated subset. std::vector<float> rr_v -> vector of x-axis coordinates (i.e. position for track profile) std::vector<float> dq_v -> vector of measured values for which truncated profile is requested (i.e. charge profile of a track) std::vector<float> dq_trunc_v -> passed by reference -> output stored here float nsigma -> optional parameter, number of sigma to keep around RMS for TM calculation.
Definition at line 47 of file TruncMean.cxx.
References _rad, Median(), n, and RMS().
|
private |
Definition at line 110 of file TruncMean.cxx.
References pmtana::mean(), and n.
Referenced by CalcIterativeTruncMean(), and setRadius().
|
private |
Definition at line 121 of file TruncMean.cxx.
Referenced by CalcIterativeTruncMean(), CalcTruncMeanProfile(), and setRadius().
|
private |
Definition at line 135 of file TruncMean.cxx.
Referenced by CalcIterativeTruncMean(), CalcTruncMeanProfile(), and setRadius().
|
inline |
|
private |
Smearing radius over which charge from neighboring hits is scanned to calculate local truncated mean
Definition at line 93 of file TruncMean.h.
Referenced by CalcTruncMeanProfile(), and setRadius().