]>
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 | */ | |
18 | //____________________________________________________________________ | |
19 | // | |
20 | // AliFMDFlowTrueBin: | |
21 | // A specialised AliFMDFlowBin of flow in case the event plane is | |
22 | // well-known. | |
23 | // AliFMDFlowTrue1D: | |
24 | // A specialised AliFMDFlowBinned1D histogram in case the event | |
25 | // plane is well-known. | |
26 | // | |
39eefe19 | 27 | #include "flow/AliFMDFlowTrue.h" |
28 | #include "flow/AliFMDFlowUtil.h" | |
29 | #include <iostream> | |
30 | #include <iomanip> | |
31 | #include <TString.h> | |
32 | ||
33 | //==================================================================== | |
9b98d361 | 34 | void |
6ce810fc | 35 | AliFMDFlowTrueBin::AddToHarmonic(Double_t phi, Double_t, Double_t) |
9b98d361 | 36 | { |
37 | // Called to add a contribution to the harmonic. | |
38 | // Parameters: | |
39 | // phi The angle phi in [0,2pi] | |
40 | // w Weight of phi (only used in the calculation of | |
41 | // the event plane). | |
42 | // | |
43 | // Disregard the obervation of phi from the event plane angle. | |
44 | fHarmonic.Add(phi, fPsiR); | |
45 | fPhi.Fill(NormalizeAngle(phi-fPsiR)); | |
46 | } | |
47 | ||
48 | //____________________________________________________________________ | |
39eefe19 | 49 | void |
50 | AliFMDFlowTrueBin::End() | |
51 | { | |
97e94238 | 52 | // Called at end of event |
53 | // PArameters: | |
54 | // none | |
39eefe19 | 55 | Double_t psi = fPsi.Psi(); |
56 | Double_t dpsi = NormalizeAngle(fPsi.Order() * (psi-fPsiR)); | |
57 | fResReal.Add(cos(dpsi)); | |
9b98d361 | 58 | if (fN != 0) { |
59 | fSplit.Fill(.5, float(fNA)/fN); | |
60 | fSplit.Fill(1.5, float(fNB)/fN); | |
61 | } | |
39eefe19 | 62 | } |
63 | ||
64 | //____________________________________________________________________ | |
65 | Double_t | |
66 | AliFMDFlowTrueBin::Value(CorType t) const | |
67 | { | |
97e94238 | 68 | // Get value of harmonic |
69 | // PArameters: | |
70 | // see AliFMDFlowBin::Value | |
39eefe19 | 71 | Double_t e; |
72 | return Value(e, t); | |
73 | } | |
74 | //____________________________________________________________________ | |
75 | Double_t | |
76 | AliFMDFlowTrueBin::Value(Double_t& e2, CorType) const | |
77 | { | |
97e94238 | 78 | // Get value of harmonic |
79 | // PArameters: | |
80 | // see AliFMDFlowBin::Value | |
39eefe19 | 81 | return fHarmonic.Value(1, 0, e2); |
82 | } | |
83 | //____________________________________________________________________ | |
84 | Double_t | |
85 | AliFMDFlowTrueBin::Correction(Double_t& e2, CorType) const | |
86 | { | |
97e94238 | 87 | // Get value of correction |
88 | // PArameters: | |
89 | // see AliFMDFlowBin::Correction | |
39eefe19 | 90 | e2 = fResReal.SqVar() / fResReal.N(); |
91 | return fResReal.Average(); | |
92 | } | |
93 | ||
94 | //____________________________________________________________________ | |
95 | void | |
96 | AliFMDFlowTrueBin::Print(Option_t*) const | |
97 | { | |
97e94238 | 98 | // Print to standard out |
99 | // PArameters: | |
100 | // see AliFMDFlowBin::Print | |
39eefe19 | 101 | Double_t e2v, e2r; |
97e94238 | 102 | Double_t v = 100 * Value(e2v, AliFMDFlowBin::kNone); |
103 | Double_t r = 100 * Correction(e2r, AliFMDFlowBin::kNone); | |
39eefe19 | 104 | |
97e94238 | 105 | std::streamsize oldP = std::cout.precision(3); |
106 | std::ios_base::fmtflags oldF = std::cout.setf(std::ios_base::fixed, | |
39eefe19 | 107 | std::ios_base::floatfield); |
9b98d361 | 108 | std::cout << GetName() << " - " << GetTitle() << "\n" |
109 | << " v" << std::setw(1) << fHarmonic.Order() << ": True: " | |
39eefe19 | 110 | << std::setw(6) << v << " +/- " |
111 | << std::setw(6) << 100*sqrt(e2v) << " [" | |
112 | << std::setw(7) << r << " +/- " | |
113 | << std::setw(7) << 100*sqrt(e2r) << "]"; | |
114 | std::cout << std::endl; | |
97e94238 | 115 | std::cout.precision(oldP); |
116 | std::cout.setf(oldF, std::ios_base::floatfield); | |
39eefe19 | 117 | } |
118 | ||
119 | //==================================================================== | |
9b98d361 | 120 | AliFMDFlowTrue1D::AliFMDFlowTrue1D(const char* name, const char* title, |
121 | UShort_t order, const AliFMDFlowAxis& xaxis) | |
122 | : AliFMDFlowBinned1D(name, title, order, 1, xaxis) | |
39eefe19 | 123 | { |
97e94238 | 124 | // Constructor. |
125 | // Parameters: | |
126 | // see AliFMDFlowBinned1D::AliFMDFlowBinned1D | |
39eefe19 | 127 | // Delete old flow objects, and make new "true" ones. |
128 | for (UInt_t i = 0; i < xaxis.N(); i++) { | |
129 | delete fBins[i]; | |
130 | fBins[i] = new AliFMDFlowTrueBin(order); | |
131 | } | |
132 | } | |
133 | ||
134 | //____________________________________________________________________ | |
135 | void | |
136 | AliFMDFlowTrue1D::SetPsi(Double_t psi) | |
137 | { | |
97e94238 | 138 | // Set event plane |
139 | // Parameters. | |
140 | // psi The true, well-known, event plane angle | |
39eefe19 | 141 | for (UInt_t i = 0; i < fXAxis.N(); i++) |
142 | static_cast<AliFMDFlowTrueBin*>(fBins[i])->SetPsi(psi); | |
143 | } | |
144 | ||
145 | //____________________________________________________________________ | |
146 | void | |
147 | AliFMDFlowTrue1D::Print(Option_t* option) const | |
148 | { | |
97e94238 | 149 | // Print to standard out. |
150 | // Parameters | |
151 | // See AliFMDFlowBinned1D::Print | |
39eefe19 | 152 | TString opt(option); |
153 | opt.ToLower(); | |
154 | Bool_t det = opt.Contains("d"); | |
155 | Bool_t sum = opt.Contains("s"); | |
156 | if (det) AliFMDFlowBinned1D::Print("d"); | |
157 | if (sum) { | |
158 | std::cout << " x | Real \n" | |
159 | << "------+-------------------" << std::endl; | |
160 | ||
97e94238 | 161 | std::streamsize oldP = std::cout.precision(2); |
162 | std::ios_base::fmtflags oldF = std::cout.setf(std::ios_base::fixed, | |
163 | std::ios_base::floatfield); | |
39eefe19 | 164 | for (UShort_t i = 0; i < fXAxis.N(); i++) { |
165 | Double_t x = fXAxis.BinCenter(i); | |
166 | Double_t e2v; | |
97e94238 | 167 | Double_t v = fBins[i]->Value(e2v, AliFMDFlowBin::kNone); |
39eefe19 | 168 | std::cout << std::setprecision(2) << std::setw(5) << x << " | " |
169 | << std::setprecision(3) | |
170 | << std::setw(6) << 100 * v << " +/- " | |
171 | << std::setw(6) << 100 * sqrt(e2v) | |
172 | << std::endl; | |
173 | } | |
97e94238 | 174 | std::cout.precision(oldP); |
175 | std::cout.setf(oldF, std::ios_base::floatfield); | |
39eefe19 | 176 | } |
177 | } | |
178 | ||
179 | ||
180 | //____________________________________________________________________ | |
181 | // | |
182 | // EOF | |
183 | // |