AliPhysics  56f1704 (56f1704)
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.

Author
Markus Fasel marku.nosp@m.s.fa.nosp@m.sel@c.nosp@m.ern..nosp@m.ch, Lawrence Berkeley National Laboratory
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(), and TCustomBinning::MinNotSetException::what().

virtual TCustomBinning::~TCustomBinning ( )
inlinevirtual

Destructor

Definition at line 93 of file TCustomBinning.h.

Member Function Documentation

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]edgesArray storing bin edges
Exceptions
MinNotSetExceptionin case the minimum is not defined

Implements TBinning.

Definition at line 40 of file TCustomBinning.cxx.

Referenced by AliAnaCalorimeterQA::GetCreateOutputObjects(), and SetMinimum().

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.

Referenced by ~TCustomBinning().

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<double, double> 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: