]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGDQ/dielectron/AliDielectronHistos.h
o update dielectron package
[u/mrichter/AliRoot.git] / PWGDQ / dielectron / AliDielectronHistos.h
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
16 #include <Rtypes.h>
17
18 #include <TNamed.h>
19 // #include <TCollection.h>
20 #include <THashList.h>
21 #include <TVectorDfwd.h>
22
23 class TH1;
24 class TString;
25 class TList;
26 // class TVectorT<double>;
27
28 class AliDielectronHistos : public TNamed {
29 public:
30
31   AliDielectronHistos();
32   AliDielectronHistos(const char* name, const char* title);
33   virtual ~AliDielectronHistos();
34
35   
36   void UserProfile(const char* histClass,const char *name, const char* title,
37                    UInt_t valTypeP,
38                    Int_t nbinsX, Double_t xmin, Double_t xmax,
39                    UInt_t valTypeX=kNoAutoFill, Bool_t logBinX=kFALSE);
40
41   void UserProfile(const char* histClass,const char *name, const char* title,
42                    UInt_t valTypeP,
43                    Int_t nbinsX, Double_t xmin, Double_t xmax,
44                    Int_t nbinsY, Double_t ymin, Double_t ymax,
45                    UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0,
46                    Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE);
47   
48   void UserProfile(const char* histClass,const char *name, const char* title,
49                    UInt_t valTypeP,
50                    Int_t nbinsX, Double_t xmin, Double_t xmax,
51                    Int_t nbinsY, Double_t ymin, Double_t ymax,
52                    Int_t nbinsZ, Double_t zmin, Double_t zmax,
53                    UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0,
54                    Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE);
55   
56   void UserProfile(const char* histClass,const char *name, const char* title,
57                    UInt_t valTypeP,
58                    const char* binning, UInt_t valTypeX=kNoAutoFill);
59   
60   void UserProfile(const char* histClass,const char *name, const char* title,
61                    UInt_t valTypeP,
62                    const TVectorD * const binsX, UInt_t valTypeX=kNoAutoFill);
63   
64   void UserProfile(const char* histClass,const char *name, const char* title,
65                    UInt_t valTypeP,
66                    const TVectorD * const binsX, const TVectorD * const binsY,
67                    UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0);
68   
69   void UserProfile(const char* histClass,const char *name, const char* title,
70                    UInt_t valTypeP,
71                    const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
72                    UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0);
73
74
75   void UserHistogram(const char* histClass,const char *name, const char* title,
76                      Int_t nbinsX, Double_t xmin, Double_t xmax, UInt_t valTypeX=kNoAutoFill, Bool_t logBinX=kFALSE) 
77   { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,valTypeX,logBinX); }
78
79   void UserHistogram(const char* histClass,const char *name, const char* title,
80                      Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
81                      UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE)    
82   { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,nbinsY,ymin,ymax,valTypeX,valTypeY,logBinX,logBinY); }
83
84   void UserHistogram(const char* histClass,const char *name, const char* title,
85                      Int_t nbinsX, Double_t xmin, Double_t xmax, Int_t nbinsY, Double_t ymin, Double_t ymax,
86                      Int_t nbinsZ, Double_t zmin, Double_t zmax, UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0,
87                      Bool_t logBinX=kFALSE, Bool_t logBinY=kFALSE, Bool_t logBinZ=kFALSE)
88   { UserProfile(histClass,name,title,999,nbinsX,xmin,xmax,nbinsY,ymin,ymax,nbinsZ,zmin,zmax,valTypeX,valTypeY,valTypeZ,logBinX,logBinY,logBinZ); }
89
90   void UserHistogram(const char* histClass,const char *name, const char* title,
91                      const char* binning, UInt_t valTypeX=kNoAutoFill)
92   { UserProfile(histClass,name,title,999,binning,valTypeX); }
93
94   void UserHistogram(const char* histClass,const char *name, const char* title,
95                      const TVectorD * const binsX, UInt_t valTypeX=kNoAutoFill)
96   { UserProfile(histClass,name,title,999,binsX,valTypeX); }
97
98   void UserHistogram(const char* histClass,const char *name, const char* title,
99                      const TVectorD * const binsX, const TVectorD * const binsY, UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0)
100   { UserProfile(histClass,name,title,999,binsX,binsY,valTypeX,valTypeY); }
101
102   void UserHistogram(const char* histClass,const char *name, const char* title,
103                      const TVectorD * const binsX, const TVectorD * const binsY, const TVectorD * const binsZ,
104                      UInt_t valTypeX=kNoAutoFill, UInt_t valTypeY=0, UInt_t valTypeZ=0)
105   { UserProfile(histClass,name,title,999,binsX,binsY,binsZ,valTypeX,valTypeY,valTypeZ); }
106   
107   void UserHistogram(const char* histClass, TH1* hist, UInt_t valTypes=kNoAutoFill);
108
109   void Fill(const char* histClass, const char* name, Double_t xval);
110   void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval);
111   void Fill(const char* histClass, const char* name, Double_t xval, Double_t yval, Double_t zval);
112   
113 //   void FillClass(const char* histClass, const TVectorD &vals);
114   void FillClass(const char* histClass, Int_t nValues, const Double_t *values);
115
116   
117   TH1* GetHistogram(const char* histClass, const char* name) const;
118   TH1* GetHistogram(const char* cutClass, const char* histClass, const char* name) const;
119   
120   void SetHistogramList(THashList &list, Bool_t setOwner=kTRUE);
121   void ResetHistogramList(){fHistoList.Clear();}
122   const THashList* GetHistogramList() const {return &fHistoList;}
123
124   void SetList(TList * const list) { fList=list; }
125   TList *GetList() const { return fList; }
126
127   void AddClass(const char* histClass);
128
129   void DumpToFile(const char* file="histos.root");
130   void ReadFromFile(const char* file="histos.root");
131   
132   virtual void Print(const Option_t* option = "") const;
133   virtual void Draw(const Option_t* option = "");
134   virtual void DrawSame(const char* histName, const Option_t *opt="leg can");
135
136   void SetReservedWords(const char* words);
137   void StoreVarForProfile(TObject *obj, UInt_t valType);
138 //   virtual void       Add(TObject *obj) {};
139 //   virtual void       Clear(Option_t *option="") {};
140 //   virtual void       Delete(Option_t *option="") {};
141 //   virtual TObject  **GetObjectRef(const TObject *obj) const { return 0; }
142 //   virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const ;
143 //   virtual TObject   *Remove(TObject *obj) { return 0; }
144
145   Bool_t SetCutClass(const char* cutClass);
146   
147 private:
148   THashList fHistoList;             //-> list of histograms
149   TList    *fList;                  //! List of list of histograms
150
151   TString *fReservedWords;          //! list of reserved words
152   void UserHistogramReservedWords(const char* histClass, const TH1 *hist, UInt_t valTypes);
153   void FillClass(THashTable *classTable, Int_t nValues, Double_t *values);
154   
155   void PrintPDF(Option_t* opt);
156   void PrintStructure() const;
157
158   Bool_t IsHistogramOk(const char* classTable, const char* name);
159   
160   enum {kNoAutoFill=1000000000};
161
162   AliDielectronHistos(const AliDielectronHistos &hist);
163   AliDielectronHistos& operator = (const AliDielectronHistos &hist);
164
165   ClassDef(AliDielectronHistos,2)
166 };
167
168 #endif
169