ra4_stats  0341147a0dc35f80f4e12c6003afb76a38e2ed6e
Macros | Functions
utilities.hpp File Reference
#include <string>
#include <vector>
#include <stdexcept>
#include <iostream>
#include "TTree.h"
#include "RooWorkspace.h"
#include "cut.hpp"

Go to the source code of this file.

Macros

#define ERROR(x)   do{throw std::runtime_error(string("Error in file ")+__FILE__+" at line "+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

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)
 
void RmCutOn (std::string &cut, const std::string &orig, const std::string &rep="1")
 
size_t MaxIndex (const std::vector< double > &v)
 
void DefineSet (RooWorkspace &w, const std::string &set_name, const std::vector< std::string > &var_names)
 
void GetCountAndUncertainty (TTree &tree, const Cut &cut, double &count, double &uncertainty)
 
std::string execute (const std::string &cmd)
 
std::vector< std::string > Tokenize (const std::string &input, const std::string &tokens=" ")
 
std::string ChangeExtension (std::string path, const std::string &new_ext)
 
std::string MakeDir (std::string prefix)
 
void parseMasses (const std::string &str, int &mglu, int &mlsp)
 
template<typename T >
void Append (T &collection, const typename T::value_type &value)
 

Macro Definition Documentation

#define DBG (   x)    do{std::cerr << "In " << __FILE__ << " at line " << __LINE__ << " (in function " << __func__ << "): " << x << std::endl;}while(false)
#define ERROR (   x)    do{throw std::runtime_error(string("Error in file ")+__FILE__+" at line "+to_string(__LINE__)+" (in "+__func__+"): "+x);}while(false)

Function Documentation

template<typename T >
void Append ( T &  collection,
const typename T::value_type &  value 
)
std::string ChangeExtension ( std::string  path,
const std::string &  new_ext 
)

Definition at line 115 of file utilities.cpp.

Referenced by main().

bool Contains ( const std::string &  str,
const std::string &  pat 
)
void DefineSet ( RooWorkspace &  w,
const std::string &  set_name,
const std::vector< std::string > &  var_names 
)

Definition at line 62 of file utilities.cpp.

std::string execute ( const std::string &  cmd)
void GetCountAndUncertainty ( TTree &  tree,
const Cut cut,
double &  count,
double &  uncertainty 
)

Definition at line 76 of file utilities.cpp.

Referenced by Process::GetYield().

std::string MakeDir ( std::string  prefix)

Definition at line 126 of file utilities.cpp.

References ERROR.

Referenced by ExtractSignal(), and main().

size_t MaxIndex ( const std::vector< double > &  v)

Definition at line 51 of file utilities.cpp.

void parseMasses ( const std::string &  str,
int &  mglu,
int &  mlsp 
)

Definition at line 21 of file utilities.cpp.

Referenced by main().

void ReplaceAll ( std::string &  str,
const std::string &  orig,
const std::string &  rep 
)
void RmCutOn ( std::string &  cut,
const std::string &  orig,
const std::string &  rep = "1" 
)

Definition at line 42 of file utilities.cpp.

bool StartsWith ( const std::string &  str,
const std::string &  pat 
)

Definition at line 30 of file utilities.cpp.

std::vector<std::string> Tokenize ( const std::string &  input,
const std::string &  tokens = " " 
)

Definition at line 101 of file utilities.cpp.

Referenced by WorkspaceGenerator::ReadSystematicsFile().