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(), fDebug(0)
38 * @param title Name of object
40 AliFMDHistCollector(const char* title)
41 : TNamed("fmdHistCollector", title),
42 fNCutBins(1), fCorrectionCut(0.5),
43 fFirstBins(1), fLastBins(1), fDebug(0)
48 * @param o Object to copy from
50 AliFMDHistCollector(const AliFMDHistCollector& o)
52 fNCutBins(o.fNCutBins), fCorrectionCut(o.fCorrectionCut),
53 fFirstBins(o.fFirstBins), fLastBins(o.fLastBins), fDebug(o.fDebug)
59 virtual ~AliFMDHistCollector() {}
61 * Assignement operator
63 * @return Reference to this object
65 AliFMDHistCollector& operator=(const AliFMDHistCollector&);
69 * @param vtxAxis Vertex axis
71 virtual void Init(const TAxis& vtxAxis);
75 * @param hists Cache of histograms
76 * @param vtxBin Vertex bin (1 based)
77 * @param out Output histogram
79 * @return true on successs
81 virtual Bool_t Collect(AliForwardUtil::Histos& hists, UShort_t vtxBin,
84 * Set the number of extra bins (beyond the secondary map border)
87 * @param n Number of bins
89 void SetNCutBins(UInt_t n=2) { fNCutBins = n; }
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
97 void SetCorrectionCut(Float_t cut=0.5) { fCorrectionCut = cut; }
99 * Set the debug level. The higher the value the more output
101 * @param dbg Debug level
103 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
107 * @param option Not used
109 void Print(Option_t* option="") const;
112 * Get the first and last eta bin to use for a given ring and vertex
116 * @param vtxBin Vertex bin (1 based)
117 * @param first On return, the first eta bin to use
118 * @param last On return, the last eta bin to use
120 virtual void GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxBin,
121 Int_t& first, Int_t& last) const;
123 * Get the first and last eta bin to use for a given ring and vertex
125 * @param idx Ring index as given by GetIdx
126 * @param vtxBin Vertex bin (1 based)
127 * @param first On return, the first eta bin to use
128 * @param last On return, the last eta bin to use
130 virtual void GetFirstAndLast(Int_t idx, UShort_t vtxBin,
131 Int_t& first, Int_t& last) const;
133 * Get the first eta bin to use for a given ring and vertex
137 * @param v vertex bin (1 based)
139 * @return First eta bin to use, or -1 in case of problems
141 Int_t GetFirst(UShort_t d, Char_t r, UShort_t v) const;
143 * Get the first eta bin to use for a given ring and vertex
145 * @param idx Ring index as given by GetIdx
146 * @param v vertex bin (1 based)
148 * @return First eta bin to use, or -1 in case of problems
150 Int_t GetFirst(Int_t idx, UShort_t v) const;
152 * Get the last eta bin to use for a given ring and vertex
156 * @param v vertex bin (1 based)
158 * @return Last eta bin to use, or -1 in case of problems
160 Int_t GetLast(UShort_t d, Char_t r, UShort_t v) const;
162 * Get the last eta bin to use for a given ring and vertex
164 * @param idx Ring index as given by GetIdx
165 * @param v vertex bin (1 based)
167 * @return Last eta bin to use, or -1 in case of problems
169 Int_t GetLast(Int_t idx, UShort_t v) const;
171 * Get the detector and ring from the ring index
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
177 void GetDetRing(Int_t idx, UShort_t& d, Char_t& r) const;
179 * Get the ring index from detector number and ring identifier
182 * @param r Ring identifier
184 * @return ring index or -1 in case of problems
186 Int_t GetIdx(UShort_t d, Char_t r) const;
188 * Get the possibly overlapping histogram of eta bin @a e in
194 * @param v Vertex bin (1 based)
196 * @return Overlapping histogram index or -1
198 Int_t GetOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const;
200 * Get the possibly overlapping histogram of eta bin @a e in
203 * @param i Ring index
205 * @param v Vertex bin (1 based)
207 * @return Overlapping histogram index or -1
209 Int_t GetOverlap(Int_t i, Int_t e, UShort_t v) const;
211 * Check if there's an overlapping histogram with this eta bin of
212 * the detector and ring
217 * @param v Vertex bin (1 based)
219 * @return True if there's an overlapping histogram
221 Bool_t HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const;
223 * Check if there's an overlapping histogram with this eta bin of
226 * @param i Ring index
228 * @param v Vertex bin
230 * @return True if there's an overlapping histogram
232 Bool_t HasOverlap(Int_t i, Int_t e, UShort_t v) const;
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
239 Int_t fDebug; // Debug level
241 ClassDef(AliFMDHistCollector,1); // Calculate Nch density
244 //____________________________________________________________________
246 AliFMDHistCollector::GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxbin,
247 Int_t& first, Int_t& last) const
249 GetFirstAndLast(GetIdx(d,r), vtxbin, first, last);
251 //____________________________________________________________________
253 AliFMDHistCollector::GetFirst(UShort_t d, Char_t r, UShort_t v) const
255 return GetFirst(GetIdx(d,r), v);
257 //____________________________________________________________________
259 AliFMDHistCollector::GetLast(UShort_t d, Char_t r, UShort_t v) const
261 return GetLast(GetIdx(d, r), v);
263 //____________________________________________________________________
265 AliFMDHistCollector::HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const
267 return GetOverlap(d,r,e,v) >= 0;
269 //____________________________________________________________________
271 AliFMDHistCollector::HasOverlap(Int_t i, Int_t e, UShort_t v) const
273 return GetOverlap(i,e,v) >= 0;