source: trunk/MagicSoft/Mars/mhbase/MH.h@ 4983

Last change on this file since 4983 was 4966, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 4.3 KB
Line 
1#ifndef MARS_MH
2#define MARS_MH
3
4#ifndef MARS_MParContainer
5#include "MParContainer.h"
6#endif
7
8class TH1;
9class TH1I;
10class TH1D;
11class TH2;
12class TH3;
13class TAxis;
14class TArrayF;
15class TArrayD;
16class MArrayF;
17class MArrayD;
18class TCanvas;
19
20class MBinning;
21class MParList;
22
23class MH : public MParContainer
24{
25private:
26 Byte_t fSerialNumber;
27
28public:
29 MH(const char *name=NULL, const char *title=NULL);
30
31
32 virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; }
33 Byte_t GetSerialNumber() const { return fSerialNumber; }
34 TString AddSerialNumber(const char *str) const { TString s(str); if (fSerialNumber==0) return s; s += ";"; s += fSerialNumber; return s; }
35 TString AddSerialNumber(const TString &str) const { return AddSerialNumber((const char*)str); }
36
37 Bool_t OverwritesDraw(TClass *cls=NULL) const;
38
39 virtual Bool_t SetupFill(const MParList *pList) { return kTRUE; }
40 virtual Bool_t ReInit(MParList *pList) { return kTRUE; }
41 virtual Bool_t Fill(const MParContainer *par, const Stat_t weight=1);
42 virtual Bool_t Finalize() { return kTRUE; }
43
44 virtual TString GetDataMember() const { return ""; }
45
46 virtual TH1 *GetHistByName(const TString name);
47
48 static TCanvas *MakeDefCanvas(TString name="", const char *title="",
49 UInt_t w=625, UInt_t h=440,
50 Bool_t usescreenfactor=kTRUE);
51 static TCanvas *MakeDefCanvas(const TObject *obj,
52 UInt_t w=625, UInt_t h=440,
53 Bool_t usescreenfactor=kFALSE);
54
55 // FIXME: * --> & !!!
56
57 static void SetBinning(TH1 *h, const MBinning *binsx);
58 static void SetBinning(TH2 *h, const MBinning *binsx, const MBinning *binsy);
59 static void SetBinning(TH3 *h, const MBinning *binsx, const MBinning *binsy, const MBinning *binsz);
60
61 static void SetBinning(TH1 *h, const TArrayD &binsx);
62 static void SetBinning(TH2 *h, const TArrayD &binsx, const TArrayD &binsy);
63 static void SetBinning(TH3 *h, const TArrayD &binsx, const TArrayD &binsy, const TArrayD &binsz);
64
65 static void SetBinning(TH1 *h, const TAxis *binsx);
66 static void SetBinning(TH2 *h, const TAxis *binsx, const TAxis *binsy);
67 static void SetBinning(TH3 *h, const TAxis *binsx, const TAxis *binsy, const TAxis *binsz);
68
69 static void SetBinning(TH1 *h, const TH1 *x);
70
71 static void RemoveFirstBin(TH1 &h);
72
73 static Bool_t ApplyBinning(const MParList &plist, TString name, TH1 *h);
74
75 static void ScaleArray(TArrayD &bins, Double_t f);
76 static TArrayD ScaleAxis(TAxis &axe, Double_t f);
77 static void ScaleAxis(TH1 *bins, Double_t fx=1, Double_t fy=1, Double_t fz=1);
78
79 static Double_t GetBinCenterLog(const TAxis &axe, Int_t nbin);
80
81 static void DrawSameCopy(const TH1 &hist1, const TH1 &hist2, const TString title);
82 static void DrawSame(TH1 &hist1, TH1 &hist2, const TString title);
83
84 TObject *Clone(const char *name="") const;
85
86 TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const;
87 TObject *DrawClone(Option_t *opt="") const
88 {
89 return MH::DrawClone(opt, 625, 440);
90 }
91
92 static TVirtualPad *GetNewPad(TString &opt);
93
94 static void FindGoodLimits(Int_t nbins, Int_t &newbins, Double_t &xmin, Double_t &xmax, Bool_t isInteger);
95 static Double_t GetMinimumGT(const TH1 &h, Double_t gt=0);
96 static Int_t StripZeros(TH1 *h, Int_t nbins);
97
98 static TH1I* ProjectArray(const TArrayF &array, Int_t nbins=30,
99 const char* name="ProjectArray", const char* title="Projected Array");
100 static TH1I* ProjectArray(const TArrayD &array, Int_t nbins=30,
101 const char* name="ProjectArray", const char* title="Projected Array");
102 static TH1I* ProjectArray(const MArrayF &array, Int_t nbins=30,
103 const char* name="ProjectArray", const char* title="Projected Array");
104 static TH1I* ProjectArray(const MArrayD &array, Int_t nbins=30,
105 const char* name="ProjectArray", const char* title="Projected Array");
106
107 static void ProjectionX(TH1D &dest, const TH2 &src, Int_t firstybin=-1, Int_t lastybin=9999);
108 static void ProjectionY(TH1D &dest, const TH2 &src, Int_t firstxbin=-1, Int_t lastxbin=9999);
109
110 static TObject *FindObjectInPad(const char *name, TVirtualPad *pad=NULL);
111
112 ClassDef(MH, 1) //A base class for Mars histograms
113};
114
115#endif
116
Note: See TracBrowser for help on using the repository browser.