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