]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/flow/AliFMDFlowResolution.h
Misalignment-related bug fixed
[u/mrichter/AliRoot.git] / FMD / flow / AliFMDFlowResolution.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 an Resolution class */
97e94238 21//____________________________________________________________________
22//
23// Calculate the event plane resolution.
24// Input is the observed phis.
25// There's a number of implementations of this.
26#ifndef ALIFMDFLOWRESOLUTION_H
27#define ALIFMDFLOWRESOLUTION_H
39eefe19 28#include <flow/AliFMDFlowStat.h>
29
30//______________________________________________________
31/** @class AliFMDFlowResolution flow/AliFMDFlowResolution.h <flow/AliFMDFlowResolution.h>
32 @brief Class to calculate the event plane resolution based on two
33 sub-events
34 @ingroup a_basic
35
36 This class calculates the event plane resolution based on the
37 basic formulas given in Phys. Rev. @b C58, 1671. That is, the
38 resolution is given by
39 @f[
40 R_{k} = \langle\cos(km(\Psi_m-\Psi_R))\rangle
41 @f]
42 where @f$ \Psi_R@f$ is the unknown @e true event plane angle, and
43 @f$ n = km@f$
44
45 Using two random sub-events, @f$ A, B@f$ we get that
46 @f[
47 \langle\cos(n(\Psi^A_m-\Psi^B_m))\rangle =
48 \langle\cos(n(\Psi^A_m-\Psi_R))\rangle
49 \langle\cos(n(\Psi^B_m-\Psi_R))\rangle
50 @f]
51 If the sub-events are of equal size, and randomly chosen, then we
52 get that
53 @f[
54 \langle\cos(n(\Psi^A_m-\Psi_R))\rangle =
55 \sqrt{\langle\cos(n(\Psi^A_m-\Psi^B_m))}
56 @f]
57 and it follows that
58 @f{eqnarray*}
59 \langle\cos(km(\Psi_m-\Psi_R))\rangle & = &
60 \sqrt{2}\langle\cos(n(\Psi^A_m-\Psi_R))\rangle\\
61 \sqrt{2}\sqrt{\langle\cos(n(\Psi^A_m-\Psi^B_m))}
62 @f}
63
64 Hence, the event-plane resolution is simply the square root of the
65 scaled average distance between the two sub-events, multiplied by
66 @f$ \sqrt{s}@f$
67
68 The error is therefor @f$ \sqrt{s}@f$ times the variance of the
69 cosine of the distance between the two sub-events.
70*/
71class AliFMDFlowResolution : public AliFMDFlowStat
72{
73public:
74 /** Constructor
75 @param n Harmonic order */
97e94238 76 AliFMDFlowResolution(UShort_t n=0) : fOrder(n) {}
39eefe19 77 /** Destructor */
78 virtual ~AliFMDFlowResolution() {}
97e94238 79 /** Copy constructor
80 @param o Object to copy from */
81 AliFMDFlowResolution(const AliFMDFlowResolution& o);
82 /** Assignment operator
83 @param o Object to copy from */
84 AliFMDFlowResolution& operator=(const AliFMDFlowResolution& o);
39eefe19 85 /** add data point
86 @param psiA A sub-event plane angle @f$ \Psi_A \in[0,2\pi]@f$
87 @param psiB B sub-event plane angle @f$ \Psi_B \in[0,2\pi]@f$ */
88 virtual void Add(Double_t psiA, Double_t psiB);
89 /** Get the correction for harmonic strength of order @a k
90 @param k The harminic strenght order to get the correction for
91 @param e2 The square error on the correction
92 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
93 virtual Double_t Correction(UShort_t k, Double_t& e2) const;
94 /** Get the correction for harmonic strength of order @a k
95 @param k The harminic strenght order to get the correction for
96 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
97 virtual Double_t Correction(UShort_t k) const;
98 /** Get the harmnic order */
99 UShort_t Order() const { return fOrder; }
824e71c1 100 /** Draw this corrrection function
101 @param option Options passed to drawing */
102 virtual void Draw(Option_t* option=""); //*MENU*
39eefe19 103protected:
104 /** Order */
97e94238 105 UShort_t fOrder; // Order
39eefe19 106 /** Define for ROOT I/O */
107 ClassDef(AliFMDFlowResolution,1);
108};
109
110//______________________________________________________
111/**
112 @ingroup a_basic
113 The event plane angle resolution function is
114 @f[
115 R_k(\chi) = \frac{\pi} \chi e^{-\chi^2/4}\left(
116 I_{\frac{k-1}2}(\chi^2/4) + I_{\frac{k+1}2}(\chi^2/4)\right)
117 @f]
118 Where @f$ I_n(x)@f$ is the modified Bessel function of the first
119 kind. Identifying
120 @f[
121 y = \chi^2/4\quad C=\frac{\sqrt{\pi}e^{-y}}{2\sqrt{2}}
122 @f]
123 and the short hands @f$ f2(y) = I_{\frac{k-1}2}@f$ and @f$ f3(y) =
124 I_{\frac{k+1}2}(y)@f$ we can write this more compact as
125 @f[
126 R_k(y) = C y (f2(y) + f3(y))
127 @f]
128 The derivative of the resolution function is
129 @f[
130 R_k'(y) = \frac{C}{2}\left[4\sqrt{y}\left(f2'(y)-f3'(y)\right)
131 - (4 y - 2)\left(f2(y) + f3(y)\right)\right]
132 @f]
133 Since
134 @f[
135 I_\nu'(x) = I_{\nu-1}(x) - \frac{\nu}{x} I_\nu(x)\quad,
136 @f]
137 and setting @f$ f1(y) = I_{\frac{k-3}2}(y)@f$, we get
138 @f[
139 R_k'(y) = \frac{C}{2}\left[4y f1(y) + (4-2k) f2(y) - (4y+2k)
140 f3(y)\right]
141 @f]
142
143 In this class, the argument @f$ \chi@f$ is estimated by finding
144 the minima of @f$ R_k(\chi)@f$ near the average of
145 @f$\cos(n(\Psi_A-\Psi_B))@f$. The error @f$ \delta\chi@f$ is
146 estimated as the largest step size in the minimisation.
147
148 The total error on the correction is then
149 @f[
150 \delta R_k = R_k'(\chi) \delta\chi
151 @f]
152*/
153
154class AliFMDFlowResolutionStar : public AliFMDFlowResolution
155{
156public:
157 /** Constructor
158 @param n Harmonic order */
97e94238 159 AliFMDFlowResolutionStar(UShort_t n=0) : AliFMDFlowResolution(n) {}
39eefe19 160 /** Destructor */
97e94238 161 virtual ~AliFMDFlowResolutionStar() {}
39eefe19 162 /** Get the correction for harmonic strength of order @a k
163 @param k The harminic strenght order to get the correction for
164 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
165 virtual Double_t Correction(UShort_t k) const;
166
167 /** Get the correction for harmonic strength of order @a k
168 @param k The harminic strenght order to get the correction for
169 @param e2 The square error on the correction
170 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
171 virtual Double_t Correction(UShort_t k, Double_t& e2) const;
172 /** Get @f$ \chi@f$
173 @param res First shot at the resolution.
174 @param k Order
175 @param delta On return, the last step size in @f$ \chi@f$ -
176 which is taken to be @f$ \delta\chi@f$
177 @return @f$\chi@f$ */
178 virtual Double_t Chi(Double_t res, UShort_t k, Double_t& delta) const;
824e71c1 179 /** Draw this corrrection function
180 @param option Options passed to drawing */
181 virtual void Draw(Option_t* option=""); //*MENU*
39eefe19 182protected:
183 /** Calculate resolution
184 @param chi @f$ \chi@f$
185 @param k Order factor
186 @param dr On return, the derivative of @f$ R(\chi)@f$
187 @return
188 @f[
189 \frac{\sqrt{\pi/2}}{2}\chi e^{-\chi^2/4}
190 (I_{\frac{(k-1)}{2}}(\chi^2/4)+ I_{\frac{(k+1)}{2}}(\chi^2/4))
191 @f] */
192 Double_t Res(Double_t chi, UShort_t k, Double_t& dr) const;
193 /** Define for ROOT I/O */
194 ClassDef(AliFMDFlowResolutionStar,1);
195};
196
197//______________________________________________________
198/**
199 @ingroup a_basic
200
201 For more on the event plane angle resolution function, please
202 refer to the class description of ResolutionStar.
203
204 In this class @f$ \chi@f$ is calculated from the ratio @f$ k/N@f$
205 of events with @f$ |\Psi_A - \Psi_B| > \pi/2@f$ to the total
206 number of events.
207
208 The pre-print @c nucl-ex/9711003v2 gives the formula
209 @f[
210 \frac{k}{N} = \frac{e^{-\chi^2/2}}{2}
211 @f]
212 for @f$ \chi@f$. Note, that this differs from the @f$ \chi@f$
213 used in ResolutionStar by a factor of @f$ 1/sqrt{2}@f$.
214
215 We can isolate @f$ \chi = \mp\sqrt{-2\log(2k/N)}@f$ from the
216 equation above.
217
218 Since @f$ r=k/N@f$ is obviously a efficiency-like ratio, we get
219 that error @f$ \delta r@f$ is given by Binomial errors
220 @f[
221 \delta r = \sqrt{r\frac{1 - r}{N}}\quad.
222 @f]
223 The total error @f$ \delta\chi@f$ then becomes
224 @f[
225 \delta^2\chi = \left(\frac{d\chi}{dr}\right)^2 \delta^2r
226 = \frac{r - 1}{4 k log(2 r)}
227 @f]
228
229 The total error on the correction is, as in
230 ResolutionStar, then given by
231 @f[
232 \delta R_k = R_k'(\chi) \delta\chi
233 @f]
234*/
235class AliFMDFlowResolutionTDR : public AliFMDFlowResolution
236{
237public:
238 /** Constructor
239 @param n Harmonic order */
240 AliFMDFlowResolutionTDR(UShort_t n)
241 : AliFMDFlowResolution(n), fLarge(0) {}
242 /** DTOR */
243 ~AliFMDFlowResolutionTDR() {}
97e94238 244 /** Copy constructor
245 @param o Object to copy from */
246 AliFMDFlowResolutionTDR(const AliFMDFlowResolutionTDR& o);
247 /** Assignment operator
248 @param o Object to assign from
249 @return reference to this */
250 AliFMDFlowResolutionTDR& operator=(const AliFMDFlowResolutionTDR& o);
824e71c1 251 virtual void Clear(Option_t* option="");
39eefe19 252 /** add a data point */
97e94238 253 virtual void Add(Double_t psiA, Double_t psiB);
39eefe19 254 /** Get the correction for harmonic strength of order @a k
255 @param k The harminic strenght order to get the correction for
256 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
257 virtual Double_t Correction(UShort_t k) const;
258 /** Get the correction for harmonic strength of order @a k
259 @param e2 The square error on the correction
260 @param k The harminic strenght order to get the correction for
261 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
262 virtual Double_t Correction(UShort_t k, Double_t& e2) const;
263 /** Get @f$ \chi^2/2@f$
264 @param e2 The square error on the correction
265 @return @f$ \chi^2/2@f$ */
824e71c1 266 virtual Double_t Chi2Over2(Double_t r, Double_t& e2) const;
267 /** Draw this corrrection function
268 @param option Options passed to drawing */
269 virtual void Draw(Option_t* option=""); //*MENU*
39eefe19 270protected:
824e71c1 271 /** Calculate resolution
272 @param k Order factor
273 @param y @f$ \chi^2/2@f$
274 @param echi @f$\delta\chi@f$
275 @param dr On return, the derivative of @f$ R(\chi)@f$
276 @return
277 @f[
278 \frac{\sqrt{\pi/2}}{2}\chi e^{-\chi^2/2}
279 (I_{\frac{(k-1)}{2}}(\chi^2/2)+ I_{\frac{(k+1)}{2}}(\chi^2/2))
280 @f] */
281 Double_t Res(UShort_t k, Double_t y, Double_t echi2, Double_t& e2) const;
39eefe19 282 /** Number of events with large diviation */
97e94238 283 ULong_t fLarge; // Number of events with large angle
39eefe19 284 /** Define for ROOT I/O */
285 ClassDef(AliFMDFlowResolutionTDR,1);
286};
287
288
289#endif
290//
291// EOF
292//