SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Private Member Functions | Private Attributes
DSpiral Class Reference

Defines the methods associated with the Spiral distribution in any dimension. More...

#include <DSpiral.hh>

Inheritance diagram for DSpiral:
DFunction

Public Member Functions

 DSpiral (const size_t n=1, const double turn=1)
 Normal constructor, initilizes a Spiral distribution of dimension n. More...
 
 DSpiral (const double mu, const double sigma, const double turn=1)
 1D constructor, initilizes a Spiral of mean mu and RMS sigma More...
 
 DSpiral (const std::vector< double > &mu, const std::vector< double > &sigma, const double turn=1)
 Uncorrelated constructor, initilizes an n-Spiral of mean mu and RMS sigma. More...
 
 DSpiral (const std::vector< double > &mu, const Matrix< double > &cov, const double turn=1)
 General constructor, intializes mean and the covariance matrix of the distribution. More...
 
 DSpiral (const DSpiral &df)
 Copy constructor. More...
 
DSpiral & operator= (const DSpiral &df)
 Equality operator. More...
 
 ~DSpiral ()
 Destructor. More...
 
double CDF (const double &v) const
 Cumulative distribution function at v. More...
 
double CDFRadial (const double &R) const
 If the function has an L1, L2 or Linf symmetry, returns its CDF at radius R. More...
 
std::vector< TLine * > Contour1D (const double alpha) const
 Segment that encompass a certain p-value in 1 dimension. More...
 
std::vector< TObject * > Contour2D (const double alpha) const
 Ellipse that encompasses a certain p-value in 2 dimensions. More...
 
TF3 * Contour3D (const double alpha) const
 Ellipsoid that encompasses a certain p-value in 3 dimensions. More...
 
std::vector< TLine * > ContourRadial (const double alpha) const
 Segment that encompass a certain p-value in radius. More...
 
double ContourVolume (const double alpha) const
 Volume of the smallest contour of a given p-value. More...
 
double Evaluate (const std::vector< double > &v) const
 Returns the value of the distribution in v. More...
 
double Level (const double alpha) const
 Returns the level of the alpha-contour of the distribution. More...
 
double Norm () const
 Returns the probability content within the defined interval. More...
 
double Radial (const double R) const
 Return the value of the spiral for an R following the L2 symmetry. More...
 
double Radius (const double alpha) const
 Returns the radius of the alpha-contour, following an L2 symmetry. More...
 
double Random ()
 Returns a random value sampled from the spiral distribution. More...
 
std::vector< double > RandomVector ()
 Returns a random vector sampled from the spiral distribution. More...
 
- Public Member Functions inherited from DFunction
 DFunction ()
 Default constructor, initilizes everything to 0. More...
 
 DFunction (const DFunction &df)
 Copy constructor. More...
 
DFunction & operator= (const DFunction &df)
 Equality operator. More...
 
double operator() (const std::vector< double > &v) const
 Overloaded function operator, calls Evaluate. More...
 
double operator() (const double &v) const
 Overloaded function operator, calls Evaluate. More...
 
double operator() (const double *v) const
 Overloaded function operator, calls Evaluate. More...
 
 ~DFunction ()
 Destructor. More...
 
size_t Dimension () const
 Returns the dimension of the space. More...
 
double Evaluate (const double &v) const
 Returns the value of the PDF. More...
 
double Evaluate (const double *v) const
 Returns the value of the PDF. More...
 
void SetLowerBound (const double lower, const size_t i=0)
 Sets the lower bound of axis i. More...
 
double LowerBound (const size_t i=0) const
 Returns the lower bound of axis i. More...
 
void SetLowerBounds (std::vector< double > lower)
 Sets the vector of lower bounds. More...
 
std::vector< double > LowerBounds () const
 Returns the array of lower bounds. More...
 
void SetName (const std::string &name)
 Returns the name of the function. More...
 
std::string Name () const
 Returns the name of the function. More...
 
void SetRange (const double lower, const double upper, const size_t i=0)
 Returns the upper bound of axis i. More...
 
void SetRange (const std::vector< double > &lower, const std::vector< double > &upper)
 Returns the upper bound of axis i. More...
 
void Range (std::vector< double > &lower, std::vector< double > &upper) const
 Returns the upper bound of axis i. More...
 
void SetTitle (const std::string &title)
 Returns the name of the function. More...
 
