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