MURE
Loading...
Searching...
No Matches
Functions
MiscFunction.cxx File Reference

Methods for linear regression and auxiliaries for error logging. More...

#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include "MiscFunction.hxx"
#include "MureConstant.hxx"

Functions

void RotateVector (vector< double > &V, double phi, double theta, double psi)
 Rotate a Vector clockwise. ??? why a shape member?
 
void RotatePoint (double *P, double phi, double theta, double psi, double *center)
 Rotate a Point clockwise.??? why a shape member?
 
void RotatePoint (vector< double > &P, double phi, double theta, double psi, double *center)
 Rotate a Point clockwise.??? why a shape member?
 
double PS (vector< double > U, vector< double >V)
 Scalar product of 3D vectors U and V.
 
string wordwrap (string x, int w)
 word-wrap a string
 
string __macro_method_name__ (string x)
 this is for METHOD_NAME macro, extracting method name from PRETTY_FUNCTION
 
void Regression (int N, const vector< double > &x, const vector< double > &y, const vector< double > &y_sdev, double &A, double &B, double &A_sdev, double &B_sdev, double &chi2)
 Linear Regression function.
 
void FindFitParameters (int N, const vector< double > &x, const vector< double > &y, const vector< double > &y_sdev, double &A, double &B)
 Find Slope and Intersept of fit.
 
double CylVol (double Radius, double Height)
 
double OnionRingVol (double Radius_a, double Radius_i, double Height)
 
double OnionRingVol (double Radius_a, double Radius_i, double Height_a, double Height_i)
 

Detailed Description

Methods for linear regression and auxiliaries for error logging.

Function Documentation

◆ __macro_method_name__()

string __macro_method_name__ ( string  x)

this is for METHOD_NAME macro, extracting method name from PRETTY_FUNCTION

◆ CylVol()

double CylVol ( double  Radius,
double  Height 
)

◆ FindFitParameters()

void FindFitParameters ( int  N,
const vector< double > &  x,
const vector< double > &  y,
const vector< double > &  y_sdev,
double &  A,
double &  B 
)

Find Slope and Intersept of fit.

The method uses the Regression function.

Author
PTO
Version
1.0
Parameters
N: Number of point to use for the regression
x: vector of X axis (only the N first are taken into account)
y: vector of Y axis value (only the N first are taken into account)
y_sdev: vector of Y axis error value (only the N first are taken into account). if size=0 no weights are used
A: the slope of the regression
B: the intersept of the regression

◆ OnionRingVol() [1/2]

double OnionRingVol ( double  Radius_a,
double  Radius_i,
double  Height 
)

◆ OnionRingVol() [2/2]

double OnionRingVol ( double  Radius_a,
double  Radius_i,
double  Height_a,
double  Height_i 
)

◆ PS()

double PS ( vector< double >  U,
vector< double >  V 
)

Scalar product of 3D vectors U and V.

◆ Regression()

void Regression ( int  N,
const vector< double > &  x,
const vector< double > &  y,
const vector< double > &  y_sdev,
double &  A,
double &  B,
double &  A_sdev,
double &  B_sdev,
double &  chi2 
)

Linear Regression function.

The method is taken from Numerical Recipes and converted in C++ form.

Author
PTO
Version
1.0
Parameters
N: Number of point to use for the regression
x: vector of X axis (only the N first are taken into account)
y: vector of Y axis value (only the N first are taken into account)
y_sdev: vector of Y axis error value (only the N first are taken into account). if size=0 no weights are used
A: the slope of the regression
B: the intersept of the regression
A_sdev: the slope error of the regression
B_sdev: the slope intersept of the regression
chi2the chi square

◆ RotatePoint() [1/2]

void RotatePoint ( double *  P,
double  phi,
double  theta = 0,
double  psi = 0,
double *  center = nullptr 
)

Rotate a Point clockwise.??? why a shape member?

Parameters
P: 3D point
phi: angle around z axis
theta: angle around y axis
psi: arround x axis
center: the center of rotation (Default=origin)

◆ RotatePoint() [2/2]

void RotatePoint ( vector< double > &  P,
double  phi,
double  theta = 0,
double  psi = 0,
double *  center = nullptr 
)

Rotate a Point clockwise.??? why a shape member?

Parameters
P: 3D point
phi: angle around z axis
theta: angle around y axis
psi: arround x axis
center: the center of rotation (Default=origin)

◆ RotateVector()

void RotateVector ( vector< double > &  V,
double  phi,
double  theta = 0,
double  psi = 0 
)

Rotate a Vector clockwise. ??? why a shape member?

Parameters
V: 3D vector
phi: arround z axis
theta: arround y axis
psi: arround x axis

◆ wordwrap()

string wordwrap ( string  x,
int  w 
)

word-wrap a string

Parameters
x: String to be wrapped
w: Maximum width

MURE Project, documentation generated by Doxygen 1.9.7 - Fri Jan 19 2024