English Français

Documentation / Developer's manual

Available modules

Calibration,  DataServer,  Launcher,  MetaModelOptim,  Modeler,  Optimizer,  ReLauncher,  Reliability,  ReOptimizer,  Sampler,  Sensitivity,  UncertModeler,  XmlProblem,   Uranie / DataServer: URANIE::DataServer::TCustomDistribution Class Reference
Uranie / DataServer v4.9.0
/* @license-end */
URANIE::DataServer::TCustomDistribution Class Reference

Description of the class TCustomDistribution. More...

#include <TCustomDistribution.h>

Inheritance diagram for URANIE::DataServer::TCustomDistribution:
Collaboration diagram for URANIE::DataServer::TCustomDistribution:

Public Member Functions

Constructor and Destructor
 TCustomDistribution ()
 Default constructor.
 
 TCustomDistribution (TString name)
 Constructor by name only.
 
 TCustomDistribution (TString name, Int_t nbValues, Double_t *values, Double_t *frequencies=NULL)
 Constructor by name and statistics.
 
virtual ~TCustomDistribution ()
 Default destructor.
 
Getters and Setters methods

Getting and setting attribute values.

virtual Int_t getNbValues ()
 Get the number of values.
 
virtual Double_t * getAllValues ()
 Get the values as a Double_t array.
 
virtual Double_t getValue (Int_t i)
 Get a value by index.
 
virtual Double_t * getAllFrequencies ()
 Get the frequencies as a Double_t array.
 
virtual Double_t getFrequency (Int_t i)
 Get a frequency by index.
 
virtual Double_t getProba (Int_t i)
 Return the probability corresponding to the given index.
 
virtual void setDistribution (Int_t nbValues, Double_t *values, Double_t *frequencies=NULL)
 
virtual void setAllValues (Double_t *values)
 Set the values as a Double_t array.
 
virtual void setValue (Int_t i, Double_t value)
 Set a value by index.
 
virtual void setAllFrequencies (Double_t *frequencies)
 Set the frequencies as a Double_t array.
 
virtual void setFrequency (Int_t i, Double_t frequency)
 Set a single frequency by index.
 
Statistical methods

The statistical methods ( pdf, cdf, quantile, ...).

virtual void computeTheoreticalInformation ()
 Mean and Variance are meaningless for non ordered discrete values.
 
virtual Double_t getCDF (Double_t x)
 CDF is meaningless for non ordered discrete values.
 
virtual Double_t getPDF (Double_t x, Double_t precision)
 Returns the probability of a value.
 
virtual Double_t getPDF (Double_t x)
 Returns the probability of a value x, with a precision on x fixed at 1e-9.
 
virtual Double_t getInvCDF (Double_t p)
 Returns a value from the distribution.
 
Printing Log
virtual void printLog (Option_t *option="")
 
- Public Member Functions inherited from URANIE::DataServer::TDiscreteAttribute
 TDiscreteAttribute ()
 Default Constructor

 
 TDiscreteAttribute (TString str)
 
 TDiscreteAttribute (TString str, ELawType value)
 
 TDiscreteAttribute (TAttribute *object, ELawType value)
 
virtual ~TDiscreteAttribute ()
 
virtual void printLog ()
 Display information specific to this class.
 
- Public Member Functions inherited from URANIE::DataServer::TStochasticAttribute
 TStochasticAttribute ()
 Default Constructor.
 
 TStochasticAttribute (TString str)
 Constructor setting the name.
 
 TStochasticAttribute (TString str, ELawType value)
 Constructor setting the name and the law type.
 
 TStochasticAttribute (TString str, ELawType value, Double_t min, Double_t max)
 Constructor setting the name, the law type, and the range (lower and upper bounds)
 
 TStochasticAttribute (TAttribute *object, ELawType value)
 Construction of a TStochasticAttribute from an existing TAttribute object.
 
virtual ~TStochasticAttribute ()
 Default Destructor.
 
double getPDFforTF1 (double *x)
 
double getCDFforTF1 (double *x)
 
double getInvCDFforTF1 (double *x)
 
virtual Double_t getTheoreticalMean ()
 Returns the theoretical value of the mean.
 
virtual Double_t getTheoreticalStdDev ()
 Returns the theoretical value of the standard deviation.
 
