ra4_draw
4bd0201e3d922d42bd545d4b045ed44db33454a4
|
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <limits>
#include <mutex>
#include <set>
#include <numeric>
#include "TH1D.h"
#include "TRandom3.h"
Go to the source code of this file.
Namespaces | |
Multithreading | |
Macros | |
#define | ERROR(x) do{throw std::runtime_error(std::string("Error in file ")+__FILE__+" at line "+std::to_string(__LINE__)+" (in "+__func__+"): "+x);}while(false) |
#define | DBG(x) do{std::cerr << "In " << __FILE__ << " at line " << __LINE__ << " (in function " << __func__ << "): " << x << std::endl;}while(false) |
Functions | |
std::set< std::string > | Glob (const std::string &pattern) |
std::string | Basename (const std::string &filename) |
bool | Contains (const std::string &str, const std::string &pat) |
bool | StartsWith (const std::string &str, const std::string &pat) |
void | ReplaceAll (std::string &str, const std::string &orig, const std::string &rep) |
std::string | CopyReplaceAll (const std::string &str, const std::string &orig, const std::string &rep) |
std::string | execute (const std::string &cmd) |
std::string | CodeToPlainText (std::string code) |
std::string | CodeToLatex (std::string code) |
std::string | CodeToRootTex (std::string code) |
template<typename T > | |
std::vector< std::size_t > | SortPermutation (const std::vector< T > &vec) |
template<typename T > | |
std::vector< T > | ApplyPermutation (const std::vector< T > &vec, const std::vector< std::size_t > &perm) |
std::vector< std::string > | Tokenize (const std::string &input, const std::string &tokens=" ") |
std::string | MakeDir (std::string prefix) |
void | AdjustDensityForBinWidth (TH1D &h) |
void | Normalize (TH1D &h, double normalization, bool norm_per_avg_x) |
void | MergeOverflow (TH1D &h, bool merge_underflow, bool merge_overflow) |
std::string | FixedDigits (double x, int n_digits) |
std::string | FullTitle (const TH1 &h) |
template<typename T > | |
void | Append (T &collection, const typename T::value_type &value) |
template<typename T > | |
std::string | ToString (const T &x) |
template<typename T > | |
std::string | ToLongString (const T &x) |
TString | HoursMinSec (float fseconds) |
TString | AddCommas (double num) |
TString | RoundNumber (double num, int decimals, double denom=1.) |
double | Significance (double Nobs, double Nbkg, double Eup_bkg, double Edown_bkg=-1.) |
double | gsl_ran_gamma (const double a, const double b, TRandom3 &rand) |
double | intGaus (double mean, double sigma, double minX, double maxX) |
float | deltaR (float eta1, float phi1, float eta2, float phi2) |
double | calcKappa (std::vector< std::vector< float > > &entries, std::vector< std::vector< float > > &weights, std::vector< float > &powers, float &mSigma, float &pSigma, bool do_data=false, bool verbose=false, double syst=-1., bool do_plot=false, int nrep=100000) |
Variables | |
std::mutex | Multithreading::root_mutex |
#define DBG | ( | x | ) | do{std::cerr << "In " << __FILE__ << " at line " << __LINE__ << " (in function " << __func__ << "): " << x << std::endl;}while(false) |
Definition at line 18 of file utilities.hpp.
Referenced by Hist1D::AddEntries(), PlotOpt::BackgroundsStacked(), FunctionParser::CheckSolved(), Hist1D::GetBottomHorizontal(), Hist2D::GetComponent(), Table::GetComponent(), Hist1D::GetComponent(), Hist1D::GetCutLines(), anonymous_namespace{baby.cpp}::GetFunction(), Baby::GetFunction(), main(), PlotOpt::MakeSane(), Palette::operator()(), PlotOpt::SetProperty(), Hist1D::StyleHisto(), and PlotOpt::TypeString().
#define ERROR | ( | x | ) | do{throw std::runtime_error(std::string("Error in file ")+__FILE__+" at line "+std::to_string(__LINE__)+" (in "+__func__+"): "+x);}while(false) |
Definition at line 17 of file utilities.hpp.
Referenced by Baby::ActivateChain(), ApplyPermutation(), FunctionParser::CheckForUnknowns(), FunctionParser::CheckSolved(), Hist1D::GetBottomPlots(), Table::GetComponentList(), Hist2D::GetComponentList(), Hist1D::GetComponentList(), Hist2D::GetLabels(), Hist1D::GetTitleTexts(), PlotOpt::LoadOptions(), main(), Clustering::Clusterizer::NearestNeighbors(), Palette::operator()(), and NamedFunc::operator[]().
TString AddCommas | ( | double | num | ) |
Definition at line 351 of file utilities.cpp.
Referenced by PlotMaker::GetYields(), and ToLongString().
void AdjustDensityForBinWidth | ( | TH1D & | h | ) |
Definition at line 273 of file utilities.cpp.
Referenced by ApplyPermutation(), and Hist1D::ScaleHistos().
void Append | ( | T & | collection, |
const typename T::value_type & | value | ||
) |
Definition at line 69 of file utilities.hpp.
std::vector<T> ApplyPermutation | ( | const std::vector< T > & | vec, |
const std::vector< std::size_t > & | perm | ||
) |
Definition at line 47 of file utilities.hpp.
References AdjustDensityForBinWidth(), ERROR, FixedDigits(), FullTitle(), MakeDir(), MergeOverflow(), Normalize(), and Tokenize().
Referenced by main().
std::string Basename | ( | const std::string & | filename | ) |
Definition at line 38 of file utilities.cpp.
Referenced by PlotMaker::GetYield().
double calcKappa | ( | std::vector< std::vector< float > > & | entries, |
std::vector< std::vector< float > > & | weights, | ||
std::vector< float > & | powers, | ||
float & | mSigma, | ||
float & | pSigma, | ||
bool | do_data = false , |
||
bool | verbose = false , |
||
double | syst = -1. , |
||
bool | do_plot = false , |
||
int | nrep = 100000 |
||
) |
Definition at line 469 of file utilities.cpp.
References anonymous_namespace{plot_mismeasure.cxx}::bignum, gsl_ran_gamma(), and intGaus().
Referenced by findPreds(), main(), plotRatio(), and ToLongString().
std::string CodeToLatex | ( | std::string | code | ) |
Definition at line 242 of file utilities.cpp.
References CodeToRootTex(), and ReplaceAll().
Referenced by main(), and printTable().
std::string CodeToPlainText | ( | std::string | code | ) |
Definition at line 79 of file utilities.cpp.
References ReplaceAll().
Referenced by addSlices(), main(), Hist2D::Name(), Hist1D::Name(), plotRatio(), EventScan::Print(), and Table::PrintPie().
std::string CodeToRootTex | ( | std::string | code | ) |
Definition at line 116 of file utilities.cpp.
References ReplaceAll().
Referenced by CodeToLatex(), plotKappa(), plotRatio(), Table::PrintPie(), and Hist1D::Title().
bool Contains | ( | const std::string & | str, |
const std::string & | pat | ||
) |
Definition at line 44 of file utilities.cpp.
Referenced by anonymous_namespace{hist1d.cpp}::DrawAll(), main(), and Table::PrintPie().
std::string CopyReplaceAll | ( | const std::string & | str, |
const std::string & | orig, | ||
const std::string & | rep | ||
) |
Referenced by main().
float deltaR | ( | float | eta1, |
float | phi1, | ||
float | eta2, | ||
float | phi2 | ||
) |
Definition at line 420 of file utilities.cpp.
Referenced by Functions::NISRMatch(), nisrMatch(), and ToLongString().
std::string execute | ( | const std::string & | cmd | ) |
Definition at line 65 of file utilities.cpp.
Referenced by SlideMaker::Close(), and main().
std::string FixedDigits | ( | double | x, |
int | n_digits | ||
) |
Definition at line 316 of file utilities.cpp.
Referenced by Hist1D::AddEntries(), and ApplyPermutation().
std::string FullTitle | ( | const TH1 & | h | ) |
Definition at line 331 of file utilities.cpp.
Referenced by ApplyPermutation(), Expand(), and Clustering::Clusterizer::GetGraph().
std::set<std::string> Glob | ( | const std::string & | pattern | ) |
Definition at line 27 of file utilities.cpp.
Referenced by Process::Process().
double gsl_ran_gamma | ( | const double | a, |
const double | b, | ||
TRandom3 & | rand | ||
) |
Definition at line 386 of file utilities.cpp.
Referenced by calcKappa(), and ToLongString().
TString HoursMinSec | ( | float | fseconds | ) |
Definition at line 337 of file utilities.cpp.
Referenced by PlotMaker::GetYields(), main(), and ToLongString().
double intGaus | ( | double | mean, |
double | sigma, | ||
double | minX, | ||
double | maxX | ||
) |
Definition at line 416 of file utilities.cpp.
Referenced by calcKappa(), and ToLongString().
std::string MakeDir | ( | std::string | prefix | ) |
Definition at line 262 of file utilities.cpp.
Referenced by ApplyPermutation().
void MergeOverflow | ( | TH1D & | h, |
bool | merge_underflow, | ||
bool | merge_overflow | ||
) |
Definition at line 300 of file utilities.cpp.
Referenced by ApplyPermutation().
void Normalize | ( | TH1D & | h, |
double | normalization, | ||
bool | norm_per_avg_x | ||
) |
Definition at line 290 of file utilities.cpp.
Referenced by ApplyPermutation(), and Hist1D::NormalizeHistos().
void ReplaceAll | ( | std::string & | str, |
const std::string & | orig, | ||
const std::string & | rep | ||
) |
Definition at line 52 of file utilities.cpp.
Referenced by NamedFunc::CleanName(), SlideMaker::Close(), CodeToLatex(), CodeToPlainText(), CodeToRootTex(), CopyReplaceAll(), FunctionParser::FunctionParser(), FunctionParser::FunctionString(), PlotOpt::LoadOptions(), main(), Palette::operator()(), Hist1D::Print(), abcd_method::setLeptons(), abcd_method::setMj12(), and anonymous_namespace{table.cpp}::ToLatex().
TString RoundNumber | ( | double | num, |
int | decimals, | ||
double | denom = 1. |
||
) |
Definition at line 361 of file utilities.cpp.
Referenced by addSlices(), SlideMaker::AddSlide(), PlotMaker::GetYields(), main(), Hist1D::Print(), printDebug(), Table::PrintPie(), printTable(), ToLongString(), and Zbi().
double Significance | ( | double | Nobs, |
double | Nbkg, | ||
double | Eup_bkg, | ||
double | Edown_bkg = -1. |
||
) |
Definition at line 426 of file utilities.cpp.
Referenced by ToLongString(), and Zbi().
std::vector<std::size_t> SortPermutation | ( | const std::vector< T > & | vec | ) |
Definition at line 39 of file utilities.hpp.
Referenced by main().
bool StartsWith | ( | const std::string & | str, |
const std::string & | pat | ||
) |
Definition at line 48 of file utilities.cpp.
std::vector<std::string> Tokenize | ( | const std::string & | input, |
const std::string & | tokens = " " |
||
) |
Definition at line 248 of file utilities.cpp.
Referenced by ApplyPermutation().
std::string ToLongString | ( | const T & | x | ) |
Definition at line 81 of file utilities.hpp.
References AddCommas(), calcKappa(), deltaR(), gsl_ran_gamma(), HoursMinSec(), intGaus(), RoundNumber(), Significance(), anonymous_namespace{table_2016-06-03_freeze_preapp_an.cxx}::syst, and anonymous_namespace{plot_tru_isr.cxx}::verbose.
std::string ToString | ( | const T & | x | ) |
Definition at line 74 of file utilities.hpp.
Referenced by Hist2D::GetBkgHist(), and Table::Print().