1 #ifndef ALIROOT_PWG2_FORWARD_ANALYSIS2_ALIFMDHISTCOLLECTOR_H
2 #define ALIROOT_PWG2_FORWARD_ANALYSIS2_ALIFMDHISTCOLLECTOR_H
6 #include "AliForwardUtil.h"
11 * This class collects the event histograms into single histograms,
12 * one for each ring in each vertex bin.
15 * - AliESDFMD object possibly corrected for sharing
18 * - 5 RingHistos objects - each with a number of vertex dependent
19 * 2D histograms of the inclusive charge particle density
21 * @par HistCollector used:
22 * - AliFMDAnaCalibBackgroundCorrection
24 * @ingroup pwg2_forward_analysis
26 class AliFMDHistCollector : public TNamed
33 : fNCutBins(0), fCorrectionCut(0), fFirstBins(), fLastBins()
38 * @param title Name of object
40 AliFMDHistCollector(const char* title)
41 : TNamed("fmdHistCollector", title),
42 fNCutBins(1), fCorrectionCut(0.5), fFirstBins(1), fLastBins(1)
47 * @param o Object to copy from
49 AliFMDHistCollector(const AliFMDHistCollector& o)
51 fNCutBins(o.fNCutBins), fCorrectionCut(o.fCorrectionCut),
52 fFirstBins(o.fFirstBins), fLastBins(o.fLastBins)
58 virtual ~AliFMDHistCollector() {}
60 * Assignement operator
62 * @return Reference to this object
64 AliFMDHistCollector& operator=(const AliFMDHistCollector&);
68 * @param vtxAxis Vertex axis
70 virtual void Init(const TAxis& vtxAxis);
74 * @param hists Cache of histograms
75 * @param vtxBin Vertex bin
76 * @param out Output histogram
78 * @return true on successs
80 virtual Bool_t Collect(AliForwardUtil::Histos& hists, Int_t vtxBin,
83 * Set the number of extra bins (beyond the secondary map border)
86 * @param n Number of bins
88 void SetNCutBins(UInt_t n=2) { fNCutBins = n; }
90 * Set the correction cut, that is, when bins in the secondary
91 * correction maps have a value lower than this cut, they are
92 * considered uncertain and not used
96 void SetCorrectionCut(Float_t cut=0.5) { fCorrectionCut = cut; }
99 * Get the first and last eta bin to use for a given ring and vertex
103 * @param vtxBin Vertex bin
104 * @param first On return, the first eta bin to use
105 * @param last On return, the last eta bin to use
107 virtual void GetFirstAndLast(UShort_t d, Char_t r, Int_t vtxBin,
108 Int_t& first, Int_t& last) const;
110 * Get the first and last eta bin to use for a given ring and vertex
112 * @param idx Ring index as given by GetIdx
113 * @param vtxBin Vertex bin
114 * @param first On return, the first eta bin to use
115 * @param last On return, the last eta bin to use
117 virtual void GetFirstAndLast(Int_t idx, Int_t vtxBin,
118 Int_t& first, Int_t& last) const;
120 * Get the first eta bin to use for a given ring and vertex
124 * @param v vertex bin
126 * @return First eta bin to use, or -1 in case of problems
128 Int_t GetFirst(UShort_t d, Char_t r, Int_t v) const;
130 * Get the first eta bin to use for a given ring and vertex
132 * @param idx Ring index as given by GetIdx
133 * @param v vertex bin
135 * @return First eta bin to use, or -1 in case of problems
137 Int_t GetFirst(Int_t idx, Int_t v) const;
139 * Get the last eta bin to use for a given ring and vertex
143 * @param v vertex bin
145 * @return Last eta bin to use, or -1 in case of problems
147 Int_t GetLast(UShort_t d, Char_t r, Int_t v) const;
149 * Get the last eta bin to use for a given ring and vertex
151 * @param idx Ring index as given by GetIdx
152 * @param v vertex bin
154 * @return Last eta bin to use, or -1 in case of problems
156 Int_t GetLast(Int_t idx, Int_t v) const;
158 * Get the detector and ring from the ring index
160 * @param idx Ring index
161 * @param d On return, the detector or 0 in case of errors
162 * @param r On return, the ring id or '0' in case of errors
164 void GetDetRing(Int_t idx, UShort_t& d, Char_t& r) const;
166 * Get the ring index from detector number and ring identifier
169 * @param r Ring identifier
171 * @return ring index or -1 in case of problems
173 Int_t GetIdx(UShort_t d, Char_t r) const;
175 * Get the possibly overlapping histogram of eta bin @a e in
181 * @param v Vertex bin
183 * @return Overlapping histogram index or -1
185 Int_t GetOverlap(UShort_t d, Char_t r, Int_t e, Int_t v) const;
187 * Get the possibly overlapping histogram of eta bin @a e in
190 * @param i Ring index
192 * @param v Vertex bin
194 * @return Overlapping histogram index or -1
196 Int_t GetOverlap(Int_t i, Int_t e, Int_t v) const;
198 * Check if there's an overlapping histogram with this eta bin of
199 * the detector and ring
204 * @param v Vertex bin
206 * @return True if there's an overlapping histogram
208 Bool_t HasOverlap(UShort_t d, Char_t r, Int_t e, Int_t v) const;
210 * Check if there's an overlapping histogram with this eta bin of
213 * @param i Ring index
215 * @param v Vertex bin
217 * @return True if there's an overlapping histogram
219 Bool_t HasOverlap(Int_t i, Int_t e, Int_t v) const;
222 Int_t fNCutBins; // Number of additional bins to cut away
223 Float_t fCorrectionCut; // Cut-off on secondary corrections
224 TArrayI fFirstBins; // Array of first eta bins
225 TArrayI fLastBins; // Array of last eta bins
227 ClassDef(AliFMDHistCollector,1); // Calculate Nch density
230 //____________________________________________________________________
232 AliFMDHistCollector::GetFirstAndLast(UShort_t d, Char_t r, Int_t vtxbin,
233 Int_t& first, Int_t& last) const
235 GetFirstAndLast(GetIdx(d,r), vtxbin, first, last);
237 //____________________________________________________________________
239 AliFMDHistCollector::GetFirst(UShort_t d, Char_t r, Int_t v) const
241 return GetFirst(GetIdx(d,r), v);
243 //____________________________________________________________________
245 AliFMDHistCollector::GetLast(UShort_t d, Char_t r, Int_t v) const
247 return GetLast(GetIdx(d, r), v);
249 //____________________________________________________________________
251 AliFMDHistCollector::HasOverlap(UShort_t d, Char_t r, Int_t e, Int_t v) const
253 return GetOverlap(d,r,e,v) >= 0;
255 //____________________________________________________________________
257 AliFMDHistCollector::HasOverlap(Int_t i, Int_t e, Int_t v) const
259 return GetOverlap(i,e,v) >= 0;