]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG0/CorrectionMatrix2D.h
(martin) 2D correction matrix calculation class
[u/mrichter/AliRoot.git] / PWG0 / CorrectionMatrix2D.h
1 #ifndef CORRECTIONMATRIX2D_H
2 #define CORRECTIONMATRIX2D_H
3
4 // ------------------------------------------------------
5 //
6 // Class to handle corrections for dN/dEta measurements
7 //
8 // ------------------------------------------------------
9 //
10 // TODO:
11 // - add documentation
12 // - add status: generate or use maps
13 // - add functionality to set the bin sizes
14 // - add histograms with errors (for error visualization)
15 // 
16
17 #ifndef ROOT_TObject
18 #include "TObject.h"
19 #endif
20 #ifndef ROOT_TFile
21 #include "TFile.h"
22 #endif
23 #ifndef ROOT_TH2
24 #include "TH2.h"
25 #endif
26 #ifndef ROOT_TCanvas
27 #include "TCanvas.h"
28 #endif
29 #ifndef ROOT_TError
30 #include "TError.h"
31 #endif
32
33 class CorrectionMatrix2D : public TObject 
34 {
35 protected:
36   
37   TString  fName; 
38   
39   TH2F*    hmeas;
40   TH2F*    hgene;
41
42   TH2F*    hcorr; 
43   TH2F*    hratio;
44
45 public:
46   CorrectionMatrix2D(Char_t* name="CorrectionMatrix");
47
48   TH2F* GetGeneratedHistogram() { return hgene; }
49   TH2F* GetMeasuredHistogram()  { return hmeas; }
50
51   void SetGeneratedHistogram(TH2F* agene) { hgene = agene; }
52   void SetMeasuredHistogram(TH2F* ameas) { hmeas = ameas; }
53
54
55   void FillMeas(Float_t x, Float_t y) {hmeas->Fill(x,y);}
56   void FillGene(Float_t x, Float_t y) {hgene->Fill(x,y);}
57
58   void Finish();
59   
60   //Char_t *name , Char_t *title , 
61                
62   void SetHist(Char_t* title ,Int_t nBinX=10, Float_t Xmin=0., Float_t Xmax=10.,
63                Int_t nBinY=10, Float_t Ymin=0., Float_t Ymax=10.);
64   void SetHist(Char_t* title ,Int_t nBinX, Float_t *X, Int_t nBinY, Float_t *Y);
65    
66   void SetHistTitle(Char_t* titleX=" ", Char_t* titleY=" ");
67   
68   void SaveHistograms();
69   void DrawHistograms();  
70
71   Bool_t  LoadHistograms(Char_t* fileName, Char_t* dir);
72   Bool_t  LoadCorrection(Char_t* fileName, Char_t* dir) {return LoadHistograms(fileName, dir);}
73   
74   void    RemoveEdges(Float_t cut=2, Int_t nBinsVtx=0, Int_t nBinsEta=0);
75   
76   Float_t GetCorrection(Float_t x, Float_t y) {return hcorr->GetBinContent(hcorr->FindBin(x,y));}
77   
78   ClassDef(CorrectionMatrix2D,0)
79 };
80
81 #endif
82