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