Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
lar_content::DiscreteProbabilityVector Class Reference

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.
 
 DiscreteProbabilityVector (const DiscreteProbabilityVector &discreteProbabilityVector, const ResamplingPoints &resamplingPoints)
 Constructor.
 
 DiscreteProbabilityVector (const DiscreteProbabilityVector &discreteProbabilityVector, std::mt19937 &randomNumberGenerator)
 Constructor.
 
float EvaluateCumulativeProbability (const float x) const
 Evaluate the cumulative probability at arbitrary x.
 
unsigned int GetSize () const
 Get the size of the probability vector.
 
float GetX (const unsigned int index) const
 Get the x value of the element in the vector.
 
float GetProbability (const unsigned int index) const
 Get the probability value of the element in the vector.
 
float GetProbabilityDensity (const unsigned int index) const
 Get the probability density value of the element in the vector.
 
float GetCumulativeProbability (const unsigned int index) const
 Get the cumulative probability value of the element in the vector.
 
float GetWidth (const unsigned int index) const
 Get the width of the element in the vectorr.
 
void GetAllAtIndex (const unsigned int index, float &x, float &probabilityDensity, float &cumulativeProbability, float &width) const
 Get all information stored at a particular index.
 

Private Types

typedef std::vector< DiscreteProbabilityDatumDiscreteProbabilityData
 

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.
 
DiscreteProbabilityData ResampleDiscreteProbabilityData (const DiscreteProbabilityVector &discreteProbabilityVector, const ResamplingPoints &resamplingPoints) const
 Get a resampled probability data vector by resampling another probability data vector.
 
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.
 
template<typename TX , typename TY >
float CalculateNormalisation (const InputData< TX, TY > &inputData) const
 Calculate the probability normalisation.
 
void VerifyCompleteData () const
 Verify the integrity of the complete probability vector.
 
void VerifyElementRequest (const unsigned int index) const
 Verify the integrity of the element request.
 

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.
 

Private Attributes

float m_xUpperBound
 the upper bound of the probability vector
 
bool m_useWidths
 controls whether bin widths are used in calculations
 
DiscreteProbabilityData m_discreteProbabilityData
 the probability data
 

Detailed Description

DiscreteProbabilityVector class.

Definition at line 25 of file LArDiscreteProbabilityVector.h.

Member Typedef Documentation

◆ AllFloatInputData

◆ DiscreteProbabilityData

◆ InputData

template<typename TX , typename TY >
using lar_content::DiscreteProbabilityVector::InputData = std::vector<InputDatum<TX, TY> >

Definition at line 32 of file LArDiscreteProbabilityVector.h.

◆ InputDatum

template<typename TX , typename TY >
using lar_content::DiscreteProbabilityVector::InputDatum = std::pair<TX, TY>

Definition at line 29 of file LArDiscreteProbabilityVector.h.

◆ ResamplingPoints

Constructor & Destructor Documentation

◆ DiscreteProbabilityVector() [1/3]

template<typename TX , typename TY >
lar_content::DiscreteProbabilityVector::DiscreteProbabilityVector ( const InputData< TX, TY > &  inputData,
const TX  xUpperBound,
const bool  useWidths 
)

Constructor.

Parameters
inputDatathe data used to construct the probability vector
xUpperBoundthe upper bound of the probability vector
useWidthsbool controlling whether the bin widths are used in calculations

Definition at line 19 of file LArDiscreteProbabilityVector.cc.

Here is the call graph for this function:

◆ DiscreteProbabilityVector() [2/3]

lar_content::DiscreteProbabilityVector::DiscreteProbabilityVector ( const DiscreteProbabilityVector discreteProbabilityVector,
const ResamplingPoints resamplingPoints 
)

Constructor.

Parameters
discreteProbabilityVectora discrete probability vector to resample from
resamplingPointsthe points to resample the discrete probability vector with

Definition at line 39 of file LArDiscreteProbabilityVector.cc.

Here is the call graph for this function:

◆ DiscreteProbabilityVector() [3/3]

lar_content::DiscreteProbabilityVector::DiscreteProbabilityVector ( const DiscreteProbabilityVector discreteProbabilityVector,
std::mt19937 &  randomNumberGenerator 
)

Constructor.

Parameters
discreteProbabilityVectora discrete probability vector to randomly rearrange
randomNumberGeneratorthe random number generator for the random reshuffling

Definition at line 29 of file LArDiscreteProbabilityVector.cc.

Here is the call graph for this function:

Member Function Documentation

◆ CalculateNormalisation()

template<typename TX , typename TY >
template float lar_content::DiscreteProbabilityVector::CalculateNormalisation ( const InputData< TX, TY > &  inputData) const
private

Calculate the probability normalisation.

Parameters
inputDatathe input data
Returns
the probability normalisation

Definition at line 199 of file LArDiscreteProbabilityVector.cc.

Here is the caller graph for this function:

◆ EvaluateCumulativeProbability()

float lar_content::DiscreteProbabilityVector::EvaluateCumulativeProbability ( const float  x) const

Evaluate the cumulative probability at arbitrary x.

Parameters
xthe x value
Returns
the cumulative probability

Definition at line 49 of file LArDiscreteProbabilityVector.cc.

Here is the caller graph for this function:

◆ GetAllAtIndex()

void lar_content::DiscreteProbabilityVector::GetAllAtIndex ( const unsigned int  index,
float &  x,
float &  probabilityDensity,
float &  cumulativeProbability,
float &  width 
) const
inline

Get all information stored at a particular index.

