RootUtils
StringUtils Namespace Reference

Functions

TString stripExtension (const char *path)
 Remove extension from a file path. More...
 
void writeProgress (const char *message, Int_t nTimes)
 Simple implementation of an ASCII progress bar. More...
 
EnergyValueUnit formatEnergy (Double_t value)
 Format energy to appropriate unit. Function outputs EnergyValueUnit structure containing energy value converted to the best unit for presenting - TeV, GeV, .. eV. More...
 
TString getSafeName (const char *name)
 Get save ROOT object name. More...
 

Detailed Description

Useful string operations.

Function Documentation

◆ formatEnergy()

EnergyValueUnit StringUtils::formatEnergy ( Double_t  value)

Format energy to appropriate unit. Function outputs EnergyValueUnit structure containing energy value converted to the best unit for presenting - TeV, GeV, .. eV.

Parameters
valueEnergy value in default Geant4 unit - MeV.
Returns
EnergyValueUnit Structure containing value (double) and unit (std::string).

◆ getSafeName()

TString StringUtils::getSafeName ( const char *  name)

Get save ROOT object name.

Function checks if ROOT object with given name exists and appends corresponding index to it avoiding objects with duplicate names.

Parameters
naemBase name of a new object.
Returns
TString object name with appended index to it

◆ stripExtension()

TString StringUtils::stripExtension ( const char *  path)

Remove extension from a file path.

Parameters
pathFile name or path.
Returns
File name or path without extension.

◆ writeProgress()

void StringUtils::writeProgress ( const char *  message,
Int_t  nTimes 
)

Simple implementation of an ASCII progress bar.

Parameters
messageString explaining what is happening.
Returns
nTimes How many times writeProgress will be called.