std::string Title () const
 Returns the name of the function. More...
 
void SetUpperBound (const double upper, const size_t i=0)
 Sets the upper bound of axis i. More...
 
double UpperBound (const size_t i=0) const
 Returns the upper bound of axis i. More...
 
void SetUpperBounds (std::vector< double > upper)
 Sets the vector of upper bounds. More...
 
std::vector< double > UpperBounds () const
 Returns the array of upper bounds. More...
 
TGraph * Graph (size_t idx=0, std::vector< double > x=std::vector< double >()) const
 Returns a 1D graph of the function in the requested axis. More...
 
TGraph * GraphRadial () const
 Returns a radial graph of the function. More...
 
TH2F * Graph2D (size_t idx=0, size_t idy=1, std::vector< double > x=std::vector< double >()) const
 Returns a 2D histogram of the function in the requested axis. More...
 
TGraph * GraphCDFRadial () const
 Returns a radial graph of the cummulative density function. More...
 
void Draw (const std::string opt="", int idx=0, int idy=1, std::vector< double > x=std::vector< double >()) const
 Draws the function on whichever TCanvas is currently being used (ROOT) More...
 
void DrawRadial (const std::string opt="") const
 Draws the radial function on whichever TCanvas is currently being used (ROOT) More...
 
void Print (const std::string opt="", int idx=0, int idy=1, std::vector< double > x=std::vector< double >()) const
 Creates a canvas, draws the function on it and save it to a file. More...
 
void PrintRadial (const std::string opt="") const
 Creates a canvas, draws the radial function on it and save it to a file. More...
 

Private Member Functions

bool Initialize ()
 Initializes the distribution. More...
 
double Norm1D (const size_t i) const
 Retuns the 1D normalisation for an arbitrary interval. More...
 
std::vector< double > Parameters () const
 Returns the parameters to produce a ROOT type spiral function. More...
 
std::vector< double > OffsetParameters (const double C) const
 Returns the parameters necessary to produce a ROOT 3D contour. More...
 
Matrix< double > TwistingMatrix (const double R2) const
 Returns the twisting matrix at a given squared radius R2. More...
 

Private Attributes

std::vector< double > _mean
 Vector mean. More...
 
Matrix< double > _cov
 Covariance matrix. More...
 
Matrix< double > _invcov
 Inverse covariance matrix. More...
 
Matrix< double > _J
 Jacobian of variable change. More...
 
double _det
 Determinant of the covariance matrix. More...
 
double _turn
 Controls the turning strength. More...
 

Additional Inherited Members

- Protected Attributes inherited from DFunction
size_t _dim
 Dimension of the space the function lives in. More...
 
std::vector< double > _lower
 Array of lower bounds. More...
 
std::vector< double > _upper
 Array of upper bounds. More...
 
std::string _name
 Name of the function. More...
 
std::string _title
 Title of the function. More...
 
TRandom3 _rdmzer
 Pseudorandom number generator. More...
 

Detailed Description

Defines the methods associated with the Spiral distribution in any dimension.

This distribution is based on an n dimensional Gaussian that has a radial dependant rotation applied to it. The rotation preserves the normalisation of the Gaussian. It adopts the shape of a spiral in any 2 dimensional projections. It is a Fermat spiral as the rotation angle grows as $\theta= r^2/a^2$.

The radius of this density function is defined as the product, $\vec{x}^{T}(T\Sigma^{-1}T^{T})\vec{x}$, with $x$ the phase space vector, $\Sigma$ the covariance matrix and $T$ the twisting matrix, function of the $L^{2}$ squared radius, $R^2=\vec{x}^T\vec{x}$.

Constructor & Destructor Documentation

DSpiral::DSpiral ( const size_t  n = 1,
const double  turn = 1 
)

Normal constructor, initilizes a Spiral distribution of dimension n.

Parameters
nDimension of the space
turnTurning strength
DSpiral::DSpiral ( const double  mu,
const double  sigma,
const double  turn = 1 
)

1D constructor, initilizes a Spiral of mean mu and RMS sigma

This is identical to a 1D gaussian, a rotation in 1D is always the identity.

Parameters
muMean of the distribution
sigmaRMS of the distribution
turnTurning strength
DSpiral::DSpiral ( const std::vector< double > &  mu,
const std::vector< double > &  sigma,
const double  turn = 1 
)

