LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
DiscreteProbabilityVector class. More...
#include "LArDiscreteProbabilityVector.h"
Classes | |
class | DiscreteProbabilityDatum |
DiscreteProbabilityData class. More... | |
Public Types | |
template<typename TX , typename TY > | |
using | InputDatum = std::pair< TX, TY > |
template<typename TX , typename TY > | |
using | InputData = std::vector< InputDatum< TX, TY >> |
typedef InputData< float, float > | AllFloatInputData |
typedef pandora::FloatVector | ResamplingPoints |
Public Member Functions | |
template<typename TX , typename TY > | |
DiscreteProbabilityVector (const InputData< TX, TY > &inputData, const TX xUpperBound, const bool useWidths) | |
Constructor. More... | |
DiscreteProbabilityVector (const DiscreteProbabilityVector &discreteProbabilityVector, const ResamplingPoints &resamplingPoints) | |
Constructor. More... | |
DiscreteProbabilityVector (const DiscreteProbabilityVector &discreteProbabilityVector, std::mt19937 &randomNumberGenerator) | |
Constructor. More... | |
float | EvaluateCumulativeProbability (const float x) const |
Evaluate the cumulative probability at arbitrary x. More... | |
unsigned int | GetSize () const |
Get the size of the probability vector. More... | |
float | GetX (const unsigned int index) const |
Get the x value of the element in the vector. More... | |
float | GetProbability (const unsigned int index) const |
Get the probability value of the element in the vector. More... | |
float | GetProbabilityDensity (const unsigned int index) const |
Get the probability density value of the element in the vector. More... | |
float | GetCumulativeProbability (const unsigned int index) const |
Get the cumulative probability value of the element in the vector. More... | |
float | GetWidth (const unsigned int index) const |
Get the width of the element in the vectorr. More... | |
void | GetAllAtIndex (const unsigned int index, float &x, float &probabilityDensity, float &cumulativeProbability, float &width) const |
Get all information stored at a particular index. More... | |
Private Types | |
typedef std::vector< DiscreteProbabilityDatum > | DiscreteProbabilityData |
Private Member Functions | |
template<typename TX , typename TY > | |
DiscreteProbabilityData | InitialiseDiscreteProbabilityData (InputData< TX, TY > inputData) const |
Get a initialised probability data vector from the input data. More... | |
DiscreteProbabilityData | ResampleDiscreteProbabilityData (const DiscreteProbabilityVector &discreteProbabilityVector, const ResamplingPoints &resamplingPoints) const |
Get a resampled probability data vector by resampling another probability data vector. More... | |
DiscreteProbabilityData | RandomiseDiscreteProbabilityData (const DiscreteProbabilityVector &discreteProbabilityVector, std::mt19937 &randomNumberGenerator) const |
Get a randomised probability data vector in which the x values are unchanged, the probability density is randomised and the cumulative probability is recalculated. More... | |
template<typename TX , typename TY > | |
float | CalculateNormalisation (const InputData< TX, TY > &inputData) const |
Calculate the probability normalisation. More... | |
void | VerifyCompleteData () const |
Verify the integrity of the complete probability vector. More... | |
void | VerifyElementRequest (const unsigned int index) const |
Verify the integrity of the element request. More... | |
Static Private Member Functions | |
template<typename TX , typename TY > | |
static bool | SortInputDataByX (const InputDatum< TX, TY > &lhs, const InputDatum< TX, TY > &rhs) |
Sort the input data according to their x value. More... | |
Private Attributes | |
float | m_xUpperBound |
the upper bound of the probability vector More... | |
bool | m_useWidths |
controls whether bin widths are used in calculations More... | |
DiscreteProbabilityData | m_discreteProbabilityData |
the probability data More... | |
DiscreteProbabilityVector class.
Definition at line 25 of file LArDiscreteProbabilityVector.h.
typedef InputData<float, float> lar_content::DiscreteProbabilityVector::AllFloatInputData |
Definition at line 34 of file LArDiscreteProbabilityVector.h.
|
private |
Definition at line 188 of file LArDiscreteProbabilityVector.h.
using lar_content::DiscreteProbabilityVector::InputData = std::vector<InputDatum<TX, TY>> |
Definition at line 32 of file LArDiscreteProbabilityVector.h.
using lar_content::DiscreteProbabilityVector::InputDatum = std::pair<TX, TY> |
Definition at line 29 of file LArDiscreteProbabilityVector.h.
typedef pandora::FloatVector lar_content::DiscreteProbabilityVector::ResamplingPoints |
Definition at line 36 of file LArDiscreteProbabilityVector.h.
lar_content::DiscreteProbabilityVector::DiscreteProbabilityVector | ( | const InputData< TX, TY > & | inputData, |
const TX | xUpperBound, | ||
const bool | useWidths | ||
) |
Constructor.
inputData | the data used to construct the probability vector |
xUpperBound | the upper bound of the probability vector |
useWidths | bool controlling whether the bin widths are used in calculations |
Definition at line 19 of file LArDiscreteProbabilityVector.cc.
References VerifyCompleteData().
Referenced by CalculateNormalisation().
lar_content::DiscreteProbabilityVector::DiscreteProbabilityVector | ( | const DiscreteProbabilityVector & | discreteProbabilityVector, |
const ResamplingPoints & | resamplingPoints | ||
) |
Constructor.
discreteProbabilityVector | a discrete probability vector to resample from |
resamplingPoints | the points to resample the discrete probability vector with |
Definition at line 39 of file LArDiscreteProbabilityVector.cc.
References VerifyCompleteData().
lar_content::DiscreteProbabilityVector::DiscreteProbabilityVector | ( | const DiscreteProbabilityVector & | discreteProbabilityVector, |
std::mt19937 & | randomNumberGenerator | ||
) |
Constructor.
discreteProbabilityVector | a discrete probability vector to randomly rearrange |
randomNumberGenerator | the random number generator for the random reshuffling |
Definition at line 29 of file LArDiscreteProbabilityVector.cc.
References VerifyCompleteData().
|
private |
Calculate the probability normalisation.
inputData | the input data |
Definition at line 199 of file LArDiscreteProbabilityVector.cc.
References DiscreteProbabilityVector(), f, InitialiseDiscreteProbabilityData(), m_useWidths, m_xUpperBound, SortInputDataByX(), and y.
Referenced by InitialiseDiscreteProbabilityData().
float lar_content::DiscreteProbabilityVector::EvaluateCumulativeProbability | ( | const float | x | ) | const |
Evaluate the cumulative probability at arbitrary x.
x | the x value |
Definition at line 49 of file LArDiscreteProbabilityVector.cc.
References f, and m_discreteProbabilityData.
Referenced by ResampleDiscreteProbabilityData().
|
inline |
Get all information stored at a particular index.
index | the index in the vector |
x | the x value |
probabilityDensity | the probability density value |
cumulativeProbability | the cumulative probability value |
width | the width of the probability bin |
Definition at line 315 of file LArDiscreteProbabilityVector.h.
References lar_content::DiscreteProbabilityVector::DiscreteProbabilityDatum::GetX(), m_discreteProbabilityData, and VerifyElementRequest().
|
inline |
Get the cumulative probability value of the element in the vector.
index | the index in the vector |
Definition at line 297 of file LArDiscreteProbabilityVector.h.
References m_discreteProbabilityData, and VerifyElementRequest().
|
inline |
Get the probability value of the element in the vector.
index | the index in the vector |
Definition at line 279 of file LArDiscreteProbabilityVector.h.
References m_discreteProbabilityData, m_useWidths, and VerifyElementRequest().
Referenced by lar_content::TwoViewTransverseTracksAlgorithm::CalculateNumberOfLocallyMatchingSamplingPoints(), and lar_content::LArDiscreteProbabilityHelper::GetElement().
|
inline |
Get the probability density value of the element in the vector.
index | the index in the vector |
Definition at line 288 of file LArDiscreteProbabilityVector.h.
References m_discreteProbabilityData, and VerifyElementRequest().
Referenced by RandomiseDiscreteProbabilityData().
|
inline |
Get the size of the probability vector.
Definition at line 263 of file LArDiscreteProbabilityVector.h.
References m_discreteProbabilityData.
Referenced by lar_content::TwoViewTransverseTracksAlgorithm::CalculateNumberOfLocallyMatchingSamplingPoints(), lar_content::LArDiscreteProbabilityHelper::GetSize(), RandomiseDiscreteProbabilityData(), lar_content::TwoViewTransverseTracksAlgorithm::TwoViewTransverseTracksAlgorithm(), and VerifyElementRequest().
|
inline |
Get the width of the element in the vectorr.
index | the index in the vector |
Definition at line 306 of file LArDiscreteProbabilityVector.h.
References m_discreteProbabilityData, and VerifyElementRequest().
Referenced by RandomiseDiscreteProbabilityData().
|
inline |
Get the x value of the element in the vector.
index | the index in the vector |
Definition at line 270 of file LArDiscreteProbabilityVector.h.
References m_discreteProbabilityData, and VerifyElementRequest().
Referenced by RandomiseDiscreteProbabilityData().
|
private |
Get a initialised probability data vector from the input data.
inputData | the input data |
Definition at line 82 of file LArDiscreteProbabilityVector.cc.
References CalculateNormalisation(), f, m_useWidths, m_xUpperBound, and x.
Referenced by CalculateNormalisation().
|
private |
Get a randomised probability data vector in which the x values are unchanged, the probability density is randomised and the cumulative probability is recalculated.
discreteProbabilityVector | another discrete probability vector |
randomNumberGenerator | the random number generator for the random reshuffling |
Definition at line 159 of file LArDiscreteProbabilityVector.cc.
References util::begin(), util::end(), f, GetProbabilityDensity(), GetSize(), GetWidth(), GetX(), and m_useWidths.
|
private |
Get a resampled probability data vector by resampling another probability data vector.
discreteProbabilityVector | another discrete probability vector |
resamplingPoints | the points to resample the discrete probability vector with |
Definition at line 119 of file LArDiscreteProbabilityVector.cc.
References EvaluateCumulativeProbability(), f, m_useWidths, and m_xUpperBound.
|
staticprivate |
Sort the input data according to their x value.
lhs | the first InputDatum |
lhs | the second InputDatum |
Definition at line 187 of file LArDiscreteProbabilityVector.cc.
Referenced by CalculateNormalisation().
|
inlineprivate |
Verify the integrity of the complete probability vector.
Definition at line 368 of file LArDiscreteProbabilityVector.h.
References m_discreteProbabilityData, and m_xUpperBound.
Referenced by DiscreteProbabilityVector().
|
inlineprivate |
Verify the integrity of the element request.
index | the index in the probability vector |
Definition at line 381 of file LArDiscreteProbabilityVector.h.
References GetSize().
Referenced by GetAllAtIndex(), GetCumulativeProbability(), GetProbability(), GetProbabilityDensity(), GetWidth(), and GetX().
|
private |
the probability data
Definition at line 258 of file LArDiscreteProbabilityVector.h.
Referenced by EvaluateCumulativeProbability(), GetAllAtIndex(), GetCumulativeProbability(), GetProbability(), GetProbabilityDensity(), GetSize(), GetWidth(), GetX(), and VerifyCompleteData().
|
private |
controls whether bin widths are used in calculations
Definition at line 257 of file LArDiscreteProbabilityVector.h.
Referenced by CalculateNormalisation(), GetProbability(), InitialiseDiscreteProbabilityData(), RandomiseDiscreteProbabilityData(), and ResampleDiscreteProbabilityData().
|
private |
the upper bound of the probability vector
Definition at line 256 of file LArDiscreteProbabilityVector.h.
Referenced by CalculateNormalisation(), InitialiseDiscreteProbabilityData(), ResampleDiscreteProbabilityData(), and VerifyCompleteData().