]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDEventPlaneFinder.h
Renamed some member functions for more logical names
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDEventPlaneFinder.h
1 // This task finds the eventplane
2 // using the FMD
3 // 
4 #ifndef ALIFMDEVENTPLANEFINDER_H 
5 #define ALIFMDEVENTPLANEFINDER_H 
6 /**
7  * @file AliFMDEventPlaneFinder.h
8  * @author Alexander Hansen
9  * @date   Tue Feb 14 2012
10  * 
11  * @brief
12  * 
13  * 
14  * @ingroup pwglf_forward
15  */
16 #include <TNamed.h>
17 #include <TVector2.h>
18 #include "AliForwardUtil.h"
19 class AliVEvent;
20 class TH1D;
21 class TH2F;
22 class TH2D;
23 class TString;
24 class AliOADBContainer;
25 class AliAODForwardEP;
26
27 /**
28  * Find the event plane using the FMD
29  * 
30  */
31 class AliFMDEventPlaneFinder : public TNamed
32 {
33 public:
34   /** 
35    * Constructor 
36    */
37   AliFMDEventPlaneFinder();
38   /** 
39    * Constructor 
40    * 
41    * @param name Name of object
42    */
43   AliFMDEventPlaneFinder(const char* name);
44   /** 
45    * Copy constructor 
46    * 
47    * @param o Object to copy from 
48    */
49   AliFMDEventPlaneFinder(const AliFMDEventPlaneFinder& o);
50   /** 
51    * Destructor 
52    */
53   virtual ~AliFMDEventPlaneFinder();
54   /** 
55    * Assignement operator
56    * 
57    * @param o Object to assign from 
58    * 
59    * @return Reference to this object
60    */
61   AliFMDEventPlaneFinder& operator=(const AliFMDEventPlaneFinder& o);
62   /** 
63    * Initialize this sub-algorithm
64    * 
65    * @param etaAxis  Eta axis to use 
66    */
67   virtual void SetupForData(const TAxis& etaAxis);
68   /** 
69    * Do the calculations 
70    * 
71    * @param hists    Histogram cache
72    * @param esd      Event 
73    * @param aodEp    Output object 
74    * @param h        Output histogram
75    * 
76    * @return true on successs 
77    */
78   Bool_t FindEventplane(AliVEvent* esd,
79                         AliAODForwardEP& aodEp,
80                         TH2D* h,
81                         AliForwardUtil::Histos* hists);
82   /** 
83    * Output diagnostic histograms to directory 
84    * 
85    * @param dir List to write in
86    */  
87   virtual void CreateOutputObjects(TList* dir);
88   /** 
89    * Print information 
90    * 
91    * @param option Print options 
92    *   - max  Print max weights 
93    */
94   void Print(Option_t* option="") const;
95   /** 
96    * Set the debug level.  The higher the value the more output 
97    * 
98    * @param dbg Debug level 
99    */
100   void SetDebug(Int_t dbg=1) { fDebug = dbg; }
101   /**
102    * Calculate Q vectors
103    *
104    * @param h dN/detadphi histogram
105    * @param eHist histogram for ep vs. eta
106    */
107   void CalcQVectors(TH2D* h, TH1D* eHist);
108   /**
109    * Calculate the eventplane from a vector
110    *
111    * @param v TVector2 of Q-vectors
112    *
113    * @return the eventplane as a double
114    */
115   Double_t CalcEventplane(const TVector2& v) const;
116   /**
117    * Set the run number, used for OADB object
118    *
119    * @param run Run number
120    */
121   void SetRunNumber(Int_t run);
122   /**
123    * Get the run number
124    *
125    * @return returns the run number
126    */
127   Int_t GetRunNumber() { return fRunNumber; }
128   /**
129    * Get the OADB phi distribution for flattening
130    */
131   void GetPhiDist();
132   /**
133    * Flag for setting the use of phi weights for flattening
134    * 
135    * @param use true or false
136    */
137   void SetUsePhiWeights(Bool_t use = kTRUE) { fUsePhiWeights = use; }
138   /**
139    * Fill diagnostics hists
140    *
141    * @param fmdEP Object containing results of FMD EP calculations
142    */
143   void FillHists(AliAODForwardEP* fmdEP);
144   /**
145    * Set the OADB path, for using a custom OADB path and file
146    *
147    * @param fname Name of the custom OADB file, including path
148    */
149   void SetOADBPath(Char_t* fname) { fOADBFileName = fname; }
150
151 protected:
152   /**
153    * Get the phi weight from OADB histogram for the ep flattening
154    *
155    * @param etaBin which eta bin
156    * @param phiBin which phi bin
157    *
158    * @return phi weight for etaBin, phiBin as double
159    */
160   Double_t GetPhiWeight(Int_t etaBin, Int_t phiBin) const;
161   /** 
162    * Calculat the difference @f$a_1 - a_2@f$ between two angles
163    * @f$a_1, a_2@f$ and normalize to @f$[-\pi/2,\pi/2]@f$
164    * 
165    * @param a1 First angle @f$a_1@f$
166    * @param a2 Second angle @f$a_2@f$
167    * 
168    * @return @f$a_1 - a_2 \in[-\pi/2,\pi/2]@f$
169    */
170   Double_t CalcDifference(Double_t a1, Double_t a2) const;
171   /** 
172    * Make a histogram of @f$\Psi_R@f$ values 
173    * 
174    * @param name   Name of histogram
175    * @param title  Source 
176    * @param color  Color of histogram 
177    * 
178    * @return Newly allocated histogram
179    */
180   TH1D* MakePsiRHist(const char* name, 
181                      const char* title,
182                      Int_t color);
183   /** 
184    * Make a difference histogram, and add to the output list
185    * 
186    * @param name    Name of histogram
187    * @param first   First variable to correlate (X axis)
188    * @param second  Second variable to correlate (Y axis)
189    * @param color   Fill and line color of histogram
190    * 
191    * @return Newly allocated histogram
192    */
193   TH1D* MakeDiffHist(const char* name, 
194                      const char* first,
195                      const char* second,
196                      Int_t color);
197   /** 
198    * Make a correlation histogram, and add it to the output list.
199    * 
200    * @param name    Name of histogram
201    * @param first   First variable to correlate (X axis)
202    * @param second  Second variable to correlate (Y axis)
203    * 
204    * @return Newly allocated histogram 
205    */
206   TH2F* MakeCorrHist(const char* name, 
207                      const char* first,
208                      const char* second);
209   TList*            fList;               // List for diag. hists.
210   AliVEvent*        fEvent;              // Current event
211   TVector2          fQt;                 // Q vector for total ep
212   TVector2          fQa;                 // Q vector for sub-ep A
213   TVector2          fQc;                 // Q vector for sub-ep C
214   TVector2          fQ1;                 // Q vector for sub-ep 1
215   TVector2          fQ2;                 // Q vector for sub-ep 2
216   TVector2          fQeta;               // Q vector for psi eta-dependence
217   TH1D*             fHepFMD;             // Diagnostics histogram
218   TH1D*             fHepFMDA;            // Diagnostics histogram
219   TH1D*             fHepFMDC;            // Diagnostics histogram
220   TH1D*             fHepFMDQC1;          // Diagnostics histogram
221   TH1D*             fHepFMDQC2;          // Diagnostics histogram
222   TH1D*             fHdiffFMDAC;         // Diagnostics histogram
223   TH1D*             fHdiffFMDTPC;        // Diagnostics histogram
224   TH1D*             fHdiffFMDVZERO;      // Diagnostics histogram
225   TH2F*             fHcorrFMDAC;         // Diagnostics histogram
226   TH2F*             fHcorrFMDTPC;        // Diagnostics histogram
227   TH2F*             fHcorrFMDVZERO;      // Diagnostics histogram
228   TH2D*             fHPhi;               // Diagnostics histogram
229   Int_t             fDebug;              // Debug flag
230   TString           fOADBFileName;       // Path to OADB container
231   AliOADBContainer* fOADBContainer;      // OADBContainer object
232   TH2D*             fPhiDist;            // Phi dist. for phi weights
233   Int_t             fRunNumber;          // Run number supplied
234   Bool_t            fUsePhiWeights;      // Flag for phi weights
235
236   ClassDef(AliFMDEventPlaneFinder,2); //  
237 };
238
239 #endif
240 // Local Variables:
241 //   mode: C++
242 // End:
243