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();
37 void UserProfile(const char* histClass,const char *name, const char* title,
39 Int_t nbinsX, Double_t xmin, Double_t xmax,
40 UInt_t valTypeX=kNoAutoFill, Bool_t logBinX=kFALSE, TString option="");
42 void UserProfile(const char* histClass,const char *name, const char* title,
44 Int_t nbinsX, Double_t xmin, Double_t xmax,
45 Int_t nbinsY, Double_t ymin, Double_t ymax,
46 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0,
47 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, TString option="");
49 void UserProfile(const char* histClass,const char *name, const char* title,
51 Int_t nbinsX, Double_t xmin, Double_t xmax,
52 Int_t nbinsY, Double_t ymin, Double_t ymax,
53 Int_t nbinsZ, Double_t zmin, Double_t zmax,
54 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0,
55 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE, TString option="");
57 void UserProfile(const char* histClass,const char *name, const char* title,
59 const char* binning, UInt_t valTypeX=kNoAutoFill, TString option="");
61 void UserProfile(const char* histClass,const char *name, const char* title,
63 const TVectorD * const binsX, UInt_t valTypeX=kNoAutoFill, TString option="");
65 void UserProfile(const char* histClass,const char *name, const char* title,
67 const TVectorD * const binsX, const TVectorD * const binsY,
68 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, TString option="");
70 void UserProfile(const char* histClass,const char *name, const char* title,
72 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
73 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0, TString option="");
75 void UserHistogram(const char* histClass, Int_t ndim, Int_t *bins, Double_t *mins, Double_t *maxs, UInt_t *vars);
76 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,const char *name, const char* title,
79 Int_t nbinsX, Double_t xmin, Double_t xmax, UInt_t valTypeX=kNoAutoFill, Bool_t logBinX=kFALSE)
80 { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,valTypeX,logBinX); }
82 void UserHistogram(const char* histClass,const char *name, const char* title,
83 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
84 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE)
85 { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,nbinsY,ymin,ymax,valTypeX,valTypeY,logBinX,logBinY); }
87 void UserHistogram(const char* histClass,const char *name, const char* title,
88 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
89 Int_t nbinsZ, Double_t zmin, Double_t zmax, UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0,
90 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE)
91 { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,nbinsY,ymin,ymax,nbinsZ,zmin,zmax,valTypeX,valTypeY,valTypeZ,logBinX,logBinY,logBinZ); }
93 void UserHistogram(const char* histClass,const char *name, const char* title,
94 const char* binning, UInt_t valTypeX=kNoAutoFill)
95 { UserProfile(histClass,name,title,999,binning,valTypeX); }
97 void UserHistogram(const char* histClass,const char *name, const char* title,
98 const TVectorD * const binsX, UInt_t valTypeX=kNoAutoFill)
99 { UserProfile(histClass,name,title,999,binsX,valTypeX); }
101 void UserHistogram(const char* histClass,const char *name, const char* title,
102 const TVectorD * const binsX, const TVectorD * const binsY, UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0)
103 { UserProfile(histClass,name,title,999,binsX,binsY,valTypeX,valTypeY); }
105 void UserHistogram(const char* histClass,const char *name, const char* title,
106 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
107 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0)
108 { UserProfile(histClass,name,title,999,binsX,binsY,binsZ,valTypeX,valTypeY,valTypeZ); }
110 void UserHistogram(const char* histClass, TObject* hist, UInt_t valTypes=kNoAutoFill);
112 void Fill(const char* histClass, const char* name, Double_t xval);
113 void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval);
114 void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval, Double_t zval);
116 // void FillClass(const char* histClass, const TVectorD &vals);
117 void FillClass(const char* histClass, Int_t nValues, const Double_t *values);
119 void StoreVariables(TObject *obj, UInt_t valType[20]);
120 void StoreVariables(TH1 *obj, UInt_t valType[20]);
121 void StoreVariables(THnBase *obj, UInt_t valType[20]);
122 void AdaptNameTitle(TH1 *hist, const char* histClass);
123 Int_t GetPrecision(Double_t value);
124 void FillVarArray(TObject *obj, UInt_t *valType);
125 void FillValues(TObject *obj, const Double_t *values);
126 void FillValues(TH1 *obj, const Double_t *values);
127 void FillValues(THnBase *obj, const Double_t *values);
129 TObject* GetHist(const char* histClass, const char* name) const;
130 TH1* GetHistogram(const char* histClass, const char* name) const;
131 TObject* GetHist(const char* cutClass, const char* histClass, const char* name) const;
132 TH1* GetHistogram(const char* cutClass, const char* histClass, const char* name) const;
134 void SetHistogramList(THashList &list, Bool_t setOwner=kTRUE);
135 void ResetHistogramList(){fHistoList.Clear();}
136 const THashList* GetHistogramList() const {return &fHistoList;}
138 void SetList(TList * const list) { fList=list; }
139 TList *GetList() const { return fList; }
141 void AddClass(const char* histClass);
143 void DumpToFile(const char* file="histos.root");
144 void ReadFromFile(const char* file="histos.root");
146 virtual void Print(const Option_t* option = "") const;
147 virtual void Draw(const Option_t* option = "");
148 virtual void DrawSame(const char* histName, const Option_t *opt="leg can");
150 void SetReservedWords(const char* words);
151 // void StoreVarForProfile(TObject *obj, UInt_t valType);
152 // virtual void Add(TObject *obj) {};
153 // virtual void Clear(Option_t *option="") {};
154 // virtual void Delete(Option_t *option="") {};
155 // virtual TObject **GetObjectRef(const TObject *obj) const { return 0; }
156 // virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const ;
157 // virtual TObject *Remove(TObject *obj) { return 0; }
159 Bool_t SetCutClass(const char* cutClass);
162 THashList fHistoList; //-> list of histograms
163 TList *fList; //! List of list of histograms
165 TString *fReservedWords; //! list of reserved words
166 void UserHistogramReservedWords(const char* histClass, const TObject *hist, UInt_t valTypes);
167 void FillClass(THashTable *classTable, Int_t nValues, Double_t *values);
169 void PrintPDF(Option_t* opt);
170 void PrintStructure() const;
172 Bool_t IsHistogramOk(const char* classTable, const char* name);
174 enum {kNoAutoFill=1000000000};
176 AliDielectronHistos(const AliDielectronHistos &hist);
177 AliDielectronHistos& operator = (const AliDielectronHistos &hist);
179 ClassDef(AliDielectronHistos,2)