]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDEventPlaneTask.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDEventPlaneTask.cxx
1 //
2 // Calculate the FMD eventplane 
3 //
4 // Inputs:
5 //  - AliAODEvent
6 //
7 // Outputs:
8 //  - AnalysisResults.root
9 //
10 /**
11  * @file   AliFMDEventPlaneTask.cxx
12  * @author Christian Holm Christensen <cholm@master.hehi.nbi.dk>
13  * @date   Thu Feb  7 01:09:40 2013
14  * 
15  * @brief  
16  * 
17  * 
18  * @ingroup pwglf_forward_flow
19  */
20 #include <TList.h>
21 #include <TMath.h>
22 #include "TH2D.h"
23 #include "AliLog.h"
24 #include "TAxis.h"
25 #include "AliAnalysisManager.h"
26 #include "AliFMDEventPlaneTask.h"
27 #include "AliAODHandler.h"
28 #include "AliAODInputHandler.h"
29 #include "AliAODForwardMult.h"
30 #include "AliAODEvent.h"
31 #include "AliAODForwardEP.h"
32
33 ClassImp(AliFMDEventPlaneTask)
34 #if 0
35 ; // For emacs 
36 #endif
37
38 AliFMDEventPlaneTask::AliFMDEventPlaneTask()
39   : AliBaseAODTask(),
40     fEventPlaneFinder(), // EP finder
41     fHistVertexSel()     // Diagnostics histogram
42 {
43   // 
44   // Default constructor
45   //
46   DGUARD(fDebug, 3,"Default CTOR of AliFMDEventPlaneTask");
47 }
48 //_____________________________________________________________________
49 AliFMDEventPlaneTask::AliFMDEventPlaneTask(const char* name) 
50   : AliBaseAODTask(name, "AliFMDEventPlaneTask"),
51     fEventPlaneFinder("eventPlane"), // EP finder
52     fHistVertexSel(0)               // Diagnostics histogram
53 {
54   // 
55   // Constructor
56   //
57   // Parameters:
58   //  name: Name of task
59   //
60   DGUARD(fDebug, 3,"Named CTOR of AliFMDEventPlaneTask: %s", name);
61 }
62 //_____________________________________________________________________
63 Bool_t AliFMDEventPlaneTask::Book()
64 {
65   //
66   // Create output objects
67   //
68   DGUARD(fDebug,1,"Create user objects of AliFMDEventPlaneTask");
69   // Diagnostics histograms
70   fHistVertexSel     = new TH1D("hVertexSel", "Selected vertices", 40, -20, 20);
71
72   fSums->Add(fHistVertexSel);
73
74   // Init of EventPlaneFinder
75   TAxis* pe = new TAxis(200, -4., 6.);
76   fEventPlaneFinder.CreateOutputObjects(fSums);
77   fEventPlaneFinder.SetupForData(*pe);
78
79   return true;
80 }
81 //_____________________________________________________________________
82 Bool_t AliFMDEventPlaneTask::Event(AliAODEvent& aod)
83 {
84   // 
85   // Called each event
86   //
87   // Parameters:
88   //  option: Not used
89   //
90   DGUARD(fDebug,1,"Process an event in AliFMDEventPlaneTask");
91
92   // Reset data members
93   AliAODForwardMult* aodfmult = GetForward(aod);
94   fHistVertexSel->Fill(aodfmult->GetIpZ());
95
96   if (aod.GetRunNumber() != fEventPlaneFinder.GetRunNumber())
97     fEventPlaneFinder.SetRunNumber(aod.GetRunNumber());
98
99   AliAODForwardEP aodep;
100   TH2D& fmdHist = aodfmult->GetHistogram();
101
102   fEventPlaneFinder.FindEventplane(&aod, aodep, &fmdHist, 0);
103
104   return true;
105 }
106 //_____________________________________________________________________
107 Bool_t AliFMDEventPlaneTask::Finalize()
108 {
109   //
110   // Terminate - Called after all events
111   //
112   // Parameters:
113   //  option: Not used
114   //
115   DGUARD(fDebug,1,"Process merged output of AliFMDEventPlaneTask");
116   
117   // Calculations can be done here: Currently there are none
118   // Summed histograms can be found in the list fSums
119   // Output should be stored in the output list fResults
120
121   return true;
122 }
123 //_____________________________________________________________________
124 //
125 //
126 // EOF