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