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> //
13 // Julian Book <Julian.Book@cern.ch> //
15 ///////////////////////////////////////////////////////////////////////////////////////////
20 // #include <TCollection.h>
21 #include <THashList.h>
22 #include <TVectorDfwd.h>
28 // class TVectorT<double>;
30 class AliDielectronHistos : public TNamed {
33 AliDielectronHistos();
34 AliDielectronHistos(const char* name, const char* title);
35 virtual ~AliDielectronHistos();
37 enum {kNoAutoFill=1000000000, kNoProfile=999, kNoWeights=998};
39 void UserProfile(const char* histClass,const char *name, const char* title,
41 Int_t nbinsX, Double_t xmin, Double_t xmax,
42 UInt_t valTypeX, Bool_t logBinX=kFALSE, TString option="",
43 UInt_t valTypeW=kNoWeights);
45 void UserProfile(const char* histClass,const char *name, const char* title,
47 Int_t nbinsX, Double_t xmin, Double_t xmax,
48 Int_t nbinsY, Double_t ymin, Double_t ymax,
49 UInt_t valTypeX, UInt_t valTypeY,
50 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, TString option="",
51 UInt_t valTypeW=kNoWeights);
53 void UserProfile(const char* histClass,const char *name, const char* title,
55 Int_t nbinsX, Double_t xmin, Double_t xmax,
56 Int_t nbinsY, Double_t ymin, Double_t ymax,
57 Int_t nbinsZ, Double_t zmin, Double_t zmax,
58 UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ,
59 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE, TString option="",
60 UInt_t valTypeW=kNoWeights);
62 void UserProfile(const char* histClass,const char *name, const char* title,
64 const char* binning, UInt_t valTypeX, TString option="",
65 UInt_t valTypeW=kNoWeights);
67 void UserProfile(const char* histClass,const char *name, const char* title,
69 const TVectorD * const binsX, UInt_t valTypeX, TString option="",
70 UInt_t valTypeW=kNoWeights);
72 void UserProfile(const char* histClass,const char *name, const char* title,
74 const TVectorD * const binsX, const TVectorD * const binsY,
75 UInt_t valTypeX, UInt_t valTypeY, TString option="",
76 UInt_t valTypeW=kNoWeights);
78 void UserProfile(const char* histClass,const char *name, const char* title,
80 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
81 UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ, TString option="",
82 UInt_t valTypeW=kNoWeights);
84 void UserHistogram(const char* histClass, Int_t ndim, Int_t *bins, Double_t *mins, Double_t *maxs, UInt_t *vars, UInt_t valTypeW=kNoWeights);
85 void UserSparse( const char* histClass, Int_t ndim, Int_t *bins, Double_t *mins, Double_t *maxs, UInt_t *vars, UInt_t valTypeW=kNoWeights);
86 void UserHistogram(const char* histClass, Int_t ndim, TObjArray *limits, UInt_t *vars, UInt_t valTypeW=kNoWeights);
87 void UserSparse( const char* histClass, Int_t ndim, TObjArray *limits, UInt_t *vars, UInt_t valTypeW=kNoWeights);
89 void UserHistogram(const char* histClass,const char *name, const char* title,
90 Int_t nbinsX, Double_t xmin, Double_t xmax, UInt_t valTypeX, Bool_t logBinX=kFALSE)
91 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,valTypeX,logBinX); }
93 void UserHistogram(const char* histClass,const char *name, const char* title,
94 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
95 UInt_t valTypeX, UInt_t valTypeY, Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE,
96 UInt_t valTypeW=kNoWeights)
97 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,nbinsY,ymin,ymax,valTypeX,valTypeY,logBinX,logBinY,valTypeW); }
99 void UserHistogram(const char* histClass,const char *name, const char* title,
100 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
101 Int_t nbinsZ, Double_t zmin, Double_t zmax, UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ,
102 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE,
103 UInt_t valTypeW=kNoWeights)
104 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,nbinsY,ymin,ymax,nbinsZ,zmin,zmax,valTypeX,valTypeY,valTypeZ,logBinX,logBinY,logBinZ,valTypeW); }
106 void UserHistogram(const char* histClass,const char *name, const char* title,
107 const char* binning, UInt_t valTypeX)
108 { UserProfile(histClass,name,title,kNoProfile,binning,valTypeX); }
110 void UserHistogram(const char* histClass,const char *name, const char* title,
111 const TVectorD * const binsX, UInt_t valTypeX)
112 { UserProfile(histClass,name,title,kNoProfile,binsX,valTypeX); }
114 void UserHistogram(const char* histClass,const char *name, const char* title,
115 const TVectorD * const binsX, UInt_t valTypeX, UInt_t valTypeW)
116 { UserProfile(histClass,name,title,kNoProfile,binsX,valTypeX,valTypeW); }
118 void UserHistogram(const char* histClass,const char *name, const char* title,
119 const TVectorD * const binsX, const TVectorD * const binsY, UInt_t valTypeX, UInt_t valTypeY,
120 UInt_t valTypeW=kNoWeights)
121 { UserProfile(histClass,name,title,kNoProfile,binsX,binsY,valTypeX,valTypeY,valTypeW); }
123 void UserHistogram(const char* histClass,const char *name, const char* title,
124 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
125 UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ,
126 UInt_t valTypeW=kNoWeights)
127 { UserProfile(histClass,name,title,kNoProfile,binsX,binsY,binsZ,valTypeX,valTypeY,valTypeZ,valTypeW); }
129 void UserHistogram(const char* histClass, TObject* hist, UInt_t valTypes=kNoAutoFill);
131 // some functions needed to garantuee backward compatibility
132 void UserHistogram(const char* histClass,const char *name, const char* title,
133 Int_t nbinsX, Double_t xmin, Double_t xmax)
134 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,kNoAutoFill); }
135 void UserHistogram(const char* histClass,const char *name, const char* title,
136 Int_t nbinsX, Double_t xmin, Double_t xmax,
137 Int_t nbinsY, Double_t ymin, Double_t ymax)
138 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,nbinsY,ymin,ymax,kNoAutoFill,kNoAutoFill); }
141 void Fill(const char* histClass, const char* name, Double_t xval);
142 void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval);
143 void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval, Double_t zval);
145 // void FillClass(const char* histClass, const TVectorD &vals);
146 void FillClass(const char* histClass, Int_t nValues, const Double_t *values);
148 TObject* GetHist(const char* histClass, const char* name) const;
149 TH1* GetHistogram(const char* histClass, const char* name) const;
150 TObject* GetHist(const char* cutClass, const char* histClass, const char* name) const;
151 TH1* GetHistogram(const char* cutClass, const char* histClass, const char* name) const;
153 void SetHistogramList(THashList &list, Bool_t setOwner=kTRUE);
154 void ResetHistogramList(){fHistoList.Clear();}
155 const THashList* GetHistogramList() const {return &fHistoList;}
157 void SetList(TList * const list) { fList=list; }
158 TList *GetList() const { return fList; }
160 void AddClass(const char* histClass);
162 void DumpToFile(const char* file="histos.root");
163 void ReadFromFile(const char* file="histos.root");
165 virtual void Print(const Option_t* option = "") const;
166 virtual void Draw(const Option_t* option = "");
167 virtual void DrawSame(const char* histName, const Option_t *opt="leg can");
169 void SetReservedWords(const char* words);
171 // virtual void Add(TObject *obj) {};
172 // virtual void Clear(Option_t *option="") {};
173 // virtual void Delete(Option_t *option="") {};
174 // virtual TObject **GetObjectRef(const TObject *obj) const { return 0; }
175 // virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const ;
176 // virtual TObject *Remove(TObject *obj) { return 0; }
178 Bool_t SetCutClass(const char* cutClass);
179 static void StoreVariables(TObject *obj, UInt_t valType[20]);
180 static void StoreVariables(TH1 *obj, UInt_t valType[20]);
181 static void StoreVariables(THnBase *obj, UInt_t valType[20]);
182 static void AdaptNameTitle(TH1 *hist, const char* histClass);
183 static Int_t GetPrecision(Double_t value);
184 static void FillValues(TObject *obj, const Double_t *values);
185 static void FillValues(TH1 *obj, const Double_t *values);
186 static void FillValues(THnBase *obj, const Double_t *values);
190 void FillVarArray(TObject *obj, UInt_t *valType);
192 THashList fHistoList; //-> list of histograms
193 TList *fList; //! List of list of histograms
195 TString *fReservedWords; //! list of reserved words
196 void UserHistogramReservedWords(const char* histClass, const TObject *hist, UInt_t valTypes);
197 void FillClass(THashTable *classTable, Int_t nValues, Double_t *values);
199 void PrintPDF(Option_t* opt);
200 void PrintStructure() const;
202 Bool_t IsHistogramOk(const char* classTable, const char* name);
205 AliDielectronHistos(const AliDielectronHistos &hist);
206 AliDielectronHistos& operator = (const AliDielectronHistos &hist);
208 ClassDef(AliDielectronHistos,2)