]>
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 | //==================================================================== | |
34 | void | |
35 | AliFMDFlowTrueBin::End() | |
36 | { | |
97e94238 | 37 | // Called at end of event |
38 | // PArameters: | |
39 | // none | |
39eefe19 | 40 | Double_t psi = fPsi.Psi(); |
41 | Double_t dpsi = NormalizeAngle(fPsi.Order() * (psi-fPsiR)); | |
42 | fResReal.Add(cos(dpsi)); | |
43 | } | |
44 | ||
45 | //____________________________________________________________________ | |
46 | Double_t | |
47 | AliFMDFlowTrueBin::Value(CorType t) const | |
48 | { | |
97e94238 | 49 | // Get value of harmonic |
50 | // PArameters: | |
51 | // see AliFMDFlowBin::Value | |
39eefe19 | 52 | Double_t e; |
53 | return Value(e, t); | |
54 | } | |
55 | //____________________________________________________________________ | |
56 | Double_t | |
57 | AliFMDFlowTrueBin::Value(Double_t& e2, CorType) const | |
58 | { | |
97e94238 | 59 | // Get value of harmonic |
60 | // PArameters: | |
61 | // see AliFMDFlowBin::Value | |
39eefe19 | 62 | return fHarmonic.Value(1, 0, e2); |
63 | } | |
64 | //____________________________________________________________________ | |
65 | Double_t | |
66 | AliFMDFlowTrueBin::Correction(Double_t& e2, CorType) const | |
67 | { | |
97e94238 | 68 | // Get value of correction |
69 | // PArameters: | |
70 | // see AliFMDFlowBin::Correction | |
39eefe19 | 71 | e2 = fResReal.SqVar() / fResReal.N(); |
72 | return fResReal.Average(); | |
73 | } | |
74 | ||
75 | //____________________________________________________________________ | |
76 | void | |
77 | AliFMDFlowTrueBin::Print(Option_t*) const | |
78 | { | |
97e94238 | 79 | // Print to standard out |
80 | // PArameters: | |
81 | // see AliFMDFlowBin::Print | |
39eefe19 | 82 | Double_t e2v, e2r; |
97e94238 | 83 | Double_t v = 100 * Value(e2v, AliFMDFlowBin::kNone); |
84 | Double_t r = 100 * Correction(e2r, AliFMDFlowBin::kNone); | |
39eefe19 | 85 | |
97e94238 | 86 | std::streamsize oldP = std::cout.precision(3); |
87 | std::ios_base::fmtflags oldF = std::cout.setf(std::ios_base::fixed, | |
39eefe19 | 88 | std::ios_base::floatfield); |
89 | std::cout << " v" << std::setw(1) << fHarmonic.Order() << ": True: " | |
90 | << std::setw(6) << v << " +/- " | |
91 | << std::setw(6) << 100*sqrt(e2v) << " [" | |
92 | << std::setw(7) << r << " +/- " | |
93 | << std::setw(7) << 100*sqrt(e2r) << "]"; | |
94 | std::cout << std::endl; | |
97e94238 | 95 | std::cout.precision(oldP); |
96 | std::cout.setf(oldF, std::ios_base::floatfield); | |
39eefe19 | 97 | } |
98 | ||
99 | //==================================================================== | |
100 | AliFMDFlowTrue1D::AliFMDFlowTrue1D(UShort_t order, const AliFMDFlowAxis& xaxis) | |
101 | : AliFMDFlowBinned1D(order, xaxis) | |
102 | { | |
97e94238 | 103 | // Constructor. |
104 | // Parameters: | |
105 | // see AliFMDFlowBinned1D::AliFMDFlowBinned1D | |
39eefe19 | 106 | // Delete old flow objects, and make new "true" ones. |
107 | for (UInt_t i = 0; i < xaxis.N(); i++) { | |
108 | delete fBins[i]; | |
109 | fBins[i] = new AliFMDFlowTrueBin(order); | |
110 | } | |
111 | } | |
112 | ||
113 | //____________________________________________________________________ | |
114 | void | |
115 | AliFMDFlowTrue1D::SetPsi(Double_t psi) | |
116 | { | |
97e94238 | 117 | // Set event plane |
118 | // Parameters. | |
119 | // psi The true, well-known, event plane angle | |
39eefe19 | 120 | for (UInt_t i = 0; i < fXAxis.N(); i++) |
121 | static_cast<AliFMDFlowTrueBin*>(fBins[i])->SetPsi(psi); | |
122 | } | |
123 | ||
124 | //____________________________________________________________________ | |
125 | void | |
126 | AliFMDFlowTrue1D::Print(Option_t* option) const | |
127 | { | |
97e94238 | 128 | // Print to standard out. |
129 | // Parameters | |
130 | // See AliFMDFlowBinned1D::Print | |
39eefe19 | 131 | TString opt(option); |
132 | opt.ToLower(); | |
133 | Bool_t det = opt.Contains("d"); | |
134 | Bool_t sum = opt.Contains("s"); | |
135 | if (det) AliFMDFlowBinned1D::Print("d"); | |
136 | if (sum) { | |
137 | std::cout << " x | Real \n" | |
138 | << "------+-------------------" << std::endl; | |
139 | ||
97e94238 | 140 | std::streamsize oldP = std::cout.precision(2); |
141 | std::ios_base::fmtflags oldF = std::cout.setf(std::ios_base::fixed, | |
142 | std::ios_base::floatfield); | |
39eefe19 | 143 | for (UShort_t i = 0; i < fXAxis.N(); i++) { |
144 | Double_t x = fXAxis.BinCenter(i); | |
145 | Double_t e2v; | |
97e94238 | 146 | Double_t v = fBins[i]->Value(e2v, AliFMDFlowBin::kNone); |
39eefe19 | 147 | std::cout << std::setprecision(2) << std::setw(5) << x << " | " |
148 | << std::setprecision(3) | |
149 | << std::setw(6) << 100 * v << " +/- " | |
150 | << std::setw(6) << 100 * sqrt(e2v) | |
151 | << std::endl; | |
152 | } | |
97e94238 | 153 | std::cout.precision(oldP); |
154 | std::cout.setf(oldF, std::ios_base::floatfield); | |
39eefe19 | 155 | } |
156 | } | |
157 | ||
158 | ||
159 | //____________________________________________________________________ | |
160 | // | |
161 | // EOF | |
162 | // |