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

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