virtual Double_t getTheoreticalMode ()
 Returns the theoretical value of the mode.
 
void setLawType (ELawType value)
 Sets the law type from an integer value.
 
void setLawType (TString name)
 Sets the law type from a law name.
 
int getLawType ()
 Returns the law type as an integer.
 
void setStochasticBasis (EStochasticBasis n)
 Defines an orthogonal polynomial family to represent the stochastic attribute.
 
void setDefaultStochasticBasis ()
 Sets the default orthogonal polynomial family representing the stochastic attribute.
 
EStochasticBasis getStochasticBasis () const
 Returns the orthogonal polynomial which is used to represent the attribute.
 
virtual Double_t getPMin ()
 Returns the minimum value of the cumulative distribution function.
 
virtual Double_t getPMax ()
 Returns the maximum value of the cumulative distribution function.
 
- Public Member Functions inherited from URANIE::DataServer::TAttribute
 TAttribute ()
 Default constructor.
 
 TAttribute (const char *name, const char *title)
 
 TAttribute (TString name)
 Constructor by name only.
 
 TAttribute (TString name, EType type)
 Constructor by name and type only.
 
 TAttribute (TString name, TString value, EType type)
 Constructor by name and range.
 
 TAttribute (TString name, Double_t lower, Double_t upper)
 Constructor by name and range.
 
 TAttribute (const TAttribute &attr)
 Copy constructor.
 
TAttributeClone (const char *newname) const
 Clone an attribute with a new name.
 
virtual ~TAttribute ()
 Default destructor.
 
void checkSizeBeforePush (const char *type, int iel, Double_t val)
 Internal method used to check the validity of all setters when dealing with vectors.
 
Double_t checkSizeBeforeGet (const char *type, int iel=0)
 Internal method used to check the validity of all getters when dealing with vectors and return the request.
 
void setQuantile (double prob, double quantile, int iel=0)
 Set the quantile value.
 
void getQuantilesSize (int &nb, int iel=0)
 Returns the number of quantile computed and stored for element iel.
 
void getQuantiles (double *prob, double *quantile, int iel=0)
 Returns all the probabilities and corresponding quantiles computed for element iel.
 
void getQuantile (double &prob, double &quantile, int iel=0)
 Returns the value of the quantile for element iel, given the probability.
 
void getQuantileVector (double &prob, vector< double > &quantile)
 Returns the vector of quantile given the probability.
 
Double_t getMinimum (int iel=0)
 
Double_t getMinimumSize ()
 Returns the size of the vector of minimum.
 
Bool_t hasDefault ()
 Details whether this attribute has a default value.
 
void setMinimum (Double_t val, int iel=0)
 Set the minimum value oef element iel.
 
Double_t getMaximum (int iel=0)
 
Double_t getMaximumSize ()
 Returns the size of the vector of maximum.
 
void setMaximum (Double_t val, int iel=0)
 Set the maximum value oef element iel.
 
void getStatisticalVector (const char *type, vector< double > &vec)
 Returns the vector of considered statistical value.
 
Double_t getMean (int iel=0)
 
Double_t getMeanSize ()
 Returns the size of the vector of mean.
 
void setMean (Double_t val, int iel=0)
 Set the mean value oef element iel.
 
Double_t getStd (int iel=0)
 
Double_t getStdSize ()
 Returns the size of the vector of std.
 
void setStd (Double_t val, int iel=0)
 Set the std value oef element iel.
 
void setSlurmOption (TString value)
 
EType getDataType () const
 Returns the datatype of the considered attribute.
 
TString getDataTypeStr ()
 Returns the datatype as TString.
 
void setTitle (const char *title)
 Defines the title of the attribute.
 
void setTitle (TString str)
 
TString getTitle ()
 
void setDataType (EType thetype)
 Change the type of data.
 
void setDataType (TString name)
 Change the type of data.
 
TString getLegend ()
 Returns the legend of the attribut.
 
TString getUnit ()
 
void setUnit (TString str)
 
TString getUnity ()
 
void setUnity (TString str)
 
TString getNote ()
 
void setNote (TString str)
 
Bool_t setDefault (TString value)
 
TString getDefault (TString format="%e")
 
