| 1 | #ifndef MARS_MH | 
|---|
| 2 | #define MARS_MH | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef MARS_MParContainer | 
|---|
| 5 | #include "MParContainer.h" | 
|---|
| 6 | #endif | 
|---|
| 7 |  | 
|---|
| 8 | class TH1; | 
|---|
| 9 | class TH1I; | 
|---|
| 10 | class TH1D; | 
|---|
| 11 | class TH2; | 
|---|
| 12 | class TH3; | 
|---|
| 13 | class TAxis; | 
|---|
| 14 | class TArrayF; | 
|---|
| 15 | class TArrayD; | 
|---|
| 16 | class MArrayF; | 
|---|
| 17 | class MArrayD; | 
|---|
| 18 | class TCanvas; | 
|---|
| 19 |  | 
|---|
| 20 | class MBinning; | 
|---|
| 21 | class MParList; | 
|---|
| 22 |  | 
|---|
| 23 | class MH : public MParContainer | 
|---|
| 24 | { | 
|---|
| 25 | private: | 
|---|
| 26 | Byte_t fSerialNumber;   // Serial number (eg of telecope) | 
|---|
| 27 | UInt_t fNumExecutions;  // Number of calls to Fill function | 
|---|
| 28 |  | 
|---|
| 29 | public: | 
|---|
| 30 | MH(const char *name=NULL, const char *title=NULL); | 
|---|
| 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 | UInt_t GetNumExecutions() const { return fNumExecutions; } | 
|---|
| 38 | void SetNumExecutions(UInt_t n) { fNumExecutions=n; } | 
|---|
| 39 |  | 
|---|
| 40 | void PrintSkipped(UInt_t n, const char *str); | 
|---|
| 41 |  | 
|---|
| 42 | Bool_t OverwritesDraw(TClass *cls=NULL) const; | 
|---|
| 43 |  | 
|---|
| 44 | virtual Bool_t SetupFill(const MParList *pList) { return kTRUE; } | 
|---|
| 45 | virtual Bool_t ReInit(MParList *pList) { return kTRUE; } | 
|---|
| 46 | virtual Bool_t Fill(const MParContainer *par, const Stat_t weight=1); | 
|---|
| 47 | virtual Bool_t Finalize() { return kTRUE; } | 
|---|
| 48 |  | 
|---|
| 49 | virtual TString GetDataMember() const { return ""; } | 
|---|
| 50 |  | 
|---|
| 51 | virtual TH1 *GetHistByName(const TString name) const; | 
|---|
| 52 |  | 
|---|
| 53 | static TCanvas *MakeDefCanvas(TString name="", const char *title="", | 
|---|
| 54 | UInt_t w=625, UInt_t h=440, | 
|---|
| 55 | Bool_t usescreenfactor=kTRUE); | 
|---|
| 56 | static TCanvas *MakeDefCanvas(const TObject *obj, | 
|---|
| 57 | UInt_t w=625, UInt_t h=440, | 
|---|
| 58 | Bool_t usescreenfactor=kFALSE); | 
|---|
| 59 |  | 
|---|
| 60 | static void RemoveFromPad(const char *name); | 
|---|
| 61 |  | 
|---|
| 62 | // FIXME: * --> & !!! | 
|---|
| 63 |  | 
|---|
| 64 | static void SetBinning(TH1 *h, const MBinning *binsx); | 
|---|
| 65 | static void SetBinning(TH2 *h, const MBinning *binsx, const MBinning *binsy); | 
|---|
| 66 | static void SetBinning(TH3 *h, const MBinning *binsx, const MBinning *binsy, const MBinning *binsz); | 
|---|
| 67 |  | 
|---|
| 68 | static void SetBinning(TH1 *h, const TArrayD &binsx); | 
|---|
| 69 | static void SetBinning(TH2 *h, const TArrayD &binsx, const TArrayD &binsy); | 
|---|
| 70 | static void SetBinning(TH3 *h, const TArrayD &binsx, const TArrayD &binsy, const TArrayD &binsz); | 
|---|
| 71 |  | 
|---|
| 72 | static void SetBinning(TH1 *h, const TAxis *binsx); | 
|---|
| 73 | static void SetBinning(TH2 *h, const TAxis *binsx, const TAxis *binsy); | 
|---|
| 74 | static void SetBinning(TH3 *h, const TAxis *binsx, const TAxis *binsy, const TAxis *binsz); | 
|---|
| 75 |  | 
|---|
| 76 | static void SetBinning(TH1 *h, const TH1 *x); | 
|---|
| 77 |  | 
|---|
| 78 | static void SetBinomialErrors(TH1 &hres, const TH1 &h1, const TH1 &h2, Double_t c1=1, Double_t c2=1); | 
|---|
| 79 |  | 
|---|
| 80 | static void RemoveFirstBin(TH1 &h); | 
|---|
| 81 |  | 
|---|
| 82 | static Bool_t ApplyBinning(const MParList &plist, TString x, TH1 *h); | 
|---|
| 83 | static Bool_t ApplyBinning(const MParList &plist, TString x, TString y, TH2 *h); | 
|---|
| 84 | static Bool_t ApplyBinning(const MParList &plist, TString x, TString y, TString z, TH3 *h); | 
|---|
| 85 |  | 
|---|
| 86 | static void    ScaleArray(TArrayD &bins, Double_t f); | 
|---|
| 87 | static TArrayD ScaleAxis(TAxis &axe, Double_t f); | 
|---|
| 88 | static void    ScaleAxis(TH1 *bins, Double_t fx=1, Double_t fy=1, Double_t fz=1); | 
|---|
| 89 |  | 
|---|
| 90 | static Double_t GetBinCenterLog(const TAxis &axe, Int_t nbin); | 
|---|
| 91 |  | 
|---|
| 92 | static void DrawSameCopy(const TH1 &hist1, const TH1 &hist2, const TString title); | 
|---|
| 93 | static void DrawSame(TH1 &hist1, TH1 &hist2, const TString title, Bool_t same=kFALSE); | 
|---|
| 94 |  | 
|---|
| 95 | TObject *Clone(const char *name="") const; | 
|---|
| 96 |  | 
|---|
| 97 | TObject *DrawClone(Option_t *opt, Int_t w, Int_t h) const; | 
|---|
| 98 | TObject *DrawClone(Option_t *opt="") const | 
|---|
| 99 | { | 
|---|
| 100 | return MH::DrawClone(opt, 625, 440); | 
|---|
| 101 | } | 
|---|
| 102 |  | 
|---|
| 103 | static TVirtualPad *GetNewPad(TString &opt); | 
|---|
| 104 |  | 
|---|
| 105 | static void FindGoodLimits(Int_t nbins, Int_t &newbins, Double_t &xmin, Double_t &xmax, Bool_t isInteger); | 
|---|
| 106 | static Double_t GetMinimumGT(const TH1 &h, Double_t gt=0); | 
|---|
| 107 | static Int_t StripZeros(TH1 *h, Int_t nbins); | 
|---|
| 108 |  | 
|---|
| 109 | static TH1I* ProjectArray(const TArrayF &array, Int_t nbins=30, | 
|---|
| 110 | const char* name="ProjectArray", const char* title="Projected Array"); | 
|---|
| 111 | static TH1I* ProjectArray(const TArrayD &array, Int_t nbins=30, | 
|---|
| 112 | const char* name="ProjectArray", const char* title="Projected Array"); | 
|---|
| 113 | static TH1I* ProjectArray(const MArrayF &array, Int_t nbins=30, | 
|---|
| 114 | const char* name="ProjectArray", const char* title="Projected Array"); | 
|---|
| 115 | static TH1I* ProjectArray(const MArrayD &array, Int_t nbins=30, | 
|---|
| 116 | const char* name="ProjectArray", const char* title="Projected Array"); | 
|---|
| 117 |  | 
|---|
| 118 | static void ProjectionX(TH1D &dest, const TH2 &src, Int_t firstybin=-1, Int_t lastybin=9999); | 
|---|
| 119 | static void ProjectionY(TH1D &dest, const TH2 &src, Int_t firstxbin=-1, Int_t lastxbin=9999); | 
|---|
| 120 |  | 
|---|
| 121 | static void GetRangeUser(const TH1 &hist, Axis_t &lo, Axis_t &hi); | 
|---|
| 122 | static void GetRangeUserX(const TH1 &hist, Axis_t &lo, Axis_t &hi); | 
|---|
| 123 | static void GetRangeUserY(const TH1 &hist, Axis_t &lo, Axis_t &hi); | 
|---|
| 124 | static void GetRange(const TH1 &hist, Int_t &lo, Int_t &hi); | 
|---|
| 125 | static void GetRangeX(const TH1 &hist, Int_t &lo, Int_t &hi); | 
|---|
| 126 | static void GetRangeY(const TH1 &hist, Int_t &lo, Int_t &hi); | 
|---|
| 127 |  | 
|---|
| 128 | static TObject *FindObjectInPad(const char *name, TVirtualPad *pad=NULL); | 
|---|
| 129 |  | 
|---|
| 130 | static void SetPalette(TString paletteName="pretty", Int_t ncol=50); | 
|---|
| 131 |  | 
|---|
| 132 | ClassDef(MH, 2) //A base class for Mars histograms | 
|---|
| 133 | }; | 
|---|
| 134 |  | 
|---|
| 135 | #endif | 
|---|
| 136 |  | 
|---|