]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Tasks/AliAnalysisTaskCumulants.cxx
updated timestamps following the timestamps of the new simulation in AMANDA, adding...
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskCumulants.cxx
CommitLineData
924fafb7 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* *
7* Permission to use, copy, modify and distribute this software and its *
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
2188af53 16/**************************************
17 * analysis task for cumulant method *
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
2ed70edf 27class TFile;
28class TList;
29class AliAnalysisTaskSE;
30
2188af53 31#include "Riostream.h"
7183fe85 32#include "AliFlowEventSimple.h"
924fafb7 33#include "AliAnalysisTaskCumulants.h"
924fafb7 34#include "AliFlowAnalysisWithCumulants.h"
35
924fafb7 36ClassImp(AliAnalysisTaskCumulants)
37
2188af53 38//================================================================================================================
39
7183fe85 40AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name, Bool_t useWeights):
2ed70edf 41AliAnalysisTaskSE(name),
42fEvent(NULL),
43fGFC(NULL),
44fListHistos(NULL),
3688e459 45fHarmonic(2),
46fMultiple(1),
47fCalculateVsMultiplicity(kFALSE),
48fnBinsMult(10000),
49fMinMult(0.),
50fMaxMult(10000.),
2ed70edf 51fUseWeights(useWeights),
52fUsePhiWeights(kFALSE),
53fUsePtWeights(kFALSE),
54fUseEtaWeights(kFALSE),
3688e459 55fWeightsList(NULL),
56fTuneParameters(kFALSE)
924fafb7 57{
2ed70edf 58 // Constructor
59 cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name, Bool_t useWeights)"<<endl;
fe488c8a 60
61 // Define input and output slots here
2ed70edf 62 // Input slot #0 works with an AliFlowEventSimple
7183fe85 63 DefineInput(0, AliFlowEventSimple::Class());
e5e75b58 64
2ed70edf 65 // Input slot #1 is needed for the weights input files
66 if(useWeights)
e5e75b58 67 {
68 DefineInput(1, TList::Class());
69 }
2ed70edf 70 // Output slot #0 is reserved
71 // Output slot #1 writes into a TList container
3688e459 72 DefineOutput(1, TList::Class());
73
74 // Initilize arrays:
75 for(Int_t r=0;r<10;r++)
76 {
77 fTuningR0[r] = 0.;
78 }
79} // end of constructor
2188af53 80
7183fe85 81AliAnalysisTaskCumulants::AliAnalysisTaskCumulants():
2ed70edf 82AliAnalysisTaskSE(),
83fEvent(NULL),
84fGFC(NULL),
85fListHistos(NULL),
3688e459 86fHarmonic(0),
87fMultiple(0),
88fCalculateVsMultiplicity(kFALSE),
89fnBinsMult(0),
90fMinMult(0.),
91fMaxMult(0.),
2ed70edf 92fUseWeights(kFALSE),
93fUsePhiWeights(kFALSE),
94fUsePtWeights(kFALSE),
95fUseEtaWeights(kFALSE),
3688e459 96fWeightsList(NULL),
97fTuneParameters(kFALSE)
aaebd73d 98{
2ed70edf 99 // Dummy constructor
2188af53 100 cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants()"<<endl;
3688e459 101
102 // Initilize arrays:
103 for(Int_t r=0;r<10;r++)
104 {
105 fTuningR0[r] = 0.;
106 }
2188af53 107}
108
109//================================================================================================================
924fafb7 110
2ed70edf 111void AliAnalysisTaskCumulants::UserCreateOutputObjects()
924fafb7 112{
2ed70edf 113 // Called at every worker node to initialize
114 cout<<"AliAnalysisTaskCumulants::UserCreateOutputObjects()"<<endl;
2188af53 115
2ed70edf 116 // Analyser:
50fe33aa 117 fGFC = new AliFlowAnalysisWithCumulants();
118 fGFC->SetHarmonic(fHarmonic);
e5e75b58 119
3688e459 120 // Calculation vs multiplicity:
121 if(fCalculateVsMultiplicity)
122 {
123 fGFC->SetCalculateVsMultiplicity(fCalculateVsMultiplicity);
124 fGFC->SetnBinsMult(fnBinsMult);
125 fGFC->SetMinMult(fMinMult);
126 fGFC->SetMaxMult(fMaxMult);
127 }
128
2ed70edf 129 // Weights:
e5e75b58 130 if(fUseWeights)
131 {
2ed70edf 132 // Pass the flags to class:
133 if(fUsePhiWeights) fGFC->SetUsePhiWeights(fUsePhiWeights);
134 if(fUsePtWeights) fGFC->SetUsePtWeights(fUsePtWeights);
135 if(fUseEtaWeights) fGFC->SetUseEtaWeights(fUseEtaWeights);
136 // Get data from input slot #1 which is used for weights:
e5e75b58 137 if(GetNinputs()==2)
138 {
3688e459 139 fWeightsList = (TList*)GetInputData(1);
e5e75b58 140 }
2ed70edf 141 // Pass the list with weights to class:
3688e459 142 if(fWeightsList) fGFC->SetWeightsList(fWeightsList);
e5e75b58 143 }
2188af53 144
3688e459 145 // Tuning:
146 if(fTuneParameters)
147 {
148 fGFC->SetTuneParameters(fTuneParameters);
149 for(Int_t r=0;r<10;r++) {fGFC->SetTuningR0(fTuningR0[r],r);}
150 }
151
2ed70edf 152 fGFC->Init();
153
154 if(fGFC->GetHistList())
2188af53 155 {
2ed70edf 156 fListHistos = fGFC->GetHistList();
2188af53 157 //fListHistos->Print();
2ed70edf 158 } else
159 {
160 Printf("ERROR: Could not retrieve histogram list (GFC, Task::UserCreateOutputObjects()) !!!!");
161 }
61e0c8c0 162
163 PostData(1,fListHistos);
2ed70edf 164
165} // end of void AliAnalysisTaskCumulants::UserCreateOutputObjects()
2188af53 166
167//================================================================================================================
924fafb7 168
2ed70edf 169void AliAnalysisTaskCumulants::UserExec(Option_t *)
924fafb7 170{
2ed70edf 171 // Main loop (called for each event)
7183fe85 172 fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
aaebd73d 173
2ed70edf 174 // Generating function cumulants (GFC):
7183fe85 175 if(fEvent)
176 {
2ed70edf 177 fGFC->Make(fEvent);
178 } else
179 {
180 cout<<"WARNING: No input data (GFC, Task::UserExec()) !!!!"<<endl;
181 }
7183fe85 182
2ed70edf 183 PostData(1,fListHistos);
184
185} // end of void AliAnalysisTaskCumulants::UserExec(Option_t *)
924fafb7 186
2188af53 187//================================================================================================================
188
924fafb7 189void AliAnalysisTaskCumulants::Terminate(Option_t *)
aaebd73d 190{
2ed70edf 191 // Accessing the output list which contains the merged 2D and 3D profiles from all worker nodes
192 fListHistos = (TList*)GetOutputData(1);
2188af53 193 //fListHistos->Print();
194
2ed70edf 195 fGFC = new AliFlowAnalysisWithCumulants();
fd46c3dd 196
2188af53 197 if(fListHistos)
52021ae2 198 {
2ed70edf 199 fGFC->GetOutputHistograms(fListHistos);
200 fGFC->Finish();
201 PostData(1,fListHistos);
fd46c3dd 202 } else
203 {
2ed70edf 204 cout<<"WARNING: histogram list pointer is empty (GFC, Task::Terminate()) !!!!"<<endl;
fd46c3dd 205 cout<<endl;
206 }
2ed70edf 207
208} // end of void AliAnalysisTaskCumulants::Terminate(Option_t *)
aaebd73d 209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
924fafb7 225
924fafb7 226
924fafb7 227
924fafb7 228
c75fdbdc 229