wavecatcher-analysis
Loading...
Searching...
No Matches
Helpers Class Reference

#include <Helpers.h>

Static Public Member Functions

template<typename T >
static bool Contains (const vector< T > &vec, const T &val)
 Returns true if vector vec contains value val.
 
static void filterChannelUserInput (vector< int > &, const vector< int >)
 Check if user input exists in data and remove channels that are not there.
 
static double * gety (const vector< float > &, int, int)
 Get truncated array of y values for a certain waveform.
 
template<typename HistType >
static double * gety (HistType *, int, int)
 Get truncated array of y values for a certain waveform.
 
template<typename HistType >
static double * gety (HistType *his)
 Get array of y values for a histogram.
 
static string ListFiles (const char *, const char *)
 Helper. Creates a list of .bin data files in data folder to be read in.
 
static void PrintProgressBar (int, int)
 Print progress bar for a loop in steps of 10 percent.
 
static int rcolor (unsigned int)
 Translate a random number into a useful root color https://root.cern.ch/doc/master/classTColor.html.
 
static void SetRangeCanvas (TCanvas *&, double, double, double=-999, double=-999)
 Set consistent x-axis and y-axis range for all TH1 histograms on a canvas.
 
template<typename HistType >
static void ShiftTH1 (HistType *&, int)
 Shift a histogram in x
The histogram will be cycled, so bins at the end will be attached at the front and vice versa.
 
static void SplitCanvas (TCanvas *&, vector< int >, vector< int >)
 Helper to split canvas according to the number of channels to be plotted.
 

Detailed Description

Definition at line 19 of file Helpers.h.

Member Function Documentation

◆ Contains()

template<typename T >
static bool Helpers::Contains ( const vector< T > &  vec,
const T &  val 
)
inlinestatic

Returns true if vector vec contains value val.

Template Parameters
TType of the elements
Parameters
vecVector to search for ->
valValue

Definition at line 55 of file Helpers.h.

◆ filterChannelUserInput()

void Helpers::filterChannelUserInput ( vector< int > &  user_channels,
const vector< int >  active_channels 
)
static

Check if user input exists in data and remove channels that are not there.

Parameters
user_channelsUser input
active_channelsFrom data

Definition at line 97 of file Helpers.cc.

◆ gety() [1/3]

double * Helpers::gety ( const vector< float > &  waveform,
int  start_at,
int  end_at 
)
static

Get truncated array of y values for a certain waveform.

Parameters
waveformWaveform
start_atTruncate from index
end_atTruncate to index
Returns
Truncated Y values of waveform

Definition at line 180 of file Helpers.cc.

◆ gety() [2/3]

template<typename HistType >
double * Helpers::gety ( HistType *  his,
int  start_at,
int  end_at 
)
static

Get truncated array of y values for a certain waveform.

Template Parameters
HistTypeHistogram derived from ROOT TH1
Parameters
hisWaveform histogram
start_atTruncate from index
end_atTruncate to index
Returns
Truncated Y values of waveform

Definition at line 157 of file Helpers.cc.

◆ gety() [3/3]

template<typename HistType >
double * Helpers::gety ( HistType *  his)
static

Get array of y values for a histogram.

Template Parameters
HistTypeHistogram derived from ROOT TH1
Parameters
hisPointer to histogram
Returns
Array of Y values

Definition at line 138 of file Helpers.cc.

◆ ListFiles()

string Helpers::ListFiles ( const char *  dirname,
const char *  ext 
)
static

Helper. Creates a list of .bin data files in data folder to be read in.

Parameters
dirnameDirectory
extFile extension
Returns
String of line separated file names

Definition at line 7 of file Helpers.cc.

◆ PrintProgressBar()

void Helpers::PrintProgressBar ( int  index,
int  length 
)
static

Print progress bar for a loop in steps of 10 percent.

Parameters
indexCurrent loop index
lengthLength of loop

Definition at line 28 of file Helpers.cc.

◆ rcolor()

int Helpers::rcolor ( unsigned int  i)
static

Translate a random number into a useful root color https://root.cern.ch/doc/master/classTColor.html.

Parameters
iIndex of your plotting loop that is to be translated into a useful ROOT color index
Returns
ROOT color index
Examples
use_functions_wo_measurement.cc.

Definition at line 44 of file Helpers.cc.

◆ SetRangeCanvas()

void Helpers::SetRangeCanvas ( TCanvas *&  c,
double  x_range_min,
double  x_range_max,
double  y_range_min = -999,
double  y_range_max = -999 
)
static

Set consistent x-axis and y-axis range for all TH1 histograms on a canvas.

Will only change the axes where min != max.

Parameters
cCanvas Canvas
x_range_minX-axis minimum
x_range_maxX-axis maximum
y_range_minY-axis minimum
y_range_maxY-axis maximum

Definition at line 59 of file Helpers.cc.

◆ ShiftTH1()

template<typename HistType >
template void Helpers::ShiftTH1< TH1I > ( HistType *&  ,
int   
)
static

Shift a histogram in x
The histogram will be cycled, so bins at the end will be attached at the front and vice versa.

Template Parameters
HistTypeHistogram derived from ROOT TH1
Parameters
hisHistogram to be shifted
shift_binsNumber of bins in x to shift by

Definition at line 199 of file Helpers.cc.

◆ SplitCanvas()

void Helpers::SplitCanvas ( TCanvas *&  c,
vector< int >  active_channels,
vector< int >  plot_active_channels 
)
static

Helper to split canvas according to the number of channels to be plotted.

Parameters
cCanvas to be split
active_channelsAll channels available in the data
plot_active_channelsThe channels from the data that should be plotted

Definition at line 121 of file Helpers.cc.


The documentation for this class was generated from the following files: