]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/flow/AliFMDFlowEventPlane.h
coding conventions and compilation warnings
[u/mrichter/AliRoot.git] / FMD / flow / AliFMDFlowEventPlane.h
1 // -*- 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 an EventPlane class */
21 //____________________________________________________________________
22 //
23 // Class to determine the event plane 
24 // 
25 // The event plane is calculated as 
26 // 
27 //    Psi_n = 1/n * atan((sum_i(w_i sin(n phi_i)))
28 //                        sum_i(w_i cos(n phi_i))))
29 //
30 // where i runs over all observations of phi in an event, and 
31 // w_i is the weight of the ith observation of phi
32 #ifndef ALIFMDFLOWEVENTPLANE_H
33 #define ALIFMDFLOWEVENTPLANE_H
34 #include <TObject.h>
35 #include <TH2D.h>
36 #include <TH1D.h>
37 class TBrowser;
38
39 //______________________________________________________
40 /** @class AliFMDFlowEventPlane flow/AliFMDFlowEventPlane.h <flow/AliFMDFlowEventPlane.h>
41     @brief Class to determine the event plane 
42
43     The event plane is calculated as 
44     @f[ 
45     \Psi_n = \frac1n\tan^{-1}\left[\frac{\sum_i(w_i\sin(n\varphi_i))}
46     {\sum_i(w_i\cos(n\varphi_i))}\right]
47     @f]
48     where @f$ i @f$ runs over all observations of @f$\varphi@f$ in an
49     event, and @f$ w_i@f$ is the weight of the @f$ i@f$ observation of
50     @f$ \varphi@f$
51
52     @ingroup a_basic
53 */
54 class AliFMDFlowEventPlane : public TObject
55 {
56 public:
57   /** Constructor 
58       @param m Harmonic number */
59   AliFMDFlowEventPlane(UShort_t m=0);
60   /** Copy constructor. 
61       @param o Object to copy from */ 
62   AliFMDFlowEventPlane(const AliFMDFlowEventPlane& o);
63   /** Assignement operator. 
64       @param o Object to copy from 
65       @return Reference to this */
66   AliFMDFlowEventPlane& operator=(const AliFMDFlowEventPlane& o);
67   /** Destructor */
68   ~AliFMDFlowEventPlane() {} 
69
70   /** @{ 
71       @name Information */
72   /** Get the event plane 
73       @return @f$ \Psi_k@f$ */
74   Double_t Psi() const;
75   /** Get the event plane angle @f$ \Psi_k@f$ @e disregarding the
76       contribution from the observation @f$ \varphi_i@f$ with weight
77       @f$ w_i@f$.  This is to avoid auto-correlations 
78       @param phi The observation  @f$ \varphi_i@f$
79       @param w   The weight @f$ w_i@f$ of the obervation. 
80       @return The event plane angle @f$ \Psi_k@f$ with out the
81       contribution from @f$ \varphi_i@f$ */
82   Double_t Psi(Double_t phi, Double_t w=1) const;
83   /** Get the harmnic order 
84       @return @f$ k@f$  */
85   UShort_t Order() const { return fOrder; }
86   /** @} */
87
88   /** @{ 
89       @name Processing */
90   /** Clear it */
91   void Clear(Option_t* option="");
92   /** Add a data point 
93       @param phi The angle @f$\varphi\in[0,2\pi]@f$
94       @param weight The weight */
95   void Add(Double_t phi, Double_t weight=1);
96   /** Called at end of event to fill histograms */
97   void End();
98   /** @} */
99   
100   /** @{ 
101       @name Utilities */
102   /** this is a folder */ 
103   Bool_t IsFolder() const { return kTRUE; }
104   /** Browse this object */
105   void Browse(TBrowser* b);
106   /** @} */
107
108   /** @{ 
109       @name histograms */ 
110   /** @return Sum histogram */
111   const TH2& SumHistogram() const { return fSum; }
112   /** @return Psi histogram */
113   const TH1& PsiHistogram() const { return fPsi; }
114   /** @} */
115 protected:
116   /** Utility function to calculate @f$ \Psi@f$ from the sum of
117       sines and cosines. 
118       @param sumsin Sum of sines 
119       @param sumcos Sum of cosine. 
120       @return @f$ \Psi@f$ */
121   Double_t DoPsi(Double_t sumsin, Double_t sumcos) const;
122   /** @f$ \sum_i w_i \sin(k \varphi_i)@f$ */
123   Double_t fSumSinMPhi; // Sum of contributions 
124   /** @f$ \sum_i w_i \cos(k \varphi_i)@f$ */
125   Double_t fSumCosMPhi; // Sum of contributions 
126   /** Order */
127   UShort_t fOrder; // Order 
128   /** Cache of Psi */
129   mutable Double_t fCache; // Cache of calculated value 
130   /** Histogram of summed sin(m*phi) vs cos(m*phi) */
131   TH2D fSum;
132   /** Histogram of event plane angles */ 
133   TH1D fPsi;
134   /** Counter */ 
135   Double_t fScale;
136   /** Define for ROOT I/O */
137   ClassDef(AliFMDFlowEventPlane,1); 
138 };
139
140
141 #endif
142 //
143 // EOF
144 //