herwig is hosted by Hepforge, IPPP Durham
Herwig  7.1.5
Herwig::Histogram Class Reference

The Histogram class is a simple histogram for the Analysis handlers. More...

#include <Histogram.h>

Inheritance diagram for Herwig::Histogram:

Classes

struct  Bin
 One bin of the histogram. More...
 

Public Member Functions

void operator+= (double input)
 Operator to add a point to the histogrma with unit weight.
 
void addWeighted (double input, double weight)
 Function to add a weighted point to the histogram.
 
unsigned int numberOfBins () const
 Number of bins (not counting the overflow)
 
double prefactor () const
 Get the prefactor.
 
void prefactor (double in)
 Set the prefactor.
 
const StatisticglobalStatistics () const
 Access to the statistics on the total entry of the histogram.
 
void normaliseToData ()
 Normalise the distributions to the data.
 
void normaliseToCrossSection ()
 Normalise the distributions to the total cross section.
 
void chiSquared (double &chisq, unsigned int &ndegrees, double minfrac=0.) const
 Return the chi squared. More...
 
void rivetOutput (ostream &out, string histogramname=string("default"), string analysisname=string("default"), string title=string(), string xlabel=string(), string ylabel=string(), bool rawcount=false, double multiplicator=1.0) const
 Output as file ready for usage with flat2aida and other Rivet tools. More...
 
void topdrawOutput (ostream &out, unsigned int flags=0, string colour=string("BLACK"), string title=string(), string titlecase=string(), string left=string(), string leftcase=string(), string bottom=string(), string bottomcase=string()) const
 Output as a topdrawer file. More...
 
void topdrawMCatNLO (ostream &out, unsigned int flags=0, string colour=string("BLACK"), string title=string()) const
 
void topdrawOutputAverage (ostream &out, bool frame, bool errorbars, bool xlog, bool ylog, string colour=string("BLACK"), string title=string(), string titlecase=string(), string left=string(), string leftcase=string(), string bottom=string(), string bottomcase=string()) const
 Output as a topdrawer file. More...
 
unsigned int visibleEntries () const
 get the number of visible entries (all entries without those in the under- and overflow bins) in the histogram. More...
 
double dataNorm () const
 Compute the normalisation of the data.
 
void simpleOutput (ostream &out, bool errorbars, bool normdata=false)
 Output into a simple ascii file, easily readable by gnuplot.
 
vector< double > dumpBins () const
 Dump bin data into a vector.
 
Histogram ratioWith (const Histogram &h2) const
 Returns a new histogram containing bin-by-bin ratios of two histograms.
 
vector< Binbins () const
 The vector of bins.
 
Standard constructors and destructors.
 Histogram (double lower=0., double upper=0., unsigned int nbin=0)
 The default constructor. More...
 
 Histogram (vector< double > limits)
 Constructor for variable width bins. More...
 
 Histogram (vector< double > limits, vector< double > data, vector< double > dataerror)
 Constructor with data included. More...
 
- Public Member Functions inherited from ThePEG::Interfaced
virtual bool defaultInit ()
 
PPtr getParticle (PID) const
 
PDPtr getParticleData (PID) const
 
bool used () const
 
void useMe () const
 
tEGPtr generator () const
 
void persistentOutput (PersistentOStream &os) const
 
void persistentInput (PersistentIStream &is, int version)
 
PPtr getParticle (PID) const
 
PDPtr getParticleData (PID) const
 
bool used () const
 
void useMe () const
 
tEGPtr generator () const
 
void persistentOutput (PersistentOStream &os) const
 
void persistentInput (PersistentIStream &is, int version)
 
- Public Member Functions inherited from ThePEG::InterfacedBase
string fullName () const
 
string name () const
 
string path () const
 
string comment () const
 
void setup (istream &is)
 
virtual void debugme () const
 
void update ()
 
void init ()
 
virtual bool preInitialize () const
 
void initrun ()
 
void finish ()
 
void touch ()
 
void reset ()
 
void clear ()
 
InitState state () const
 
bool locked () const
 
bool touched () const
 
void persistentOutput (PersistentOStream &os) const
 
void persistentInput (PersistentIStream &is, int version)
 
void update ()
 
void init ()
 
virtual bool preInitialize () const
 
void initrun ()
 
void finish ()
 
void touch ()
 
void reset ()
 
void clear ()
 
InitState state () const
 
bool locked () const
 
bool touched () const
 
void persistentOutput (PersistentOStream &os) const
 
void persistentInput (PersistentIStream &is, int version)
 
- Public Member Functions inherited from ThePEG::Base
void debug () const
 
- Public Member Functions inherited from ThePEG::Pointer::ReferenceCounted
CounterType referenceCount () const
 
- Public Member Functions inherited from ThePEG::Named
 Named (const string &newName=string())
 
const string & name () const
 
bool operator== (const Named &other) const
 
bool operator< (const Named &other) const
 

Static Public Member Functions

static vector< double > LogBins (double xmin, unsigned nbins, double base=10.0)
 Returns limits for bins with exponentially increasing widths. More...
 
static void Init ()
 The standard Init function used to initialize the interfaces. More...
 
- Static Public Member Functions inherited from ThePEG::Interfaced
static void Init ()
 
- Static Public Member Functions inherited from ThePEG::InterfacedBase
static void Init ()
 
- Static Public Member Functions inherited from ThePEG::Base
static void Init ()
 

Protected Member Functions

Clone Methods.
virtual IBPtr clone () const
 Make a simple clone of this object. More...
 
virtual IBPtr fullclone () const
 Make a clone of this object, possibly modifying the cloned object to make it sane. More...
 
- Protected Member Functions inherited from ThePEG::Interfaced
void reporeg (IBPtr object, string name) const
 
bool setDefaultReference (PtrT &ptr, string classname, string objectname)
 
 Interfaced (const string &newName)
 
 Interfaced (const Interfaced &i)
 
void setGenerator (tEGPtr generator)
 
- Protected Member Functions inherited from ThePEG::InterfacedBase
 InterfacedBase (string newName)
 
 InterfacedBase (const InterfacedBase &i)
 
virtual void readSetup (istream &is)
 
virtual void doupdate ()
 
virtual void doinit ()
 
virtual void doinitrun ()
 
virtual void dofinish ()
 
virtual IVector getReferences ()
 
virtual void rebind (const TranslationMap &)
 
virtual void readSetup (istream &is)
 
virtual void doupdate ()
 
virtual void doinit ()
 
virtual void doinitrun ()
 
virtual void dofinish ()
 
virtual IVector getReferences ()
 
virtual void rebind (const TranslationMap &)
 
- Protected Member Functions inherited from ThePEG::Pointer::ReferenceCounted
 ReferenceCounted (const ReferenceCounted &)
 
ReferenceCountedoperator= (const ReferenceCounted &)
 
 ReferenceCounted (const ReferenceCounted &)
 
ReferenceCountedoperator= (const ReferenceCounted &)
 
- Protected Member Functions inherited from ThePEG::Named
const Namedoperator= (const Named &other)
 
const string & name (const string &newName)
 

Private Member Functions

Histogramoperator= (const Histogram &)=delete
 The assignment operator is private and must never be called. More...
 

Private Attributes

Statistic _globalStats
 Global statistics of all data that went into the histogram.
 
bool _havedata
 Set to true if there is experimental data available.
 
vector< Bin_bins
 The histogram bins. More...
 
double _prefactor
 Prefactors to multiply the output by.
 
double _total
 Total entry.
 

Static Private Attributes

static NoPIOClassDescription< HistograminitHistogram
 The static object used to initialize the description of this class. More...
 

Additional Inherited Members

- Public Types inherited from ThePEG::InterfacedBase
enum  InitState
 
- Public Types inherited from ThePEG::Pointer::ReferenceCounted
typedef unsigned int CounterType
 
- Public Attributes inherited from ThePEG::InterfacedBase
 initializing
 
 uninitialized
 
 initialized
 
 runready
 
- Public Attributes inherited from ThePEG::Pointer::ReferenceCounted
const unsigned long uniqueId
 
- Static Protected Member Functions inherited from ThePEG::Interfaced
static void registerRepository (IBPtr)
 
static void registerRepository (IBPtr, string newName)
 

Detailed Description

The Histogram class is a simple histogram for the Analysis handlers.

See also
The interfaces defined for Histogram.

Definition at line 43 of file Histogram.h.

Constructor & Destructor Documentation

◆ Histogram() [1/3]

Herwig::Histogram::Histogram ( double  lower = 0.,
double  upper = 0.,
unsigned int  nbin = 0 
)
inline

The default constructor.

Parameters
lowerThe lower limit of the histogram
upperThe upper limit of the histogram
nbinNumber of bins

Definition at line 55 of file Histogram.h.

◆ Histogram() [2/3]

Herwig::Histogram::Histogram ( vector< double >  limits)
inline

Constructor for variable width bins.

Parameters
limitsThe lower limits for the bins followed by the upper limit of the last bin

Definition at line 72 of file Histogram.h.

◆ Histogram() [3/3]

Herwig::Histogram::Histogram ( vector< double >  limits,
vector< double >  data,
vector< double >  dataerror 
)
inline

Constructor with data included.

Parameters
limitsThe lower limits for the bins followed by the upper limit of the last bin
dataThe data
dataerrorThe errors on the data

Definition at line 85 of file Histogram.h.

Member Function Documentation

◆ chiSquared()

void Herwig::Histogram::chiSquared ( double &  chisq,
unsigned int &  ndegrees,
double  minfrac = 0. 
) const

Return the chi squared.

Parameters
chisqThe chi squared
ndegreesThe number of points
minfracThe minimum fractional error on the data point

◆ clone()

virtual IBPtr Herwig::Histogram::clone ( ) const
protectedvirtual

Make a simple clone of this object.

Returns
a pointer to the new object.

Implements ThePEG::InterfacedBase.

◆ fullclone()

virtual IBPtr Herwig::Histogram::fullclone ( ) const
protectedvirtual

Make a clone of this object, possibly modifying the cloned object to make it sane.

Returns
a pointer to the new object.

Reimplemented from ThePEG::InterfacedBase.

◆ Init()

static void Herwig::Histogram::Init ( )
static

The standard Init function used to initialize the interfaces.

Called exactly once for each class by the class description system before the main function starts or when this class is dynamically loaded.

◆ LogBins()

static vector<double> Herwig::Histogram::LogBins ( double  xmin,
unsigned  nbins,
double  base = 10.0 
)
static

Returns limits for bins with exponentially increasing widths.

For usage with the variable-bin-width Histogram constructor.

Parameters
xminLower limit of the first bin, needs to be > 0
nbinsNumber of bins
baseThe base, needs to be > 1

◆ operator=()

Histogram& Herwig::Histogram::operator= ( const Histogram )
privatedelete

The assignment operator is private and must never be called.

In fact, it should not even be implemented.

◆ rivetOutput()

void Herwig::Histogram::rivetOutput ( ostream &  out,
string  histogramname = string("default"),
string  analysisname = string("default"),
string  title = string(),
string  xlabel = string(),
string  ylabel = string(),
bool  rawcount = false,
double  multiplicator = 1.0 
) const

Output as file ready for usage with flat2aida and other Rivet tools.

Parameters
outThe output stream
histogramnameThe histogram name identifying the histogram. Required for comparisons (e.g. with rivet-mkhtml or with compare-histos)
analysisnameThe analysis name
titleThe title for the top of the plot in LaTeX format
xlabelThe x label in LaTeX format
ylabelThe y label in LaTeX format
rawcountDon't normalise to unit area.
multiplicatorFactor the histogram is multiplied with. N.B. Experimental data is not output.

◆ topdrawOutput()

void Herwig::Histogram::topdrawOutput ( ostream &  out,
unsigned int  flags = 0,
string  colour = string("BLACK"),
string  title = string(),
string  titlecase = string(),
string  left = string(),
string  leftcase = string(),
string  bottom = string(),
string  bottomcase = string() 
) const

Output as a topdrawer file.

The histogram is normalised to unit area

Parameters
outThe output stream
flagsA bitmask of flags from HistogramOptions, e.g. Frame|Ylog
colourThe colour for the line
titleThe title for the top of the plot
titlecasetopdraw format for the title
leftLeft axis lable
leftcasetopdraw format for left axis label
bottomBottom axis lable
bottomcaseBottom axis lable ofr topdraw N.B. in td smoothing only works for histograms with uniform binning.

◆ topdrawOutputAverage()

void Herwig::Histogram::topdrawOutputAverage ( ostream &  out,
bool  frame,
bool  errorbars,
bool  xlog,
bool  ylog,
string  colour = string("BLACK"),
string  title = string(),
string  titlecase = string(),
string  left = string(),
string  leftcase = string(),
string  bottom = string(),
string  bottomcase = string() 
) const

Output as a topdrawer file.

A bin by bin average is taken.

Parameters
outThe output stream
frameoutput on a new graph
errorbarsoutput data points with error bars
xloglog scale on x axis
yloglog scale on y axis
colourThe colour for the line
titleThe title for the top of the plot
titlecasetopdraw format for the title
leftLeft axis lable
leftcasetopdraw format for left axis label
bottomBottom axis lable
bottomcaseBottom axis lable ofr topdraw

◆ visibleEntries()

unsigned int Herwig::Histogram::visibleEntries ( ) const

get the number of visible entries (all entries without those in the under- and overflow bins) in the histogram.

This assumes integer entries, ie it gives wrong results for weighted histograms.

Member Data Documentation

◆ _bins

vector<Bin> Herwig::Histogram::_bins
private

The histogram bins.

_bins[0] is the underflow, _bins.back() the overflow

Definition at line 389 of file Histogram.h.

◆ initHistogram

NoPIOClassDescription<Histogram> Herwig::Histogram::initHistogram
staticprivate

The static object used to initialize the description of this class.

Indicates that this is a concrete class with persistent data.

Definition at line 326 of file Histogram.h.


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