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
49 * @param title Name of object
51 AliFMDHistCollector(const char* title)
52 : TNamed("fmdHistCollector", title),
65 * @param o Object to copy from
67 AliFMDHistCollector(const AliFMDHistCollector& o)
69 fNCutBins(o.fNCutBins),
70 fCorrectionCut(o.fCorrectionCut),
71 fFirstBins(o.fFirstBins),
72 fLastBins(o.fLastBins),
75 fSumRings(o.fSumRings),
76 fCoverage(o.fCoverage)
82 virtual ~AliFMDHistCollector();
84 * Assignement operator
86 * @param o Object to assign from
88 * @return Reference to this object
90 AliFMDHistCollector& operator=(const AliFMDHistCollector&);
94 * @param vtxAxis Vertex axis
96 virtual void Init(const TAxis& vtxAxis,
97 const TAxis& etaAxis);
101 * @param hists Cache of histograms
102 * @param vtxBin Vertex bin (1 based)
103 * @param out Output histogram
105 * @return true on successs
107 virtual Bool_t Collect(AliForwardUtil::Histos& hists, UShort_t vtxBin,
110 * Output diagnostic histograms to directory
112 * @param dir List to write in
114 virtual void DefineOutput(TList* dir);
116 * Set the number of extra bins (beyond the secondary map border)
119 * @param n Number of bins
121 void SetNCutBins(UInt_t n=2) { fNCutBins = n; }
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
129 void SetCorrectionCut(Float_t cut=0.5) { fCorrectionCut = cut; }
131 * Set the debug level. The higher the value the more output
133 * @param dbg Debug level
135 void SetDebug(Int_t dbg=1) { fDebug = dbg; }
139 * @param option Not used
141 void Print(Option_t* option="") const;
144 * Get the first and last eta bin to use for a given ring and vertex
148 * @param vtxBin Vertex bin (1 based)
149 * @param first On return, the first eta bin to use
150 * @param last On return, the last eta bin to use
152 virtual void GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxBin,
153 Int_t& first, Int_t& last) const;
155 * Get the first and last eta bin to use for a given ring and vertex
157 * @param idx Ring index as given by GetIdx
158 * @param vtxBin Vertex bin (1 based)
159 * @param first On return, the first eta bin to use
160 * @param last On return, the last eta bin to use
162 virtual void GetFirstAndLast(Int_t idx, UShort_t vtxBin,
163 Int_t& first, Int_t& last) const;
165 * Get the first eta bin to use for a given ring and vertex
169 * @param v vertex bin (1 based)
171 * @return First eta bin to use, or -1 in case of problems
173 Int_t GetFirst(UShort_t d, Char_t r, UShort_t v) const;
175 * Get the first eta bin to use for a given ring and vertex
177 * @param idx Ring index as given by GetIdx
178 * @param v vertex bin (1 based)
180 * @return First eta bin to use, or -1 in case of problems
182 Int_t GetFirst(Int_t idx, UShort_t v) const;
184 * Get the last eta bin to use for a given ring and vertex
188 * @param v vertex bin (1 based)
190 * @return Last eta bin to use, or -1 in case of problems
192 Int_t GetLast(UShort_t d, Char_t r, UShort_t v) const;
194 * Get the last eta bin to use for a given ring and vertex
196 * @param idx Ring index as given by GetIdx
197 * @param v vertex bin (1 based)
199 * @return Last eta bin to use, or -1 in case of problems
201 Int_t GetLast(Int_t idx, UShort_t v) const;
203 * Get the detector and ring from the ring index
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
209 void GetDetRing(Int_t idx, UShort_t& d, Char_t& r) const;
211 * Get the ring index from detector number and ring identifier
214 * @param r Ring identifier
216 * @return ring index or -1 in case of problems
218 Int_t GetIdx(UShort_t d, Char_t r) const;
220 * Get the possibly overlapping histogram of eta bin @a e in
226 * @param v Vertex bin (1 based)
228 * @return Overlapping histogram index or -1
230 Int_t GetOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const;
232 * Get the possibly overlapping histogram of eta bin @a e in
235 * @param i Ring index
237 * @param v Vertex bin (1 based)
239 * @return Overlapping histogram index or -1
241 Int_t GetOverlap(Int_t i, Int_t e, UShort_t v) const;
243 * Check if there's an overlapping histogram with this eta bin of
244 * the detector and ring
249 * @param v Vertex bin (1 based)
251 * @return True if there's an overlapping histogram
253 Bool_t HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const;
255 * Check if there's an overlapping histogram with this eta bin of
258 * @param i Ring index
260 * @param v Vertex bin
262 * @return True if there's an overlapping histogram
264 Bool_t HasOverlap(Int_t i, Int_t e, UShort_t v) const;
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
271 Int_t fDebug; // Debug level
272 TList* fList; // Output list
273 TH2D* fSumRings; // Sum per ring (on y-axis)
274 TH2D* fCoverage; // Sum per ring (on y-axis)
276 ClassDef(AliFMDHistCollector,1); // Calculate Nch density
279 //____________________________________________________________________
281 AliFMDHistCollector::GetFirstAndLast(UShort_t d, Char_t r, UShort_t vtxbin,
282 Int_t& first, Int_t& last) const
284 GetFirstAndLast(GetIdx(d,r), vtxbin, first, last);
286 //____________________________________________________________________
288 AliFMDHistCollector::GetFirst(UShort_t d, Char_t r, UShort_t v) const
290 return GetFirst(GetIdx(d,r), v);
292 //____________________________________________________________________
294 AliFMDHistCollector::GetLast(UShort_t d, Char_t r, UShort_t v) const
296 return GetLast(GetIdx(d, r), v);
298 //____________________________________________________________________
300 AliFMDHistCollector::HasOverlap(UShort_t d, Char_t r, Int_t e, UShort_t v) const
302 return GetOverlap(d,r,e,v) >= 0;
304 //____________________________________________________________________
306 AliFMDHistCollector::HasOverlap(Int_t i, Int_t e, UShort_t v) const
308 return GetOverlap(i,e,v) >= 0;