2 /* Copyright (C) 2007 Christian Holm Christensen <cholm@nbi.dk>
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.
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.
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
20 @brief Declaration of an Resolution class */
21 //____________________________________________________________________
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
28 #include <flow/AliFMDFlowStat.h>
33 //______________________________________________________
34 /** @class AliFMDFlowResolution flow/AliFMDFlowResolution.h <flow/AliFMDFlowResolution.h>
35 @brief Class to calculate the event plane resolution based on two
39 This class calculates the event plane resolution based on the
40 basic formulas given in Phys. Rev. @b C58, 1671. That is, the
41 resolution is given by
43 R_{k} = \langle\cos(km(\Psi_m-\Psi_R))\rangle
45 where @f$ \Psi_R@f$ is the unknown @e true event plane angle, and
48 Using two random sub-events, @f$ A, B@f$ we get that
50 \langle\cos(n(\Psi^A_m-\Psi^B_m))\rangle =
51 \langle\cos(n(\Psi^A_m-\Psi_R))\rangle
52 \langle\cos(n(\Psi^B_m-\Psi_R))\rangle
54 If the sub-events are of equal size, and randomly chosen, then we
57 \langle\cos(n(\Psi^A_m-\Psi_R))\rangle =
58 \sqrt{\langle\cos(n(\Psi^A_m-\Psi^B_m))}
62 \langle\cos(km(\Psi_m-\Psi_R))\rangle & = &
63 \sqrt{2}\langle\cos(n(\Psi^A_m-\Psi_R))\rangle\\
64 \sqrt{2}\sqrt{\langle\cos(n(\Psi^A_m-\Psi^B_m))}
67 Hence, the event-plane resolution is simply the square root of the
68 scaled average distance between the two sub-events, multiplied by
71 The error is therefor @f$ \sqrt{s}@f$ times the variance of the
72 cosine of the distance between the two sub-events.
74 class AliFMDFlowResolution : public AliFMDFlowStat
78 @param n Harmonic order */
79 AliFMDFlowResolution(UShort_t n=0);
81 virtual ~AliFMDFlowResolution() {}
83 @param o Object to copy from */
84 AliFMDFlowResolution(const AliFMDFlowResolution& o);
85 /** Assignment operator
86 @param o Object to copy from */
87 AliFMDFlowResolution& operator=(const AliFMDFlowResolution& o);
92 @param psiA A sub-event plane angle @f$ \Psi_A \in[0,2\pi]@f$
93 @param psiB B sub-event plane angle @f$ \Psi_B \in[0,2\pi]@f$ */
94 virtual void Add(Double_t psiA, Double_t psiB);
99 /** Get the correction for harmonic strength of order @a k
100 @param k The harminic strenght order to get the correction for
101 @param e2 The square error on the correction
102 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
103 virtual Double_t Correction(UShort_t k, Double_t& e2) const;
104 /** Get the correction for harmonic strength of order @a k
105 @param k The harminic strenght order to get the correction for
106 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
107 virtual Double_t Correction(UShort_t k) const;
108 /** Get the harmnic order */
109 UShort_t Order() const { return fOrder; }
114 /** Draw this corrrection function
115 @param option Options passed to drawing */
116 virtual void Draw(Option_t* option=""); //*MENU*
117 /** This is a folder */
118 Bool_t IsFolder() const { return kTRUE; }
119 /** Look through this object */
120 virtual void Browse(TBrowser* b);
125 /** @return Contrib histogram */
126 const TH1& ContribHistogram() const { return fContrib; }
130 UShort_t fOrder; // Order
133 /** Define for ROOT I/O */
134 ClassDef(AliFMDFlowResolution,1);
137 //______________________________________________________
140 The event plane angle resolution function is
142 R_k(\chi) = \frac{\pi} \chi e^{-\chi^2/4}\left(
143 I_{\frac{k-1}2}(\chi^2/4) + I_{\frac{k+1}2}(\chi^2/4)\right)
145 Where @f$ I_n(x)@f$ is the modified Bessel function of the first
148 y = \chi^2/4\quad C=\frac{\sqrt{\pi}e^{-y}}{2\sqrt{2}}
150 and the short hands @f$ f2(y) = I_{\frac{k-1}2}@f$ and @f$ f3(y) =
151 I_{\frac{k+1}2}(y)@f$ we can write this more compact as
153 R_k(y) = C y (f2(y) + f3(y))
155 The derivative of the resolution function is
157 R_k'(y) = \frac{C}{2}\left[4\sqrt{y}\left(f2'(y)-f3'(y)\right)
158 - (4 y - 2)\left(f2(y) + f3(y)\right)\right]
162 I_\nu'(x) = I_{\nu-1}(x) - \frac{\nu}{x} I_\nu(x)\quad,
164 and setting @f$ f1(y) = I_{\frac{k-3}2}(y)@f$, we get
166 R_k'(y) = \frac{C}{2}\left[4y f1(y) + (4-2k) f2(y) - (4y+2k)
170 In this class, the argument @f$ \chi@f$ is estimated by finding
171 the minima of @f$ R_k(\chi)@f$ near the average of
172 @f$\cos(n(\Psi_A-\Psi_B))@f$. The error @f$ \delta\chi@f$ is
173 estimated as the largest step size in the minimisation.
175 The total error on the correction is then
177 \delta R_k = R_k'(\chi) \delta\chi
181 class AliFMDFlowResolutionStar : public AliFMDFlowResolution
185 @param n Harmonic order */
186 AliFMDFlowResolutionStar(UShort_t n=0) : AliFMDFlowResolution(n) {}
188 virtual ~AliFMDFlowResolutionStar() {}
192 /** Get the correction for harmonic strength of order @a k
193 @param k The harminic strenght order to get the correction for
194 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
195 virtual Double_t Correction(UShort_t k) const;
196 /** Get the correction for harmonic strength of order @a k
197 @param k The harminic strenght order to get the correction for
198 @param e2 The square error on the correction
199 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
200 virtual Double_t Correction(UShort_t k, Double_t& e2) const;
202 @param res First shot at the resolution.
204 @param delta On return, the last step size in @f$ \chi@f$ -
205 which is taken to be @f$ \delta\chi@f$
206 @return @f$\chi@f$ */
207 virtual Double_t Chi(Double_t res, UShort_t k, Double_t& delta) const;
212 /** Draw this corrrection function
213 @param option Options passed to drawing */
214 virtual void Draw(Option_t* option=""); //*MENU*
217 /** Calculate resolution
218 @param chi @f$ \chi@f$
219 @param k Order factor
220 @param dr On return, the derivative of @f$ R(\chi)@f$
223 \frac{\sqrt{\pi/2}}{2}\chi e^{-\chi^2/4}
224 (I_{\frac{(k-1)}{2}}(\chi^2/4)+ I_{\frac{(k+1)}{2}}(\chi^2/4))
226 Double_t Res(Double_t chi, UShort_t k, Double_t& dr) const;
227 /** Define for ROOT I/O */
228 ClassDef(AliFMDFlowResolutionStar,1);
231 //______________________________________________________
235 For more on the event plane angle resolution function, please
236 refer to the class description of ResolutionStar.
238 In this class @f$ \chi@f$ is calculated from the ratio @f$ k/N@f$
239 of events with @f$ |\Psi_A - \Psi_B| > \pi/2@f$ to the total
242 The pre-print @c nucl-ex/9711003v2 gives the formula
244 \frac{k}{N} = \frac{e^{-\chi^2/2}}{2}
246 for @f$ \chi@f$. Note, that this differs from the @f$ \chi@f$
247 used in ResolutionStar by a factor of @f$ 1/sqrt{2}@f$.
249 We can isolate @f$ \chi = \mp\sqrt{-2\log(2k/N)}@f$ from the
252 Since @f$ r=k/N@f$ is obviously a efficiency-like ratio, we get
253 that error @f$ \delta r@f$ is given by Binomial errors
255 \delta r = \sqrt{r\frac{1 - r}{N}}\quad.
257 The total error @f$ \delta\chi@f$ then becomes
259 \delta^2\chi = \left(\frac{d\chi}{dr}\right)^2 \delta^2r
260 = \frac{r - 1}{4 k log(2 r)}
263 The total error on the correction is, as in
264 ResolutionStar, then given by
266 \delta R_k = R_k'(\chi) \delta\chi
269 class AliFMDFlowResolutionTDR : public AliFMDFlowResolution
273 @param n Harmonic order */
274 AliFMDFlowResolutionTDR(UShort_t n=0);
276 ~AliFMDFlowResolutionTDR() {}
278 @param o Object to copy from */
279 AliFMDFlowResolutionTDR(const AliFMDFlowResolutionTDR& o);
280 /** Assignment operator
281 @param o Object to assign from
282 @return reference to this */
283 AliFMDFlowResolutionTDR& operator=(const AliFMDFlowResolutionTDR& o);
287 virtual void Clear(Option_t* option="");
288 /** add a data point */
289 virtual void Add(Double_t psiA, Double_t psiB);
294 /** Get the correction for harmonic strength of order @a k
295 @param k The harminic strenght order to get the correction for
296 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
297 virtual Double_t Correction(UShort_t k) const;
298 /** Get the correction for harmonic strength of order @a k
299 @param e2 The square error on the correction
300 @param k The harminic strenght order to get the correction for
301 @return @f$ \langle\cos(n(\psi_n - \psi_R))\rangle@f$ */
302 virtual Double_t Correction(UShort_t k, Double_t& e2) const;
303 /** Get @f$ \chi^2/2@f$
304 @param e2 The square error on the correction
305 @return @f$ \chi^2/2@f$ */
306 virtual Double_t Chi2Over2(Double_t r, Double_t& e2) const;
311 /** Draw this corrrection function
312 @param option Options passed to drawing */
313 virtual void Draw(Option_t* option=""); //*MENU*
314 /** Look through this object */
315 virtual void Browse(TBrowser* b);
320 /** @return NK histogram */
321 const TH1& NKHistogram() const { return fNK; }
324 /** Calculate resolution
325 @param k Order factor
326 @param y @f$ \chi^2/2@f$
327 @param echi @f$\delta\chi@f$
328 @param dr On return, the derivative of @f$ R(\chi)@f$
331 \frac{\sqrt{\pi/2}}{2}\chi e^{-\chi^2/2}
332 (I_{\frac{(k-1)}{2}}(\chi^2/2)+ I_{\frac{(k+1)}{2}}(\chi^2/2))
334 Double_t Res(UShort_t k, Double_t y, Double_t echi2, Double_t& e2) const;
335 /** Number of events with large diviation */
336 ULong_t fLarge; // Number of events with large angle
337 /** Histogram of large and all angles */
339 /** Define for ROOT I/O */
340 ClassDef(AliFMDFlowResolutionTDR,1);