1 /*! 2 \class StMultiH2F 3 4 StMultiH2F allows multiple similar TH2F histograms to be 5 easily plotted on one graph 6 7 */ 8 9 #ifndef ClassStMultiH2F 10 #define ClassStMultiH2F 11 12 #include "TH3.h" 13 #include "TH2.h" 14 class TString; 15 #define StMultiH2FMaxBins 10 16 // change in MaxBins requires change in ClassDef version 17 18 class StMultiH2F : public TH3F { 19 public: 20 StMultiH2F(); 21 StMultiH2F(const char *name,const char *title,Int_t nbinsx,Axis_t xlow, 22 Axis_t xup,Int_t nbinsy,Axis_t ylow,Axis_t yup,Int_t nbinsz); 23 virtual ~StMultiH2F(); 24 virtual void Draw(Option_t *option=""); 25 // Probably only the "box" and "cont" options are reasonable here 26 virtual void Draw3F(Option_t *option="") { TH3F::Draw(option); } // access inherited 27 28 virtual void SetNames(Int_t zbin, const char* name) 29 { if (zbin<StMultiH2FMaxBins) names[zbin] = name; } 30 virtual void SetNames(Float_t zbin, const char* name) 31 { SetNames((Int_t) zbin, name); } 32 virtual const char* GetNames(Int_t zbin) const 33 { return (zbin<StMultiH2FMaxBins ? names[zbin].Data() : 0); } 34 virtual const char* GetNames(Float_t zbin) const 35 { return GetNames((Int_t) zbin); } 36 // Overload the Rebin() function to allow naming of z bins with TH3F pointer 37 virtual TH1* Rebin(Int_t ngroup, const char* newname) 38 { SetNames(ngroup, newname); return 0; } 39 virtual TH1* Rebin(Int_t ngroup, const char* newname, const Double_t* xbins) 40 { SetNames(ngroup, newname); return 0; } 41 virtual void SavePrimitive(std::ostream& out, Option_t* option = ""); 42 virtual TH2D* GetSubHist(Int_t zbin) { return (subHists ? subHists[zbin] : 0); } 43 protected: 44 TString names[StMultiH2FMaxBins]; 45 virtual TH2D* XYProjection(const char* name, Int_t zbin=-1); 46 TH2D** subHists; //! 47 ClassDef(StMultiH2F,2) 48 }; 49 50 #endif 51 52 // $Id: StMultiH2F.h,v 1.6 2016/05/27 18:02:41 genevb Exp $ 53 // $Log: StMultiH2F.h,v $ 54 // Revision 1.6 2016/05/27 18:02:41 genevb 55 // Garbage collection (Coverity), remove unnecessary ROOT types 56 // 57 // Revision 1.5 2013/11/22 16:48:39 genevb 58 // Access to inherited Draw() functions 59 // 60 // Revision 1.4 2013/11/21 22:22:48 genevb 61 // Protect against array out-of-bounds, use inherited axis handles 62 // 63 // Revision 1.3 2012/06/11 15:05:34 fisyak 64 // std namespace 65 // 66 // Revision 1.2 2008/07/09 20:52:38 genevb 67 // Implement SavePrimitive functions 68 // 69 // Revision 1.1 2007/03/13 16:22:32 genevb 70 // Introduce StMultiH2F class 71 // 72 // 73