Bool_t setDefaultValue (Double_t val)
 
Bool_t getDefaultValue (Double_t &val)
 
Bool_t hasDefaultValue ()
 
Bool_t setDefaultVector (vector< double > &vec)
 
Bool_t getDefaultVector (vector< double > *val)
 
Bool_t hasDefaultVector ()
 
Bool_t setDefaultString (TString str)
 
Bool_t getDefaultString (string &str)
 
Bool_t hasDefaultString ()
 
void setStepValue (Double_t val)
 
Bool_t getStepValue (Double_t &val)
 
TString getSlurmOption ()
 
EOrigin getOrigin ()
 
void setOrigin (EOrigin ind)
 
Int_t getShare ()
 
void setOutput ()
 Sets the attribute as an output attribute.
 
void setInput ()
 Sets the attribute as Input.
 
EAttribute getInputOutput ()
 Returns the input/Output information of the attribute.
 
void setFileNameOfKey (TString str)
 Sets the file name for a key.
 
list< URANIE::DataServer::TAttributeFileKey * > getKeyList ()
 Gets KeyList for the attribute.
 
void setFieldOfKey (Int_t ind)
 Sets index ind in the unique field related to a unique key.
 
void setFieldOfKey (Int_t sIndex, Int_t ind)
 
void setFileKey (TString sfile, TString skey="", TString sformatToSubstitute="%e", TAttributeFileKey::EFileType FileType=TAttributeFileKey::kKey)
 Defines the input files and eventually others informations like key, format to substitute.
 
void setFileFlag (TString sfile, TString skey="", TString sformatToSubstitute="%e")
 Defines the input files as in the "flag" format and eventually others informations like key, format to substitute.
 
void setFileXMLAttribute (TString sfile, TString sXPathAttribute, TString sformatToSubstitute="%e")
 Defines the input files as an "XML" input file with XPath attribute format and eventually the format to substitute.
 
void setFileXMLField (TString sfile, TString sXPathField, TString sformatToSubstitute="%e")
 Defines the input files as an "XML" input file with XPath field and eventually the format to substitute.
 
void setFileFMU (TString sfile, TString sXPathField, TString sformatToSubstitute="%e")
 
const char * getFormatToSubstitute ()
 Returns the format of substitution.
 
void setFormatToSubstitute (TString str)
 Sets the format of substitution.
 
Bool_t isInput ()
 Tests if the attribute is an input attribute.
 
Bool_t isOutput ()
 Tests if the attribute is an output attribute.
 
void addShare ()
 
void delShare ()
 
void initShare ()
 
void clearVectors ()
 
virtual void setLowerBound (Double_t val, bool internalcall=false)
 Sets the lower bound value of the attribute.
 
Double_t getLowerBound ()
 Gets the lower bound value of the attribute.
 
Bool_t isLowerBounded ()
 Returns a boolean if the attribute have a lower bound.
 
virtual void setUpperBound (Double_t val, bool internalcall=false)
 Sets the upper bound value of the attribute.
 
Double_t getUpperBound ()
 Gets the upper bound value of the attribute.
 
Bool_t isUpperBounded ()
 Returns a boolean if the attribute have an upper bound.
 
virtual void setBounds (Double_t lower, Double_t upper)
 Sets the two bounds values (lower and upper) of the attribute.
 
Bool_t isBounded ()
 Returns a boolean if the attribute have a lower AND an upper bounds.
 
void setLog ()
 
void unsetLog ()
 
void changeLog ()
 
Bool_t getLog ()
 
TAttributegetSonAttribute ()
 
void setSonAttribute (TAttribute *tatt)
 
void removeSonAttribute ()
 
Int_t getLevel ()
 
void setLevel (Int_t nlevel)
 
Bool_t haveSon ()
 

Protected Attributes

Int_t iNbValues
 
Double_t _dSumFreq
 
Double_t * pValues
 
Double_t * pFrequencies
 
- Protected Attributes inherited from URANIE::DataServer::TStochasticAttribute
ELawType _lawType
 The law type ELawType.
 
Double_t _dtheoreticalMean
 The theoretical mean.
 
Double_t _dtheoreticalStdDev
 The theoretical standard deviation.
 
