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