2 // Class AliRsnHistoDef
4 // Definition for a histogram type.
5 // Since one could do an analysis which is not an invariant mass
6 // the histogram definition should be more flexible, and it is stored
7 // separately in a new class.
8 // This class considers the possibility of a 1D or 2D histograms
9 // with its related binning, and can create a new histo from his definitions
17 #include "AliRsnHistoDef.h"
19 ClassImp(AliRsnHistoDef)
21 //_____________________________________________________________________________
22 AliRsnHistoDef::AliRsnHistoDef() :
26 // Default constructor
30 //_____________________________________________________________________________
31 AliRsnHistoDef::AliRsnHistoDef
32 (Int_t nbins, Double_t min, Double_t max) :
36 // 1D histo definition.
39 SetBins(nbins, min, max);
41 //_____________________________________________________________________________
42 AliRsnHistoDef::AliRsnHistoDef
43 (Int_t nbinsX, Double_t minX, Double_t maxX, Int_t nbinsY, Double_t minY, Double_t maxY):
47 // 1D histo definition.
50 SetBins(nbinsX, minX, maxX, nbinsY, minY, maxY);
53 //_____________________________________________________________________________
54 void AliRsnHistoDef::SetBins(Int_t n, Double_t min, Double_t max)
57 // Binning for 1D histograms.
69 //_____________________________________________________________________________
70 void AliRsnHistoDef::SetBins
71 (Int_t nx, Double_t minx, Double_t maxx, Int_t ny, Double_t miny, Double_t maxy)
74 // Binning for 1D histograms.
90 //_____________________________________________________________________________
91 void AliRsnHistoDef::CheckEdges()
94 // Checks that histogram edges are appropriate,
95 // otherwise swaps them.
99 for (i = 0; i < fNDim; i++) {
100 if (fMin[i] > fMax[i]) {
101 AliWarning(Form("min = %f -- max = %f --> swapping", fMin, fMax));
102 Double_t temp = fMin[i];
109 //_____________________________________________________________________________
110 TH1D* AliRsnHistoDef::Create1DHistogram(const char *name, const char *title)
113 // Create 1D histogram, if the configuration is appropriate for this.
117 AliError("Number of dimension not set to 1!");
121 TH1D *histo = new TH1D(name, title, fNBins[0], fMin[0], fMax[0]);
125 //_____________________________________________________________________________
126 TH2D* AliRsnHistoDef::Create2DHistogram(const char *name, const char *title)
129 // Create 2D histogram, if the configuration is appropriate for this.
133 AliError("Number of dimension not set to 2!");
137 TH2D *histo = new TH2D(name, title, fNBins[0], fMin[0], fMax[0], fNBins[1], fMin[1], fMax[1]);