herwig is hosted by Hepforge, IPPP Durham
Herwig++  2.7.0
Analysis2::HistogramChannel Class Reference

A channel in a histogram. More...

#include <Histogram2.h>

List of all members.

Public Member Functions

Constructors
 HistogramChannel ()
 Default constructor.
 HistogramChannel (unsigned int bins, bool counting=true)
 Construct giving the number of bins.
 HistogramChannel (const vector< pair< double, double > > &, double underflow=0., double overflow=0.)
 Construct giving contents of bins.
Methods to book events
void book (unsigned int bin, double weight=1.)
 Book the weight into the bin with the given index.
void bookUnderflow (double weight=1.)
 Book the weight into the underflow.
void bookOverflow (double weight=1.)
 Book the weight into the overflow.
void nanEvent ()
 Signal a numerical indefinite event.
Channel algebra. It takes care of properly computing uncertainties.
HistogramChanneloperator+= (const HistogramChannel &)
 Add another channel.
HistogramChanneloperator-= (const HistogramChannel &)
 Subtract another channel.
HistogramChanneloperator*= (const HistogramChannel &)
 Multiply by another channel.
HistogramChanneloperator*= (double)
 Multiply the channel by a factor.
HistogramChanneloperator+= (double)
 Add a constant to each bin.
HistogramChanneloperator*= (pair< double, double >)
 Multiply the channel by a factor including uncertainties.
HistogramChanneloperator/= (const HistogramChannel &)
 Divide two channels.
HistogramChanneloperator/= (double)
 Divide the channel by a factor.
HistogramChanneloperator/= (pair< double, double >)
 Divide the channel by a factor including uncertainties.
Access channel statistics.
bool isCountingChannel () const
 Return true, if this is a counting channel.
vector< pair< double, double > > bins () const
 Return the bins.
pair< double, double > bin (unsigned int) const
 Return the bin content for the given index.
vector< unsigned long > binEntries () const
 Return the bin entries.
unsigned long binEntries (unsigned int) const
 Return the bin entries for the given index.
void bin (unsigned int, pair< double, double >, unsigned long en=0)
 Explicitly set the content of the bin with given index.
pair< double, double > outOfRange () const
 Return under- and overflow.
unsigned long visible () const
 Return the visible entries.
unsigned long total () const
 Return the total entries.
vector< unsigned long > nanWeights () const
 Return the histogram of numerical indefinite weights.
unsigned long nanWeightEvents () const
 Return the total number of events with indefinite weights.
unsigned long nanEvents () const
 Return the number of numerical indefinite events.
Normalization and statistics
void finish ()
 Finish this channel.
double binVariance (unsigned int) const
 Return the variance of the bin content for the given bin.
double weightMean (unsigned int) const
 Return the mean of weights in the given bin.
double weightVariance (unsigned int) const
 Return the variance of weights in the given bin.
void differential (const vector< pair< double, double > > &)
 This channel is a differential distribution: divide each bin by its width.
pair< double, double > binSum () const
 Return the summed visible bin content.
pair< double, double > binAverage () const
 Return the average visible bin content.
pair< double, double > integrate (const vector< pair< double, double > > &) const
 Return the visible integral of the channel using the given binning.
pair< double, double > average (const vector< pair< double, double > > &) const
 Return the weighted average visible bin content.
HistogramChannel delta (const HistogramChannel &channel) const
 Return a channel containing this/channel - 1.
HistogramChannel chi2 (const HistogramChannel &channel, double minfrac=.0) const
 Return a channel containing the $\chi^2$ taking this as hypothesis and the given channel as data.
HistogramChannel profile () const
 Generate a channel containing the profile histogram obtained from this channel, i.e.
Utilities for store/load
void write (ostream &, const string &)
 Write out the channel.
string read (istream &)
 Read in the channel.
Functions used by the persistent I/O system.
void persistentOutput (PersistentOStream &os) const
 Function used to write out object persistently.
void persistentInput (PersistentIStream &is)
 Function used to read in object persistently.

Private Attributes

bool _isCountingChannel
 Wether or not the number of entries is meaningfull.
vector< pair< double, double > > _bins
 The contents and uncertainties squared, to be accessed by the bin id.
vector< unsigned long > _binEntries
 The number of entries in each bin, to be accessed by the bin id.
pair< double, double > _outOfRange
 The contents of under- and overflow.
unsigned long _visible
 The number of visible entries.
unsigned long _total
 The number of total entries.
unsigned long _nanEvents
 The number of numerical indefinite events.
vector< unsigned long > _nanWeights
 A histogram of the number of indefinite weights.
bool _finished
 Has finish() already been called?

Detailed Description

A channel in a histogram.

Author:
Simon Plaetzer

Definition at line 27 of file Histogram2.h.


Member Function Documentation

pair<double,double> Analysis2::HistogramChannel::bin ( unsigned  int) const [inline]

Return the bin content for the given index.

The first entry is the sum of weights, the second the sum of squared weights.

HistogramChannel Analysis2::HistogramChannel::chi2 ( const HistogramChannel channel,
double  minfrac = .0 
) const

Return a channel containing the $\chi^2$ taking this as hypothesis and the given channel as data.

Rescale the data error to data*minfrac, if data error/data < minfrac.

Finish this channel.

Provided for future use.

Function used to read in object persistently.

Parameters:
isthe persistent input stream read from.

Function used to write out object persistently.

Parameters:
osthe persistent output stream written to.

Generate a channel containing the profile histogram obtained from this channel, i.e.

a channel containing the mean of weights and its variance as content/content square values


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