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

Last change on this file since 1765 was 1668, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 1.6 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 kIsCosinic,
28 kIsUserArray
29 };
30
31public:
32 MBinning(const char *name=NULL, const char *title=NULL);
33
34 void SetEdges(const TArrayD &arr)
35 {
36 fEdges = arr;
37 fType = kIsUserArray;
38 }
39
40 void SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up);
41 void SetEdgesLog(const Int_t nbins, const Axis_t lo, Axis_t up);
42 void SetEdgesCos(const Int_t nbins, const Axis_t lo, Axis_t up);
43
44 // FIXME: ROOT workaround: "operator[] const" missing
45 Double_t GetEdgeLo() const { return ((TArrayD)fEdges)[0]; }
46 Double_t GetEdgeHi() const { return ((TArrayD)fEdges)[fEdges.GetSize()-1]; }
47
48 Int_t GetNumEdges() const { return fEdges.GetSize(); }
49 Int_t GetNumBins() const { return fEdges.GetSize()-1; }
50
51 Double_t *GetEdges() const { return (Double_t*)fEdges.GetArray(); }
52
53 Bool_t IsLinear() const { return fType==kIsLinear; }
54 Bool_t IsLogarithmic() const { return fType==kIsLogarithmic; }
55 Bool_t IsCosinic() const { return fType==kIsCosinic; }
56 Bool_t IsDefault() const { return fType==kIsDefault; }
57 Bool_t IsUserArray() const { return fType==kIsUserArray; }
58
59 void Apply(TH1 &);
60
61 ClassDef(MBinning, 1) //Container to store the binning of a histogram
62};
63
64#endif
65
Note: See TracBrowser for help on using the repository browser.