]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/flow/AliFMDFlowBin.h
added low and high flux parameters to the array
[u/mrichter/AliRoot.git] / FMD / flow / AliFMDFlowBin.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 Bin in a Flow "histogram" */
21 //____________________________________________________________________
22 //
23 // This contains an of class AliFMDFlowHarmonic and an object of
24 // class AliFMDFlowEventPlane to calculate v_n and \Psi_k.  It contain
25 // two objects of class AliFMDFlowEventPlane to calculate the
26 // sub-event event planes Psi_A, \Psi_B.  It also contain 3 objects of
27 // class AliFMDFlowResolution to calculate the event plane angle
28 // resolution. 
29 //
30 #ifndef ALIFMDFLOWBIN_H
31 #define ALIFMDFLOWBIN_H
32 #include <flow/AliFMDFlowEventPlane.h>
33 #include <flow/AliFMDFlowHarmonic.h>
34 #include <flow/AliFMDFlowResolution.h>
35 #include <TH2D.h>
36 #include <TH1D.h>
37 #include <TObject.h>
38
39 //Forward declaration 
40 class TBrowser;
41
42 /** @defgroup c_binned Binned flow 
43     @brief This group contains code for binned flow analysis.  Two
44     kinds of "histograms" are defined - a 1 dimensional and a 2
45     dimensional set of binned objects of class AliFMDFlowBin.   
46
47     Objects of class AliFMDFlowBin contains all the code needed to compute
48     flow in a given bin.   
49
50     The class AliFMDFlowAxis encodes look-up of a object of class
51     AliFMDFlowBin in a flow "Histogram"
52 */
53 //______________________________________________________
54 /** @class AliFMDFlowBin flow/AliFMDFlowBin.h <flow/AliFMDFlowBin.h>
55     @brief A bin of flow.   
56
57     This contains an of class AliFMDFlowHarmonic and an object of
58     class AliFMDFlowEventPlane to calculate @f$ v_n@f$ and
59     @f$\Psi_k@f$.  It contain two objects of class
60     AliFMDFlowEventPlane to calculate the sub-event event planes
61     @f$\Psi_A, \Psi_B@f$.  It also contain 3 objects of class
62     AliFMDFlowResolution to calculate the event plane angle
63     resolution.
64
65     @ingroup c_binned 
66 */
67 class AliFMDFlowBin : public TObject
68 {
69 public:
70   /** Correction type */
71   enum CorType {
72     /** No correction */
73     kNone = 1, 
74     /** Naive, using the formulas in Voloshins paper */
75     kNaive = 2,
76     /** STARs way */
77     kStar = 4, 
78     /** The way used in the TDR */
79     kTdr = 8
80   };
81   /** Types of things to draw */
82   enum DrawVar { 
83     /** The harmonic */
84     kHarmonic, 
85     /** The resolution */
86     kResolution, 
87     /** The statistics */ 
88     kCounts
89   };
90   /** Default Ctor - do not use */ 
91   AliFMDFlowBin() 
92     : fPsi(),
93       fPsiA(),
94       fPsiB(),
95       fRes(),
96       fResStar(),
97       fResTdr(),
98       fHarmonic(),
99       fSplit(),
100       fPhi(),
101       fNA(0),
102       fNB(0),
103       fN(0),
104       fAB()
105   {}
106   /** Constructor 
107       @param order Order of harmonic. 
108       @param k     Factor of event plane order=k * m */
109   AliFMDFlowBin(UShort_t order, UShort_t k=1); 
110   /** Copy constructor 
111       @param o Object top copy from */ 
112   AliFMDFlowBin(const AliFMDFlowBin& o);
113   /** Assignment operator
114       @param o Object to assign from 
115       @return Reference to this object */
116   AliFMDFlowBin& operator=(const AliFMDFlowBin& o);
117   
118   /** Destructor */
119   virtual ~AliFMDFlowBin() {} 
120   
121   /** @{ 
122       @name Processing */
123   /** Should be called at the start of an event */ 
124   virtual void Begin();
125   /** Called to add a contribution to the event plane 
126       @param phi The angle @f$ \varphi \in[0,2\pi]@f$ 
127       @param w   Weight
128       @param a   If true, add to sub-event A, otherwise to sub-event
129       B. */
130   virtual void AddToEventPlane(Double_t phi, Double_t w=1, Bool_t a=kTRUE);
131   /** Called to add a contribution to the harmonic. 
132       @param phi The angle @f$ \varphi \in[0,2\pi]@f$
133       @param wp  Weight of @a phi (only used in the calculation of
134                  the event plane). 
135       @param wh  Weight if the @f$ \varphi@f$ observation */
136   virtual void AddToHarmonic(Double_t phi, Double_t wp=1, Double_t wh=1);
137   /** Should be called at the end of an event */ 
138   virtual void End();
139   /** Analyse events 
140       @param n    Size of @a phis and possibly @a ws
141       @param phis @f$ (\varphi_i, \ldots, \varphi_n)@f$ 
142       @param wp   Weights for event plane (optional)
143       @param wh   Weights for harmonic (optional - can be the same as @a ws) */
144   virtual void Event(UInt_t n, Double_t* phis, Double_t* wp=0, Double_t* wh=0);
145   /** Finish run */
146   virtual void Finish();
147   /** @} */
148
149   /** @{ 
150       @name Orders */
151   /** Get the harmonic order 
152       @return The harmonic order */ 
153   virtual UShort_t Order() const { return fHarmonic.Order(); }
154   /** Get the harmonic order 
155       @return The harmonic order */ 
156   virtual UShort_t PsiOrder() const { return fPsi.Order(); }
157   /** @} */
158
159   /** @{
160       @name Values */
161   /** Get the value in this bin 
162       @param t  Which type of correction
163       @return the value of the harmonic */
164   virtual Double_t Value(CorType t=kTdr) const;
165   /** Get the value in this bin 
166       @param t  Which type of correction 
167       @return the error on the value of the harmonic */
168   virtual Double_t EValue(CorType t=kTdr) const;
169   /** Get the value in this bin 
170       @param e2 On return, the square error. 
171       @param t  Which type of correction
172       @return the value of the harmonic */
173   virtual Double_t Value(Double_t& e2, CorType t=kTdr) const;
174   /** Get the value in this bin 
175       @param e2 On return, the square error. 
176       @param t  Which type  of correction
177       @return the value of the event plane correction */
178   virtual Double_t Correction(Double_t& e2, CorType t=kTdr) const;
179   /** Get the number of counts used in this. 
180       @return The number of counts used in this bin */
181   virtual ULong_t  Counts() const;
182   /** @} */
183
184   /** @{ 
185       @name Utility */
186   /** Print summary to standard output */ 
187   virtual void Print(Option_t* option="") const; //*MENU*
188   /** Return true */ 
189   virtual Bool_t IsFolder() const { return kTRUE; } 
190   /** Browse this item */ 
191   virtual void Browse(TBrowser* b); 
192   /** Get the event plane angle */
193   virtual Double_t Psi() const { return fPsi.Psi(); } 
194   /** Get the sub-event A plane angle */
195   virtual Double_t PsiA() const { return fPsiA.Psi(); } 
196   /** Get the sub-event B plane angle */
197   virtual Double_t PsiB() const { return fPsiB.Psi(); } 
198   /** @} */
199
200   /** @{ 
201       @name histograms */ 
202   /** @return Split histogram */
203   const TH2& SplitHistogram() const { return fSplit; }
204   /** @return Phi histogram */
205   const TH1& PhiHistogram() const { return fPhi; }
206   /** @} */
207 protected:
208   /** Major event plane */
209   AliFMDFlowEventPlane fPsi; // Major event plane
210   /** Sub-event A event plane */
211   AliFMDFlowEventPlane fPsiA; // Sub-event A event plane
212   /** Sub-event B event plane */
213   AliFMDFlowEventPlane fPsiB; // Sub-event B event plane
214   /** Resolution */
215   AliFMDFlowResolution fRes; // Resolution
216   /** Resolution */
217   AliFMDFlowResolutionStar fResStar; // Resolution
218   /** Resolution */
219   AliFMDFlowResolutionTDR fResTdr; // Resolution
220   /** The harmonic */
221   AliFMDFlowHarmonic fHarmonic; // Harmonic
222   /** Histogram of the relative split between A and B */ 
223   TH2D fSplit;
224   /** Histogram of relative phi's */ 
225   TH1D fPhi;
226   /** Counter of number of observations in sub-A */
227   ULong_t fNA;
228   /** Counter of number of observations in sub-B */
229   ULong_t fNB;
230   /** Counter of number of observations */
231   ULong_t fN;
232   /** Psi from A vs from B */
233   TH2D    fAB;
234
235   /** Define for ROOT I/O */
236   ClassDef(AliFMDFlowBin,1); // A flow analysis 
237 };
238
239
240 #endif
241 //
242 // EOF
243 //