1 /* Copyright (C) 2007 Christian Holm Christensen <cholm@nbi.dk>
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.
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.
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
18 //____________________________________________________________________
21 // A specialised AliFMDFlowBin of flow in case the event plane is
24 // A specialised AliFMDFlowBinned1D histogram in case the event
25 // plane is well-known.
27 #include "flow/AliFMDFlowTrue.h"
28 #include "flow/AliFMDFlowUtil.h"
33 //====================================================================
35 AliFMDFlowTrueBin::AddToHarmonic(Double_t phi, Double_t, Double_t)
37 // Called to add a contribution to the harmonic.
39 // phi The angle phi in [0,2pi]
40 // w Weight of phi (only used in the calculation of
43 // Disregard the obervation of phi from the event plane angle.
44 fHarmonic.Add(phi, fPsiR);
45 fPhi.Fill(NormalizeAngle(phi-fPsiR));
48 //____________________________________________________________________
50 AliFMDFlowTrueBin::End()
52 // Called at end of event
55 Double_t psi = fPsi.Psi();
56 Double_t dpsi = NormalizeAngle(fPsi.Order() * (psi-fPsiR));
57 fResReal.Add(cos(dpsi));
59 fSplit.Fill(.5, float(fNA)/fN);
60 fSplit.Fill(1.5, float(fNB)/fN);
64 //____________________________________________________________________
66 AliFMDFlowTrueBin::Value(CorType t) const
68 // Get value of harmonic
70 // see AliFMDFlowBin::Value
74 //____________________________________________________________________
76 AliFMDFlowTrueBin::Value(Double_t& e2, CorType) const
78 // Get value of harmonic
80 // see AliFMDFlowBin::Value
81 return fHarmonic.Value(1, 0, e2);
83 //____________________________________________________________________
85 AliFMDFlowTrueBin::Correction(Double_t& e2, CorType) const
87 // Get value of correction
89 // see AliFMDFlowBin::Correction
90 e2 = fResReal.SqVar() / fResReal.N();
91 return fResReal.Average();
94 //____________________________________________________________________
96 AliFMDFlowTrueBin::Print(Option_t*) const
98 // Print to standard out
100 // see AliFMDFlowBin::Print
102 Double_t v = 100 * Value(e2v, AliFMDFlowBin::kNone);
103 Double_t r = 100 * Correction(e2r, AliFMDFlowBin::kNone);
105 std::streamsize oldP = std::cout.precision(3);
106 std::ios_base::fmtflags oldF = std::cout.setf(std::ios_base::fixed,
107 std::ios_base::floatfield);
108 std::cout << GetName() << " - " << GetTitle() << "\n"
109 << " v" << std::setw(1) << fHarmonic.Order() << ": True: "
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;
115 std::cout.precision(oldP);
116 std::cout.setf(oldF, std::ios_base::floatfield);
119 //====================================================================
120 AliFMDFlowTrue1D::AliFMDFlowTrue1D(const char* name, const char* title,
121 UShort_t order, const AliFMDFlowAxis& xaxis)
122 : AliFMDFlowBinned1D(name, title, order, 1, xaxis)
126 // see AliFMDFlowBinned1D::AliFMDFlowBinned1D
127 // Delete old flow objects, and make new "true" ones.
128 for (UInt_t i = 0; i < xaxis.N(); i++) {
130 fBins[i] = new AliFMDFlowTrueBin(order);
134 //____________________________________________________________________
136 AliFMDFlowTrue1D::SetPsi(Double_t psi)
140 // psi The true, well-known, event plane angle
141 for (UInt_t i = 0; i < fXAxis.N(); i++)
142 static_cast<AliFMDFlowTrueBin*>(fBins[i])->SetPsi(psi);
145 //____________________________________________________________________
147 AliFMDFlowTrue1D::Print(Option_t* option) const
149 // Print to standard out.
151 // See AliFMDFlowBinned1D::Print
154 Bool_t det = opt.Contains("d");
155 Bool_t sum = opt.Contains("s");
156 if (det) AliFMDFlowBinned1D::Print("d");
158 std::cout << " x | Real \n"
159 << "------+-------------------" << std::endl;
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);
164 for (UShort_t i = 0; i < fXAxis.N(); i++) {
165 Double_t x = fXAxis.BinCenter(i);
167 Double_t v = fBins[i]->Value(e2v, AliFMDFlowBin::kNone);
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)
174 std::cout.precision(oldP);
175 std::cout.setf(oldF, std::ios_base::floatfield);
180 //____________________________________________________________________