source: trunk/MagicSoft/Mars/mhist/MBinning.h@ 1604

Last change on this file since 1604 was 1572, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 1.4 KB
Line 
1#ifndef MARS_MBinning
2#define MARS_MBinning
3
4#ifndef MARS_MParContainer
5#include "MParContainer.h"
6#endif
7
8#ifndef ROOT_TArrayD
9#include "TArrayD.h"
10#endif
11
12class TH1;
13
14class MBinning : public MParContainer
15{
16private:
17 TArrayD fEdges;
18
19 Byte_t fType;
20
21 void StreamPrimitive(ofstream &out) const;
22
23 enum {
24 kIsDefault,
25 kIsLinear,
26 kIsLogarithmic,
27 kIsUserArray
28 };
29
30public:
31 MBinning(const char *name=NULL, const char *title=NULL);
32
33 void SetEdges(const TArrayD &arr)
34 {
35 fEdges = arr;
36 fType = kIsUserArray;
37 }
38
39 void SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up);
40 void SetEdgesLog(const Int_t nbins, const Axis_t lo, Axis_t up);
41
42 // FIXME: ROOT workaround: "operator[] const" missing
43 Double_t GetEdgeLo() const { return ((TArrayD)fEdges)[0]; }
44 Double_t GetEdgeHi() const { return ((TArrayD)fEdges)[fEdges.GetSize()-1]; }
45
46 Int_t GetNumEdges() const { return fEdges.GetSize(); }
47 Int_t GetNumBins() const { return fEdges.GetSize()-1; }
48
49 Double_t *GetEdges() const { return (Double_t*)fEdges.GetArray(); }
50
51 Bool_t IsLinear() const { return fType==kIsLinear; }
52 Bool_t IsLogarithmic() const { return fType==kIsLogarithmic; }
53 Bool_t IsDefault() const { return fType==kIsDefault; }
54 Bool_t IsUserArray() const { return fType==kIsUserArray; }
55
56 void Apply(TH1 &);
57
58 ClassDef(MBinning, 1) //Container to store the binning of a histogram
59};
60
61#endif
62
Note: See TracBrowser for help on using the repository browser.