]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliForwardFlowTaskQC.h
Updates to Trains. create a job-script to help
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwardFlowTaskQC.h
1 //
2 // Calculate the flow in the forward regions using the Q cumulants method
3 //
4 #ifndef ALIFORWARDFLOWTASKQC_H
5 #define ALIFORWARDFLOWTASKQC_H
6 /**
7  * @file AliForwardFlowTaskQC.h
8  * @author Alexander Hansen
9  * @date   Tue Feb 14 2012
10  * 
11  * @brief
12  * 
13  * 
14  * @ingroup pwglf_forward_flow
15  */
16 #include "AliAnalysisTaskSE.h"
17 #include "TString.h"
18 class AliAODForwardMult;
19 class TH1D;
20 class TH2D;
21 class TH3D;
22 class TAxis;
23
24  /**
25  * @defgroup pwglf_forward_tasks_flow Flow tasks 
26  * @ingroup pwglf_forward_tasks
27  */
28 /**
29  * Calculate the flow in the forward regions using the Q cumulants method
30  *
31  * @par Inputs:
32  *   - AliAODEvent
33  *
34  * Outputs:
35  *   - AnalysisResults.root
36  *
37  * @ingroup pwglf_forward_tasks_flow
38  * @ingroup pwglf_forward_flow
39  *
40  *
41  */
42 class AliForwardFlowTaskQC : public AliAnalysisTaskSE
43 {
44 public:
45   /** 
46    * Constructor 
47    */
48   AliForwardFlowTaskQC();
49   /** 
50    * Constructor
51    * 
52    * @param name Name of task 
53    */
54   AliForwardFlowTaskQC(const char* name);
55   /**
56    * Destructor
57    */
58   virtual ~AliForwardFlowTaskQC() {}
59   /** 
60    * @{ 
61    * @name Task interface methods 
62    */
63   /** 
64    * Create output objects 
65    */
66   virtual void UserCreateOutputObjects();
67   /**
68    * Initialize the task
69    */
70   virtual void Init() {} 
71   /** 
72    * Process each event 
73    *
74    * @param option Not used
75    */  
76   virtual void UserExec(Option_t *option);
77   /** 
78    * End of job
79    * 
80    * @param option Not used 
81    */
82   virtual void Terminate(Option_t *option);
83   /* @} */
84   /**
85    * Loops of vertex bins in list and runs analysis on those for current vertex
86    *
87    * @param list List of vertex bins
88    * @param h dN/detadphi histogram
89    * @param vtx Current vertex bin
90    *
91    * @return true on success
92    */
93   Bool_t FillVtxBinList(const TList& list, const TH2D& h, Int_t vtx) const;
94   /**
95    * Loops over VertexBin list and calls terminate on each
96    *
97    * @param list VertexBin list
98    */
99   void EndVtxBinList(const TList& list) const;
100   /**
101    * Returns the outputlist
102    * 
103    * @return TList* 
104    */
105   TList* GetOutputList() { return fOutputList; }
106   /**
107    * Check AODevent object for trigger, vertex and centrality
108    * returns true if event is OK
109    *
110    * @param aodfm AliAODForwardMultObject
111    * 
112    * @return Bool_t 
113    */
114   Bool_t CheckEvent(const AliAODForwardMult* aodfm);
115   /**
116    * Check trigger from AODForwardMult object
117    * returns true if offline trigger is present
118    *
119    * @param aodfm AliAODForwardMultObject
120    * 
121    * @return Bool_t 
122    */
123   virtual Bool_t CheckTrigger(const AliAODForwardMult* aodfm) const;
124   /**
125    * Check for centrality in AliAODForwardMult object, 
126    * if present return true - also sets fCent value
127    *
128    * @param aodfm AliAODForwardMultObject
129    * 
130    * @return Bool_t 
131    */
132   virtual Bool_t GetCentrality(const AliAODForwardMult* aodfm);
133   /*
134    * Check for vertex in AliAODForwardMult
135    * returns true if in range of fVtxAXis, also sets fVtx value
136    *
137    * @param aodfm AliAODForwardMultObject
138    * 
139    * @return Bool_t 
140    */
141   virtual Bool_t GetVertex(const AliAODForwardMult* aodfm);
142   /**
143    * Set which harmonics to calculate. @f$ v_{1}@f$ to @f$ v_{4}@f$ is
144    * available and calculated as default
145    * 
146    * @param  v1 Do @f$ v_{1}$f$
147    * @param  v2 Do @f$ v_{2}$f$
148    * @param  v3 Do @f$ v_{3}$f$
149    * @param  v4 Do @f$ v_{4}$f$
150    * @param  v5 Do @f$ v_{5}$f$
151    * @param  v6 Do @f$ v_{6}$f$
152    * 
153    * @return void 
154    */
155   void SetDoHarmonics(Bool_t v1 = kTRUE, Bool_t v2 = kTRUE, 
156                       Bool_t v3 = kTRUE, Bool_t v4 = kTRUE,
157                       Bool_t v5 = kTRUE, Bool_t v6 = kTRUE) { 
158     fv[1] = v1; fv[2] = v2; fv[3] = v3; fv[4] = v4; fv[5] = v5; fv[6] = v6;}
159    /*
160    * Set non-default vertex binning and range
161    *
162    * @param axis Use this vtx axis
163    *
164    * @return void
165    */
166   void SetVertexAxis(TAxis* axis) { fVtxAxis = axis; }
167  /**
168   * Nested class to handle cumulant calculations in vertex bins
169   */
170   class VertexBin : public TNamed
171   {
172     public:
173     /*
174      * Constructor
175      */
176     VertexBin();
177     /**
178      * Constructor
179      * 
180      * @param vLow Min vertex z-coordinate
181      * @param vHigh Max vertex z-coordinate
182      * @param moment Flow moment
183      * @param type Data type (FMD/SPD/FMDTR/SPDTR/MC)
184      * @parma sym Data is symmetric in eta
185      */
186     VertexBin(Int_t vLow, Int_t vHigh, 
187               UShort_t moment, TString type,
188               Bool_t sym = kTRUE);
189     /**
190      * Copy constructor 
191      * 
192      * @param o Object to copy from
193      * 
194      * @return VertexBin
195      */
196     VertexBin(const VertexBin& o);
197     /**
198      * Assignment operator 
199      * 
200      * @param VertexBin&
201      * 
202      * @return VertexBin& 
203      */
204     VertexBin& operator=(const VertexBin&);
205     /**
206      * Destructor 
207      */
208     ~VertexBin(){}
209     /**
210      * Add vertex bin output to list
211      * 
212      * @param list Histograms are added to this list
213      * 
214      * @return void 
215      */
216     virtual void AddOutput(TList* list);
217     /**
218      * Fill reference and differential flow histograms for analysis
219      *
220      * @param dNdetadphi 2D data histogram
221      *
222      * @return false if bad event (det. hotspot)
223      */
224     Bool_t FillHists(const TH2D& dNdetadphi);
225     /**
226      * Do cumulants calculations for current event with 
227      * centrality cent
228      * 
229      * @param cent Event centrality
230      * 
231      * @return void 
232      */
233     void CumulantsAccumulate(Double_t cent);
234     /**
235      * Finish cumulants calculations. Takes input and
236      * output lists in case Terminate is called separately
237      * 
238      * @param inlist List with input histograms
239      * @param outlist List with output histograms
240      * 
241      * @return void 
242      */
243     void CumulantsTerminate(TList* inlist, TList* outlist);
244
245     protected:
246     /*
247      * Enumeration for ref/diff histograms
248      */
249     enum { kHmult = 1, kHQnRe, kHQnIm, kHQ2nRe, kHQ2nIm };
250     /*
251      * Enumeration for cumulant histograms
252      */
253     enum { kW2Two = 1, 
254            kW2, 
255            kW4Four, 
256            kW4, 
257            kQnRe, 
258            kQnIm, 
259            kM,
260            kCosphi1phi2, 
261            kSinphi1phi2, 
262            kCosphi1phi2phi3m, 
263            kSinphi1phi2phi3m, 
264            kMm1m2, 
265            kw2two, 
266            kw2, 
267            kw4four, 
268            kw4, 
269            kpnRe, 
270            kpnIm, 
271            kmp, 
272            kCospsi1phi2, 
273            kSinpsi1phi2, 
274            kCospsi1phi2phi3m, 
275            kSinpsi1phi2phi3m,
276            kmpmq, 
277            kCospsi1phi2phi3p, 
278            kSinpsi1phi2phi3p };
279
280     const UShort_t fMoment;    // flow moment 
281     const Int_t    fVzMin;     // z-vertex min must be in whole [cm]
282     const Int_t    fVzMax;     // z-vertex max must be in whoe [cm]
283     TString        fType;      // data type
284     const Bool_t   fSymEta;    // Use forward-backward symmetry, if detector allows it
285     TH2D*          fCumuRef;   // histogram for reference flow
286     TH2D*          fCumuDiff;  // histogram for differential flow
287     TH3D*          fCumuHist;  // histogram for cumulants calculations
288     TH2D*          fdNdedpAcc; // Diagnostics histogram to make acc. maps
289     UShort_t       fDebug;     // Debug flag
290
291     ClassDef(VertexBin, 1); // object for cumulants ananlysis in FMD
292   };
293
294 protected:
295   /** 
296    * Copy constructor 
297    * 
298    * @param o Object to copy from 
299    */
300   AliForwardFlowTaskQC(const AliForwardFlowTaskQC& o);
301   /** 
302    * Assignment operator 
303    * 
304    * @return Reference to this object 
305    */
306   AliForwardFlowTaskQC& operator=(const AliForwardFlowTaskQC&);
307   /*
308    * Initiate vertex bin objects
309    */
310   virtual void InitVertexBins();
311   /*
312    * Initiate diagnostics histograms
313    */
314   virtual void InitHists();
315   /*
316    * Analyze event
317    */
318   virtual Bool_t Analyze();
319   /*
320    * Finalize analysis
321    */
322   virtual void Finalize();
323
324   TAxis*         fVtxAxis;        //  Axis to control vertex binning
325   TList          fBinsFMD;        //  list with FMD VertexBin objects 
326   TList          fBinsSPD;        //  list with SPD VertexBin objects
327   TList*         fSumList;        //  sum list
328   TList*         fOutputList;     //  Output list
329   AliAODEvent*   fAOD;            //  AOD event
330   Bool_t         fv[7];           //  Calculate v_{n} flag
331   Float_t        fVtx;            //  Z vertex bin
332   Double_t       fCent;           //  Centrality
333   TH1D*          fHistCent;       //  Diagnostics hist for centrality
334   TH1D*          fHistVertexSel;  //  Diagnostics hist for selected vertices
335   TH1D*          fHistVertexAll;  //  Diagnostics hist for all vertices
336
337   ClassDef(AliForwardFlowTaskQC, 1); // Analysis task for FMD analysis
338 };
339  
340 #endif
341 // Local Variables:
342 //   mode: C++ 
343 // End: