]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/flow/AliFMDFlowBinned2D.h
Fix Coverity 10974-82
[u/mrichter/AliRoot.git] / FMD / flow / AliFMDFlowBinned2D.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 2-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 ALIFMDFLOWBINNED2D_H
30 #define ALIFMDFLOWBINNED2D_H
31 #include <TNamed.h>
32 #include <TAttLine.h>
33 #include <TAttFill.h>
34 #include <TAttMarker.h>
35 #include <flow/AliFMDFlowAxis.h>
36
37 // Forward declaration 
38 class AliFMDFlowBin;
39 class AliFMDFlowSplitter;
40 class TBrowser;
41 class TH1;
42
43 //______________________________________________________
44 /** @class AliFMDFlowBinned2D flow/AliFMDFlowBinned2D.h <flow/AliFMDFlowBinned2D.h>
45     @brief A 2 dimensional "histogram" of objects of class AliFMDFlowBin. 
46     @ingroup c_binned */
47 class AliFMDFlowBinned2D : public TNamed, 
48                            public TAttLine, 
49                            public TAttFill, 
50                            public TAttMarker
51 {
52 public:
53   /** Constructor 
54       @param order    Order of the harmonic 
55       @param nxbins   Number of X bins.
56       @param xbins    Borders of X bins (@a nxbins+1 entries) 
57       @param nybins   Number of Y bins.
58       @param ybins    Borders of Y bins (@a nybins+1 entries) */
59   AliFMDFlowBinned2D(const char* name, const char* title, UShort_t order,  
60                      UShort_t nxbins, Double_t* xbins,
61                      UShort_t nybins, Double_t* ybins,
62                      AliFMDFlowSplitter* splitter=0);
63   /** Constructor 
64       @param order Order of the harmonic 
65       @param xaxis Axis object 
66       @param yaxis Axis object */
67   AliFMDFlowBinned2D(const char* name, const char* title, UShort_t order, 
68                      const AliFMDFlowAxis& xaxis, const AliFMDFlowAxis& yaxis,
69                      AliFMDFlowSplitter* splitter=0);
70       
71   /** Copy constructor */
72   AliFMDFlowBinned2D(const AliFMDFlowBinned2D& other);
73   /** Copy constructor */
74   AliFMDFlowBinned2D& operator=(const AliFMDFlowBinned2D& other);
75   /** Destructor */
76   virtual ~AliFMDFlowBinned2D();
77   
78   /** Called at the beginning of an event */
79   virtual void Begin();
80   /** Called at the end of an event */ 
81   virtual void End();
82   /** Called to add a contribution to the event plane 
83       @param x   Bin to fill into 
84       @param y   Bin to fill into 
85       @param phi The angle @f$ \varphi@f$ in radians 
86       @param w   Weight
87       @param a   If true, add to sub-event A, otherwise sub-event B */ 
88   virtual Bool_t AddToEventPlane(Double_t x, Double_t y, Double_t phi, 
89                                  Double_t w, Bool_t a);
90   /** Called to add a contribution to the harmonic
91       @param x   Bin to fill into 
92       @param y   Bin to fill into 
93       @param phi The angle @f$ \varphi@f$ in radians 
94       @param wp  The event plane angle weight
95       @param wh  The harmonic weight */
96   virtual Bool_t AddToHarmonic(Double_t x, Double_t y, Double_t phi, 
97                                Double_t wp, Double_t wh);
98   /** Process a full event. 
99       @param phis List of @a n @f$ \varphi=[0,2\pi]@f$ angles 
100       @param xs   List of @a n @f$ x@f$ values. 
101       @param ys   List of @a n @f$ y@f$ values. 
102       @param wp   Weights for event plane
103       @param wh   Weights for harmonic
104       @param n    Size of @a phis and @a xs */
105   virtual void Event(ULong_t n, Double_t* phis, Double_t* xs, Double_t* ys, 
106                      Double_t* wp=0, Double_t* wh=0);
107   /** Called at the end of a run */
108   virtual void Finish();
109   /** Get the bin at @a x 
110       @param x The bin value to find a flow object for. 
111       @param y The bin value to find a flow object for. 
112       @return The flow object at @a x,y or 0 if out of range */ 
113   virtual AliFMDFlowBin* GetBin(Double_t x, Double_t y) const;
114   /** Get the bin at @a x 
115       @param i The bin index to find a flow object for. 
116       @param j The bin index to find a flow object for. 
117       @return The flow object at @a i,j or 0 if out of range */ 
118   virtual AliFMDFlowBin* GetBin(UShort_t i, UShort_t j) const;
119   /** Whether this is to be considered a folder */
120   Bool_t IsFolder() const { return kTRUE; }
121   /** Browse this object */ 
122   void Browse(TBrowser* b);
123 protected:
124   /** X axis */ 
125   AliFMDFlowAxis fXAxis; // X axis
126   /** Y axis */ 
127   AliFMDFlowAxis fYAxis; // Y axis
128   /** Array of the flow objects */ 
129   AliFMDFlowBin** fBins;  // Bins 
130   /** The event splitter used. */
131   AliFMDFlowSplitter* fSplitter;
132   /** Define for ROOT I/O */
133   ClassDef(AliFMDFlowBinned2D,1);
134 };
135
136
137 #endif
138 //
139 // EOF
140 //
141