Change Mult binning scheme
[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> //
13// //
14///////////////////////////////////////////////////////////////////////////////////////////
15
5720c765 16#include <Rtypes.h>
b2a297fa 17
18#include <TNamed.h>
19// #include <TCollection.h>
20#include <THashList.h>
ffbede40 21#include <TVectorDfwd.h>
849a30fc 22#include <THnBase.h>
b2a297fa 23
24class TH1;
25class TString;
164bfb53 26class TList;
b2a297fa 27// class TVectorT<double>;
28
29class AliDielectronHistos : public TNamed {
30public:
5720c765 31
b2a297fa 32 AliDielectronHistos();
33 AliDielectronHistos(const char* name, const char* title);
34 virtual ~AliDielectronHistos();
35
35363fb9 36 enum {kNoAutoFill=1000000000};
37
5720c765 38 void UserProfile(const char* histClass,const char *name, const char* title,
39 UInt_t valTypeP,
40 Int_t nbinsX, Double_t xmin, Double_t xmax,
e4339752 41 UInt_t valTypeX=kNoAutoFill, Bool_t logBinX=kFALSE, TString option="");
5720c765 42
43 void UserProfile(const char* histClass,const char *name, const char* title,
44 UInt_t valTypeP,
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,
e4339752 48 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, TString option="");
5720c765 49
50 void UserProfile(const char* histClass,const char *name, const char* title,
51 UInt_t valTypeP,
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,
e4339752 56 Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE, TString option="");
5720c765 57
58 void UserProfile(const char* histClass,const char *name, const char* title,
59 UInt_t valTypeP,
e4339752 60 const char* binning, UInt_t valTypeX=kNoAutoFill, TString option="");
5720c765 61
62 void UserProfile(const char* histClass,const char *name, const char* title,
63 UInt_t valTypeP,
e4339752 64 const TVectorD * const binsX, UInt_t valTypeX=kNoAutoFill, TString option="");
5720c765 65
66 void UserProfile(const char* histClass,const char *name, const char* title,
67 UInt_t valTypeP,
68 const TVectorD * const binsX, const TVectorD * const binsY,
e4339752 69 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, TString option="");
5720c765 70
71 void UserProfile(const char* histClass,const char *name, const char* title,
72 UInt_t valTypeP,
73 const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
e4339752 74 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0, TString option="");
5720c765 75
80c1dcac 76 void UserHistogram(const char* histClass, Int_t ndim, Int_t *bins, Double_t *mins, Double_t *maxs, UInt_t *vars);
7a1ddc4b 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);
5720c765 80
b2a297fa 81 void UserHistogram(const char* histClass,const char *name, const char* title,
80c1dcac 82 Int_t nbinsX, Double_t xmin, Double_t xmax, UInt_t valTypeX=kNoAutoFill, Bool_t logBinX=kFALSE)
5720c765 83 { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,valTypeX,logBinX); }
84
b2a297fa 85 void UserHistogram(const char* histClass,const char *name, const char* title,
5720c765 86 Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
80c1dcac 87 UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE)
5720c765 88 { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,nbinsY,ymin,ymax,valTypeX,valTypeY,logBinX,logBinY); }
89
b2a297fa 90 void UserHistogram(const char* histClass,const char *name, const char* title,
5720c765 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); }
95
ffbede40 96 void UserHistogram(const char* histClass,const char *name, const char* title,
5720c765 97 const char* binning, UInt_t valTypeX=kNoAutoFill)
98 { UserProfile(histClass,name,title,999,binning,valTypeX); }
ffbede40 99
100 void UserHistogram(const char* histClass,const char *name, const char* title,
5720c765 101 const TVectorD * const binsX, UInt_t valTypeX=kNoAutoFill)
102 { UserProfile(histClass,name,title,999,binsX,valTypeX); }
103
ffbede40 104 void UserHistogram(const char* histClass,const char *name, const char* title,
5720c765 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); }
107
ffbede40 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,
5720c765 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); }
7a1ddc4b 112
80c1dcac 113 void UserHistogram(const char* histClass, TObject* hist, UInt_t valTypes=kNoAutoFill);
b2a297fa 114
b2a297fa 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);
118
119// void FillClass(const char* histClass, const TVectorD &vals);
120 void FillClass(const char* histClass, Int_t nValues, const Double_t *values);
b2a297fa 121
80c1dcac 122 TObject* GetHist(const char* histClass, const char* name) const;
b2a297fa 123 TH1* GetHistogram(const char* histClass, const char* name) const;
80c1dcac 124 TObject* GetHist(const char* cutClass, const char* histClass, const char* name) const;
164bfb53 125 TH1* GetHistogram(const char* cutClass, const char* histClass, const char* name) const;
849a30fc 126
164bfb53 127 void SetHistogramList(THashList &list, Bool_t setOwner=kTRUE);
572b0139 128 void ResetHistogramList(){fHistoList.Clear();}
b2a297fa 129 const THashList* GetHistogramList() const {return &fHistoList;}
164bfb53 130
131 void SetList(TList * const list) { fList=list; }
132 TList *GetList() const { return fList; }
133
b2a297fa 134 void AddClass(const char* histClass);
135
136 void DumpToFile(const char* file="histos.root");
137 void ReadFromFile(const char* file="histos.root");
138
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");
142
143 void SetReservedWords(const char* words);
2874f304 144
b2a297fa 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; }
572b0139 151
164bfb53 152 Bool_t SetCutClass(const char* cutClass);
35363fb9 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);
161
b2a297fa 162private:
2874f304 163
2874f304 164 void FillVarArray(TObject *obj, UInt_t *valType);
2874f304 165
b2a297fa 166 THashList fHistoList; //-> list of histograms
164bfb53 167 TList *fList; //! List of list of histograms
b2a297fa 168
169 TString *fReservedWords; //! list of reserved words
80c1dcac 170 void UserHistogramReservedWords(const char* histClass, const TObject *hist, UInt_t valTypes);
b2a297fa 171 void FillClass(THashTable *classTable, Int_t nValues, Double_t *values);
172
173 void PrintPDF(Option_t* opt);
174 void PrintStructure() const;
175
176 Bool_t IsHistogramOk(const char* classTable, const char* name);
177
b2a297fa 178
179 AliDielectronHistos(const AliDielectronHistos &hist);
180 AliDielectronHistos& operator = (const AliDielectronHistos &hist);
181
164bfb53 182 ClassDef(AliDielectronHistos,2)
b2a297fa 183};
184
185#endif
186