]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/flow/AliFMDFlowHarmonic.h
Fix Coverity 10974-82
[u/mrichter/AliRoot.git] / FMD / flow / AliFMDFlowHarmonic.h
1 // -*- mode: C++ -*-
2 /* Copyright (C) 2007 Christian Holm Christensen <cholm@nbi.dk>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 2.1 of
7  * the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA
18  */
19 /** @file 
20     @brief Declaration of a Harmonic class */
21 //____________________________________________________________________
22 //
23 // Calculate the nth order harmonic. 
24 // Input is the phis of the observations,
25 // and the resolution of the event plane. 
26 // The class derives from AliFMDFlowStat to easy calculating the mean
27 // and the square variance of the harmonic. 
28 #ifndef ALIFMDFLOWHARMONIC_H
29 #define ALIFMDFLOWHARMONIC_H
30 #include <flow/AliFMDFlowStat.h>
31 #include <TH2D.h>
32 class TBrowser;
33
34 /** @defgroup a_basic Basic classes for doing Flow analysis. 
35     @brief This group of class handles the low-level stuff to do
36     flow analysis. 
37     @ingroup FMD_flow
38 */
39 //______________________________________________________
40 /** @class AliFMDFlowHarmonic flow/AliFMDFlowHarmonic.h <flow/AliFMDFlowHarmonic.h>
41     @brief Calculate the @f$ n^{th}@f$ order harmonic
42     @ingroup a_basic 
43
44     Calculate the @f$ n^{th}@f$ order harmonic, given by 
45     @f{eqnarray*}
46     v_n       &=& \frac{v_n^{obs}}{R}\\
47     v_n^{obs} &=& \frac1M\sum_i^M\cos(n (\varphi_i - \Psi))
48     @f}
49     where @f$ R@f$ is the resolution, @f$ i@f$ runs over all @f$
50     M@f$ observations of @f$ \varphi_i@f$ in all events, and
51     @f$\Psi@f$ is the estimated event plane. 
52
53     The error on the corrected value is given by 
54     @f{eqnarray*} 
55     \delta^2v_n & = & \left(\frac{dv_n}{dv_n^{obs}}\right)^2\delta^2
56     v_n^{obs} + \left(\frac{dv_n}{dR}\right)^2\delta^2R \\ 
57     & = & \frac{\delta^2v_n^{obs} R^2 + \delta^2R (v_n^{obs})^2}
58     {R^4}
59     @f}
60 */    
61 class AliFMDFlowHarmonic : public AliFMDFlowStat
62 {
63 public:
64   /** Constructor 
65       @param n Order of the harmonic */
66   AliFMDFlowHarmonic(UShort_t n=0);
67   /** Destructor */ 
68   virtual ~AliFMDFlowHarmonic() {}
69   /** Copy constructor 
70       @param o Object to copy from. */
71   AliFMDFlowHarmonic(const AliFMDFlowHarmonic& o);
72   /** Assignment operator  
73       @param o Object to assign from
74       @return Reference to this object. */
75   AliFMDFlowHarmonic& operator=(const AliFMDFlowHarmonic& o);
76   
77   /** @{ 
78       @name Processing */
79   /** Add a data point 
80       @param phi    The absolute angle @f$ \varphi \in[0,2\pi]@f$ 
81       @param psi    The event plane angle @f$ \Psi \in[0,2\pi] @f$
82       @param weight The weight of the observation */
83   void Add(Double_t phi, Double_t psi, Double_t weight=1);
84   /** @} */
85
86   /** @{ 
87       @name Information */
88   /** Get the harmonic. 
89       @param r   Event plane resolution 
90       @param er2 Square error on event plane resolution 
91       @param e2  On return the square error 
92       @return The harmonic value */
93   Double_t Value(Double_t r, Double_t er2, Double_t& e2) const;
94   /** Get the order of the harmonic */
95   UShort_t Order() const { return fOrder; }
96   /** @} */
97
98   /** @{ 
99       @name Utility */
100   /** This is a folder */ 
101   Bool_t IsFolder() const { return kTRUE; }
102   /** Browse this object */ 
103   void Browse(TBrowser* b);
104   /** Print content */
105   void Print(Option_t* option="") const;
106   /** @} */
107
108   /** @{ 
109       @name histograms */ 
110   /** @return Contrib histogram */
111   const TH1& ContribHistogram() const { return fContrib; }
112   /** @return Phi histogram */
113   const TH1& PhiHistogram() const { return fPhi; }
114   /** @return Nphi histogram */
115   const TH1& NPhiHistogram() const { return fNPhi; }
116   /** @return Weight histogram */
117   const TH1& WeightHistogram() const { return fWeight; }
118   /** @} */
119 protected:
120   /** the order */ 
121   UShort_t fOrder; // Order 
122   /** Histogram of angles */ 
123   TH1D fPhi;
124   /** Histogram of angles */ 
125   TH1D fNPhi;
126   /** Histogram of weights */ 
127   TH1D fWeight;
128   /** cos(n(phi-psi)) vs (phi-psi) */
129   TH2D fContrib;
130   /** Define for ROOT I/O */ 
131   ClassDef(AliFMDFlowHarmonic,1);
132 };
133
134
135 #endif
136 //
137 // EOF
138 //
139