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

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