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