]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnHistoDef.cxx
fix for bug #70582 (change from L. Molnar)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnHistoDef.cxx
1 //
2 // Class AliRsnHistoDef
3 //
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
10 //
11
12 #include <TObject.h>
13
14 //#include "AliLog.h"
15 #include "AliRsnHistoDef.h"
16
17 ClassImp(AliRsnHistoDef)
18
19 //_____________________________________________________________________________
20 AliRsnHistoDef::AliRsnHistoDef() :
21     fNBins(0),
22     fMin(0.0),
23     fMax(0.0)
24 {
25 //
26 // Default constructor
27 //
28 }
29
30 //_____________________________________________________________________________
31 AliRsnHistoDef::AliRsnHistoDef
32 (Int_t nbins, Double_t min, Double_t max) :
33     fNBins(0),
34     fMin(0.0),
35     fMax(0.0)
36 {
37 //
38 // 1D histo definition.
39 //
40   SetBins(nbins, min, max);
41 }
42
43 //_____________________________________________________________________________
44 AliRsnHistoDef::AliRsnHistoDef
45 (Double_t min, Double_t max, Double_t step) :
46     fNBins(0),
47     fMin(0.0),
48     fMax(0.0)
49 {
50 //
51 // 1D histo definition.
52 //
53   SetBins(min, max, step);
54 }
55
56 //_____________________________________________________________________________
57 void AliRsnHistoDef::SetBins(Int_t n, Double_t min, Double_t max)
58 {
59 //
60 // Binning for histogram.
61 //
62
63   fNBins = n;
64
65   if (min < max)
66   {
67     fMin = min;
68     fMax = max;
69   }
70   else
71   {
72     fMin = max;
73     fMax = min;
74   }
75 }
76
77 //_____________________________________________________________________________
78 void AliRsnHistoDef::SetBins(Double_t min, Double_t max, Double_t step)
79 {
80 //
81 // Binning for histogram.
82 //
83
84   if (min < max)
85   {
86     fMin = min;
87     fMax = max;
88   }
89   else
90   {
91     fMin = max;
92     fMax = min;
93   }
94
95   fNBins = (Int_t)((fMax - fMin) / (step)) + 1;
96 }