GamR  0.0.0
GammaROOT
Loading...
Searching...
No Matches
GamR::Utils Namespace Reference

Classes

class  Clicker
 
class  REPL
 

Functions

template<typename... Ts, typename F>
void for_each_in_tuple (std::tuple< Ts... > &t, F f)
 Applies function on each element of tuple.
 
template<typename T1, typename T2, typename F>
void for_both_in_tuple (T1 &t1, T2 &t2, F f)
 Applies function taking both elements of tuple as arguments.
 
template<typename T1, typename T2, typename F, typename N>
void for_both_in_tuple (T1 &t1, T2 &t2, F f, N n)
 
double Fac10 (int n)
 
TH1D * GetHist1D (TVirtualPad *canvas)
 
std::vector< TH1D * > GetHists1D (TVirtualPad *canvas)
 
TH2D * GetHist2D (TVirtualPad *canvas)
 
int wrresult (char *out, float value, float err, int minlen)
 
std::string wrresult (double value, double error)
 
char * c_to_f_str (std::string strin)
 
double Simps (double *y, int n, double dx)
 
std::complex< double > ** Simps (std::complex< double > ***rho, int n, double dx)
 
std::string getline (std::ifstream &f)
 
int catcherr (std::string inp, double &val, bool require_positive)
 
int catcherr (std::string inp, float &val, bool require_positive)
 
int catcherr (std::string inp, int &val, bool require_positive)
 
int GetInput (std::string prompt, double &val, bool require_positive)
 
int GetInput (std::string prompt, float &val, bool require_positive)
 
int GetInput (std::string prompt, int &val, bool require_positive)
 
int GetNPads (TVirtualPad *pad)
 

Detailed Description

Useful tools for general use. Here goes general utility functions, conversion libraries, and in anything generally useful but not particularly physics-y

Function Documentation

◆ c_to_f_str()

char * GamR::Utils::c_to_f_str ( std::string strin)

Definition at line 284 of file Utilities.cc.

Referenced by GamR::Coulex::ReadDatafile().

+ Here is the caller graph for this function:

◆ catcherr() [1/3]

int GamR::Utils::catcherr ( std::string inp,
double & val,
bool require_positive )

Definition at line 340 of file Utilities.cc.

Referenced by GetInput(), GetInput(), GetInput(), and GamR::Coulex::CoulexCalculation::ReadFromFile().

+ Here is the caller graph for this function:

◆ catcherr() [2/3]

int GamR::Utils::catcherr ( std::string inp,
float & val,
bool require_positive )

Definition at line 353 of file Utilities.cc.

◆ catcherr() [3/3]

int GamR::Utils::catcherr ( std::string inp,
int & val,
bool require_positive )

Definition at line 366 of file Utilities.cc.

◆ Fac10()

double GamR::Utils::Fac10 ( int n)

Function to calculate n!/10^n for up to n=79

Returns
n!/10^n

Definition at line 18 of file Utilities.cc.

Referenced by GamR::AngDist::djmm().

+ Here is the caller graph for this function:

◆ for_both_in_tuple() [1/2]

template<typename T1, typename T2, typename F>
void GamR::Utils::for_both_in_tuple ( T1 & t1,
T2 & t2,
F f )

Applies function taking both elements of tuple as arguments.

An extension of GamR::Utils::for_each_in_tuple.

Parameters
t1First tuple
t2Second tuple (length less than tuple 1)
fFunction of type void(T1, T2)

Definition at line 83 of file Tuples.hh.

Referenced by GamR::Tree::TDetDefn< Ts >::Calibrate(), GamR::Tree::TEvent< ADets >::FillEvent(), and GamR::Tree::TDetDefn< Ts >::IsGood().

+ Here is the caller graph for this function:

◆ for_both_in_tuple() [2/2]

template<typename T1, typename T2, typename F, typename N>
void GamR::Utils::for_both_in_tuple ( T1 & t1,
T2 & t2,
F f,
N n )

Definition at line 89 of file Tuples.hh.

◆ for_each_in_tuple()

