2 // This class collects the event histograms into single histograms,
3 // one for each ring in each vertex bin.
5 #ifndef ALIFMDHISTCOLLECTOR_H
6 #define ALIFMDHISTCOLLECTOR_H
10 #include "AliForwardUtil.h"
15 * This class collects the event histograms into single histograms,
16 * one for each ring in each vertex bin.
19 * - AliESDFMD object possibly corrected for sharing
22 * - 5 RingHistos objects - each with a number of vertex dependent
23 * 2D histograms of the inclusive charge particle density
25 * @par HistCollector used:
26 * - AliFMDCorrSecondaryMap
28 * @ingroup pwg2_forward_algo
30 class AliFMDHistCollector : public TNamed
37 : fNCutBins(0), fCorrectionCut(0), fFirstBins(), fLastBins(), fDebug(0)
42 * @param title Name of object
44 AliFMDHistCollector(const char* title)
45 : TNamed("fmdHistCollector", title),
46 fNCutBins(1), fCorrectionCut(0.5),
47 fFirstBins(1), fLastBins(1), fDebug(0)
52 * @param o Object to copy from
54 AliFMDHistCollector(const AliFMDHistCollector& o)
56 fNCutBins(o.fNCutBins), fCorrectionCut(o.fCorrectionCut),
57 fFirstBins(o.fFirstBins), fLastBins(o.fLastBins), fDebug(o.fDebug)
63 virtual ~AliFMDHistCollector() {}
65 * Assignement operator
67 * @param o Object to assign from
69 * @return Reference to this object
71 AliFMDHistCollector& operator=(const AliFMDHistCollector&);
75 * @param vtxAxis Vertex axis
77 virtual void Init(const TAxis& vtxAxis);
81 * @param hists Cache of histograms
82 * @param vtxBin Vertex bin (1 based)
83 * @param out Output histogram
85 * @return true on successs
87 virtual Bool_t Collect(AliForwardUtil::Histos& hists, UShort_t vtxBin,
90 * Set the number of extra bins (beyond the secondary map border)
93 * @param n Number of bins
95 void SetNCutBins(UInt_t n=2) { fNCutBins = n; }
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
103 void SetCorrectionCut(Float_t cut=0.5) { fCorrectionCut = cut; }
105 * Set the debug level. The higher the value the more output
107 * @param dbg Debug level
109 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
113 * @param option Not used
115 void Print(Option_t* option="") const;
118 * Get the first and last eta bin to use for a given ring and vertex
122 * @param vtxBin Vertex bin (1 based)
123 * @param first On return, the first eta bin to use
124 * @param last On return, the last eta bin to use
126 virtual void GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxBin,
127 Int_t& first, Int_t& last) const;
129 * Get the first and last eta bin to use for a given ring and vertex
131 * @param idx Ring index as given by GetIdx
132 * @param vtxBin Vertex bin (1 based)
133 * @param first On return, the first eta bin to use
134 * @param last On return, the last eta bin to use
136 virtual void GetFirstAndLast(Int_t idx, UShort_t vtxBin,
137 Int_t& first, Int_t& last) const;
139 * Get the first eta bin to use for a given ring and vertex
143 * @param v vertex bin (1 based)
145 * @return First eta bin to use, or -1 in case of problems
147 Int_t GetFirst(UShort_t d, Char_t r, UShort_t v) const;
149 * Get the first eta bin to use for a given ring and vertex
151 * @param idx Ring index as given by GetIdx
152 * @param v vertex bin (1 based)
154 * @return First eta bin to use, or -1 in case of problems
156 Int_t GetFirst(Int_t idx, UShort_t v) const;
158 * Get the last eta bin to use for a given ring and vertex
162 * @param v vertex bin (1 based)
164 * @return Last eta bin to use, or -1 in case of problems
166 Int_t GetLast(UShort_t d, Char_t r, UShort_t v) const;
168 * Get the last eta bin to use for a given ring and vertex
170 * @param idx Ring index as given by GetIdx
171 * @param v vertex bin (1 based)
173 * @return Last eta bin to use, or -1 in case of problems
175 Int_t GetLast(Int_t idx, UShort_t v) const;
177 * Get the detector and ring from the ring index
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
183 void GetDetRing(Int_t idx, UShort_t& d, Char_t& r) const;
185 * Get the ring index from detector number and ring identifier
188 * @param r Ring identifier
190 * @return ring index or -1 in case of problems
192 Int_t GetIdx(UShort_t d, Char_t r) const;
194 * Get the possibly overlapping histogram of eta bin @a e in
200 * @param v Vertex bin (1 based)
202 * @return Overlapping histogram index or -1
204 Int_t GetOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const;
206 * Get the possibly overlapping histogram of eta bin @a e in
209 * @param i Ring index
211 * @param v Vertex bin (1 based)
213 * @return Overlapping histogram index or -1
215 Int_t GetOverlap(Int_t i, Int_t e, UShort_t v) const;
217 * Check if there's an overlapping histogram with this eta bin of
218 * the detector and ring
223 * @param v Vertex bin (1 based)
225 * @return True if there's an overlapping histogram
227 Bool_t HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const;
229 * Check if there's an overlapping histogram with this eta bin of
232 * @param i Ring index
234 * @param v Vertex bin
236 * @return True if there's an overlapping histogram
238 Bool_t HasOverlap(Int_t i, Int_t e, UShort_t v) const;
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
245 Int_t fDebug; // Debug level
247 ClassDef(AliFMDHistCollector,1); // Calculate Nch density
250 //____________________________________________________________________
252 AliFMDHistCollector::GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxbin,
253 Int_t& first, Int_t& last) const
255 GetFirstAndLast(GetIdx(d,r), vtxbin, first, last);
257 //____________________________________________________________________
259 AliFMDHistCollector::GetFirst(UShort_t d, Char_t r, UShort_t v) const
261 return GetFirst(GetIdx(d,r), v);
263 //____________________________________________________________________
265 AliFMDHistCollector::GetLast(UShort_t d, Char_t r, UShort_t v) const
267 return GetLast(GetIdx(d, r), v);
269 //____________________________________________________________________
271 AliFMDHistCollector::HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const
273 return GetOverlap(d,r,e,v) >= 0;
275 //____________________________________________________________________
277 AliFMDHistCollector::HasOverlap(Int_t i, Int_t e, UShort_t v) const
279 return GetOverlap(i,e,v) >= 0;