]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskQCumulants.cxx
Rename method Dump to DumpPayLoad to avoid compilation warning since mother class...
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskQCumulants.cxx
CommitLineData
bc92c0cb 1/*************************************************************************
2* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
52021ae2 7* Permission to use, copy, modify and distribute this software and its *
bc92c0cb 8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16/**************************************
17 * analysis task for Q-cumulants *
18 * *
19 * authors: Naomi van der Kolk *
20 * (kolk@nikhef.nl) *
21 * Raimond Snellings *
22 * (snelling@nikhef.nl) *
23 * Ante Bilandzic *
24 * (anteb@nikhef.nl) *
25 * ***********************************/
26
27#include "Riostream.h"
28#include "TChain.h"
29#include "TTree.h"
30#include "TFile.h"
31#include "TList.h"
32#include "TH1.h"
e085f1a9 33#include "TGraph.h"
bc92c0cb 34#include "TProfile.h"
35#include "TProfile2D.h"
36#include "TProfile3D.h"
9c1a9547 37#include "TBits.h"
bc92c0cb 38
39#include "AliAnalysisTask.h"
40#include "AliAnalysisDataSlot.h"
41#include "AliAnalysisDataContainer.h"
42#include "AliAnalysisManager.h"
43
7183fe85 44#include "AliFlowEventSimple.h"
bc92c0cb 45#include "AliAnalysisTaskQCumulants.h"
bc92c0cb 46#include "AliFlowAnalysisWithQCumulants.h"
47#include "AliFlowCumuConstants.h"
48#include "AliFlowCommonConstants.h"
7e58a232 49#include "AliFlowCommonHist.h"
bc92c0cb 50#include "AliFlowCommonHistResults.h"
bc92c0cb 51
52ClassImp(AliAnalysisTaskQCumulants)
53
54//================================================================================================================
55
7183fe85 56AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name, Bool_t useWeights):
bc92c0cb 57 AliAnalysisTask(name,""),
7183fe85 58 fEvent(NULL),
59 fQCA(NULL), // Q-cumulant Analysis (QCA) object
77515452 60 fListHistos(NULL),
e04e4ec5 61 fUseWeights(useWeights),
62 fUsePhiWeights(kFALSE),
63 fUsePtWeights(kFALSE),
64 fUseEtaWeights(kFALSE),
65 fListWeights(NULL)
bc92c0cb 66{
7183fe85 67 // constructor
bc92c0cb 68 cout<<"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants(const char *name)"<<endl;
69
70 // Define input and output slots here
71 // Input slot #0 works with a TChain
7183fe85 72 DefineInput(0, AliFlowEventSimple::Class());
bc92c0cb 73
e04e4ec5 74 // Input slot #1 is needed for the weights
75 if(useWeights)
76 {
77 DefineInput(1, TList::Class());
78 }
79
bc92c0cb 80 // Output slot #0 writes into a TList container
81 DefineOutput(0, TList::Class());
e04e4ec5 82
bc92c0cb 83}
84
85AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants():
7183fe85 86 fEvent(NULL),
bc92c0cb 87 fQCA(NULL),//Q-cumulant Analysis (QCA) object
7183fe85 88 fListHistos(NULL),
e04e4ec5 89 fUseWeights(kFALSE),
90 fUsePhiWeights(kFALSE),
91 fUsePtWeights(kFALSE),
92 fUseEtaWeights(kFALSE),
93 fListWeights(NULL)
bc92c0cb 94{
7183fe85 95 // dummy constructor
bc92c0cb 96 cout<<"AliAnalysisTaskQCumulants::AliAnalysisTaskQCumulants()"<<endl;
97}
98
99//================================================================================================================
100
101void AliAnalysisTaskQCumulants::ConnectInputData(Option_t *)
102{
7183fe85 103 // connect ESD or AOD (called once)
bc92c0cb 104 cout<<"AliAnalysisTaskQCumulants::ConnectInputData(Option_t *)"<<endl;
bc92c0cb 105}
106
107//================================================================================================================
108
109void AliAnalysisTaskQCumulants::CreateOutputObjects()
110{
7183fe85 111 // called at every worker node to initialize
bc92c0cb 112 cout<<"AliAnalysisTaskQCumulants::CreateOutputObjects()"<<endl;
113
7183fe85 114 // analyser
bc92c0cb 115 fQCA = new AliFlowAnalysisWithQCumulants();
e085f1a9 116 fQCA->Init();
e04e4ec5 117
118 //weights:
119 if(fUseWeights)
120 {
121 //pass the flags to class:
122 if(fUsePhiWeights) fQCA->SetUsePhiWeights(fUsePhiWeights);
123 if(fUsePtWeights) fQCA->SetUsePtWeights(fUsePtWeights);
124 if(fUseEtaWeights) fQCA->SetUseEtaWeights(fUseEtaWeights);
125 //get data from input slot #1 which is used for weights:
126 if(GetNinputs()==2)
127 {
128 fListWeights = (TList*)GetInputData(1);
129 }
130 //pass the list with weights to class:
131 if(fListWeights) fQCA->SetWeightsList(fListWeights);
132 }
133
bc92c0cb 134 if(fQCA->GetHistList())
135 {
136 fListHistos = fQCA->GetHistList();
137 //fListHistos->Print();
138 }
139 else
140 {
7183fe85 141 Printf(" ERROR: Could not retrieve histogram list (QC, Task::COO)");
bc92c0cb 142 }
e04e4ec5 143
bc92c0cb 144 //PostData(0,fListHistos);
145
146}
147
148//================================================================================================================
149
150void AliAnalysisTaskQCumulants::Exec(Option_t *)
151{
7183fe85 152 // main loop (called for each event)
153 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
154
155 // Q-cumulants
156 if(fEvent)
157 {
158 fQCA->Make(fEvent);
159 }else
160 {
161 cout<<" WARNING: No input data (QC, Task::E) !!!"<<endl;
162 cout<<endl;
bc92c0cb 163 }
164
7183fe85 165 PostData(0,fListHistos);
bc92c0cb 166}
167
168//================================================================================================================
169
170void AliAnalysisTaskQCumulants::Terminate(Option_t *)
8842fb2b 171{
bc92c0cb 172 //accessing the output list which contains the merged 2D and 3D profiles from all worker nodes
173 fListHistos = (TList*)GetOutputData(0);
174 //fListHistos->Print();
77515452 175
fd46c3dd 176 fQCA = new AliFlowAnalysisWithQCumulants();
8842fb2b 177
fd46c3dd 178 if (fListHistos)
179 {
180 fQCA->GetOutputHistograms(fListHistos);
8842fb2b 181 fQCA->Finish();
bc92c0cb 182 }
183 else
184 {
3d824203 185 cout<<" WARNING: histogram list pointer is empty (QC, Task::Terminate())"<<endl;
ae733b3b 186 cout<<endl;
bc92c0cb 187 }
188}
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209