]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDCorrVertexBias.h
A better way to specify the Nch axis for the MultDists task.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDCorrVertexBias.h
1 //
2 // This class contains the secondary correction and the double hit
3 // correction used in low-flux events.
4 //
5 #ifndef ALIFMDCORRVERTEXBIAS_H
6 #define ALIFMDCORRVERTEXBIAS_H
7 /**
8  * @file   AliFMDCorrVertexBias.h
9  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
10  * @date   Wed Mar 23 14:01:56 2011
11  * 
12  * @brief  
13  * 
14  * 
15  * @ingroup pwglf_forward_corr
16  */
17 #include <TObject.h>
18 #include <TObjArray.h>
19 #include <TAxis.h>
20 class TH2D;
21
22 /**
23  * This class contains the correction for the bias introduced by
24  * different vertex bins
25  *
26  * The correction is given by 
27  * @f[
28  *   b_{v}(\eta,\varphi) = \frac{1/N_{t}\sum_i^{N_{tv}} N_{ch,i,primary}}{
29  *                               1/N_{v}\sum_i^{N_{v}} N_{ch,i,primary}}
30  * @f]
31  *
32  * where @f$N_{ch,i,primary}@f$ is the number of primary particles in
33  * the given @f$(\eta,\varphi)@f$, and where the denominator sum runs
34  * over all events with a vertex within the given vertex bin, and the
35  * sum in the numerator runs over only events that have a valid
36  * trigger and reconstructed vertex.  @f$ N_{t}@f$ is the number of
37  * events with a valid trigger (but not necessarily a valid vertex).
38  * The vertex information used @f$v@f$ is in all cases the MC truth
39  * vertex
40  *
41  * These are generated from Monte-Carlo truth and ESD information. 
42  *
43  * @ingroup pwglf_forward_corr
44  */
45 class AliFMDCorrVertexBias : public TObject 
46 {
47 public:
48   /** 
49    * Default constructor 
50    */
51   AliFMDCorrVertexBias();
52   /** 
53    * Copy constructor 
54    * 
55    * @param o Object to copy from 
56    */
57   AliFMDCorrVertexBias(const AliFMDCorrVertexBias& o);
58   /**
59    * Destructor 
60    * 
61    */
62   virtual ~AliFMDCorrVertexBias();
63   /** 
64    * @{ 
65    * @name Get corrections and parameters 
66    */
67   /** 
68    * Assignment operator 
69    * 
70    * @param o Object to assign from 
71    * 
72    * @return Reference to this object 
73    */
74   AliFMDCorrVertexBias& operator=(const AliFMDCorrVertexBias& o);
75   /** 
76    * Get the vertex bias correction @f$ b_{v}@f$ 
77    *
78    * @param r  Ring type (I or O)
79    * @param v  Primary interaction point @f$z@f$ coordinate
80    * 
81    * @return The correction @f$ b_{v}@f$ 
82    */
83   TH2D* GetCorrection(Char_t r, Double_t v) const;
84   /** 
85    * Get the vertex bias correction @f$ b_{v}@f$ 
86    *
87    * @param r  Ring type (I or O)
88    * @param b  Bin corresponding to the primary interaction point 
89    *           @f$z@f$ coordinate (1 based)
90    * 
91    * @return The correction @f$ b_{v}@f$ 
92    */
93   TH2D* GetCorrection(Char_t r, UShort_t b) const;
94   /** 
95    * Get the vertex axis used 
96    * 
97    * @return vertex axis 
98    */
99   const TAxis& GetVertexAxis() const { return fVertexAxis; }
100   /* @} */
101
102   /** 
103    * @{ 
104    * @name Set corrections and parameters 
105    */
106   /** 
107    * Set the vertex bias correction @f$ b_{v}(\eta,\varphi)@f$.
108    * Note, that the object takes ownership of the passed pointer.
109    * 
110    * @param r    Ring type (I or O)
111    * @param v    Primary interaction point @f$z@f$ coordinate  
112    * @param h    @f$ b_{v}(\eta,\varphi)@f$ 
113    * 
114    * @return true if operation succeeded 
115    */
116   Bool_t SetCorrection(Char_t r, Double_t v, TH2D* h);
117   /** 
118    * Set the vertex bias correction @f$ b_{v}(\eta,\varphi)@f$ 
119    * Note, that the object takes ownership of the passed pointer.
120    * 
121    * @param r    Ring type (I or O)
122    * @param b    Bin corresponding to the primary interaction point 
123    *             @f$z@f$ coordinate  (1 based)
124    * @param h    @f$ b_{v}(\eta,\varphi)@f$ 
125    * 
126    * @return true if operation succeeded 
127    */
128   Bool_t SetCorrection(Char_t r, UShort_t b, TH2D* h);
129   /** 
130    * Set the vertex axis to use 
131    * 
132    * @param axis Vertex axis 
133    */
134   void SetVertexAxis(const TAxis& axis);
135   /** 
136    * Set the vertex axis to use 
137    * 
138    * @param nBins Number of bins
139    * @param min   Minimum         
140    * @param max   Maximum         
141    */
142   void SetVertexAxis(Int_t nBins, Double_t min, Double_t max);
143   /* @} */
144
145   /** 
146    * @{ 
147    * @name Auxiliary member functions 
148    */
149   /** 
150    * Declare this as a folder
151    * 
152    * @return Always true 
153    */
154   Bool_t IsFolder() const { return true; }
155   /** 
156    * Browse this object in the browser
157    * 
158    * @param b 
159    */
160   void Browse(TBrowser* b);
161   /** 
162    * Print this object 
163    * 
164    * @param option 
165    */  
166   void Print(Option_t* option="R") const; //*MENU*
167   /* @} */
168 protected:
169   /** 
170    * Find the vertex bin that corresponds to the passed vertex 
171    * 
172    * @param vertex The interaction points @f$z@f$-coordinate 
173    * 
174    * @return Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if 
175    * out of range 
176    */
177   Int_t FindVertexBin(Double_t vertex) const;
178   /** 
179    * Get the vertex array corresponding to the specified ring
180    * 
181    * @param v vertex bin (1 based)
182    * 
183    * @return Pointer to vertex array, or null in case of problems
184    */
185   TObjArray* GetVertexArray(UShort_t v) const;
186   /** 
187    * Get the vertex array corresponding to the specified ring
188    * 
189    * @param v vertex bin (1 based)
190    * 
191    * @return Pointer to vertex array, or newly created container 
192    */
193   TObjArray* GetOrMakeVertexArray(UShort_t v);
194
195   TObjArray fVertexArray;    // Array of per-ring, per-vertex 2nd map
196   TAxis     fVertexAxis;     // The vertex axis 
197   ClassDef(AliFMDCorrVertexBias,1); // 
198 };
199
200 //____________________________________________________________________
201 inline void 
202 AliFMDCorrVertexBias::SetVertexAxis(Int_t nBins, Double_t min, Double_t max)
203 {
204   fVertexAxis.Set(nBins, min, max);
205 }
206 //____________________________________________________________________
207 inline void 
208 AliFMDCorrVertexBias::SetVertexAxis(const TAxis& e)
209 {
210   fVertexAxis.Set(e.GetNbins(), e.GetXmin(), e.GetXmax());
211 }
212 #endif
213 // Local Variables:
214 //  mode: C++
215 // End: