]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // This class collects the event histograms into single histograms, | |
3 | // one for each ring in each vertex bin. | |
4 | // | |
5 | #ifndef ALIFMDHISTCOLLECTOR_H | |
6 | #define ALIFMDHISTCOLLECTOR_H | |
ffca499d | 7 | /** |
8 | * @file AliFMDHistCollector.h | |
9 | * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk> | |
10 | * @date Wed Mar 23 14:03:01 2011 | |
11 | * | |
12 | * @brief | |
13 | * | |
14 | * | |
bd6f5206 | 15 | * @ingroup pwglf_forward_aod |
ffca499d | 16 | */ |
7e4038b5 | 17 | #include <TNamed.h> |
18 | #include <TList.h> | |
19 | #include <TArrayI.h> | |
20 | #include "AliForwardUtil.h" | |
21 | class AliESDFMD; | |
22 | class TH2D; | |
23 | ||
24 | /** | |
25 | * This class collects the event histograms into single histograms, | |
26 | * one for each ring in each vertex bin. | |
27 | * | |
28 | * @par Input: | |
29 | * - AliESDFMD object possibly corrected for sharing | |
30 | * | |
31 | * @par Output: | |
32 | * - 5 RingHistos objects - each with a number of vertex dependent | |
33 | * 2D histograms of the inclusive charge particle density | |
34 | * | |
35 | * @par HistCollector used: | |
171c2d71 | 36 | * - AliFMDCorrSecondaryMap |
7e4038b5 | 37 | * |
bd6f5206 | 38 | * @ingroup pwglf_forward_algo |
39 | * @ingroup pwglf_forward_aod | |
7e4038b5 | 40 | */ |
41 | class AliFMDHistCollector : public TNamed | |
42 | { | |
43 | public: | |
e1f47419 | 44 | /** |
45 | * Methods to use when merging overlapping bins @f$b_1@f$, @f$b_2@f$ | |
46 | * with content @f$c_1@f$, @f$c_2@f$, and errors @f$e_1@f$, | |
47 | * @f$e_2@f$ into bin @f$ b@f$ with content @f$c@f$ and error @f$e@f$ | |
48 | */ | |
49 | enum MergeMethod { | |
50 | /** | |
51 | * @f[ | |
52 | * c = \frac{1}{2}(c_1+c_2) | |
53 | * @f] | |
54 | * @f[ | |
55 | * e = \sqrt{e_1^2+e_2^2} | |
56 | * @f] | |
57 | */ | |
58 | kStraightMean, | |
59 | /** | |
60 | * As above, exept zero's are ignored | |
61 | */ | |
62 | kStraightMeanNoZero, | |
63 | /** | |
64 | * @f[ | |
65 | * c = \frac{\frac{c_1}{e_1^2}+\frac{c_2}{e_2^2}}{ | |
66 | * \frac{1}{e_1^2}+\frac{1}{e_2^2}} | |
67 | * @f] | |
68 | * @f[ | |
ffca499d | 69 | * e = \sqrt{\frac{1}{\frac{1}{e_1^2}+\frac{1}{e_2^2}}} |
e1f47419 | 70 | * @f] |
71 | */ | |
72 | kWeightedMean, | |
73 | /** | |
74 | * @f[ | |
75 | * c = \left\{\begin{array}{cl} | |
ffca499d | 76 | * c_1 & \mbox{if $e_1 < e_2$} \\ |
77 | * c_2 & \mbox{otherwise}\end{array}\right. | |
e1f47419 | 78 | * @f] |
79 | */ | |
80 | kLeastError | |
81 | }; | |
82 | /** | |
83 | * How to obtain the fiducial cuts | |
84 | */ | |
85 | enum FiducialMethod { | |
86 | /** | |
87 | * Select bins by fixed cut. Bins with a secondary correction | |
88 | * less than the cut is considered as non-valid | |
89 | */ | |
90 | kByCut, | |
91 | /** | |
92 | * A bin is considered non-valid, if it is less then twice as | |
93 | * large as it's neighbors (in eta) | |
94 | */ | |
95 | kDistance | |
96 | }; | |
ce731b9f | 97 | /** |
98 | * FMD ring bits for skipping | |
99 | */ | |
100 | enum FMDRingBits { | |
101 | kFMD1I=0x01, | |
102 | kFMD1 =0x01, | |
103 | kFMD2I=0x02, | |
104 | kFMD2O=0x04, | |
105 | kFMD2 =0x06, | |
106 | kFMD3I=0x08, | |
107 | kFMD3O=0x10, | |
108 | kFMD3 =0x18 | |
109 | }; | |
7e4038b5 | 110 | /** |
111 | * Constructor | |
112 | */ | |
5bb5d1f6 | 113 | AliFMDHistCollector(); |
7e4038b5 | 114 | /** |
115 | * Constructor | |
116 | * | |
117 | * @param title Name of object | |
118 | */ | |
5bb5d1f6 | 119 | AliFMDHistCollector(const char* title); |
7e4038b5 | 120 | /** |
121 | * Copy constructor | |
122 | * | |
123 | * @param o Object to copy from | |
124 | */ | |
5bb5d1f6 | 125 | AliFMDHistCollector(const AliFMDHistCollector& o); |
7e4038b5 | 126 | |
127 | /** | |
128 | * Destructor | |
129 | */ | |
12fffad7 | 130 | virtual ~AliFMDHistCollector(); |
7e4038b5 | 131 | /** |
132 | * Assignement operator | |
133 | * | |
7984e5f7 | 134 | * @param o Object to assign from |
135 | * | |
7e4038b5 | 136 | * @return Reference to this object |
137 | */ | |
138 | AliFMDHistCollector& operator=(const AliFMDHistCollector&); | |
139 | /** | |
140 | * Intialise | |
141 | * | |
ffca499d | 142 | * @param vtxAxis @f$ v_z@f$ axis |
143 | * @param etaAxis @f$ \eta@f$ axis | |
7e4038b5 | 144 | */ |
12fffad7 | 145 | virtual void Init(const TAxis& vtxAxis, |
146 | const TAxis& etaAxis); | |
7e4038b5 | 147 | /** |
148 | * Do the calculations | |
149 | * | |
150 | * @param hists Cache of histograms | |
5bb5d1f6 | 151 | * @param sums Cache to sum ring histograms in |
0bd4b00f | 152 | * @param vtxBin Vertex bin (1 based) |
7e4038b5 | 153 | * @param out Output histogram |
154 | * | |
155 | * @return true on successs | |
156 | */ | |
5bb5d1f6 | 157 | virtual Bool_t Collect(const AliForwardUtil::Histos& hists, |
158 | AliForwardUtil::Histos& sums, | |
159 | UShort_t vtxBin, | |
160 | TH2D& out); | |
12fffad7 | 161 | /** |
162 | * Output diagnostic histograms to directory | |
163 | * | |
164 | * @param dir List to write in | |
165 | */ | |
166 | virtual void DefineOutput(TList* dir); | |
e1f47419 | 167 | /** |
168 | * Set the merge method | |
169 | * | |
170 | * @param m Method | |
171 | */ | |
172 | void SetMergeMethod(MergeMethod m) { fMergeMethod = m; } | |
173 | /** | |
174 | * Set the method for finding the fidicual area of the secondary maps | |
175 | * | |
176 | * @param m Method | |
177 | */ | |
178 | void SetFiducialMethod(FiducialMethod m) { fFiducialMethod = m; } | |
7e4038b5 | 179 | /** |
180 | * Set the number of extra bins (beyond the secondary map border) | |
181 | * to cut away. | |
182 | * | |
183 | * @param n Number of bins | |
184 | */ | |
185 | void SetNCutBins(UInt_t n=2) { fNCutBins = n; } | |
186 | /** | |
187 | * Set the correction cut, that is, when bins in the secondary | |
188 | * correction maps have a value lower than this cut, they are | |
189 | * considered uncertain and not used | |
190 | * | |
191 | * @param cut Cut-off | |
192 | */ | |
193 | void SetCorrectionCut(Float_t cut=0.5) { fCorrectionCut = cut; } | |
ea3e5d95 | 194 | /** |
ce731b9f | 195 | * Set FMD rings to skip. Argument should be kFirstRingToSkip|kSecondRingToSkip... |
196 | * | |
197 | * @param mask bit pattern | |
198 | */ | |
199 | void SetFMDRingsToSkip(UShort_t mask) { fSkipFMDRings = mask; } | |
200 | /** | |
201 | * Set whether to make bg maps or not | |
202 | * | |
203 | * @param use make them | |
204 | */ | |
205 | void SetMakeBGHitMaps(Bool_t use) { fBgAndHitMaps = use; } | |
206 | ||
207 | /** | |
208 | * Set the debug level. The higher the value the more output | |
ea3e5d95 | 209 | * |
210 | * @param dbg Debug level | |
211 | */ | |
ce731b9f | 212 | |
ea3e5d95 | 213 | void SetDebug(Int_t dbg=1) { fDebug = dbg; } |
0bd4b00f | 214 | /** |
215 | * Print information | |
216 | * | |
217 | * @param option Not used | |
218 | */ | |
219 | void Print(Option_t* option="") const; | |
7e4038b5 | 220 | protected: |
221 | /** | |
222 | * Get the first and last eta bin to use for a given ring and vertex | |
223 | * | |
224 | * @param d Detector | |
225 | * @param r Ring | |
0bd4b00f | 226 | * @param vtxBin Vertex bin (1 based) |
7e4038b5 | 227 | * @param first On return, the first eta bin to use |
228 | * @param last On return, the last eta bin to use | |
229 | */ | |
0bd4b00f | 230 | virtual void GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxBin, |
7e4038b5 | 231 | Int_t& first, Int_t& last) const; |
232 | /** | |
233 | * Get the first and last eta bin to use for a given ring and vertex | |
234 | * | |
235 | * @param idx Ring index as given by GetIdx | |
0bd4b00f | 236 | * @param vtxBin Vertex bin (1 based) |
7e4038b5 | 237 | * @param first On return, the first eta bin to use |
238 | * @param last On return, the last eta bin to use | |
239 | */ | |
0bd4b00f | 240 | virtual void GetFirstAndLast(Int_t idx, UShort_t vtxBin, |
7e4038b5 | 241 | Int_t& first, Int_t& last) const; |
242 | /** | |
243 | * Get the first eta bin to use for a given ring and vertex | |
244 | * | |
245 | * @param d Detector | |
246 | * @param r Ring | |
0bd4b00f | 247 | * @param v vertex bin (1 based) |
7e4038b5 | 248 | * |
249 | * @return First eta bin to use, or -1 in case of problems | |
250 | */ | |
0bd4b00f | 251 | Int_t GetFirst(UShort_t d, Char_t r, UShort_t v) const; |
7e4038b5 | 252 | /** |
253 | * Get the first eta bin to use for a given ring and vertex | |
254 | * | |
255 | * @param idx Ring index as given by GetIdx | |
0bd4b00f | 256 | * @param v vertex bin (1 based) |
7e4038b5 | 257 | * |
258 | * @return First eta bin to use, or -1 in case of problems | |
259 | */ | |
0bd4b00f | 260 | Int_t GetFirst(Int_t idx, UShort_t v) const; |
7e4038b5 | 261 | /** |
262 | * Get the last eta bin to use for a given ring and vertex | |
263 | * | |
264 | * @param d Detector | |
265 | * @param r Ring | |
0bd4b00f | 266 | * @param v vertex bin (1 based) |
7e4038b5 | 267 | * |
268 | * @return Last eta bin to use, or -1 in case of problems | |
269 | */ | |
0bd4b00f | 270 | Int_t GetLast(UShort_t d, Char_t r, UShort_t v) const; |
7e4038b5 | 271 | /** |
272 | * Get the last eta bin to use for a given ring and vertex | |
273 | * | |
274 | * @param idx Ring index as given by GetIdx | |
0bd4b00f | 275 | * @param v vertex bin (1 based) |
7e4038b5 | 276 | * |
277 | * @return Last eta bin to use, or -1 in case of problems | |
278 | */ | |
0bd4b00f | 279 | Int_t GetLast(Int_t idx, UShort_t v) const; |
7e4038b5 | 280 | /** |
281 | * Get the detector and ring from the ring index | |
282 | * | |
283 | * @param idx Ring index | |
284 | * @param d On return, the detector or 0 in case of errors | |
285 | * @param r On return, the ring id or '0' in case of errors | |
286 | */ | |
287 | void GetDetRing(Int_t idx, UShort_t& d, Char_t& r) const; | |
288 | /** | |
289 | * Get the ring index from detector number and ring identifier | |
290 | * | |
291 | * @param d Detector | |
292 | * @param r Ring identifier | |
293 | * | |
294 | * @return ring index or -1 in case of problems | |
295 | */ | |
296 | Int_t GetIdx(UShort_t d, Char_t r) const; | |
297 | /** | |
298 | * Get the possibly overlapping histogram of eta bin @a e in | |
299 | * detector and ring | |
300 | * | |
301 | * @param d Detector | |
302 | * @param r Ring | |
303 | * @param e Eta bin | |
0bd4b00f | 304 | * @param v Vertex bin (1 based) |
7e4038b5 | 305 | * |
306 | * @return Overlapping histogram index or -1 | |
307 | */ | |
0bd4b00f | 308 | Int_t GetOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const; |
7e4038b5 | 309 | /** |
310 | * Get the possibly overlapping histogram of eta bin @a e in | |
311 | * detector and ring | |
312 | * | |
313 | * @param i Ring index | |
314 | * @param e Eta bin | |
0bd4b00f | 315 | * @param v Vertex bin (1 based) |
7e4038b5 | 316 | * |
317 | * @return Overlapping histogram index or -1 | |
318 | */ | |
0bd4b00f | 319 | Int_t GetOverlap(Int_t i, Int_t e, UShort_t v) const; |
7e4038b5 | 320 | /** |
321 | * Check if there's an overlapping histogram with this eta bin of | |
322 | * the detector and ring | |
323 | * | |
324 | * @param d Detector | |
325 | * @param r Ring | |
326 | * @param e eta bin | |
0bd4b00f | 327 | * @param v Vertex bin (1 based) |
7e4038b5 | 328 | * |
329 | * @return True if there's an overlapping histogram | |
330 | */ | |
0bd4b00f | 331 | Bool_t HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const; |
7e4038b5 | 332 | /** |
333 | * Check if there's an overlapping histogram with this eta bin of | |
334 | * ring | |
335 | * | |
336 | * @param i Ring index | |
337 | * @param e eta bin | |
338 | * @param v Vertex bin | |
339 | * | |
340 | * @return True if there's an overlapping histogram | |
341 | */ | |
0bd4b00f | 342 | Bool_t HasOverlap(Int_t i, Int_t e, UShort_t v) const; |
e1f47419 | 343 | /** |
344 | * Check if we should include the bin in the data range | |
345 | * | |
346 | * @param bg Secondary map histogram | |
347 | * @param ie Eta bin | |
348 | * @param ip Phi bin | |
349 | * | |
350 | * @return True if to be used | |
351 | */ | |
352 | Bool_t CheckCorrection(const TH2D* bg, Int_t ie, Int_t ip) const; | |
353 | /** | |
354 | * Merge bins accoring to set method | |
355 | * | |
356 | * @param c Current content | |
357 | * @param e Current error | |
358 | * @param oc Old content | |
359 | * @param oe Old error | |
360 | * @param rc On return, the new content | |
361 | * @param re On return, tne new error | |
362 | */ | |
363 | void MergeBins(Double_t c, Double_t e, | |
364 | Double_t oc, Double_t oe, | |
365 | Double_t& rc, Double_t& re) const; | |
5bb5d1f6 | 366 | |
7e4038b5 | 367 | |
368 | Int_t fNCutBins; // Number of additional bins to cut away | |
369 | Float_t fCorrectionCut; // Cut-off on secondary corrections | |
370 | TArrayI fFirstBins; // Array of first eta bins | |
371 | TArrayI fLastBins; // Array of last eta bins | |
ea3e5d95 | 372 | Int_t fDebug; // Debug level |
12fffad7 | 373 | TList* fList; // Output list |
374 | TH2D* fSumRings; // Sum per ring (on y-axis) | |
375 | TH2D* fCoverage; // Sum per ring (on y-axis) | |
e1f47419 | 376 | MergeMethod fMergeMethod; // Merge methiod for overlapping bins |
377 | FiducialMethod fFiducialMethod; // Fidicual method | |
ce731b9f | 378 | UShort_t fSkipFMDRings; // FMD rings to ignore |
379 | Bool_t fBgAndHitMaps; // Make hit/bg maps or not | |
380 | ||
381 | ClassDef(AliFMDHistCollector,2); // Calculate Nch density | |
7e4038b5 | 382 | }; |
383 | ||
384 | //____________________________________________________________________ | |
385 | inline void | |
0bd4b00f | 386 | AliFMDHistCollector::GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxbin, |
7e4038b5 | 387 | Int_t& first, Int_t& last) const |
388 | { | |
389 | GetFirstAndLast(GetIdx(d,r), vtxbin, first, last); | |
390 | } | |
391 | //____________________________________________________________________ | |
392 | inline Int_t | |
0bd4b00f | 393 | AliFMDHistCollector::GetFirst(UShort_t d, Char_t r, UShort_t v) const |
7e4038b5 | 394 | { |
395 | return GetFirst(GetIdx(d,r), v); | |
396 | } | |
397 | //____________________________________________________________________ | |
398 | inline Int_t | |
0bd4b00f | 399 | AliFMDHistCollector::GetLast(UShort_t d, Char_t r, UShort_t v) const |
7e4038b5 | 400 | { |
401 | return GetLast(GetIdx(d, r), v); | |
402 | } | |
403 | //____________________________________________________________________ | |
404 | inline Bool_t | |
0bd4b00f | 405 | AliFMDHistCollector::HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const |
7e4038b5 | 406 | { |
407 | return GetOverlap(d,r,e,v) >= 0; | |
408 | } | |
409 | //____________________________________________________________________ | |
410 | inline Bool_t | |
0bd4b00f | 411 | AliFMDHistCollector::HasOverlap(Int_t i, Int_t e, UShort_t v) const |
7e4038b5 | 412 | { |
413 | return GetOverlap(i,e,v) >= 0; | |
414 | } | |
415 | ||
416 | #endif | |
417 | // Local Variables: | |
418 | // mode: C++ | |
419 | // End: | |
420 |