]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/flow/AliFMDFlowBinned1D.h
Fixes for Coverity + changes to take into account the improvements of the analysis...
[u/mrichter/AliRoot.git] / FMD / flow / AliFMDFlowBinned1D.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 1-dimensional Flow "histogram" */
21 //____________________________________________________________________ 
22 //
23 // A histogram of flow bins.  The axis can by anything
24 // (pseudo-rapidity, transvers momentum) - there's no assumption on
25 // what is the basis of the histogram.  The method Event can be used
26 // to calculate everything in one go.   Alternatively, one can use the
27 // methods AddToEventPlane and AddToHarmonic.  See also the example
28 // TestFlow.C 
29 #ifndef ALIFMDFLOWBINNED1D_H
30 #define ALIFMDFLOWBINNED1D_H
31 #include <flow/AliFMDFlowAxis.h>
32 #include <TNamed.h>
33 #include <TAttLine.h>
34 #include <TAttFill.h>
35 #include <TAttMarker.h>
36
37 // Forward declaration 
38 class AliFMDFlowBin;
39 class AliFMDFlowSplitter;
40 class TBrowser;
41 class TH1;
42
43 //______________________________________________________
44 /** @class AliFMDFlowBinned1D flow/AliFMDFlowBinned1D.h <flow/AliFMDFlowBinned1D.h>
45     @brief A 1 dimensional "histogram" of objects of class AliFMDFlowBin. 
46     @ingroup c_binned 
47     @example TestFlow.C 
48 */
49 class AliFMDFlowBinned1D : public TNamed, 
50                            public TAttLine, 
51                            public TAttFill, 
52                            public TAttMarker
53 {
54 public:
55   /** Default constructor */
56   AliFMDFlowBinned1D();
57   /** Constructor 
58       @param order    Order of the harmonic
59       @param nxbins   Number of X bins.
60       @param xbins    Borders of X bins (@a nxbins+1 entries) 
61       @param splitter Event splitter (is adopted by this object) */
62   AliFMDFlowBinned1D(const char* name, const char* title, 
63                      UShort_t order,  UShort_t  k, 
64                      UShort_t nxbins, Double_t* xbins, 
65                      AliFMDFlowSplitter* splitter=0);
66   /** Constructor 
67       @param order    Order of the harmonic
68       @param xaxis    Axis object  
69       @param splitter Event splitter (is adopted by this object) */
70   AliFMDFlowBinned1D(const char* name, const char* title, 
71                      UShort_t order,  UShort_t  k, 
72                      const AliFMDFlowAxis& xaxis, 
73                      AliFMDFlowSplitter* splitter=0);
74   /** Copy constructor */
75   AliFMDFlowBinned1D(const AliFMDFlowBinned1D& other);
76   /** Copy constructor */
77   AliFMDFlowBinned1D& operator=(const AliFMDFlowBinned1D& other);
78   /** Destructor */
79   virtual ~AliFMDFlowBinned1D();
80
81   /** @{ 
82       @name Processing */
83   /** Called at the beginning of an event */
84   virtual void Begin();
85   /** Called at the end of an event */ 
86   virtual void End();
87   /** Called to add a contribution to the event plane 
88       @param x   Bin to fill into 
89       @param w   Weight
90       @param phi The angle @f$ \varphi@f$ in radians 
91       @param a   If true, add to sub-event A, otherwise sub-event B */ 
92   virtual Bool_t AddToEventPlane(Double_t x, Double_t phi, 
93                                  Double_t w, Bool_t a);
94   /** Called to add a contribution to the harmonic
95       @param x   Bin to fill into 
96       @param phi The angle @f$ \varphi@f$ in radians 
97       @param wp  optional weight of event plane 
98       @param wh  optional weight of harmonic */
99   virtual Bool_t AddToHarmonic(Double_t x,  Double_t phi, 
100                                Double_t wp=1, Double_t wh=1);
101   /** Process a full event. 
102       @param phis List of @a n @f$ \varphi=[0,2\pi]@f$ angles 
103       @param xs   List of @a n @f$ x@f$ values. 
104       @param wp   Weights of event plane (0 or @a n long)
105       @param wh   Weights of harmonic (0 or @a n long)
106       @param n    Size of @a phis and @a xs */
107   virtual void Event(ULong_t n, Double_t* phis, Double_t* xs, 
108                      Double_t* ws=0, Double_t* wh=0);
109   /** Called at the end of a run */
110   virtual void Finish();
111   /** @} */
112
113   /** @{ 
114       @name Bins */
115   /** Get the bin at @a x 
116       @param x The bin value to find a flow object for. 
117       @return The flow object at @a x or 0 if out of range */ 
118   virtual AliFMDFlowBin* GetBin(Double_t x) const;
119   /** Get the bin @a i 
120       @param i The bin number to get
121       @return The flow object in bin @a i or 0 if out of range */ 
122   virtual AliFMDFlowBin* GetBin(UShort_t i) const;
123   /** @} */
124
125   /** @{ 
126       @name Orders */
127   /** Get the harmonic order 
128       @return The harmonic order */ 
129   virtual UShort_t Order() const;
130   /** Get the harmonic order 
131       @return The harmonic order */ 
132   virtual UShort_t PsiOrder() const;
133   /** @} */
134
135   /** @{ 
136       @name Information */
137   /** Print to standard out */ 
138   virtual void Print(Option_t* option="s") const;  //*MENU*
139   /** Make a histogram */
140   virtual TH1* MakeHistogram(UInt_t which, UInt_t what);
141   /** Draw as a histogram
142       @param option Option string. 
143       - s  Draw STAR method. 
144       - t  Draw TDR method 
145       - n  Draw Naive method 
146       - b  Draw bare method 
147       - r  Draw resolution rather than harmonic. 
148   */
149   virtual void Draw(Option_t* option="stnb"); //*MENU*
150   /** Whether this is to be considered a folder */
151   Bool_t IsFolder() const { return kTRUE; }
152   /** Browse this object */ 
153   void Browse(TBrowser* b);
154   /** @} */
155 protected:
156   /** X axis */ 
157   AliFMDFlowAxis fXAxis; // Axis 
158   /** Number of bins */ 
159   Int_t fN;
160   /** Array of the flow objects */ 
161   AliFMDFlowBin** fBins; //[fN] Bins 
162   /** The event splitter used. */
163   AliFMDFlowSplitter* fSplitter;
164   /** Define for ROOT I/O */
165   ClassDef(AliFMDFlowBinned1D,1);
166 };
167
168 #endif
169 //
170 // EOF
171 //