PYTHIA  8.303
Public Member Functions | Static Public Member Functions | Friends | List of all members
Hist Class Reference

#include <Basics.h>

Public Member Functions

 Hist ()
 Constructors, including copy constructors.
 
 Hist (string titleIn, int nBinIn=100, double xMinIn=0., double xMaxIn=1., bool logXIn=false)
 
 Hist (const Hist &h)
 
 Hist (string titleIn, const Hist &h)
 
Histoperator= (const Hist &h)
 
void book (string titleIn=" ", int nBinIn=100, double xMinIn=0., double xMaxIn=1., bool logXIn=false)
 Book a histogram.
 
void title (string titleIn=" ")
 Set title of a histogram.
 
void null ()
 Reset bin contents.
 
void fill (double x, double w=1.)
 Fill bin with weight.
 
void table (ostream &os=cout, bool printOverUnder=false, bool xMidBin=true) const
 Print histogram contents as a table (e.g. for Gnuplot, Rivet or Pyplot). More...
 
void table (string fileName, bool printOverUnder=false, bool xMidBin=true) const
 
void rivetTable (ostream &os=cout, bool printError=false) const
 Print histogram contents as a table, in Rivet's *.dat style. More...
 
void rivetTable (string fileName, bool printError=false) const
 
void pyplotTable (ostream &os=cout, bool isHist=true) const
 Print histogram contents as a table, as appropriate for Pyplot. More...
 
void pyplotTable (string fileName, bool isHist=true) const
 
string getTitle () const
 Return title and size of histogram. Also if logarithmic x scale.
 
int getBinNumber () const
 
int getNonFinite () const
 
bool getLinX () const
 
double getXMin () const
 Return min and max in x and y directions.
 
double getXMax () const
 
double getYMin () const
 
double getYMax () const
 
double getYAbsMin () const
 
double getXMean () const
 
double getYMean () const
 
double getBinContent (int iBin) const
 Return content of specific bin: 0 gives underflow and nBin+1 overflow. More...
 
int getEntries (bool alsoNonFinite=true) const
 Return number of entries.
 
bool sameSize (const Hist &h) const
 Check whether another histogram has same size and limits.
 
void takeLog (bool tenLog=true)
 Take logarithm (base 10 or e) of bin contents. More...
 
void takeSqrt ()
 Take square root of bin contents. More...
 
void normalize (double sum=1., bool alsoOverflow=true)
 Normalize bin contents to given sum, by default including overflow bins.
 
Histoperator+= (const Hist &h)
 Operator overloading with member functions. More...
 
Histoperator-= (const Hist &h)
 Subtract histogram from existing one.
 
Histoperator*= (const Hist &h)
 Multiply existing histogram by another one.
 
Histoperator/= (const Hist &h)
 Divide existing histogram by another one.
 
Histoperator+= (double f)
 Add constant offset to histogram.
 
Histoperator-= (double f)
 Subtract constant offset from histogram.
 
Histoperator*= (double f)
 Multiply histogram by constant.
 
Histoperator/= (double f)
 Divide histogram by constant. More...
 
Hist operator+ (double f) const
 
Hist operator+ (const Hist &h2) const
 
Hist operator- (double f) const
 
Hist operator- (const Hist &h2) const
 
Hist operator* (double f) const
 
Hist operator* (const Hist &h2) const
 
Hist operator/ (double f) const
 
Hist operator/ (const Hist &h2) const
 

Static Public Member Functions

static Hist plotFunc (function< double(double)> f, string titleIn, int nBinIn, double xMinIn, double xMaxIn, bool logXIn=false)
 Create a histogram that is the plot of the given function.
 

Friends

ostream & operator<< (ostream &os, const Hist &h)
 Print a histogram with overloaded << operator. More...
 
void table (const Hist &h1, const Hist &h2, ostream &os, bool printOverUnder, bool xMidBin)
 Print a table out of two histograms with same x axis. More...
 
void table (const Hist &h1, const Hist &h2, string fileName, bool printOverUnder, bool xMidBin)
 
Hist operator+ (double f, const Hist &h1)
 Operator overloading with friends. More...
 
Hist operator- (double f, const Hist &h1)
 
Hist operator* (double f, const Hist &h1)
 
Hist operator/ (double f, const Hist &h1)
 

Detailed Description

Hist class. This class handles a single histogram at a time.

Member Function Documentation

double getBinContent ( int  iBin) const

Return content of specific bin: 0 gives underflow and nBin+1 overflow.

Get content of specific bin. Special values are bin 0 for underflow and bin nBin+1 for overflow. All other bins outside proper histogram range return 0.

Hist & operator+= ( const Hist h)

Operator overloading with member functions.

Add histogram to existing one.

Hist & operator/= ( double  f)

Divide histogram by constant.

Set empty contents when division by zero.

void pyplotTable ( ostream &  os = cout,
bool  isHist = true 
) const

Print histogram contents as a table, as appropriate for Pyplot.

Set precision.

For plotting as a histogram one needs bin edges as last column.

And also an extra no-weights line to give final upper bin edge.

void rivetTable ( ostream &  os = cout,
bool  printError = false 
) const

Print histogram contents as a table, in Rivet's *.dat style.

Print histogram vector bin by bin, with x range in first two columns and +- error in last two (assuming that contents is number of events).

void table ( ostream &  os = cout,
bool  printOverUnder = false,
bool  xMidBin = true 
) const

Print histogram contents as a table (e.g. for Gnuplot, Rivet or Pyplot).

Print histogram contents as a table (e.g. for Gnuplot).

Print histogram vector bin by bin, with mean x as first column.

void takeLog ( bool  tenLog = true)

Take logarithm (base 10 or e) of bin contents.

Take 10-logarithm or natural logarithm of contents bin by bin.

Find smallest positive bin content, and put min a bit below.

Take 10-logarithm bin by bin, but ensure positivity.

Take natural logarithm bin by bin, but ensure positivity.

void takeSqrt ( )

Take square root of bin contents.

Take square root of contents bin by bin; set 0 for negative content.

Friends And Related Function Documentation

Hist operator+ ( double  f,
const Hist h1 
)
friend

Operator overloading with friends.

Implementation of operator overloading with friends.

ostream& operator<< ( ostream &  os,
const Hist h 
)
friend

Print a histogram with overloaded << operator.

Print a histogram: also operator overloading with friend.

Print a histogram with overloaded << operator.

Do not print empty histograms.

Write time and title.

Group bins, where required, to make printout have fewer columns. Avoid overflow.

Find minimum and maximum bin content.

Determine scale and step size for y axis.

Convert bin contents to integer form; fractional fill in top row.

Print histogram row by row.

Print sign and value of bin contents

Print sign and value of lower bin edge.

Print explanation if histogram cannot be shown.

Calculate and print statistics.

void table ( const Hist h1,
const Hist h2,
ostream &  os = cout,
bool  printOverUnder = false,
bool  xMidBin = true 
)
friend

Print a table out of two histograms with same x axis.

Print a table out of two histograms with same x axis (e.g. for Gnuplot).

Require histogram x axes to agree.

Print histogram vectors bin by bin, with mean x as first column.


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