1 #ifndef ALIDIELECTRONHISTOS_H
2 #define ALIDIELECTRONHISTOS_H
3 /* Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
6 ///////////////////////////////////////////////////////////////////////////////////////////
8 // Generic Histogram container with support for groups and filling of groups by passing //
12 // Jens Wiechula <Jens.Wiechula@cern.ch> //
14 ///////////////////////////////////////////////////////////////////////////////////////////
19 // #include <TCollection.h>
20 #include <THashList.h>
21 #include <TVectorDfwd.h>
27 // class TVectorT<double>;
29 class AliDielectronHistos : public TNamed {
32 AliDielectronHistos();
33 AliDielectronHistos(const char* name, const char* title);
34 virtual ~AliDielectronHistos();
36 enum {kNoAutoFill=1000000000};
38 void UserProfile(const char* histClass,const char *name, const char* title,
40 Int_t nbinsX, Double_t xmin, Double_t xmax,
41 UInt_t valTypeX=kNoAutoFill, Bool_t logBinX=kFALSE, TString option="");
43 void UserProfile(const char* histClass,const char *name, const char* title,
45 Int_t nbinsX, Double_t xmin, Double_t xmax,
46 Int_t nbinsY, Double_t ymin, Double_t ymax,
47 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0,
48 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, TString option="");
50 void UserProfile(const char* histClass,const char *name, const char* title,
52 Int_t nbinsX, Double_t xmin, Double_t xmax,
53 Int_t nbinsY, Double_t ymin, Double_t ymax,
54 Int_t nbinsZ, Double_t zmin, Double_t zmax,
55 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0,
56 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE, TString option="");
58 void UserProfile(const char* histClass,const char *name, const char* title,
60 const char* binning, UInt_t valTypeX=kNoAutoFill, TString option="");
62 void UserProfile(const char* histClass,const char *name, const char* title,
64 const TVectorD * const binsX, UInt_t valTypeX=kNoAutoFill, TString option="");
66 void UserProfile(const char* histClass,const char *name, const char* title,
68 const TVectorD * const binsX, const TVectorD * const binsY,
69 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, TString option="");
71 void UserProfile(const char* histClass,const char *name, const char* title,
73 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
74 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0, TString option="");
76 void UserHistogram(const char* histClass, Int_t ndim, Int_t *bins, Double_t *mins, Double_t *maxs, UInt_t *vars);
77 void UserSparse( const char* histClass, Int_t ndim, Int_t *bins, Double_t *mins, Double_t *maxs, UInt_t *vars);
78 void UserHistogram(const char* histClass, Int_t ndim, TObjArray *limits, UInt_t *vars);
79 void UserSparse( const char* histClass, Int_t ndim, TObjArray *limits, UInt_t *vars);
81 void UserHistogram(const char* histClass,const char *name, const char* title,
82 Int_t nbinsX, Double_t xmin, Double_t xmax, UInt_t valTypeX=kNoAutoFill, Bool_t logBinX=kFALSE)
83 { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,valTypeX,logBinX); }
85 void UserHistogram(const char* histClass,const char *name, const char* title,
86 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
87 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE)
88 { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,nbinsY,ymin,ymax,valTypeX,valTypeY,logBinX,logBinY); }
90 void UserHistogram(const char* histClass,const char *name, const char* title,
91 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
92 Int_t nbinsZ, Double_t zmin, Double_t zmax, UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0,
93 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE)
94 { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,nbinsY,ymin,ymax,nbinsZ,zmin,zmax,valTypeX,valTypeY,valTypeZ,logBinX,logBinY,logBinZ); }
96 void UserHistogram(const char* histClass,const char *name, const char* title,
97 const char* binning, UInt_t valTypeX=kNoAutoFill)
98 { UserProfile(histClass,name,title,999,binning,valTypeX); }
100 void UserHistogram(const char* histClass,const char *name, const char* title,
101 const TVectorD * const binsX, UInt_t valTypeX=kNoAutoFill)
102 { UserProfile(histClass,name,title,999,binsX,valTypeX); }
104 void UserHistogram(const char* histClass,const char *name, const char* title,
105 const TVectorD * const binsX, const TVectorD * const binsY, UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0)
106 { UserProfile(histClass,name,title,999,binsX,binsY,valTypeX,valTypeY); }
108 void UserHistogram(const char* histClass,const char *name, const char* title,
109 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
110 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0)
111 { UserProfile(histClass,name,title,999,binsX,binsY,binsZ,valTypeX,valTypeY,valTypeZ); }
113 void UserHistogram(const char* histClass, TObject* hist, UInt_t valTypes=kNoAutoFill);
115 void Fill(const char* histClass, const char* name, Double_t xval);
116 void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval);
117 void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval, Double_t zval);
119 // void FillClass(const char* histClass, const TVectorD &vals);
120 void FillClass(const char* histClass, Int_t nValues, const Double_t *values);
122 TObject* GetHist(const char* histClass, const char* name) const;
123 TH1* GetHistogram(const char* histClass, const char* name) const;
124 TObject* GetHist(const char* cutClass, const char* histClass, const char* name) const;
125 TH1* GetHistogram(const char* cutClass, const char* histClass, const char* name) const;
127 void SetHistogramList(THashList &list, Bool_t setOwner=kTRUE);
128 void ResetHistogramList(){fHistoList.Clear();}
129 const THashList* GetHistogramList() const {return &fHistoList;}
131 void SetList(TList * const list) { fList=list; }
132 TList *GetList() const { return fList; }
134 void AddClass(const char* histClass);
136 void DumpToFile(const char* file="histos.root");
137 void ReadFromFile(const char* file="histos.root");
139 virtual void Print(const Option_t* option = "") const;
140 virtual void Draw(const Option_t* option = "");
141 virtual void DrawSame(const char* histName, const Option_t *opt="leg can");
143 void SetReservedWords(const char* words);
145 // virtual void Add(TObject *obj) {};
146 // virtual void Clear(Option_t *option="") {};
147 // virtual void Delete(Option_t *option="") {};
148 // virtual TObject **GetObjectRef(const TObject *obj) const { return 0; }
149 // virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const ;
150 // virtual TObject *Remove(TObject *obj) { return 0; }
152 Bool_t SetCutClass(const char* cutClass);
153 static void StoreVariables(TObject *obj, UInt_t valType[20]);
154 static void StoreVariables(TH1 *obj, UInt_t valType[20]);
155 static void StoreVariables(THnBase *obj, UInt_t valType[20]);
156 static void AdaptNameTitle(TH1 *hist, const char* histClass);
157 static Int_t GetPrecision(Double_t value);
158 static void FillValues(TObject *obj, const Double_t *values);
159 static void FillValues(TH1 *obj, const Double_t *values);
160 static void FillValues(THnBase *obj, const Double_t *values);
164 void FillVarArray(TObject *obj, UInt_t *valType);
166 THashList fHistoList; //-> list of histograms
167 TList *fList; //! List of list of histograms
169 TString *fReservedWords; //! list of reserved words
170 void UserHistogramReservedWords(const char* histClass, const TObject *hist, UInt_t valTypes);
171 void FillClass(THashTable *classTable, Int_t nValues, Double_t *values);
173 void PrintPDF(Option_t* opt);
174 void PrintStructure() const;
176 Bool_t IsHistogramOk(const char* classTable, const char* name);
179 AliDielectronHistos(const AliDielectronHistos &hist);
180 AliDielectronHistos& operator = (const AliDielectronHistos &hist);
182 ClassDef(AliDielectronHistos,2)