]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDCorrAcceptance.h
Mega commit of many changes to PWGLFforward
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDCorrAcceptance.h
1 //
2 // This class contains the acceptance correction due to dead channels
3 //
4 //
5 #ifndef ALIFMDCORRACCEPTANCE_H
6 #define ALIFMDCORRACCEPTANCE_H
7 /**
8  * @file   AliFMDCorrAcceptance.h
9  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
10  * @date   Wed Mar 23 14:00:40 2011
11  * 
12  * @brief  
13  * 
14  * @ingroup pwglf_forward_corr
15  * 
16  */
17 #include <TObject.h>
18 #include <TObjArray.h>
19 #include <TAxis.h>
20 class TH2D;
21 class TH1D;
22
23 /**
24  * This class contains the acceptance correction due to dead channels
25  *
26  * These are generated from the on-line dead channel calculations 
27  *
28  * @ingroup pwglf_forward_corr
29  */
30 class AliFMDCorrAcceptance : public TObject 
31 {
32 public:
33   /** 
34    * Default constructor 
35    */
36   AliFMDCorrAcceptance();
37   /** 
38    * Copy constructor 
39    * 
40    * @param o Object to copy from 
41    */
42   AliFMDCorrAcceptance(const AliFMDCorrAcceptance& o);
43   /**
44    * Destructor 
45    * 
46    */
47   virtual ~AliFMDCorrAcceptance();
48   /** 
49    * @{ 
50    * @name Get corrections and parameters 
51    */
52   /** 
53    * Assignment operator 
54    * 
55    * @param o Object to assign from 
56    * 
57    * @return Reference to this object 
58    */
59   AliFMDCorrAcceptance& operator=(const AliFMDCorrAcceptance& o);
60   /** 
61    * Get the acceptance correction @f$ a_{r,v}@f$ 
62    *
63    * @param d  Detector number (1-3)
64    * @param r  Ring identifier (I or O)
65    * @param v  Primary interaction point @f$z@f$ coordinate
66    * 
67    * @return The correction @f$ a_{r,v}@f$ 
68    */
69   TH2D* GetCorrection(UShort_t d, Char_t r, Double_t v) const;
70   /** 
71    * Get the acceptance correction @f$ a_{r,v}@f$ 
72    *
73    * @param d  Detector number (1-3)
74    * @param r  Ring identifier (I or O)
75    * @param b  Bin corresponding to the primary interaction point 
76    *           @f$z@f$ coordinate (1 based)
77    * 
78    * @return The correction @f$ a_{r,v}@f$ 
79    */
80   TH2D* GetCorrection(UShort_t d, Char_t r, UShort_t b) const;
81   /** 
82    * Get the phi acceptance 
83    * 
84    * @param d Detector
85    * @param r ring 
86    * @param v vertex 
87    * 
88    * @return 
89    */  
90   TH1D* GetPhiAcceptance(UShort_t d, Char_t r, Double_t v) const;
91   /** 
92    * Get the phi acceptance 
93    * 
94    * @param d Detector 
95    * @param r ring 
96    * @param b vertex bin number 
97    * 
98    * @return 
99    */  
100   TH1D* GetPhiAcceptance(UShort_t d, Char_t r, UShort_t b) const;
101   /** 
102    * Get the vertex axis used 
103    * 
104    * @return vertex axis 
105    */
106   const TAxis& GetVertexAxis() const { return fVertexAxis; }
107   /** 
108    * @return true if the overflow bins along eta are set to the ratio
109    * of OK strips to all strips for a given eta bin.
110    */
111   Bool_t HasOverflow() const { return fHasOverflow; }
112   /* @} */
113
114   /** 
115    * @{ 
116    * @name Set corrections and parameters 
117    */
118   /** 
119    * Set the acceptance correction @f$ a_{r,v}(\eta)@f$.
120    * Note, that the object takes ownership of the passed pointer.
121    * 
122    * @param d    Detector number (1-3)
123    * @param r    Ring identifier (I or O)
124    * @param v    Primary interaction point @f$z@f$ coordinate  
125    * @param h    @f$ a_{r,v}(\eta)@f$ 
126    * 
127    * @return true if operation succeeded 
128    */
129   Bool_t SetCorrection(UShort_t d, Char_t r, Double_t v, TH2D* h);
130   /** 
131    * Set the acceptance correction @f$ a_{r,v}(\eta)@f$ 
132    * Note, that the object takes ownership of the passed pointer.
133    * 
134    * @param d    Detector number (1-3)
135    * @param r    Ring identifier (I or O)
136    * @param b    Bin corresponding to the primary interaction point 
137    *             @f$z@f$ coordinate  (1 based)
138    * @param h    @f$ a_{r,v}(\eta)@f$ 
139    * 
140    * @return true if operation succeeded 
141    */
142   Bool_t SetCorrection(UShort_t d, Char_t r, UShort_t b, TH2D* h);
143   /** 
144    * Set the vertex axis to use 
145    * 
146    * @param axis Vertex axis 
147    */
148   void SetVertexAxis(const TAxis& axis);
149   /** 
150    * Set the vertex axis to use 
151    * 
152    * @param nBins   Number of bins
153    * @param min     Minimum
154    * @param max     Maximum
155    */
156   void SetVertexAxis(Int_t nBins, Double_t min, Double_t max);
157   /** 
158    * Set that we have (or not) the overflow bin present 
159    * 
160    * @param present If true, assume the overflow bins are filled
161    */
162   void SetHasOverflow(Bool_t present=true) { fHasOverflow = present; }
163   /* @} */
164
165   /** 
166    * @{ 
167    * @name Auxiliary member functions 
168    */
169   /** 
170    * Declare this as a folder
171    * 
172    * @return Always true 
173    */
174   Bool_t IsFolder() const { return true; }
175   /** 
176    * Browse this object in the browser
177    * 
178    * @param b 
179    */
180   void Browse(TBrowser* b);
181   /** 
182    * Print this object 
183    * 
184    * @param option 
185    */  
186   void Print(Option_t* option="R") const; //*MENU*
187   void ls(Option_t* option="") const; //*MENU*
188   // void Draw(Option_t* option="");
189   // void SaveAs(const Char_t* filename, Option_t* option="colz") const;
190   /* @} */
191 protected:
192   /** 
193    * Find the vertex bin that corresponds to the passed vertex 
194    * 
195    * @param vertex The interaction points @f$z@f$-coordinate 
196    * 
197    * @return Vertex bin in @f$[1,N_{\mbox{vertex}}]@f$ or negative if 
198    * out of range 
199    */
200   Int_t FindVertexBin(Double_t vertex) const;
201   /** 
202    * Get the index corresponding to the given ring 
203    * 
204    * @param d Detector
205    * @param r Ring 
206    * 
207    * @return Index (0 based) or negative in case of errors
208    */
209   Int_t GetRingIndex(UShort_t d, Char_t r) const;
210   /** 
211    * Get the ring array corresponding to the specified ring
212    * 
213    * @param m Array 
214    * @param d Detector 
215    * @param r Ring 
216    * 
217    * @return Pointer to ring array, or null in case of problems
218    */
219   TObjArray* GetRingArray(const TObjArray& m, UShort_t d, Char_t r) const;
220   /** 
221    * Get the ring array corresponding to the specified ring
222    * 
223    * @param m Array 
224    * @param d Detector 
225    * @param r Ring 
226    * 
227    * @return Pointer to ring array, or newly created container 
228    */
229   TObjArray* GetOrMakeRingArray(TObjArray& m, UShort_t d, Char_t r) const;
230   TObject* GetObject(const TObjArray& m, UShort_t d, 
231                      Char_t r, UShort_t b) const;
232
233   void FillCache() const;
234
235   TObjArray fRingArray;      // Array of per-ring, per-vertex 2d map
236   mutable TObjArray* fCache;  //! Array of per-ring, per-vertex 1d factors
237   TAxis     fVertexAxis;     // The vertex axis 
238   Bool_t    fHasOverflow;    // Whether we have the overflow bin set
239   ClassDef(AliFMDCorrAcceptance,2); // Acceptance correction due to dead areas
240 };
241
242 //____________________________________________________________________
243 inline void 
244 AliFMDCorrAcceptance::SetVertexAxis(Int_t nBins, Double_t min, 
245                                            Double_t max)
246 {
247   fVertexAxis.Set(nBins, min, max);
248 }
249 //____________________________________________________________________
250 inline void 
251 AliFMDCorrAcceptance::SetVertexAxis(const TAxis& e)
252 {
253   fVertexAxis.Set(e.GetNbins(), e.GetXmin(), e.GetXmax());
254 }
255 #endif
256 // Local Variables:
257 //  mode: C++
258 // End: