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>
29 // class TVectorT<double>;
31 class AliDielectronHistos : public TNamed {
34 AliDielectronHistos();
35 AliDielectronHistos(const char* name, const char* title);
36 virtual ~AliDielectronHistos();
38 enum {kNoAutoFill=1000000000, kNoProfile=999, kNoWeights=998};
40 void UserProfile(const char* histClass,const char *name, const char* title,
42 Int_t nbinsX, Double_t xmin, Double_t xmax,
43 UInt_t valTypeX, Bool_t logBinX=kFALSE, TString option="",
44 UInt_t valTypeW=kNoWeights);
46 void UserProfile(const char* histClass,const char *name, const char* title,
48 Int_t nbinsX, Double_t xmin, Double_t xmax,
49 Int_t nbinsY, Double_t ymin, Double_t ymax,
50 UInt_t valTypeX, UInt_t valTypeY,
51 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, TString option="",
52 UInt_t valTypeW=kNoWeights);
54 void UserProfile(const char* histClass,const char *name, const char* title,
56 Int_t nbinsX, Double_t xmin, Double_t xmax,
57 Int_t nbinsY, Double_t ymin, Double_t ymax,
58 Int_t nbinsZ, Double_t zmin, Double_t zmax,
59 UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ,
60 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE, TString option="",
61 UInt_t valTypeW=kNoWeights);
63 void UserProfile(const char* histClass,const char *name, const char* title,
65 const char* binning, UInt_t valTypeX, TString option="",
66 UInt_t valTypeW=kNoWeights);
68 void UserProfile(const char* histClass,const char *name, const char* title,
70 const TVectorD * const binsX, UInt_t valTypeX, TString option="",
71 UInt_t valTypeW=kNoWeights);
73 void UserProfile(const char* histClass,const char *name, const char* title,
75 const TVectorD * const binsX, const TVectorD * const binsY,
76 UInt_t valTypeX, UInt_t valTypeY, TString option="",
77 UInt_t valTypeW=kNoWeights);
79 void UserProfile(const char* histClass,const char *name, const char* title,
81 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
82 UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ, TString option="",
83 UInt_t valTypeW=kNoWeights);
85 void UserHistogram(const char* histClass, Int_t ndim, Int_t *bins, Double_t *mins, Double_t *maxs, UInt_t *vars, UInt_t valTypeW=kNoWeights);
86 void UserSparse( const char* histClass, Int_t ndim, Int_t *bins, Double_t *mins, Double_t *maxs, UInt_t *vars, UInt_t valTypeW=kNoWeights);
87 void UserHistogram(const char* histClass, Int_t ndim, TObjArray *limits, UInt_t *vars, UInt_t valTypeW=kNoWeights);
88 void UserSparse( const char* histClass, Int_t ndim, TObjArray *limits, UInt_t *vars, UInt_t valTypeW=kNoWeights);
90 void UserHistogram(const char* histClass,const char *name, const char* title,
91 Int_t nbinsX, Double_t xmin, Double_t xmax, UInt_t valTypeX, Bool_t logBinX=kFALSE,
92 UInt_t valTypeW=kNoWeights)
93 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,valTypeX,logBinX,"",valTypeW); }
95 void UserHistogram(const char* histClass,const char *name, const char* title,
96 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
97 UInt_t valTypeX, UInt_t valTypeY, Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE,
98 UInt_t valTypeW=kNoWeights)
99 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,nbinsY,ymin,ymax,valTypeX,valTypeY,logBinX,logBinY,valTypeW); }
101 void UserHistogram(const char* histClass,const char *name, const char* title,
102 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
103 Int_t nbinsZ, Double_t zmin, Double_t zmax, UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ,
104 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE,
105 UInt_t valTypeW=kNoWeights)
106 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,nbinsY,ymin,ymax,nbinsZ,zmin,zmax,valTypeX,valTypeY,valTypeZ,logBinX,logBinY,logBinZ,valTypeW); }
108 void UserHistogram(const char* histClass,const char *name, const char* title,
109 const char* binning, UInt_t valTypeX, UInt_t valTypeW=kNoWeights)
110 { UserProfile(histClass,name,title,kNoProfile,binning,valTypeX,"",valTypeW); }
111 // void UserHistogram(const char* histClass,const char *name, const char* title,
112 // const TVectorD * const binsX, UInt_t valTypeX)
113 // { UserProfile(histClass,name,title,kNoProfile,binsX,valTypeX); }
115 void UserHistogram(const char* histClass,const char *name, const char* title,
116 const TVectorD * const binsX, UInt_t valTypeX, UInt_t valTypeW=kNoWeights)
117 { UserProfile(histClass,name,title,kNoProfile,binsX,valTypeX,"",valTypeW); }
119 void UserHistogram(const char* histClass,const char *name, const char* title,
120 const TVectorD * const binsX, const TVectorD * const binsY, UInt_t valTypeX, UInt_t valTypeY,
121 UInt_t valTypeW=kNoWeights)
122 { UserProfile(histClass,name,title,kNoProfile,binsX,binsY,valTypeX,valTypeY,"",valTypeW); }
124 void UserHistogram(const char* histClass,const char *name, const char* title,
125 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
126 UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ,
127 UInt_t valTypeW=kNoWeights)
128 { UserProfile(histClass,name,title,kNoProfile,binsX,binsY,binsZ,valTypeX,valTypeY,valTypeZ,"",valTypeW); }
130 void UserHistogram(const char* histClass, TObject* hist, UInt_t valTypes=kNoAutoFill);
132 // some functions needed to garantuee backward compatibility
133 void UserHistogram(const char* histClass,const char *name, const char* title,
134 Int_t nbinsX, Double_t xmin, Double_t xmax)
135 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,kNoAutoFill); }
136 void UserHistogram(const char* histClass,const char *name, const char* title,
137 Int_t nbinsX, Double_t xmin, Double_t xmax,
138 Int_t nbinsY, Double_t ymin, Double_t ymax)
139 { UserProfile(histClass,name,title,kNoProfile,nbinsX,xmin,xmax,nbinsY,ymin,ymax,kNoAutoFill,kNoAutoFill); }
142 void Fill(const char* histClass, const char* name, Double_t xval);
143 void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval);
144 void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval, Double_t zval);
146 // void FillClass(const char* histClass, const TVectorD &vals);
147 void FillClass(const char* histClass, Int_t nValues, const Double_t *values);
149 TObject* GetHist(const char* histClass, const char* name) const;
150 TH1* GetHistogram(const char* histClass, const char* name) const;
151 TObject* GetHist(const char* cutClass, const char* histClass, const char* name) const;
152 TH1* GetHistogram(const char* cutClass, const char* histClass, const char* name) const;
154 void SetHistogramList(THashList &list, Bool_t setOwner=kTRUE);
155 void ResetHistogramList(){fHistoList.Clear();}
156 const THashList* GetHistogramList() const {return &fHistoList;}
158 void SetList(TList * const list) { fList=list; }
159 TList *GetList() const { return fList; }
160 TBits *GetUsedVars() const { return fUsedVars; }
162 void AddClass(const char* histClass);
164 void DumpToFile(const char* file="histos.root");
165 void ReadFromFile(const char* file="histos.root");
167 virtual void Print(const Option_t* option = "") const;
168 virtual void Draw(const Option_t* option = "");
169 virtual void DrawSame(const char* histName, const Option_t *opt="leg can");
171 void SetReservedWords(const char* words);
173 // virtual void Add(TObject *obj) {};
174 // virtual void Clear(Option_t *option="") {};
175 // virtual void Delete(Option_t *option="") {};
176 // virtual TObject **GetObjectRef(const TObject *obj) const { return 0; }
177 // virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const ;
178 // virtual TObject *Remove(TObject *obj) { return 0; }
180 Bool_t SetCutClass(const char* cutClass);
181 static void StoreVariables(TObject *obj, UInt_t valType[20]);
182 static void StoreVariables(TH1 *obj, UInt_t valType[20]);
183 static void StoreVariables(THnBase *obj, UInt_t valType[20]);
184 static void AdaptNameTitle(TH1 *hist, const char* histClass);
185 static Int_t GetPrecision(Double_t value);
186 static void FillValues(TObject *obj, const Double_t *values);
187 static void FillValues(TH1 *obj, const Double_t *values);
188 static void FillValues(THnBase *obj, const Double_t *values);
192 void FillVarArray(TObject *obj, UInt_t *valType);
195 THashList fHistoList; //-> list of histograms
196 TList *fList; //! List of list of histograms
197 TBits *fUsedVars; // list of used variables
199 TString *fReservedWords; //! list of reserved words
200 void UserHistogramReservedWords(const char* histClass, const TObject *hist, UInt_t valTypes);
201 void FillClass(THashTable *classTable, Int_t nValues, Double_t *values);
203 void PrintPDF(Option_t* opt);
204 void PrintStructure() const;
206 Bool_t IsHistogramOk(const char* classTable, const char* name);
209 AliDielectronHistos(const AliDielectronHistos &hist);
210 AliDielectronHistos& operator = (const AliDielectronHistos &hist);
212 ClassDef(AliDielectronHistos,3)