]>
Commit | Line | Data |
---|---|---|
7e4038b5 | 1 | #ifndef ALIROOT_PWG2_FORWARD_ANALYSIS2_ALIFMDHISTCOLLECTOR_H |
2 | #define ALIROOT_PWG2_FORWARD_ANALYSIS2_ALIFMDHISTCOLLECTOR_H | |
3 | #include <TNamed.h> | |
4 | #include <TList.h> | |
5 | #include <TArrayI.h> | |
6 | #include "AliForwardUtil.h" | |
7 | class AliESDFMD; | |
8 | class TH2D; | |
9 | ||
10 | /** | |
11 | * This class collects the event histograms into single histograms, | |
12 | * one for each ring in each vertex bin. | |
13 | * | |
14 | * @par Input: | |
15 | * - AliESDFMD object possibly corrected for sharing | |
16 | * | |
17 | * @par Output: | |
18 | * - 5 RingHistos objects - each with a number of vertex dependent | |
19 | * 2D histograms of the inclusive charge particle density | |
20 | * | |
21 | * @par HistCollector used: | |
22 | * - AliFMDAnaCalibBackgroundCorrection | |
23 | * | |
24 | * @ingroup pwg2_forward_analysis | |
25 | */ | |
26 | class AliFMDHistCollector : public TNamed | |
27 | { | |
28 | public: | |
29 | /** | |
30 | * Constructor | |
31 | */ | |
32 | AliFMDHistCollector() | |
ea3e5d95 | 33 | : fNCutBins(0), fCorrectionCut(0), fFirstBins(), fLastBins(), fDebug(0) |
7e4038b5 | 34 | {} |
35 | /** | |
36 | * Constructor | |
37 | * | |
38 | * @param title Name of object | |
39 | */ | |
40 | AliFMDHistCollector(const char* title) | |
41 | : TNamed("fmdHistCollector", title), | |
ea3e5d95 | 42 | fNCutBins(1), fCorrectionCut(0.5), |
43 | fFirstBins(1), fLastBins(1), fDebug(0) | |
7e4038b5 | 44 | {} |
45 | /** | |
46 | * Copy constructor | |
47 | * | |
48 | * @param o Object to copy from | |
49 | */ | |
50 | AliFMDHistCollector(const AliFMDHistCollector& o) | |
51 | : TNamed(o), | |
52 | fNCutBins(o.fNCutBins), fCorrectionCut(o.fCorrectionCut), | |
ea3e5d95 | 53 | fFirstBins(o.fFirstBins), fLastBins(o.fLastBins), fDebug(o.fDebug) |
7e4038b5 | 54 | {} |
55 | ||
56 | /** | |
57 | * Destructor | |
58 | */ | |
59 | virtual ~AliFMDHistCollector() {} | |
60 | /** | |
61 | * Assignement operator | |
62 | * | |
63 | * @return Reference to this object | |
64 | */ | |
65 | AliFMDHistCollector& operator=(const AliFMDHistCollector&); | |
66 | /** | |
67 | * Intialise | |
68 | * | |
69 | * @param vtxAxis Vertex axis | |
70 | */ | |
71 | virtual void Init(const TAxis& vtxAxis); | |
72 | /** | |
73 | * Do the calculations | |
74 | * | |
75 | * @param hists Cache of histograms | |
0bd4b00f | 76 | * @param vtxBin Vertex bin (1 based) |
7e4038b5 | 77 | * @param out Output histogram |
78 | * | |
79 | * @return true on successs | |
80 | */ | |
0bd4b00f | 81 | virtual Bool_t Collect(AliForwardUtil::Histos& hists, UShort_t vtxBin, |
7e4038b5 | 82 | TH2D& out); |
83 | /** | |
84 | * Set the number of extra bins (beyond the secondary map border) | |
85 | * to cut away. | |
86 | * | |
87 | * @param n Number of bins | |
88 | */ | |
89 | void SetNCutBins(UInt_t n=2) { fNCutBins = n; } | |
90 | /** | |
91 | * Set the correction cut, that is, when bins in the secondary | |
92 | * correction maps have a value lower than this cut, they are | |
93 | * considered uncertain and not used | |
94 | * | |
95 | * @param cut Cut-off | |
96 | */ | |
97 | void SetCorrectionCut(Float_t cut=0.5) { fCorrectionCut = cut; } | |
ea3e5d95 | 98 | /** |
99 | * Set the debug level. The higher the value the more output | |
100 | * | |
101 | * @param dbg Debug level | |
102 | */ | |
103 | void SetDebug(Int_t dbg=1) { fDebug = dbg; } | |
0bd4b00f | 104 | /** |
105 | * Print information | |
106 | * | |
107 | * @param option Not used | |
108 | */ | |
109 | void Print(Option_t* option="") const; | |
7e4038b5 | 110 | protected: |
111 | /** | |
112 | * Get the first and last eta bin to use for a given ring and vertex | |
113 | * | |
114 | * @param d Detector | |
115 | * @param r Ring | |
0bd4b00f | 116 | * @param vtxBin Vertex bin (1 based) |
7e4038b5 | 117 | * @param first On return, the first eta bin to use |
118 | * @param last On return, the last eta bin to use | |
119 | */ | |
0bd4b00f | 120 | virtual void GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxBin, |
7e4038b5 | 121 | Int_t& first, Int_t& last) const; |
122 | /** | |
123 | * Get the first and last eta bin to use for a given ring and vertex | |
124 | * | |
125 | * @param idx Ring index as given by GetIdx | |
0bd4b00f | 126 | * @param vtxBin Vertex bin (1 based) |
7e4038b5 | 127 | * @param first On return, the first eta bin to use |
128 | * @param last On return, the last eta bin to use | |
129 | */ | |
0bd4b00f | 130 | virtual void GetFirstAndLast(Int_t idx, UShort_t vtxBin, |
7e4038b5 | 131 | Int_t& first, Int_t& last) const; |
132 | /** | |
133 | * Get the first eta bin to use for a given ring and vertex | |
134 | * | |
135 | * @param d Detector | |
136 | * @param r Ring | |
0bd4b00f | 137 | * @param v vertex bin (1 based) |
7e4038b5 | 138 | * |
139 | * @return First eta bin to use, or -1 in case of problems | |
140 | */ | |
0bd4b00f | 141 | Int_t GetFirst(UShort_t d, Char_t r, UShort_t v) const; |
7e4038b5 | 142 | /** |
143 | * Get the first eta bin to use for a given ring and vertex | |
144 | * | |
145 | * @param idx Ring index as given by GetIdx | |
0bd4b00f | 146 | * @param v vertex bin (1 based) |
7e4038b5 | 147 | * |
148 | * @return First eta bin to use, or -1 in case of problems | |
149 | */ | |
0bd4b00f | 150 | Int_t GetFirst(Int_t idx, UShort_t v) const; |
7e4038b5 | 151 | /** |
152 | * Get the last eta bin to use for a given ring and vertex | |
153 | * | |
154 | * @param d Detector | |
155 | * @param r Ring | |
0bd4b00f | 156 | * @param v vertex bin (1 based) |
7e4038b5 | 157 | * |
158 | * @return Last eta bin to use, or -1 in case of problems | |
159 | */ | |
0bd4b00f | 160 | Int_t GetLast(UShort_t d, Char_t r, UShort_t v) const; |
7e4038b5 | 161 | /** |
162 | * Get the last eta bin to use for a given ring and vertex | |
163 | * | |
164 | * @param idx Ring index as given by GetIdx | |
0bd4b00f | 165 | * @param v vertex bin (1 based) |
7e4038b5 | 166 | * |
167 | * @return Last eta bin to use, or -1 in case of problems | |
168 | */ | |
0bd4b00f | 169 | Int_t GetLast(Int_t idx, UShort_t v) const; |
7e4038b5 | 170 | /** |
171 | * Get the detector and ring from the ring index | |
172 | * | |
173 | * @param idx Ring index | |
174 | * @param d On return, the detector or 0 in case of errors | |
175 | * @param r On return, the ring id or '0' in case of errors | |
176 | */ | |
177 | void GetDetRing(Int_t idx, UShort_t& d, Char_t& r) const; | |
178 | /** | |
179 | * Get the ring index from detector number and ring identifier | |
180 | * | |
181 | * @param d Detector | |
182 | * @param r Ring identifier | |
183 | * | |
184 | * @return ring index or -1 in case of problems | |
185 | */ | |
186 | Int_t GetIdx(UShort_t d, Char_t r) const; | |
187 | /** | |
188 | * Get the possibly overlapping histogram of eta bin @a e in | |
189 | * detector and ring | |
190 | * | |
191 | * @param d Detector | |
192 | * @param r Ring | |
193 | * @param e Eta bin | |
0bd4b00f | 194 | * @param v Vertex bin (1 based) |
7e4038b5 | 195 | * |
196 | * @return Overlapping histogram index or -1 | |
197 | */ | |
0bd4b00f | 198 | Int_t GetOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const; |
7e4038b5 | 199 | /** |
200 | * Get the possibly overlapping histogram of eta bin @a e in | |
201 | * detector and ring | |
202 | * | |
203 | * @param i Ring index | |
204 | * @param e Eta bin | |
0bd4b00f | 205 | * @param v Vertex bin (1 based) |
7e4038b5 | 206 | * |
207 | * @return Overlapping histogram index or -1 | |
208 | */ | |
0bd4b00f | 209 | Int_t GetOverlap(Int_t i, Int_t e, UShort_t v) const; |
7e4038b5 | 210 | /** |
211 | * Check if there's an overlapping histogram with this eta bin of | |
212 | * the detector and ring | |
213 | * | |
214 | * @param d Detector | |
215 | * @param r Ring | |
216 | * @param e eta bin | |
0bd4b00f | 217 | * @param v Vertex bin (1 based) |
7e4038b5 | 218 | * |
219 | * @return True if there's an overlapping histogram | |
220 | */ | |
0bd4b00f | 221 | Bool_t HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const; |
7e4038b5 | 222 | /** |
223 | * Check if there's an overlapping histogram with this eta bin of | |
224 | * ring | |
225 | * | |
226 | * @param i Ring index | |
227 | * @param e eta bin | |
228 | * @param v Vertex bin | |
229 | * | |
230 | * @return True if there's an overlapping histogram | |
231 | */ | |
0bd4b00f | 232 | Bool_t HasOverlap(Int_t i, Int_t e, UShort_t v) const; |
7e4038b5 | 233 | |
234 | ||
235 | Int_t fNCutBins; // Number of additional bins to cut away | |
236 | Float_t fCorrectionCut; // Cut-off on secondary corrections | |
237 | TArrayI fFirstBins; // Array of first eta bins | |
238 | TArrayI fLastBins; // Array of last eta bins | |
ea3e5d95 | 239 | Int_t fDebug; // Debug level |
7e4038b5 | 240 | |
241 | ClassDef(AliFMDHistCollector,1); // Calculate Nch density | |
242 | }; | |
243 | ||
244 | //____________________________________________________________________ | |
245 | inline void | |
0bd4b00f | 246 | AliFMDHistCollector::GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxbin, |
7e4038b5 | 247 | Int_t& first, Int_t& last) const |
248 | { | |
249 | GetFirstAndLast(GetIdx(d,r), vtxbin, first, last); | |
250 | } | |
251 | //____________________________________________________________________ | |
252 | inline Int_t | |
0bd4b00f | 253 | AliFMDHistCollector::GetFirst(UShort_t d, Char_t r, UShort_t v) const |
7e4038b5 | 254 | { |
255 | return GetFirst(GetIdx(d,r), v); | |
256 | } | |
257 | //____________________________________________________________________ | |
258 | inline Int_t | |
0bd4b00f | 259 | AliFMDHistCollector::GetLast(UShort_t d, Char_t r, UShort_t v) const |
7e4038b5 | 260 | { |
261 | return GetLast(GetIdx(d, r), v); | |
262 | } | |
263 | //____________________________________________________________________ | |
264 | inline Bool_t | |
0bd4b00f | 265 | AliFMDHistCollector::HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const |
7e4038b5 | 266 | { |
267 | return GetOverlap(d,r,e,v) >= 0; | |
268 | } | |
269 | //____________________________________________________________________ | |
270 | inline Bool_t | |
0bd4b00f | 271 | AliFMDHistCollector::HasOverlap(Int_t i, Int_t e, UShort_t v) const |
7e4038b5 | 272 | { |
273 | return GetOverlap(i,e,v) >= 0; | |
274 | } | |
275 | ||
276 | #endif | |
277 | // Local Variables: | |
278 | // mode: C++ | |
279 | // End: | |
280 |