Double_t _dtheoreticalMode
 The theoretical mode.
 
Double_t _pmin
 The min value of cumulative density function.
 
Double_t _pmax
 The max value of cumulative density function.
 
EStochasticBasis _nStochasticBasis
 The stochastic representation of an orthogonal basis.
 
- Protected Attributes inherited from URANIE::DataServer::TAttribute
TString _sunity
 Unity.
 
TString _snote
 Note.
 
Bool_t _blog
 Log printing.
 
Int_t _nshare
 The number of time this attribute is shared in TDataServer.
 
TAttribute_attSon
 Son attribute.
 
Int_t _nlevel
 level to its "father"
 
Bool_t _haveSon
 true if the attribute have a son
 
TString _sFormatSubstitute
 Format to substitute the value.
 
list< TEventList * > _nfields
 List of all TEventLists created for the attribute.
 
list< TAttributeFileKey * > _KeyList
 List of Keys Attributes structures.
 
Double_t upperBound
 Upper bound.
 
Bool_t _bHaveUpperBound
 If have an upper bound.
 
Double_t lowerBound
 Lower bound.
 
Bool_t _bHaveLowerBound
 If have a lower bound.
 
Double_t _defaultValue
 Default value.
 
Bool_t _bHaveDefaultValue
 If have a default value.
 
vector< double > _defaultVector
 Default value for vector.
 
Bool_t _bHaveDefaultVector
 If have a default value for vector.
 
string _defaultString
 Default value for string.
 
Bool_t _bHaveDefaultString
 If have a default value for string.
 
Double_t _stepValue
 Step value when using in Optimization.
 
Bool_t _bHaveStepValue
 If have a step value.
 
vector< Double_t > _vminimum
 All minimun calculated.
 
vector< Double_t > _vmaximum
 All maximun calculated.
 
vector< Double_t > _vmean
 All mean calculated.
 
vector< Double_t > _vstd
 All std calculated.
 
vector< Double_t > * _vbuffer
 
vector< map< double, double > * > _vquantile
 

‍buffer pointer to check addresses


 
EOrigin _norigin
 The origin of the attribute (Internal of uranie, attribute or Input, Output...)
 
EAttribute _nAttribute
 The nature of attributes : kInput (default) or kOutput.
 
EType _nType
 The type of attribute: real (double), vector (of double), string...
 
TString _slurmValue
 

Additional Inherited Members

- Public Types inherited from URANIE::DataServer::TStochasticAttribute
enum  ELawType {
  kUniform , kLogUniform , kNormal , kStudent ,
  kLogNormal , kTrapezium , kTriangular , kLogTriangular ,
  kExponential , kBeta , kGamma , kInvGamma ,
  kCauchy , kUniformByParts , kWeibull , kGumbel ,
  kMultinomial , kGenPareto , kGeneralizedNormal , kGeneralizedNormalV2 ,
  kCompose , kUnknown
}
 The list of laws that a TStochasticAttribute can follow. More...
 
enum  EStochasticBasis {
  kUnknownBasis , kHermite , kLegendre , kLaguerre ,
  kJacobi
}
 The list of orthogonal polynomial families that can represent a given TStochasticAttribute. More...
 
- Public Types inherited from URANIE::DataServer::TAttribute
enum  EOrigin {
  kInternal , kIterator , kConstant , kAttribute ,
  kDeleted
}
 
enum  EAttribute { kInput , kOutput }
 
enum  EType {
  kDefault , kReal , kVector , kString ,
  kCategory , kInconnu
}
 

Detailed Description

Description of the class TCustomDistribution.

This class allows to define a discrete distribution of probabilities by associating a list of "labels" with a list of frequencies. The labels are real numbers, but no order is assumed between them, i.e. one can't say that "label 1.0 is smaller than label 2.0". The consequence is that the notions of Probability Density Function and Cumulative Distribution Function are irrelevant and the functions getPDF, getCDF and getInvCDF don't work the same as for TStochasticAttribute objects:

  • getPDF: returns the probability of the given label;
  • getCDF: returns nothing;
  • getInvCDF: returns a label drawn from a "pseudo-cumulative" distribution function.

Constructor & Destructor Documentation

◆ TCustomDistribution() [1/3]