Parameters
indexthe index in the vector
xthe x value
probabilityDensitythe probability density value
cumulativeProbabilitythe cumulative probability value
widththe width of the probability bin

Definition at line 315 of file LArDiscreteProbabilityVector.h.

Here is the call graph for this function:

◆ GetCumulativeProbability()

float lar_content::DiscreteProbabilityVector::GetCumulativeProbability ( const unsigned int  index) const
inline

Get the cumulative probability value of the element in the vector.

Parameters
indexthe index in the vector
Returns
the cumulative probability

Definition at line 297 of file LArDiscreteProbabilityVector.h.

Here is the call graph for this function:

◆ GetProbability()

float lar_content::DiscreteProbabilityVector::GetProbability ( const unsigned int  index) const
inline

Get the probability value of the element in the vector.

Parameters
indexthe index in the vector
Returns
the probability

Definition at line 279 of file LArDiscreteProbabilityVector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetProbabilityDensity()

float lar_content::DiscreteProbabilityVector::GetProbabilityDensity ( const unsigned int  index) const
inline

Get the probability density value of the element in the vector.

Parameters
indexthe index in the vector
Returns
the probability density

Definition at line 288 of file LArDiscreteProbabilityVector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSize()

unsigned int lar_content::DiscreteProbabilityVector::GetSize ( ) const
inline

Get the size of the probability vector.

Returns
the probability vector size

Definition at line 263 of file LArDiscreteProbabilityVector.h.

Here is the caller graph for this function:

◆ GetWidth()

float lar_content::DiscreteProbabilityVector::GetWidth ( const unsigned int  index) const
inline

Get the width of the element in the vectorr.

Parameters
indexthe index in the vector
Returns
the width of the probability bin

Definition at line 306 of file LArDiscreteProbabilityVector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetX()

float lar_content::DiscreteProbabilityVector::GetX ( const unsigned int  index) const
inline

Get the x value of the element in the vector.

Parameters
indexthe index in the vector
Returns
the x value

Definition at line 270 of file LArDiscreteProbabilityVector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitialiseDiscreteProbabilityData()

template<typename TX , typename TY >
template DiscreteProbabilityVector::DiscreteProbabilityData lar_content::DiscreteProbabilityVector::InitialiseDiscreteProbabilityData ( InputData< TX, TY >  inputData) const
private

Get a initialised probability data vector from the input data.

Parameters
inputDatathe input data
Returns
a fully-initialised discrete probability data vector

Definition at line 82 of file LArDiscreteProbabilityVector.cc.

Here is the call graph for this function:

◆ RandomiseDiscreteProbabilityData()

DiscreteProbabilityVector::DiscreteProbabilityData lar_content::DiscreteProbabilityVector::RandomiseDiscreteProbabilityData ( const DiscreteProbabilityVector discreteProbabilityVector,
std::mt19937 &  randomNumberGenerator 
) const
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.

Parameters
discreteProbabilityVectoranother discrete probability vector
randomNumberGeneratorthe random number generator for the random reshuffling
Returns
a resampled probability data vector

Definition at line 159 of file LArDiscreteProbabilityVector.cc.

Here is the call graph for this function:

◆ ResampleDiscreteProbabilityData()

DiscreteProbabilityVector::DiscreteProbabilityData lar_content::DiscreteProbabilityVector::ResampleDiscreteProbabilityData ( const DiscreteProbabilityVector discreteProbabilityVector,
const ResamplingPoints resamplingPoints 
) const
private

Get a resampled probability data vector by resampling another probability data vector.

Parameters
discreteProbabilityVectoranother discrete probability vector
resamplingPointsthe points to resample the discrete probability vector with
Returns
a resampled probability data vector

Definition at line 119 of file LArDiscreteProbabilityVector.cc.

Here is the call graph for this function:

◆ SortInputDataByX()

template<typename TX , typename TY >
template bool lar_content::DiscreteProbabilityVector::SortInputDataByX ( const InputDatum< TX, TY > &  lhs,
const InputDatum< TX, TY > &  rhs 
)
staticprivate

Sort the input data according to their x value.

Parameters
lhsthe first InputDatum
lhsthe second InputDatum
Returns
a bool dictacting swapping the two InputDatums

Definition at line 187 of file LArDiscreteProbabilityVector.cc.

◆ VerifyCompleteData()

void lar_content::DiscreteProbabilityVector::VerifyCompleteData ( ) const
inlineprivate

Verify the integrity of the complete probability vector.

Definition at line 368 of file LArDiscreteProbabilityVector.h.

Here is the caller graph for this function:

◆ VerifyElementRequest()

void lar_content::DiscreteProbabilityVector::VerifyElementRequest ( const unsigned int  index) const
inlineprivate

Verify the integrity of the element request.

Parameters
indexthe index in the probability vector

Definition at line 381 of file LArDiscreteProbabilityVector.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_discreteProbabilityData

DiscreteProbabilityData lar_content::DiscreteProbabilityVector::m_discreteProbabilityData
private

the probability data

Definition at line 258 of file LArDiscreteProbabilityVector.h.

◆ m_useWidths

bool lar_content::DiscreteProbabilityVector::m_useWidths
private

controls whether bin widths are used in calculations

Definition at line 257 of file LArDiscreteProbabilityVector.h.

◆ m_xUpperBound

float lar_content::DiscreteProbabilityVector::m_xUpperBound
private

the upper bound of the probability vector

Definition at line 256 of file LArDiscreteProbabilityVector.h.


The documentation for this class was generated from the following files: