coverity 15108 fixed
[u/mrichter/AliRoot.git] / FMD / flow / AliFMDFlowBin.h
CommitLineData
39eefe19 1// -*- mode: C++ -*-
97e94238 2/* Copyright (C) 2007 Christian Holm Christensen <cholm@nbi.dk>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation; either version 2.1 of
7 * the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17 * USA
18 */
39eefe19 19/** @file
20 @brief Declaration of a Bin in a Flow "histogram" */
97e94238 21//____________________________________________________________________
22//
23// This contains an of class AliFMDFlowHarmonic and an object of
24// class AliFMDFlowEventPlane to calculate v_n and \Psi_k. It contain
25// two objects of class AliFMDFlowEventPlane to calculate the
26// sub-event event planes Psi_A, \Psi_B. It also contain 3 objects of
27// class AliFMDFlowResolution to calculate the event plane angle
28// resolution.
29//
30#ifndef ALIFMDFLOWBIN_H
31#define ALIFMDFLOWBIN_H
39eefe19 32#include <flow/AliFMDFlowEventPlane.h>
33#include <flow/AliFMDFlowHarmonic.h>
34#include <flow/AliFMDFlowResolution.h>
9b98d361 35#include <TH2D.h>
36#include <TH1D.h>
39eefe19 37#include <TObject.h>
38
824e71c1 39//Forward declaration
40class TBrowser;
41
85a60ebd 42/** @defgroup FMD_flow Flow code
43 @brief Code to do flow analysis.
44*/
39eefe19 45/** @defgroup c_binned Binned flow
46 @brief This group contains code for binned flow analysis. Two
47 kinds of "histograms" are defined - a 1 dimensional and a 2
48 dimensional set of binned objects of class AliFMDFlowBin.
49
85a60ebd 50 Objects of class hAliFMDFlowBin contains all the code needed to compute
39eefe19 51 flow in a given bin.
52
53 The class AliFMDFlowAxis encodes look-up of a object of class
54 AliFMDFlowBin in a flow "Histogram"
85a60ebd 55
56 @ingroup FMD_flow
39eefe19 57*/
58//______________________________________________________
59/** @class AliFMDFlowBin flow/AliFMDFlowBin.h <flow/AliFMDFlowBin.h>
60 @brief A bin of flow.
61
62 This contains an of class AliFMDFlowHarmonic and an object of
63 class AliFMDFlowEventPlane to calculate @f$ v_n@f$ and
64 @f$\Psi_k@f$. It contain two objects of class
65 AliFMDFlowEventPlane to calculate the sub-event event planes
66 @f$\Psi_A, \Psi_B@f$. It also contain 3 objects of class
67 AliFMDFlowResolution to calculate the event plane angle
68 resolution.
69
39eefe19 70*/
71class AliFMDFlowBin : public TObject
72{
73public:
74 /** Correction type */
75 enum CorType {
76 /** No correction */
9b98d361 77 kNone = 1,
39eefe19 78 /** Naive, using the formulas in Voloshins paper */
9b98d361 79 kNaive = 2,
39eefe19 80 /** STARs way */
9b98d361 81 kStar = 4,
39eefe19 82 /** The way used in the TDR */
9b98d361 83 kTdr = 8
39eefe19 84 };
9b98d361 85 /** Types of things to draw */
86 enum DrawVar {
87 /** The harmonic */
88 kHarmonic,
89 /** The resolution */
90 kResolution,
91 /** The statistics */
92 kCounts
93 };
94 /** Default Ctor - do not use */
6ce810fc 95 AliFMDFlowBin()
96 : fPsi(),
97 fPsiA(),
98 fPsiB(),
99 fRes(),
100 fResStar(),
101 fResTdr(),
102 fHarmonic(),
103 fSplit(),
104 fPhi(),
105 fNA(0),
106 fNB(0),
107 fN(0),
108 fAB()
109 {}
97e94238 110 /** Constructor
111 @param order Order of harmonic.
112 @param k Factor of event plane order=k * m */
9b98d361 113 AliFMDFlowBin(UShort_t order, UShort_t k=1);
97e94238 114 /** Copy constructor
115 @param o Object top copy from */
116 AliFMDFlowBin(const AliFMDFlowBin& o);
117 /** Assignment operator
118 @param o Object to assign from
119 @return Reference to this object */
120 AliFMDFlowBin& operator=(const AliFMDFlowBin& o);
121
39eefe19 122 /** Destructor */
123 virtual ~AliFMDFlowBin() {}
9b98d361 124
125 /** @{
126 @name Processing */
39eefe19 127 /** Should be called at the start of an event */
128 virtual void Begin();
129 /** Called to add a contribution to the event plane
130 @param phi The angle @f$ \varphi \in[0,2\pi]@f$
131 @param w Weight
132 @param a If true, add to sub-event A, otherwise to sub-event
133 B. */
134 virtual void AddToEventPlane(Double_t phi, Double_t w=1, Bool_t a=kTRUE);
135 /** Called to add a contribution to the harmonic.
136 @param phi The angle @f$ \varphi \in[0,2\pi]@f$
6ce810fc 137 @param wp Weight of @a phi (only used in the calculation of
9b98d361 138 the event plane).
139 @param wh Weight if the @f$ \varphi@f$ observation */
140 virtual void AddToHarmonic(Double_t phi, Double_t wp=1, Double_t wh=1);
39eefe19 141 /** Should be called at the end of an event */
142 virtual void End();
143 /** Analyse events
9b98d361 144 @param n Size of @a phis and possibly @a ws
39eefe19 145 @param phis @f$ (\varphi_i, \ldots, \varphi_n)@f$
9b98d361 146 @param wp Weights for event plane (optional)
147 @param wh Weights for harmonic (optional - can be the same as @a ws) */
148 virtual void Event(UInt_t n, Double_t* phis, Double_t* wp=0, Double_t* wh=0);
39eefe19 149 /** Finish run */
150 virtual void Finish();
9b98d361 151 /** @} */
152
153 /** @{
154 @name Orders */
155 /** Get the harmonic order
156 @return The harmonic order */
157 virtual UShort_t Order() const { return fHarmonic.Order(); }
158 /** Get the harmonic order
159 @return The harmonic order */
160 virtual UShort_t PsiOrder() const { return fPsi.Order(); }
161 /** @} */
162
163 /** @{
164 @name Values */
39eefe19 165 /** Get the value in this bin
166 @param t Which type of correction
167 @return the value of the harmonic */
97e94238 168 virtual Double_t Value(CorType t=kTdr) const;
39eefe19 169 /** Get the value in this bin
170 @param t Which type of correction
171 @return the error on the value of the harmonic */
97e94238 172 virtual Double_t EValue(CorType t=kTdr) const;
39eefe19 173 /** Get the value in this bin
174 @param e2 On return, the square error.
175 @param t Which type of correction
176 @return the value of the harmonic */
97e94238 177 virtual Double_t Value(Double_t& e2, CorType t=kTdr) const;
39eefe19 178 /** Get the value in this bin
179 @param e2 On return, the square error.
180 @param t Which type of correction
97e94238 181 @return the value of the event plane correction */
182 virtual Double_t Correction(Double_t& e2, CorType t=kTdr) const;
9b98d361 183 /** Get the number of counts used in this.
184 @return The number of counts used in this bin */
185 virtual ULong_t Counts() const;
186 /** @} */
187
188 /** @{
189 @name Utility */
39eefe19 190 /** Print summary to standard output */
824e71c1 191 virtual void Print(Option_t* option="") const; //*MENU*
192 /** Return true */
193 virtual Bool_t IsFolder() const { return kTRUE; }
194 /** Browse this item */
195 virtual void Browse(TBrowser* b);
39eefe19 196 /** Get the event plane angle */
197 virtual Double_t Psi() const { return fPsi.Psi(); }
198 /** Get the sub-event A plane angle */
199 virtual Double_t PsiA() const { return fPsiA.Psi(); }
200 /** Get the sub-event B plane angle */
201 virtual Double_t PsiB() const { return fPsiB.Psi(); }
9b98d361 202 /** @} */
39eefe19 203
9b98d361 204 /** @{
205 @name histograms */
206 /** @return Split histogram */
207 const TH2& SplitHistogram() const { return fSplit; }
208 /** @return Phi histogram */
209 const TH1& PhiHistogram() const { return fPhi; }
210 /** @} */
39eefe19 211protected:
212 /** Major event plane */
97e94238 213 AliFMDFlowEventPlane fPsi; // Major event plane
39eefe19 214 /** Sub-event A event plane */
97e94238 215 AliFMDFlowEventPlane fPsiA; // Sub-event A event plane
39eefe19 216 /** Sub-event B event plane */
97e94238 217 AliFMDFlowEventPlane fPsiB; // Sub-event B event plane
39eefe19 218 /** Resolution */
97e94238 219 AliFMDFlowResolution fRes; // Resolution
39eefe19 220 /** Resolution */
97e94238 221 AliFMDFlowResolutionStar fResStar; // Resolution
39eefe19 222 /** Resolution */
97e94238 223 AliFMDFlowResolutionTDR fResTdr; // Resolution
39eefe19 224 /** The harmonic */
97e94238 225 AliFMDFlowHarmonic fHarmonic; // Harmonic
9b98d361 226 /** Histogram of the relative split between A and B */
227 TH2D fSplit;
228 /** Histogram of relative phi's */
229 TH1D fPhi;
230 /** Counter of number of observations in sub-A */
231 ULong_t fNA;
232 /** Counter of number of observations in sub-B */
233 ULong_t fNB;
234 /** Counter of number of observations */
235 ULong_t fN;
236 /** Psi from A vs from B */
237 TH2D fAB;
238
39eefe19 239 /** Define for ROOT I/O */
97e94238 240 ClassDef(AliFMDFlowBin,1); // A flow analysis
39eefe19 241};
242
243
244#endif
245//
246// EOF
247//