URANIE::DataServer::TCustomDistribution::TCustomDistribution ( )

Default constructor.

Referenced by ClassImp().

◆ TCustomDistribution() [2/3]

URANIE::DataServer::TCustomDistribution::TCustomDistribution ( TString  name)

Constructor by name only.

Parameters
name(TString) Name of the attribute

◆ TCustomDistribution() [3/3]

URANIE::DataServer::TCustomDistribution::TCustomDistribution ( TString  name,
Int_t  nbValues,
Double_t *  values,
Double_t *  frequencies = NULL 
)

Constructor by name and statistics.

This constructor allows to define the distribution. The values are considered as labels, and not numerical values. This means that there is no need to sort them. The associated "frequencies" are given in a separated array. They are not probabilities as their sum does not need to be equal to 1. However, it is assumed that the distribution is complete, i.e. the discrete random variable can only take values from the one given.

Parameters
name(TString) Name of the attribute
nbValues(Int_t) Number of values taken by the discrete variable
values(Double_t*) List of values taken by the discrete variable
frequencies(Double_t*) List of the frequencies of each value. If NULL, the values are set to be equiprobable. Default = NULL.

◆ ~TCustomDistribution()

virtual URANIE::DataServer::TCustomDistribution::~TCustomDistribution ( )
virtual

Default destructor.

Referenced by ClassImp().

Member Function Documentation

◆ computeTheoreticalInformation()

virtual void URANIE::DataServer::TCustomDistribution::computeTheoreticalInformation ( )
virtual

Mean and Variance are meaningless for non ordered discrete values.

Exceptions
alwaysthrows a UWarningExceptions.

Implements URANIE::DataServer::TStochasticAttribute.

Referenced by ClassImp().

◆ getAllFrequencies()

virtual Double_t * URANIE::DataServer::TCustomDistribution::getAllFrequencies ( )
inlinevirtual

Get the frequencies as a Double_t array.

References pFrequencies.

◆ getAllValues()

virtual Double_t * URANIE::DataServer::TCustomDistribution::getAllValues ( )
inlinevirtual

Get the values as a Double_t array.

References pValues.

◆ getCDF()

virtual Double_t URANIE::DataServer::TCustomDistribution::getCDF ( Double_t  x)
virtual

CDF is meaningless for non ordered discrete values.

This function returns 0.0.

Exceptions
alwaysthrows a UWarningExceptions.

Implements URANIE::DataServer::TStochasticAttribute.

Referenced by ClassImp().

◆ getFrequency()

virtual Double_t URANIE::DataServer::TCustomDistribution::getFrequency ( Int_t  i)
virtual

Get a frequency by index.

Parameters
i(Int_t): index of the frequency to retrieve
Exceptions
UErrorExceptionsif no frequency array exists or index is invalid.

Referenced by ClassImp().

◆ getInvCDF()

virtual Double_t URANIE::DataServer::TCustomDistribution::getInvCDF ( Double_t  p)
virtual

Returns a value from the distribution.

The choice of the value is based on a pseudo-cumulative function where the order of the discrete values is the order of appearance in the pValues array.

Parameters
p(Double_t): a probability value between 0 and 1

Implements URANIE::DataServer::TDiscreteAttribute.

Referenced by ClassImp().

◆ getNbValues()

virtual Int_t URANIE::DataServer::TCustomDistribution::getNbValues ( )
inlinevirtual

Get the number of values.

References iNbValues.

◆ getPDF() [1/2]

virtual Double_t URANIE::DataServer::TCustomDistribution::getPDF ( Double_t  x)
inlinevirtual

Returns the probability of a value x, with a precision on x fixed at 1e-9.

If x belongs to the distribution, its probability will be equal to the corresponding value in the pFrequencies array divided by the sum of the pFrequencies values. NOTE: only values belonging to the distribution have a non-zero probability. The precision to determine if x is equal to a value of the distribution is set to 1e-9.

Parameters
x(Double_t): the value for which the probability is computed.

Implements URANIE::DataServer::TDiscreteAttribute.

References getPDF().

◆ getPDF() [2/2]

virtual Double_t URANIE::DataServer::TCustomDistribution::getPDF ( Double_t  x,
Double_t  precision 
)
virtual

Returns the probability of a value.

