StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMultiH1F.h
1 
9 #ifndef ClassStMultiH1F
10 #define ClassStMultiH1F
11 
12 #include "TH2.h"
13 class TString;
14 #define StMultiH1FMaxBins 10
15 // change in MaxBins requires change in ClassDef version
16 
17 class StMultiH1F : public TH2F {
18  public:
19  StMultiH1F();
20  StMultiH1F(const char *name,const char *title,Int_t nbinsx,Axis_t xlow,
21  Axis_t xup,Int_t nbinsy);
22  StMultiH1F(const char *name,const char *title,Int_t nbinsx,Double_t *xbins,
23  Int_t nbinsy);
24  virtual ~StMultiH1F();
25  virtual void Draw(Option_t *option="");
26  virtual void Draw2F(Option_t *option="") { TH2F::Draw(option); } // access inherited
27  virtual void SetNames(Int_t ybin, const char* name)
28  { if (ybin<StMultiH1FMaxBins) names[ybin] = name; }
29  virtual void SetNames(Float_t ybin, const char* name)
30  { SetNames((Int_t) ybin, name); }
31  virtual const char* GetNames(Int_t ybin) const
32  { return (ybin<StMultiH1FMaxBins ? names[ybin].Data() : 0); }
33  virtual const char* GetNames(Float_t ybin) const
34  { return GetNames((Int_t) ybin); }
35  // Overload the Rebin() function to allow naming of y bins with TH2F pointer
36  virtual TH2* Rebin(Int_t ngroup, const char* newname)
37  { SetNames(ngroup, newname); return 0; }
38  virtual TH2* Rebin(Int_t ngroup, const char* newname, const Double_t* xbins)
39  { SetNames(ngroup, newname); return 0; }
40  // Overload the SetBarOffset() function to allow offsetting of y bins vertically
41  virtual void SetBarOffset(Float_t offset);
42  virtual Double_t GetNonZeroMinimum() const;
43  virtual Double_t GetNonZeroMaximum() const;
44  virtual void SavePrimitive(std::ostream& out, Option_t* option = "");
45  virtual TH1F* GetSubHist(Int_t ybin) { return (subHists ? subHists[ybin] : 0); }
46  virtual TH1F* GetAHist() { return aHist; }
47 
49  virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0);
50 
51  protected:
52  TString names[StMultiH1FMaxBins];
53  Float_t fMOffset;
54  virtual TH1F* XProjection(const char* name, Int_t ybin=-1);
55  TH1F** subHists;
56  TH1F* aHist;
57  ClassDef(StMultiH1F,2)
58 };
59 
60 #endif
61 
62 // $Id: StMultiH1F.h,v 1.12 2018/05/03 16:04:58 smirnovd Exp $
63 // $Log: StMultiH1F.h,v $
64 // Revision 1.12 2018/05/03 16:04:58 smirnovd
65 // Override Write() to save sub histograms in StMultiH1F
66 //
67 // Revision 1.11 2016/05/27 18:02:41 genevb
68 // Garbage collection (Coverity), remove unnecessary ROOT types
69 //
70 // Revision 1.10 2013/11/22 16:48:39 genevb
71 // Access to inherited Draw() functions
72 //
73 // Revision 1.9 2013/11/21 22:22:48 genevb
74 // Protect against array out-of-bounds, use inherited axis handles
75 //
76 // Revision 1.8 2012/06/11 15:05:34 fisyak
77 // std namespace
78 //
79 // Revision 1.7 2008/07/09 20:52:38 genevb
80 // Implement SavePrimitive functions
81 //
82 // Revision 1.6 2006/08/10 20:46:24 genevb
83 // additional Rebin() interface for TH1.h vers. 1.79, ROOT 5.13
84 //
85 // Revision 1.5 2002/04/23 01:59:16 genevb
86 // New offset abilities
87 //
88 // Revision 1.4 2000/09/05 19:54:46 genevb
89 // Erroneous delete in destructor removed
90 //
91 // Revision 1.3 2000/08/28 19:21:05 genevb
92 // Improved projection code
93 //
94 // Revision 1.2 2000/08/25 15:46:42 genevb
95 // Added stats box, legend names
96 //
97 // Revision 1.1 2000/07/26 22:00:28 lansdell
98 // new multi-hist class for superimposing the x-projections of y-bins (of a TH2F histogram) into one TH1F histogram
99 //
100 
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Saves subhistograms (TH1F) along with this composite object.
Definition: StMultiH1F.cxx:289