Uncorrelated constructor, initilizes an n-Spiral of mean mu and RMS sigma.

Parameters
muMean of the distribution
sigmaRMS of the distribution in each dimension
turnTurning strength
DSpiral::DSpiral ( const std::vector< double > &  mu,
const Matrix< double > &  cov,
const double  turn = 1 
)

General constructor, intializes mean and the covariance matrix of the distribution.

Parameters
muMean of the distribution
covCovariance matrix of the distribution
turnTurning strength
DSpiral::DSpiral ( const DSpiral &  df)

Copy constructor.

DSpiral::~DSpiral ( )

Destructor.

Member Function Documentation

double DSpiral::CDF ( const double &  v) const
virtual

Cumulative distribution function at v.

Parameters
vValue in which to evaluate the CDF

Implements DFunction.

double DSpiral::CDFRadial ( const double &  R) const
virtual

If the function has an L1, L2 or Linf symmetry, returns its CDF at radius R.

Parameters
RRadius to evaluate at

Implements DFunction.

std::vector< TLine * > DSpiral::Contour1D ( const double  alpha) const
virtual

Segment that encompass a certain p-value in 1 dimension.

Parameters
alphaP-value

Implements DFunction.

std::vector< TObject * > DSpiral::Contour2D ( const double  alpha) const
virtual

Ellipse that encompasses a certain p-value in 2 dimensions.

Parameters
alphaP-value

Implements DFunction.

TF3 * DSpiral::Contour3D ( const double  alpha) const
virtual

Ellipsoid that encompasses a certain p-value in 3 dimensions.

Parameters
alphaP-value

Implements DFunction.

std::vector< TLine * > DSpiral::ContourRadial ( const double  alpha) const
virtual

Segment that encompass a certain p-value in radius.

Parameters
alphaP-value

Implements DFunction.

double DSpiral::ContourVolume ( const double  alpha) const
virtual

Volume of the smallest contour of a given p-value.

Parameters
alphaP-value

Implements DFunction.

double DSpiral::Evaluate ( const std::vector< double > &  v) const
virtual

Returns the value of the distribution in v.

Parameters
vVector in which to evaluate

Implements DFunction.

bool DSpiral::Initialize ( )
private

Initializes the distribution.

double DSpiral::Level ( const double  alpha) const
virtual

Returns the level of the alpha-contour of the distribution.

Parameters
alphaP-value

Implements DFunction.

double DSpiral::Norm ( ) const
virtual

Returns the probability content within the defined interval.

Implements DFunction.

double DSpiral::Norm1D ( const size_t  i) const
private

Retuns the 1D normalisation for an arbitrary interval.

Parameters
iAxis to consider
std::vector< double > DSpiral::OffsetParameters ( const double  C) const
private

Returns the parameters necessary to produce a ROOT 3D contour.

Parameters
CLevel of the contour
DSpiral & DSpiral::operator= ( const DSpiral &  df)

Equality operator.

std::vector< double > DSpiral::Parameters ( ) const
private

Returns the parameters to produce a ROOT type spiral function.

double DSpiral::Radial ( const double  R) const
virtual

Return the value of the spiral for an R following the L2 symmetry.

Parameters
RRadius to evaluate at (L2 symmetry)

Implements DFunction.

double DSpiral::Radius ( const double  alpha) const

Returns the radius of the alpha-contour, following an L2 symmetry.

Parameters
alphaP-value
double DSpiral::Random ( )
virtual

Returns a random value sampled from the spiral distribution.

Implements DFunction.

std::vector< double > DSpiral::RandomVector ( )
virtual

Returns a random vector sampled from the spiral distribution.

Implements DFunction.

Matrix< double > DSpiral::TwistingMatrix ( const double  R2) const
private

Returns the twisting matrix at a given squared radius R2.

Parameters
R2Squared radius

Field Documentation

Matrix<double> DSpiral::_cov
private

Covariance matrix.

double DSpiral::_det
private

Determinant of the covariance matrix.

Matrix<double> DSpiral::_invcov
private

Inverse covariance matrix.

Matrix<double> DSpiral::_J
private

Jacobian of variable change.

std::vector<double> DSpiral::_mean
private

Vector mean.

double DSpiral::_turn
private

Controls the turning strength.


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