2 @brief Implementation of an EventPlane class */
3 #include "flow/AliFMDFlowEventPlane.h"
4 #include "flow/AliFMDFlowUtil.h"
9 /** Function to caculate @f$ \sin(a), \cos(a)@f$ in one go. Note,
10 that with GCC, this is a built-in, and we only have this to
11 serve as a replacement function
13 inline void sincos(Double_t a, Double_t* sina, Double_t* cosa) {
20 //====================================================================
22 AliFMDFlowEventPlane::Clear(Option_t*)
28 //____________________________________________________________________
30 AliFMDFlowEventPlane::Add(Double_t phi, Double_t weight)
32 Double_t a = NormalizeAngle(fOrder * phi);
35 if (isnan(s) || isinf(s) || isnan(c) || isinf(s)) return;
36 fSumSinMPhi += weight * s;
37 fSumCosMPhi += weight * c;
39 //____________________________________________________________________
41 AliFMDFlowEventPlane::Psi() const
43 if (fCache < 0) fCache = DoPsi(fSumSinMPhi, fSumCosMPhi);
46 //____________________________________________________________________
48 AliFMDFlowEventPlane::Psi(Double_t phi, Double_t w) const
50 Double_t a = NormalizeAngle(fOrder * phi);
53 if (isnan(s) || isinf(s) || isnan(c) || isinf(s)) return Psi();
54 Double_t psi = DoPsi(fSumSinMPhi - w * s, fSumCosMPhi - w * c);
58 //____________________________________________________________________
60 AliFMDFlowEventPlane::DoPsi(Double_t sumsin, Double_t sumcos) const
63 // Make sure we get an angle everywhere
64 if (sumcos != 0) psi = atan2(sumsin, sumcos);
65 else if (sumsin == 0) psi = 0;
66 else if (sumsin > 0) psi = M_PI / 2;
68 psi = NormalizeAngle(psi);
73 //____________________________________________________________________