]>
Commit | Line | Data |
---|---|---|
b82e76e0 | 1 | |
2 | #include "AliFMDAnaCalibBackgroundCorrection.h" | |
3 | #include <TH2F.h> | |
4fb49e43 | 4 | #include <TH1F.h> |
b82e76e0 | 5 | #include <TBrowser.h> |
6 | ||
7 | ClassImp(AliFMDAnaCalibBackgroundCorrection) | |
8 | #if 0 | |
9 | ; // For Emacs | |
10 | #endif | |
11 | ||
12 | //____________________________________________________________________ | |
13 | AliFMDAnaCalibBackgroundCorrection::AliFMDAnaCalibBackgroundCorrection() : TObject(), | |
14 | fArray(), | |
15 | fAxis(), | |
4fb49e43 | 16 | fIsInit(kFALSE), |
17 | fListOfDoubleHitCorrection() | |
b82e76e0 | 18 | { |
19 | ||
20 | ||
21 | ||
22 | } | |
23 | ||
24 | ||
25 | //____________________________________________________________________ | |
26 | AliFMDAnaCalibBackgroundCorrection::AliFMDAnaCalibBackgroundCorrection(const AliFMDAnaCalibBackgroundCorrection& o) | |
4fb49e43 | 27 | : TObject(o), fArray(o.fArray), fAxis(o.fAxis), fIsInit(o.fIsInit), fListOfDoubleHitCorrection() |
b82e76e0 | 28 | { |
29 | // Copy ctor | |
30 | } | |
31 | //____________________________________________________________________ | |
32 | AliFMDAnaCalibBackgroundCorrection& | |
33 | AliFMDAnaCalibBackgroundCorrection::operator=(const AliFMDAnaCalibBackgroundCorrection& o) | |
34 | { | |
35 | // Assignment operator | |
36 | ||
37 | fArray = o.fArray; | |
38 | ||
39 | return (*this); | |
40 | } | |
41 | ||
42 | //____________________________________________________________________ | |
43 | TH2F* AliFMDAnaCalibBackgroundCorrection::GetBgCorrection(Int_t det, | |
44 | Char_t ring, | |
45 | Int_t vtxbin) { | |
46 | TObjArray* ringArray = GetRingArray(det,ring); | |
47 | TH2F* hCorrection = (TH2F*)ringArray->At(vtxbin); | |
46807b30 | 48 | return hCorrection; |
b82e76e0 | 49 | } |
50 | ||
51 | //____________________________________________________________________ | |
52 | void AliFMDAnaCalibBackgroundCorrection::SetBgCorrection(Int_t det, | |
53 | Char_t ring, | |
54 | Int_t vtxbin, | |
55 | TH2F* hCorrection) { | |
56 | if(!fIsInit) | |
57 | Init(); | |
58 | ||
59 | TObjArray* ringArray = GetRingArray(det,ring); | |
60 | ringArray->AddAtAndExpand(hCorrection,vtxbin); | |
61 | ||
62 | } | |
63 | //____________________________________________________________________ | |
41bad769 | 64 | TH1F* AliFMDAnaCalibBackgroundCorrection::GetDoubleHitCorrection(Int_t det, |
4fb49e43 | 65 | Char_t ring) { |
66 | ||
67 | ||
41bad769 | 68 | TH1F* hCorrection = (TH1F*)fListOfDoubleHitCorrection.FindObject(Form("hDoubleHitCorrection_FMD%d%c",det,ring)); |
4fb49e43 | 69 | return hCorrection; |
70 | } | |
71 | ||
72 | //____________________________________________________________________ | |
73 | void AliFMDAnaCalibBackgroundCorrection::SetDoubleHitCorrection(Int_t det, | |
74 | Char_t ring, | |
75 | TH1F* hCorrection) { | |
41bad769 | 76 | hCorrection->SetName(Form("hDoubleHitCorrection_FMD%d%c",det,ring)); |
4fb49e43 | 77 | fListOfDoubleHitCorrection.Add(hCorrection); |
78 | } | |
79 | //____________________________________________________________________ | |
b82e76e0 | 80 | void AliFMDAnaCalibBackgroundCorrection::SetRefAxis(TAxis* axis) { |
81 | ||
82 | ||
83 | fAxis.Set(axis->GetNbins(),axis->GetXmin(),axis->GetXmax()); | |
84 | ||
85 | } | |
86 | //____________________________________________________________________ | |
87 | void AliFMDAnaCalibBackgroundCorrection::Init() { | |
88 | ||
89 | fArray.SetOwner(); | |
90 | for(Int_t det = 1; det<=3;det++) { | |
91 | TObjArray* detArray = new TObjArray(); | |
92 | detArray->SetOwner(); | |
93 | fArray.AddAtAndExpand(detArray,det); | |
94 | Int_t nRings = (det == 1 ? 1 : 2); | |
95 | for(Int_t ring = 0;ring<nRings;ring++) { | |
96 | TObjArray* ringArray = new TObjArray(); | |
97 | ringArray->SetOwner(); | |
98 | detArray->AddAtAndExpand(ringArray,ring); | |
99 | ||
100 | } | |
101 | } | |
102 | fIsInit = kTRUE; | |
103 | ||
104 | } | |
105 | //____________________________________________________________________ | |
106 | TObjArray* AliFMDAnaCalibBackgroundCorrection::GetRingArray(Int_t det, | |
107 | Char_t ring) { | |
108 | ||
109 | Int_t ringNumber = (ring == 'I' ? 0 : 1); | |
110 | TObjArray* detArray = (TObjArray*)fArray.At(det); | |
111 | TObjArray* ringArray = (TObjArray*)detArray->At(ringNumber); | |
112 | ||
113 | return ringArray; | |
114 | } | |
115 | //____________________________________________________________________ | |
116 | Int_t AliFMDAnaCalibBackgroundCorrection::GetNvtxBins() { | |
117 | ||
118 | return fAxis.GetNbins(); | |
119 | ||
120 | } | |
121 | //____________________________________________________________________ | |
122 | Float_t AliFMDAnaCalibBackgroundCorrection::GetVtxCutZ() { | |
123 | ||
124 | return fAxis.GetXmax(); | |
125 | ||
126 | } | |
127 | ||
128 | //____________________________________________________________________ | |
129 | void | |
130 | AliFMDAnaCalibBackgroundCorrection::Browse(TBrowser* b) | |
131 | { | |
132 | b->Add(&fAxis, "Vertex bins"); | |
133 | b->Add(&fArray, "Array of histograms w/BG corrections"); | |
134 | } | |
135 | ||
136 | //____________________________________________________________________ | |
137 | // | |
138 | // EOF | |
139 | // |