babymaker  e95a6a9342d4604277fe7cc6149b6b5b24447d89
Typedefs | Enumerations | Functions | Variables
utilities.hh File Reference
#include <cstddef>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include "TString.h"
#include "TTree.h"
#include "TGraph.h"

Go to the source code of this file.

Typedefs

typedef std::pair< int, double > int_double
 
typedef std::pair< double, double > double_double
 

Enumerations

enum  varType {
  kDouble, kvDouble, kFloat, kvFloat,
  kInt, kvInt, kBool, kvBool
}
 

Functions

int change_branch_one (TString indir, TString name, TString outdir, std::vector< TString > var_type, std::vector< TString > var, std::vector< std::vector< TString > > var_val, int totentries)
 
int change_branch_one (TString indir, TString name, TString outdir, std::vector< TString > var_type, std::vector< TString > var, std::vector< TString > var_val, TString newname="empty")
 
bool eigen2x2 (float matrix[2][2], float &eig1, float &eig2)
 
bool id_big2small (const int_double &left, const int_double &right)
 
bool dd_big2small (const double_double &left, const double_double &right)
 
bool dd_small2big (const double_double &left, const double_double &right)
 
long double DeltaPhi (long double phi1, long double phi2)
 
long double SignedDeltaPhi (long double phi1, long double phi2)
 
float dR (float eta1, float eta2, float phi1, float phi2)
 
TString roundNumber (double num, int decimals, double denom=1.)
 
TString addCommas (double num)
 
long double AddInQuadrature (long double x, long double y)
 
long double GetMass (long double e, long double px, long double py, long double pz)
 
long double GetMT (long double m1, long double pt1, long double phi1, long double m2, long double pt2, long double phi2)
 
long double GetMT (long double pt1, long double phi1, long double pt2, long double phi2)
 
bool Contains (const std::string &text, const std::string &pattern)
 
std::vector< std::string > Tokenize (const std::string &input, const std::string &tokens=" ")
 
void get_count_and_uncertainty (TTree &tree, const std::string &cut, double &count, double &uncertainty)
 
void AddPoint (TGraph &graph, const double x, const double y)
 
TString hoursMinSec (long seconds)
 
float wISR (int nisr, std::vector< float > &sys_isr)
 
std::vector< TString > dirlist (const TString &folder, const TString &inname="dir", const TString &tag="")
 
void mergeNtuples (std::vector< TString > ntuples, TString outname)
 
template<class T >
noNaN (T val, T defval=1.)
 
template<class T >
short Sign (T val)
 
std::string execute (const std::string &cmd)
 
std::string RemoveTrailingNewlines (std::string str)
 
std::vector< double > LinearSpacing (size_t npts, double low, double high)
 

Variables

const long double PI = acos(-1.L)
 

Typedef Documentation

typedef std::pair<double,double> double_double

Definition at line 21 of file utilities.hh.

typedef std::pair<int,double> int_double

Definition at line 20 of file utilities.hh.

Enumeration Type Documentation

enum varType
Enumerator
kDouble 
kvDouble 
kFloat 
kvFloat 
kInt 
kvInt 
kBool 
kvBool 

Definition at line 23 of file utilities.hh.

Function Documentation

TString addCommas ( double  num)

Definition at line 499 of file utilities.cc.

References resubmit::ind.

Referenced by change_branch_one(), and main().

long double AddInQuadrature ( long double  x,
long double  y 
)

Definition at line 508 of file utilities.cc.

Referenced by dR().

void AddPoint ( TGraph &  graph,
const double  x,
const double  y 
)

Definition at line 563 of file utilities.cc.

int change_branch_one ( TString  indir,
TString  name,
TString  outdir,
std::vector< TString >  var_type,
std::vector< TString >  var,
std::vector< std::vector< TString > >  var_val,
int  totentries 
)
int change_branch_one ( TString  indir,
TString  name,
TString  outdir,
std::vector< TString >  var_type,
std::vector< TString >  var,
std::vector< TString >  var_val,
TString  newname = "empty" 
)

Definition at line 310 of file utilities.cc.

References Contains().

bool Contains ( const std::string &  text,
const std::string &  pattern 
)
bool dd_big2small ( const double_double left,
const double_double right 
)

Definition at line 454 of file utilities.cc.

bool dd_small2big ( const double_double left,
const double_double right 
)

Definition at line 450 of file utilities.cc.

long double DeltaPhi ( long double  phi1,
long double  phi2 
)

Definition at line 458 of file utilities.cc.

References PI.

Referenced by dR().

std::vector<TString> dirlist ( const TString &  folder,
const TString &  inname = "dir",
const TString &  tag = "" 
)

Definition at line 287 of file utilities.cc.

References count_root_files::files.

Referenced by main(), and onefile_skim().

float dR ( float  eta1,
float  eta2,
float  phi1,
float  phi2 
)

Definition at line 474 of file utilities.cc.

References AddInQuadrature(), DeltaPhi(), and utilities::dPhi().

Referenced by bmaker_full::writeIFSR(), and bmaker_full::writeMC().

bool eigen2x2 ( float  matrix[2][2],
float &  eig1,
float &  eig2 
)

Definition at line 437 of file utilities.cc.

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

Definition at line 553 of file utilities.cc.

long double GetMass ( long double  e,
long double  px,
long double  py,
long double  pz 
)

Definition at line 519 of file utilities.cc.

long double GetMT ( long double  m1,
long double  pt1,
long double  phi1,
long double  m2,
long double  pt2,
long double  phi2 
)

Definition at line 524 of file utilities.cc.

long double GetMT ( long double  pt1,
long double  phi1,
long double  pt2,
long double  phi2 
)

Definition at line 529 of file utilities.cc.

TString hoursMinSec ( long  seconds)

Definition at line 599 of file utilities.cc.

Referenced by main().

bool id_big2small ( const int_double left,
const int_double right 
)

Definition at line 446 of file utilities.cc.

std::vector<double> LinearSpacing ( size_t  npts,
double  low,
double  high 
)

Definition at line 588 of file utilities.cc.

Referenced by Sign().

void mergeNtuples ( std::vector< TString >  ntuples,
TString  outname 
)

Definition at line 632 of file utilities.cc.

References resubmit::ind, and bmaker_full_cfg::rootfile.

Referenced by main().

template<class T >
T noNaN ( val,
defval = 1. 
)

Definition at line 61 of file utilities.hh.

Referenced by change_branch_one(), and main().

std::string RemoveTrailingNewlines ( std::string  str)

Definition at line 581 of file utilities.cc.

Referenced by Sign().

TString roundNumber ( double  num,
int  decimals,
double  denom = 1. 
)
template<class T >
short Sign ( val)
long double SignedDeltaPhi ( long double  phi1,
long double  phi2 
)

Definition at line 463 of file utilities.cc.

References PI.

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

Definition at line 40 of file generate_baby.cxx.

Referenced by main().

float wISR ( int  nisr,
std::vector< float > &  sys_isr 
)

Definition at line 612 of file utilities.cc.

Referenced by change_branch_one(), and main().

Variable Documentation

const long double PI = acos(-1.L)

Definition at line 22 of file utilities.hh.

Referenced by DeltaPhi(), and SignedDeltaPhi().