AliPhysics  48852ec (48852ec)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskCumulants.cxx
Go to the documentation of this file.
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 
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 
27 class TFile;
28 class TList;
29 class AliAnalysisTaskSE;
30 
31 #include "Riostream.h"
32 #include "AliFlowEventSimple.h"
35 
36 using std::cout;
37 using std::endl;
39 
40 //================================================================================================================
41 
42 AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name, Bool_t useWeights):
43 AliAnalysisTaskSE(name),
44 fEvent(NULL),
45 fGFC(NULL),
46 fListHistos(NULL),
47 fHarmonic(2),
48 fMultiple(1),
49 fCalculateVsMultiplicity(kFALSE),
50 fnBinsMult(10000),
51 fMinMult(0.),
52 fMaxMult(10000.),
53 fUseWeights(useWeights),
54 fUsePhiWeights(kFALSE),
55 fUsePtWeights(kFALSE),
56 fUseEtaWeights(kFALSE),
57 fWeightsList(NULL),
58 fTuneParameters(kFALSE)
59 {
60  // Constructor
61  cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants(const char *name, Bool_t useWeights)"<<endl;
62 
63  // Define input and output slots here
64  // Input slot #0 works with an AliFlowEventSimple
65  DefineInput(0, AliFlowEventSimple::Class());
66 
67  // Input slot #1 is needed for the weights input files
68  if(useWeights)
69  {
70  DefineInput(1, TList::Class());
71  }
72  // Output slot #0 is reserved
73  // Output slot #1 writes into a TList container
74  DefineOutput(1, TList::Class());
75 
76  // Initilize arrays:
77  for(Int_t r=0;r<10;r++)
78  {
79  fTuningR0[r] = 0.;
80  }
81 } // end of constructor
82 
85 fEvent(NULL),
86 fGFC(NULL),
87 fListHistos(NULL),
88 fHarmonic(0),
89 fMultiple(0),
90 fCalculateVsMultiplicity(kFALSE),
91 fnBinsMult(0),
92 fMinMult(0.),
93 fMaxMult(0.),
94 fUseWeights(kFALSE),
95 fUsePhiWeights(kFALSE),
96 fUsePtWeights(kFALSE),
97 fUseEtaWeights(kFALSE),
98 fWeightsList(NULL),
99 fTuneParameters(kFALSE)
100 {
101  // Dummy constructor
102  cout<<"AliAnalysisTaskCumulants::AliAnalysisTaskCumulants()"<<endl;
103 
104  // Initilize arrays:
105  for(Int_t r=0;r<10;r++)
106  {
107  fTuningR0[r] = 0.;
108  }
109 }
110 
111 //================================================================================================================
112 
114 {
115  // Called at every worker node to initialize
116  cout<<"AliAnalysisTaskCumulants::UserCreateOutputObjects()"<<endl;
117 
118  // Analyser:
121 
122  // Calculation vs multiplicity:
124  {
129  }
130 
131  // Weights:
132  if(fUseWeights)
133  {
134  // Pass the flags to class:
138  // Get data from input slot #1 which is used for weights:
139  if(GetNinputs()==2)
140  {
141  fWeightsList = (TList*)GetInputData(1);
142  }
143  // Pass the list with weights to class:
145  }
146 
147  // Tuning:
148  if(fTuneParameters)
149  {
151  for(Int_t r=0;r<10;r++) {fGFC->SetTuningR0(fTuningR0[r],r);}
152  }
153 
154  fGFC->Init();
155 
156  if(fGFC->GetHistList())
157  {
159  //fListHistos->Print();
160  } else
161  {
162  Printf("ERROR: Could not retrieve histogram list (GFC, Task::UserCreateOutputObjects()) !!!!");
163  }
164 
165  PostData(1,fListHistos);
166 
167 } // end of void AliAnalysisTaskCumulants::UserCreateOutputObjects()
168 
169 //================================================================================================================
170 
172 {
173  // Main loop (called for each event)
174  fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0));
175 
176  // Generating function cumulants (GFC):
177  if(fEvent)
178  {
179  fGFC->Make(fEvent);
180  } else
181  {
182  cout<<"WARNING: No input data (GFC, Task::UserExec()) !!!!"<<endl;
183  }
184 
185  PostData(1,fListHistos);
186 
187 } // end of void AliAnalysisTaskCumulants::UserExec(Option_t *)
188 
189 //================================================================================================================
190 
192 {
193  // Accessing the output list which contains the merged 2D and 3D profiles from all worker nodes
194  fListHistos = (TList*)GetOutputData(1);
195  //fListHistos->Print();
196 
198 
199  if(fListHistos)
200  {
202  fGFC->Finish();
203  PostData(1,fListHistos);
204  } else
205  {
206  cout<<"WARNING: histogram list pointer is empty (GFC, Task::Terminate()) !!!!"<<endl;
207  cout<<endl;
208  }
209 
210 } // end of void AliAnalysisTaskCumulants::Terminate(Option_t *)
211 
212 
213 
214 
215 
216 
217 
218 
219 
220 
221 
222 
223 
224 
225 
226 
227 
228 
229 
230 
231 
void SetTuningR0(Double_t const tr0, Int_t const r)
void SetHarmonic(Int_t const harmonic)
ClassImp(AliAnalysisTaskCumulants) AliAnalysisTaskCumulants
int Int_t
Definition: External.C:63
void SetCalculateVsMultiplicity(Bool_t const ecvm)
AliFlowAnalysisWithCumulants * fGFC
virtual void Terminate(Option_t *)
virtual void Make(AliFlowEventSimple *anEvent)
const char Option_t
Definition: External.C:48
virtual void GetOutputHistograms(TList *outputListHistos)
bool Bool_t
Definition: External.C:53
virtual void UserExec(Option_t *option)