]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/FLOW/Base/AliFlowAnalysisWithMultiparticleCorrelations.cxx
add correlation coefficient equal to 1 in case of propagation of fully correlated...
[u/mrichter/AliRoot.git] / PWG / FLOW / Base / AliFlowAnalysisWithMultiparticleCorrelations.cxx
CommitLineData
37d2f768 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 * flow analysis with multi-particle *
18 * correlations *
19 * *
20 * author: Ante Bilandzic *
21 * (abilandzic@gmail.com) *
22 ************************************/
23
24#define AliFlowAnalysisWithMultiparticleCorrelations_cxx
25
26#include "AliFlowAnalysisWithMultiparticleCorrelations.h"
27
28using std::endl;
29using std::cout;
30using std::flush;
31
32//================================================================================================================
33
34ClassImp(AliFlowAnalysisWithMultiparticleCorrelations)
35
36AliFlowAnalysisWithMultiparticleCorrelations::AliFlowAnalysisWithMultiparticleCorrelations():
37 // 0.) Base:
38 fHistList(NULL),
7ecb5af4 39 fInternalFlagsPro(NULL),
40 fUseInternalFlags(kFALSE),
41 fMinNoRPs(-44),
42 fMaxNoRPs(-44),
43 fExactNoRPs(-44),
37d2f768 44 // 1.) Control histograms:
45 fControlHistogramsList(NULL),
7ecb5af4 46 fControlHistogramsFlagsPro(NULL),
9efbd2f5 47 fFillControlHistograms(kFALSE),
48 fFillKinematicsHist(kFALSE),
49 fFillMultDistributionsHist(kFALSE),
50 fFillMultCorrelationsHist(kFALSE),
7ecb5af4 51 // 2.) Q-vector:
9efbd2f5 52 fQvectorList(NULL),
53 fQvectorFlagsPro(NULL),
54 fCalculateQvector(kFALSE),
68a8e667 55 fCalculateDiffQvectors(kFALSE),
7ecb5af4 56 // 3.) Correlations:
57 fCorrelationsList(NULL),
58 fCorrelationsFlagsPro(NULL),
6696a113 59 fCalculateCorrelations(kFALSE),
60 fMaxHarmonic(6), // TBI this shall not be hardwired in the ideal world...
61 fMaxCorrelator(8),
62 fCalculateIsotropic(kFALSE),
63 fCalculateSame(kFALSE),
64 fSkipZeroHarmonics(kFALSE),
65 fCalculateSameIsotropic(kFALSE),
66 fCalculateAll(kFALSE),
67 fDontGoBeyond(0),
68a8e667 68 fCalculateOnlyForHarmonicQC(kFALSE),
69 fCalculateOnlyForSC(kFALSE),
70 fCalculateOnlyCos(kFALSE),
71 fCalculateOnlySin(kFALSE),
72 // 4.) Event-by-event cumulants:
73 fEbECumulantsList(NULL),
74 fEbECumulantsFlagsPro(NULL),
75 fCalculateEbECumulants(kFALSE),
7ecb5af4 76 // 5.) Weights:
77 fWeightsList(NULL),
78 fWeightsFlagsPro(NULL),
7ecb5af4 79 // 6.) Nested loops:
80 fNestedLoopsList(NULL),
81 fNestedLoopsFlagsPro(NULL),
82 fCrossCheckWithNestedLoops(kFALSE),
68a8e667 83 fCrossCheckDiffWithNestedLoops(kFALSE),
7ecb5af4 84 fNestedLoopsResultsCosPro(NULL),
85 fNestedLoopsResultsSinPro(NULL),
68a8e667 86 fNestedLoopsDiffResultsPro(NULL),
7ecb5af4 87 // 7.) 'Standard candles':
88 fStandardCandlesList(NULL),
89 fStandardCandlesFlagsPro(NULL),
90 fCalculateStandardCandles(kFALSE),
68a8e667 91 fPropagateErrorSC(kTRUE),
6d19c373 92 fStandardCandlesHist(NULL),
68a8e667 93 fProductsSCPro(NULL),
94 // 8.) Q-cumulants:
95 fQcumulantsList(NULL),
96 fQcumulantsFlagsPro(NULL),
97 fCalculateQcumulants(kFALSE),
98 fHarmonicQC(2),
99 fPropagateErrorQC(kTRUE),
100 fQcumulantsHist(NULL),
101 fReferenceFlowHist(NULL),
102 fProductsQCPro(NULL),
103 // 9.) Differential correlations:
104 fDiffCorrelationsList(NULL),
105 fDiffCorrelationsFlagsPro(NULL),
106 fCalculateDiffCorrelations(kFALSE),
107 fDiffBinNo(-1)
37d2f768 108 {
109 // Constructor.
110
111 // a) Book grandmother of all lists;
112 // b) Initialize all arrays.
113
114 // a) Book grandmother of all lists:
115 fHistList = new TList();
116 fHistList->SetName("cobjMPC");
117 fHistList->SetOwner(kTRUE);
118
119 // b) Initialize all arrays:
120 this->InitializeArraysForControlHistograms();
7ecb5af4 121 this->InitializeArraysForQvector();
122 this->InitializeArraysForCorrelations();
68a8e667 123 this->InitializeArraysForEbECumulants();
124 this->InitializeArraysForWeights();
125 this->InitializeArraysForQcumulants();
126 this->InitializeArraysForDiffCorrelations();
7ecb5af4 127
37d2f768 128 } // end of AliFlowAnalysisWithMultiparticleCorrelations::AliFlowAnalysisWithMultiparticleCorrelations()
129
130//================================================================================================================
131
132AliFlowAnalysisWithMultiparticleCorrelations::~AliFlowAnalysisWithMultiparticleCorrelations()
133{
134 // Destructor.
135
136 delete fHistList;
137
138} // end of AliFlowAnalysisWithMultiparticleCorrelations::~AliFlowAnalysisWithMultiparticleCorrelations()
139
140//================================================================================================================
141
142void AliFlowAnalysisWithMultiparticleCorrelations::Init()
143{
144 // Well, this is method Init().
145
146 // a) Trick to avoid name clashes, part 1;
147 // b) Cross-check the initial settings before starting this adventure;
148 // c) Book all objects;
149 // d) Set all flags;
150 // *) Trick to avoid name clashes, part 2.
151
152 // a) Trick to avoid name clashes, part 1:
153 Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
154 TH1::AddDirectory(kFALSE);
155
156 // b) Cross-check the initial settings before starting this adventure:
157 this->CrossCheckSettings();
158
159 // c) Book all objects:
160 this->BookAndNestAllLists();
7ecb5af4 161 this->BookEverythingForBase();
37d2f768 162 this->BookEverythingForControlHistograms();
9efbd2f5 163 this->BookEverythingForQvector();
7ecb5af4 164 this->BookEverythingForWeights();
165 this->BookEverythingForCorrelations();
68a8e667 166 this->BookEverythingForEbECumulants();
7ecb5af4 167 this->BookEverythingForNestedLoops();
168 this->BookEverythingForStandardCandles();
68a8e667 169 this->BookEverythingForQcumulants();
170 this->BookEverythingForDiffCorrelations();
37d2f768 171
172 // d) Set all flags:
173 // ...
174
175 // *) Trick to avoid name clashes, part 2:
176 TH1::AddDirectory(oldHistAddStatus);
177
178} // end of void AliFlowAnalysisWithMultiparticleCorrelations::Init()
179
180//================================================================================================================
181
182void AliFlowAnalysisWithMultiparticleCorrelations::Make(AliFlowEventSimple *anEvent)
183{
184 // Running over data only in this method.
185
7ecb5af4 186 // a) Cross-check internal flags;
6d19c373 187 // b) Cross-check all pointers used in this method;
188 // c) Fill control histograms;
189 // d) Fill Q-vector components;
190 // e) Calculate multi-particle correlations from Q-vector components;
68a8e667 191 // f) Calculate e-b-e cumulants;
192 // g) Reset Q-vector components;
193 // h) Cross-check results with nested loops.
7ecb5af4 194
195 // a) Cross-check internal flags:
196 if(fUseInternalFlags){if(!this->CrossCheckInternalFlags(anEvent)){return;}}
197
6d19c373 198 // b) Cross-check all pointers used in this method:
68a8e667 199 this->CrossCheckPointersUsedInMake(); // TBI shall I call this method first
6d19c373 200
201 // c) Fill control histograms:
7ecb5af4 202 if(fFillControlHistograms){this->FillControlHistograms(anEvent);}
37d2f768 203
6d19c373 204 // d) Fill Q-vector components:
68a8e667 205 if(fCalculateQvector||fCalculateDiffQvectors){this->FillQvector(anEvent);}
7ecb5af4 206
6d19c373 207 // e) Calculate multi-particle correlations from Q-vector components:
6696a113 208 if(fCalculateCorrelations){this->CalculateCorrelations(anEvent);}
68a8e667 209 if(fCalculateDiffCorrelations){this->CalculateDiffCorrelations(anEvent);}
7ecb5af4 210
68a8e667 211 // f) Calculate e-b-e cumulants:
212 if(fCalculateEbECumulants){this->CalculateEbECumulants(anEvent);}
6d19c373 213
68a8e667 214 // g) Reset Q-vector components:
215 if(fCalculateQvector||fCalculateDiffQvectors){this->ResetQvector();}
7ecb5af4 216
68a8e667 217 // h) Cross-check results with nested loops:
7ecb5af4 218 if(fCrossCheckWithNestedLoops){this->CrossCheckWithNestedLoops(anEvent);}
68a8e667 219 if(fCrossCheckDiffWithNestedLoops){this->CrossCheckDiffWithNestedLoops(anEvent);}
7ecb5af4 220
37d2f768 221} // end of AliFlowAnalysisWithMultiparticleCorrelations::Make(AliFlowEventSimple *anEvent)
222
223//=======================================================================================================================
224
225void AliFlowAnalysisWithMultiparticleCorrelations::Finish()
226{
7ecb5af4 227 // Closing the curtains.
228
6696a113 229 // a) Cross-check pointers used in this method;
68a8e667 230 // b) Calculate 'standard candles';
231 // c) Calculate Q-cumulants.
6696a113 232
233 // a) Cross-check pointers used in this method:
234 this->CrossCheckPointersUsedInFinish();
7ecb5af4 235
236 // b) Calculate 'standard candles':
237 if(fCalculateStandardCandles){this->CalculateStandardCandles();}
238
68a8e667 239 // c) Calculate Q-cumulants:
240 if(fCalculateQcumulants){this->CalculateQcumulants();this->CalculateReferenceFlow();}
241
37d2f768 242 // ...
68a8e667 243
6d19c373 244 printf("\n ... Closing the curtains ... \n\n");
37d2f768 245
246} // end of AliFlowAnalysisWithMultiparticleCorrelations::Finish()
247
248//=======================================================================================================================
249
6696a113 250void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckPointersUsedInFinish()
251{
252 // Cross-check all pointers used in method Finish().
253
6d19c373 254 // a) Correlations;
68a8e667 255 // b) 'Standard candles';
256 // c) Q-cumulants.
6d19c373 257
258 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckPointersUsedInFinish()";
259
260 // a) Correlations:
261 if(fCalculateCorrelations)
6696a113 262 {
6d19c373 263 for(Int_t cs=0;cs<2;cs++)
264 {
68a8e667 265 if(fCalculateOnlyCos && 1==cs){continue;}
266 else if(fCalculateOnlySin && 0==cs){continue;}
6d19c373 267 for(Int_t c=0;c<fMaxCorrelator;c++)
268 {
269 if(!fCorrelationsPro[cs][c]){Fatal(sMethodName.Data(),"fCorrelationsPro[%d][%d] is NULL, for one reason or another...",cs,c);}
270 }
271 }
68a8e667 272 if(fCalculateQcumulants && fPropagateErrorQC && !fProductsQCPro)
273 {Fatal(sMethodName.Data(),"fCalculateQcumulants && fPropagateErrorQC && !fProductsQCPro");}
6d19c373 274 } // if(fCalculateCorrelations)
275
276 // b) 'Standard candles':
277 if(fCalculateStandardCandles)
278 {
279 if(!fStandardCandlesHist){Fatal(sMethodName.Data(),"fStandardCandlesHist is NULL, for one reason or another...");}
68a8e667 280 if(fPropagateErrorSC)
281 {
282 if(!fProductsSCPro){Fatal(sMethodName.Data(),"fProductsSCPro is NULL, for one reason or another...");}
283 }
6d19c373 284 } // if(fCalculateStandardCandles)
6696a113 285
68a8e667 286 // c) Q-cumulants:
287 if(fCalculateQcumulants)
288 {
289 if(!fQcumulantsHist){Fatal(sMethodName.Data(),"fQcumulantsHist is NULL, for one reason or another...");}
290 if(!fReferenceFlowHist){Fatal(sMethodName.Data(),"fReferenceFlowHist is NULL, for one reason or another...");}
291 if(fPropagateErrorQC)
292 {
293 if(!fProductsQCPro){Fatal(sMethodName.Data(),"fProductsQCPro is NULL, for one reason or another...");}
294 }
295 } // if(fCalculateQcumulants)
296
6696a113 297} // void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckPointersUsedInFinish()
298
299//=======================================================================================================================
300
6d19c373 301void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckPointersUsedInMake()
302{
303 // Cross-check all pointers used in method Make().
304
305 // a) Correlations;
68a8e667 306 // b) Event-by-event cumulants;
307 // c) ...
6d19c373 308
309 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckPointersUsedInMake()";
310
311 // a) Correlations:
312 if(fCalculateCorrelations)
313 {
314 for(Int_t cs=0;cs<2;cs++)
315 {
68a8e667 316 if(fCalculateOnlyCos && 1==cs){continue;}
317 else if(fCalculateOnlySin && 0==cs){continue;}
6d19c373 318 for(Int_t c=0;c<fMaxCorrelator;c++)
319 {
320 if(!fCorrelationsPro[cs][c]){Fatal(sMethodName.Data(),"fCorrelationsPro[%d][%d] is NULL, for one reason or another...",cs,c);}
321 }
322 }
68a8e667 323 if(fCalculateQcumulants && fPropagateErrorQC && !fProductsQCPro)
324 {Fatal(sMethodName.Data(),"fCalculateQcumulants && fPropagateErrorQC && !fProductsQCPro");}
6d19c373 325 } // if(fCalculateCorrelations)
326
68a8e667 327 // b) Event-by-event cumulants:
328 if(fCalculateEbECumulants)
6d19c373 329 {
68a8e667 330 for(Int_t cs=0;cs<2;cs++)
331 {
332 for(Int_t c=0;c<fMaxCorrelator;c++)
333 {
334 if(!fEbECumulantsPro[cs][c]){Fatal(sMethodName.Data(),"fEbECumulantsPro[%d][%d] is NULL, for one reason or another...",cs,c);}
335 }
336 }
337 } // if(fCalculateEbECumulants)
6d19c373 338
339} // void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckPointersUsedInMake()
340
341//=======================================================================================================================
342
7ecb5af4 343void AliFlowAnalysisWithMultiparticleCorrelations::CalculateStandardCandles()
344{
9efbd2f5 345 // Calculate 'standard candles'.
346
6d19c373 347 // 'Standard candle' (SC) is defined in terms of average (all-event!) correlations as follows:
348 // SC(-n1,-n2,n2,n1) = <<Cos(-n1,-n2,n2,n1)>> - <<Cos(-n1,n1)>>*<<Cos(-n2,n2)>>, n1 > n2.
349
9efbd2f5 350 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CalculateStandardCandles()";
351
68a8e667 352 Int_t nBins = fStandardCandlesHist->GetNbinsX();
353 Int_t nBins2p = fCorrelationsPro[0][1]->GetNbinsX();
354 Int_t nBins4p = fCorrelationsPro[0][3]->GetNbinsX();
355 for(Int_t b=1;b<=nBins;b++)
6d19c373 356 {
68a8e667 357 // Standard candle:
358 Double_t dSCn1n2n2n1 = 0.; // SC(-n1,-n2,n2,n1)
359 Double_t dSCn1n2n2n1Err = 0.; // SC(-n1,-n2,n2,n1) stat. error
360
361 // Correlations:
362 Double_t dCosn1n2n2n1 = 0.; // <<Cos(-n1,-n2,n2,n1)>>
363 Double_t dCosn1n2n2n1Err = 0.; // <<Cos(-n1,-n2,n2,n1)>> stat. error
6d19c373 364 Double_t dCosn1n1 = 0.; // <<Cos(-n1,n1)>>
68a8e667 365 Double_t dCosn1n1Err = 0.; // <<Cos(-n1,n1)>> stat. error
366 Double_t dCosn2n2 = 0.; // <<Cos(-n2,n2)>>
367 Double_t dCosn2n2Err = 0.; // <<Cos(-n2,n2)>> stat. error
368
369 // Labels:
370 TString labeln1n2n2n1 = TString(fStandardCandlesHist->GetXaxis()->GetBinLabel(b)).ReplaceAll("SC","Cos");
371 TString n1 = TString(fStandardCandlesHist->GetXaxis()->GetBinLabel(b))(4);
372 TString n2 = TString(fStandardCandlesHist->GetXaxis()->GetBinLabel(b))(7);
373 if(n1.EqualTo("-") || n1.EqualTo(",")){Fatal(sMethodName.Data(),"n1.EqualTo...");}
374 if(n2.EqualTo("-") || n2.EqualTo(",")){Fatal(sMethodName.Data(),"n2.EqualTo...");}
375 TString labeln1n1 = Form("Cos(-%s,%s)",n1.Data(),n1.Data());
376 TString labeln2n2 = Form("Cos(-%s,%s)",n2.Data(),n2.Data());
377 //cout<<labeln1n2n2n1.Data()<<endl;
378 //cout<<labeln1n1.Data()<<endl;
379 //cout<<labeln2n2.Data()<<endl;
380 //cout<<endl;
381
382 // Access <<Cos(-n1,-n2,n2,n1)>>:
383 for(Int_t b4p=1;b4p<=nBins4p;b4p++)
6d19c373 384 {
68a8e667 385 if(labeln1n2n2n1.EqualTo(fCorrelationsPro[0][3]->GetXaxis()->GetBinLabel(b4p)))
6d19c373 386 {
68a8e667 387 //cout<<labeln1n2n2n1.Data()<<endl;
388 dCosn1n2n2n1 = fCorrelationsPro[0][3]->GetBinContent(b4p);
389 dCosn1n2n2n1Err = fCorrelationsPro[0][3]->GetBinError(b4p);
390 break;
391 }
392 } // for(Int_t b4p=1;b4p<=nBins4p;b4p++)
393 if(TMath::Abs(dCosn1n2n2n1) < 1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(dCosn1n2n2n1) < 1.e-44 !!!!");}
6d19c373 394
68a8e667 395 // Access <<Cos(-n1,n1)>> and <<Cos(-n2,n2)>>:
396 for(Int_t b2p=1;b2p<=nBins2p;b2p++)
6d19c373 397 {
68a8e667 398 if(labeln1n1.EqualTo(fCorrelationsPro[0][1]->GetXaxis()->GetBinLabel(b2p)))
6d19c373 399 {
68a8e667 400 //cout<<labeln1n1.Data()<<endl;
401 dCosn1n1 = fCorrelationsPro[0][1]->GetBinContent(b2p);
402 dCosn1n1Err = fCorrelationsPro[0][1]->GetBinError(b2p);
403 }
404 else if(labeln2n2.EqualTo(fCorrelationsPro[0][1]->GetXaxis()->GetBinLabel(b2p)))
6d19c373 405 {
68a8e667 406 //cout<<labeln2n2.Data()<<endl;
407 dCosn2n2 = fCorrelationsPro[0][1]->GetBinContent(b2p);
408 dCosn2n2Err = fCorrelationsPro[0][1]->GetBinError(b2p);
409 }
410 if(TMath::Abs(dCosn1n1) > 0. && TMath::Abs(dCosn2n2) > 0.){break;} // found 'em both!
411 } // for(Int_t b2p=1;b2p<=nBins2p;b2p++)
412 if(TMath::Abs(dCosn1n1) < 1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(dCosn1n1) < 1.e-44 !!!!");}
413 if(TMath::Abs(dCosn2n2) < 1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(dCosn2n2) < 1.e-44 !!!!");}
414
415 // Calculate standard candles:
416 dSCn1n2n2n1 = dCosn1n2n2n1-dCosn1n1*dCosn2n2;
417
418 // Store the final results:
419 fStandardCandlesHist->SetBinContent(b,dSCn1n2n2n1);
420
421 // Error propagation:
422 if(!fPropagateErrorSC)
423 {
424 fStandardCandlesHist->SetBinError(b,0.);
425 continue;
426 }
427
428 // Access covariances (multiplied by weight dependent prefactor):
429 Double_t wCovCosn1n2n2n1Cosn1n1 = Covariance(labeln1n2n2n1.Data(),labeln1n1.Data(),fProductsSCPro); // weighted Cov(<Cos(-n1,-n2,n2,n1)>,<Cos(-n1,n1)>)
430 Double_t wCovCosn1n2n2n1Cosn2n2 = Covariance(labeln1n2n2n1.Data(),labeln2n2.Data(),fProductsSCPro); // weighted Cov(<Cos(-n1,-n2,n2,n1)>,<Cos(-n2,n2)>)
431 Double_t wCovCosn1n1Cosn2n2 = Covariance(labeln1n1.Data(),labeln2n2.Data(),fProductsSCPro); // weighted Cov(<Cos(-n1,n1)>,<Cos(-n2,n2)>)
432
433 // Explicit error propagation:
434 Double_t dSCn1n2n2n1ErrSquared = pow(dCosn1n1,2.)*pow(dCosn2n2Err,2.) + pow(dCosn2n2,2.)*pow(dCosn1n1Err,2.)
435 + pow(dCosn1n2n2n1Err,2.) + 2.*dCosn1n1*dCosn2n2*wCovCosn1n1Cosn2n2
436 - 2.*dCosn1n1*wCovCosn1n2n2n1Cosn2n2 - 2.*dCosn2n2*wCovCosn1n2n2n1Cosn1n1;
437 if(dSCn1n2n2n1ErrSquared > 0.)
438 {
439 dSCn1n2n2n1Err = pow(dSCn1n2n2n1ErrSquared,0.5);
440 } else{Warning(sMethodName.Data(),"dSCn1n2n2n1ErrSquared > 0. is not satisfied for %s !!!!",labeln1n2n2n1.ReplaceAll("Cos","SC").Data());}
441
442 // Store the final stat. error:
443 fStandardCandlesHist->SetBinError(b,dSCn1n2n2n1Err);
444 } // for(Int_t b=1;b<=nBins;b++)
445
446 return;
7ecb5af4 447
448} // void AliFlowAnalysisWithMultiparticleCorrelations::CalculateStandardCandles()
449
450//=======================================================================================================================
451
452void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForCorrelations()
453{
454 // Initialize all arrays for correlations.
455
6696a113 456 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
7ecb5af4 457 {
6696a113 458 for(Int_t c=0;c<8;c++) // [1p,2p,...,8p]
459 {
460 fCorrelationsPro[cs][c] = NULL;
461 }
7ecb5af4 462 }
463
464} // void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForCorrelations()
465
466//=======================================================================================================================
467
68a8e667 468void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForEbECumulants()
469{
470 // Initialize all arrays for event-by-event cumulants.
471
472 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
473 {
474 for(Int_t c=0;c<8;c++) // [1p,2p,...,8p]
475 {
476 fEbECumulantsPro[cs][c] = NULL;
477 }
478 }
479
480} // void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForEbECumulants()
481
482//=======================================================================================================================
483
484void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForDiffCorrelations()
485{
486 // Initialize all arrays for differential correlations.
487
488 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
489 {
490 for(Int_t c=0;c<4;c++) // [1p,2p,3p,4p]
491 {
492 fDiffCorrelationsPro[cs][c] = NULL;
493 fDiffHarmonics[cs][c] = 0;
494 }
495 }
496
497 // Default values:
498 // Cos, 2p:
499 fDiffHarmonics[1][0] = -2;
500 fDiffHarmonics[1][1] = 2;
501 // Cos, 3p:
502 fDiffHarmonics[2][0] = -3;
503 fDiffHarmonics[2][1] = 1;
504 fDiffHarmonics[2][2] = 2;
505 // Cos, 4p:
506 fDiffHarmonics[3][0] = -2;
507 fDiffHarmonics[3][1] = -2;
508 fDiffHarmonics[3][2] = 2;
509 fDiffHarmonics[3][3] = 2;
510
511} // void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForDiffCorrelations()
512
513//=======================================================================================================================
514
6696a113 515void AliFlowAnalysisWithMultiparticleCorrelations::CalculateCorrelations(AliFlowEventSimple *anEvent)
7ecb5af4 516{
517 // Calculate multi-particle correlations from Q-vector components.
518
68a8e667 519 // a) Calculate all booked multi-particle correlations;
520 // b) Calculate products needed for QC error propagation;
521 // c) Calculate products needed for SC error propagation.
7ecb5af4 522
68a8e667 523 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CalculateCorrelations(AliFlowEventSimple *anEvent)";
524 if(!anEvent){Fatal(sMethodName.Data(),"'anEvent'!?!? You again!!!!");}
6d19c373 525
68a8e667 526 // a) Calculate all booked multi-particle correlations:
6696a113 527 Double_t dMultRP = anEvent->GetNumberOfRPs(); // TBI shall I promote this variable into data member?
68a8e667 528 for(Int_t cs=0;cs<2;cs++) // cos/sin
529 {
530 if(fCalculateOnlyCos && 1==cs){continue;}
531 else if(fCalculateOnlySin && 0==cs){continue;}
532 for(Int_t co=0;co<8;co++) // correlator order (TBI hardwired 8)
533 {
534 if(dMultRP < co+1){break;} // defines min. number of particles in an event for a certain correlator to make sense
535 Int_t nBins = 0;
536 if(fCorrelationsPro[cs][co]){nBins = fCorrelationsPro[cs][co]->GetNbinsX();}
537 else{continue;}
538 for(Int_t b=1;b<=nBins;b++)
539 {
540 TString sBinLabel = fCorrelationsPro[cs][co]->GetXaxis()->GetBinLabel(b);
541 if(sBinLabel.EqualTo("")){break;}
542 Double_t num = CastStringToCorrelation(sBinLabel.Data(),kTRUE);
543 Double_t den = CastStringToCorrelation(sBinLabel.Data(),kFALSE);
544 Double_t weight = den; // TBI: add support for other options for the weight eventually
545 if(den>0.)
546 {
547 fCorrelationsPro[cs][co]->Fill(b-.5,num/den,weight);
548 } else{Warning(sMethodName.Data(),"if(den>0.)");}
549 } // for(Int_t b=1;b<=nBins;b++)
550 } // for(Int_t co=0;co<8;co++) // correlator order (TBI hardwired 8)
551 } // for(Int_t cs=0;cs<=1;cs++) // cos/sin
552
553 // b) Calculate products needed for QC error propagation:
554 if(fCalculateQcumulants && fPropagateErrorQC){this->CalculateProductsOfCorrelations(anEvent,fProductsQCPro);}
555
556 // c) Calculate products needed for SC error propagation:
557 if(fCalculateStandardCandles && fPropagateErrorSC){this->CalculateProductsOfCorrelations(anEvent,fProductsSCPro);}
558
559} // void AliFlowAnalysisWithMultiparticleCorrelations::CalculateCorrelations(AliFlowEventSimple *anEvent)
560
561//=======================================================================================================================
562
563void AliFlowAnalysisWithMultiparticleCorrelations::CalculateDiffCorrelations(AliFlowEventSimple *anEvent)
564{
565 // Calculate differential multi-particle correlations from Q-, p- and q-vector components.
566
567 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CalculateCorrelations(AliFlowEventSimple *anEvent)";
568 if(!anEvent){Fatal(sMethodName.Data(),"'anEvent'!?!? You again!!!!");}
569
570 Int_t nBins = 0; // TBI promote this to data member?
571 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
572 {
573 if(nBins != 0){break;}
574 for(Int_t co=0;co<4;co++) // [1p,2p,3p,4p]
575 {
576 if(fDiffCorrelationsPro[cs][co] && 0==nBins)
577 {
578 nBins = fDiffCorrelationsPro[cs][co]->GetNbinsX();
579 }
580 } // for(Int_t co=0;co<4;co++) // [1p,2p,3p,4p]
581 } // for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
582
583 // TBI: The lines below are genuine, most delicious, spaghetti ever... To be reimplemented (one day).
584 for(Int_t b=1;b<=nBins;b++)
585 {
586 fDiffBinNo = b-1;
587 // <2'>:
588 Double_t num2 = TwoDiff(fDiffHarmonics[1][0],fDiffHarmonics[1][1]).Re();
589 Double_t den2 = TwoDiff(0,0).Re();
590 Double_t w2 = den2; // TBI add support for other options for the weight
591 if(den2>0.){fDiffCorrelationsPro[0][1]->Fill(fDiffCorrelationsPro[0][1]->GetBinCenter(b),num2/den2,w2);}
592 // <3'>:
593 Double_t num3 = ThreeDiff(fDiffHarmonics[2][0],fDiffHarmonics[2][1],fDiffHarmonics[2][2]).Re();
594 Double_t den3 = ThreeDiff(0,0,0).Re();
595 Double_t w3 = den3; // TBI add support for other options for the weight
596 if(den3>0.){fDiffCorrelationsPro[0][2]->Fill(fDiffCorrelationsPro[0][2]->GetBinCenter(b),num3/den3,w3);}
597 // <4'>:
598 Double_t num4 = FourDiff(fDiffHarmonics[3][0],fDiffHarmonics[3][1],fDiffHarmonics[3][2],fDiffHarmonics[3][3]).Re();
599 Double_t den4 = FourDiff(0,0,0,0).Re();
600 Double_t w4 = den4; // TBI add support for other options for the weight
601 if(den4>0.){fDiffCorrelationsPro[0][3]->Fill(fDiffCorrelationsPro[0][3]->GetBinCenter(b),num4/den4,w4);}
602 } // for(Int_t b=1;b<=nBins;b++)
603
604} // void AliFlowAnalysisWithMultiparticleCorrelations::CalculateDiffCorrelations(AliFlowEventSimple *anEvent)
605
606//=======================================================================================================================
607
608Double_t AliFlowAnalysisWithMultiparticleCorrelations::CastStringToCorrelation(const char *string, Bool_t numerator)
609{
610 // Cast string of the generic form Cos/Sin(-n_1,-n_2,...,n_{k-1},n_k) in the corresponding correlation value.
611 // If you issue a call to this method with setting numerator = kFALSE, then you are getting back for free
612 // the corresponding denumerator (a.k.a. weight 'number of combinations').
613
614 // TBI:
615 // a) add protection against cases a la:
616 // string = Cos(-3,-4,5,6,5,6,-3)
617 // method = Six(-3,-4,5,6,5,-3).Re()
618 // b) cross-check with nested loops this method
619
620 Double_t dValue = 0.; // return value
621
622 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CastStringToCorrelation(const char *string, Bool_t numerator)";
623
624 if(!(TString(string).BeginsWith("Cos") || TString(string).BeginsWith("Sin")))
625 {
626 cout<<Form("And the fatal string is... '%s'. Congratulations!!",string)<<endl;
627 Fatal(sMethodName.Data(),"!(TString(string).BeginsWith(...");
628 }
629
630 Bool_t bRealPart = kTRUE;
631 if(TString(string).BeginsWith("Sin")){bRealPart = kFALSE;}
632
633 Int_t n[8] = {0,0,0,0,0,0,0,0}; // harmonics, supporting up to 8p correlations
634 UInt_t whichCorr = 0;
635 for(Int_t t=0;t<=TString(string).Length();t++)
636 {
637 if(TString(string[t]).EqualTo(",") || TString(string[t]).EqualTo(")")) // TBI this is just ugly
638 {
639 n[whichCorr] = string[t-1] - '0';
640 if(TString(string[t-2]).EqualTo("-")){n[whichCorr] = -1*n[whichCorr];}
641 if(!(TString(string[t-2]).EqualTo("-")
642 || TString(string[t-2]).EqualTo(",")
643 || TString(string[t-2]).EqualTo("("))) // TBI relax this eventually to allow two-digits harmonics
644 {
645 cout<<Form("And the fatal string is... '%s'. Congratulations!!",string)<<endl;
646 Fatal(sMethodName.Data(),"!(TString(string[t-2]).EqualTo(...");
647 }
648 whichCorr++;
649 if(whichCorr>=9){Fatal(sMethodName.Data(),"whichCorr>=9");} // not supporting corr. beyond 8p
650 } // if(TString(string[t]).EqualTo(",") || TString(string[t]).EqualTo(")")) // TBI this is just ugly
651 } // for(UInt_t t=0;t<=TString(string).Length();t++)
652
653 switch(whichCorr)
654 {
655 case 1:
656 if(!numerator){dValue = One(0).Re();}
657 else if(bRealPart){dValue = One(n[0]).Re();}
658 else{dValue = One(n[0]).Im();}
659 break;
660
661 case 2:
662 if(!numerator){dValue = Two(0,0).Re();}
663 else if(bRealPart){dValue = Two(n[0],n[1]).Re();}
664 else{dValue = Two(n[0],n[1]).Im();}
665 break;
666
667 case 3:
668 if(!numerator){dValue = Three(0,0,0).Re();}
669 else if(bRealPart){dValue = Three(n[0],n[1],n[2]).Re();}
670 else{dValue = Three(n[0],n[1],n[2]).Im();}
671 break;
672
673 case 4:
674 if(!numerator){dValue = Four(0,0,0,0).Re();}
675 else if(bRealPart){dValue = Four(n[0],n[1],n[2],n[3]).Re();}
676 else{dValue = Four(n[0],n[1],n[2],n[3]).Im();}
677 break;
678
679 case 5:
680 if(!numerator){dValue = Five(0,0,0,0,0).Re();}
681 else if(bRealPart){dValue = Five(n[0],n[1],n[2],n[3],n[4]).Re();}
682 else{dValue = Five(n[0],n[1],n[2],n[3],n[4]).Im();}
683 break;
684
685 case 6:
686 if(!numerator){dValue = Six(0,0,0,0,0,0).Re();}
687 else if(bRealPart){dValue = Six(n[0],n[1],n[2],n[3],n[4],n[5]).Re();}
688 else{dValue = Six(n[0],n[1],n[2],n[3],n[4],n[5]).Im();}
689 break;
690
691 case 7:
692 if(!numerator){dValue = Seven(0,0,0,0,0,0,0).Re();}
693 else if(bRealPart){dValue = Seven(n[0],n[1],n[2],n[3],n[4],n[5],n[6]).Re();}
694 else{dValue = Seven(n[0],n[1],n[2],n[3],n[4],n[5],n[6]).Im();}
695 break;
696
697 case 8:
698 if(!numerator){dValue = Eight(0,0,0,0,0,0,0,0).Re();}
699 else if(bRealPart){dValue = Eight(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]).Re();}
700 else{dValue = Eight(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]).Im();}
701 break;
702
703 default:
704 cout<<Form("And the fatal 'whichCorr' value is... %d. Congratulations!!",whichCorr)<<endl;
705 Fatal(sMethodName.Data(),"switch(whichCorr)");
706 } // switch(whichCorr)
707
708 return dValue;
709
710} // Double_t AliFlowAnalysisWithMultiparticleCorrelations::CastStringToCorrelation(const char *string, Bool_t numerator)
711
712//=======================================================================================================================
713
714void AliFlowAnalysisWithMultiparticleCorrelations::CalculateProductsOfCorrelations(AliFlowEventSimple *anEvent, TProfile2D *profile2D)
715{
716 // Calculate products of multi-particle correlations (needed for error propagation).
717
718 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CalculateProductsOfCorrelations(AliFlowEventSimple *anEvent, TProfile2D *profile2D)";
719 if(!anEvent){Fatal(sMethodName.Data(),"Sorry, 'anEvent' is on holidays.");}
720 if(!profile2D){Fatal(sMethodName.Data(),"Sorry, 'profile2D' is on holidays.");}
721
722 Int_t nBins = profile2D->GetXaxis()->GetNbins();
723 for(Int_t bx=2;bx<=nBins;bx++)
724 {
725 for(Int_t by=1;by<bx;by++)
726 {
727 const char *binLabelX = profile2D->GetXaxis()->GetBinLabel(bx);
728 const char *binLabelY = profile2D->GetYaxis()->GetBinLabel(by);
729 Double_t numX = this->CastStringToCorrelation(binLabelX,kTRUE); // numerator
730 Double_t denX = this->CastStringToCorrelation(binLabelX,kFALSE); // denominator
731 Double_t wX = denX; // weight TBI add support for other options
732 Double_t numY = this->CastStringToCorrelation(binLabelY,kTRUE); // numerator
733 Double_t denY = this->CastStringToCorrelation(binLabelY,kFALSE); // denominator
734 Double_t wY = denY; // weight TBI add support for other options
735 if(TMath::Abs(denX) > 0. && TMath::Abs(denY) > 0.)
736 {
737 profile2D->Fill(bx-0.5,by-0.5,(numX/denX)*(numY/denY),wX*wY);
738 }
739 else{Fatal(sMethodName.Data(),"if(TMath::Abs(denX) > 0. && TMath::Abs(denY) > 0.)");}
740 } // for(Int_t by=1;by<bx;by++)
741 } // for(Int_t bx=2;bx<=nBins;bx++)
742
743} // void CalculateProductsOfCorrelations(AliFlowEventSimple *anEvent, TProfile2D *profile2D)
744
745//=======================================================================================================================
7ecb5af4 746
68a8e667 747void AliFlowAnalysisWithMultiparticleCorrelations::CalculateEbECumulants(AliFlowEventSimple *anEvent)
748{
749 // Calculate e-b-e cumulants from Q-vector components.
750
751 // TBI this mathod is far (very far, in fact) from being finalized :'(
752
753 // a) Calculate and store e-b-e cumulants.
754
755 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CalculateEbECumulants(AliFlowEventSimple *anEvent)";
756 if(!anEvent){Fatal(sMethodName.Data(),"'anEvent'!?!? You again!!!!");}
757
758 // a) Calculate and store e-b-e cumulants:
759 Double_t dMultRP = anEvent->GetNumberOfRPs(); // TBI shall I promote this variable into data member?
6696a113 760 Int_t binNo[8]; for(Int_t c=0;c<8;c++){binNo[c]=1;}
761 // 1-p:
762 for(Int_t n1=-fMaxHarmonic;n1<=fMaxHarmonic;n1++)
7ecb5af4 763 {
6696a113 764 if(fSkipZeroHarmonics && 0==n1){continue;}
765 if(fCalculateAll)
7ecb5af4 766 {
6696a113 767 TComplex oneN = One(n1); // numerator
768 Double_t oneD = One(0).Re(); // denominator
769 Double_t oneW = oneD; // weight TBI add other possibilities here for the weight
770 if(oneD>0. && dMultRP>=1)
771 {
68a8e667 772 fEbECumulantsPro[0][0]->Fill(binNo[0]-.5,oneN.Re()/oneD,oneW);
773 fEbECumulantsPro[1][0]->Fill(binNo[0]++-.5,oneN.Im()/oneD,oneW);
6696a113 774 } else {Warning(sMethodName.Data(),"if(oneD>0. && dMultRP>=1) ");}
775 }
776 if(1==fDontGoBeyond){continue;}
777 // 2-p:
778 for(Int_t n2=n1;n2<=fMaxHarmonic;n2++)
7ecb5af4 779 {
6696a113 780 if(fSkipZeroHarmonics && 0==n2){continue;}
781 if(fCalculateAll
782 || (fCalculateIsotropic && 0==n1+n2)
783 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2))
784 || (fCalculateSameIsotropic && 0==n1+n2 && TMath::Abs(n1)==TMath::Abs(n2)))
785 {
68a8e667 786 Double_t cumulants2pCos = Two(n1,n2).Re()/Two(0,0).Re()
787 - (One(n1).Re()/One(0).Re())*(One(n2).Re()/One(0).Re())
788 + (One(n1).Im()/One(0).Re())*(One(n2).Im()/One(0).Re());
789
790 Double_t cumulants2pSin = Two(n1,n2).Im()/Two(0,0).Re()
791 - (One(n1).Re()/One(0).Re())*(One(n2).Im()/One(0).Re())
792 - (One(n2).Re()/One(0).Re())*(One(n1).Im()/One(0).Re());
793
794 if(/*twoD>0. &&*/ dMultRP>=2)
6696a113 795 {
68a8e667 796 fEbECumulantsPro[0][1]->Fill(binNo[1]-.5,cumulants2pCos,1.);;
797 fEbECumulantsPro[1][1]->Fill(binNo[1]++-.5,cumulants2pSin,1.);;
798 } else {Warning(sMethodName.Data(),"/*twoD>0. &&*/ dMultRP>=2");}
6696a113 799 }
800 if(2==fDontGoBeyond){continue;}
68a8e667 801
802 /*
803
6696a113 804 // 3-p:
805 for(Int_t n3=n2;n3<=fMaxHarmonic;n3++)
806 {
807 if(fSkipZeroHarmonics && 0==n3){continue;}
808 if(fCalculateAll
809 || (fCalculateIsotropic && 0==n1+n2+n3)
810 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3))
811 || (fCalculateSameIsotropic && 0==n1+n2+n3 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)))
812 {
813 TComplex threeN = Three(n1,n2,n3); // numerator
814 Double_t threeD = Three(0,0,0).Re(); // denominator
815 Double_t threeW = threeD; // weight TBI add other possibilities here for the weight
816 if(threeD>0. && dMultRP>=3)
817 {
68a8e667 818 fEbECumulantsPro[0][2]->Fill(binNo[2]-.5,threeN.Re()/threeD,threeW);
819 fEbECumulantsPro[1][2]->Fill(binNo[2]++-.5,threeN.Im()/threeD,threeW);
6696a113 820 } else {Warning(sMethodName.Data(),"threeD>0. && dMultRP>=3");}
821 }
822 if(3==fDontGoBeyond){continue;}
823 // 4-p:
824 for(Int_t n4=n3;n4<=fMaxHarmonic;n4++)
825 {
826 if(fSkipZeroHarmonics && 0==n4){continue;}
827 if(fCalculateAll
828 || (fCalculateIsotropic && 0==n1+n2+n3+n4)
829 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
830 && TMath::Abs(n1)==TMath::Abs(n4))
831 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4 && TMath::Abs(n1)==TMath::Abs(n2)
832 && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)))
833 {
834 TComplex fourN = Four(n1,n2,n3,n4); // numerator
835 Double_t fourD = Four(0,0,0,0).Re(); // denominator
836 Double_t fourW = fourD; // weight TBI add other possibilities here for the weight
837 if(fourD>0. && dMultRP>=4)
838 {
68a8e667 839 fEbECumulantsPro[0][3]->Fill(binNo[3]-.5,fourN.Re()/fourD,fourW);
840 fEbECumulantsPro[1][3]->Fill(binNo[3]++-.5,fourN.Im()/fourD,fourW);
6696a113 841 } else {Warning(sMethodName.Data(),"fourD>0. && dMultRP>=4");}
842 }
843 if(4==fDontGoBeyond){continue;}
844 // 5-p:
845 for(Int_t n5=n4;n5<=fMaxHarmonic;n5++)
846 {
847 if(fSkipZeroHarmonics && 0==n5){continue;}
848 if(fCalculateAll
849 || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5)
850 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
851 && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5))
852 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5 && TMath::Abs(n1)==TMath::Abs(n2)
853 && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5)))
854 {
855 TComplex fiveN = Five(n1,n2,n3,n4,n5); // numerator
856 Double_t fiveD = Five(0,0,0,0,0).Re(); // denominator
857 Double_t fiveW = fiveD; // weight TBI add other possibilities here for the weight
858 if(fiveD>0. && dMultRP>=5)
859 {
68a8e667 860 fEbECumulantsPro[0][4]->Fill(binNo[4]-.5,fiveN.Re()/fiveD,fiveW);
861 fEbECumulantsPro[1][4]->Fill(binNo[4]++-.5,fiveN.Im()/fiveD,fiveW);
6696a113 862 } else {Warning(sMethodName.Data(),"fiveD>0. && dMultRP>=5");}
863 }
864 if(5==fDontGoBeyond){continue;}
865 // 6-p:
866 for(Int_t n6=n5;n6<=fMaxHarmonic;n6++)
867 {
868 if(fSkipZeroHarmonics && 0==n6){continue;}
869 if(fCalculateAll
870 || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5+n6)
871 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
872 && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6))
873 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5+n6 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
874 && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6)))
875 {
876 TComplex sixN = Six(n1,n2,n3,n4,n5,n6); // numerator
877 Double_t sixD = Six(0,0,0,0,0,0).Re(); // denominator
878 Double_t sixW = sixD; // weight TBI add other possibilities here for the weight
879 if(sixD>0. && dMultRP>=6)
880 {
68a8e667 881 fEbECumulantsPro[0][5]->Fill(binNo[5]-.5,sixN.Re()/sixD,sixW);
882 fEbECumulantsPro[1][5]->Fill(binNo[5]++-.5,sixN.Im()/sixD,sixW);
6696a113 883 } else {Warning(sMethodName.Data(),"sixD>0. && dMultRP>=6");}
884 }
885 if(6==fDontGoBeyond){continue;}
886 // 7-p:
887 for(Int_t n7=n6;n7<=fMaxHarmonic;n7++)
888 {
889 if(fSkipZeroHarmonics && 0==n7){continue;}
890 if(fCalculateAll
891 || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5+n6+n7)
892 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
893 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7))
894 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5+n6+n7 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
895 && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6)
896 && TMath::Abs(n1)==TMath::Abs(n7)))
897 {
898 TComplex sevenN = Seven(n1,n2,n3,n4,n5,n6,n7); // numerator
899 Double_t sevenD = Seven(0,0,0,0,0,0,0).Re(); // denominator
900 Double_t sevenW = sevenD; // weight TBI add other possibilities here for the weight
901 if(sevenD>0. && dMultRP>=7)
902 {
68a8e667 903 fEbECumulantsPro[0][6]->Fill(binNo[6]-.5,sevenN.Re()/sevenD,sevenW);
904 fEbECumulantsPro[1][6]->Fill(binNo[6]++-.5,sevenN.Im()/sevenD,sevenW);
6696a113 905 } else {Warning(sMethodName.Data(),"sevenD>0. && dMultRP>=7");}
906 }
907 if(7==fDontGoBeyond){continue;}
908 // 8-p:
909 for(Int_t n8=n7;n8<=fMaxHarmonic;n8++)
910 {
911 if(fSkipZeroHarmonics && 0==n8){continue;}
912 if(fCalculateAll
913 || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5+n6+n7+n8)
914 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
915 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7)
916 && TMath::Abs(n1)==TMath::Abs(n8))
917 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5+n6+n7+n8 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
918 && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6)
919 && TMath::Abs(n1)==TMath::Abs(n7) && TMath::Abs(n1)==TMath::Abs(n8)))
920 {
921 TComplex eightN = Eight(n1,n2,n3,n4,n5,n6,n7,n8); // numerator
922 Double_t eightD = Eight(0,0,0,0,0,0,0,0).Re(); // denominator
923 Double_t eightW = eightD; // weight TBI add other possibilities here for the weight
924 if(eightD>0. && dMultRP>=8)
925 {
68a8e667 926 fEbECumulantsPro[0][7]->Fill(binNo[7]-.5,eightN.Re()/eightD,eightW);
927 fEbECumulantsPro[1][7]->Fill(binNo[7]++-.5,eightN.Im()/eightD,eightW);
6696a113 928 }
929 }
930 } // for(Int_t n8=n7;n8<=fMaxHarmonic;n8++)
931 } // for(Int_t n7=n6;n7<=fMaxHarmonic;n7++)
932 } // for(Int_t n6=n5;n6<=fMaxHarmonic;n6++)
933 } // for(Int_t n5=n4;n5<=fMaxHarmonic;n5++)
934 } // for(Int_t n4=n3;n4<=fMaxHarmonic;n4++)
935 } // for(Int_t n3=n2;n3<=fMaxHarmonic;n3++)
68a8e667 936
937 */
938
6696a113 939 } // for(Int_t n2=n1;n2<=fMaxHarmonic;n2++)
940 } // for(Int_t n1=-fMaxHarmonic;n1<=fMaxHarmonic;n1++)
941
68a8e667 942} // void AliFlowAnalysisWithMultiparticleCorrelations::CalculateEbECumulants(AliFlowEventSimple *anEvent)
7ecb5af4 943
944//=======================================================================================================================
945
68a8e667 946void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckWithNestedLoops(AliFlowEventSimple *anEvent)
6d19c373 947{
68a8e667 948 // Cross-check results for multi-particle correlations with nested loops.
6d19c373 949
68a8e667 950 // TBI add few comments here, there and over there
951 // TBI this method is rather messy :'(
6d19c373 952
68a8e667 953 Int_t h1 = (Int_t)fNestedLoopsFlagsPro->GetBinContent(2);
954 Int_t h2 = (Int_t)fNestedLoopsFlagsPro->GetBinContent(3);
955 Int_t h3 = (Int_t)fNestedLoopsFlagsPro->GetBinContent(4);
956 Int_t h4 = (Int_t)fNestedLoopsFlagsPro->GetBinContent(5);
957 Int_t h5 = (Int_t)fNestedLoopsFlagsPro->GetBinContent(6);
958 Int_t h6 = (Int_t)fNestedLoopsFlagsPro->GetBinContent(7);
959 Int_t h7 = (Int_t)fNestedLoopsFlagsPro->GetBinContent(8);
960 Int_t h8 = (Int_t)fNestedLoopsFlagsPro->GetBinContent(9);
6d19c373 961
68a8e667 962 this->ResetQvector();
963 this->FillQvector(anEvent);
6d19c373 964
68a8e667 965 if(TMath::Abs(One(0).Re())>0.)
6d19c373 966 {
68a8e667 967 fNestedLoopsResultsCosPro->Fill(1.5,One(h1).Re()/One(0).Re(),One(0).Re());
968 fNestedLoopsResultsSinPro->Fill(1.5,One(h1).Im()/One(0).Re(),One(0).Re());
969 }
970 if(TMath::Abs(Two(0,0).Re())>0.)
971 {
972 fNestedLoopsResultsCosPro->Fill(3.5,Two(h1,h2).Re()/Two(0,0).Re(),Two(0,0).Re());
973 fNestedLoopsResultsSinPro->Fill(3.5,Two(h1,h2).Im()/Two(0,0).Re(),Two(0,0).Re());
6d19c373 974 }
68a8e667 975 if(TMath::Abs(Three(0,0,0).Re())>0.)
6d19c373 976 {
68a8e667 977 fNestedLoopsResultsCosPro->Fill(5.5,Three(h1,h2,h3).Re()/Three(0,0,0).Re(),Three(0,0,0).Re());
978 fNestedLoopsResultsSinPro->Fill(5.5,Three(h1,h2,h3).Im()/Three(0,0,0).Re(),Three(0,0,0).Re());
979 }
980 if(TMath::Abs(Four(0,0,0,0).Re())>0.)
6d19c373 981 {
68a8e667 982 fNestedLoopsResultsCosPro->Fill(7.5,Four(h1,h2,h3,h4).Re()/Four(0,0,0,0).Re(),Four(0,0,0,0).Re());
983 fNestedLoopsResultsSinPro->Fill(7.5,Four(h1,h2,h3,h4).Im()/Four(0,0,0,0).Re(),Four(0,0,0,0).Re());
984 }
985 if(TMath::Abs(Five(0,0,0,0,0).Re())>0.)
6d19c373 986 {
68a8e667 987 fNestedLoopsResultsCosPro->Fill(9.5,Five(h1,h2,h3,h4,h5).Re()/Five(0,0,0,0,0).Re(),Five(0,0,0,0,0).Re());
988 fNestedLoopsResultsSinPro->Fill(9.5,Five(h1,h2,h3,h4,h5).Im()/Five(0,0,0,0,0).Re(),Five(0,0,0,0,0).Re());
989 }
990 if(TMath::Abs(Six(0,0,0,0,0,0).Re())>0.)
7ecb5af4 991 {
68a8e667 992 fNestedLoopsResultsCosPro->Fill(11.5,Six(h1,h2,h3,h4,h5,h6).Re()/Six(0,0,0,0,0,0).Re(),Six(0,0,0,0,0,0).Re());
993 fNestedLoopsResultsSinPro->Fill(11.5,Six(h1,h2,h3,h4,h5,h6).Im()/Six(0,0,0,0,0,0).Re(),Six(0,0,0,0,0,0).Re());
994 }
995 if(TMath::Abs(Seven(0,0,0,0,0,0,0).Re())>0.)
996 {
997 fNestedLoopsResultsCosPro->Fill(13.5,Seven(h1,h2,h3,h4,h5,h6,h7).Re()/Seven(0,0,0,0,0,0,0).Re(),Seven(0,0,0,0,0,0,0).Re());
998 fNestedLoopsResultsSinPro->Fill(13.5,Seven(h1,h2,h3,h4,h5,h6,h7).Im()/Seven(0,0,0,0,0,0,0).Re(),Seven(0,0,0,0,0,0,0).Re());
999 }
1000 if(TMath::Abs(Eight(0,0,0,0,0,0,0,0).Re())>0.)
1001 {
1002 fNestedLoopsResultsCosPro->Fill(15.5,Eight(h1,h2,h3,h4,h5,h6,h7,h8).Re()/Eight(0,0,0,0,0,0,0,0).Re(),Eight(0,0,0,0,0,0,0,0).Re());
1003 fNestedLoopsResultsSinPro->Fill(15.5,Eight(h1,h2,h3,h4,h5,h6,h7,h8).Im()/Eight(0,0,0,0,0,0,0,0).Re(),Eight(0,0,0,0,0,0,0,0).Re());
1004 }
7ecb5af4 1005
1006 Int_t nPrim = anEvent->NumberOfTracks();
6696a113 1007 Double_t dMultRP = anEvent->GetNumberOfRPs(); // TBI shall I promote this variable into data member?
7ecb5af4 1008 AliFlowTrackSimple *aftsTrack = NULL;
1009 Double_t dPhi1=0.,dPhi2=0.,dPhi3=0.,dPhi4=0.,dPhi5=0.,dPhi6=0.,dPhi7=0.,dPhi8=0.;
1010 Double_t wPhi1=1.,wPhi2=1.,wPhi3=1.,wPhi4=1.,wPhi5=1.,wPhi6=1.,wPhi7=1.,wPhi8=1.;
1011
1012 // 1-particle stuff: TBI
6696a113 1013 if(dMultRP>=1)
7ecb5af4 1014 {
1015 for(Int_t i1=0;i1<nPrim;i1++)
1016 {
1017 aftsTrack = anEvent->GetTrack(i1);
1018 if(!(aftsTrack->InRPSelection())){continue;}
1019 dPhi1 = aftsTrack->Phi();
68a8e667 1020 if(fUseWeights[0][0]){wPhi1 = Weight(dPhi1,"RP","phi");}
7ecb5af4 1021 // Fill:
1022 fNestedLoopsResultsCosPro->Fill(0.5,TMath::Cos(h1*dPhi1),wPhi1);
1023 fNestedLoopsResultsSinPro->Fill(0.5,TMath::Sin(h1*dPhi1),wPhi1);
1024 } // end of for(Int_t i1=0;i1<nPrim;i1++)
1025 } // end of if(nPrim>=1)
1026
1027 // 2-particle correlations:
6696a113 1028 if(dMultRP>=2)
7ecb5af4 1029 {
1030 for(Int_t i1=0;i1<nPrim;i1++)
1031 {
1032 aftsTrack = anEvent->GetTrack(i1);
1033 if(!(aftsTrack->InRPSelection())){continue;}
1034 dPhi1 = aftsTrack->Phi();
68a8e667 1035 if(fUseWeights[0][0]){wPhi1 = Weight(dPhi1,"RP","phi");}
7ecb5af4 1036 for(Int_t i2=0;i2<nPrim;i2++)
1037 {
1038 if(i2==i1){continue;}
1039 aftsTrack = anEvent->GetTrack(i2);
1040 if(!(aftsTrack->InRPSelection())){continue;}
1041 dPhi2 = aftsTrack->Phi();
68a8e667 1042 if(fUseWeights[0][0]){wPhi2 = Weight(dPhi2,"RP","phi");}
7ecb5af4 1043 // Fill:
1044 fNestedLoopsResultsCosPro->Fill(2.5,TMath::Cos(h1*dPhi1+h2*dPhi2),wPhi1*wPhi2);
1045 fNestedLoopsResultsSinPro->Fill(2.5,TMath::Sin(h1*dPhi1+h2*dPhi2),wPhi1*wPhi2);
1046 } // end of for(Int_t i2=0;i2<nPrim;i2++)
1047 } // end of for(Int_t i1=0;i1<nPrim;i1++)
1048 } // end of if(nPrim>=2)
1049
1050 // 3-particle correlations:
6696a113 1051 if(dMultRP>=3)
7ecb5af4 1052 {
1053 for(Int_t i1=0;i1<nPrim;i1++)
1054 {
1055 aftsTrack=anEvent->GetTrack(i1);
1056 if(!(aftsTrack->InRPSelection())){continue;}
1057 dPhi1=aftsTrack->Phi();
68a8e667 1058 if(fUseWeights[0][0]){wPhi1 = Weight(dPhi1,"RP","phi");}
7ecb5af4 1059 for(Int_t i2=0;i2<nPrim;i2++)
1060 {
1061 if(i2==i1){continue;}
1062 aftsTrack=anEvent->GetTrack(i2);
1063 if(!(aftsTrack->InRPSelection())){continue;}
1064 dPhi2=aftsTrack->Phi();
68a8e667 1065 if(fUseWeights[0][0]){wPhi2 = Weight(dPhi2,"RP","phi");}
7ecb5af4 1066 for(Int_t i3=0;i3<nPrim;i3++)
1067 {
1068 if(i3==i1||i3==i2){continue;}
1069 aftsTrack=anEvent->GetTrack(i3);
1070 if(!(aftsTrack->InRPSelection())){continue;}
1071 dPhi3=aftsTrack->Phi();
68a8e667 1072 if(fUseWeights[0][0]){wPhi3 = Weight(dPhi3,"RP","phi");}
7ecb5af4 1073 // Fill:
1074 fNestedLoopsResultsCosPro->Fill(4.5,TMath::Cos(h1*dPhi1+h2*dPhi2+h3*dPhi3),wPhi1*wPhi2*wPhi3);
1075 fNestedLoopsResultsSinPro->Fill(4.5,TMath::Sin(h1*dPhi1+h2*dPhi2+h3*dPhi3),wPhi1*wPhi2*wPhi3);
1076 } // end of for(Int_t i3=0;i3<nPrim;i3++)
1077 } // end of for(Int_t i2=0;i2<nPrim;i2++)
1078 } // end of for(Int_t i1=0;i1<nPrim;i1++)
1079 } // end of if(nPrim>=3)
1080
1081 // 4-particle correlations:
6696a113 1082 if(dMultRP>=4)
7ecb5af4 1083 {
1084 for(Int_t i1=0;i1<nPrim;i1++)
1085 {
1086 aftsTrack=anEvent->GetTrack(i1);
1087 if(!(aftsTrack->InRPSelection())){continue;}
1088 dPhi1=aftsTrack->Phi();
68a8e667 1089 if(fUseWeights[0][0]){wPhi1 = Weight(dPhi1,"RP","phi");}
7ecb5af4 1090 for(Int_t i2=0;i2<nPrim;i2++)
1091 {
1092 if(i2==i1){continue;}
1093 aftsTrack=anEvent->GetTrack(i2);
1094 if(!(aftsTrack->InRPSelection())){continue;}
1095 dPhi2=aftsTrack->Phi();
68a8e667 1096 if(fUseWeights[0][0]){wPhi2 = Weight(dPhi2,"RP","phi");}
7ecb5af4 1097 for(Int_t i3=0;i3<nPrim;i3++)
1098 {
1099 if(i3==i1||i3==i2){continue;}
1100 aftsTrack=anEvent->GetTrack(i3);
1101 if(!(aftsTrack->InRPSelection())){continue;}
1102 dPhi3=aftsTrack->Phi();
68a8e667 1103 if(fUseWeights[0][0]){wPhi3 = Weight(dPhi3,"RP","phi");}
7ecb5af4 1104 for(Int_t i4=0;i4<nPrim;i4++)
1105 {
1106 if(i4==i1||i4==i2||i4==i3){continue;}
1107 aftsTrack=anEvent->GetTrack(i4);
1108 if(!(aftsTrack->InRPSelection())){continue;}
1109 dPhi4=aftsTrack->Phi();
68a8e667 1110 if(fUseWeights[0][0]){wPhi4 = Weight(dPhi4,"RP","phi");}
7ecb5af4 1111 // Fill:
1112 fNestedLoopsResultsCosPro->Fill(6.5,TMath::Cos(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4),wPhi1*wPhi2*wPhi3*wPhi4);
1113 fNestedLoopsResultsSinPro->Fill(6.5,TMath::Sin(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4),wPhi1*wPhi2*wPhi3*wPhi4);
1114 } // end of for(Int_t i4=0;i4<nPrim;i4++)
1115 } // end of for(Int_t i3=0;i3<nPrim;i3++)
1116 } // end of for(Int_t i2=0;i2<nPrim;i2++)
1117 } // end of for(Int_t i1=0;i1<nPrim;i1++)
1118 } // end of if(nPrim>=)
1119
1120 // 5-particle correlations:
6696a113 1121 if(dMultRP>=5)
7ecb5af4 1122 {
1123 for(Int_t i1=0;i1<nPrim;i1++)
1124 {
1125 aftsTrack=anEvent->GetTrack(i1);
1126 if(!(aftsTrack->InRPSelection())){continue;}
1127 dPhi1=aftsTrack->Phi();
68a8e667 1128 if(fUseWeights[0][0]){wPhi1 = Weight(dPhi1,"RP","phi");}
7ecb5af4 1129 for(Int_t i2=0;i2<nPrim;i2++)
1130 {
1131 if(i2==i1){continue;}
1132 aftsTrack=anEvent->GetTrack(i2);
1133 if(!(aftsTrack->InRPSelection())){continue;}
1134 dPhi2=aftsTrack->Phi();
68a8e667 1135 if(fUseWeights[0][0]){wPhi2 = Weight(dPhi2,"RP","phi");}
7ecb5af4 1136 for(Int_t i3=0;i3<nPrim;i3++)
1137 {
1138 if(i3==i1||i3==i2){continue;}
1139 aftsTrack=anEvent->GetTrack(i3);
1140 if(!(aftsTrack->InRPSelection())){continue;}
1141 dPhi3=aftsTrack->Phi();
68a8e667 1142 if(fUseWeights[0][0]){wPhi3 = Weight(dPhi3,"RP","phi");}
7ecb5af4 1143 for(Int_t i4=0;i4<nPrim;i4++)
1144 {
1145 if(i4==i1||i4==i2||i4==i3){continue;}
1146 aftsTrack=anEvent->GetTrack(i4);
1147 if(!(aftsTrack->InRPSelection())){continue;}
1148 dPhi4=aftsTrack->Phi();
68a8e667 1149 if(fUseWeights[0][0]){wPhi4 = Weight(dPhi4,"RP","phi");}
7ecb5af4 1150 for(Int_t i5=0;i5<nPrim;i5++)
1151 {
1152 if(i5==i1||i5==i2||i5==i3||i5==i4){continue;}
1153 aftsTrack=anEvent->GetTrack(i5);
1154 if(!(aftsTrack->InRPSelection())){continue;}
1155 dPhi5=aftsTrack->Phi();
68a8e667 1156 if(fUseWeights[0][0]){wPhi5 = Weight(dPhi5,"RP","phi");}
7ecb5af4 1157 // Fill:
1158 fNestedLoopsResultsCosPro->Fill(8.5,TMath::Cos(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4+h5*dPhi5),wPhi1*wPhi2*wPhi3*wPhi4*wPhi5);
1159 fNestedLoopsResultsSinPro->Fill(8.5,TMath::Sin(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4+h5*dPhi5),wPhi1*wPhi2*wPhi3*wPhi4*wPhi5);
1160 } // end of for(Int_t i5=0;i5<nPrim;i5++)
1161 } // end of for(Int_t i4=0;i4<nPrim;i4++)
1162 } // end of for(Int_t i3=0;i3<nPrim;i3++)
1163 } // end of for(Int_t i2=0;i2<nPrim;i2++)
1164 } // end of for(Int_t i1=0;i1<nPrim;i1++)
1165 } // end of if(nPrim>=5)
1166
1167 // 6-particle correlations:
6696a113 1168 if(dMultRP>=6)
7ecb5af4 1169 {
1170 for(Int_t i1=0;i1<nPrim;i1++)
1171 {
1172 aftsTrack=anEvent->GetTrack(i1);
1173 if(!(aftsTrack->InRPSelection())){continue;}
1174 dPhi1=aftsTrack->Phi();
68a8e667 1175 if(fUseWeights[0][0]){wPhi1 = Weight(dPhi1,"RP","phi");}
7ecb5af4 1176 for(Int_t i2=0;i2<nPrim;i2++)
1177 {
1178 if(i2==i1){continue;}
1179 aftsTrack=anEvent->GetTrack(i2);
1180 if(!(aftsTrack->InRPSelection())){continue;}
1181 dPhi2=aftsTrack->Phi();
68a8e667 1182 if(fUseWeights[0][0]){wPhi2 = Weight(dPhi2,"RP","phi");}
7ecb5af4 1183 for(Int_t i3=0;i3<nPrim;i3++)
1184 {
1185 if(i3==i1||i3==i2){continue;}
1186 aftsTrack=anEvent->GetTrack(i3);
1187 if(!(aftsTrack->InRPSelection())){continue;}
1188 dPhi3=aftsTrack->Phi();
68a8e667 1189 if(fUseWeights[0][0]){wPhi3 = Weight(dPhi3,"RP","phi");}
7ecb5af4 1190 for(Int_t i4=0;i4<nPrim;i4++)
1191 {
1192 if(i4==i1||i4==i2||i4==i3){continue;}
1193 aftsTrack=anEvent->GetTrack(i4);
1194 if(!(aftsTrack->InRPSelection())){continue;}
1195 dPhi4=aftsTrack->Phi();
68a8e667 1196 if(fUseWeights[0][0]){wPhi4 = Weight(dPhi4,"RP","phi");}
7ecb5af4 1197 for(Int_t i5=0;i5<nPrim;i5++)
1198 {
1199 if(i5==i1||i5==i2||i5==i3||i5==i4){continue;}
1200 aftsTrack=anEvent->GetTrack(i5);
1201 if(!(aftsTrack->InRPSelection())){continue;}
1202 dPhi5=aftsTrack->Phi();
68a8e667 1203 if(fUseWeights[0][0]){wPhi5=Weight(dPhi5,"RP","phi");}
7ecb5af4 1204 for(Int_t i6=0;i6<nPrim;i6++)
1205 {
1206 if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5){continue;}
1207 aftsTrack=anEvent->GetTrack(i6);
1208 if(!(aftsTrack->InRPSelection())){continue;}
1209 dPhi6=aftsTrack->Phi();
68a8e667 1210 if(fUseWeights[0][0]){wPhi6=Weight(dPhi6,"RP","phi");}
7ecb5af4 1211 // Fill:
1212 fNestedLoopsResultsCosPro->Fill(10.5,TMath::Cos(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4+h5*dPhi5+h6*dPhi6),wPhi1*wPhi2*wPhi3*wPhi4*wPhi5*wPhi6);
1213 fNestedLoopsResultsSinPro->Fill(10.5,TMath::Sin(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4+h5*dPhi5+h6*dPhi6),wPhi1*wPhi2*wPhi3*wPhi4*wPhi5*wPhi6);
1214 } // end of for(Int_t i6=0;i6<nPrim;i6++)
1215 } // end of for(Int_t i5=0;i5<nPrim;i5++)
1216 } // end of for(Int_t i4=0;i4<nPrim;i4++)
1217 } // end of for(Int_t i3=0;i3<nPrim;i3++)
1218 } // end of for(Int_t i2=0;i2<nPrim;i2++)
1219 } // end of for(Int_t i1=0;i1<nPrim;i1++)
1220 } // end of if(nPrim>=6)
1221
1222 // 7-particle correlations:
6696a113 1223 if(dMultRP>=7)
7ecb5af4 1224 {
1225 for(Int_t i1=0;i1<nPrim;i1++)
1226 {
1227 aftsTrack=anEvent->GetTrack(i1);
1228 if(!(aftsTrack->InRPSelection())){continue;}
1229 dPhi1=aftsTrack->Phi();
68a8e667 1230 if(fUseWeights[0][0]){wPhi1=Weight(dPhi1,"RP","phi");}
7ecb5af4 1231 for(Int_t i2=0;i2<nPrim;i2++)
1232 {
1233 if(i2==i1){continue;}
1234 aftsTrack=anEvent->GetTrack(i2);
1235 if(!(aftsTrack->InRPSelection())){continue;}
1236 dPhi2=aftsTrack->Phi();
68a8e667 1237 if(fUseWeights[0][0]){wPhi2=Weight(dPhi2,"RP","phi");}
7ecb5af4 1238 for(Int_t i3=0;i3<nPrim;i3++)
1239 {
1240 if(i3==i1||i3==i2){continue;}
1241 aftsTrack=anEvent->GetTrack(i3);
1242 if(!(aftsTrack->InRPSelection())){continue;}
1243 dPhi3=aftsTrack->Phi();
68a8e667 1244 if(fUseWeights[0][0]){wPhi3=Weight(dPhi3,"RP","phi");}
7ecb5af4 1245 for(Int_t i4=0;i4<nPrim;i4++)
1246 {
1247 if(i4==i1||i4==i2||i4==i3){continue;}
1248 aftsTrack=anEvent->GetTrack(i4);
1249 if(!(aftsTrack->InRPSelection())){continue;}
1250 dPhi4=aftsTrack->Phi();
68a8e667 1251 if(fUseWeights[0][0]){wPhi4=Weight(dPhi4,"RP","phi");}
7ecb5af4 1252 for(Int_t i5=0;i5<nPrim;i5++)
1253 {
1254 if(i5==i1||i5==i2||i5==i3||i5==i4){continue;}
1255 aftsTrack=anEvent->GetTrack(i5);
1256 if(!(aftsTrack->InRPSelection())){continue;}
1257 dPhi5=aftsTrack->Phi();
68a8e667 1258 if(fUseWeights[0][0]){wPhi5=Weight(dPhi5,"RP","phi");}
7ecb5af4 1259 for(Int_t i6=0;i6<nPrim;i6++)
1260 {
1261 if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5){continue;}
1262 aftsTrack=anEvent->GetTrack(i6);
1263 if(!(aftsTrack->InRPSelection())){continue;}
1264 dPhi6=aftsTrack->Phi();
68a8e667 1265 if(fUseWeights[0][0]){wPhi6=Weight(dPhi6,"RP","phi");}
7ecb5af4 1266 for(Int_t i7=0;i7<nPrim;i7++)
1267 {
1268 if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6){continue;}
1269 aftsTrack=anEvent->GetTrack(i7);
1270 if(!(aftsTrack->InRPSelection())){continue;}
1271 dPhi7=aftsTrack->Phi();
68a8e667 1272 if(fUseWeights[0][0]){wPhi7=Weight(dPhi7,"RP","phi");}
7ecb5af4 1273 // Fill:
1274 fNestedLoopsResultsCosPro->Fill(12.5,TMath::Cos(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4+h5*dPhi5+h6*dPhi6+h7*dPhi7),wPhi1*wPhi2*wPhi3*wPhi4*wPhi5*wPhi6*wPhi7);
1275 fNestedLoopsResultsSinPro->Fill(12.5,TMath::Sin(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4+h5*dPhi5+h6*dPhi6+h7*dPhi7),wPhi1*wPhi2*wPhi3*wPhi4*wPhi5*wPhi6*wPhi7);
1276 } // end of for(Int_t i7=0;i7<nPrim;i7++)
1277 } // end of for(Int_t i6=0;i6<nPrim;i6++)
1278 } // end of for(Int_t i5=0;i5<nPrim;i5++)
1279 } // end of for(Int_t i4=0;i4<nPrim;i4++)
1280 } // end of for(Int_t i3=0;i3<nPrim;i3++)
1281 } // end of for(Int_t i2=0;i2<nPrim;i2++)
1282 } // end of for(Int_t i1=0;i1<nPrim;i1++)
1283 } // end of if(nPrim>=7)
1284
1285 // 8-particle correlations:
6696a113 1286 if(dMultRP>=8)
7ecb5af4 1287 {
1288 for(Int_t i1=0;i1<nPrim;i1++)
1289 {
1290 aftsTrack=anEvent->GetTrack(i1);
1291 if(!(aftsTrack->InRPSelection())){continue;}
1292 dPhi1=aftsTrack->Phi();
68a8e667 1293 if(fUseWeights[0][0]){wPhi1=Weight(dPhi1,"RP","phi");}
7ecb5af4 1294 for(Int_t i2=0;i2<nPrim;i2++)
1295 {
1296 if(i2==i1){continue;}
1297 aftsTrack=anEvent->GetTrack(i2);
1298 if(!(aftsTrack->InRPSelection())){continue;}
1299 dPhi2=aftsTrack->Phi();
68a8e667 1300 if(fUseWeights[0][0]){wPhi2=Weight(dPhi2,"RP","phi");}
7ecb5af4 1301 for(Int_t i3=0;i3<nPrim;i3++)
1302 {
1303 if(i3==i1||i3==i2){continue;}
1304 aftsTrack=anEvent->GetTrack(i3);
1305 if(!(aftsTrack->InRPSelection())){continue;}
1306 dPhi3=aftsTrack->Phi();
68a8e667 1307 if(fUseWeights[0][0]){wPhi3=Weight(dPhi3,"RP","phi");}
7ecb5af4 1308 for(Int_t i4=0;i4<nPrim;i4++)
1309 {
1310 if(i4==i1||i4==i2||i4==i3){continue;}
1311 aftsTrack=anEvent->GetTrack(i4);
1312 if(!(aftsTrack->InRPSelection())){continue;}
1313 dPhi4=aftsTrack->Phi();
68a8e667 1314 if(fUseWeights[0][0]){wPhi4=Weight(dPhi4,"RP","phi");}
7ecb5af4 1315 for(Int_t i5=0;i5<nPrim;i5++)
1316 {
1317 if(i5==i1||i5==i2||i5==i3||i5==i4){continue;}
1318 aftsTrack=anEvent->GetTrack(i5);
1319 if(!(aftsTrack->InRPSelection())){continue;}
1320 dPhi5=aftsTrack->Phi();
68a8e667 1321 if(fUseWeights[0][0]){wPhi5=Weight(dPhi5,"RP","phi");}
7ecb5af4 1322 for(Int_t i6=0;i6<nPrim;i6++)
1323 {
1324 if(i6==i1||i6==i2||i6==i3||i6==i4||i6==i5){continue;}
1325 aftsTrack=anEvent->GetTrack(i6);
1326 if(!(aftsTrack->InRPSelection())){continue;}
1327 dPhi6=aftsTrack->Phi();
68a8e667 1328 if(fUseWeights[0][0]){wPhi6=Weight(dPhi6,"RP","phi");}
7ecb5af4 1329 for(Int_t i7=0;i7<nPrim;i7++)
1330 {
1331 if(i7==i1||i7==i2||i7==i3||i7==i4||i7==i5||i7==i6){continue;}
1332 aftsTrack=anEvent->GetTrack(i7);
1333 if(!(aftsTrack->InRPSelection())){continue;}
1334 dPhi7=aftsTrack->Phi();
68a8e667 1335 if(fUseWeights[0][0]){wPhi7=Weight(dPhi7,"RP","phi");}
7ecb5af4 1336 for(Int_t i8=0;i8<nPrim;i8++)
1337 {
1338 if(i8==i1||i8==i2||i8==i3||i8==i4||i8==i5||i8==i6||i8==i7){continue;}
1339 aftsTrack=anEvent->GetTrack(i8);
1340 if(!(aftsTrack->InRPSelection())){continue;}
1341 dPhi8=aftsTrack->Phi();
68a8e667 1342 if(fUseWeights[0][0]){wPhi8=Weight(dPhi8,"RP","phi");}
7ecb5af4 1343 // Fill:
1344 fNestedLoopsResultsCosPro->Fill(14.5,TMath::Cos(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4+h5*dPhi5+h6*dPhi6+h7*dPhi7+h8*dPhi8),wPhi1*wPhi2*wPhi3*wPhi4*wPhi5*wPhi6*wPhi7*wPhi8);
1345 fNestedLoopsResultsSinPro->Fill(14.5,TMath::Sin(h1*dPhi1+h2*dPhi2+h3*dPhi3+h4*dPhi4+h5*dPhi5+h6*dPhi6+h7*dPhi7+h8*dPhi8),wPhi1*wPhi2*wPhi3*wPhi4*wPhi5*wPhi6*wPhi7*wPhi8);
1346 } // end of for(Int_t i8=0;i8<nPrim;i8++)
1347 } // end of for(Int_t i7=0;i7<nPrim;i7++)
1348 } // end of for(Int_t i6=0;i6<nPrim;i6++)
1349 } // end of for(Int_t i5=0;i5<nPrim;i5++)
1350 } // end of for(Int_t i4=0;i4<nPrim;i4++)
1351 } // end of for(Int_t i3=0;i3<nPrim;i3++)
1352 } // end of for(Int_t i2=0;i2<nPrim;i2++)
1353 } // end of for(Int_t i1=0;i1<nPrim;i1++)
1354 } // end of if(nPrim>=8)
1355
1356 // *) Printout: TBI move somewhere else
1357 printf("\n cosine:");
1358 printf("\n 1-p => Q-vector: %.12f",fNestedLoopsResultsCosPro->GetBinContent(2));
1359 printf("\n 1-p => Nested loops: %.12f",fNestedLoopsResultsCosPro->GetBinContent(1));
1360 printf("\n 2-p => Q-vector: %.12f",fNestedLoopsResultsCosPro->GetBinContent(4));
1361 printf("\n 2-p => Nested loops: %.12f",fNestedLoopsResultsCosPro->GetBinContent(3));
1362 printf("\n 3-p => Q-vector: %.12f",fNestedLoopsResultsCosPro->GetBinContent(6));
1363 printf("\n 3-p => Nested loops: %.12f",fNestedLoopsResultsCosPro->GetBinContent(5));
1364 printf("\n 4-p => Q-vector: %.12f",fNestedLoopsResultsCosPro->GetBinContent(8));
1365 printf("\n 4-p => Nested loops: %.12f",fNestedLoopsResultsCosPro->GetBinContent(7));
1366 printf("\n 5-p => Q-vector: %.12f",fNestedLoopsResultsCosPro->GetBinContent(10));
1367 printf("\n 5-p => Nested loops: %.12f",fNestedLoopsResultsCosPro->GetBinContent(9));
1368 printf("\n 6-p => Q-vector: %.12f",fNestedLoopsResultsCosPro->GetBinContent(12));
1369 printf("\n 6-p => Nested loops: %.12f",fNestedLoopsResultsCosPro->GetBinContent(11));
1370 printf("\n 7-p => Q-vector: %.12f",fNestedLoopsResultsCosPro->GetBinContent(14));
1371 printf("\n 7-p => Nested loops: %.12f",fNestedLoopsResultsCosPro->GetBinContent(13));
1372 printf("\n 8-p => Q-vector: %.12f",fNestedLoopsResultsCosPro->GetBinContent(16));
1373 printf("\n 8-p => Nested loops: %.12f",fNestedLoopsResultsCosPro->GetBinContent(15));
1374
1375 printf("\n\n sinus:");
1376 printf("\n 1-p => Q-vector: %.12f",fNestedLoopsResultsSinPro->GetBinContent(2));
1377 printf("\n 1-p => Nested loops: %.12f",fNestedLoopsResultsSinPro->GetBinContent(1));
1378 printf("\n 2-p => Q-vector: %.12f",fNestedLoopsResultsSinPro->GetBinContent(4));
1379 printf("\n 2-p => Nested loops: %.12f",fNestedLoopsResultsSinPro->GetBinContent(3));
1380 printf("\n 3-p => Q-vector: %.12f",fNestedLoopsResultsSinPro->GetBinContent(6));
1381 printf("\n 3-p => Nested loops: %.12f",fNestedLoopsResultsSinPro->GetBinContent(5));
1382 printf("\n 4-p => Q-vector: %.12f",fNestedLoopsResultsSinPro->GetBinContent(8));
1383 printf("\n 4-p => Nested loops: %.12f",fNestedLoopsResultsSinPro->GetBinContent(7));
1384 printf("\n 5-p => Q-vector: %.12f",fNestedLoopsResultsSinPro->GetBinContent(10));
1385 printf("\n 5-p => Nested loops: %.12f",fNestedLoopsResultsSinPro->GetBinContent(9));
1386 printf("\n 6-p => Q-vector: %.12f",fNestedLoopsResultsSinPro->GetBinContent(12));
1387 printf("\n 6-p => Nested loops: %.12f",fNestedLoopsResultsSinPro->GetBinContent(11));
1388 printf("\n 7-p => Q-vector: %.12f",fNestedLoopsResultsSinPro->GetBinContent(14));
1389 printf("\n 7-p => Nested loops: %.12f",fNestedLoopsResultsSinPro->GetBinContent(13));
1390 printf("\n 8-p => Q-vector: %.12f",fNestedLoopsResultsSinPro->GetBinContent(16));
1391 printf("\n 8-p => Nested loops: %.12f",fNestedLoopsResultsSinPro->GetBinContent(15));
1392
1393 printf("\n\n");
1394
1395} // void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckWithNestedLoops(AliFlowEventSimple *anEvent)
1396
1397//=======================================================================================================================
1398
68a8e667 1399void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckDiffWithNestedLoops(AliFlowEventSimple *anEvent)
1400{
1401 // Cross-check results for differential multi-particle correlations with nested loops.
1402
1403 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckDiffWithNestedLoops(AliFlowEventSimple *anEvent)";
1404
1405 Int_t nPrim = anEvent->NumberOfTracks();
1406 AliFlowTrackSimple *aftsTrack = NULL;
1407 Double_t dPsi1=0.,dPhi2=0.,dPhi3=0.,dPhi4=0.;
1408 Double_t wPsi1=1.,wPhi2=1.,wPhi3=1.,wPhi4=1.;
1409
1410 // TBI reiplement lines below in a more civilised manner:
1411 Bool_t bCrossCheck2p = kTRUE;
1412 Bool_t bCrossCheck3p = kFALSE;
1413 Bool_t bCrossCheck4p = kFALSE;
1414 if(Int_t(bCrossCheck2p + bCrossCheck3p + bCrossCheck4p) > 1)
1415 {
1416 Fatal(sMethodName.Data(),"Int_t(bCrossCheck2p + bCrossCheck3p + bCrossCheck4p) > 1");
1417 }
1418 if(!(bCrossCheck2p || bCrossCheck3p || bCrossCheck4p))
1419 {
1420 Fatal(sMethodName.Data(),"!(bCrossCheck2p || bCrossCheck3p || bCrossCheck4p)");
1421 }
1422 Int_t nDiffBinNo=4;
1423 Double_t dPt=0.;
1424
1425
1426 // <2'>:
1427 for(Int_t i1=0;i1<nPrim;i1++) // Loop over particles in a differential bin _55
1428 {
1429 aftsTrack=anEvent->GetTrack(i1);
1430 if(!(aftsTrack->InPOISelection())){continue;}
1431 dPsi1=aftsTrack->Phi();
1432 dPt=aftsTrack->Pt();
1433 if(fDiffCorrelationsPro[0][1]->FindBin(dPt) != nDiffBinNo){continue;} // TBI spaghetti again
1434 if(fUseWeights[1][0]){wPsi1=Weight(dPsi1,"POI","phi");}
1435 for(Int_t i2=0;i2<nPrim;i2++) // Loop over particles in an event
1436 {
1437 if(i2==i1){continue;} // get rid of autocorrelations
1438 aftsTrack=anEvent->GetTrack(i2);
1439 if(!(aftsTrack->InRPSelection())){continue;}
1440 dPhi2=aftsTrack->Phi();
1441 if(fUseWeights[0][0]){wPhi2=Weight(dPhi2,"RP","phi");}
1442 // Fill profiles:
1443 if(bCrossCheck2p){fNestedLoopsDiffResultsPro->Fill(0.5,TMath::Cos(fDiffHarmonics[1][0]*dPsi1+fDiffHarmonics[1][1]*dPhi2),wPsi1*wPhi2);}
1444 } // for(Int_t i2=0;i2<nPrim;i2++)
1445 } // for(Int_t i1=0;i1<nPrim;i1++)
1446
1447 // <3'>:
1448 for(Int_t i1=0;i1<nPrim;i1++) // Loop over particles in a differential bin
1449 {
1450 aftsTrack=anEvent->GetTrack(i1);
1451 if(!(aftsTrack->InPOISelection())){continue;}
1452 dPsi1=aftsTrack->Phi();
1453 dPt=aftsTrack->Pt();
1454 if(fDiffCorrelationsPro[0][1]->FindBin(dPt) != nDiffBinNo){continue;} // TBI spaghetti again
1455 if(fUseWeights[1][0]){wPsi1=Weight(dPsi1,"POI","phi");}
1456 for(Int_t i2=0;i2<nPrim;i2++) // Loop over particles in an event
1457 {
1458 if(i2==i1){continue;} // get rid of autocorrelations
1459 aftsTrack=anEvent->GetTrack(i2);
1460 if(!(aftsTrack->InRPSelection())){continue;}
1461 dPhi2=aftsTrack->Phi();
1462 if(fUseWeights[0][0]){wPhi2=Weight(dPhi2,"RP","phi");}
1463 for(Int_t i3=0;i3<nPrim;i3++)
1464 {
1465 if(i3==i1||i3==i2){continue;} // get rid of autocorrelations
1466 aftsTrack=anEvent->GetTrack(i3);
1467 if(!(aftsTrack->InRPSelection())){continue;}
1468 dPhi3=aftsTrack->Phi();
1469 if(fUseWeights[0][0]){wPhi3=Weight(dPhi3,"RP","phi");}
1470 // Fill the profiles:
1471 if(bCrossCheck3p){fNestedLoopsDiffResultsPro->Fill(0.5,TMath::Cos(fDiffHarmonics[2][0]*dPsi1+fDiffHarmonics[2][1]*dPhi2+fDiffHarmonics[2][2]*dPhi3),wPsi1*wPhi2*wPhi3); }
1472 } // end of for(Int_t i3=0;i3<nPrim;i3++)
1473 } // for(Int_t i2=0;i2<nPrim;i2++)
1474 } // for(Int_t i1=0;i1<nPrim;i1++)
1475
1476 // <4'>:
1477 for(Int_t i1=0;i1<nPrim;i1++) // Loop over particles in a differential bin
1478 {
1479 aftsTrack=anEvent->GetTrack(i1);
1480 if(!(aftsTrack->InPOISelection())){continue;}
1481 dPsi1=aftsTrack->Phi();
1482 dPt=aftsTrack->Pt();
1483 if(fDiffCorrelationsPro[0][1]->FindBin(dPt) != nDiffBinNo){continue;} // TBI spaghetti again
1484 if(fUseWeights[1][0]){wPsi1=Weight(dPsi1,"POI","phi");}
1485 for(Int_t i2=0;i2<nPrim;i2++) // Loop over particles in an event
1486 {
1487 if(i2==i1){continue;} // get rid of autocorrelations
1488 aftsTrack=anEvent->GetTrack(i2);
1489 if(!(aftsTrack->InRPSelection())){continue;}
1490 dPhi2=aftsTrack->Phi();
1491 if(fUseWeights[0][0]){wPhi2=Weight(dPhi2,"RP","phi");}
1492 for(Int_t i3=0;i3<nPrim;i3++)
1493 {
1494 if(i3==i1||i3==i2){continue;} // get rid of autocorrelations
1495 aftsTrack=anEvent->GetTrack(i3);
1496 if(!(aftsTrack->InRPSelection())){continue;}
1497 dPhi3=aftsTrack->Phi();
1498 if(fUseWeights[0][0]){wPhi3=Weight(dPhi3,"RP","phi");}
1499 for(Int_t i4=0;i4<nPrim;i4++)
1500 {
1501 if(i4==i1||i4==i2||i4==i3){continue;} // get rid of autocorrelations
1502 aftsTrack=anEvent->GetTrack(i4);
1503 if(!(aftsTrack->InRPSelection())){continue;}
1504 dPhi4=aftsTrack->Phi();
1505 if(fUseWeights[0][0]){wPhi4=Weight(dPhi4,"RP","phi");}
1506 // Fill the profiles:
1507 if(bCrossCheck4p){fNestedLoopsDiffResultsPro->Fill(0.5,TMath::Cos(fDiffHarmonics[3][0]*dPsi1+fDiffHarmonics[3][1]*dPhi2+fDiffHarmonics[3][2]*dPhi3+fDiffHarmonics[3][3]*dPhi4),wPsi1*wPhi2*wPhi3*wPhi4);}
1508 } // end of for(Int_t i4=0;i4<nPrim;i4++)
1509 } // end of for(Int_t i3=0;i3<nPrim;i3++)
1510 } // for(Int_t i2=0;i2<nPrim;i2++)
1511 } // for(Int_t i1=0;i1<nPrim;i1++)
1512
1513 // Printout:
1514 // 2-p:
1515 if(bCrossCheck2p)
1516 {
1517 printf("\n 2-p => Q-vector: %.12f",fDiffCorrelationsPro[0][1]->GetBinContent(nDiffBinNo));
1518 printf("\n 2-p => Nested loops: %.12f\n",fNestedLoopsDiffResultsPro->GetBinContent(1));
1519 }
1520 // 3-p:
1521 if(bCrossCheck3p)
1522 {
1523 printf("\n 3-p => Q-vector: %.12f",fDiffCorrelationsPro[0][2]->GetBinContent(nDiffBinNo));
1524 printf("\n 3-p => Nested loops: %.12f\n",fNestedLoopsDiffResultsPro->GetBinContent(1));
1525 }
1526 // 4-p:
1527 if(bCrossCheck4p)
1528 {
1529 printf("\n 4-p => Q-vector: %.12f",fDiffCorrelationsPro[0][3]->GetBinContent(nDiffBinNo));
1530 printf("\n 4-p => Nested loops: %.12f\n",fNestedLoopsDiffResultsPro->GetBinContent(1));
1531 }
1532
1533} // void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckDiffWithNestedLoops(AliFlowEventSimple *anEvent)
1534
1535//=======================================================================================================================
1536
7ecb5af4 1537void AliFlowAnalysisWithMultiparticleCorrelations::FillQvector(AliFlowEventSimple *anEvent)
1538{
1539 // Fill Q-vector components.
1540
1541 Int_t nTracks = anEvent->NumberOfTracks(); // TBI shall I promote this to data member?
1542 Double_t dPhi = 0., wPhi = 1.; // azimuthal angle and corresponding phi weight
1543 Double_t dPt = 0., wPt = 1.; // transverse momentum and corresponding pT weight
1544 Double_t dEta = 0., wEta = 1.; // pseudorapidity and corresponding eta weight
1545 Double_t wToPowerP = 1.; // weight raised to power p
1546 for(Int_t t=0;t<nTracks;t++) // loop over all tracks
1547 {
1548 AliFlowTrackSimple *pTrack = anEvent->GetTrack(t);
1549 if(!pTrack){printf("\n AAAARGH: pTrack is NULL in MPC::FillQvector(...) !!!!"); continue;}
68a8e667 1550 if(!(pTrack->InRPSelection() || pTrack->InPOISelection())){printf("\n AAAARGH: pTrack is neither RP nor POI !!!!"); continue;}
1551 if(pTrack->InRPSelection()) // fill Q-vector components only with reference particles
7ecb5af4 1552 {
68a8e667 1553 // Access kinematic variables for RP and corresponding weights:
7ecb5af4 1554 dPhi = pTrack->Phi(); // azimuthal angle
68a8e667 1555 if(fUseWeights[0][0]){wPhi = Weight(dPhi,"RP","phi");} // corresponding phi weight
7ecb5af4 1556 //if(dPhi < 0.){dPhi += TMath::TwoPi();} TBI
1557 //if(dPhi > TMath::TwoPi()){dPhi -= TMath::TwoPi();} TBI
1558 dPt = pTrack->Pt();
68a8e667 1559 if(fUseWeights[0][1]){wPt = Weight(dPt,"RP","pt");} // corresponding pT weight
7ecb5af4 1560 dEta = pTrack->Eta();
68a8e667 1561 if(fUseWeights[0][2]){wEta = Weight(dEta,"RP","eta");} // corresponding eta weight
7ecb5af4 1562 // Calculate Q-vector components:
6696a113 1563 for(Int_t h=0;h<fMaxHarmonic*fMaxCorrelator+1;h++)
7ecb5af4 1564 {
68a8e667 1565 for(Int_t wp=0;wp<fMaxCorrelator+1;wp++) // weight power
1566 {
1567 if(fUseWeights[0][0]||fUseWeights[0][1]||fUseWeights[0][2]){wToPowerP = pow(wPhi*wPt*wEta,wp);}
1568 fQvector[h][wp] += TComplex(wToPowerP*TMath::Cos(h*dPhi),wToPowerP*TMath::Sin(h*dPhi));
1569 } // for(Int_t wp=0;wp<fMaxCorrelator+1;wp++)
1570 } // for(Int_t h=0;h<fMaxHarmonic*fMaxCorrelator+1;h++)
1571 } // if(pTrack->InRPSelection()) // fill Q-vector components only with reference particles
1572
1573 // Differential Q-vectors (a.k.a. p-vector and q-vector):
1574 if(!fCalculateDiffQvectors){continue;}
1575 if(pTrack->InPOISelection())
1576 {
1577 wPhi = 1.; wPt = 1.; wEta = 1.; wToPowerP = 1.; // TBI this shall go somewhere else, for performance sake
1578
1579 // Access kinematic variables for POI and corresponding weights:
1580 dPhi = pTrack->Phi(); // azimuthal angle
1581 if(fUseWeights[1][0]){wPhi = Weight(dPhi,"POI","phi");} // corresponding phi weight
1582 //if(dPhi < 0.){dPhi += TMath::TwoPi();} TBI
1583 //if(dPhi > TMath::TwoPi()){dPhi -= TMath::TwoPi();} TBI
1584 dPt = pTrack->Pt();
1585 if(fUseWeights[1][1]){wPt = Weight(dPt,"POI","pt");} // corresponding pT weight
1586 dEta = pTrack->Eta();
1587 if(fUseWeights[1][2]){wEta = Weight(dEta,"POI","eta");} // corresponding eta weight
1588 // Determine bin:
1589 Int_t binNo = fDiffCorrelationsPro[0][0]->FindBin(dPt); // TBI: hardwired [0][0] and dPt
1590 // Calculate p-vector components:
1591 for(Int_t h=0;h<fMaxHarmonic*fMaxCorrelator+1;h++)
1592 {
1593 for(Int_t wp=0;wp<fMaxCorrelator+1;wp++) // weight power
7ecb5af4 1594 {
68a8e667 1595 if(fUseWeights[1][0]||fUseWeights[1][1]||fUseWeights[1][2]){wToPowerP = pow(wPhi*wPt*wEta,wp);}
1596 fpvector[binNo-1][h][wp] += TComplex(wToPowerP*TMath::Cos(h*dPhi),wToPowerP*TMath::Sin(h*dPhi));
1597
1598 if(pTrack->InRPSelection())
1599 {
1600 // Fill q-vector components:
1601 fqvector[binNo-1][h][wp] += TComplex(wToPowerP*TMath::Cos(h*dPhi),wToPowerP*TMath::Sin(h*dPhi));
1602 } // if(pTrack->InRPSelection())
1603 } // for(Int_t wp=0;wp<fMaxCorrelator+1;wp++)
6696a113 1604 } // for(Int_t h=0;h<fMaxHarmonic*fMaxCorrelator+1;h++)
68a8e667 1605 } // if(pTrack->InPOISelection())
1606
7ecb5af4 1607 } // for(Int_t t=0;t<nTracks;t++) // loop over all tracks
1608
1609} // void AliFlowAnalysisWithMultiparticleCorrelations::FillQvector(AliFlowEventSimple *anEvent)
1610
1611//=======================================================================================================================
1612
37d2f768 1613void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckSettings()
1614{
1615 // Cross-check all initial settings in this method.
1616
6696a113 1617 // a) Few cross-checks for control histograms;
6d19c373 1618 // b) Few cross-checks for flags for correlations;
68a8e667 1619 // c) 'Standard candles';
1620 // d) Q-cumulants;
1621 // e) Weights.
6696a113 1622
1623 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckSettings()";
1624
1625 // a) Few cross-checks for control histograms: TBI the lines below are not really what they are supposed to be...
1626 /*
1627 if(fFillKinematicsHist && !fFillControlHistograms){Fatal(sMethodName.Data(),"fFillKinematicsHist && !fFillControlHistograms");}
1628 if(fFillMultDistributionsHist && !fFillControlHistograms){Fatal(sMethodName.Data(),"fFillMultDistributionsHist && !fFillControlHistograms");}
1629 if(fFillMultCorrelationsHist && !fFillControlHistograms){Fatal(sMethodName.Data(),"fFillMultCorrelationsHist && !fFillControlHistograms");}
1630 */
1631
1632 // b) Few cross-checks for flags for correlations: // TBI the lines bellow can be civilized
1633 Int_t iSum = (Int_t)fCalculateIsotropic + (Int_t)fCalculateSame + (Int_t)fCalculateSameIsotropic;
1634 if(iSum>1){Fatal(sMethodName.Data(),"iSum is doing crazy things...");}
68a8e667 1635 if(fCalculateOnlyCos && fCalculateOnlySin){Fatal(sMethodName.Data(),"fCalculateOnlyCos && fCalculateOnlySin");}
37d2f768 1636
6d19c373 1637 // c) 'Standard candles':
1638 if(fCalculateStandardCandles && !fCalculateCorrelations)
1639 {
1640 Fatal(sMethodName.Data(),"fCalculateStandardCandles && !fCalculateCorrelations");
1641 }
68a8e667 1642 if(fCalculateStandardCandles && fCalculateCorrelations && fCalculateSameIsotropic)
1643 {
1644 Fatal(sMethodName.Data(),"fCalculateStandardCandles && fCalculateCorrelations && fCalculateSameIsotropic");
1645 }
1646 if(fCalculateStandardCandles && fCalculateOnlyForHarmonicQC)
1647 {
1648 Fatal(sMethodName.Data(),"fCalculateStandardCandles && fCalculateOnlyForHarmonicQC");
1649 }
1650 if(fCalculateStandardCandles && fCalculateOnlyForSC && (4!=fDontGoBeyond))
1651 {
1652 Fatal(sMethodName.Data(),"fCalculateStandardCandles && fCalculateOnlyForSC && (4!=fDontGoBeyond)");
1653 }
1654 if(fCalculateStandardCandles && !fPropagateErrorSC)
1655 {
1656 Warning(sMethodName.Data(),"fCalculateStandardCandles && !fPropagateErrorSC");
1657 }
1658 if(fCalculateStandardCandles && fCalculateOnlySin)
1659 {
1660 Fatal(sMethodName.Data(),"fCalculateStandardCandles && fCalculateOnlySin");
1661 }
1662
1663 // d) Q-cumulants:
1664 if(fCalculateQcumulants && !fCalculateCorrelations)
1665 {
1666 Fatal(sMethodName.Data(),"fCalculateQcumulants && !fCalculateCorrelations");
1667 }
1668 if(fCalculateQcumulants && !(fHarmonicQC > 0))
1669 {
1670 Fatal(sMethodName.Data(),"fCalculateQcumulants && !(fHarmonicQC > 0)");
1671 }
1672 if(fCalculateQcumulants && fCalculateOnlyForSC)
1673 {
1674 Fatal(sMethodName.Data(),"fCalculateQcumulants && fCalculateOnlyForSC");
1675 }
1676 if(fCalculateQcumulants && !fPropagateErrorQC)
1677 {
1678 Warning(sMethodName.Data(),"fCalculateQcumulants && !fPropagateErrorQC");
1679 }
1680 if(fCalculateQcumulants && fCalculateOnlySin)
1681 {
1682 Fatal(sMethodName.Data(),"fCalculateQcumulants && fCalculateOnlySin");
1683 }
1684
1685 // e) Weights:
1686 for(Int_t rp=0;rp<2;rp++) // [RP,POI]
1687 {
1688 for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
1689 {
1690 if(fUseWeights[rp][ppe] && !fWeightsHist[rp][ppe])
1691 {
1692 Fatal(sMethodName.Data(),"fUseWeights[rp][ppe] && !fWeightsHist[rp][ppe], rp = %d, ppe = %d",rp,ppe);
1693 }
1694 }
1695 }
6d19c373 1696
37d2f768 1697} // end of void AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckSettings()
1698
1699//=======================================================================================================================
1700
1701void AliFlowAnalysisWithMultiparticleCorrelations::BookAndNestAllLists()
1702{
1703 // Book and nest all lists nested in the base list fHistList.
1704
1705 // a) Book and nest lists for control histograms;
68a8e667 1706 // b) Book and nest lists for Q-vectors;
7ecb5af4 1707 // c) Book and nest lists for correlations;
68a8e667 1708 // d) Book and nest lists for e-b-e cumulants;
9efbd2f5 1709 // e) Book and nest lists for weights;
1710 // f) Book and nest lists for nested loops;
68a8e667 1711 // g) Book and nest lists for 'standard candles';
1712 // h) Book and nest lists for Q-cumulants;
1713 // i) Book and nest lists for differential correlations.
37d2f768 1714
1715 // a) Book and nest lists for control histograms:
1716 fControlHistogramsList = new TList();
1717 fControlHistogramsList->SetName("Control Histograms");
1718 fControlHistogramsList->SetOwner(kTRUE);
1719 fHistList->Add(fControlHistogramsList);
1720
68a8e667 1721 // b) Book and nest lists for Q-vectors:
9efbd2f5 1722 fQvectorList = new TList();
68a8e667 1723 fQvectorList->SetName("Q-vectors");
9efbd2f5 1724 fQvectorList->SetOwner(kTRUE);
1725 fHistList->Add(fQvectorList);
7ecb5af4 1726
1727 // c) Book and nest lists for correlations:
1728 fCorrelationsList = new TList();
1729 fCorrelationsList->SetName("Correlations");
1730 fCorrelationsList->SetOwner(kTRUE);
1731 fHistList->Add(fCorrelationsList);
1732
68a8e667 1733 // d) Book and nest lists for e-b-e cumulants:
1734 fEbECumulantsList = new TList();
1735 fEbECumulantsList->SetName("E-b-e Cumulants");
1736 fEbECumulantsList->SetOwner(kTRUE);
1737 fHistList->Add(fEbECumulantsList);
7ecb5af4 1738
9efbd2f5 1739 // e) Book and nest lists for weights:
1740 fWeightsList = new TList();
1741 fWeightsList->SetName("Weights");
1742 fWeightsList->SetOwner(kTRUE);
1743 fHistList->Add(fWeightsList);
1744
1745 // f) Book and nest lists for nested loops:
7ecb5af4 1746 fNestedLoopsList = new TList();
1747 fNestedLoopsList->SetName("Nested Loops");
1748 fNestedLoopsList->SetOwner(kTRUE);
1749 fHistList->Add(fNestedLoopsList);
1750
9efbd2f5 1751 // g) Book and nest lists for 'standard candles':
7ecb5af4 1752 fStandardCandlesList = new TList();
1753 fStandardCandlesList->SetName("Standard Candles");
1754 fStandardCandlesList->SetOwner(kTRUE);
1755 fHistList->Add(fStandardCandlesList);
1756
68a8e667 1757 // h) Book and nest lists for Q-cumulants:
1758 fQcumulantsList = new TList();
1759 fQcumulantsList->SetName("Q-cumulants");
1760 fQcumulantsList->SetOwner(kTRUE);
1761 fHistList->Add(fQcumulantsList);
1762
1763 // i) Book and nest lists for differential correlations:
1764 fDiffCorrelationsList = new TList();
1765 fDiffCorrelationsList->SetName("Differential Correlations");
1766 fDiffCorrelationsList->SetOwner(kTRUE);
1767 fHistList->Add(fDiffCorrelationsList);
1768
37d2f768 1769} // end of void AliFlowAnalysisWithMultiparticleCorrelations::BookAndNestAllLists()
1770
1771//=======================================================================================================================
1772
1773void AliFlowAnalysisWithMultiparticleCorrelations::WriteHistograms(TString outputFileName)
1774{
1775 // Store the final results in output file <outputFileName>.root.
1776
1777 TFile *output = new TFile(outputFileName.Data(),"RECREATE");
1778 fHistList->Write(fHistList->GetName(),TObject::kSingleKey);
1779
1780 delete output;
1781
1782} // end of void AliFlowAnalysisWithMultiparticleCorrelations::WriteHistograms(TString outputFileName)
1783
1784//=======================================================================================================================
1785
1786void AliFlowAnalysisWithMultiparticleCorrelations::WriteHistograms(TDirectoryFile *outputFileName)
1787{
1788 // Store the final results in output file <outputFileName>.root.
1789
1790 outputFileName->Add(fHistList);
1791 outputFileName->Write(outputFileName->GetName(),TObject::kSingleKey);
1792
1793} // end of void AliFlowAnalysisWithMultiparticleCorrelations::WriteHistograms(TDirectoryFile *outputFileName)
1794
1795//=======================================================================================================================
1796
1797void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForControlHistograms()
1798{
1799 // Book all the stuff for control histograms.
1800
1801 // a) Book the profile holding all the flags for control histograms;
1802 // b) Book all control histograms;
1803 // b0) Book TH1D *fKinematicsHist[2][3];
1804 // b1) Book TH1D *fMultDistributionsHist[3];
1805 // b2) Book TH2D *fMultCorrelationsHist[3].
1806
1807 // a) Book the profile holding all the flags for control histograms: TBI stil incomplete
6696a113 1808 fControlHistogramsFlagsPro = new TProfile("fControlHistogramsFlagsPro","Flags and settings for control histograms",4,0,4);
37d2f768 1809 fControlHistogramsFlagsPro->SetTickLength(-0.01,"Y");
1810 fControlHistogramsFlagsPro->SetMarkerStyle(25);
1811 fControlHistogramsFlagsPro->SetLabelSize(0.04);
1812 fControlHistogramsFlagsPro->SetLabelOffset(0.02,"Y");
1813 fControlHistogramsFlagsPro->SetStats(kFALSE);
7ecb5af4 1814 fControlHistogramsFlagsPro->SetFillColor(kGray);
1815 fControlHistogramsFlagsPro->SetLineColor(kBlack);
1816 fControlHistogramsFlagsPro->GetXaxis()->SetBinLabel(1,"fFillControlHistograms"); fControlHistogramsFlagsPro->Fill(0.5,fFillControlHistograms);
6696a113 1817 fControlHistogramsFlagsPro->GetXaxis()->SetBinLabel(2,"fFillKinematicsHist"); fControlHistogramsFlagsPro->Fill(1.5,fFillKinematicsHist);
1818 fControlHistogramsFlagsPro->GetXaxis()->SetBinLabel(3,"fFillMultDistributionsHist"); fControlHistogramsFlagsPro->Fill(2.5,fFillMultDistributionsHist);
1819 fControlHistogramsFlagsPro->GetXaxis()->SetBinLabel(4,"fFillMultCorrelationsHist"); fControlHistogramsFlagsPro->Fill(3.5,fFillMultCorrelationsHist);
37d2f768 1820 fControlHistogramsList->Add(fControlHistogramsFlagsPro);
1821
6696a113 1822 if(!fFillControlHistograms){return;} // TBI is this safe? Well, perhaps it is if I can't implement it better...
7ecb5af4 1823
37d2f768 1824 // b) Book all control histograms: // TBI add setters for all these values
1825 // b0) Book TH1D *fKinematicsHist[2][3]:
1826 Int_t nBins[2][3] = {{360,1000,1000},{360,1000,1000}}; // [RP,POI][phi,pt,eta]
1827 Double_t min[2][3] = {{0.,0.,-1.},{0.,0.,-1.}}; // [RP,POI][phi,pt,eta]
1828 Double_t max[2][3] = {{TMath::TwoPi(),10.,1.},{TMath::TwoPi(),10.,1.}}; // [RP,POI][phi,pt,eta]
1829 TString name[2][3] = {{"RP,phi","RP,pt","RP,eta"},{"POI,phi","POI,pt","POI,eta"}}; // [RP,POI][phi,pt,eta]
1830 TString title[2] = {"Reference particles (RP)","Particles of interest (POI)"}; // [RP,POI]
1831 Int_t lineColor[2] = {kBlue,kRed}; // [RP,POI]
1832 Int_t fillColor[2] = {kBlue-10,kRed-10}; // [RP,POI]
1833 TString xAxisTitle[3] = {"#phi","p_{T}","#eta"}; // [phi,pt,eta]
1834 for(Int_t rp=0;rp<2;rp++) // [RP,POI]
1835 {
1836 for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
1837 {
1838 fKinematicsHist[rp][ppe] = new TH1D(name[rp][ppe].Data(),title[rp].Data(),nBins[rp][ppe],min[rp][ppe],max[rp][ppe]);
1839 fKinematicsHist[rp][ppe]->GetXaxis()->SetTitle(xAxisTitle[ppe].Data());
1840 fKinematicsHist[rp][ppe]->SetLineColor(lineColor[rp]);
1841 fKinematicsHist[rp][ppe]->SetFillColor(fillColor[rp]);
7ecb5af4 1842 fKinematicsHist[rp][ppe]->SetMinimum(0.);
6696a113 1843 if(fFillKinematicsHist){fControlHistogramsList->Add(fKinematicsHist[rp][ppe]);}
37d2f768 1844 }
1845 }
1846
1847 // b1) Book TH1D *fMultDistributionsHist[3]: // TBI add setters for all these values
1848 Int_t nBinsMult[3] = {3000,3000,3000}; // [RP,POI,reference multiplicity]
1849 Double_t minMult[3] = {0.,0.,0.}; // [RP,POI,reference multiplicity]
1850 Double_t maxMult[3] = {3000.,3000.,3000.}; // [RP,POI,reference multiplicity]
1851 TString nameMult[3] = {"Multiplicity (RP)","Multiplicity (POI)","Multiplicity (REF)"}; // [RP,POI,reference multiplicity]
1852 TString titleMult[3] = {"Reference particles (RP)","Particles of interest (POI)",""}; // [RP,POI,reference multiplicity]
1853 Int_t lineColorMult[3] = {kBlue,kRed,kGreen+2}; // [RP,POI,reference multiplicity]
1854 Int_t fillColorMult[3] = {kBlue-10,kRed-10,kGreen-10}; // [RP,POI,reference multiplicity]
1855 TString xAxisTitleMult[3] = {"Multiplicity (RP)","Multiplicity (POI)","Multiplicity (REF)"}; // [phi,pt,eta]
1856 for(Int_t rprm=0;rprm<3;rprm++) // [RP,POI,reference multiplicity]
1857 {
1858 fMultDistributionsHist[rprm] = new TH1D(nameMult[rprm].Data(),titleMult[rprm].Data(),nBinsMult[rprm],minMult[rprm],maxMult[rprm]);
1859 fMultDistributionsHist[rprm]->GetXaxis()->SetTitle(xAxisTitleMult[rprm].Data());
1860 fMultDistributionsHist[rprm]->SetLineColor(lineColorMult[rprm]);
1861 fMultDistributionsHist[rprm]->SetFillColor(fillColorMult[rprm]);
6696a113 1862 if(fFillMultDistributionsHist){fControlHistogramsList->Add(fMultDistributionsHist[rprm]);}
37d2f768 1863 } // for(Int_t rprm=0;rprm<3;rprm++) // [RP,POI,reference multiplicity]
1864
7ecb5af4 1865 // b2) Book TH2D *fMultCorrelationsHist[3]: TBI too large objects to store in this way, perhaps,
37d2f768 1866 // ...
1867 fMultCorrelationsHist[0] = new TH2D("Multiplicity (RP vs. POI)","Multiplicity (RP vs. POI)",nBinsMult[0],minMult[0],maxMult[0],nBinsMult[1],minMult[1],maxMult[1]);
1868 fMultCorrelationsHist[0]->GetXaxis()->SetTitle(xAxisTitleMult[0].Data());
1869 fMultCorrelationsHist[0]->GetYaxis()->SetTitle(xAxisTitleMult[1].Data());
6696a113 1870 if(fFillMultCorrelationsHist){fControlHistogramsList->Add(fMultCorrelationsHist[0]);}
37d2f768 1871
1872 // ...
1873 fMultCorrelationsHist[1] = new TH2D("Multiplicity (RP vs. REF)","Multiplicity (RP vs. REF)",nBinsMult[0],minMult[0],maxMult[0],nBinsMult[2],minMult[2],maxMult[2]);
1874 fMultCorrelationsHist[1]->GetXaxis()->SetTitle(xAxisTitleMult[0].Data());
1875 fMultCorrelationsHist[1]->GetYaxis()->SetTitle(xAxisTitleMult[2].Data());
6696a113 1876 if(fFillMultCorrelationsHist){fControlHistogramsList->Add(fMultCorrelationsHist[1]);}
37d2f768 1877
1878 // ...
1879 fMultCorrelationsHist[2] = new TH2D("Multiplicity (POI vs. REF)","Multiplicity (POI vs. REF)",nBinsMult[1],minMult[1],maxMult[1],nBinsMult[2],minMult[2],maxMult[2]);
1880 fMultCorrelationsHist[2]->GetXaxis()->SetTitle(xAxisTitleMult[1].Data());
1881 fMultCorrelationsHist[2]->GetYaxis()->SetTitle(xAxisTitleMult[2].Data());
6696a113 1882 if(fFillMultCorrelationsHist){fControlHistogramsList->Add(fMultCorrelationsHist[2]);}
37d2f768 1883
1884} // void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForControlHistograms()
1885
1886//=======================================================================================================================
1887
1888void AliFlowAnalysisWithMultiparticleCorrelations::FillControlHistograms(AliFlowEventSimple *anEvent)
1889{
1890 // Fill control histograms.
37d2f768 1891 // a) Fill TH1D *fKinematicsHist[2][3];
1892 // b) Fill TH1D *fMultDistributionsHist[3];
1893 // c) Fill TH2D *fMultCorrelationsHist[3].
1894
1895 // a) Fill TH1D *fKinematicsHist[2][3]:
6696a113 1896 if(fFillKinematicsHist)
37d2f768 1897 {
6696a113 1898 Int_t nTracks = anEvent->NumberOfTracks(); // TBI shall I promote this to data member?
1899 for(Int_t t=0;t<nTracks;t++) // loop over all tracks
37d2f768 1900 {
6696a113 1901 AliFlowTrackSimple *pTrack = anEvent->GetTrack(t);
1902 if(!pTrack){printf("\n AAAARGH: pTrack is NULL in MPC::FCH() !!!!");continue;}
1903 if(pTrack)
37d2f768 1904 {
6696a113 1905 Double_t dPhi = pTrack->Phi();
1906 //if(dPhi < 0.){dPhi += TMath::TwoPi();} TBI
1907 //if(dPhi > TMath::TwoPi()){dPhi -= TMath::TwoPi();} TBI
1908 Double_t dPt = pTrack->Pt();
1909 Double_t dEta = pTrack->Eta();
1910 Double_t dPhiPtEta[3] = {dPhi,dPt,dEta};
1911 for(Int_t rp=0;rp<2;rp++) // [RP,POI]
37d2f768 1912 {
6696a113 1913 for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
1914 {
1915 if((0==rp && pTrack->InRPSelection()) || (1==rp && pTrack->InPOISelection())) // TBI
1916 {
1917 fKinematicsHist[rp][ppe]->Fill(dPhiPtEta[ppe]);
1918 }
1919 } // for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
1920 } // for(Int_t rp=0;rp<2;rp++) // [RP,POI]
1921 } // if(pTrack)
1922 } // for(Int_t t=0;t<nTracks;t++) // loop over all tracks
1923 } // if(fFillKinematicsHist)
37d2f768 1924
1925 // b) Fill TH1D *fMultDistributionsHist[3]:
1926 Double_t dMultRP = anEvent->GetNumberOfRPs(); // TBI shall I promote these 3 variables into data members?
1927 Double_t dMultPOI = anEvent->GetNumberOfPOIs();
1928 Double_t dMultREF = anEvent->GetReferenceMultiplicity();
1929 Double_t dMult[3] = {dMultRP,dMultPOI,dMultREF};
1930 for(Int_t rprm=0;rprm<3;rprm++) // [RP,POI,reference multiplicity]
1931 {
6696a113 1932 if(fFillMultDistributionsHist){fMultDistributionsHist[rprm]->Fill(dMult[rprm]);}
37d2f768 1933 }
1934
1935 // c) Fill TH2D *fMultCorrelationsHist[3]:
6696a113 1936 if(fFillMultCorrelationsHist)
1937 {
1938 fMultCorrelationsHist[0]->Fill((Int_t)dMultRP,(Int_t)dMultPOI); // RP vs. POI
1939 fMultCorrelationsHist[1]->Fill((Int_t)dMultRP,(Int_t)dMultREF); // RP vs. refMult
1940 fMultCorrelationsHist[2]->Fill((Int_t)dMultPOI,(Int_t)dMultREF); // POI vs. refMult
1941 } // if(fFillMultCorrelationsHist)
37d2f768 1942
1943} // void AliFlowAnalysisWithMultiparticleCorrelations::FillControlHistograms(AliFlowEventSimple *anEvent)
1944
1945//=======================================================================================================================
1946
1947void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForControlHistograms()
1948{
1949 // Initialize all arrays for control histograms.
1950
1951 // a) Initialize TH1D *fKinematicsHist[2][3];
1952 // b) Initialize TH1D *fMultDistributionsHist[3];
1953 // c) Initialize TH2D *fMultCorrelationsHist[3].
1954
1955 // a) Initialize TH1D *fKinematicsHist[2][3]:
1956 for(Int_t rp=0;rp<2;rp++) // [RP,POI]
1957 {
1958 for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
1959 {
1960 fKinematicsHist[rp][ppe] = NULL;
1961 }
1962 }
1963
1964 // b) Initialize TH1D *fMultDistributionsHist[3]:
1965 for(Int_t rprm=0;rprm<3;rprm++) // [RP,POI,reference multiplicity]
1966 {
1967 fMultDistributionsHist[rprm] = NULL;
1968 }
1969
1970 // c) Initialize TH2D *fMultCorrelationsHist[3]:
1971 for(Int_t r=0;r<3;r++) // [RP vs. POI, RP vs. refMult, POI vs. refMult]
1972 {
1973 fMultCorrelationsHist[r] = NULL;
1974 }
1975
1976} // void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForControlHistograms()
1977
1978//=======================================================================================================================
1979
9efbd2f5 1980void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForQvector()
1981{
1982 // Book all the stuff for Q-vector.
1983
1984 // a) Book the profile holding all the flags for Q-vector;
1985 // ...
1986
1987 // a) Book the profile holding all the flags for Q-vector:
68a8e667 1988 fQvectorFlagsPro = new TProfile("fQvectorFlagsPro","Flags for Q-vectors",2,0,2);
9efbd2f5 1989 fQvectorFlagsPro->SetTickLength(-0.01,"Y");
1990 fQvectorFlagsPro->SetMarkerStyle(25);
1991 fQvectorFlagsPro->SetLabelSize(0.03);
1992 fQvectorFlagsPro->SetLabelOffset(0.02,"Y");
1993 fQvectorFlagsPro->SetStats(kFALSE);
1994 fQvectorFlagsPro->SetFillColor(kGray);
1995 fQvectorFlagsPro->SetLineColor(kBlack);
1996 fQvectorFlagsPro->GetXaxis()->SetBinLabel(1,"fCalculateQvector"); fQvectorFlagsPro->Fill(0.5,fCalculateQvector);
68a8e667 1997 fQvectorFlagsPro->GetXaxis()->SetBinLabel(2,"fCalculateDiffQvectors"); fQvectorFlagsPro->Fill(1.5,fCalculateDiffQvectors);
9efbd2f5 1998 fQvectorList->Add(fQvectorFlagsPro);
1999
9efbd2f5 2000 // ...
2001
2002} // void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForQvector()
2003
2004//=======================================================================================================================
2005
7ecb5af4 2006void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForCorrelations()
2007{
2008 // Book all the stuff for correlations.
2009
2010 // TBI this method can be implemented in a much more civilised way.
2011
2012 // a) Book the profile holding all the flags for correlations;
6696a113 2013 // b) Book TProfile *fCorrelationsPro[2][8] ([0=cos,1=sin][1p,2p,...,8p]).
7ecb5af4 2014
68a8e667 2015 TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForCorrelations()";
2016
7ecb5af4 2017 // a) Book the profile holding all the flags for correlations:
68a8e667 2018 fCorrelationsFlagsPro = new TProfile("fCorrelationsFlagsPro","Flags for correlations",13,0,13);
7ecb5af4 2019 fCorrelationsFlagsPro->SetTickLength(-0.01,"Y");
2020 fCorrelationsFlagsPro->SetMarkerStyle(25);
2021 fCorrelationsFlagsPro->SetLabelSize(0.03);
2022 fCorrelationsFlagsPro->SetLabelOffset(0.02,"Y");
2023 fCorrelationsFlagsPro->SetStats(kFALSE);
2024 fCorrelationsFlagsPro->SetFillColor(kGray);
2025 fCorrelationsFlagsPro->SetLineColor(kBlack);
2026 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(1,"fCalculateCorrelations"); fCorrelationsFlagsPro->Fill(0.5,fCalculateCorrelations);
2027 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(2,"fMaxHarmonic"); fCorrelationsFlagsPro->Fill(1.5,fMaxHarmonic);
2028 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(3,"fMaxCorrelator"); fCorrelationsFlagsPro->Fill(2.5,fMaxCorrelator);
6696a113 2029 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(4,"fCalculateIsotropic"); fCorrelationsFlagsPro->Fill(3.5,fCalculateIsotropic);
2030 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(5,"fCalculateSame"); fCorrelationsFlagsPro->Fill(4.5,fCalculateSame);
2031 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(6,"fSkipZeroHarmonics"); fCorrelationsFlagsPro->Fill(5.5,fSkipZeroHarmonics);
2032 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(7,"fCalculateSameIsotropic"); fCorrelationsFlagsPro->Fill(6.5,fCalculateSameIsotropic);
2033 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(8,"fCalculateAll"); fCorrelationsFlagsPro->Fill(7.5,fCalculateAll);
2034 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(9,"fDontGoBeyond"); fCorrelationsFlagsPro->Fill(8.5,fDontGoBeyond);
68a8e667 2035 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(10,"fCalculateOnlyForHarmonicQC"); fCorrelationsFlagsPro->Fill(9.5,fCalculateOnlyForHarmonicQC);
2036 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(11,"fCalculateOnlyForSC"); fCorrelationsFlagsPro->Fill(10.5,fCalculateOnlyForSC);
2037 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(12,"fCalculateOnlyCos"); fCorrelationsFlagsPro->Fill(11.5,fCalculateOnlyCos);
2038 fCorrelationsFlagsPro->GetXaxis()->SetBinLabel(13,"fCalculateOnlySin"); fCorrelationsFlagsPro->Fill(12.5,fCalculateOnlySin);
7ecb5af4 2039 fCorrelationsList->Add(fCorrelationsFlagsPro);
2040
2041 if(!fCalculateCorrelations){return;} // TBI is this safe enough?
2042
68a8e667 2043 // b) Book TProfile *fCorrelationsPro[2][8] ([0=cos,1=sin][1p,2p,...,8p]): // TBI hardwired 8, shall be fMaxCorrelator
2044 cout<<" => Booking TProfile *fCorrelationsPro[2][8]..."<<endl;
6696a113 2045 TString sCosSin[2] = {"Cos","Sin"};
2046 Int_t markerColor[2] = {kBlue,kRed};
2047 Int_t markerStyle[2] = {kFullSquare,kFullSquare};
2048 Int_t nBins[8] = {1,1,1,1,1,1,1,1}; // TBI hardwired 8, shall be fMaxCorrelator
2049 Int_t nBinsTitle[8] = {1,1,1,1,1,1,1,1}; // TBI hardwired 8, shall be fMaxCorrelator
2050 Int_t nToBeFilled[8] = {0,0,0,0,0,0,0,0}; // TBI hardwired 8, shall be fMaxCorrelator
2051 for(Int_t c=0;c<fMaxCorrelator;c++) // [1p,2p,...,8p]
7ecb5af4 2052 {
6696a113 2053 // Implementing \binom{n+k-1}{k}, which is the resulting number of sets obtained
2054 // after sampling n starting elements into k subsets, repetitions allowed.
2055 // In my case, n=2*fMaxHarmonic+1, k=c+1, hence:
9efbd2f5 2056 nBins[c] = (Int_t)(TMath::Factorial(2*fMaxHarmonic+1+c+1-1)
2057 / (TMath::Factorial(2*fMaxHarmonic+1-1)*TMath::Factorial(c+1)));
6696a113 2058 nBinsTitle[c] = nBins[c];
68a8e667 2059 if(c>=fDontGoBeyond){nBins[c]=1;} // TBI is this really safe?
6696a113 2060 } // for(Int_t c=0;c<8;c++) // [1p,2p,...,8p]
2061 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
2062 {
68a8e667 2063 if(fCalculateOnlyCos && 1==cs){continue;}
2064 else if(fCalculateOnlySin && 0==cs){continue;}
6696a113 2065 for(Int_t c=0;c<fMaxCorrelator;c++) // [1p,2p,...,8p]
2066 {
2067 fCorrelationsPro[cs][c] = new TProfile(Form("%dpCorrelations%s",c+1,sCosSin[cs].Data()),"",nBins[c],0.,1.*nBins[c]);
2068 fCorrelationsPro[cs][c]->Sumw2();
2069 fCorrelationsPro[cs][c]->SetStats(kFALSE);
2070 fCorrelationsPro[cs][c]->SetMarkerColor(markerColor[cs]);
2071 fCorrelationsPro[cs][c]->SetMarkerStyle(markerStyle[cs]);
2072 fCorrelationsList->Add(fCorrelationsPro[cs][c]);
2073 } // for(Int_t c=0;c<8;c++) // [1p,2p,...,8p]
2074 } // for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
2075 // Set all bin labels: TBI this can be implemented better, most likely...
68a8e667 2076 Int_t binNo[2][8];
2077 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
2078 {
2079 if(fCalculateOnlyCos && 1==cs){continue;}
2080 else if(fCalculateOnlySin && 0==cs){continue;}
2081 for(Int_t c=0;c<fMaxCorrelator;c++)
2082 {
2083 binNo[cs][c] = 1;
2084 }
2085 } // for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
2086
6696a113 2087 for(Int_t n1=-fMaxHarmonic;n1<=fMaxHarmonic;n1++)
7ecb5af4 2088 {
68a8e667 2089 cout<< Form(" Patience, this takes some time... n1 = %d/%d\r",n1+fMaxHarmonic,2*fMaxHarmonic)<<flush; // TBI
6696a113 2090 if(fSkipZeroHarmonics && 0==n1){continue;}
68a8e667 2091 if(fCalculateOnlyForHarmonicQC && TMath::Abs(n1) != fHarmonicQC){continue;}
6696a113 2092 if(fCalculateAll)
2093 {
68a8e667 2094 for(Int_t cs=0;cs<2;cs++)
2095 {
2096 if(fCalculateOnlyCos && 1==cs){continue;}
2097 else if(fCalculateOnlySin && 0==cs){continue;}
2098 fCorrelationsPro[cs][0]->GetXaxis()->SetBinLabel(binNo[cs][0]++,Form("%s(%d)",sCosSin[cs].Data(),n1));
2099 } // for(Int_t cs=0;cs<2;cs++)
6696a113 2100 nToBeFilled[0]++;
2101 }
2102 if(1==fDontGoBeyond){continue;}
2103 for(Int_t n2=n1;n2<=fMaxHarmonic;n2++)
2104 {
2105 if(fSkipZeroHarmonics && 0==n2){continue;}
68a8e667 2106 if(fCalculateOnlyForHarmonicQC && TMath::Abs(n2) != fHarmonicQC){continue;}
6696a113 2107 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2) || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2))
68a8e667 2108 || (fCalculateSameIsotropic && 0==n1+n2 && TMath::Abs(n1)==TMath::Abs(n2))
2109 || (fCalculateOnlyForHarmonicQC && 0==n1+n2)
2110 || (fCalculateOnlyForSC && 0==n1+n2))
6696a113 2111 {
68a8e667 2112 for(Int_t cs=0;cs<2;cs++)
2113 {
2114 if(fCalculateOnlyCos && 1==cs){continue;}
2115 else if(fCalculateOnlySin && 0==cs){continue;}
2116 fCorrelationsPro[cs][1]->GetXaxis()->SetBinLabel(binNo[cs][1]++,Form("%s(%d,%d)",sCosSin[cs].Data(),n1,n2));
2117 } // for(Int_t cs=0;cs<2;cs++)
6696a113 2118 nToBeFilled[1]++;
2119 }
2120 if(2==fDontGoBeyond){continue;}
2121 for(Int_t n3=n2;n3<=fMaxHarmonic;n3++)
2122 {
2123 if(fSkipZeroHarmonics && 0==n3){continue;}
68a8e667 2124 if(fCalculateOnlyForHarmonicQC && TMath::Abs(n3) != fHarmonicQC){continue;}
6696a113 2125 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3) || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3))
68a8e667 2126 || (fCalculateSameIsotropic && 0==n1+n2+n3 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3))
2127 || (fCalculateOnlyForHarmonicQC && 0==n1+n2+n3))
6696a113 2128 {
68a8e667 2129 for(Int_t cs=0;cs<2;cs++)
2130 {
2131 if(fCalculateOnlyCos && 1==cs){continue;}
2132 else if(fCalculateOnlySin && 0==cs){continue;}
2133 fCorrelationsPro[cs][2]->GetXaxis()->SetBinLabel(binNo[cs][2]++,Form("%s(%d,%d,%d)",sCosSin[cs].Data(),n1,n2,n3));
2134 } // for(Int_t cs=0;cs<2;cs++)
6696a113 2135 nToBeFilled[2]++;
2136 }
2137 if(3==fDontGoBeyond){continue;}
2138 for(Int_t n4=n3;n4<=fMaxHarmonic;n4++)
2139 {
2140 if(fSkipZeroHarmonics && 0==n4){continue;}
68a8e667 2141 if(fCalculateOnlyForHarmonicQC && TMath::Abs(n4) != fHarmonicQC){continue;}
6696a113 2142 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4) || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4))
68a8e667 2143 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4))
2144 || (fCalculateOnlyForHarmonicQC && 0==n1+n2+n3+n4)
2145 || (fCalculateOnlyForSC && (0==n1+n4 && 0==n2+n3 && n1 != n2 && n3 != n4)))
6696a113 2146 {
68a8e667 2147 for(Int_t cs=0;cs<2;cs++)
2148 {
2149 if(fCalculateOnlyCos && 1==cs){continue;}
2150 else if(fCalculateOnlySin && 0==cs){continue;}
2151 fCorrelationsPro[cs][3]->GetXaxis()->SetBinLabel(binNo[cs][3]++,Form("%s(%d,%d,%d,%d)",sCosSin[cs].Data(),n1,n2,n3,n4));
2152 } // for(Int_t cs=0;cs<2;cs++)
6696a113 2153 nToBeFilled[3]++;
2154 }
2155 if(4==fDontGoBeyond){continue;}
2156 for(Int_t n5=n4;n5<=fMaxHarmonic;n5++)
2157 {
2158 if(fSkipZeroHarmonics && 0==n5){continue;}
68a8e667 2159 if(fCalculateOnlyForHarmonicQC && TMath::Abs(n5) != fHarmonicQC){continue;}
6696a113 2160 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5)
2161 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5))
68a8e667 2162 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5))
2163 || (fCalculateOnlyForHarmonicQC && 0==n1+n2+n3+n4+n5))
6696a113 2164 {
68a8e667 2165 for(Int_t cs=0;cs<2;cs++)
2166 {
2167 if(fCalculateOnlyCos && 1==cs){continue;}
2168 else if(fCalculateOnlySin && 0==cs){continue;}
2169 fCorrelationsPro[cs][4]->GetXaxis()->SetBinLabel(binNo[cs][4]++,Form("%s(%d,%d,%d,%d,%d)",sCosSin[cs].Data(),n1,n2,n3,n4,n5));
2170 } // for(Int_t cs=0;cs<2;cs++)
6696a113 2171 nToBeFilled[4]++;
2172 }
2173 if(5==fDontGoBeyond){continue;}
2174 for(Int_t n6=n5;n6<=fMaxHarmonic;n6++)
2175 {
2176 if(fSkipZeroHarmonics && 0==n6){continue;}
68a8e667 2177 if(fCalculateOnlyForHarmonicQC && TMath::Abs(n6) != fHarmonicQC){continue;}
6696a113 2178 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5+n6)
2179 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
2180 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6))
2181 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5+n6 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
68a8e667 2182 && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6))
2183 || (fCalculateOnlyForHarmonicQC && 0==n1+n2+n3+n4+n5+n6))
6696a113 2184 {
68a8e667 2185 for(Int_t cs=0;cs<2;cs++)
2186 {
2187 if(fCalculateOnlyCos && 1==cs){continue;}
2188 else if(fCalculateOnlySin && 0==cs){continue;}
2189 fCorrelationsPro[cs][5]->GetXaxis()->SetBinLabel(binNo[cs][5]++,Form("%s(%d,%d,%d,%d,%d,%d)",sCosSin[cs].Data(),n1,n2,n3,n4,n5,n6));
2190 } // for(Int_t cs=0;cs<2;cs++)
6696a113 2191 nToBeFilled[5]++;
2192 }
2193 if(6==fDontGoBeyond){continue;}
2194 for(Int_t n7=n6;n7<=fMaxHarmonic;n7++)
2195 {
2196 if(fSkipZeroHarmonics && 0==n7){continue;}
68a8e667 2197 if(fCalculateOnlyForHarmonicQC && TMath::Abs(n7) != fHarmonicQC){continue;}
6696a113 2198 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5+n6+n7)
2199 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
2200 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7))
2201 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5+n6+n7 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
68a8e667 2202 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7))
2203 || (fCalculateOnlyForHarmonicQC && 0==n1+n2+n3+n4+n5+n6+n7))
6696a113 2204 {
68a8e667 2205 for(Int_t cs=0;cs<2;cs++)
2206 {
2207 if(fCalculateOnlyCos && 1==cs){continue;}
2208 else if(fCalculateOnlySin && 0==cs){continue;}
2209 fCorrelationsPro[cs][6]->GetXaxis()->SetBinLabel(binNo[cs][6]++,Form("%s(%d,%d,%d,%d,%d,%d,%d)",sCosSin[cs].Data(),n1,n2,n3,n4,n5,n6,n7));
2210 } // for(Int_t cs=0;cs<2;cs++)
6696a113 2211 nToBeFilled[6]++;
2212 }
2213 if(7==fDontGoBeyond){continue;}
2214 for(Int_t n8=n7;n8<=fMaxHarmonic;n8++)
2215 {
2216 if(fSkipZeroHarmonics && 0==n8){continue;}
68a8e667 2217 if(fCalculateOnlyForHarmonicQC && TMath::Abs(n8) != fHarmonicQC){continue;}
6696a113 2218 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5+n6+n7+n8)
2219 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
2220 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7) && TMath::Abs(n1)==TMath::Abs(n8))
2221 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5+n6+n7+n8 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
2222 && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7)
68a8e667 2223 && TMath::Abs(n1)==TMath::Abs(n8))
2224 || (fCalculateOnlyForHarmonicQC && 0==n1+n2+n3+n4+n5+n6+n7+n8))
6696a113 2225 {
68a8e667 2226 for(Int_t cs=0;cs<2;cs++)
2227 {
2228 if(fCalculateOnlyCos && 1==cs){continue;}
2229 else if(fCalculateOnlySin && 0==cs){continue;}
2230 fCorrelationsPro[cs][7]->GetXaxis()->SetBinLabel(binNo[cs][7]++,Form("%s(%d,%d,%d,%d,%d,%d,%d,%d)",sCosSin[cs].Data(),n1,n2,n3,n4,n5,n6,n7,n8));
2231 } // for(Int_t cs=0;cs<2;cs++)
6696a113 2232 nToBeFilled[7]++;
2233 }
2234 } // for(Int_t n8=n7;n8<=fMaxHarmonic;n8++)
2235 } // for(Int_t n7=n6;n7<=fMaxHarmonic;n7++)
2236 } // for(Int_t n6=n5;n6<=fMaxHarmonic;n6++)
2237 } // for(Int_t n5=n4;n5<=fMaxHarmonic;n5++)
2238 } // for(Int_t n4=n3;n4<=fMaxHarmonic;n4++)
2239 } // for(Int_t n3=n2;n3<=fMaxHarmonic;n3++)
2240 } // for(Int_t n2=n1;n2<=fMaxHarmonic;n2++)
2241 } // for(Int_t n1=-fMaxHarmonic;n1<=fMaxHarmonic;n1++)
2242
2243 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
2244 {
68a8e667 2245 if(fCalculateOnlyCos && 1==cs){continue;}
2246 else if(fCalculateOnlySin && 0==cs){continue;}
6696a113 2247 for(Int_t c=0;c<fMaxCorrelator;c++) // [1p,2p,...,8p]
2248 {
2249 fCorrelationsPro[cs][c]->SetTitle(Form("%d-p correlations, %s terms, %d/%d in total",c+1,sCosSin[cs].Data(),nToBeFilled[c],nBinsTitle[c]));
2250 fCorrelationsPro[cs][c]->GetXaxis()->SetRangeUser(0.,fCorrelationsPro[cs][c]->GetBinLowEdge(nToBeFilled[c]+1));
2251 }
7ecb5af4 2252 }
68a8e667 2253 cout<<" Booked. "<<endl; // TBI
7ecb5af4 2254
2255} // end of void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForCorrelations()
2256
2257//=======================================================================================================================
2258
68a8e667 2259void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForDiffCorrelations()
2260{
2261 // Book all the stuff for differential correlations.
2262
2263 // a) Book the profile holding all the flags for differential correlations;
2264 // b) Book TProfile *fDiffCorrelationsPro[2][4] ([0=cos,1=sin][1p,2p,3p,4p]).
2265
2266 TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForDiffCorrelations()";
2267
2268 // a) Book the profile holding all the flags for differential correlations:
2269 fDiffCorrelationsFlagsPro = new TProfile("fDiffCorrelationsFlagsPro","Flags for differential correlations",1,0,1);
2270 fDiffCorrelationsFlagsPro->SetTickLength(-0.01,"Y");
2271 fDiffCorrelationsFlagsPro->SetMarkerStyle(25);
2272 fDiffCorrelationsFlagsPro->SetLabelSize(0.03);
2273 fDiffCorrelationsFlagsPro->SetLabelOffset(0.02,"Y");
2274 fDiffCorrelationsFlagsPro->SetStats(kFALSE);
2275 fDiffCorrelationsFlagsPro->SetFillColor(kGray);
2276 fDiffCorrelationsFlagsPro->SetLineColor(kBlack);
2277 fDiffCorrelationsFlagsPro->GetXaxis()->SetBinLabel(1,"fCalculateDiffCorrelations"); fDiffCorrelationsFlagsPro->Fill(0.5,fCalculateDiffCorrelations);
2278 fDiffCorrelationsList->Add(fDiffCorrelationsFlagsPro);
2279
2280 // b) Book TProfile *fDiffCorrelationsPro[2][4] ([0=cos,1=sin][1p,2p,3p,4p]):
2281 Bool_t fDiffStore[2][4] = {{0,1,1,1},{0,0,0,0}}; // store or not TBI promote to data member, and implement setter perhaps
2282 Int_t nBinsPt = 100; // TBI
2283 Double_t dPtMin = 0.; // TBI
2284 Double_t dPtMax = 10.; // TBI
2285 Int_t markerColor[2] = {kRed,kGreen};
2286 Int_t markerStyle[2] = {kFullSquare,kOpenSquare};
2287 TString sCosSin[2] = {"Cos","Sin"};
2288 TString sLabel[4] = {Form("%d",fDiffHarmonics[0][0]),
2289 Form("%d,%d",fDiffHarmonics[1][0],fDiffHarmonics[1][1]),
2290 Form("%d,%d,%d",fDiffHarmonics[2][0],fDiffHarmonics[2][1],fDiffHarmonics[2][2]),
2291 Form("%d,%d,%d,%d",fDiffHarmonics[3][0],fDiffHarmonics[3][1],fDiffHarmonics[3][2],fDiffHarmonics[3][3])};
2292
2293 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
2294 {
2295 for(Int_t c=0;c<4;c++) // [1p,2p,3p,4p]
2296 {
2297 fDiffCorrelationsPro[cs][c] = new TProfile(Form("%s, %dp, %s",sCosSin[cs].Data(),c+1,"pt"),
2298 Form("%s(%s)",sCosSin[cs].Data(),sLabel[c].Data()),
2299 nBinsPt,dPtMin,dPtMax);
2300 fDiffCorrelationsPro[cs][c]->Sumw2();
2301 fDiffCorrelationsPro[cs][c]->SetStats(kFALSE);
2302 fDiffCorrelationsPro[cs][c]->SetMarkerColor(markerColor[cs]);
2303 fDiffCorrelationsPro[cs][c]->SetMarkerStyle(markerStyle[cs]);
2304 fDiffCorrelationsPro[cs][c]->GetXaxis()->SetTitle("p_{T}");
2305 if(fDiffStore[cs][c]){fDiffCorrelationsList->Add(fDiffCorrelationsPro[cs][c]);}
2306 } // for(Int_t c=0;c<4;c++) // [1p,2p,3p,4p]
2307 } // for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
2308
2309} // void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForDiffCorrelations()
2310
2311//=======================================================================================================================
2312
2313void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForEbECumulants()
7ecb5af4 2314{
68a8e667 2315 // Book all the stuff for event-by-event cumulants.
7ecb5af4 2316
68a8e667 2317 // a) Book the profile holding all the flags for e-b-e cumulants;
2318 // b) Book TProfile *fEbECumulantsPro[2][8] ([0=cos,1=sin][1p,2p,...,8p]).
7ecb5af4 2319
68a8e667 2320 TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForEbECumulants()";
7ecb5af4 2321
68a8e667 2322 // a) Book the profile holding all the flags for e-b-e cumulants:
2323 fEbECumulantsFlagsPro = new TProfile("fEbECumulantsFlagsPro","Flags for e-b-e cumulants",1,0,1);
2324 fEbECumulantsFlagsPro->SetTickLength(-0.01,"Y");
2325 fEbECumulantsFlagsPro->SetMarkerStyle(25);
2326 fEbECumulantsFlagsPro->SetLabelSize(0.03);
2327 fEbECumulantsFlagsPro->SetLabelOffset(0.02,"Y");
2328 fEbECumulantsFlagsPro->SetStats(kFALSE);
2329 fEbECumulantsFlagsPro->SetFillColor(kGray);
2330 fEbECumulantsFlagsPro->SetLineColor(kBlack);
2331 fEbECumulantsFlagsPro->GetXaxis()->SetBinLabel(1,"fCalculateEbECumulants"); fEbECumulantsFlagsPro->Fill(0.5,fCalculateEbECumulants);
2332 fEbECumulantsList->Add(fEbECumulantsFlagsPro);
2333
2334 if(!fCalculateEbECumulants){return;} // TBI is this safe enough?
2335
2336 // b) Book TProfile *fEbECumulantsPro[2][8] ([0=cos,1=sin][1p,2p,...,8p]):
2337 TString sCosSin[2] = {"Cos","Sin"};
2338 Int_t markerColor[2] = {kBlue,kRed};
2339 Int_t markerStyle[2] = {kFullSquare,kFullSquare};
2340 Int_t nBins[8] = {1,1,1,1,1,1,1,1}; // TBI hardwired 8, shall be fMaxCorrelator
2341 Int_t nBinsTitle[8] = {1,1,1,1,1,1,1,1}; // TBI hardwired 8, shall be fMaxCorrelator
2342 Int_t nToBeFilled[8] = {0,0,0,0,0,0,0,0}; // TBI hardwired 8, shall be fMaxCorrelator
2343 for(Int_t c=0;c<fMaxCorrelator;c++) // [1p,2p,...,8p]
2344 {
2345 // Implementing \binom{n+k-1}{k}, which is the resulting number of sets obtained
2346 // after sampling n starting elements into k subsets, repetitions allowed.
2347 // In my case, n=2*fMaxHarmonic+1, k=c+1, hence:
2348 nBins[c] = (Int_t)(TMath::Factorial(2*fMaxHarmonic+1+c+1-1)
2349 / (TMath::Factorial(2*fMaxHarmonic+1-1)*TMath::Factorial(c+1)));
2350 nBinsTitle[c] = nBins[c];
2351 if(c>=fDontGoBeyond){nBins[c]=1;} // TBI a bit of spaghetti here...
2352 } // for(Int_t c=0;c<8;c++) // [1p,2p,...,8p]
2353 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
2354 {
2355 for(Int_t c=0;c<fMaxCorrelator;c++) // [1p,2p,...,8p]
2356 {
2357 fEbECumulantsPro[cs][c] = new TProfile(Form("%dpEbECumulants%s",c+1,sCosSin[cs].Data()),"",nBins[c],0.,1.*nBins[c]);
2358 fEbECumulantsPro[cs][c]->Sumw2();
2359 fEbECumulantsPro[cs][c]->SetStats(kFALSE);
2360 fEbECumulantsPro[cs][c]->SetMarkerColor(markerColor[cs]);
2361 fEbECumulantsPro[cs][c]->SetMarkerStyle(markerStyle[cs]);
2362 fEbECumulantsList->Add(fEbECumulantsPro[cs][c]);
2363 } // for(Int_t c=0;c<8;c++) // [1p,2p,...,8p]
2364 } // for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
2365 // Set all bin labels: TBI this can be implemented better, most likely...
2366 Int_t binNo[8]; for(Int_t c=0;c<fMaxCorrelator;c++){binNo[c]=1;} // TBI hardwired 8, shall be fMaxCorrelator
2367 for(Int_t n1=-fMaxHarmonic;n1<=fMaxHarmonic;n1++)
2368 {
2369 if(fSkipZeroHarmonics && 0==n1){continue;}
2370 if(fCalculateAll)
2371 {
2372 fEbECumulantsPro[0][0]->GetXaxis()->SetBinLabel(binNo[0],Form("Cos(%d)",n1));
2373 fEbECumulantsPro[1][0]->GetXaxis()->SetBinLabel(binNo[0]++,Form("Sin(%d)",n1));
2374 nToBeFilled[0]++;
2375 }
2376 if(1==fDontGoBeyond){continue;}
2377 for(Int_t n2=n1;n2<=fMaxHarmonic;n2++)
2378 {
2379 if(fSkipZeroHarmonics && 0==n2){continue;}
2380 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2) || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2))
2381 || (fCalculateSameIsotropic && 0==n1+n2 && TMath::Abs(n1)==TMath::Abs(n2)))
2382 {
2383 fEbECumulantsPro[0][1]->GetXaxis()->SetBinLabel(binNo[1],Form("Cos(%d,%d)",n1,n2));
2384 fEbECumulantsPro[1][1]->GetXaxis()->SetBinLabel(binNo[1]++,Form("Sin(%d,%d)",n1,n2));
2385 nToBeFilled[1]++;
2386 }
2387 if(2==fDontGoBeyond){continue;}
2388 for(Int_t n3=n2;n3<=fMaxHarmonic;n3++)
2389 {
2390 if(fSkipZeroHarmonics && 0==n3){continue;}
2391 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3) || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3))
2392 || (fCalculateSameIsotropic && 0==n1+n2+n3 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)))
2393 {
2394 fEbECumulantsPro[0][2]->GetXaxis()->SetBinLabel(binNo[2],Form("Cos(%d,%d,%d)",n1,n2,n3));
2395 fEbECumulantsPro[1][2]->GetXaxis()->SetBinLabel(binNo[2]++,Form("Sin(%d,%d,%d)",n1,n2,n3));
2396 nToBeFilled[2]++;
2397 }
2398 if(3==fDontGoBeyond){continue;}
2399 for(Int_t n4=n3;n4<=fMaxHarmonic;n4++)
2400 {
2401 if(fSkipZeroHarmonics && 0==n4){continue;}
2402 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4) || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4))
2403 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)))
2404 {
2405 fEbECumulantsPro[0][3]->GetXaxis()->SetBinLabel(binNo[3],Form("Cos(%d,%d,%d,%d)",n1,n2,n3,n4));
2406 fEbECumulantsPro[1][3]->GetXaxis()->SetBinLabel(binNo[3]++,Form("Sin(%d,%d,%d,%d)",n1,n2,n3,n4));
2407 nToBeFilled[3]++;
2408 }
2409 if(4==fDontGoBeyond){continue;}
2410 for(Int_t n5=n4;n5<=fMaxHarmonic;n5++)
2411 {
2412 if(fSkipZeroHarmonics && 0==n5){continue;}
2413 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5)
2414 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5))
2415 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5)))
2416 {
2417 fEbECumulantsPro[0][4]->GetXaxis()->SetBinLabel(binNo[4],Form("Cos(%d,%d,%d,%d,%d)",n1,n2,n3,n4,n5));
2418 fEbECumulantsPro[1][4]->GetXaxis()->SetBinLabel(binNo[4]++,Form("Sin(%d,%d,%d,%d,%d)",n1,n2,n3,n4,n5));
2419 nToBeFilled[4]++;
2420 }
2421 if(5==fDontGoBeyond){continue;}
2422 for(Int_t n6=n5;n6<=fMaxHarmonic;n6++)
2423 {
2424 if(fSkipZeroHarmonics && 0==n6){continue;}
2425 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5+n6)
2426 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
2427 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6))
2428 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5+n6 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
2429 && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6)))
2430 {
2431 fEbECumulantsPro[0][5]->GetXaxis()->SetBinLabel(binNo[5],Form("Cos(%d,%d,%d,%d,%d,%d)",n1,n2,n3,n4,n5,n6));
2432 fEbECumulantsPro[1][5]->GetXaxis()->SetBinLabel(binNo[5]++,Form("Sin(%d,%d,%d,%d,%d,%d)",n1,n2,n3,n4,n5,n6));
2433 nToBeFilled[5]++;
2434 }
2435 if(6==fDontGoBeyond){continue;}
2436 for(Int_t n7=n6;n7<=fMaxHarmonic;n7++)
2437 {
2438 if(fSkipZeroHarmonics && 0==n7){continue;}
2439 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5+n6+n7)
2440 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
2441 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7))
2442 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5+n6+n7 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
2443 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7)))
2444 {
2445 fEbECumulantsPro[0][6]->GetXaxis()->SetBinLabel(binNo[6],Form("Cos(%d,%d,%d,%d,%d,%d,%d)",n1,n2,n3,n4,n5,n6,n7));
2446 fEbECumulantsPro[1][6]->GetXaxis()->SetBinLabel(binNo[6]++,Form("Sin(%d,%d,%d,%d,%d,%d,%d)",n1,n2,n3,n4,n5,n6,n7));
2447 nToBeFilled[6]++;
2448 }
2449 if(7==fDontGoBeyond){continue;}
2450 for(Int_t n8=n7;n8<=fMaxHarmonic;n8++)
2451 {
2452 if(fSkipZeroHarmonics && 0==n8){continue;}
2453 if(fCalculateAll || (fCalculateIsotropic && 0==n1+n2+n3+n4+n5+n6+n7+n8)
2454 || (fCalculateSame && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3) && TMath::Abs(n1)==TMath::Abs(n4)
2455 && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7) && TMath::Abs(n1)==TMath::Abs(n8))
2456 || (fCalculateSameIsotropic && 0==n1+n2+n3+n4+n5+n6+n7+n8 && TMath::Abs(n1)==TMath::Abs(n2) && TMath::Abs(n1)==TMath::Abs(n3)
2457 && TMath::Abs(n1)==TMath::Abs(n4) && TMath::Abs(n1)==TMath::Abs(n5) && TMath::Abs(n1)==TMath::Abs(n6) && TMath::Abs(n1)==TMath::Abs(n7)
2458 && TMath::Abs(n1)==TMath::Abs(n8)))
2459 {
2460 fEbECumulantsPro[0][7]->GetXaxis()->SetBinLabel(binNo[7],Form("Cos(%d,%d,%d,%d,%d,%d,%d,%d)",n1,n2,n3,n4,n5,n6,n7,n8));
2461 fEbECumulantsPro[1][7]->GetXaxis()->SetBinLabel(binNo[7]++,Form("Sin(%d,%d,%d,%d,%d,%d,%d,%d)",n1,n2,n3,n4,n5,n6,n7,n8));
2462 nToBeFilled[7]++;
2463 }
2464 } // for(Int_t n8=n7;n8<=fMaxHarmonic;n8++)
2465 } // for(Int_t n7=n6;n7<=fMaxHarmonic;n7++)
2466 } // for(Int_t n6=n5;n6<=fMaxHarmonic;n6++)
2467 } // for(Int_t n5=n4;n5<=fMaxHarmonic;n5++)
2468 } // for(Int_t n4=n3;n4<=fMaxHarmonic;n4++)
2469 } // for(Int_t n3=n2;n3<=fMaxHarmonic;n3++)
2470 } // for(Int_t n2=n1;n2<=fMaxHarmonic;n2++)
2471 } // for(Int_t n1=-fMaxHarmonic;n1<=fMaxHarmonic;n1++)
7ecb5af4 2472
68a8e667 2473 for(Int_t cs=0;cs<2;cs++) // [0=cos,1=sin]
7ecb5af4 2474 {
68a8e667 2475 for(Int_t c=0;c<fMaxCorrelator;c++) // [1p,2p,...,8p]
2476 {
2477 fEbECumulantsPro[cs][c]->SetTitle(Form("%d-p e-b-e cumulants, %s terms, %d/%d in total",c+1,sCosSin[cs].Data(),nToBeFilled[c],nBinsTitle[c]));
2478 fEbECumulantsPro[cs][c]->GetXaxis()->SetRangeUser(0.,fEbECumulantsPro[cs][c]->GetBinLowEdge(nToBeFilled[c]+1));
2479 }
7ecb5af4 2480 }
7ecb5af4 2481
68a8e667 2482} // end of void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForEbECumulants()
7ecb5af4 2483
2484//=======================================================================================================================
2485
2486void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForNestedLoops()
2487{
2488 // Book all the stuff for nested loops.
2489
6696a113 2490 // TBI this method is just ugly, who implemented it like this...
2491
7ecb5af4 2492 // a) Set default harmonic values;
2493 // b) Book the profile holding all the flags for nested loops;
2494 // c) Book the profile holding all results for nested loops (cosine);
68a8e667 2495 // d) Book the profile holding all results for nested loops (sinus);
2496 // e) Book the profile holding all results for differential nested loops.
7ecb5af4 2497
6696a113 2498 // a) Set default harmonic values:
2499 //delete gRandom; // TBI this is not safe here,
2500 //gRandom = new TRandom3(0);
9efbd2f5 2501 Int_t h1 = (Int_t)pow(-1.,1.*gRandom->Integer(fMaxHarmonic+1))*gRandom->Integer(fMaxHarmonic+1); // TBI reimplement all these lines eventually
2502 Int_t h2 = (Int_t)pow(-1.,1.*gRandom->Integer(fMaxHarmonic+1))*gRandom->Integer(fMaxHarmonic+1);
2503 Int_t h3 = (Int_t)pow(-1.,1.*gRandom->Integer(fMaxHarmonic+1))*gRandom->Integer(fMaxHarmonic+1);
2504 Int_t h4 = (Int_t)pow(-1.,1.*gRandom->Integer(fMaxHarmonic+1))*gRandom->Integer(fMaxHarmonic+1);
2505 Int_t h5 = (Int_t)pow(-1.,1.*gRandom->Integer(fMaxHarmonic+1))*gRandom->Integer(fMaxHarmonic+1);
2506 Int_t h6 = (Int_t)pow(-1.,1.*gRandom->Integer(fMaxHarmonic+1))*gRandom->Integer(fMaxHarmonic+1);
2507 Int_t h7 = (Int_t)pow(-1.,1.*gRandom->Integer(fMaxHarmonic+1))*gRandom->Integer(fMaxHarmonic+1);
2508 Int_t h8 = (Int_t)pow(-1.,1.*gRandom->Integer(fMaxHarmonic+1))*gRandom->Integer(fMaxHarmonic+1);
6696a113 2509
7ecb5af4 2510 // REMARK: This values can be overriden in a steering macro via
2511 // mpc->GetNestedLoopsFlagsPro()->SetBinContent(<binNo>,<value>);
2512
2513 // b) Book the profile holding all the flags for nested loops:
68a8e667 2514 fNestedLoopsFlagsPro = new TProfile("fNestedLoopsFlagsPro","Flags for nested loops",10,0,10);
7ecb5af4 2515 fNestedLoopsFlagsPro->SetTickLength(-0.01,"Y");
2516 fNestedLoopsFlagsPro->SetMarkerStyle(25);
2517 fNestedLoopsFlagsPro->SetLabelSize(0.03);
2518 fNestedLoopsFlagsPro->SetLabelOffset(0.02,"Y");
2519 fNestedLoopsFlagsPro->SetStats(kFALSE);
2520 fNestedLoopsFlagsPro->SetFillColor(kGray);
2521 fNestedLoopsFlagsPro->SetLineColor(kBlack);
2522 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(1,"fCrossCheckWithNestedLoops"); fNestedLoopsFlagsPro->Fill(0.5,fCrossCheckWithNestedLoops);
2523 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(2,"h_{1}"); fNestedLoopsFlagsPro->Fill(1.5,h1);
2524 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(3,"h_{2}"); fNestedLoopsFlagsPro->Fill(2.5,h2);
2525 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(4,"h_{3}"); fNestedLoopsFlagsPro->Fill(3.5,h3);
2526 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(5,"h_{4}"); fNestedLoopsFlagsPro->Fill(4.5,h4);
2527 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(6,"h_{5}"); fNestedLoopsFlagsPro->Fill(5.5,h5);
2528 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(7,"h_{6}"); fNestedLoopsFlagsPro->Fill(6.5,h6);
2529 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(8,"h_{7}"); fNestedLoopsFlagsPro->Fill(7.5,h7);
2530 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(9,"h_{8}"); fNestedLoopsFlagsPro->Fill(8.5,h8);
68a8e667 2531 fNestedLoopsFlagsPro->GetXaxis()->SetBinLabel(10,"fCrossCheckDiffWithNestedLoops"); fNestedLoopsFlagsPro->Fill(9.5,fCrossCheckDiffWithNestedLoops);
7ecb5af4 2532 fNestedLoopsList->Add(fNestedLoopsFlagsPro);
2533
7ecb5af4 2534 // c) Book the profile holding all results for nested loops (cosine):
2535 fNestedLoopsResultsCosPro = new TProfile("fNestedLoopsResultsCosPro","Nested loops results (cosine)",16,0,16);
2536 fNestedLoopsResultsCosPro->SetTickLength(-0.01,"Y");
2537 fNestedLoopsResultsCosPro->SetMarkerStyle(25);
2538 fNestedLoopsResultsCosPro->SetLabelSize(0.02);
2539 fNestedLoopsResultsCosPro->SetLabelOffset(0.02,"Y");
2540 fNestedLoopsResultsCosPro->SetStats(kFALSE);
2541 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(1,Form("N: 1p(%d)",h1));
2542 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(2,Form("Q: 1p(%d)",h1));
2543 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(3,Form("N: 2p(%d,%d)",h1,h2));
2544 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(4,Form("Q: 2p(%d,%d)",h1,h2));
2545 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(5,Form("N: 3p(%d,%d,%d)",h1,h2,h3));
2546 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(6,Form("Q: 3p(%d,%d,%d)",h1,h2,h3));
2547 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(7,Form("N: 4p(%d,%d,%d,%d)",h1,h2,h3,h4));
2548 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(8,Form("Q: 4p(%d,%d,%d,%d)",h1,h2,h3,h4));
2549 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(9,Form("N: 5p(%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5));
2550 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(10,Form("Q: 5p(%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5));
2551 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(11,Form("N: 6p(%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6));
2552 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(12,Form("Q: 6p(%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6));
2553 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(13,Form("N: 7p(%d,%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6,h7));
2554 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(14,Form("Q: 7p(%d,%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6,h7));
2555 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(15,Form("N: 8p(%d,%d,%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6,h7,h8));
2556 fNestedLoopsResultsCosPro->GetXaxis()->SetBinLabel(16,Form("Q: 8p(%d,%d,%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6,h7,h8));
68a8e667 2557 if(fCrossCheckWithNestedLoops){fNestedLoopsList->Add(fNestedLoopsResultsCosPro);} else{delete fNestedLoopsResultsCosPro;}
7ecb5af4 2558
2559 // d) Book the profile holding all results for nested loops (sinus):
2560 fNestedLoopsResultsSinPro = new TProfile("fNestedLoopsResultsSinPro","Nested loops results (sinus)",16,0,16);
2561 fNestedLoopsResultsSinPro->SetTickLength(-0.01,"Y");
2562 fNestedLoopsResultsSinPro->SetMarkerStyle(25);
2563 fNestedLoopsResultsSinPro->SetLabelSize(0.02);
2564 fNestedLoopsResultsSinPro->SetLabelOffset(0.02,"Y");
2565 fNestedLoopsResultsSinPro->SetStats(kFALSE);
2566 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(1,Form("N: 1p(%d)",h1));
2567 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(2,Form("Q: 1p(%d)",h1));
2568 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(3,Form("N: 2p(%d,%d)",h1,h2));
2569 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(4,Form("Q: 2p(%d,%d)",h1,h2));
2570 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(5,Form("N: 3p(%d,%d,%d)",h1,h2,h3));
2571 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(6,Form("Q: 3p(%d,%d,%d)",h1,h2,h3));
2572 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(7,Form("N: 4p(%d,%d,%d,%d)",h1,h2,h3,h4));
2573 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(8,Form("Q: 4p(%d,%d,%d,%d)",h1,h2,h3,h4));
2574 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(9,Form("N: 5p(%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5));
2575 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(10,Form("Q: 5p(%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5));
2576 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(11,Form("N: 6p(%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6));
2577 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(12,Form("Q: 6p(%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6));
2578 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(13,Form("N: 7p(%d,%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6,h7));
2579 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(14,Form("Q: 7p(%d,%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6,h7));
2580 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(15,Form("N: 8p(%d,%d,%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6,h7,h8));
2581 fNestedLoopsResultsSinPro->GetXaxis()->SetBinLabel(16,Form("Q: 8p(%d,%d,%d,%d,%d,%d,%d,%d)",h1,h2,h3,h4,h5,h6,h7,h8));
68a8e667 2582 if(fCrossCheckWithNestedLoops){fNestedLoopsList->Add(fNestedLoopsResultsSinPro);} else{delete fNestedLoopsResultsSinPro;}
2583
2584 // e) Book the profile holding all results for differential nested loops:
2585 fNestedLoopsDiffResultsPro = new TProfile("fNestedLoopsDiffResultsPro","Differential nested loops results",1,0.,1.);
2586 fNestedLoopsDiffResultsPro->SetStats(kFALSE);
2587 if(fCrossCheckDiffWithNestedLoops){fNestedLoopsList->Add(fNestedLoopsDiffResultsPro);} else{delete fNestedLoopsDiffResultsPro;}
7ecb5af4 2588
2589} // void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForNestedLoops()
2590
2591//=======================================================================================================================
2592
2593void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForStandardCandles()
2594{
2595 // Book all the stuff for 'standard candles'.
2596
2597 // a) Book the profile holding all the flags for 'standard candles';
6d19c373 2598 // b) Book the histogram holding all results for 'standard candles';
68a8e667 2599 // c) Book TProfile2D *fProductsSCPro.
7ecb5af4 2600
9efbd2f5 2601 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForStandardCandles()";
2602
7ecb5af4 2603 // a) Book the profile holding all the flags for 'standard candles':
68a8e667 2604 fStandardCandlesFlagsPro = new TProfile("fStandardCandlesFlagsPro","Flags for standard candles",2,0,2);
7ecb5af4 2605 fStandardCandlesFlagsPro->SetTickLength(-0.01,"Y");
2606 fStandardCandlesFlagsPro->SetMarkerStyle(25);
2607 fStandardCandlesFlagsPro->SetLabelSize(0.03);
2608 fStandardCandlesFlagsPro->SetLabelOffset(0.02,"Y");
2609 fStandardCandlesFlagsPro->SetStats(kFALSE);
2610 fStandardCandlesFlagsPro->SetFillColor(kGray);
2611 fStandardCandlesFlagsPro->SetLineColor(kBlack);
2612 fStandardCandlesFlagsPro->GetXaxis()->SetBinLabel(1,"fCalculateStandardCandles"); fStandardCandlesFlagsPro->Fill(0.5,fCalculateStandardCandles);
68a8e667 2613 fStandardCandlesFlagsPro->GetXaxis()->SetBinLabel(2,"fPropagateErrorSC"); fStandardCandlesFlagsPro->Fill(1.5,fPropagateErrorSC);
7ecb5af4 2614 fStandardCandlesList->Add(fStandardCandlesFlagsPro);
2615
2616 if(!fCalculateStandardCandles){return;} // TBI is this safe like this?
2617
2618 // b) Book the histogram holding all results for 'standard candles':
9efbd2f5 2619 Int_t nBins = fMaxHarmonic*(fMaxHarmonic-1)/2;
68a8e667 2620 fStandardCandlesHist = new TH1D("fStandardCandlesHist","Standard candles (SC)",nBins,0.,1.*nBins);
7ecb5af4 2621 fStandardCandlesHist->SetStats(kFALSE);
6d19c373 2622 fStandardCandlesHist->SetMarkerStyle(kFullSquare);
2623 fStandardCandlesHist->SetMarkerColor(kBlue);
2624 fStandardCandlesHist->SetLineColor(kBlue);
9efbd2f5 2625 Int_t binNo = 1;
2626 for(Int_t n1=-fMaxHarmonic;n1<=-2;n1++)
2627 {
2628 for(Int_t n2=n1+1;n2<=-1;n2++)
2629 {
2630 fStandardCandlesHist->GetXaxis()->SetBinLabel(binNo++,Form("SC(%d,%d,%d,%d)",n1,n2,-1*n2,-1*n1));
2631 }
2632 }
2633 if(binNo-1 != nBins){Fatal(sMethodName.Data(),"Well, binNo-1 != nBins ... :'( ");}
7ecb5af4 2634 fStandardCandlesList->Add(fStandardCandlesHist);
2635
68a8e667 2636 if(!fPropagateErrorSC){return;} // TBI is this safe like this?
2637
2638 // c) Book TProfile2D *fProductsSCPro:
2639 Int_t nBins2D = fMaxHarmonic + fMaxHarmonic*(fMaxHarmonic-1)/2; // #2-p + #4-p distinct correlators in SC context
2640 if(nBins2D<=0){Fatal(sMethodName.Data(),"nBins2D<=0");} // well, just in case...
2641 fProductsSCPro = new TProfile2D("fProductsSCPro","Products of correlations",nBins2D,0.,nBins2D,nBins2D,0.,nBins2D);
2642 fProductsSCPro->SetStats(kFALSE);
2643 fProductsSCPro->Sumw2();
2644 for(Int_t b=1;b<=fMaxHarmonic;b++) // 2-p correlators
6d19c373 2645 {
68a8e667 2646 fProductsSCPro->GetXaxis()->SetBinLabel(b,Form("Cos(%d,%d)",-(fMaxHarmonic+1-b),(fMaxHarmonic+1-b)));
2647 fProductsSCPro->GetYaxis()->SetBinLabel(b,Form("Cos(%d,%d)",-(fMaxHarmonic+1-b),(fMaxHarmonic+1-b)));
2648 } // for(Int_t b=1;b<=fMaxHarmonic;b++) // 2-p correlators
2649 for(Int_t b=fMaxHarmonic+1;b<=nBins2D;b++) // 4-p correlators
6d19c373 2650 {
68a8e667 2651 TString sBinLabel = fStandardCandlesHist->GetXaxis()->GetBinLabel(b-fMaxHarmonic);
2652 if(sBinLabel.EqualTo("")){Fatal(sMethodName.Data(),"sBinLabel.EqualTo...");}
2653 fProductsSCPro->GetXaxis()->SetBinLabel(b,sBinLabel.ReplaceAll("SC","Cos").Data());
2654 fProductsSCPro->GetYaxis()->SetBinLabel(b,sBinLabel.ReplaceAll("SC","Cos").Data());
2655 } // for(Int_t b=fMaxHarmonic+1;b<=nBins2D;b++) // 4-p correlators
2656 fStandardCandlesList->Add(fProductsSCPro);
6d19c373 2657
7ecb5af4 2658} // end of void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForStandardCandles()
2659
2660//=======================================================================================================================
2661
37d2f768 2662void AliFlowAnalysisWithMultiparticleCorrelations::GetOutputHistograms(TList *histList)
2663{
7ecb5af4 2664 // Get pointers for everything and everywhere from the base list "fHistList".
2665
2666 // a) Get pointer for base list fHistList;
2667 // b) Get pointer for profile holding internal flags and, well, set again all flags;
2668 // c) Get pointers for control histograms;
9efbd2f5 2669 // d) Get pointers for Q-vector;
2670 // e) Get pointers for correlations;
68a8e667 2671 // f) Get pointers for 'standard candles';
2672 // g) Get pointers for Q-cumulants;
2673 // h) Get pointers for differential correlations.
7ecb5af4 2674
6696a113 2675 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::GetOutputHistograms(TList *histList)";
2676
7ecb5af4 2677 // a) Get pointer for base list fHistList and profile holding internal flags;
2678 fHistList = histList;
9efbd2f5 2679 if(!fHistList){Fatal(sMethodName.Data(),"fHistList is malicious today...");}
7ecb5af4 2680
2681 // b) Get pointer for profile holding internal flags and, well, set again all flags:
2682 fInternalFlagsPro = dynamic_cast<TProfile*>(fHistList->FindObject("fInternalFlagsPro"));
6696a113 2683 if(!fInternalFlagsPro){Fatal(sMethodName.Data(),"fInternalFlagsPro");}
7ecb5af4 2684 fUseInternalFlags = fInternalFlagsPro->GetBinContent(1);
9efbd2f5 2685 fMinNoRPs = (Int_t)fInternalFlagsPro->GetBinContent(2);
2686 fMaxNoRPs = (Int_t)fInternalFlagsPro->GetBinContent(3);
2687 fExactNoRPs = (Int_t)fInternalFlagsPro->GetBinContent(4);
7ecb5af4 2688
2689 // c) Get pointers for control histograms:
2690 this->GetPointersForControlHistograms();
2691
9efbd2f5 2692 // d) Get pointers for Q-vector:
2693 this->GetPointersForQvector();
2694
2695 // e) Get pointers for correlations:
7ecb5af4 2696 this->GetPointersForCorrelations();
2697
9efbd2f5 2698 // f) Get pointers for 'standard candles':
7ecb5af4 2699 this->GetPointersForStandardCandles();
68a8e667 2700
2701 // g) Get pointers for Q-cumulants:
2702 this->GetPointersForQcumulants();
2703
2704 // h) Get pointers for differential correlations:
2705 this->GetPointersForDiffCorrelations();
7ecb5af4 2706
2707} // void AliFlowAnalysisWithMultiparticleCorrelations::GetOutputHistograms(TList *histList)
2708
2709//=======================================================================================================================
2710
9efbd2f5 2711void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForQvector()
2712{
2713 // Get pointers for Q-vector objects.
2714
68a8e667 2715 // a) Get pointer for fQvectorList;
2716 // b) Get pointer for fQvectorFlagsPro;
2717 // c) Set again all flags.
9efbd2f5 2718
2719 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForQvector()";
2720
68a8e667 2721 // a) Get pointer for fQvectorList:
2722 fQvectorList = dynamic_cast<TList*>(fHistList->FindObject("Q-vectors"));
9efbd2f5 2723 if(!fQvectorList){Fatal(sMethodName.Data(),"fQvectorList");}
2724
68a8e667 2725 // b) Get pointer for fQvectorFlagsPro:
9efbd2f5 2726 fQvectorFlagsPro = dynamic_cast<TProfile*>(fQvectorList->FindObject("fQvectorFlagsPro"));
2727 if(!fQvectorFlagsPro){Fatal(sMethodName.Data(),"fQvectorFlagsPro");}
2728
68a8e667 2729 // c) Set again all flags:
9efbd2f5 2730 fCalculateQvector = (Bool_t)fQvectorFlagsPro->GetBinContent(1);
68a8e667 2731 fCalculateDiffQvectors = (Bool_t)fQvectorFlagsPro->GetBinContent(2);
9efbd2f5 2732
2733} // void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForQvector()
2734
2735//=======================================================================================================================
2736
7ecb5af4 2737void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForStandardCandles()
2738{
2739 // Get pointers for 'standard candles'.
2740
68a8e667 2741 // a) Get pointer for fStandardCandlesList;
2742 // b) Get pointer for fStandardCandlesFlagsPro;
2743 // c) Set again all flags;
2744 // d) Get pointer TH1D *fStandardCandlesHist;
2745 // e) Get pointer TProfile2D *fProductsSCPro.
7ecb5af4 2746
6696a113 2747 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForStandardCandles()";
2748
68a8e667 2749 // a) Get pointer for fStandardCandlesList:
7ecb5af4 2750 fStandardCandlesList = dynamic_cast<TList*>(fHistList->FindObject("Standard Candles"));
6696a113 2751 if(!fStandardCandlesList){Fatal(sMethodName.Data(),"fStandardCandlesList");}
7ecb5af4 2752
68a8e667 2753 // b) Get pointer for fStandardCandlesFlagsPro:
7ecb5af4 2754 fStandardCandlesFlagsPro = dynamic_cast<TProfile*>(fStandardCandlesList->FindObject("fStandardCandlesFlagsPro"));
6696a113 2755 if(!fStandardCandlesFlagsPro){Fatal(sMethodName.Data(),"fStandardCandlesFlagsPro");}
7ecb5af4 2756
68a8e667 2757 // c) Set again all flags:
2758 fCalculateStandardCandles = (Bool_t)fStandardCandlesFlagsPro->GetBinContent(1);
2759 fPropagateErrorSC = (Bool_t)fStandardCandlesFlagsPro->GetBinContent(2);
7ecb5af4 2760
2761 if(!fCalculateStandardCandles){return;} // TBI is this safe enough
2762
68a8e667 2763 // d) Get pointer TH1D *fStandardCandlesHist:
7ecb5af4 2764 fStandardCandlesHist = dynamic_cast<TH1D*>(fStandardCandlesList->FindObject("fStandardCandlesHist"));
6d19c373 2765
68a8e667 2766 if(!fPropagateErrorSC){return;} // TBI is this safe enough
2767
2768 // e) Get pointer TProfile2D *fProductsSCPro:
2769 fProductsSCPro = dynamic_cast<TProfile2D*>(fStandardCandlesList->FindObject("fProductsSCPro"));
7ecb5af4 2770
2771} // void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForStandardCandles()
2772
2773//=======================================================================================================================
2774
2775void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForControlHistograms()
2776{
2777 // Get pointers for control histograms.
2778
2779 // a) Get pointer for fControlHistogramsList; TBI
2780 // b) Get pointer for fControlHistogramsFlagsPro; TBI
2781 // c) Set again all flags; TBI
2782 // d) Get pointers to TH1D *fKinematicsHist[2][3]; TBI
2783 // e) Get pointers to TH1D *fMultDistributionsHist[3]; TBI
2784 // f) Get pointers to TH2D *fMultCorrelationsHist[3]. TBI
2785
6696a113 2786 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForControlHistograms()";
2787
7ecb5af4 2788 // a) Get pointer for fControlHistogramsList: TBI
2789 fControlHistogramsList = dynamic_cast<TList*>(fHistList->FindObject("Control Histograms"));
6696a113 2790 if(!fControlHistogramsList){Fatal(sMethodName.Data(),"fControlHistogramsList");}
7ecb5af4 2791
2792 // b) Get pointer for fControlHistogramsFlagsPro: TBI
2793 fControlHistogramsFlagsPro = dynamic_cast<TProfile*>(fControlHistogramsList->FindObject("fControlHistogramsFlagsPro"));
6696a113 2794 if(!fControlHistogramsFlagsPro){Fatal(sMethodName.Data(),"fControlHistogramsFlagsPro");}
37d2f768 2795
6696a113 2796 // c) Set again all flags:
7ecb5af4 2797 fFillControlHistograms = fControlHistogramsFlagsPro->GetBinContent(1);
6696a113 2798 fFillKinematicsHist = fControlHistogramsFlagsPro->GetBinContent(2);
2799 fFillMultDistributionsHist = fControlHistogramsFlagsPro->GetBinContent(3);
2800 fFillMultCorrelationsHist = fControlHistogramsFlagsPro->GetBinContent(4);
7ecb5af4 2801
2802 if(!fFillControlHistograms){return;} // TBI is this safe enough
2803
2804 // d) Get pointers to fKinematicsHist[2][3]: TBI
2805 TString name[2][3] = {{"RP,phi","RP,pt","RP,eta"},{"POI,phi","POI,pt","POI,eta"}}; // [RP,POI][phi,pt,eta]
2806 for(Int_t rp=0;rp<2;rp++) // [RP,POI]
2807 {
2808 for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
37d2f768 2809 {
7ecb5af4 2810 fKinematicsHist[rp][ppe] = dynamic_cast<TH1D*>(fControlHistogramsList->FindObject(name[rp][ppe].Data()));
6696a113 2811 if(!fKinematicsHist[rp][ppe] && fFillKinematicsHist){Fatal(sMethodName.Data(),"%s",name[rp][ppe].Data());} // TBI
37d2f768 2812 }
7ecb5af4 2813 }
2814
2815 // e) Get pointers to TH1D *fMultDistributionsHist[3]:
2816 TString nameMult[3] = {"Multiplicity (RP)","Multiplicity (POI)","Multiplicity (REF)"}; // [RP,POI,reference multiplicity]
2817 for(Int_t rprm=0;rprm<3;rprm++) // [RP,POI,reference multiplicity]
2818 {
2819 fMultDistributionsHist[rprm] = dynamic_cast<TH1D*>(fControlHistogramsList->FindObject(nameMult[rprm].Data()));
6696a113 2820 if(!fMultDistributionsHist[rprm] && fFillMultDistributionsHist){Fatal(sMethodName.Data(),"%s",nameMult[rprm].Data());} // TBI
7ecb5af4 2821 } // for(Int_t rprm=0;rprm<3;rprm++) // [RP,POI,reference multiplicity]
2822
2823 // f) Get pointers to TH2D *fMultCorrelationsHist[3]: TBI automatize the things here...
2824 fMultCorrelationsHist[0] = dynamic_cast<TH2D*>(fControlHistogramsList->FindObject("Multiplicity (RP vs. POI)"));
6696a113 2825 if(!fMultCorrelationsHist[0] && fFillMultCorrelationsHist){Fatal(sMethodName.Data(),"Multiplicity (RP vs. POI)");} // TBI
7ecb5af4 2826 fMultCorrelationsHist[1] = dynamic_cast<TH2D*>(fControlHistogramsList->FindObject("Multiplicity (RP vs. REF)"));
6696a113 2827 if(!fMultCorrelationsHist[1] && fFillMultCorrelationsHist){Fatal(sMethodName.Data(),"Multiplicity (RP vs. REF)");} // TBI
7ecb5af4 2828 fMultCorrelationsHist[2] = dynamic_cast<TH2D*>(fControlHistogramsList->FindObject("Multiplicity (POI vs. REF)"));
6696a113 2829 if(!fMultCorrelationsHist[2] && fFillMultCorrelationsHist){Fatal(sMethodName.Data(),"Multiplicity (POI vs. REF)");} // TBI
7ecb5af4 2830
2831} // void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForControlHistograms()
2832
2833//=======================================================================================================================
2834
2835void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForCorrelations()
2836{
2837 // Get pointers for correlations.
2838
2839 // a) Get pointer for fCorrelationsList; TBI
2840 // b) Get pointer for fCorrelationsFlagsPro; TBI
2841 // c) Set again all flags; TBI
6696a113 2842 // d) Get pointers to TProfile *fCorrelationsPro[2][8].
2843
2844 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForCorrelations()";
7ecb5af4 2845
2846 // a) Get pointer for fCorrelationsList: TBI
2847 fCorrelationsList = dynamic_cast<TList*>(fHistList->FindObject("Correlations"));
6696a113 2848 if(!fCorrelationsList){Fatal(sMethodName.Data(),"fCorrelationsList");}
7ecb5af4 2849
2850 // b) Get pointer for fCorrelationsFlagsPro: TBI
2851 fCorrelationsFlagsPro = dynamic_cast<TProfile*>(fCorrelationsList->FindObject("fCorrelationsFlagsPro"));
2852
6696a113 2853 if(!fCorrelationsFlagsPro){Fatal(sMethodName.Data(),"fCorrelationsFlagsPro");}
7ecb5af4 2854
2855 // c) Set again all flags:
2856 fCalculateCorrelations = fCorrelationsFlagsPro->GetBinContent(1);
9efbd2f5 2857 fMaxHarmonic = (Int_t)fCorrelationsFlagsPro->GetBinContent(2);
2858 fMaxCorrelator = (Int_t)fCorrelationsFlagsPro->GetBinContent(3);
68a8e667 2859 fCalculateIsotropic = (Bool_t)fCorrelationsFlagsPro->GetBinContent(4);
2860 fCalculateSame = (Bool_t)fCorrelationsFlagsPro->GetBinContent(5);
2861 fSkipZeroHarmonics = (Bool_t)fCorrelationsFlagsPro->GetBinContent(6);
2862 fCalculateSameIsotropic = (Bool_t)fCorrelationsFlagsPro->GetBinContent(7);
2863 fCalculateAll = (Bool_t)fCorrelationsFlagsPro->GetBinContent(8);
9efbd2f5 2864 fDontGoBeyond = (Int_t)fCorrelationsFlagsPro->GetBinContent(9);
68a8e667 2865 fCalculateOnlyForHarmonicQC = (Bool_t)fCorrelationsFlagsPro->GetBinContent(10);
2866 fCalculateOnlyForSC = (Bool_t)fCorrelationsFlagsPro->GetBinContent(11);
2867 fCalculateOnlyCos = (Bool_t)fCorrelationsFlagsPro->GetBinContent(12);
2868 fCalculateOnlySin = (Bool_t)fCorrelationsFlagsPro->GetBinContent(13);
7ecb5af4 2869
6696a113 2870 if(!fCalculateCorrelations){return;} // TBI is this safe enough, that is the question...
7ecb5af4 2871
9efbd2f5 2872 // d) Get pointers to TProfile *fCorrelationsPro[2][8]:
2873 TString sCosSin[2] = {"Cos","Sin"};
2874 for(Int_t cs=0;cs<2;cs++)
7ecb5af4 2875 {
68a8e667 2876 if(fCalculateOnlyCos && 1==cs){continue;}
2877 else if(fCalculateOnlySin && 0==cs){continue;}
9efbd2f5 2878 for(Int_t c=0;c<fMaxCorrelator;c++)
2879 {
2880 fCorrelationsPro[cs][c] = dynamic_cast<TProfile*>(fCorrelationsList->FindObject(Form("%dpCorrelations%s",c+1,sCosSin[cs].Data())));
2881 if(!fCorrelationsPro[cs][c]){Fatal(sMethodName.Data(),"%dpCorrelations%s",c+1,sCosSin[cs].Data());}
2882 }
7ecb5af4 2883 }
2884
2885} // void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForCorrelations()
37d2f768 2886
2887//=======================================================================================================================
2888
68a8e667 2889void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForQcumulants()
2890{
2891 // Get pointers for Q-cumulants.
2892
2893 // a) Get pointer for fQcumulantsList;
2894 // b) Get pointer for fQcumulantsFlagsPro;
2895 // c) Set again all flags;
2896 // d) Get pointer for fQcumulantsHist;
2897 // e) Get pointer for fReferenceFlowHist;
2898 // f) Get pointer for fProductsQCPro.
2899
2900 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForQcumulants()";
2901
2902 // a) Get pointer for fQcumulantsList:
2903 fQcumulantsList = dynamic_cast<TList*>(fHistList->FindObject("Q-cumulants"));
2904 if(!fQcumulantsList){Fatal(sMethodName.Data(),"fQcumulantsList");}
2905
2906 // b) Get pointer for fQcumulantsFlagsPro:
2907 fQcumulantsFlagsPro = dynamic_cast<TProfile*>(fQcumulantsList->FindObject("fQcumulantsFlagsPro"));
2908 if(!fQcumulantsFlagsPro){Fatal(sMethodName.Data(),"fQcumulantsFlagsPro");}
2909
2910 // c) Set again all flags:
2911 fCalculateQcumulants = (Bool_t) fQcumulantsFlagsPro->GetBinContent(1);
2912 fHarmonicQC = (Int_t) fQcumulantsFlagsPro->GetBinContent(2);
2913 fPropagateErrorQC = (Bool_t) fQcumulantsFlagsPro->GetBinContent(3);
2914
2915 if(!fCalculateQcumulants){return;} // TBI is this safe enough
2916
2917 // d) Get pointer for fQcumulantsHist:
2918 fQcumulantsHist = dynamic_cast<TH1D*>(fQcumulantsList->FindObject("Q-cumulants"));
2919 if(!fQcumulantsHist){Fatal(sMethodName.Data(),"fQcumulantsHist");}
2920
2921 // e) Get pointer for fReferenceFlowHist:
2922 fReferenceFlowHist = dynamic_cast<TH1D*>(fQcumulantsList->FindObject("Reference Flow"));
2923 if(!fReferenceFlowHist){Fatal(sMethodName.Data(),"fReferenceFlowHist");}
2924
2925 if(!fPropagateErrorQC){return;} // TBI is this safe enough
2926
2927 // f) Get pointer for fProductsQCPro:
2928 fProductsQCPro = dynamic_cast<TProfile2D*>(fQcumulantsList->FindObject("fProductsQCPro"));
2929 if(!fProductsQCPro){Fatal(sMethodName.Data(),"fProductsQCPro");}
2930
2931} // void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForQcumulants()
2932
2933//=======================================================================================================================
2934
2935void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForDiffCorrelations()
2936{
2937 // Get pointers for differential correlations.
2938
2939 // a) Get pointer for fDiffCorrelationsList;
2940 // b) Get pointer for fDiffCorrelationsFlagsPro;
2941 // c) Set again all flags;
2942 // d) Get pointers to TProfile *fDiffCorrelationsPro[2][4].
2943
2944 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForDiffCorrelations()";
2945
2946 // a) Get pointer for fDiffCorrelationsList:
2947 fDiffCorrelationsList = dynamic_cast<TList*>(fHistList->FindObject("Differential Correlations"));
2948 if(!fDiffCorrelationsList){Fatal(sMethodName.Data(),"fDiffCorrelationsList");}
2949
2950 // b) Get pointer for fDiffCorrelationsFlagsPro:
2951 fDiffCorrelationsFlagsPro = dynamic_cast<TProfile*>(fDiffCorrelationsList->FindObject("fDiffCorrelationsFlagsPro"));
2952 if(!fDiffCorrelationsFlagsPro){Fatal(sMethodName.Data(),"fDiffCorrelationsFlagsPro");}
2953
2954 // c) Set again all flags:
2955 fCalculateDiffCorrelations = fDiffCorrelationsFlagsPro->GetBinContent(1);
2956
2957 if(!fCalculateDiffCorrelations){return;}
2958
2959 // d) Get pointers to TProfile *fDiffCorrelationsPro[2][4]: _77
2960 /*
2961 TString sCosSin[2] = {"Cos","Sin"};
2962 for(Int_t cs=0;cs<2;cs++)
2963 {
2964 if(fCalculateOnlyCos && 1==cs){continue;}
2965 else if(fCalculateOnlySin && 0==cs){continue;}
2966 for(Int_t c=0;c<fMaxCorrelator;c++)
2967 {
2968 fCorrelationsPro[cs][c] = dynamic_cast<TProfile*>(fCorrelationsList->FindObject(Form("%dpCorrelations%s",c+1,sCosSin[cs].Data())));
2969 if(!fCorrelationsPro[cs][c]){Fatal(sMethodName.Data(),"%dpCorrelations%s",c+1,sCosSin[cs].Data());}
2970 }
2971 }
2972 */
2973
2974} // void AliFlowAnalysisWithMultiparticleCorrelations::GetPointersForDiffCorrelations()
2975
2976//=======================================================================================================================
2977
7ecb5af4 2978void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForQvector()
2979{
2980 // Initialize all arrays for Q-vector.
2981
6696a113 2982 for(Int_t h=0;h<fMaxHarmonic*fMaxCorrelator+1;h++)
7ecb5af4 2983 {
68a8e667 2984 for(Int_t wp=0;wp<fMaxCorrelator+1;wp++) // weight power
7ecb5af4 2985 {
68a8e667 2986 fQvector[h][wp] = TComplex(0.,0.);
2987 for(Int_t b=0;b<100;b++) // TBI hardwired 100
2988 {
2989 fpvector[b][h][wp] = TComplex(0.,0.);
2990 fqvector[b][h][wp] = TComplex(0.,0.);
2991 }
7ecb5af4 2992 }
2993 }
2994
2995} // void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForQvector()
2996
2997//=======================================================================================================================
2998
2999void AliFlowAnalysisWithMultiparticleCorrelations::ResetQvector()
3000{
3001 // Reset all Q-vector components to zero before starting a new event.
3002
6696a113 3003 for(Int_t h=0;h<fMaxHarmonic*fMaxCorrelator+1;h++)
7ecb5af4 3004 {
68a8e667 3005 for(Int_t wp=0;wp<fMaxCorrelator+1;wp++) // weight powe
7ecb5af4 3006 {
68a8e667 3007 fQvector[h][wp] = TComplex(0.,0.);
3008 if(!fCalculateDiffQvectors){continue;}
3009 for(Int_t b=0;b<100;b++) // TBI hardwired 100
3010 {
3011 fpvector[b][h][wp] = TComplex(0.,0.);
3012 fqvector[b][h][wp] = TComplex(0.,0.);
3013 }
6696a113 3014 }
3015 }
7ecb5af4 3016
3017} // void AliFlowAnalysisWithMultiparticleCorrelations::ResetQvector()
3018
3019//=======================================================================================================================
3020
68a8e667 3021TComplex AliFlowAnalysisWithMultiparticleCorrelations::Q(Int_t n, Int_t wp)
7ecb5af4 3022{
3023 // Using the fact that Q{-n,p} = Q{n,p}^*.
3024
68a8e667 3025 if(n>=0){return fQvector[n][wp];}
3026 return TComplex::Conjugate(fQvector[-n][wp]);
7ecb5af4 3027
68a8e667 3028} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::Q(Int_t n, Int_t wp)
3029
3030//=======================================================================================================================
3031
3032TComplex AliFlowAnalysisWithMultiparticleCorrelations::p(Int_t n, Int_t wp)
3033{
3034 // Using the fact that p{-n,p} = p{n,p}^*.
3035
3036 if(n>=0){return fpvector[fDiffBinNo][n][wp];}
3037 return TComplex::Conjugate(fpvector[fDiffBinNo][-n][wp]);
3038
3039} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::p(Int_t n, Int_t p)
3040
3041//=======================================================================================================================
3042
3043TComplex AliFlowAnalysisWithMultiparticleCorrelations::q(Int_t n, Int_t wp)
3044{
3045 // Using the fact that q{-n,p} = q{n,p}^*.
3046
3047 if(n>=0){return fqvector[fDiffBinNo][n][wp];}
3048 return TComplex::Conjugate(fqvector[fDiffBinNo][-n][wp]);
3049
3050} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::q(Int_t n, Int_t wp)
7ecb5af4 3051
3052//=======================================================================================================================
3053
3054TComplex AliFlowAnalysisWithMultiparticleCorrelations::One(Int_t n1)
3055{
3056 // Generic expression <exp[i(n1*phi1)]>. TBI comment
3057
3058 TComplex one = Q(n1,1);
3059
3060 return one;
3061
3062} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::One(Int_t n1)
3063
3064//=======================================================================================================================
3065
3066TComplex AliFlowAnalysisWithMultiparticleCorrelations::Two(Int_t n1, Int_t n2)
3067{
3068 // Generic two-particle correlation <exp[i(n1*phi1+n2*phi2)]>.
3069
3070 TComplex two = Q(n1,1)*Q(n2,1)-Q(n1+n2,2);
3071
3072 return two;
3073
3074} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::Two(Int_t n1, Int_t n2)
3075
3076//=======================================================================================================================
3077
3078TComplex AliFlowAnalysisWithMultiparticleCorrelations::Three(Int_t n1, Int_t n2, Int_t n3)
3079{
3080 // Generic three-particle correlation <exp[i(n1*phi1+n2*phi2+n3*phi3)]>.
3081
3082 TComplex three = Q(n1,1)*Q(n2,1)*Q(n3,1)-Q(n1+n2,2)*Q(n3,1)-Q(n2,1)*Q(n1+n3,2)
3083 - Q(n1,1)*Q(n2+n3,2)+2.*Q(n1+n2+n3,3);
3084
3085 return three;
3086
3087} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::Three(Int_t n1, Int_t n2, Int_t n3)
3088
3089//=======================================================================================================================
3090
3091TComplex AliFlowAnalysisWithMultiparticleCorrelations::Four(Int_t n1, Int_t n2, Int_t n3, Int_t n4)
3092{
3093 // Generic four-particle correlation <exp[i(n1*phi1+n2*phi2+n3*phi3+n4*phi4)]>.
3094
3095 TComplex four = Q(n1,1)*Q(n2,1)*Q(n3,1)*Q(n4,1)-Q(n1+n2,2)*Q(n3,1)*Q(n4,1)-Q(n2,1)*Q(n1+n3,2)*Q(n4,1)
3096 - Q(n1,1)*Q(n2+n3,2)*Q(n4,1)+2.*Q(n1+n2+n3,3)*Q(n4,1)-Q(n2,1)*Q(n3,1)*Q(n1+n4,2)
3097 + Q(n2+n3,2)*Q(n1+n4,2)-Q(n1,1)*Q(n3,1)*Q(n2+n4,2)+Q(n1+n3,2)*Q(n2+n4,2)
3098 + 2.*Q(n3,1)*Q(n1+n2+n4,3)-Q(n1,1)*Q(n2,1)*Q(n3+n4,2)+Q(n1+n2,2)*Q(n3+n4,2)
3099 + 2.*Q(n2,1)*Q(n1+n3+n4,3)+2.*Q(n1,1)*Q(n2+n3+n4,3)-6.*Q(n1+n2+n3+n4,4);
3100
3101 return four;
3102
3103} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::Four(Int_t n1, Int_t n2, Int_t n3, Int_t n4)
3104
3105//=======================================================================================================================
3106
3107TComplex AliFlowAnalysisWithMultiparticleCorrelations::Five(Int_t n1, Int_t n2, Int_t n3, Int_t n4, Int_t n5)
3108{
3109 // Generic five-particle correlation <exp[i(n1*phi1+n2*phi2+n3*phi3+n4*phi4+n5*phi5)]>.
3110
3111 TComplex five = Q(n1,1)*Q(n2,1)*Q(n3,1)*Q(n4,1)*Q(n5,1)-Q(n1+n2,2)*Q(n3,1)*Q(n4,1)*Q(n5,1)
3112 - Q(n2,1)*Q(n1+n3,2)*Q(n4,1)*Q(n5,1)-Q(n1,1)*Q(n2+n3,2)*Q(n4,1)*Q(n5,1)
3113 + 2.*Q(n1+n2+n3,3)*Q(n4,1)*Q(n5,1)-Q(n2,1)*Q(n3,1)*Q(n1+n4,2)*Q(n5,1)
3114 + Q(n2+n3,2)*Q(n1+n4,2)*Q(n5,1)-Q(n1,1)*Q(n3,1)*Q(n2+n4,2)*Q(n5,1)
3115 + Q(n1+n3,2)*Q(n2+n4,2)*Q(n5,1)+2.*Q(n3,1)*Q(n1+n2+n4,3)*Q(n5,1)
3116 - Q(n1,1)*Q(n2,1)*Q(n3+n4,2)*Q(n5,1)+Q(n1+n2,2)*Q(n3+n4,2)*Q(n5,1)
3117 + 2.*Q(n2,1)*Q(n1+n3+n4,3)*Q(n5,1)+2.*Q(n1,1)*Q(n2+n3+n4,3)*Q(n5,1)
3118 - 6.*Q(n1+n2+n3+n4,4)*Q(n5,1)-Q(n2,1)*Q(n3,1)*Q(n4,1)*Q(n1+n5,2)
3119 + Q(n2+n3,2)*Q(n4,1)*Q(n1+n5,2)+Q(n3,1)*Q(n2+n4,2)*Q(n1+n5,2)
3120 + Q(n2,1)*Q(n3+n4,2)*Q(n1+n5,2)-2.*Q(n2+n3+n4,3)*Q(n1+n5,2)
3121 - Q(n1,1)*Q(n3,1)*Q(n4,1)*Q(n2+n5,2)+Q(n1+n3,2)*Q(n4,1)*Q(n2+n5,2)
3122 + Q(n3,1)*Q(n1+n4,2)*Q(n2+n5,2)+Q(n1,1)*Q(n3+n4,2)*Q(n2+n5,2)
3123 - 2.*Q(n1+n3+n4,3)*Q(n2+n5,2)+2.*Q(n3,1)*Q(n4,1)*Q(n1+n2+n5,3)
3124 - 2.*Q(n3+n4,2)*Q(n1+n2+n5,3)-Q(n1,1)*Q(n2,1)*Q(n4,1)*Q(n3+n5,2)
3125 + Q(n1+n2,2)*Q(n4,1)*Q(n3+n5,2)+Q(n2,1)*Q(n1+n4,2)*Q(n3+n5,2)
3126 + Q(n1,1)*Q(n2+n4,2)*Q(n3+n5,2)-2.*Q(n1+n2+n4,3)*Q(n3+n5,2)
3127 + 2.*Q(n2,1)*Q(n4,1)*Q(n1+n3+n5,3)-2.*Q(n2+n4,2)*Q(n1+n3+n5,3)
3128 + 2.*Q(n1,1)*Q(n4,1)*Q(n2+n3+n5,3)-2.*Q(n1+n4,2)*Q(n2+n3+n5,3)
3129 - 6.*Q(n4,1)*Q(n1+n2+n3+n5,4)-Q(n1,1)*Q(n2,1)*Q(n3,1)*Q(n4+n5,2)
3130 + Q(n1+n2,2)*Q(n3,1)*Q(n4+n5,2)+Q(n2,1)*Q(n1+n3,2)*Q(n4+n5,2)
3131 + Q(n1,1)*Q(n2+n3,2)*Q(n4+n5,2)-2.*Q(n1+n2+n3,3)*Q(n4+n5,2)
3132 + 2.*Q(n2,1)*Q(n3,1)*Q(n1+n4+n5,3)-2.*Q(n2+n3,2)*Q(n1+n4+n5,3)
3133 + 2.*Q(n1,1)*Q(n3,1)*Q(n2+n4+n5,3)-2.*Q(n1+n3,2)*Q(n2+n4+n5,3)
3134 - 6.*Q(n3,1)*Q(n1+n2+n4+n5,4)+2.*Q(n1,1)*Q(n2,1)*Q(n3+n4+n5,3)
3135 - 2.*Q(n1+n2,2)*Q(n3+n4+n5,3)-6.*Q(n2,1)*Q(n1+n3+n4+n5,4)
3136 - 6.*Q(n1,1)*Q(n2+n3+n4+n5,4)+24.*Q(n1+n2+n3+n4+n5,5);
3137
3138 return five;
3139
3140} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::Five(Int_t n1, Int_t n2, Int_t n3, Int_t n4, Int_t n5)
3141
3142//=======================================================================================================================
3143
3144TComplex AliFlowAnalysisWithMultiparticleCorrelations::Six(Int_t n1, Int_t n2, Int_t n3, Int_t n4, Int_t n5, Int_t n6)
3145{
3146 // Generic six-particle correlation <exp[i(n1*phi1+n2*phi2+n3*phi3+n4*phi4+n5*phi5+n6*phi6)]>.
3147
3148 TComplex six = Q(n1,1)*Q(n2,1)*Q(n3,1)*Q(n4,1)*Q(n5,1)*Q(n6,1)-Q(n1+n2,2)*Q(n3,1)*Q(n4,1)*Q(n5,1)*Q(n6,1)
3149 - Q(n2,1)*Q(n1+n3,2)*Q(n4,1)*Q(n5,1)*Q(n6,1)-Q(n1,1)*Q(n2+n3,2)*Q(n4,1)*Q(n5,1)*Q(n6,1)
3150 + 2.*Q(n1+n2+n3,3)*Q(n4,1)*Q(n5,1)*Q(n6,1)-Q(n2,1)*Q(n3,1)*Q(n1+n4,2)*Q(n5,1)*Q(n6,1)
3151 + Q(n2+n3,2)*Q(n1+n4,2)*Q(n5,1)*Q(n6,1)-Q(n1,1)*Q(n3,1)*Q(n2+n4,2)*Q(n5,1)*Q(n6,1)
3152 + Q(n1+n3,2)*Q(n2+n4,2)*Q(n5,1)*Q(n6,1)+2.*Q(n3,1)*Q(n1+n2+n4,3)*Q(n5,1)*Q(n6,1)
3153 - Q(n1,1)*Q(n2,1)*Q(n3+n4,2)*Q(n5,1)*Q(n6,1)+Q(n1+n2,2)*Q(n3+n4,2)*Q(n5,1)*Q(n6,1)
3154 + 2.*Q(n2,1)*Q(n1+n3+n4,3)*Q(n5,1)*Q(n6,1)+2.*Q(n1,1)*Q(n2+n3+n4,3)*Q(n5,1)*Q(n6,1)
3155 - 6.*Q(n1+n2+n3+n4,4)*Q(n5,1)*Q(n6,1)-Q(n2,1)*Q(n3,1)*Q(n4,1)*Q(n1+n5,2)*Q(n6,1)
3156 + Q(n2+n3,2)*Q(n4,1)*Q(n1+n5,2)*Q(n6,1)+Q(n3,1)*Q(n2+n4,2)*Q(n1+n5,2)*Q(n6,1)
3157 + Q(n2,1)*Q(n3+n4,2)*Q(n1+n5,2)*Q(n6,1)-2.*Q(n2+n3+n4,3)*Q(n1+n5,2)*Q(n6,1)
3158 - Q(n1,1)*Q(n3,1)*Q(n4,1)*Q(n2+n5,2)*Q(n6,1)+Q(n1+n3,2)*Q(n4,1)*Q(n2+n5,2)*Q(n6,1)
3159 + Q(n3,1)*Q(n1+n4,2)*Q(n2+n5,2)*Q(n6,1)+Q(n1,1)*Q(n3+n4,2)*Q(n2+n5,2)*Q(n6,1)
3160 - 2.*Q(n1+n3+n4,3)*Q(n2+n5,2)*Q(n6,1)+2.*Q(n3,1)*Q(n4,1)*Q(n1+n2+n5,3)*Q(n6,1)
3161 - 2.*Q(n3+n4,2)*Q(n1+n2+n5,3)*Q(n6,1)-Q(n1,1)*Q(n2,1)*Q(n4,1)*Q(n3+n5,2)*Q(n6,1)
3162 + Q(n1+n2,2)*Q(n4,1)*Q(n3+n5,2)*Q(n6,1)+Q(n2,1)*Q(n1+n4,2)*Q(n3+n5,2)*Q(n6,1)
3163 + Q(n1,1)*Q(n2+n4,2)*Q(n3+n5,2)*Q(n6,1)-2.*Q(n1+n2+n4,3)*Q(n3+n5,2)*Q(n6,1)
3164 + 2.*Q(n2,1)*Q(n4,1)*Q(n1+n3+n5,3)*Q(n6,1)-2.*Q(n2+n4,2)*Q(n1+n3+n5,3)*Q(n6,1)
3165 + 2.*Q(n1,1)*Q(n4,1)*Q(n2+n3+n5,3)*Q(n6,1)-2.*Q(n1+n4,2)*Q(n2+n3+n5,3)*Q(n6,1)
3166 - 6.*Q(n4,1)*Q(n1+n2+n3+n5,4)*Q(n6,1)-Q(n1,1)*Q(n2,1)*Q(n3,1)*Q(n4+n5,2)*Q(n6,1)
3167 + Q(n1+n2,2)*Q(n3,1)*Q(n4+n5,2)*Q(n6,1)+Q(n2,1)*Q(n1+n3,2)*Q(n4+n5,2)*Q(n6,1)
3168 + Q(n1,1)*Q(n2+n3,2)*Q(n4+n5,2)*Q(n6,1)-2.*Q(n1+n2+n3,3)*Q(n4+n5,2)*Q(n6,1)
3169 + 2.*Q(n2,1)*Q(n3,1)*Q(n1+n4+n5,3)*Q(n6,1)-2.*Q(n2+n3,2)*Q(n1+n4+n5,3)*Q(n6,1)
3170 + 2.*Q(n1,1)*Q(n3,1)*Q(n2+n4+n5,3)*Q(n6,1)-2.*Q(n1+n3,2)*Q(n2+n4+n5,3)*Q(n6,1)
3171 - 6.*Q(n3,1)*Q(n1+n2+n4+n5,4)*Q(n6,1)+2.*Q(n1,1)*Q(n2,1)*Q(n3+n4+n5,3)*Q(n6,1)
3172 - 2.*Q(n1+n2,2)*Q(n3+n4+n5,3)*Q(n6,1)-6.*Q(n2,1)*Q(n1+n3+n4+n5,4)*Q(n6,1)
3173 - 6.*Q(n1,1)*Q(n2+n3+n4+n5,4)*Q(n6,1)+24.*Q(n1+n2+n3+n4+n5,5)*Q(n6,1)
3174 - Q(n2,1)*Q(n3,1)*Q(n4,1)*Q(n5,1)*Q(n1+n6,2)+Q(n2+n3,2)*Q(n4,1)*Q(n5,1)*Q(n1+n6,2)
3175 + Q(n3,1)*Q(n2+n4,2)*Q(n5,1)*Q(n1+n6,2)+Q(n2,1)*Q(n3+n4,2)*Q(n5,1)*Q(n1+n6,2)
3176 - 2.*Q(n2+n3+n4,3)*Q(n5,1)*Q(n1+n6,2)+Q(n3,1)*Q(n4,1)*Q(n2+n5,2)*Q(n1+n6,2)
3177 - Q(n3+n4,2)*Q(n2+n5,2)*Q(n1+n6,2)+Q(n2,1)*Q(n4,1)*Q(n3+n5,2)*Q(n1+n6,2)
3178 - Q(n2+n4,2)*Q(n3+n5,2)*Q(n1+n6,2)-2.*Q(n4,1)*Q(n2+n3+n5,3)*Q(n1+n6,2)
3179 + Q(n2,1)*Q(n3,1)*Q(n4+n5,2)*Q(n1+n6,2)-Q(n2+n3,2)*Q(n4+n5,2)*Q(n1+n6,2)
3180 - 2.*Q(n3,1)*Q(n2+n4+n5,3)*Q(n1+n6,2)-2.*Q(n2,1)*Q(n3+n4+n5,3)*Q(n1+n6,2)
3181 + 6.*Q(n2+n3+n4+n5,4)*Q(n1+n6,2)-Q(n1,1)*Q(n3,1)*Q(n4,1)*Q(n5,1)*Q(n2+n6,2)
3182 + Q(n1+n3,2)*Q(n4,1)*Q(n5,1)*Q(n2+n6,2)+Q(n3,1)*Q(n1+n4,2)*Q(n5,1)*Q(n2+n6,2)
3183 + Q(n1,1)*Q(n3+n4,2)*Q(n5,1)*Q(n2+n6,2)-2.*Q(n1+n3+n4,3)*Q(n5,1)*Q(n2+n6,2)
3184 + Q(n3,1)*Q(n4,1)*Q(n1+n5,2)*Q(n2+n6,2)-Q(n3+n4,2)*Q(n1+n5,2)*Q(n2+n6,2)
3185 + Q(n1,1)*Q(n4,1)*Q(n3+n5,2)*Q(n2+n6,2)-Q(n1+n4,2)*Q(n3+n5,2)*Q(n2+n6,2)
3186 - 2.*Q(n4,1)*Q(n1+n3+n5,3)*Q(n2+n6,2)+Q(n1,1)*Q(n3,1)*Q(n4+n5,2)*Q(n2+n6,2)
3187 - Q(n1+n3,2)*Q(n4+n5,2)*Q(n2+n6,2)-2.*Q(n3,1)*Q(n1+n4+n5,3)*Q(n2+n6,2)
3188 - 2.*Q(n1,1)*Q(n3+n4+n5,3)*Q(n2+n6,2)+6.*Q(n1+n3+n4+n5,4)*Q(n2+n6,2)
3189 + 2.*Q(n3,1)*Q(n4,1)*Q(n5,1)*Q(n1+n2+n6,3)-2.*Q(n3+n4,2)*Q(n5,1)*Q(n1+n2+n6,3)
3190 - 2.*Q(n4,1)*Q(n3+n5,2)*Q(n1+n2+n6,3)-2.*Q(n3,1)*Q(n4+n5,2)*Q(n1+n2+n6,3)
3191 + 4.*Q(n3+n4+n5,3)*Q(n1+n2+n6,3)-Q(n1,1)*Q(n2,1)*Q(n4,1)*Q(n5,1)*Q(n3+n6,2)
3192 + Q(n1+n2,2)*Q(n4,1)*Q(n5,1)*Q(n3+n6,2)+Q(n2,1)*Q(n1+n4,2)*Q(n5,1)*Q(n3+n6,2)
3193 + Q(n1,1)*Q(n2+n4,2)*Q(n5,1)*Q(n3+n6,2)-2.*Q(n1+n2+n4,3)*Q(n5,1)*Q(n3+n6,2)
3194 + Q(n2,1)*Q(n4,1)*Q(n1+n5,2)*Q(n3+n6,2)-Q(n2+n4,2)*Q(n1+n5,2)*Q(n3+n6,2)
3195 + Q(n1,1)*Q(n4,1)*Q(n2+n5,2)*Q(n3+n6,2)-Q(n1+n4,2)*Q(n2+n5,2)*Q(n3+n6,2)
3196 - 2.*Q(n4,1)*Q(n1+n2+n5,3)*Q(n3+n6,2)+Q(n1,1)*Q(n2,1)*Q(n4+n5,2)*Q(n3+n6,2)
3197 - Q(n1+n2,2)*Q(n4+n5,2)*Q(n3+n6,2)-2.*Q(n2,1)*Q(n1+n4+n5,3)*Q(n3+n6,2)
3198 - 2.*Q(n1,1)*Q(n2+n4+n5,3)*Q(n3+n6,2)+6.*Q(n1+n2+n4+n5,4)*Q(n3+n6,2)
3199 + 2.*Q(n2,1)*Q(n4,1)*Q(n5,1)*Q(n1+n3+n6,3)-2.*Q(n2+n4,2)*Q(n5,1)*Q(n1+n3+n6,3)
3200 - 2.*Q(n4,1)*Q(n2+n5,2)*Q(n1+n3+n6,3)-2.*Q(n2,1)*Q(n4+n5,2)*Q(n1+n3+n6,3)
3201 + 4.*Q(n2+n4+n5,3)*Q(n1+n3+n6,3)+2.*Q(n1,1)*Q(n4,1)*Q(n5,1)*Q(n2+n3+n6,3)
3202 - 2.*Q(n1+n4,2)*Q(n5,1)*Q(n2+n3+n6,3)-2.*Q(n4,1)*Q(n1+n5,2)*Q(n2+n3+n6,3)
3203 - 2.*Q(n1,1)*Q(n4+n5,2)*Q(n2+n3+n6,3)+4.*Q(n1+n4+n5,3)*Q(n2+n3+n6,3)
3204 - 6.*Q(n4,1)*Q(n5,1)*Q(n1+n2+n3+n6,4)+6.*Q(n4+n5,2)*Q(n1+n2+n3+n6,4)
3205 - Q(n1,1)*Q(n2,1)*Q(n3,1)*Q(n5,1)*Q(n4+n6,2)+Q(n1+n2,2)*Q(n3,1)*Q(n5,1)*Q(n4+n6,2)
3206 + Q(n2,1)*Q(n1+n3,2)*Q(n5,1)*Q(n4+n6,2)+Q(n1,1)*Q(n2+n3,2)*Q(n5,1)*Q(n4+n6,2)
3207 - 2.*Q(n1+n2+n3,3)*Q(n5,1)*Q(n4+n6,2)+Q(n2,1)*Q(n3,1)*Q(n1+n5,2)*Q(n4+n6,2)
3208 - Q(n2+n3,2)*Q(n1+n5,2)*Q(n4+n6,2)+Q(n1,1)*Q(n3,1)*Q(n2+n5,2)*Q(n4+n6,2)
3209 - Q(n1+n3,2)*Q(n2+n5,2)*Q(n4+n6,2)-2.*Q(n3,1)*Q(n1+n2+n5,3)*Q(n4+n6,2)
3210 + Q(n1,1)*Q(n2,1)*Q(n3+n5,2)*Q(n4+n6,2)-Q(n1+n2,2)*Q(n3+n5,2)*Q(n4+n6,2)
3211 - 2.*Q(n2,1)*Q(n1+n3+n5,3)*Q(n4+n6,2)-2.*Q(n1,1)*Q(n2+n3+n5,3)*Q(n4+n6,2)
3212 + 6.*Q(n1+n2+n3+n5,4)*Q(n4+n6,2)+2.*Q(n2,1)*Q(n3,1)*Q(n5,1)*Q(n1+n4+n6,3)
3213 - 2.*Q(n2+n3,2)*Q(n5,1)*Q(n1+n4+n6,3)-2.*Q(n3,1)*Q(n2+n5,2)*Q(n1+n4+n6,3)
3214 - 2.*Q(n2,1)*Q(n3+n5,2)*Q(n1+n4+n6,3)+4.*Q(n2+n3+n5,3)*Q(n1+n4+n6,3)
3215 + 2.*Q(n1,1)*Q(n3,1)*Q(n5,1)*Q(n2+n4+n6,3)-2.*Q(n1+n3,2)*Q(n5,1)*Q(n2+n4+n6,3)
3216 - 2.*Q(n3,1)*Q(n1+n5,2)*Q(n2+n4+n6,3)-2.*Q(n1,1)*Q(n3+n5,2)*Q(n2+n4+n6,3)
3217 + 4.*Q(n1+n3+n5,3)*Q(n2+n4+n6,3)-6.*Q(n3,1)*Q(n5,1)*Q(n1+n2+n4+n6,4)
3218 + 6.*Q(n3+n5,2)*Q(n1+n2+n4+n6,4)+2.*Q(n1,1)*Q(n2,1)*Q(n5,1)*Q(n3+n4+n6,3)
3219 - 2.*Q(n1+n2,2)*Q(n5,1)*Q(n3+n4+n6,3)-2.*Q(n2,1)*Q(n1+n5,2)*Q(n3+n4+n6,3)
3220 - 2.*Q(n1,1)*Q(n2+n5,2)*Q(n3+n4+n6,3)+4.*Q(n1+n2+n5,3)*Q(n3+n4+n6,3)
3221 - 6.*Q(n2,1)*Q(n5,1)*Q(n1+n3+n4+n6,4)+6.*Q(n2+n5,2)*Q(n1+n3+n4+n6,4)
3222 - 6.*Q(n1,1)*Q(n5,1)*Q(n2+n3+n4+n6,4)+6.*Q(n1+n5,2)*Q(n2+n3+n4+n6,4)
3223 + 24.*Q(n5,1)*Q(n1+n2+n3+n4+n6,5)-Q(n1,1)*Q(n2,1)*Q(n3,1)*Q(n4,1)*Q(n5+n6,2)
3224 + Q(n1+n2,2)*Q(n3,1)*Q(n4,1)*Q(n5+n6,2)+Q(n2,1)*Q(n1+n3,2)*Q(n4,1)*Q(n5+n6,2)
3225 + Q(n1,1)*Q(n2+n3,2)*Q(n4,1)*Q(n5+n6,2)-2.*Q(n1+n2+n3,3)*Q(n4,1)*Q(n5+n6,2)
3226 + Q(n2,1)*Q(n3,1)*Q(n1+n4,2)*Q(n5+n6,2)-Q(n2+n3,2)*Q(n1+n4,2)*Q(n5+n6,2)
3227 + Q(n1,1)*Q(n3,1)*Q(n2+n4,2)*Q(n5+n6,2)-Q(n1+n3,2)*Q(n2+n4,2)*Q(n5+n6,2)
3228 - 2.*Q(n3,1)*Q(n1+n2+n4,3)*Q(n5+n6,2)+Q(n1,1)*Q(n2,1)*Q(n3+n4,2)*Q(n5+n6,2)
3229 - Q(n1+n2,2)*Q(n3+n4,2)*Q(n5+n6,2)-2.*Q(n2,1)*Q(n1+n3+n4,3)*Q(n5+n6,2)
3230 - 2.*Q(n1,1)*Q(n2+n3+n4,3)*Q(n5+n6,2)+6.*Q(n1+n2+n3+n4,4)*Q(n5+n6,2)
3231 + 2.*Q(n2,1)*Q(n3,1)*Q(n4,1)*Q(n1+n5+n6,3)-2.*Q(n2+n3,2)*Q(n4,1)*Q(n1+n5+n6,3)
3232 - 2.*Q(n3,1)*Q(n2+n4,2)*Q(n1+n5+n6,3)-2.*Q(n2,1)*Q(n3+n4,2)*Q(n1+n5+n6,3)
3233 + 4.*Q(n2+n3+n4,3)*Q(n1+n5+n6,3)+2.*Q(n1,1)*Q(n3,1)*Q(n4,1)*Q(n2+n5+n6,3)
3234 - 2.*Q(n1+n3,2)*Q(n4,1)*Q(n2+n5+n6,3)-2.*Q(n3,1)*Q(n1+n4,2)*Q(n2+n5+n6,3)
3235 - 2.*Q(n1,1)*Q(n3+n4,2)*Q(n2+n5+n6,3)+4.*Q(n1+n3+n4,3)*Q(n2+n5+n6,3)
3236 - 6.*Q(n3,1)*Q(n4,1)*Q(n1+n2+n5+n6,4)+6.*Q(n3+n4,2)*Q(n1+n2+n5+n6,4)
3237 + 2.*Q(n1,1)*Q(n2,1)*Q(n4,1)*Q(n3+n5+n6,3)-2.*Q(n1+n2,2)*Q(n4,1)*Q(n3+n5+n6,3)
3238 - 2.*Q(n2,1)*Q(n1+n4,2)*Q(n3+n5+n6,3)-2.*Q(n1,1)*Q(n2+n4,2)*Q(n3+n5+n6,3)
3239 + 4.*Q(n1+n2+n4,3)*Q(n3+n5+n6,3)-6.*Q(n2,1)*Q(n4,1)*Q(n1+n3+n5+n6,4)
3240 + 6.*Q(n2+n4,2)*Q(n1+n3+n5+n6,4)-6.*Q(n1,1)*Q(n4,1)*Q(n2+n3+n5+n6,4)
3241 + 6.*Q(n1+n4,2)*Q(n2+n3+n5+n6,4)+24.*Q(n4,1)*Q(n1+n2+n3+n5+n6,5)
3242 + 2.*Q(n1,1)*Q(n2,1)*Q(n3,1)*Q(n4+n5+n6,3)-2.*Q(n1+n2,2)*Q(n3,1)*Q(n4+n5+n6,3)
3243 - 2.*Q(n2,1)*Q(n1+n3,2)*Q(n4+n5+n6,3)-2.*Q(n1,1)*Q(n2+n3,2)*Q(n4+n5+n6,3)
3244 + 4.*Q(n1+n2+n3,3)*Q(n4+n5+n6,3)-6.*Q(n2,1)*Q(n3,1)*Q(n1+n4+n5+n6,4)
3245 + 6.*Q(n2+n3,2)*Q(n1+n4+n5+n6,4)-6.*Q(n1,1)*Q(n3,1)*Q(n2+n4+n5+n6,4)
3246 + 6.*Q(n1+n3,2)*Q(n2+n4+n5+n6,4)+24.*Q(n3,1)*Q(n1+n2+n4+n5+n6,5)
3247 - 6.*Q(n1,1)*Q(n2,1)*Q(n3+n4+n5+n6,4)+6.*Q(n1+n2,2)*Q(n3+n4+n5+n6,4)
3248 + 24.*Q(n2,1)*Q(n1+n3+n4+n5+n6,5)+24.*Q(n1,1)*Q(n2+n3+n4+n5+n6,5)
3249 - 120.*Q(n1+n2+n3+n4+n5+n6,6);
3250
3251 return six;
3252
3253} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::Six(Int_t n1, Int_t n2, Int_t n3, Int_t n4, Int_t n5, Int_t n6)
3254
3255//=======================================================================================================================
3256
3257TComplex AliFlowAnalysisWithMultiparticleCorrelations::Seven(Int_t n1, Int_t n2, Int_t n3, Int_t n4, Int_t n5, Int_t n6, Int_t n7)
3258{
3259 // Generic seven-particle correlation <exp[i(n1*phi1+n2*phi2+n3*phi3+n4*phi4+n5*phi5+n6*phi6+n7*phi7)]>.
3260
68a8e667 3261 Int_t harmonic[7] = {n1,n2,n3,n4,n5,n6,n7};
3262
3263 TComplex seven = Recursion(7,harmonic);
7ecb5af4 3264
3265 return seven;
3266
3267} // end of TComplex AliFlowAnalysisWithMultiparticleCorrelations::Seven(Int_t n1, Int_t n2, Int_t n3, Int_t n4, Int_t n5, Int_t n6, Int_t n7)
3268
3269//=======================================================================================================================
3270
3271TComplex AliFlowAnalysisWithMultiparticleCorrelations::Eight(Int_t n1, Int_t n2, Int_t n3, Int_t n4, Int_t n5, Int_t n6, Int_t n7, Int_t n8)
3272{
3273 // Generic eight-particle correlation <exp[i(n1*phi1+n2*phi2+n3*phi3+n4*phi4+n5*phi5+n6*phi6+n7*phi7+n8*phi8)]>.
3274
68a8e667 3275 Int_t harmonic[8] = {n1,n2,n3,n4,n5,n6,n7,n8};
3276
3277 TComplex eight = Recursion(8,harmonic);
7ecb5af4 3278
3279 return eight;
3280
3281} // end of TComplex AliFlowAnalysisWithMultiparticleCorrelations::Eight(Int_t n1, Int_t n2, Int_t n3, Int_t n4, Int_t n5, Int_t n6, Int_t n7, Int_t n8)
3282
3283//=======================================================================================================================
3284
3285void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForWeights()
3286{
3287 // Book all objects for calculations with weights.
3288
3289 // a) Book profile to hold all flags for weights;
3290 // b) Store histograms holding phi, pt and eta weights.
3291
3292 // a) Book profile to hold all flags for weights:
68a8e667 3293 fWeightsFlagsPro = new TProfile("fWeightsFlagsPro","0 = weight not used, 1 = weight used ",6,0,6);
7ecb5af4 3294 fWeightsFlagsPro->SetLabelSize(0.06);
3295 fWeightsFlagsPro->SetStats(kFALSE);
3296 fWeightsFlagsPro->SetFillColor(kGray);
3297 fWeightsFlagsPro->SetLineColor(kBlack);
68a8e667 3298 fWeightsFlagsPro->GetXaxis()->SetBinLabel(1,"RP: w_{#phi}"); fWeightsFlagsPro->Fill(0.5,fUseWeights[0][0]);
3299 fWeightsFlagsPro->GetXaxis()->SetBinLabel(2,"RP: w_{p_{T}}"); fWeightsFlagsPro->Fill(1.5,fUseWeights[0][1]);
3300 fWeightsFlagsPro->GetXaxis()->SetBinLabel(3,"RP: w_{#eta}"); fWeightsFlagsPro->Fill(2.5,fUseWeights[0][2]);
3301 fWeightsFlagsPro->GetXaxis()->SetBinLabel(4,"POI: w_{#phi}"); fWeightsFlagsPro->Fill(3.5,fUseWeights[1][0]);
3302 fWeightsFlagsPro->GetXaxis()->SetBinLabel(5,"POI: w_{p_{T}}"); fWeightsFlagsPro->Fill(4.5,fUseWeights[1][1]);
3303 fWeightsFlagsPro->GetXaxis()->SetBinLabel(6,"POI: w_{#eta}"); fWeightsFlagsPro->Fill(5.5,fUseWeights[1][2]);
7ecb5af4 3304 fWeightsList->Add(fWeightsFlagsPro);
3305
3306 // b) Store histograms holding phi, pt and eta weights:
3307 // REMARK: It is assumed that these histos are accessed from external file "weights.root"
68a8e667 3308 for(Int_t rp=0;rp<2;rp++) // [RP,POI]
3309 {
3310 for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
3311 {
3312 if(fWeightsHist[rp][ppe]){fWeightsList->Add(fWeightsHist[rp][ppe]);}
3313 }
3314 }
7ecb5af4 3315
3316} // void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForWeights()
3317
3318//=======================================================================================================================
3319
68a8e667 3320Double_t AliFlowAnalysisWithMultiparticleCorrelations::Weight(const Double_t &value, const char *type, const char *variable) // value, [RP,POI], [phi,pt,eta]
3321{
3322 // Determine particle weight.
3323
3324 TString sMethodName = "Double_t AliFlowAnalysisWithMultiparticleCorrelations::Weight(const Double_t &value, const char *type, const char *variable)";
3325
3326 // Basic protection:
3327 if(!(TString(type).EqualTo("RP") || TString(type).EqualTo("POI"))){Fatal(sMethodName.Data(),"!(TString(type).EqualTo...");}
3328 if(!(TString(variable).EqualTo("phi") || TString(variable).EqualTo("pt") || TString(variable).EqualTo("eta"))){Fatal(sMethodName.Data(),"!(TString(variable).EqualTo...");}
3329
3330 Int_t rp = 0; // [RP,POI]
3331 if(TString(type).EqualTo("POI")){rp=1;}
3332
3333 Int_t ppe = 0; // [phi,pt,eta]
3334 if(TString(variable).EqualTo("pt")){ppe=1;}
3335 if(TString(variable).EqualTo("eta")){ppe=2;}
3336
3337 if(!fWeightsHist[rp][ppe]){Fatal(sMethodName.Data(),"!fWeightsHist[rp][ppe]");}
3338
3339 Double_t weight = fWeightsHist[rp][ppe]->GetBinContent(fWeightsHist[rp][ppe]->FindBin(value));
3340
3341 return weight;
3342
3343} // Double_t AliFlowAnalysisWithMultiparticleCorrelations::Weight(const Double_t &value, const char *type, const char *variable)
3344
3345//=======================================================================================================================
3346
3347/*
3348Double_t AliFlowAnalysisWithMultiparticleCorrelations::PhiWeight(const Double_t &dPhi, const char *type)
7ecb5af4 3349{
3350 // Determine phi weight for a given phi.
3351
68a8e667 3352 TString sMethodName = "Double_t AliFlowAnalysisWithMultiparticleCorrelations::PhiWeight(const Double_t &dPhi, const char *type)";
3353
3354 // Basic protection:
3355 if(!(TString(type)::EqualTo("RP") || TString(type)::EqualTo("POI"))){Fatal(sMethodName.Data(),"!(TString(type)::EqualTo...");}
3356
3357 Int_t rp = 0; // RP or POI
3358 if(TString(type)::EqualTo("POI")){rp=1;}
3359
3360 if(!fWeightsHist[rp][0]){Fatal("AliFlowAnalysisWithMultiparticleCorrelations::PhiWeight(const Double_t &dPhi)","fPhiWeightsHist");}
3361
3362
3363
3364
3365
3366
3367
3368
7ecb5af4 3369
3370 Double_t wPhi = fPhiWeightsHist->GetBinContent(fPhiWeightsHist->FindBin(dPhi));
68a8e667 3371
3372
3373 wPhi = 0.;
7ecb5af4 3374
3375 return wPhi;
3376
3377} // Double_t AliFlowAnalysisWithMultiparticleCorrelations::PhiWeight(const Double_t &dPhi)
3378
3379//=======================================================================================================================
3380
68a8e667 3381Double_t AliFlowAnalysisWithMultiparticleCorrelations::PtWeight(const Double_t &dPt, const char *type)
7ecb5af4 3382{
3383 // Determine pt weight for a given pt.
3384
6696a113 3385 if(!fPtWeightsHist){Fatal("AliFlowAnalysisWithMultiparticleCorrelations::PtWeight(const Double_t &dPt)","fPtWeightsHist");}
7ecb5af4 3386
3387 Double_t wPt = fPtWeightsHist->GetBinContent(fPtWeightsHist->FindBin(dPt));
3388
3389 return wPt;
3390
3391} // Double_t AliFlowAnalysisWithMultiparticleCorrelations::PtWeight(const Double_t &dPt)
3392
3393//=======================================================================================================================
3394
68a8e667 3395Double_t AliFlowAnalysisWithMultiparticleCorrelations::EtaWeight(const Double_t &dEta, const char *type)
7ecb5af4 3396{
3397 // Determine eta weight for a given eta.
3398
6696a113 3399 if(!fEtaWeightsHist){Fatal("AliFlowAnalysisWithMultiparticleCorrelations::EtaWeight(const Double_t &dEta)","fEtaWeightsHist");}
7ecb5af4 3400
3401 Double_t wEta = fEtaWeightsHist->GetBinContent(fEtaWeightsHist->FindBin(dEta));
3402
3403 return wEta;
3404
3405} // Double_t AliFlowAnalysisWithMultiparticleCorrelations::EtaWeight(const Double_t &dEta)
3406
68a8e667 3407*/
3408
3409
7ecb5af4 3410//=======================================================================================================================
3411
3412void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForBase()
3413{
3414 // Book all base objects.
3415
3416 fInternalFlagsPro = new TProfile("fInternalFlagsPro","Internal flags and settings",4,0,4);
3417 fInternalFlagsPro->SetLabelSize(0.05);
3418 fInternalFlagsPro->SetStats(kFALSE);
3419 fInternalFlagsPro->SetFillColor(kGray);
3420 fInternalFlagsPro->SetLineColor(kBlack);
3421 fInternalFlagsPro->GetXaxis()->SetBinLabel(1,"fUseInternalFlags"); fInternalFlagsPro->Fill(0.5,fUseInternalFlags);
3422 fInternalFlagsPro->GetXaxis()->SetBinLabel(2,"fMinNoRPs"); fInternalFlagsPro->Fill(1.5,fMinNoRPs);
3423 fInternalFlagsPro->GetXaxis()->SetBinLabel(3,"fMaxNoRPs"); fInternalFlagsPro->Fill(2.5,fMaxNoRPs);
3424 fInternalFlagsPro->GetXaxis()->SetBinLabel(4,"fExactNoRPs"); fInternalFlagsPro->Fill(3.5,fExactNoRPs);
3425 fHistList->Add(fInternalFlagsPro);
3426
3427} // void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForBase()
3428
3429//=======================================================================================================================
3430
3431Bool_t AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckInternalFlags(AliFlowEventSimple *anEvent)
3432{
3433 // Cross-check in this method wether "anEvent" passes internal flags.
3434
3435 // a) Cross-check min. and max. number of RPs.
3436 // b) Cross-check...
3437
3438 Bool_t bPassesInternalFlags = kTRUE;
3439
3440 // a) Cross-check min. and max. number of RPs:
3441 fMinNoRPs <= anEvent->GetNumberOfRPs() && anEvent->GetNumberOfRPs() < fMaxNoRPs ? 1 : bPassesInternalFlags = kFALSE; // TBI can I leave 1 like this?
3442
3443 // ...
3444
3445 return bPassesInternalFlags;
3446
3447} // Bool_t AliFlowAnalysisWithMultiparticleCorrelations::CrossCheckInternalFlags(AliFlowEventSimple *anEvent)
3448
3449//=======================================================================================================================
37d2f768 3450
68a8e667 3451void AliFlowAnalysisWithMultiparticleCorrelations::DumpPointsForDurham(TGraphErrors *ge)
3452{
3453 // Dump points from TGraphErrors object into Durham database format.
3454
3455 // Remark 1: format is <binCenter> <value> +-<stat.error>
3456 // Remark 2: the default precision is 6 significant digits
3457
3458 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::DumpPointsForDurham(TGraphErrors *ge)";
3459
3460 if(!ge){Fatal(sMethodName.Data(),"ge is NULL, for one reason or another...");}
3461
3462 ge->Draw("ap");
3463
3464 Int_t nPoints = ge->GetN();
3465 Double_t x = 0.;
3466 //Double_t xErr = 0.;
3467 Double_t y = 0.;
3468 Double_t yErr = 0.;
3469 printf("\nbinCenter value +-stat.error\n");
3470 for(Int_t p=0;p<nPoints;p++)
3471 {
3472 ge->GetPoint(p,x,y);
3473 //xErr = ge->GetErrorX(p);
3474 yErr = ge->GetErrorY(p);
3475 printf("%f %f +-%f\n",x,y,yErr);
3476 } // end of for(Int_t p=0;p<nPoints;p++)
3477 cout<<endl;
3478
3479} // void AliFlowAnalysisWithMultiparticleCorrelations::DumpPointsForDurham(TGraphErrors *ge)
3480
3481//=======================================================================================================================
3482
3483void AliFlowAnalysisWithMultiparticleCorrelations::DumpPointsForDurham(TH1D *h)
3484{
3485 // Dump points from TH1D object into Durham database format.
3486
3487 // Remark 1: format is <binCenter> <value> +-<stat.error>
3488 // Remark 2: the default precision is 6 significant digits
3489
3490 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::DumpPointsForDurham(TH1D *h)";
3491
3492 if(!h){Fatal(sMethodName.Data(),"h is NULL, for one reason or another...");}
3493
3494 h->Draw();
3495
3496 Int_t nPoints = h->GetXaxis()->GetNbins();
3497 Double_t x = 0.;
3498 Double_t y = 0.;
3499 Double_t yErr = 0.;
3500 printf("\nbinCenter value +-stat.error\n");
3501 for(Int_t p=1;p<=nPoints;p++)
3502 {
3503 x = h->GetBinCenter(p);
3504 y = h->GetBinContent(p);
3505 yErr = h->GetBinError(p);
3506 //printf("%f %f +-%f\n",x,y,yErr); _33
3507 printf("%e %e +-%e\n",x,y,yErr);
3508 } // end of for(Int_t p=0;p<nPoints;p++)
3509 cout<<endl;
3510
3511} // void AliFlowAnalysisWithMultiparticleCorrelations::DumpPointsForDurham(TH1D *h)
3512
3513//=======================================================================================================================
3514
3515void AliFlowAnalysisWithMultiparticleCorrelations::DumpPointsForDurham(TH1F *h)
3516{
3517 // Dump points from TH1F object into Durham database format.
3518
3519 // Remark 1: format is <binCenter> <value> +-<stat.error>
3520 // Remark 2: the default precision is 6 significant digits
3521
3522 TString sMethodName = "AliFlowAnalysisWithMultiparticleCorrelations::DumpPointsForDurham(TH1F *h)";
3523
3524 if(!h){Fatal(sMethodName.Data(),"h is NULL, for one reason or another...");}
3525
3526 h->Draw();
3527
3528 Int_t nPoints = h->GetXaxis()->GetNbins();
3529 Double_t x = 0.;
3530 Double_t y = 0.;
3531 Double_t yErr = 0.;
3532 printf("\nbinCenter value +-stat.error\n");
3533 for(Int_t p=1;p<=nPoints;p++)
3534 {
3535 x = h->GetBinCenter(p);
3536 y = h->GetBinContent(p);
3537 yErr = h->GetBinError(p);
3538 printf("%f %f +-%f\n",x,y,yErr);
3539 } // end of for(Int_t p=0;p<nPoints;p++)
3540 cout<<endl;
3541
3542} // void AliFlowAnalysisWithMultiparticleCorrelations::DumpPointsForDurham(TH1F *h)
3543
3544//=======================================================================================================================
3545
3546void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForQcumulants()
3547{
3548 // Initialize all arrays for Q-cumulants.
3549
3550 // ... TBI
3551
3552} // void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForQcumulants()
3553
3554//=======================================================================================================================
3555
3556void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForQcumulants()
3557{
3558 // Book all the stuff for Q-cumulants.
3559
3560 // a) Book the profile holding all the flags for Q-cumulants;
3561 // b) Book TH1D *fQcumulantsHist;
3562 // c) Book TH1D *fReferenceFlowHist;
3563 // d) Book TProfile2D *fProductsQCPro.
3564
3565 TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForQcumulants()";
3566
3567 // a) Book the profile holding all the flags for Q-cumulants:
3568 fQcumulantsFlagsPro = new TProfile("fQcumulantsFlagsPro","Flags for Q-cumulants",3,0,3);
3569 fQcumulantsFlagsPro->SetTickLength(-0.01,"Y");
3570 fQcumulantsFlagsPro->SetMarkerStyle(25);
3571 fQcumulantsFlagsPro->SetLabelSize(0.03);
3572 fQcumulantsFlagsPro->SetLabelOffset(0.02,"Y");
3573 fQcumulantsFlagsPro->SetStats(kFALSE);
3574 fQcumulantsFlagsPro->SetFillColor(kGray);
3575 fQcumulantsFlagsPro->SetLineColor(kBlack);
3576 fQcumulantsFlagsPro->GetXaxis()->SetBinLabel(1,"fCalculateQcumulants"); fQcumulantsFlagsPro->Fill(0.5,fCalculateQcumulants);
3577 fQcumulantsFlagsPro->GetXaxis()->SetBinLabel(2,"fHarmonicQC"); fQcumulantsFlagsPro->Fill(1.5,fHarmonicQC);
3578 fQcumulantsFlagsPro->GetXaxis()->SetBinLabel(3,"fPropagateErrorQC"); fQcumulantsFlagsPro->Fill(2.5,fPropagateErrorQC);
3579 fQcumulantsList->Add(fQcumulantsFlagsPro);
3580
3581 if(!fCalculateQcumulants){return;} // TBI is this safe enough?
3582
3583 // b) Book TH1D *fQcumulantsHist:
3584 fQcumulantsHist = new TH1D("Q-cumulants",Form("Q-cumulants (n = %d)",fHarmonicQC),4,0.,4.);
3585 fQcumulantsHist->SetStats(kFALSE);
3586 fQcumulantsHist->SetMarkerColor(kBlack);
3587 fQcumulantsHist->SetMarkerStyle(kFullSquare);
3588 fQcumulantsHist->GetXaxis()->SetLabelSize(0.045);
3589 fQcumulantsHist->GetXaxis()->SetLabelOffset(0.01);
3590 for(Int_t qc=1;qc<=4;qc++) // [QC{2},QC{4},QC{6},QC{8}]
3591 {
3592 fQcumulantsHist->GetXaxis()->SetBinLabel(qc,Form("QC{%d}",2*qc));
3593 }
3594 fQcumulantsList->Add(fQcumulantsHist);
3595
3596 // c) Book TH1D *fReferenceFlowHist:
3597 fReferenceFlowHist = new TH1D("Reference Flow","Reference flow from Q-cumulants",4,0.,4.);
3598 fReferenceFlowHist->SetStats(kFALSE);
3599 fReferenceFlowHist->SetMarkerColor(kBlack);
3600 fReferenceFlowHist->SetMarkerStyle(kFullSquare);
3601 fReferenceFlowHist->GetXaxis()->SetLabelSize(0.045);
3602 fReferenceFlowHist->GetXaxis()->SetLabelOffset(0.01);
3603 for(Int_t qc=1;qc<=4;qc++) // [vn{2},vn{4},vn{6},vn{8}]
3604 {
3605 fReferenceFlowHist->GetXaxis()->SetBinLabel(qc,Form("v_{%d}{%d}",fHarmonicQC,2*qc));
3606 }
3607 fQcumulantsList->Add(fReferenceFlowHist);
3608
3609 if(!fPropagateErrorQC){return;} // TBI is this safe enough?
3610
3611 // d) Book TProfile2D *fProductsQCPro:
3612 const Int_t nCorrelations = 4;
3613 Int_t n = fHarmonicQC;
3614 TString sCorrelations[nCorrelations] = {Form("Cos(-%d,%d)",n,n),
3615 Form("Cos(-%d,-%d,%d,%d)",n,n,n,n),
3616 Form("Cos(-%d,-%d,-%d,%d,%d,%d)",n,n,n,n,n,n),
3617 Form("Cos(-%d,-%d,-%d,-%d,%d,%d,%d,%d)",n,n,n,n,n,n,n,n)};
3618 Int_t nBins2D = nCorrelations;
3619 fProductsQCPro = new TProfile2D("fProductsQCPro","Products of correlations",nBins2D,0.,nBins2D,nBins2D,0.,nBins2D);
3620 fProductsQCPro->SetStats(kFALSE);
3621 fProductsQCPro->Sumw2();
3622 for(Int_t b=1;b<=nBins2D;b++)
3623 {
3624 fProductsQCPro->GetXaxis()->SetBinLabel(b,sCorrelations[b-1].Data());
3625 fProductsQCPro->GetYaxis()->SetBinLabel(b,sCorrelations[b-1].Data());
3626 } // for(Int_t b=1;b<=nBins2D;b++)
3627 fQcumulantsList->Add(fProductsQCPro);
3628
3629} // end of void AliFlowAnalysisWithMultiparticleCorrelations::BookEverythingForQcumulants()
3630
3631//=======================================================================================================================
3632
3633void AliFlowAnalysisWithMultiparticleCorrelations::CalculateQcumulants()
3634{
3635 // Calculate Q-cumulants.
3636
3637 TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::CalculateQcumulants()";
3638
3639 Int_t n = fHarmonicQC;
3640 fQcumulantsHist->SetTitle(Form("Q-cumulants (n = %d)",n));
3641
3642 TString sCorrelations[4] = {Form("Cos(-%d,%d)",n,n),
3643 Form("Cos(-%d,-%d,%d,%d)",n,n,n,n),
3644 Form("Cos(-%d,-%d,-%d,%d,%d,%d)",n,n,n,n,n,n),
3645 Form("Cos(-%d,-%d,-%d,-%d,%d,%d,%d,%d)",n,n,n,n,n,n,n,n)};
3646
3647 Int_t nBins[4] = {fCorrelationsPro[0][1]->GetNbinsX(),fCorrelationsPro[0][3]->GetNbinsX(),
3648 fCorrelationsPro[0][5]->GetNbinsX(),fCorrelationsPro[0][7]->GetNbinsX()};
3649
3650 Double_t dCorrelation[4] = {0.};
3651 Double_t dCorrelationErr[4] = {0.};
3652
3653 for(Int_t c=0;c<4;c++) // [<<2>>,<<4>>,<<6>>,<<8>>]
3654 {
3655 if(2*(c+1)>fDontGoBeyond){break;}
3656 for(Int_t b=1;b<=nBins[c];b++)
3657 {
3658 if(sCorrelations[c].EqualTo(fCorrelationsPro[0][2*c+1]->GetXaxis()->GetBinLabel(b)))
3659 {
3660 dCorrelation[c] = fCorrelationsPro[0][2*c+1]->GetBinContent(b);
3661 dCorrelationErr[c] = fCorrelationsPro[0][2*c+1]->GetBinError(b);
3662 break;
3663 }
3664 } // for(Int_t b=1;b<=nBins[c];b++)
3665 } // for(Int_t c=0;c<4;c++) // [<<2>>,<<4>>,<<6>>,<<8>>]
3666
3667 // Correlations:
3668 Double_t two = dCorrelation[0]; // <<2>>
3669 Double_t four = dCorrelation[1]; // <<4>>
3670 Double_t six = dCorrelation[2]; // <<6>>
3671 Double_t eight = dCorrelation[3]; // <<8>>
3672
3673 // Q-cumulants:
3674 Double_t qc2 = 0.; // QC{2}
3675 Double_t qc4 = 0.; // QC{4}
3676 Double_t qc6 = 0.; // QC{6}
3677 Double_t qc8 = 0.; // QC{8}
3678 if(TMath::Abs(two) > 0. && !(fDontGoBeyond < 2)){qc2 = two;}
3679 if(TMath::Abs(four) > 0. && !(fDontGoBeyond < 4)){qc4 = four-2.*pow(two,2.);}
3680 if(TMath::Abs(six) > 0. && !(fDontGoBeyond < 6)){qc6 = six-9.*two*four+12.*pow(two,3.);}
3681 if(TMath::Abs(eight) > 0. && !(fDontGoBeyond < 8)){qc8 = eight-16.*two*six-18.*pow(four,2.)+144.*pow(two,2.)*four-144.*pow(two,4.);}
3682
3683 // Store the results for Q-cumulants:
3684 if(TMath::Abs(qc2)>0.)
3685 {
3686 fQcumulantsHist->SetBinContent(1,qc2);
3687 }
3688 if(TMath::Abs(qc4)>0.)
3689 {
3690 fQcumulantsHist->SetBinContent(2,qc4);
3691 }
3692 if(TMath::Abs(qc6)>0.)
3693 {
3694 fQcumulantsHist->SetBinContent(3,qc6);
3695 }
3696 if(TMath::Abs(qc8)>0.)
3697 {
3698 fQcumulantsHist->SetBinContent(4,qc8);
3699 }
3700
3701 if(!fPropagateErrorQC)
3702 {
3703 fQcumulantsHist->SetBinError(1,0.);
3704 fQcumulantsHist->SetBinError(2,0.);
3705 fQcumulantsHist->SetBinError(3,0.);
3706 fQcumulantsHist->SetBinError(4,0.);
3707 return;
3708 } // if(!fPropagateErrorQC)
3709
3710 // Statistical errors of average 2-, 4-, 6- and 8-particle azimuthal correlations:
3711 Double_t twoError = dCorrelationErr[0]; // statistical error of <2>
3712 Double_t fourError = dCorrelationErr[1]; // statistical error of <4>
3713 Double_t sixError = dCorrelationErr[2]; // statistical error of <6>
3714 Double_t eightError = dCorrelationErr[3]; // statistical error of <8>
3715
3716 // Covariances multiplied by a prefactor depending on weights:
3717 Double_t wCov24 = 0.; // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
3718 Double_t wCov26 = 0.; // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
3719 Double_t wCov28 = 0.; // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
3720 Double_t wCov46 = 0.; // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
3721 Double_t wCov48 = 0.; // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
3722 Double_t wCov68 = 0.; // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)
3723 if(!(fDontGoBeyond < 4)){wCov24 = Covariance(sCorrelations[0].Data(),sCorrelations[1].Data(),fProductsQCPro);} // Cov(<2>,<4>) * prefactor(w_<2>,w_<4>)
3724 if(!(fDontGoBeyond < 6)){wCov26 = Covariance(sCorrelations[0].Data(),sCorrelations[2].Data(),fProductsQCPro);} // Cov(<2>,<6>) * prefactor(w_<2>,w_<6>)
3725 if(!(fDontGoBeyond < 8)){wCov28 = Covariance(sCorrelations[0].Data(),sCorrelations[3].Data(),fProductsQCPro);} // Cov(<2>,<8>) * prefactor(w_<2>,w_<8>)
3726 if(!(fDontGoBeyond < 6)){wCov46 = Covariance(sCorrelations[1].Data(),sCorrelations[2].Data(),fProductsQCPro);} // Cov(<4>,<6>) * prefactor(w_<4>,w_<6>)
3727 if(!(fDontGoBeyond < 8)){wCov48 = Covariance(sCorrelations[1].Data(),sCorrelations[3].Data(),fProductsQCPro);} // Cov(<4>,<8>) * prefactor(w_<4>,w_<8>)
3728 if(!(fDontGoBeyond < 8)){wCov68 = Covariance(sCorrelations[2].Data(),sCorrelations[3].Data(),fProductsQCPro);} // Cov(<6>,<8>) * prefactor(w_<6>,w_<8>)
3729
3730 // Statistical errors of Q-cumulants:
3731 Double_t qc2Error = 0.;
3732 Double_t qc4Error = 0.;
3733 Double_t qc6Error = 0.;
3734 Double_t qc8Error = 0.;
3735 // Squared statistical errors of Q-cumulants:
3736 //Double_t qc2ErrorSquared = 0.;
3737 Double_t qc4ErrorSquared = 0.;
3738 Double_t qc6ErrorSquared = 0.;
3739 Double_t qc8ErrorSquared = 0.;
3740 // Statistical error of QC{2}:
3741 if(!(fDontGoBeyond < 2)){qc2Error = twoError;}
3742 // Statistical error of QC{4}:
3743 qc4ErrorSquared = 16.*pow(two,2.)*pow(twoError,2)+pow(fourError,2.)
3744 - 8.*two*wCov24;
3745 if(qc4ErrorSquared > 0. && !(fDontGoBeyond < 4))
3746 {
3747 qc4Error = pow(qc4ErrorSquared,0.5);
3748 } else{Warning(sMethodName.Data(),"Statistical error of QC{4} is imaginary !!!!");}
3749
3750 // Statistical error of QC{6}:
3751 qc6ErrorSquared = 81.*pow(4.*pow(two,2.)-four,2.)*pow(twoError,2.)
3752 + 81.*pow(two,2.)*pow(fourError,2.)
3753 + pow(sixError,2.)
3754 - 162.*two*(4.*pow(two,2.)-four)*wCov24
3755 + 18.*(4.*pow(two,2.)-four)*wCov26
3756 - 18.*two*wCov46;
3757 if(qc6ErrorSquared > 0. && !(fDontGoBeyond < 6))
3758 {
3759 qc6Error = pow(qc6ErrorSquared,0.5);
3760 } else{Warning(sMethodName.Data(),"Statistical error of QC{6} is imaginary !!!!");}
3761
3762 // Statistical error of QC{8}:
3763 qc8ErrorSquared = 256.*pow(36.*pow(two,3.)-18.*four*two+six,2.)*pow(twoError,2.)
3764 + 1296.*pow(4.*pow(two,2.)-four,2.)*pow(fourError,2.)
3765 + 256.*pow(two,2.)*pow(sixError,2.)
3766 + pow(eightError,2.)
3767 - 1152.*(36.*pow(two,3.)-18.*four*two+six)*(4.*pow(two,2.)-four)*wCov24
3768 + 512.*two*(36.*pow(two,3.)-18.*four*two+six)*wCov26
3769 - 32.*(36.*pow(two,3.)-18.*four*two+six)*wCov28
3770 - 1152.*two*(4.*pow(two,2.)-four)*wCov46
3771 + 72.*(4.*pow(two,2.)-four)*wCov48
3772 - 32.*two*wCov68;
3773 if(qc8ErrorSquared > 0. && !(fDontGoBeyond < 8))
3774 {
3775 qc8Error = pow(qc8ErrorSquared,0.5);
3776 } else{Warning(sMethodName.Data(),"Statistical error of QC{8} is imaginary !!!!");}
3777
3778 // Store the statistical errors for Q-cumulants:
3779 if(TMath::Abs(qc2)>0.)
3780 {
3781 fQcumulantsHist->SetBinError(1,qc2Error);
3782 }
3783 if(TMath::Abs(qc4)>0.)
3784 {
3785 fQcumulantsHist->SetBinError(2,qc4Error);
3786 }
3787 if(TMath::Abs(qc6)>0.)
3788 {
3789 fQcumulantsHist->SetBinError(3,qc6Error);
3790 }
3791 if(TMath::Abs(qc8)>0.)
3792 {
3793 fQcumulantsHist->SetBinError(4,qc8Error);
3794 }
3795
3796} // void AliFlowAnalysisWithMultiparticleCorrelations::CalculateQcumulants()
3797
3798//=======================================================================================================================
3799
3800void AliFlowAnalysisWithMultiparticleCorrelations::CalculateReferenceFlow()
3801{
3802 // Calculate reference flow from Q-cumulants.
3803
3804 TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::CalculateReferenceFlow()";
3805
3806 Int_t n = fHarmonicQC;
3807
3808 // Reference flow estimates:
3809 Double_t v2 = 0.; // v{2}
3810 Double_t v4 = 0.; // v{4}
3811 Double_t v6 = 0.; // v{6}
3812 Double_t v8 = 0.; // v{8}
3813
3814 // Reference flow's statistical errors:
3815 Double_t v2Error = 0.; // v{2} stat. error
3816 Double_t v4Error = 0.; // v{4} stat. error
3817 Double_t v6Error = 0.; // v{6} stat. error
3818 Double_t v8Error = 0.; // v{8} stat. error
3819
3820 // Q-cumulants:
3821 Double_t qc2 = fQcumulantsHist->GetBinContent(1); // QC{2}
3822 Double_t qc4 = fQcumulantsHist->GetBinContent(2); // QC{4}
3823 Double_t qc6 = fQcumulantsHist->GetBinContent(3); // QC{6}
3824 Double_t qc8 = fQcumulantsHist->GetBinContent(4); // QC{8}
3825
3826 // Q-cumulants's statistical errors:
3827 Double_t qc2Error = fQcumulantsHist->GetBinError(1); // QC{2} stat. error
3828 Double_t qc4Error = fQcumulantsHist->GetBinError(2); // QC{4} stat. error
3829 Double_t qc6Error = fQcumulantsHist->GetBinError(3); // QC{6} stat. error
3830 Double_t qc8Error = fQcumulantsHist->GetBinError(4); // QC{8} stat. error
3831
3832 // Calculate reference flow estimates from Q-cumulants:
3833 if(qc2>=0.){v2 = pow(qc2,0.5);}
3834 if(qc4<=0.){v4 = pow(-1.*qc4,1./4.);}
3835 if(qc6>=0.){v6 = pow((1./4.)*qc6,1./6.);}
3836 if(qc8<=0.){v8 = pow((-1./33.)*qc8,1./8.);}
3837
3838 // Calculate stat. error for reference flow estimates from stat. error of Q-cumulants:
3839 if(qc2>0. && qc2Error>0.){v2Error = (1./2.)*pow(qc2,-0.5)*qc2Error;}
3840 if(qc4<0. && qc4Error>0.){v4Error = (1./4.)*pow(-qc4,-3./4.)*qc4Error;}
3841 if(qc6>0. && qc6Error>0.){v6Error = (1./6.)*pow(2.,-1./3.)*pow(qc6,-5./6.)*qc6Error;}
3842 if(qc8<0. && qc8Error>0.){v8Error = (1./8.)*pow(33.,-1./8.)*pow(-qc8,-7./8.)*qc8Error;}
3843
3844 // Print warnings for the 'wrong sign' cumulants:
3845 if(TMath::Abs(v2)<1.e-44){Warning(sMethodName.Data(),"Wrong sign QC{2}, couldn't calculate v{2} !!!!");}
3846 if(TMath::Abs(v4)<1.e-44){Warning(sMethodName.Data(),"Wrong sign QC{4}, couldn't calculate v{4} !!!!");}
3847 if(TMath::Abs(v6)<1.e-44){Warning(sMethodName.Data(),"Wrong sign QC{6}, couldn't calculate v{6} !!!!");}
3848 if(TMath::Abs(v8)<1.e-44){Warning(sMethodName.Data(),"Wrong sign QC{8}, couldn't calculate v{8} !!!!");}
3849
3850 // Store the results and statistical errors of reference flow estimates:
3851 for(Int_t qc=1;qc<=4;qc++) // [vn{2},vn{4},vn{6},vn{8}]
3852 {
3853 fReferenceFlowHist->GetXaxis()->SetBinLabel(qc,Form("v_{%d}{%d}",n,2*qc));
3854 }
3855 fReferenceFlowHist->SetBinContent(1,v2);
3856 fReferenceFlowHist->SetBinError(1,v2Error);
3857 fReferenceFlowHist->SetBinContent(2,v4);
3858 fReferenceFlowHist->SetBinError(2,v4Error);
3859 fReferenceFlowHist->SetBinContent(3,v6);
3860 fReferenceFlowHist->SetBinError(3,v6Error);
3861 fReferenceFlowHist->SetBinContent(4,v8);
3862 fReferenceFlowHist->SetBinError(4,v8Error);
3863
3864 // Final printout:
3865 cout<<endl;
3866 cout<<"*************************************"<<endl;
3867 cout<<"*************************************"<<endl;
3868 cout<<" flow estimates from Q-cumulants"<<endl;
3869 TString sWhichWeights = "no weights";
3870 if(fUseWeights[0][0]){sWhichWeights = "phi weights";}
3871 else if(fUseWeights[0][1]){sWhichWeights = "pt weights";}
3872 else if(fUseWeights[0][2]){sWhichWeights = "eta weights";}
3873 cout<<Form(" (MPC class, RPs, %s)",sWhichWeights.Data())<<endl;
3874 cout<<endl;
3875 for(Int_t co=0;co<4;co++) // cumulant order
3876 {
3877 cout<<Form(" v_%d{%d} = %.8f +/- %.8f",fHarmonicQC,2*(co+1),fReferenceFlowHist->GetBinContent(co+1),fReferenceFlowHist->GetBinError(co+1))<<endl;
3878 }
3879 cout<<endl;
3880 Int_t nEvts = 0;
3881 Double_t dAvM = 0.;
3882 if(fMultDistributionsHist[0])
3883 {
3884 nEvts = (Int_t)fMultDistributionsHist[0]->GetEntries();
3885 dAvM = fMultDistributionsHist[0]->GetMean();
3886 } else{Warning(sMethodName.Data(),"fMultDistributionsHist[0] is NULL !!!!");}
3887 cout<<Form(" nEvts = %d, <M> = %.2f",nEvts,dAvM)<<endl;
3888 cout<<"*************************************"<<endl;
3889 cout<<"*************************************"<<endl;
3890 cout<<endl;
3891
3892} // void AliFlowAnalysisWithMultiparticleCorrelations::CalculateReferenceFlow()
3893
3894//=======================================================================================================================
3895
3896Double_t AliFlowAnalysisWithMultiparticleCorrelations::Covariance(const char *x, const char *y, TProfile2D *profile2D, Bool_t bUnbiasedEstimator)
3897{
3898 // Calculate covariance (multiplied by a weight dependent factor).
3899
3900 // Remark: wCov = Cov(<x>,<y>) * (sum_{i=1}^{N} w_{<x>}_i w_{<y>}_i )/[(sum_{i=1}^{N} w_{<x>}_i) * (sum_{j=1}^{N} w_{<y>}_j)],
3901 // where Cov(<x>,<y>) is biased or unbiased estimator (specified via bUnbiasedEstimator) for the covariance.
3902 // An unbiased estimator is given for instance in Eq. (C.12) on page 131 of my thesis.
3903
3904 Double_t wCov = 0.; // return value
3905
3906 TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::Covariance(const char *x, const char *y, TProfile2D *profile2D, Bool_t bBiasedEstimator)";
3907 if(!profile2D){Fatal(sMethodName.Data(),"Sorry, 'profile2D' is on holidays.");}
3908
3909 // Basic protection:
3910 if(!(TString(x).BeginsWith("Cos") || TString(x).BeginsWith("Sin")))
3911 {
3912 cout<<Form("And the fatal x is... '%s'. Congratulations!!",x)<<endl;
3913 Fatal(sMethodName.Data(),"!(TString(x).BeginsWith(...");
3914 }
3915 if(!(TString(y).BeginsWith("Cos") || TString(y).BeginsWith("Sin")))
3916 {
3917 cout<<Form("And the fatal y is... '%s'. Congratulations!!",y)<<endl;
3918 Fatal(sMethodName.Data(),"!(TString(y).BeginsWith(...");
3919 }
3920
3921 // Determine 'cs' (cosine or sinus) indices for x and y:
3922 Int_t csx = 0; if(TString(x).BeginsWith("Sin")){csx = 1;}
3923 Int_t csy = 0; if(TString(y).BeginsWith("Sin")){csy = 1;}
3924
3925 // Determine 'c' (order of correlator) indices for x and y:
3926 Int_t cx = -1;
3927 for(Int_t t=0;t<=TString(x).Length();t++)
3928 {
3929 if(TString(x[t]).EqualTo(",") || TString(x[t]).EqualTo(")")) // TBI this is just ugly
3930 {
3931 cx++;
3932 if(cx>=8){Fatal(sMethodName.Data(),"cx>=8");} // not supporting corr. beyond 8p
3933 } // if(TString(x[t]).EqualTo(",") || TString(x[t]).EqualTo(")")) // TBI this is just ugly
3934 } // for(Int_t t=0;t<=TString(x).Length();t++)
3935 Int_t cy = -1;
3936 for(Int_t t=0;t<=TString(y).Length();t++)
3937 {
3938 if(TString(y[t]).EqualTo(",") || TString(y[t]).EqualTo(")")) // TBI this is just ugly
3939 {
3940 cy++;
3941 if(cy>=8){Fatal(sMethodName.Data(),"cy>=8");} // not supporting corr. beyond 8p
3942 } // if(TString(y[t]).EqualTo(",") || TString(y[t]).EqualTo(")")) // TBI this is just ugly
3943 } // for(Int_t t=0;t<=TString(y).Length();t++)
3944
3945 // Correlations corresponding to x and y:
3946 // x:
3947 Double_t dx = 0.; // <<x>>
3948 Double_t wx = 0.; // \sum w_x
3949 Int_t nbx = fCorrelationsPro[csx][cx]->GetNbinsX();
3950 for(Int_t b=1;b<=nbx;b++)
3951 {
3952 TString sBinLabel = fCorrelationsPro[csx][cx]->GetXaxis()->GetBinLabel(b);
3953 if(sBinLabel.EqualTo(x))
3954 {
3955 //cout<<Form("b = %d, binLabel = %s",b,sBinLabel.Data())<<endl;
3956 dx = fCorrelationsPro[csx][cx]->GetBinContent(b);
3957 wx = fCorrelationsPro[csx][cx]->GetBinEntries(b);
3958 break;
3959 } // if(sBinLabel.EqualTo(x))
3960 if(sBinLabel.EqualTo("")){break;}
3961 } // for(Int_t b=1;b<=nbx;b++)
3962 if(TMath::Abs(dx)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(dx)<1.e-44, %s",x);}
3963 if(TMath::Abs(wx)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(wx)<1.e-44, %s",x);}
3964
3965 // y:
3966 Double_t dy = 0.; // <<y>>
3967 Double_t wy = 0.; // \sum w_y
3968 Int_t nby = fCorrelationsPro[csy][cy]->GetNbinsX();
3969 for(Int_t b=1;b<=nby;b++)
3970 {
3971 TString sBinLabel = fCorrelationsPro[csy][cy]->GetXaxis()->GetBinLabel(b);
3972 if(sBinLabel.EqualTo(y))
3973 {
3974 //cout<<Form("b = %d, binLabel = %s",b,sBinLabel.Data())<<endl;
3975 dy = fCorrelationsPro[csy][cy]->GetBinContent(b);
3976 wy = fCorrelationsPro[csy][cy]->GetBinEntries(b);
3977 break;
3978 } // if(sBinLabel.EqualTo(y))
3979 if(sBinLabel.EqualTo("")){break;}
3980 } // for(Int_t b=1;b<=nby;b++)
3981 if(TMath::Abs(dy)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(dy)<1.e-44, %s",y);}
3982 if(TMath::Abs(wy)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(wy)<1.e-44, %s",y);}
3983
3984 // Product:
3985 Double_t dxy = 0.; // <<xy>>
3986 Double_t wxy = 0.; // \sum w_x*w_y
3987 // x:
3988 Int_t nBinsX = profile2D->GetNbinsX();
3989 Int_t gbx = 0; // generic bin for x
3990 for(Int_t b=1;b<=nBinsX;b++)
3991 {
3992 TString sBinLabel = profile2D->GetXaxis()->GetBinLabel(b);
3993 if(sBinLabel.EqualTo(x))
3994 {
3995 gbx = b; break;
3996 }
3997 } // for(Int_t b=1;b<=nBins2D;b++)
3998 if(0==gbx){Fatal(sMethodName.Data(),"0==gbx, %s",x);}
3999 // y:
4000 Int_t nBinsY = profile2D->GetNbinsY();
4001 Int_t gby = 0; // generic bin for y
4002 for(Int_t b=1;b<=nBinsY;b++)
4003 {
4004 TString sBinLabel = profile2D->GetYaxis()->GetBinLabel(b);
4005 if(sBinLabel.EqualTo(y))
4006 {
4007 gby = b; break;
4008 }
4009 } // for(Int_t b=1;b<=nBinsY;b++)
4010 if(0==gby){Fatal(sMethodName.Data(),"0==gby, %s",y);}
4011
4012 if(gbx>gby)
4013 {
4014 dxy = profile2D->GetBinContent(profile2D->GetBin(gbx,gby));
4015 wxy = profile2D->GetBinEntries(profile2D->GetBin(gbx,gby));
4016 }
4017 else if(gbx<gby)
4018 {
4019 dxy = profile2D->GetBinContent(profile2D->GetBin(gby,gbx));
4020 wxy = profile2D->GetBinEntries(profile2D->GetBin(gby,gbx));
4021 } else{Fatal(sMethodName.Data(),"gbx==gby, %s, %s",x,y);}
4022 if(TMath::Abs(dxy)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(dxy)<1.e-44, %s, %s",x,y);}
4023 if(TMath::Abs(wxy)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(wxy)<1.e-44, %s, %s",x,y);}
4024
4025 // Finally:
4026 if(bUnbiasedEstimator)
4027 {
4028 Double_t num = dxy-dx*dy; // numerator of Eq. (C.12) on page 131 of my thesis
4029 Double_t den = 1.-wxy/(wx*wy); // denominator of Eq. (C.12) on page 131 of my thesis
4030 Double_t pre = wxy/(wx*wy); // prefactor
4031 if(TMath::Abs(den)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(den)<1.e-44, %s, %s",x,y);}
4032 wCov = pre*num/den;
4033 if(TMath::Abs(wCov)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(wCov)<1.e-44, %s, %s",x,y);}
4034 } else
4035 {
4036 // TBI check if this is a correct formula for the biased estimator
4037 Double_t num = dxy-dx*dy; // numerator of Eq. (C.12) on page 131 of my thesis
4038 Double_t den = 1.;
4039 Double_t pre = wxy/(wx*wy); // prefactor
4040 if(TMath::Abs(den)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(den)<1.e-44, %s, %s",x,y);}
4041 wCov = pre*num/den;
4042 if(TMath::Abs(wCov)<1.e-44){Fatal(sMethodName.Data(),"TMath::Abs(wCov)<1.e-44, %s, %s",x,y);}
4043 }
4044
4045 return wCov;
4046
4047} // Double_t AliFlowAnalysisWithMultiparticleCorrelationsCovariance(const char *x, const char *y, TProfile2D *profile2D, Bool_t bUnbiasedEstimator = kFALSE)
4048
4049//=======================================================================================================================
4050
4051/*
4052TComplex AliFlowAnalysisWithMultiparticleCorrelations::Recursion(Int_t n, Int_t* harmonic, Int_t* mult)
4053{
4054 // Calculate multi-particle correlators by using recursion originally developed by
4055 // Kristjan Gulbrandsen (gulbrand@nbi.dk).
4056
4057 TComplex c = Q(harmonic[n-1], mult[n-1]);
4058 if (n == 1) return c;
4059 c *= Recursion(n-1, harmonic, mult);
4060 if (mult[n-1]>1) return c;
4061 for (Int_t i=0; i<(n-1); i++) {
4062 harmonic[i] += harmonic[n-1];
4063 mult[i]++;
4064 c -= (mult[i]-1.)*Recursion(n-1, harmonic, mult);
4065 mult[i]--;
4066 harmonic[i] -= harmonic[n-1];
4067 }
4068
4069 return c;
4070
4071} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::Recursion(Int_t n, Int_t* harmonic, Int_t* mult)
4072*/
4073
4074//=======================================================================================================================
4075
4076TComplex AliFlowAnalysisWithMultiparticleCorrelations::Recursion(Int_t n, Int_t* harmonic, Int_t mult, Int_t skip)
4077{
4078 // Calculate multi-particle correlators by using recursion (an improved faster version) originally developed by
4079 // Kristjan Gulbrandsen (gulbrand@nbi.dk).
4080
4081 Int_t nm1 = n-1;
4082 TComplex c(Q(harmonic[nm1], mult));
4083 if (nm1 == 0) return c;
4084 c *= Recursion(nm1, harmonic);
4085 if (nm1 == skip) return c;
4086
4087 Int_t multp1 = mult+1;
4088 Int_t nm2 = n-2;
4089 Int_t counter1 = 0;
4090 Int_t hhold = harmonic[counter1];
4091 harmonic[counter1] = harmonic[nm2];
4092 harmonic[nm2] = hhold + harmonic[nm1];
4093 TComplex c2(Recursion(nm1, harmonic, multp1, nm2));
4094 Int_t counter2 = n-3;
4095 while (counter2 >= skip) {
4096 harmonic[nm2] = harmonic[counter1];
4097 harmonic[counter1] = hhold;
4098 ++counter1;
4099 hhold = harmonic[counter1];
4100 harmonic[counter1] = harmonic[nm2];
4101 harmonic[nm2] = hhold + harmonic[nm1];
4102 c2 += Recursion(nm1, harmonic, multp1, counter2);
4103 --counter2;
4104 }
4105 harmonic[nm2] = harmonic[counter1];
4106 harmonic[counter1] = hhold;
4107
4108 if (mult == 1) return c-c2;
4109 return c-Double_t(mult)*c2;
4110
4111} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::Recursion(Int_t n, Int_t* harmonic, Int_t mult, Int_t skip)
4112
4113//=======================================================================================================================
4114
4115TComplex AliFlowAnalysisWithMultiparticleCorrelations::OneDiff(Int_t n1)
4116{
4117 // Generic differential one-particle correlation <exp[i(n1*psi1)]>.
4118 // (psi labels POI, phi labels RPs)
4119
4120 TComplex one = p(n1,1);
4121
4122 return one;
4123
4124} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::OneDiff(Int_t n1)
4125
4126//=======================================================================================================================
4127
4128TComplex AliFlowAnalysisWithMultiparticleCorrelations::TwoDiff(Int_t n1, Int_t n2)
4129{
4130 // Generic differential two-particle correlation <exp[i(n1*psi1+n2*phi2)]>.
4131 // (psi labels POI, phi labels RPs)
4132
4133 TComplex two = p(n1,1)*Q(n2,1)-q(n1+n2,2);
4134
4135 return two;
4136
4137} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::TwoDiff(Int_t n1, Int_t n2)
4138
4139//=======================================================================================================================
4140
4141TComplex AliFlowAnalysisWithMultiparticleCorrelations::ThreeDiff(Int_t n1, Int_t n2, Int_t n3)
4142{
4143 // Generic differential three-particle correlation <exp[i(n1*psi1+n2*phi2+n3*phi3)]>.
4144 // (psi labels POI, phi labels RPs)
4145
4146 TComplex three = p(n1,1)*Q(n2,1)*Q(n3,1)-q(n1+n2,2)*Q(n3,1)-q(n1+n3,2)*Q(n2,1)
4147 - p(n1,1)*Q(n2+n3,2)+2.*q(n1+n2+n3,3);
4148
4149 return three;
4150
4151} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::ThreeDiff(Int_t n1, Int_t n2, Int_t n3)
4152
4153//=======================================================================================================================
4154
4155TComplex AliFlowAnalysisWithMultiparticleCorrelations::FourDiff(Int_t n1, Int_t n2, Int_t n3, Int_t n4)
4156{
4157 // Generic differential four-particle correlation <exp[i(n1*psi1+n2*phi2+n3*phi3+n4*phi4)]>.
4158 // (psi labels POI, phi labels RPs)
4159
4160 TComplex four = p(n1,1)*Q(n2,1)*Q(n3,1)*Q(n4,1)-q(n1+n2,2)*Q(n3,1)*Q(n4,1)-Q(n2,1)*q(n1+n3,2)*Q(n4,1)
4161 - p(n1,1)*Q(n2+n3,2)*Q(n4,1)+2.*q(n1+n2+n3,3)*Q(n4,1)-Q(n2,1)*Q(n3,1)*q(n1+n4,2)
4162 + Q(n2+n3,2)*q(n1+n4,2)-p(n1,1)*Q(n3,1)*Q(n2+n4,2)+q(n1+n3,2)*Q(n2+n4,2)
4163 + 2.*Q(n3,1)*q(n1+n2+n4,3)-p(n1,1)*Q(n2,1)*Q(n3+n4,2)+q(n1+n2,2)*Q(n3+n4,2)
4164 + 2.*Q(n2,1)*q(n1+n3+n4,3)+2.*p(n1,1)*Q(n2+n3+n4,3)-6.*q(n1+n2+n3+n4,4);
4165
4166 return four;
4167
4168} // TComplex AliFlowAnalysisWithMultiparticleCorrelations::FourDiff(Int_t n1, Int_t n2, Int_t n3, Int_t n4)
4169
4170//=======================================================================================================================
4171
4172void AliFlowAnalysisWithMultiparticleCorrelations::SetDiffHarmonics(Int_t order, Int_t *harmonics)
4173{
4174 // Set harmonics for all differential correlators.
4175
4176 TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::SetDiffHarmonics(Int_t order, Int_t *harmonics)";
4177
4178 // Basic protection:
4179 if(order<=0||order>4){Fatal(sMethodName.Data(),"order<=0||order>4");}
4180 if(!harmonics){Fatal(sMethodName.Data(),"!harmonics");}
4181
4182 for(Int_t o=0;o<order;o++)
4183 {
4184 fDiffHarmonics[order-1][o] = harmonics[o];
4185 }
4186
4187 fCalculateDiffCorrelations = kTRUE;
4188
4189} // void AliFlowAnalysisWithMultiparticleCorrelations::SetDiffHarmonics(Int_t order, Int_t *harmonics)
4190
4191//=======================================================================================================================
4192
4193void AliFlowAnalysisWithMultiparticleCorrelations::SetWeightsHist(TH1D* const hist, const char *type, const char *variable)
4194{
4195 // Pass histogram holding weights from an external file to the corresponding data member.
4196
4197 TString sMethodName = "void AliFlowAnalysisWithMultiparticleCorrelations::SetWeightsHist(TH1D* const hist, const char *type, const char *variable)";
4198
4199 // Basic protection:
4200 if(!hist){Fatal(sMethodName.Data(),"hist");}
4201 if(!(TString(type).EqualTo("RP") || TString(type).EqualTo("POI"))){Fatal(sMethodName.Data(),"!(TString(type).EqualTo... type = %s ",type);}
4202 if(!(TString(variable).EqualTo("phi") || TString(variable).EqualTo("pt") || TString(variable).EqualTo("eta"))){Fatal(sMethodName.Data(),"!(TString(variable).EqualTo... variable = %s ",variable);}
4203
4204 Int_t rp = 0; // [RP,POI]
4205 if(TString(type).EqualTo("POI")){rp=1;}
4206
4207 Int_t ppe = 0; // [phi,pt,eta]
4208 if(TString(variable).EqualTo("pt")){ppe=1;}
4209 if(TString(variable).EqualTo("eta")){ppe=2;}
4210
4211 // Finally:
4212 hist->SetDirectory(0);
4213 fWeightsHist[rp][ppe] = (TH1D*)hist->Clone();
4214 if(!fWeightsHist[rp][ppe]){Fatal(sMethodName.Data(),"fWeightsHist[%d][%d]",rp,ppe);}
4215
4216 // Cosmetics:
4217 TString sType[2] = {"RP","POI"};
4218 TString sVariable[3] = {"phi","pt","eta"};
4219 fWeightsHist[rp][ppe]->SetName(Form("%s weights (%s)",sVariable[ppe].Data(),sType[rp].Data()));
4220 fWeightsHist[rp][ppe]->SetTitle(Form("%s weights (%s)",sVariable[ppe].Data(),sType[rp].Data()));
4221
4222 // Flag:
4223 fUseWeights[rp][ppe] = kTRUE;
4224
4225} // void AliFlowAnalysisWithMultiparticleCorrelations::SetWeightsHist(TH1D* const hwh, const char *type, const char *variable)
4226
4227//=======================================================================================================================
4228
4229void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForWeights()
4230{
4231 // Initialize all arrays for weights.
4232
4233 for(Int_t rp=0;rp<2;rp++) // [RP,POI]
4234 {
4235 for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
4236 {
4237 fUseWeights[rp][ppe] = kFALSE;
4238 fWeightsHist[rp][ppe] = NULL;
4239 }
4240 }
4241
4242} // void AliFlowAnalysisWithMultiparticleCorrelations::InitializeArraysForWeights()
4243
4244//=======================================================================================================================
4245
4246
4247
4248
37d2f768 4249