]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AliFMDCorrSecondaryMap.h
More code clean up.
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliFMDCorrSecondaryMap.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_ALIFMDCORRSECONDARYMAP_H
6 #define ALIROOT_PWG2_FORWARD_ANALYSIS_ALIFMDCORRSECONDARYMAP_H
7 #include <TObject.h>
8 #include <TObjArray.h>
9 #include <TAxis.h>
10 class TH2D;
11
12 /**
13  * This class contains the secondary correction.
14  *
15  * The secondary correction is given by 
16  * @f[
17  *   c_{r,v}(\eta,\varphi) = 
18  *      \frac{\sum_i N_{ch,i,v,\mbox{primary}}(\eta,\varphi)}{
19  *            \sum_i N_{ch,i,r,v,\mbox{FMD}}(\eta,\varphi)}
20  * @f]
21  * where @f$N_{ch,i,v,\mbox{primary}}(\eta,\varphi)@f$ is the 
22  * is the number of primary charged particles that fall within
23  * the @f$(\eta,\varphi)@f$ bin in event @f$i@f$ with vertex @f$v@f$, 
24  * and is the total (primary <i>and</i> secondary) charged particles 
25  * that hit ring @f$r@f$ within @f$(\eta,\varphi)@f$ bin in event 
26  * @f$i@f$ with vertex @f$v@f$. 
27  *
28  * These are generated from Monte-Carlo truth information. 
29  *
30  * @ingroup pwg2_forward_corr
31  */
32 class AliFMDCorrSecondaryMap : public TObject 
33 {
34 public:
35   /** 
36    * Default constructor 
37    */
38   AliFMDCorrSecondaryMap();
39   /** 
40    * Copy constructor 
41    * 
42    * @param o Object to copy from 
43    */
44   AliFMDCorrSecondaryMap(const AliFMDCorrSecondaryMap& o);
45   /**
46    * Destructor 
47    * 
48    */
49   virtual ~AliFMDCorrSecondaryMap();
50   /** 
51    * @{ 
52    * @name Get corrections and parameters 
53    */
54   /** 
55    * Assignment operator 
56    * 
57    * @param o Object to assign from 
58    * 
59    * @return Reference to this object 
60    */
61   AliFMDCorrSecondaryMap& operator=(const AliFMDCorrSecondaryMap& o);
62   /** 
63    * Get the secondary correction @f$ c_{r,v}@f$ 
64    *
65    * @param d  Detector number (1-3)
66    * @param r  Ring identifier (I or O)
67    * @param v  Primary interaction point @f$z@f$ coordinate
68    * 
69    * @return The correction @f$ c_{r,v}@f$ 
70    */
71   TH2D* GetCorrection(UShort_t d, Char_t r, Double_t v) const;
72   /** 
73    * Get the secondary correction @f$ c_{r,v}@f$ 
74    *
75    * @param d  Detector number (1-3)
76    * @param r  Ring identifier (I or O)
77    * @param b  Bin corresponding to the primary interaction point 
78    *           @f$z@f$ coordinate (1 based)
79    * 
80    * @return The correction @f$ c_{r,v}@f$ 
81    */
82   TH2D* GetCorrection(UShort_t d, Char_t r, UShort_t b) const;
83   /** 
84    * Get the vertex axis used 
85    * 
86    * @return vertex axis 
87    */
88   const TAxis& GetVertexAxis() const { return fVertexAxis; }
89   /** 
90    * Get the eta axis used 
91    * 
92    * @return eta axis 
93    */
94   const TAxis& GetEtaAxis() const { return fEtaAxis; }
95   /* @} */
96
97   /** 
98    * @{ 
99    * @name Set corrections and parameters 
100    */
101   /** 
102    * Set the secondary map correction @f$ c_{r,v}(\eta,\varphi)@f$.
103    * Note, that the object takes ownership of the passed pointer.
104    * 
105    * @param d    Detector number (1-3)
106    * @param r    Ring identifier (I or O)
107    * @param v    Primary interaction point @f$z@f$ coordinate  
108    * @param h    @f$ c_{r,v}(\eta,\varphi)@f$ 
109    * 
110    * @return true if operation succeeded 
111    */
112   Bool_t SetCorrection(UShort_t d, Char_t r, Double_t v, TH2D* h);
113   /** 
114    * Set the secondary map correction @f$ c_{r,v}(\eta,\varphi)@f$ 
115    * Note, that the object takes ownership of the passed pointer.
116    * 
117    * @param d    Detector number (1-3)
118    * @param r    Ring identifier (I or O)
119    * @param b    Bin corresponding to the primary interaction point 
120    *             @f$z@f$ coordinate  (1 based)
121    * @param h    @f$ c_{r,v}(\eta,\varphi)@f$ 
122    * 
123    * @return true if operation succeeded 
124    */
125   Bool_t SetCorrection(UShort_t d, Char_t r, UShort_t b, TH2D* h);
126   /** 
127    * Set the vertex axis to use 
128    * 
129    * @param axis Vertex axis 
130    */
131   void SetVertexAxis(const TAxis& axis);
132   /** 
133    * Set the vertex axis to use 
134    * 
135    * @param axis Vertex axis 
136    */
137   void SetVertexAxis(Int_t nBins, Double_t min, Double_t max);
138   /** 
139    * Set the eta axis to use 
140    * 
141    * @param axis Eta axis 
142    */
143   void SetEtaAxis(const TAxis& axis);
144   /** 
145    * Set the eta axis to use 
146    * 
147    * @param axis Eta axis 
148    */
149   void SetEtaAxis(Int_t nBins, Double_t min, Double_t max);
150   /* @} */
151
152   /** 
153    * @{ 
154    * @name Auxiliary member functions 
155    */
156   /** 
157    * Declare this as a folder
158    * 
159    * @return Always true 
160    */
161   Bool_t IsFolder() const { return true; }
162   /** 
163    * Browse this object in the browser
164    * 
165    * @param b 
166    */
167   void Browse(TBrowser* b);
168   /** 
169    * Print this object 
170    * 
171    * @param option 
172    */  
173   void Print(Option_t* option="R") const; //*MENU*
174   /* @} */
175 protected:
176   /** 
177    * Find the vertex bin that corresponds to the passed vertex 
178    * 
179    * @param vertex The interaction points @f$z@f$-coordinate 
180    * 
181    * @return Vertex bin in @f$[1,N_{\box{vertex}}]@f$ or negative if 
182    * out of range 
183    */
184   Int_t FindVertexBin(Double_t vertex) const;
185   /** 
186    * Get the index corresponding to the given ring 
187    * 
188    * @param d Detector
189    * @param r Ring 
190    * 
191    * @return Index (0 based) or negative in case of errors
192    */
193   Int_t GetRingIndex(UShort_t d, Char_t r) const;
194   /** 
195    * Get the ring array corresponding to the specified ring
196    * 
197    * @param d Detector 
198    * @param r Ring 
199    * 
200    * @return Pointer to ring array, or null in case of problems
201    */
202   TObjArray* GetRingArray(UShort_t d, Char_t r) const;
203   /** 
204    * Get the ring array corresponding to the specified ring
205    * 
206    * @param d Detector 
207    * @param r Ring 
208    * 
209    * @return Pointer to ring array, or newly created container 
210    */
211   TObjArray* GetOrMakeRingArray(UShort_t d, Char_t r);
212
213   TObjArray fRingArray;      // Array of per-ring, per-vertex 2nd map
214   TAxis     fVertexAxis;     // The vertex axis 
215   TAxis     fEtaAxis;        // The eta axis
216   ClassDef(AliFMDCorrSecondaryMap,1); // 
217 };
218
219 //____________________________________________________________________
220 inline void 
221 AliFMDCorrSecondaryMap::SetVertexAxis(Int_t nBins, Double_t min, Double_t max)
222 {
223   fVertexAxis.Set(nBins, min, max);
224 }
225 //____________________________________________________________________
226 inline void 
227 AliFMDCorrSecondaryMap::SetVertexAxis(const TAxis& e)
228 {
229   fVertexAxis.Set(e.GetNbins(), e.GetXmin(), e.GetXmax());
230 }
231 //____________________________________________________________________
232 inline void 
233 AliFMDCorrSecondaryMap::SetEtaAxis(Int_t nBins, Double_t min, Double_t max)
234 {
235   fEtaAxis.Set(nBins, min, max);
236 }
237 //____________________________________________________________________
238 inline void 
239 AliFMDCorrSecondaryMap::SetEtaAxis(const TAxis& e)
240 {
241   fEtaAxis.Set(e.GetNbins(), e.GetXmin(), e.GetXmax());
242 }
243 #endif
244 // Local Variables:
245 //  mode: C++
246 // End: