AliPhysics  6f1d526 (6f1d526)
TCustomBinning Class Reference

Helper class creating user defined custom binning. More...

#include <TCustomBinning.h>

Inheritance diagram for TCustomBinning:

## Classes

class  MinNotSetException
Exception thrown in case the minimum is not set. More...

## Public Member Functions

TCustomBinning ()

virtual ~TCustomBinning ()

virtual TBinningMakeCopy () const

void SetMinimum (Double_t min)

void AddStep (Double_t max, Double_t binwidth)

virtual void CreateBinEdges (TArrayD &edges) const

Public Member Functions inherited from TBinning
TBinning ()

virtual ~TBinning ()

## Private Attributes

Double_t fMinimum
Minimum of the binning. More...

Bool_t fMinimumSet
Define whether minimum is set. Attention: Bin edges will not be created without minimum. More...

std::map< double, double > fSteps
List of ranges with common bin width. More...

## Detailed Description

Helper class creating user defined custom binning.

Since
May 31st, 2016

A custom binning is defined by a user an can contain bins of different width. The user has to define ranges in which the bin width is equal, bin edges are calculated accordingly. Do do so, the first step is to define a minimum for the range.

TCustomBinning mybinning;
mybinning.SetMinimum(-100.);

Now ranges can be added via the AddStep function:

mybinning.AddStep(-10., 10.);
mybinning.AddStep(10., 1.);
mybinning.AddStep(100., 10);

In this example the binning is done:

• from -100 to -10 in steps of 10
• from -10 to 10 in steps of 1
• from 10 to 100 in steps of 10

The binning can be converted to a TArrayD which contains the bin edges in increasing order:

TArrayD binlimits;
mybinning.CreateBinEdges(binlimits);
Note
In case the binning is used together with the THistManager the last step is done by the THistManager and does not need to be performed by the user.

Definition at line 52 of file TCustomBinning.h.

## Constructor & Destructor Documentation

 TCustomBinning::TCustomBinning ( )

Constructor

Definition at line 24 of file TCustomBinning.cxx.

Referenced by MakeCopy().

 virtual TCustomBinning::~TCustomBinning ( )
inlinevirtual

Destructor

Definition at line 93 of file TCustomBinning.h.

## Member Function Documentation

 void TCustomBinning::AddStep ( Double_t max, Double_t binwidth )

Add new step. Will create bins in steps of the binwidth from the previous maximum to the maximum assigned here.

Parameters
 [in] max New maximum of the binning [in] binwidth Width of the bin

Definition at line 32 of file TCustomBinning.cxx.

 void TCustomBinning::CreateBinEdges ( TArrayD & edges ) const
virtual

Create bin edges from the minimum and the ranges. Bin edges will be stored in the array edges in increasing order

Parameters
 [out] edges Array storing bin edges
Exceptions
 MinNotSetException in case the minimum is not defined

Implements TBinning.

Definition at line 40 of file TCustomBinning.cxx.

Referenced by AliAnaCalorimeterQA::GetCreateOutputObjects().

 TBinning * TCustomBinning::MakeCopy ( ) const
virtual

Implementation of the copy function for the custom binning class

Returns
Copy of this binning with the exact same bin edges

Implements TBinning.

Definition at line 69 of file TCustomBinning.cxx.

 void TCustomBinning::SetMinimum ( Double_t min )
inline

Set the minumum (the lowest bin edge). As the bin edges are calculated based on the minumum this information is cructial to be provided by the user.

Parameters
 [in] minimum bin edge

Definition at line 107 of file TCustomBinning.h.

## Member Data Documentation

 Double_t TCustomBinning::fMinimum
private

Minimum of the binning.

Definition at line 126 of file TCustomBinning.h.

Referenced by CreateBinEdges(), and SetMinimum().

 Bool_t TCustomBinning::fMinimumSet
private

Define whether minimum is set. Attention: Bin edges will not be created without minimum.

Definition at line 127 of file TCustomBinning.h.

Referenced by CreateBinEdges(), and SetMinimum().

 std::map TCustomBinning::fSteps
private

List of ranges with common bin width.

Definition at line 128 of file TCustomBinning.h.

Referenced by AddStep(), and CreateBinEdges().

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