]>
Commit | Line | Data |
---|---|---|
6f791cc3 | 1 | // |
2 | // This class contains the secondary correction | |
3 | // for the central region | |
4 | // | |
5 | #include "AliCentralCorrSecondaryMap.h" | |
6 | #include <TBrowser.h> | |
7 | #include <TH2D.h> | |
8 | #include <AliLog.h> | |
9 | #include <iostream> | |
10 | ||
11 | //____________________________________________________________________ | |
12 | AliCentralCorrSecondaryMap::AliCentralCorrSecondaryMap() | |
13 | : fArray(), | |
14 | fVertexAxis(0,0,0) | |
15 | { | |
16 | // | |
17 | // Default constructor | |
18 | // | |
19 | fArray.SetOwner(kTRUE); | |
20 | fArray.SetName("rings"); | |
21 | fVertexAxis.SetName("vtxAxis"); | |
22 | fVertexAxis.SetTitle("v_{z} [cm]"); | |
23 | ||
24 | } | |
25 | //____________________________________________________________________ | |
26 | AliCentralCorrSecondaryMap::AliCentralCorrSecondaryMap(const | |
27 | AliCentralCorrSecondaryMap& 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 | AliCentralCorrSecondaryMap::~AliCentralCorrSecondaryMap() | |
44 | { | |
45 | // | |
46 | // Destructor | |
47 | // | |
48 | // | |
49 | fArray.Clear(); | |
50 | } | |
51 | //____________________________________________________________________ | |
52 | AliCentralCorrSecondaryMap& | |
53 | AliCentralCorrSecondaryMap::operator=(const AliCentralCorrSecondaryMap& 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 | TH2D* | |
71 | AliCentralCorrSecondaryMap::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 | TH2D* | |
90 | AliCentralCorrSecondaryMap::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 | TObject* o = fArray.At(b-1); | |
106 | if (!o) { | |
107 | AliWarning(Form("No dead channels map found for SPD in vertex bin %d", | |
108 | b)); | |
109 | return 0; | |
110 | } | |
111 | return static_cast<TH2D*>(o); | |
112 | } | |
113 | ||
114 | //____________________________________________________________________ | |
115 | Int_t | |
116 | AliCentralCorrSecondaryMap::FindVertexBin(Double_t v) const | |
117 | { | |
118 | // | |
119 | // Find the vertex bin that corresponds to the passed vertex | |
120 | // | |
121 | // Parameters: | |
122 | // vertex The interaction points @f$z@f$-coordinate | |
123 | // | |
124 | // Return: | |
125 | // Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if | |
126 | // out of range | |
127 | // | |
128 | if (fVertexAxis.GetNbins() <= 0) { | |
129 | AliWarning("No vertex array defined"); | |
130 | return 0; | |
131 | } | |
132 | Int_t bin = const_cast<TAxis&>(fVertexAxis).FindBin(v); | |
133 | if (bin <= 0 || bin > fVertexAxis.GetNbins()) { | |
134 | AliWarning(Form("vertex %+8.4f out of range [%+8.4f,%+8.4f]", | |
135 | v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax())); | |
136 | return 0; | |
137 | } | |
138 | return bin; | |
139 | } | |
140 | ||
141 | //____________________________________________________________________ | |
142 | Bool_t | |
143 | AliCentralCorrSecondaryMap::SetCorrection(UShort_t b, TH2D* h) | |
144 | { | |
145 | // | |
146 | // Set the acceptance correction @f$ a_{r,v}(\eta)@f$ | |
147 | // Note, that the object takes ownership of the passed pointer. | |
148 | // | |
149 | // Parameters: | |
150 | // d Detector number (1-3) | |
151 | // r Ring identifier (I or O) | |
152 | // b Bin corresponding to the primary interaction point | |
153 | // @f$z@f$ coordinate (1 based) | |
154 | // h @f$ a_{r,v}(\eta)@f$ | |
155 | // | |
156 | // Return: | |
157 | // true if operation succeeded | |
158 | // | |
159 | ||
160 | if (b <= 0 || b > fVertexAxis.GetNbins()) { | |
161 | AliWarning(Form("Vertex bin %3d out of range [1,%3d]", | |
162 | b, fVertexAxis.GetNbins())); | |
163 | return false; | |
164 | } | |
165 | h->SetName(Form("SPD_vtxbin%03d", b)); | |
166 | h->SetTitle(Form("SecondaryMap correction for SPD " | |
167 | "in vertex bin %d [%+8.4f,%+8.4f]", | |
168 | b, fVertexAxis.GetBinLowEdge(b), | |
169 | fVertexAxis.GetBinUpEdge(b))); | |
170 | h->SetXTitle("#eta"); | |
171 | h->SetYTitle("dN_{ch}/d#eta / sum_i N_{ch,i}"); | |
172 | h->SetFillStyle(3001); | |
173 | h->SetDirectory(0); | |
174 | h->SetStats(0); | |
175 | fArray.AddAtAndExpand(h, b-1); | |
176 | return kTRUE; | |
177 | } | |
178 | //____________________________________________________________________ | |
179 | Bool_t | |
180 | AliCentralCorrSecondaryMap::SetCorrection(Double_t v, TH2D* h) | |
181 | { | |
182 | // | |
183 | // Set the acceptance correction @f$ a_{r,v}(\eta)@f$. | |
184 | // Note, that the object takes ownership of the passed pointer. | |
185 | // | |
186 | // Parameters: | |
187 | // d Detector number (1-3) | |
188 | // r Ring identifier (I or O) | |
189 | // v Primary interaction point @f$z@f$ coordinate | |
190 | // h @f$ a_{r,v}(\eta)@f$ | |
191 | // | |
192 | // Return: | |
193 | // true if operation succeeded | |
194 | // | |
195 | Int_t b = FindVertexBin(v); | |
196 | if (b <= 0 || b > fVertexAxis.GetNbins()) { | |
197 | AliWarning(Form("Vertex %+8.4f out of range [%+8.4f,%+8.4f]", | |
198 | v, fVertexAxis.GetXmin(), fVertexAxis.GetXmax())); | |
199 | return false; | |
200 | } | |
201 | return SetCorrection( UShort_t(b), h); | |
202 | } | |
203 | //____________________________________________________________________ | |
204 | void | |
205 | AliCentralCorrSecondaryMap::Browse(TBrowser* b) | |
206 | { | |
207 | // | |
208 | // Browse this object in the browser | |
209 | // | |
210 | // Parameters: | |
211 | // b | |
212 | // | |
213 | b->Add(&fArray); | |
214 | b->Add(&fVertexAxis); | |
215 | } | |
216 | //____________________________________________________________________ | |
217 | void | |
218 | AliCentralCorrSecondaryMap::Print(Option_t* option) const | |
219 | { | |
220 | // | |
221 | // Print this object | |
222 | // | |
223 | // Parameters: | |
224 | // option | |
225 | // | |
226 | std::cout << "SecondaryMap correction" << std::endl; | |
227 | fArray.Print(option); | |
228 | fVertexAxis.Print(option); | |
229 | } | |
230 | ||
231 | //____________________________________________________________________ | |
232 | // | |
233 | // EOF | |
234 | // |