OMSim
Geant4 for IceCube optical module studies
OMSimTools.hh File Reference

Definition of Tools namespace, a collection of helper methods. More...

Include dependency graph for OMSimTools.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 Tools
 A collection of helper functions for numerical operations.
 

Functions

std::vector< double > Tools::arange (double p_start, double p_stop, double p_step)
 Generates a sequence of numbers. More...
 
TGraph * Tools::create1dInterpolator (const std::vector< double > &p_X, const std::vector< double > &p_y, const std::string &p_name)
 Creates a TGraph interpolator from x and y data points. More...
 
TGraph * Tools::create1dInterpolator (const std::string &p_filename)
 Creates a TGraph interpolator from x and y in file. More...
 
TH2D * Tools::create2DHistogramFromDataFile (const std::string &p_filePath)
 Create a histogram from provided data. More...
 
void Tools::ensureDirectoryExists (const std::string &p_filePath)
 Ensure that the directory of a file to be created exists. More...
 
std::pair< std::vector< double >, std::vector< double > > Tools::histogram (const std::vector< double > &data, const std::variant< int, std::vector< double >> &bins, const std::optional< std::pair< double, double >> &p_range, const std::vector< double > &p_weights)
 Compute the histogram of a dataset. More...
 
G4String Tools::getThreadIDStr ()
 
std::vector< std::vector< double > > Tools::loadtxt (const std::string &p_filePath, bool p_unpack, size_t p_skipRows, char p_delimiter, char p_comments)
 Reads numerical data from a file and returns it as a 2D vector. Similar to numpy.loadtxt. More...
 
std::vector< double > Tools::linspace (double p_start, double p_stop, int p_num, bool p_endpoint)
 Generates a linearly spaced vector. More...
 
std::vector< double > Tools::logspace (double p_start, double p_stop, int p_num, double base, bool p_endpoint)
 Generates a logarithmically spaced vector. More...
 
void Tools::sortVectorByReference (std::vector< G4double > &p_referenceVector, std::vector< G4double > &p_sortVector)
 Sorts two vectors (p_sortVector & p_referenceVector) based on the order of values in p_referenceVector. More...
 
double Tools::median (std::vector< double > p_vec)
 
double Tools::mean (const std::vector< double > &p_vec, const std::vector< double > &p_weights={})
 
double Tools::std (const std::vector< double > &vec, const std::vector< double > &p_weights={})
 
void Tools::throwError (const G4String &message)
 
std::vector< G4String > Tools::splitStringByDelimiter (G4String const &p_string, char p_delim)
 
std::vector< G4String > Tools::splitStringByDelimiter (char *p_char, char p_delim)
 

Variables

std::string Tools::visualisationURL = "https://icecube.github.io/OMSim/md_extra_doc_2_technicalities.html#autotoc_md30"