StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StGlauberHistogramMaker.h
1 /******************************************************************************
2  * $Id: StGlauberHistogramMaker.h,v 1.2 2012/04/25 05:03:06 hmasui Exp $
3  * $Log: StGlauberHistogramMaker.h,v $
4  * Revision 1.2 2012/04/25 05:03:06 hmasui
5  * Use StCentralityMaker. Added weight for 2D fill. Use STAR logger instead of iostream
6  *
7 ******************************************************************************/
8 
9 #ifndef __StGlauberHistogramMaker_h__
10 #define __StGlauberHistogramMaker_h__
11 
12 class TH1 ;
13 class TH2 ;
14 class TProfile ;
15 class StGlauberTree ;
16 class StCentralityMaker;
17 #include "TString.h"
18 #include <vector>
19 
20 //____________________________________________________________________________________________________
21 // Class StGlauberHistogramMaker: Histogram maker
23  public:
25 
26  // Fixed bin width
27  StGlauberHistogramMaker(const TString name,
28  const TString title, const TString ytitle,
29  const Int_t ybin, const Double_t ymin, const Double_t ymax,
30  const Bool_t isUnitWeight=kTRUE);
31 
33 
35  void SetTableDirectory(const TString directory) ;
36 
37  virtual void Init();
38 
39  void SetXaxis(const StGlauberTree& tree, const StCentralityMaker& centralityMaker, const TString type);
40  virtual void Fill(const Double_t y, const Double_t weight);
41 
46  virtual void Finish(const TString type) ;
47 
48  const TString GetName() const ;
49  void DebugOn() ;
50 
51  private:
52  // Data members
53 
54  const TString mName ;
55  const TString mTitle ;
56  const TString mYTitle ;
57  const Int_t mYbin ;
58  const Double_t mYmin ;
59  const Double_t mYmax ;
60  const Bool_t mIsUnitWeight ;
61 
62  enum {
63  mNXaxis = 4
64  };
65 
66  static const TString mXAxisName[mNXaxis] ;
67  static const TString mXAxisTitle[mNXaxis] ;
68  static const Int_t mXAxisBin[mNXaxis] ;
69  static const Double_t mXAxisMax[mNXaxis] ;
70 
71  std::vector<Double_t> mXaxis ;
72 
73  std::vector<TH1*> mHistogram1D ;
74  std::vector<TH2*> mHistogram2D ;
75  std::vector<TProfile*> mProfile ;
76  std::vector<TProfile*> mWeight ;
77 
78  TString mTableDirectory ;
79 
80  UInt_t mDebug ;
81 
82  protected:
83  // Functions
84  virtual void Reset();
85 
86  Bool_t IsXaxisOk() const ;
87  void Fill2D(std::vector<TH2*> collection, const Double_t y, const Double_t weight) ;
88  void FillProfile(std::vector<TProfile*> collection, const Double_t y) ;
89  void Fill(const TString type, const Double_t y, const Double_t weight) ;
90 
92  void DoWeightCorrection(std::vector<TH1*> collection1d, std::vector<TProfile*> collectionp) ;
93 
95  void WriteTable(std::vector<TH1*> collection, const TString name) ;
96 
98  void WriteGraphs(std::vector<TH1*> collection) ;
99 
100  const TString GetHistogramName(const TString name, const UInt_t ix) const ; // histogram name
101  TH1* GetTH1D(const TString name, const UInt_t ix) ; // 1D histogram
102  TH2* GetTH2D(const TString name, const UInt_t ix) ; // 2D histogram
103  TProfile* GetTProfile(const TString name, const UInt_t ix, const TString title="Profile") ; // Profile histogram
104 
106  UInt_t GetNXaxis() const ;
107 
108  ClassDef(StGlauberHistogramMaker, 0)
109 };
110 
111 inline UInt_t StGlauberHistogramMaker::GetNXaxis() const { return mNXaxis ; }
112 
113 #endif
114 
void FillProfile(std::vector< TProfile * > collection, const Double_t y)
void WriteTable(std::vector< TH1 * > collection, const TString name)
Write text table, average quantity vs centrality (table: table_{mName}_vs_centrality.txt)
void SetTableDirectory(const TString directory)
Default destructor.
void SetXaxis(const StGlauberTree &tree, const StCentralityMaker &centralityMaker, const TString type)
Initialize histograms.
void DoWeightCorrection(std::vector< TH1 * > collection1d, std::vector< TProfile * > collectionp)
Calculate sum(w*val)/sum(w) for each profile histogram.
virtual void Reset()
Debug flag.
virtual void Fill(const Double_t y, const Double_t weight)
Set X-axis variable.
void DebugOn()
Get histogram name.
void Fill2D(std::vector< TH2 * > collection, const Double_t y, const Double_t weight)
Check xAxis has been filled, abort if empty.
UInt_t GetNXaxis() const
Naxis.
virtual void Finish(const TString type)
Fill histogram &#39;y&#39; value with &#39;weight&#39;.
Bool_t IsXaxisOk() const
Reset all data members.
void WriteGraphs(std::vector< TH1 * > collection)
Write TGraphErrors (vs centrality, 0-80%)