]>
Commit | Line | Data |
---|---|---|
6f791cc3 | 1 | // |
2 | // This class contains the acceptance correction due to dead channels | |
3 | // | |
4 | // | |
5 | #include "AliCentralCorrAcceptance.h" | |
6 | #include <TBrowser.h> | |
7 | #include <TH1D.h> | |
8 | #include <AliLog.h> | |
9 | #include <iostream> | |
10 | ||
11 | //____________________________________________________________________ | |
12 | AliCentralCorrAcceptance::AliCentralCorrAcceptance() | |
13 | : fArray(), | |
14 | fVertexAxis(0,0,0) | |
15 | { | |
16 | // | |
17 | // Default constructor | |
18 | // | |
19 | fArray.SetOwner(kTRUE); | |
20 | fArray.SetName("acceptance"); | |
21 | fVertexAxis.SetName("vtxAxis"); | |
22 | fVertexAxis.SetTitle("v_{z} [cm]"); | |
23 | ||
24 | } | |
25 | //____________________________________________________________________ | |
26 | AliCentralCorrAcceptance::AliCentralCorrAcceptance(const | |
27 | AliCentralCorrAcceptance& o) | |
28 | : TObject(o), | |
29 | fArray(o.fArray), | |
30 | fVertexAxis(o.fVertexAxis.GetNbins(), o.fVertexAxis.GetXmin(), | |
31 | o.fVertexAxis.GetXmax()) | |
32 | { | |
33 | // | |
34 | // Copy constructor | |
35 | // | |
36 | // Parameters: | |
37 | // o Object to copy from | |
38 | // | |
39 | fVertexAxis.SetName("vtxAxis"); | |
40 | fVertexAxis.SetTitle("v_{z} [cm]"); | |
41 | } | |
42 | //____________________________________________________________________ | |
43 | AliCentralCorrAcceptance::~AliCentralCorrAcceptance() | |
44 | { | |
45 | // | |
46 | // Destructor | |
47 | // | |
48 | // | |
49 | fArray.Clear(); | |
50 | } | |
51 | //____________________________________________________________________ | |
52 | AliCentralCorrAcceptance& | |
53 | AliCentralCorrAcceptance::operator=(const AliCentralCorrAcceptance& o) | |
54 | { | |
55 | // | |
56 | // Assignment operator | |
57 | // | |
58 | // Parameters: | |
59 | // o Object to assign from | |
60 | // | |
61 | // Return: | |
62 | // Reference to this object | |
63 | // | |
64 | fArray = o.fArray; | |
65 | SetVertexAxis(o.fVertexAxis); | |
66 | ||
67 | return *this; | |
68 | } | |
69 | //____________________________________________________________________ | |
70 | TH1D* | |
71 | AliCentralCorrAcceptance::GetCorrection(Double_t v) const | |
72 | { | |
73 | // | |
74 | // Get the acceptance correction @f$ a_{r,v}@f$ | |
75 | // | |
76 | // Parameters: | |
77 | // d Detector number (1-3) | |
78 | // r Ring identifier (I or O) | |
79 | // v Primary interaction point @f$z@f$ coordinate | |
80 | // | |
81 | // Return: | |
82 | // The correction @f$ a_{r,v}@f$ | |
83 | // | |
84 | Int_t b = FindVertexBin(v); | |
85 | if (b <= 0) return 0; | |
86 | return GetCorrection(UShort_t(b)); | |
87 | } | |
88 | //____________________________________________________________________ | |
89 | TH1D* | |
90 | AliCentralCorrAcceptance::GetCorrection(UShort_t b) const | |
91 | { | |
92 | // | |
93 | // Get the acceptance correction @f$ a_{r,v}@f$ | |
94 | // | |
95 | // Parameters: | |
96 | // d Detector number (1-3) | |
97 | // r Ring identifier (I or O) | |
98 | // b Bin corresponding to the primary interaction point | |
99 | // @f$z@f$ coordinate (1 based) | |
100 | // | |
101 | // Return: | |
102 | // The correction @f$ a_{r,v}@f$ | |
103 | // | |
104 | ||
105 | // TObjArray* ringArray = GetRingArray(d, r); | |
106 | //if (!ringArray) return 0; | |
107 | ||
108 | if (b <= 0 || b > fArray.GetEntriesFast()) { | |
109 | AliWarning(Form("vertex bin %d out of range [1,%d]", | |
110 | b, fArray.GetEntriesFast())); | |
111 | return 0; | |
112 | } | |
113 | ||
114 | TObject* o = fArray.At(b-1); | |
115 | if (!o) { | |
116 | AliWarning(Form("No dead channels map found for SPD in vertex bin %d", | |
117 | b)); | |
118 | return 0; | |
119 | } | |
120 | return static_cast<TH1D*>(o); | |
121 | } | |
122 | ||
123 | //____________________________________________________________________ | |
124 | Int_t | |
125 | AliCentralCorrAcceptance::FindVertexBin(Double_t v) const | |
126 | { | |
127 | // | |
128 | // Find the vertex bin that corresponds to the passed vertex | |
129 | // | |
130 | // Parameters: | |
131 | // vertex The interaction points @f$z@f$-coordinate | |
132 | // | |
133 | // Return: | |
134 | // Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if | |
135 | // out of range | |
136 | // | |
137 | if (fVertexAxis.GetNbins() <= 0) { | |
138 | AliWarning("No vertex array defined"); | |
139 | return 0; | |
140 | } | |
141 | Int_t bin = const_cast<TAxis&>(fVertexAxis).FindBin(v); | |
142 | if (bin <= 0 || bin > fVertexAxis.GetNbins()) { | |
143 | AliWarning(Form("vertex %+8.4f out of range [%+8.4f,%+8.4f]", | |
144 | v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax())); | |
145 | return 0; | |
146 | } | |
147 | return bin; | |
148 | } | |
149 | ||
150 | //____________________________________________________________________ | |
151 | Bool_t | |
152 | AliCentralCorrAcceptance::SetCorrection(UShort_t b, TH1D* h) | |
153 | { | |
154 | // | |
155 | // Set the acceptance correction @f$ a_{r,v}(\eta)@f$ | |
156 | // Note, that the object takes ownership of the passed pointer. | |
157 | // | |
158 | // Parameters: | |
159 | // b Bin corresponding to the primary interaction point | |
160 | // @f$z@f$ coordinate (1 based) | |
161 | // h @f$ a_{r,v}(\eta)@f$ | |
162 | // | |
163 | // Return: | |
164 | // true if operation succeeded | |
165 | // | |
166 | ||
167 | if (b <= 0 || b > fVertexAxis.GetNbins()) { | |
168 | AliWarning(Form("Vertex bin %3d out of range [1,%3d]", | |
169 | b, fVertexAxis.GetNbins())); | |
170 | return false; | |
171 | } | |
172 | ||
173 | h->SetName(Form("SPD_vtxbin%03d", b)); | |
174 | h->SetTitle(Form("Acceptance correction for SPD " | |
175 | "in vertex bin %d [%+8.4f,%+8.4f]", | |
176 | b, fVertexAxis.GetBinLowEdge(b), | |
177 | fVertexAxis.GetBinUpEdge(b))); | |
178 | h->SetXTitle("#eta"); | |
179 | h->SetYTitle("dN_{ch}/d#eta / sum_i N_{ch,i}"); | |
180 | h->SetFillStyle(3001); | |
181 | h->SetDirectory(0); | |
182 | h->SetStats(0); | |
183 | fArray.AddAtAndExpand(h, b-1); | |
184 | return kTRUE; | |
185 | } | |
186 | //____________________________________________________________________ | |
187 | Bool_t | |
188 | AliCentralCorrAcceptance::SetCorrection(Double_t v, TH1D* h) | |
189 | { | |
190 | // | |
191 | // Set the acceptance correction @f$ a_{r,v}(\eta)@f$. | |
192 | // Note, that the object takes ownership of the passed pointer. | |
193 | // | |
194 | // Parameters | |
195 | // v Primary interaction point @f$z@f$ coordinate | |
196 | // h @f$ a_{r,v}(\eta)@f$ | |
197 | // | |
198 | // Return: | |
199 | // true if operation succeeded | |
200 | // | |
201 | Int_t b = FindVertexBin(v); | |
202 | if (b <= 0 || b > fVertexAxis.GetNbins()) { | |
203 | AliWarning(Form("Vertex %+8.4f out of range [%+8.4f,%+8.4f]", | |
204 | v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax())); | |
205 | return false; | |
206 | } | |
207 | return SetCorrection(UShort_t(b), h); | |
208 | } | |
209 | //____________________________________________________________________ | |
210 | void | |
211 | AliCentralCorrAcceptance::Browse(TBrowser* b) | |
212 | { | |
213 | // | |
214 | // Browse this object in the browser | |
215 | // | |
216 | // Parameters: | |
217 | // b | |
218 | // | |
219 | b->Add(&fArray); | |
220 | b->Add(&fVertexAxis); | |
221 | } | |
222 | //____________________________________________________________________ | |
223 | void | |
224 | AliCentralCorrAcceptance::Print(Option_t* option) const | |
225 | { | |
226 | // | |
227 | // Print this object | |
228 | // | |
229 | // Parameters: | |
230 | // option | |
231 | // | |
232 | std::cout << "Acceptance correction due to dead channels" << std::endl; | |
233 | fArray.Print(option); | |
234 | fVertexAxis.Print(option); | |
235 | } | |
236 | ||
237 | //____________________________________________________________________ | |
238 | // | |
239 | // EOF | |
240 | // |