If x belongs to the distribution, its probability will be equal to the corresponding value in the pFrequencies array divided by the sum of the pFrequencies values. NOTE: only values belonging to the distribution have a non-zero probability.

Parameters
x(Double_t): the value for which the probability is computed
precision(Double_t): the precision to determine if x is equal to a value of the distribution.

Referenced by ClassImp(), and getPDF().

◆ getProba()

virtual Double_t URANIE::DataServer::TCustomDistribution::getProba ( Int_t  i)
virtual

Return the probability corresponding to the given index.

Parameters
i(Int_t): index of the probability to retrieve
Exceptions
UErrorExceptionsif no frequency array exists or index is invalid.

Referenced by ClassImp().

◆ getValue()

virtual Double_t URANIE::DataServer::TCustomDistribution::getValue ( Int_t  i)
virtual

Get a value by index.

Parameters
i(Int_t): index of the value to retrieve
Exceptions
UErrorExceptionsif no value array exists or index is invalid.

Referenced by ClassImp().

◆ printLog()

virtual void URANIE::DataServer::TCustomDistribution::printLog ( Option_t *  option = "")
virtual

◆ setAllFrequencies()

virtual void URANIE::DataServer::TCustomDistribution::setAllFrequencies ( Double_t *  frequencies)
virtual

Set the frequencies as a Double_t array.

The size of the array must match iNbValues.

Parameters
frequencies(Double_t*): array of size "iNbValues" containing the new frequencies.
Exceptions
UErrorExceptionsif a frequency is negative or null.

Referenced by ClassImp().

◆ setAllValues()

virtual void URANIE::DataServer::TCustomDistribution::setAllValues ( Double_t *  values)
virtual

Set the values as a Double_t array.

The number of the array must match the one of the existing frequency array

Parameters
values(Double_t*): array of size "iNbValues" containing the new input values.

Referenced by ClassImp().

◆ setDistribution()

virtual void URANIE::DataServer::TCustomDistribution::setDistribution ( Int_t  nbValues,
Double_t *  values,
Double_t *  frequencies = NULL 
)
virtual

Set the value and frequency arrays. This function erase any previous arrays and reset the "iNbValues" parameter.

The values are considered as labels, and not numbers. Thus, they don't need to be sorted. The associated "frequencies"
are given in a separated array. They are not probabilities as their sum does not need to be equal to 1. However, it is assumed that the distribution is complete, i.e. the discrete random variable can only take values from the one given.

Parameters
nbValues(Int_t) Number of values taken by the discrete variable
values(Double_t*) List of values taken by the discrete variable
frequencies(Double_t*) List of the frequencies of each value. If NULL, the values are set to be equiprobable (default = NULL).
Exceptions
UErrorExceptionsif a frequency is negative or null.

Referenced by ClassImp().

◆ setFrequency()

virtual void URANIE::DataServer::TCustomDistribution::setFrequency ( Int_t  i,
Double_t  frequency 
)
virtual

Set a single frequency by index.

Parameters
i(Int_t): index of the frequency to set.
frequency(Double_t): frequency to set.
Exceptions
UErrorExceptionsif a frequency is negative or null.
UErrorExceptionsif no frequency array exists or index is invalid.

Referenced by ClassImp().

◆ setValue()

virtual void URANIE::DataServer::TCustomDistribution::setValue ( Int_t  i,
Double_t  value 
)
virtual

Set a value by index.

Parameters
i(Int_t): index of the value to set.
value(Double_t): value to set.
Exceptions
UErrorExceptionsif no value array exists or index is invalid.

Referenced by ClassImp().

Member Data Documentation

◆ _dSumFreq

Double_t URANIE::DataServer::TCustomDistribution::_dSumFreq
protected

Referenced by ClassImp().

◆ iNbValues

Int_t URANIE::DataServer::TCustomDistribution::iNbValues
protected

Referenced by ClassImp(), and getNbValues().

◆ pFrequencies

Double_t* URANIE::DataServer::TCustomDistribution::pFrequencies
protected

Referenced by ClassImp(), and getAllFrequencies().

◆ pValues

Double_t* URANIE::DataServer::TCustomDistribution::pValues
protected

Referenced by ClassImp(), and getAllValues().