539b6cb4 |
1 | #ifndef DNDETACORRECTION_H |
2 | #define DNDETACORRECTION_H |
3 | |
75ec0f41 |
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 | |
27 | |
539b6cb4 |
28 | class dNdEtaCorrection : public TObject |
75ec0f41 |
29 | { |
30 | protected: |
31 | |
32 | TString fName; |
33 | |
34 | TH2F* hEtaVsVtx_meas; |
35 | TH2F* hEtaVsVtx_gene; |
36 | |
37 | TH2F* hEtaVsVtx_corr; |
38 | TH2F* hEtaVsVtx_ratio; |
39 | |
40 | public: |
41 | dNdEtaCorrection(Char_t* name="dndeta_correction"); |
42 | |
79ab56b9 |
43 | TH2F* GetGeneratedHistogram() { return hEtaVsVtx_gene; } |
44 | TH2F* GetMeasuredHistogram() { return hEtaVsVtx_meas; } |
45 | |
46 | void SetGeneratedHistogram(TH2F* aGeneratedHistogram) { hEtaVsVtx_gene = aGeneratedHistogram; } |
47 | void SetMeasuredHistogram(TH2F* aMeasuredHistogram) { hEtaVsVtx_meas = aMeasuredHistogram; } |
48 | |
75ec0f41 |
49 | void FillMeas(Float_t vtx, Float_t eta) {hEtaVsVtx_meas->Fill(vtx, eta);} |
50 | void FillGene(Float_t vtx, Float_t eta) {hEtaVsVtx_gene->Fill(vtx, eta);} |
51 | |
52 | void Finish(); |
53 | |
54 | void SaveHistograms(); |
55 | Bool_t LoadHistograms(Char_t* fileName, Char_t* dir = "dndeta_correction"); |
56 | Bool_t LoadCorrection(Char_t* fileName, Char_t* dir = "dndeta_correction") |
57 | {return LoadHistograms(fileName, dir);} |
58 | |
59 | void DrawHistograms(); |
60 | |
61 | void RemoveEdges(Float_t cut=2, Int_t nBinsVtx=0, Int_t nBinsEta=0); |
62 | |
63 | Float_t GetCorrection(Float_t vtx, Float_t eta) |
64 | {return hEtaVsVtx_corr->GetBinContent(hEtaVsVtx_corr->FindBin(vtx,eta));} |
65 | |
66 | ClassDef(dNdEtaCorrection,0) |
67 | }; |
68 | |
539b6cb4 |
69 | #endif |