template<typename... Ts, typename F>
void GamR::Utils::for_each_in_tuple ( std::tuple< Ts... > & t,
F f )

Applies function on each element of tuple.

As tuples may be a heterogeneous container, the function must be templated, or a lambda function utilizing auto for the input parameter. The function must be able to act upon all the types contained in the tuple.

Parameters
tTuple of types Ts...
fFunction of type void(T)

Definition at line 67 of file Tuples.hh.

Referenced by GamR::Tree::TEvent< ADets >::TEvent(), GamR::Tree::TExpDefn< ADefns >::Load(), GamR::Tree::TExpDefn< ADefns >::LoadRaw(), GamR::Tree::TEvent< ADets >::Reset(), and GamR::Tree::TDetDefn< Ts >::SetPtrs().

+ Here is the caller graph for this function:

◆ GetHist1D()

TH1D * GamR::Utils::GetHist1D ( TVirtualPad * canvas)

◆ GetHist2D()

◆ GetHists1D()

std::vector< TH1D * > GamR::Utils::GetHists1D ( TVirtualPad * canvas)

Definition at line 204 of file Utilities.cc.

Referenced by GamR::Spect::NormSpectra(), GamR::Spect::NormSpectraBackSub(), GamR::Spect::Rebin(), and GamR::Spect::Rename().

+ Here is the caller graph for this function:

◆ GetInput() [1/3]

int GamR::Utils::GetInput ( std::string prompt,
double & val,
bool require_positive )

Definition at line 379 of file Utilities.cc.

References catcherr().

Referenced by GamR::Coulex::CoulexCalculation::SetBeam(), GamR::Coulex::CoulexCalculation::SetInterests(), GamR::Coulex::CoulexCalculation::SetLevelScheme(), GamR::Coulex::CoulexCalculation::SetParticleDet(), and GamR::Coulex::CoulexCalculation::SetTarget().

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

◆ GetInput() [2/3]

int GamR::Utils::GetInput ( std::string prompt,
float & val,
bool require_positive )

Definition at line 390 of file Utilities.cc.

References catcherr().

+ Here is the call graph for this function:

◆ GetInput() [3/3]

int GamR::Utils::GetInput ( std::string prompt,
int & val,
bool require_positive )

Definition at line 400 of file Utilities.cc.

References catcherr().

+ Here is the call graph for this function:

◆ getline()

std::string GamR::Utils::getline ( std::ifstream & f)

Definition at line 330 of file Utilities.cc.

Referenced by GamR::Coulex::CoulexCalculation::ReadFromFile().

+ Here is the caller graph for this function:

◆ GetNPads()

int GamR::Utils::GetNPads ( TVirtualPad * pad)

Definition at line 411 of file Utilities.cc.

Referenced by GamR::Spect::ContourCalc(), GamR::Spect::LinAll(), GamR::Spect::LogAll(), GamR::Spect::Rebin(), GamR::Spect::RebinX(), GamR::Spect::RebinY(), GamR::Spect::UnZoomAllX(), GamR::Spect::UnZoomAllY(), GamR::Spect::ZoomAllX(), and GamR::Spect::ZoomAllY().

+ Here is the caller graph for this function:

◆ Simps() [1/2]

double GamR::Utils::Simps ( double * y,
int n,
double dx )

Definition at line 301 of file Utilities.cc.

Referenced by GamR::AngDist::SolidAttenuation::SolidAttenuation(), and GamR::Coulex::CoulexCalculation::CalcTensor().

+ Here is the caller graph for this function:

◆ Simps() [2/2]

std::complex< double > ** GamR::Utils::Simps ( std::complex< double > *** rho,
int n,
double dx )

Definition at line 310 of file Utilities.cc.

◆ wrresult() [1/2]

int GamR::Utils::wrresult ( char * out,
float value,
float err,
int minlen )

◆ wrresult() [2/2]

std::string GamR::Utils::wrresult ( double value,
double error )

Definition at line 275 of file Utilities.cc.

References wrresult().

+ Here is the call graph for this function: