HyperVector
A HyperVector is the aggregation of a vector and a symmetric matrix, representing a list of parameters (of type double) and its covariance matrix.
This class is a basic RecPack class used in State’s, Measuremen’s, etc. The data members are:
// A vector of double’s of any dimension
EVector vector;
// A matrix of double’s of any dimension
EMatrix matrix;
// the hypervector representation (the meaning of the different components)
std::string representation;
// the number of degrees of freedom of the HyperVector.
// This is defined as the number of components with non-zero error
int ndof;
// the chi2 of the HyperVector
// This is defined as vector*matrix_inv*vector_transposed
double chi2;
All information is contained in the vector and the matrix. Both ndof and chi2 are kept to avoid calculating twice the same quantity (they are calculated
automatically the first time the access function is called). The member functions:
// returns the vector
EVector vector();
// returns the covariance matrix
EMatrix matrix();
// the representation
const std::string& representation() const;
// the dimension of the vector
int dim();
// the number of degrees of freedom: number of parameters with non-zero variance
int ndf();
// this is the square of the vector times the inverse of the matrix (v M^-1 v^T)
double chi2();
// the chi2 divided by the number of degrees of freedom
double chi2ndf();
// the pull of a component is defined as the component divided by its error
EVector pull();
A HyperVector can be built as follows:
// Build a HyperVector hv of dimension n (int) and initialise it to 0
HyperVector hv(n);
// Build a HyperVector provided a EVector v and its covariance matrix C. Optional representation
HyperVector hv(v,C,rep);
// Build a HyperVector provided a EVector v. The covariance matrix is initialized to 0. Optional representation
HyperVector hv(v,rep);
// Build a HyperVector provided a EVector v and the EVector ev
// with the square root of the diagonal elements of the covariance matrix. Optional representation
HyperVector hv(v,ev,rep);
// Build a HyperVector of dimension 1 provided a scalar a and its error ea. Optional representation
HyperVector hv(a,ea,rep);