]>
Commit | Line | Data |
---|---|---|
97e94238 | 1 | /* Copyright (C) 2007 Christian Holm Christensen <cholm@nbi.dk> |
2 | * | |
3 | * This library is free software; you can redistribute it and/or | |
4 | * modify it under the terms of the GNU Lesser General Public License | |
5 | * as published by the Free Software Foundation; either version 2.1 of | |
6 | * the License, or (at your option) any later version. | |
7 | * | |
8 | * This library is distributed in the hope that it will be useful, but | |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
11 | * Lesser General Public License for more details. | |
12 | * | |
13 | * You should have received a copy of the GNU Lesser General Public | |
14 | * License along with this library; if not, write to the Free Software | |
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
16 | * USA | |
17 | */ | |
39eefe19 | 18 | /** @file |
19 | @brief Implementation of a Harmonic class */ | |
97e94238 | 20 | //____________________________________________________________________ |
21 | // | |
22 | // Calculate the nth order harmonic. | |
23 | // Input is the phis of the observations, | |
24 | // and the resolution of the event plane. | |
25 | // The class derives from AliFMDFlowStat to easy calculating the mean | |
26 | // and the square variance of the harmonic. | |
39eefe19 | 27 | #include "flow/AliFMDFlowHarmonic.h" |
28 | #include "flow/AliFMDFlowUtil.h" | |
29 | // #include <cmath> | |
30 | ||
31 | //==================================================================== | |
97e94238 | 32 | AliFMDFlowHarmonic::AliFMDFlowHarmonic(const AliFMDFlowHarmonic& o) |
33 | : AliFMDFlowStat(o), | |
34 | fOrder(o.fOrder) | |
35 | { | |
36 | // Copy constructor | |
37 | // Parameters: | |
38 | // o Object to copy from | |
39 | } | |
40 | ||
41 | //____________________________________________________________________ | |
42 | AliFMDFlowHarmonic& | |
43 | AliFMDFlowHarmonic::operator=(const AliFMDFlowHarmonic& o) | |
44 | { | |
45 | // Assignment operator | |
46 | // Parameters: | |
47 | // o Object to assign from | |
48 | // Return reference to this object. | |
49 | AliFMDFlowStat::operator=(o); | |
50 | fOrder = o.fOrder; | |
51 | return *this; | |
52 | } | |
53 | ||
54 | //____________________________________________________________________ | |
39eefe19 | 55 | void |
56 | AliFMDFlowHarmonic::Add(Double_t phi, Double_t psi) | |
57 | { | |
97e94238 | 58 | // Add a data point. |
59 | // Parameters: | |
60 | // phi Angle. | |
61 | // psi Event plane | |
39eefe19 | 62 | Double_t a = NormalizeAngle(fOrder * (phi - psi)); |
63 | Double_t contrib = cos(a); | |
64 | AliFMDFlowStat::Add(contrib); | |
65 | } | |
66 | //____________________________________________________________________ | |
67 | Double_t | |
68 | AliFMDFlowHarmonic::Value(Double_t r, Double_t er2, Double_t& e2) const | |
69 | { | |
70 | // The corrected value is given by | |
71 | // | |
72 | // v_n^obs | |
73 | // v_n = ------- | |
74 | // R | |
75 | // | |
76 | // where | |
77 | // | |
78 | // 1 | |
79 | // v_n^obs = - \sum_i(cos(n(\phi_i - \Psi))) | |
80 | // N | |
81 | // | |
82 | // and R is the resolution | |
83 | // | |
84 | // The error on the corrected value is given by | |
85 | // | |
86 | // dv_n dv_n | |
87 | // d^2v_n = (--------)^2 d^2v_n^obs + (----)^2 d^2R | |
88 | // dv_n^obs dR | |
89 | // | |
90 | // d^2v_n^obs R^2 + d^2R v_n^obs^2 | |
91 | // = ------------------------------- | |
92 | // R^4 | |
93 | // | |
94 | Double_t a = fAverage; | |
95 | Double_t v = a / r; | |
96 | Double_t s = fSqVar / fN; | |
97 | e2 = (s * r * r + er2 * a * a) / pow(r, 4); | |
98 | return v; | |
99 | } | |
100 | //____________________________________________________________________ | |
101 | // | |
102 | // EOF | |
103 | // |