]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGDQ/dielectron/AliDielectronHistos.h
New train files for Ashutosh's analysis
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronHistos.h
CommitLineData
b2a297fa 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 */
5
6///////////////////////////////////////////////////////////////////////////////////////////
7// //
8// Generic Histogram container with support for groups and filling of groups by passing //
9// a vector of data //
10// //
11// Authors: //
12// Jens Wiechula <Jens.Wiechula@cern.ch> //
d4619886 13// Julian Book <Julian.Book@cern.ch> //
b2a297fa 14// //
15///////////////////////////////////////////////////////////////////////////////////////////
16
5720c765 17#include <Rtypes.h>
b2a297fa 18
19#include <TNamed.h>
20// #include <TCollection.h>
21#include <THashList.h>
ffbede40 22#include <TVectorDfwd.h>
849a30fc 23#include <THnBase.h>
b2a297fa 24
25class TH1;
26class TString;
164bfb53 27class TList;
b2a297fa 28// class TVectorT<double>;
29
30class AliDielectronHistos : public TNamed {
31public:
5720c765 32
b2a297fa 33 AliDielectronHistos();
34 AliDielectronHistos(const char* name, const char* title);
35 virtual ~AliDielectronHistos();
36
d4619886 37 enum {kNoAutoFill=1000000000, kNoProfile=999, kNoWeights=998};
35363fb9 38
5720c765 39 void UserProfile(const char* histClass,const char *name, const char* title,
40 UInt_t valTypeP,
41 Int_t nbinsX, Double_t xmin, Double_t xmax,
d4619886 42 UInt_t valTypeX, Bool_t logBinX=kFALSE, TString option="",
43 UInt_t valTypeW=kNoWeights);
5720c765 44
45 void UserProfile(const char* histClass,const char *name, const char* title,
46 UInt_t valTypeP,
47 Int_t nbinsX, Double_t xmin, Double_t xmax,
48 Int_t nbinsY, Double_t ymin, Double_t ymax,
d4619886 49 UInt_t valTypeX, UInt_t valTypeY,
50 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, TString option="",
51 UInt_t valTypeW=kNoWeights);
5720c765 52
53 void UserProfile(const char* histClass,const char *name, const char* title,
54 UInt_t valTypeP,
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,
d4619886 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);
5720c765 61
62 void UserProfile(const char* histClass,const char *name, const char* title,
63 UInt_t valTypeP,
d4619886 64 const char* binning, UInt_t valTypeX, TString option="",
65 UInt_t valTypeW=kNoWeights);
5720c765 66
67 void UserProfile(const char* histClass,const char *name, const char* title,
68 UInt_t valTypeP,
d4619886 69 const TVectorD * const binsX, UInt_t valTypeX, TString option="",
70 UInt_t valTypeW=kNoWeights);
5720c765 71
72 void UserProfile(const char* histClass,const char *name, const char* title,
73 UInt_t valTypeP,
74 const TVectorD * const binsX, const TVectorD * const binsY,
d4619886 75 UInt_t valTypeX, UInt_t valTypeY, TString option="",
76 UInt_t valTypeW=kNoWeights);
5720c765 77
78 void UserProfile(const char* histClass,const char *name, const char* title,
79 UInt_t valTypeP,
80 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
d4619886 81 UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ, TString option="",
82 UInt_t valTypeW=kNoWeights);
5720c765 83
d4619886 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);
5720c765 88
b2a297fa 89 void UserHistogram(const char* histClass,const char *name, const char* title,
d4619886 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); }
5720c765 92
b2a297fa 93 void UserHistogram(const char* histClass,const char *name, const char* title,
5720c765 94 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
d4619886 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); }
5720c765 98
b2a297fa 99 void UserHistogram(const char* histClass,const char *name, const char* title,
5720c765 100 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
d4619886 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); }
5720c765 105
ffbede40 106 void UserHistogram(const char* histClass,const char *name, const char* title,
d4619886 107 const char* binning, UInt_t valTypeX)
108 { UserProfile(histClass,name,title,kNoProfile,binning,valTypeX); }
ffbede40 109
110 void UserHistogram(const char* histClass,const char *name, const char* title,
d4619886 111 const TVectorD * const binsX, UInt_t valTypeX)
112 { UserProfile(histClass,name,title,kNoProfile,binsX,valTypeX); }
5720c765 113
ffbede40 114 void UserHistogram(const char* histClass,const char *name, const char* title,
d4619886 115 const TVectorD * const binsX, UInt_t valTypeX, UInt_t valTypeW)
28b47aed 116 { UserProfile(histClass,name,title,kNoProfile,binsX,valTypeX,"",valTypeW); }
d4619886 117
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)
28b47aed 121 { UserProfile(histClass,name,title,kNoProfile,binsX,binsY,valTypeX,valTypeY,"",valTypeW); }
5720c765 122
ffbede40 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,
d4619886 125 UInt_t valTypeX, UInt_t valTypeY, UInt_t valTypeZ,
126 UInt_t valTypeW=kNoWeights)
28b47aed 127 { UserProfile(histClass,name,title,kNoProfile,binsX,binsY,binsZ,valTypeX,valTypeY,valTypeZ,"",valTypeW); }
7a1ddc4b 128
80c1dcac 129 void UserHistogram(const char* histClass, TObject* hist, UInt_t valTypes=kNoAutoFill);
b2a297fa 130
d4619886 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); }
139
140
b2a297fa 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);
144
145// void FillClass(const char* histClass, const TVectorD &vals);
146 void FillClass(const char* histClass, Int_t nValues, const Double_t *values);
b2a297fa 147
80c1dcac 148 TObject* GetHist(const char* histClass, const char* name) const;
b2a297fa 149 TH1* GetHistogram(const char* histClass, const char* name) const;
80c1dcac 150 TObject* GetHist(const char* cutClass, const char* histClass, const char* name) const;
164bfb53 151 TH1* GetHistogram(const char* cutClass, const char* histClass, const char* name) const;
849a30fc 152
164bfb53 153 void SetHistogramList(THashList &list, Bool_t setOwner=kTRUE);
572b0139 154 void ResetHistogramList(){fHistoList.Clear();}
b2a297fa 155 const THashList* GetHistogramList() const {return &fHistoList;}
164bfb53 156
157 void SetList(TList * const list) { fList=list; }
158 TList *GetList() const { return fList; }
159
b2a297fa 160 void AddClass(const char* histClass);
161
162 void DumpToFile(const char* file="histos.root");
163 void ReadFromFile(const char* file="histos.root");
164
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");
168
169 void SetReservedWords(const char* words);
2874f304 170
b2a297fa 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; }
572b0139 177
164bfb53 178 Bool_t SetCutClass(const char* cutClass);
35363fb9 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);
187
b2a297fa 188private:
2874f304 189
2874f304 190 void FillVarArray(TObject *obj, UInt_t *valType);
2874f304 191
b2a297fa 192 THashList fHistoList; //-> list of histograms
164bfb53 193 TList *fList; //! List of list of histograms
b2a297fa 194
195 TString *fReservedWords; //! list of reserved words
80c1dcac 196 void UserHistogramReservedWords(const char* histClass, const TObject *hist, UInt_t valTypes);
b2a297fa 197 void FillClass(THashTable *classTable, Int_t nValues, Double_t *values);
198
199 void PrintPDF(Option_t* opt);
200 void PrintStructure() const;
201
202 Bool_t IsHistogramOk(const char* classTable, const char* name);
203
b2a297fa 204
205 AliDielectronHistos(const AliDielectronHistos &hist);
206 AliDielectronHistos& operator = (const AliDielectronHistos &hist);
207
164bfb53 208 ClassDef(AliDielectronHistos,2)
b2a297fa 209};
210
211#endif
212