AliPhysics  06cda10 (06cda10)
AliAnalysisTaskTwoMultiCorrelations.cxx
Go to the documentation of this file.
1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 
16 /*******************************************************************************
17 * Analysis task for anisotropic flow analysis of data taken by ALICE *
18 * with different methods for two- and multiparticle correlations *
19 * *
20 * Author: Cindy Mordasini (cindy.mordasini@cern.ch) *
21 *******************************************************************************/
22 
23 #include "Riostream.h"
24 #include <vector>
26 #include "AliLog.h"
27 #include "AliAODEvent.h"
28 #include "AliAODInputHandler.h"
29 #include "AliAnalysisManager.h"
30 #include "AliMultSelection.h"
31 #include "TFile.h"
32 #include "TComplex.h"
33 #include "TMath.h"
34 
35 using std::cout;
36 using std::endl;
37 
39 
40 //==============================================================================
41 
43  AliAnalysisTaskSE(name),
44  fNparticlesCorrelations(2), // Number of m-particle correlations and harmonics (2-14)
45  fHarmonicOne(2), // Harmonic n_1, default value for v_2{2}
46  fHarmonicTwo(-2), // Harmonic n_2, default value for v_2{4}
47  fHarmonicThree(0), // Harmonic n_3
48  fHarmonicFour(0), // Harmonic n_4
49  fHarmonicFive(0), // Harmonic n_5
50  fHarmonicSix(0), // Harmonic n_6
51  fHarmonicSeven(0), // Harmonic n_7
52  fHarmonicEight(0), // Harmonic n_8
53  fHarmonicNine(0), // Harmonic n_9
54  fHarmonicTen(0), // Harmonic n_10
55  fHarmonicEleven(0), // Harmonic n_11
56  fHarmonicTwelve(0), // Harmonic n_12
57  fHarmonicThirteen(0), // Harmonic n_13
58  fHarmonicFourteen(0), // Harmonic n_14
59  fMinCentrality(0.0), // Minimum of centrality
60  fMaxCentrality(100.0), // Maximum of centrality
61  fUseParticleWeights(kFALSE), // Use non-unit particle weights
62  fDoNestedLoops(kFALSE), // Cross-check the results with nested loops
63  fOutputList(NULL), // Main list holding all the output objects
64  fControlOutputList(NULL), // List holding all the control objects
65  fDraftOutputList(NULL), // List holding all the intermediate objects
66  fFinalOutputList(NULL), // List holding all the final results
67  fCorrelationWithQvectorsProfile(NULL), // m-particle correlation estimated with Q-vectors
68  fCorrelationWithNestedLoopsProfile(NULL), // 2-p correlation estimated with nested loops
69  fCorrelationWithQvectorsSaProfile(NULL), // 2-p correlation estimated with stand-alone Q-vectors
70  fControlPhiHisto(NULL), // Control histogram for the azimuthal angles
71  fCentralityHisto(NULL), // Control histogram for the centrality
72  fAverageMulti(NULL) // Control histogram for the average multiplicity
73 {
74 // Constructor of the class
75 
76  AliDebug(2, "AliAnalysisTaskTwoMultiCorrelations::AliAnalysisTaskTwoMultiCorrelations(const char *name, Bool_t useParticleWeights)");
77 
78  // Creation of a new main list
79  fOutputList = new TList();
80  fOutputList->SetName("outputAnalysis");
81  fOutputList->SetOwner(kTRUE);
82 
83  // Definition of the input and output slots
84  DefineOutput(1, TList::Class());
85 
86  if(useParticleWeights)
87  {
88  // not needed for the time being, maybe insert here the call for the file with particle weights???
89  }
90 
91 } // End of the constructor
92 
93 //******************************************************************************
94 
97  fNparticlesCorrelations(2), // Number of m-particle correlations and harmonics (2-14)
98  fHarmonicOne(2), // Harmonic n_1
99  fHarmonicTwo(-2), // Harmonic n_2
100  fHarmonicThree(0), // Harmonic n_3
101  fHarmonicFour(0), // Harmonic n_4
102  fHarmonicFive(0), // Harmonic n_5
103  fHarmonicSix(0), // Harmonic n_6
104  fHarmonicSeven(0), // Harmonic n_7
105  fHarmonicEight(0), // Harmonic n_8
106  fHarmonicNine(0), // Harmonic n_9
107  fHarmonicTen(0), // Harmonic n_10
108  fHarmonicEleven(0), // Harmonic n_11
109  fHarmonicTwelve(0), // Harmonic n_12
110  fHarmonicThirteen(0), // Harmonic n_13
111  fHarmonicFourteen(0), // Harmonic n_14
112  fMinCentrality(0.0), // Minimum of centrality
113  fMaxCentrality(100.0), // Maximum of centrality
114  fUseParticleWeights(kFALSE), // Use non-unit particle weights
115  fDoNestedLoops(kFALSE), // Cross-check the results with nested loops
116  fOutputList(NULL), // Main list holding all the output objects
117  fControlOutputList(NULL), // List holding all the control objects
118  fDraftOutputList(NULL), // List holding all the intermediate objects
119  fFinalOutputList(NULL), // List holding all the final results
120  fCorrelationWithQvectorsProfile(NULL), // m-particle correlation estimated with Q-vectors
121  fCorrelationWithNestedLoopsProfile(NULL), // 2-p correlation estimated with nested loops
122  fCorrelationWithQvectorsSaProfile(NULL), // 2-p correlation estimated with stand-alone Q-vectors
123  fControlPhiHisto(NULL), // Control histogram for the azimuthal angles
124  fCentralityHisto(NULL), // Control histogram for the centrality
125  fAverageMulti(NULL) // Control histogram for the average multiplicity
126 {
127 // Dummy constructor of the class
128 
129  AliDebug(2, "AliAnalysisTaskTwoMultiCorrelations::AliAnalysisTaskTwoMultiCorrelations(const char *name, Bool_t useParticleWeights)");
130 
131 } // End of the dummy constructor
132 
133 //******************************************************************************
134 
136 {
137 // Destructor of the class
139 
140  if(fOutputList) delete fOutputList;
141 
142 } // End of the destructor
143 
144 //==============================================================================
145 
147 {
148 // Method called at every worker node to initialise the lists
149 // Organisation of the method
150  // 1.) First part of the trick to avoid name clashes
151  // 2.) Booking and nesting of all the lists
152  // 3.) Booking of all the objects
153  // 4.) Second part of the trick to avoid name clashes
154 
155  // 1.) First part of the trick to avoid name clashes
156  Bool_t oldHistAddStatus = TH1::AddDirectoryStatus();
157  TH1::AddDirectory(kFALSE);
158 
159  // 2.) Booking and nesting of all the lists
160  this->BookAndNestAllLists();
161 
162  // 3.) Booking of all the objects
163  this->BookControlList();
164  this->BookDraftList();
165  this->BookFinalList();
166 
167  // 4.) Second part of the trick to avoid name clashes
168  TH1::AddDirectory(oldHistAddStatus);
169 
170  PostData(1,fOutputList);
171 
172 } // End of AliAnalysisTaskTwoMultiCorrelations::UserCreateOutputObjects()
173 
174 //******************************************************************************
175 
177 {
178 // Method called for each event, contains all the calculations
179 // Note to self: find a way to include non-unit particle weights and select them via fUseParticleWeights
180 // Organisation of the method
181  // 1.) Obtention of the pointer to the AOD event
182  // 2.) Check if the multiplicity is higher than the considered number of correlation (to avoid the problem of dividing by zero)
183  // 3.) Gestion of the centrality
184  // 4.) Definition of the variables common to all correlation methods
185  // 5.) Filling of the azimuthal angles and particle weights
186  // 6.) Filling of some control histograms
187  // 7.) Computation of the correlation with different methods for the current event
188  // 8.) Release of the allocated memory
189  // 9.) PostData
190 
191 // 1.) Obtention of the pointer to the AOD event
192  AliAODEvent *currentEvent = dynamic_cast<AliAODEvent*>(InputEvent());
193  if(!currentEvent){return;}
194 
195 // 2.) Check if the multiplicity is higher than the considered number of correlation (to avoid the problem of dividing by zero)
196  Int_t nParticles = currentEvent->GetNumberOfTracks(); // Multiplicity
197  fAverageMulti->Fill(0.5, nParticles);
198  if (nParticles >= fNparticlesCorrelations)
199  {
200 
201 // 3.) Gestion of the centrality
202  AliMultSelection *ams = (AliMultSelection*)currentEvent->FindListObject("MultSelection");
203  if(!ams){return;}
204  if(ams->GetMultiplicityPercentile("V0M") >= fMinCentrality && ams->GetMultiplicityPercentile("V0M") < fMaxCentrality)
205  {
206  fCentralityHisto->Fill(ams->GetMultiplicityPercentile("V0M"));
207  }
208  else
209  {
210  return; // this event does not belong to the centrality class specified for this particular analysis
211  }
212 
213 // 4.) Definition of the variables common to all correlation methods
214 
216  Double_t *phi = new Double_t[nParticles](); // Azimuthal angles
217  Double_t *particleWeights = new Double_t[nParticles](); // Particle weights
218 
219  for (Int_t iParticle = 0; iParticle < nParticles; iParticle++)
220  {
221  // Pointer to a particle
222  AliAODTrack *currentParticle = dynamic_cast<AliAODTrack*>(currentEvent->GetTrack(iParticle));
223 
224 // 5.) Filling of the azimuthal angles and particle weights
225  phi[iParticle] = currentParticle->Phi();
226  particleWeights[iParticle] = 1.;
227  //if (fUseParticleWeights) {TO IMPLEMENT WITH ACCESS TO EXTERNAL FILE}
228  //else {particleWeights[iParticle] = 1.;}
229 
230 // 6.) Filling of some control histograms
231  // Azimuthal angles
232  fControlPhiHisto->Fill(phi[iParticle]);
233 
234  } // End of for (Int_t iParticle = 0; iParticle < nParticles; iParticle++)
235 
236 // 7.) Computation of the correlation with different methods for the current event
237  // Method: Q-vectors with the recursion
238  ComputeCorrelationsWithQvectors(nParticles, phi, particleWeights, harmonics, fNparticlesCorrelations);
239  // Method: Nested loops, used only to cross-check the results of the Q-vectors
240  if ((fDoNestedLoops) && (fNparticlesCorrelations == 2)) {ComputeCorrelationsWithTwoNestedLoops(fHarmonicOne, fHarmonicTwo, nParticles, phi, particleWeights);} // 2-p correlation
241  if ((fDoNestedLoops) && (fNparticlesCorrelations == 4)) {ComputeCorrelationsWithFourNestedLoops(fHarmonicOne, fHarmonicTwo, fHarmonicThree, fHarmonicFour, nParticles, phi, particleWeights);} // 4-p correlation
242  // Method: Q-vectors with stand-alone formula pour 2-p correlation (debug for recursion)
243  if (fNparticlesCorrelations == 2) {ComputeCorrelationsWithStandAloneQvectors(fHarmonicOne, 0, nParticles, phi, particleWeights);}
244 
245 // 8.) Release of the allocated memory
246  delete [] phi;
247  delete [] particleWeights;
248 
249  } // End of if (nParticles => fNparticlesCorrelations)
250 
251 // 9.) PostData
252  PostData(1,fOutputList);
253 
254 } // End of void AliAnalysisTaskTwoMultiCorrelations::UserExec(Option_t *)
255 
256 //******************************************************************************
257 
259 {
260 // Method called at the end of the execution, once the run over the events is over
261 // Organisation of the method
262  // 1.) Access to the merged output list
263  // 2.) Filling the final profiles
264  // 3.) Offline calculations
265  // 4.) Creation of the output file and save of the main list in it
266 
267 // 1.) Access to the merged output list
268  fOutputList = (TList*)GetOutputData(1);
269  if(!fOutputList){exit(1);}
270 
271 // 2.) Filling the final profiles
272 
273 // 3.) Offline calculations
274 
275 // 4.) Creation of the output file and save of the main list in it
276  TFile *outputFile = new TFile("AnalysisResults.root", "RECREATE");
277  fOutputList->Write(fOutputList->GetName(),TObject::kSingleKey);
278  delete outputFile;
279 
280 } // End of void AliAnalysisTaskTwoMultiCorrelations::Terminate(Option_t *)
281 
282 //==============================================================================
283 
285 {
286 // Method to prepare all the lists with the results in the output file
287 // Organisation of the method
288  // 1.) Booking and nesting lists for the control objects
289  // 2.) Booking and nesting lists for the intermediate objects
290  // 3.) Booking and nesting lists for the final results
291 
292  TString sMethodName = "void AliAnalysisTaskTwoMultiCorrelations::BookAndNestAllLists()";
293  if(!fOutputList){Fatal(sMethodName.Data(),"Main list fOutputList is NULL");}
294 
295 // 1.) Booking and nesting lists for the control objects
296  fControlOutputList = new TList();
297  fControlOutputList->SetName("ControlOutputList");
298  fControlOutputList->SetOwner(kTRUE);
299  fOutputList->Add(fControlOutputList);
300 
301 // 2.) Booking and nesting lists for the intermediate objects
302  fDraftOutputList = new TList();
303  fDraftOutputList->SetName("DraftOutputList");
304  fDraftOutputList->SetOwner(kTRUE);
306 
307 // 3.) Booking and nesting lists for the final results
308  fFinalOutputList = new TList();
309  fFinalOutputList->SetName("FinalOutputList");
310  fFinalOutputList->SetOwner(kTRUE);
312 
313 } // End of AliAnalysisTaskTwoMultiCorrelations::BookAndNestAllLists()
314 
315 //==============================================================================
316 
318 {
319 // Method to prepare the list with the control histograms
320 // Organisation of the method
321  // 1.) Control histogram for the azimuthal angles
322 
323 // 1.) Control histogram for the azimuthal angles
324  fControlPhiHisto = new TH1F("fControlPhiHisto", "Azimuthal angles distribution", 1000, 0., 6.3);
325  fControlPhiHisto->SetStats(kTRUE);
326  fControlPhiHisto->GetXaxis()->SetTitle("phi");
328 
329 // 2.) Control histogram for the centrality
330  fCentralityHisto = new TH1F("fCentralityHisto", "Centrality distribution", 9, 0., 100.);
331  fCentralityHisto->SetStats(kTRUE);
332  fCentralityHisto->GetXaxis()->SetTitle("Centrality percentile");
334 
335 // 3.) Control TProfile for the average multiplicity
336  fAverageMulti = new TProfile("fAverageMulti", "Average multiplicity", 1, 0., 1.);
337  fAverageMulti->GetXaxis()->SetTitle("Multiplicity");
339 
340 } // End of void AliAnalysisTaskTwoMultiCorrelations::BookControlList()
341 
342 //******************************************************************************
343 
345 {
346 // Method to prepare the list with the intermediate results from the computation of Q-vectors and nested loops
347 // Organisation of the method
348  // 1.) TProfile from the method of the Q-vectors
349  // 2.) TProfile from the method of the two nested loops
350 
351 // 1.) TProfile from the method of the Q-vectors
352  fCorrelationWithQvectorsProfile = new TProfile("fCorrelationWithQvectorsProfile", "m-particle correlation with Q-vectors", 1, 0., 1.);
354  fCorrelationWithQvectorsProfile->GetXaxis()->SetTitle("m-particle correlation");
356 
357 // 2.) TProfile from the method of nested loops
358  fCorrelationWithNestedLoopsProfile = new TProfile("fCorrelationWithNestedLoopsProfile", "m-particle correlation with nested loops", 1, 0., 1.);
360  fCorrelationWithNestedLoopsProfile->GetXaxis()->SetTitle("m-particle correlation");
362 
363 // *.) TProfile from the method of the Q-vectors, stand alone formula
364  fCorrelationWithQvectorsSaProfile = new TProfile("fCorrelationWithQvectorsSaProfile", "m-particle correlation with Q-vectors, stand alone", 1, 0., 1.);
366  fCorrelationWithQvectorsSaProfile->GetXaxis()->SetTitle("2-particle correlation");
368 
369 } // End of void AliAnalysisTaskTwoMultiCorrelations::BookDraftList()
370 
371 //******************************************************************************
372 
374 {
375 
376 } // End of void AliAnalysisTaskTwoMultiCorrelations::BookFinalList()
377 
378 //==============================================================================
379 
380 TComplex AliAnalysisTaskTwoMultiCorrelations::CalculateQvector(Int_t n, Int_t p, Int_t nParticles, Double_t phi[], Double_t particleWeight[])
381 {
382 // Method calculating the "general" definition of the Q-vector Q_(n,p) for arbitrary (n,p)
383 // Organisation of the method
384  // 1.) Declaration of the local variables: Q_(n,p)
385  // 2.) Computation of the Q-vector
386  // 3.) Application of the property Q_(-n,p) = Q_(n,p)* and return of the result
387 
388 // 1.) Declaration of the local variables: Q_(n,p)
389  TComplex qVectorNp = TComplex(0,0); // Q-vector Q_(n,p) for the current event
390  Double_t pWeightPowerP = 0.; // Particle weight to the power p
391 
392 // 2.) Computation of the Q-vector
393  for (Int_t iParticle = 0; iParticle < nParticles; iParticle++)
394  {
395  pWeightPowerP = pow(particleWeight[iParticle], p);
396  qVectorNp += pWeightPowerP * TComplex::Exp(static_cast<double>(n)*(TComplex::I())*phi[iParticle]);
397  } // End of for (Int_t iParticle = 0; iParticle < nParticles; iParticle++)
398 
399 // 3.) Application of the property Q_(-n,p) = Q_(n,p)* and return of the result
400  //if (n < 0) {return TComplex::Conjugate(qVectorNp);}
401  if (n < 0) {CalculateQvector(-n, p, nParticles, phi, particleWeight);}
402  return qVectorNp;
403 
404 } // End of TComplex AliAnalysisTaskTwoMultiCorrelations::CalculateQvector(Int_t n, Int_t p, Int_t nParticles, Double_t phi[], Double_t particleWeight[])
405 
406 //******************************************************************************
407 
408 TComplex AliAnalysisTaskTwoMultiCorrelations::CalculateRecursionWithQvectors(Int_t nParticles, Double_t phi[], Double_t particleWeight[], Int_t nCorr, Int_t harmonics[], Int_t p, Int_t skip)
409 {
410 // Method calculating the recursion with the Q-vectors for the numerator of the m-particle correlation according to the generic framework
411 // Inspired by the method originally developped by Kristjan Gulbrandsen (gulbrand@nbi.dk)
413 // Organisation of the method
414  // 1.) Declaration of the local variables
415  // 2.) Stop conditions of the recursion
416  // 3.) Computation of the recursion
417  // 4.) Return of the result after the recursion
418 
419 // 1.) Declaration of the local variables
420  Int_t nMinusOne = 0; // Harmonic (nCorr-1)
421  TComplex stopQvector = TComplex(0,0);// Q-vector used to stop the recursion
422  Int_t pPlusOne = 0; // (p + 1)
423  Int_t nMinusTwo = 0; // Harmonic (n-2)
424  Int_t counterOne = 0; // First counter for the intermediate indices
425  Int_t hHold = 0; // Temporary harmonic
426  TComplex tempQvector = TComplex(0,0);// Temporary Q-vector
427  Int_t counterTwo = 0; // Second counter for the intermediate indices
428 
429 // 2.) Stop conditions of the recursion
430  nMinusOne = nCorr-1;
431  stopQvector = CalculateQvector(harmonics[nMinusOne], p, nParticles, phi, particleWeight);
432 
433  if (nMinusOne == 0) {return stopQvector;}
434  stopQvector *= CalculateRecursionWithQvectors(nParticles, phi, particleWeight, nMinusOne, harmonics);
435  if (nMinusOne == skip) {return stopQvector;}
436 
437 // 3.) Computation of the recursion
438  pPlusOne = p+1;
439  nMinusTwo = nCorr-2;
440  hHold = harmonics[counterOne];
441  harmonics[counterOne] = harmonics[nMinusTwo];
442  harmonics[nMinusTwo] = hHold + harmonics[nMinusOne];
443  tempQvector = CalculateRecursionWithQvectors(nParticles, phi, particleWeight, nMinusOne, harmonics, pPlusOne, nMinusTwo);
444  counterTwo = nCorr-3;
445 
446  while (counterTwo >= skip)
447  {
448  harmonics[nMinusTwo] = harmonics[counterOne];
449  harmonics[counterOne] = hHold;
450  ++counterOne;
451 
452  hHold = harmonics[counterOne];
453  harmonics[counterOne] = harmonics[nMinusTwo];
454  harmonics[nMinusTwo] = hHold + harmonics[nMinusOne];
455  tempQvector += CalculateRecursionWithQvectors(nParticles, phi, particleWeight, nMinusOne, harmonics, pPlusOne, counterTwo);
456  --counterTwo;
457 
458  } // End of the while (counterTwo >= skip)
459 
460  harmonics[nMinusTwo] = harmonics[counterOne];
461  harmonics[counterOne] = hHold;
462 
463 // 4.) Return of the result after the recursion
464  if (p == 1) {return stopQvector - tempQvector;}
465  return stopQvector - (Double_t(p)*tempQvector);
466 
467 } // End of void AliAnalysisTaskTwoMultiCorrelations::CalculateRecursionWithQvectors(Int_t nParticles, Double_t *phi[], Double_t *particleWeight[], Int_t n, Double_t *harmonics[], Int_t p = 1, Int_t skip = 0)
468 
469 //******************************************************************************
470 
471 void AliAnalysisTaskTwoMultiCorrelations::ComputeCorrelationsWithQvectors(Int_t nParticles, Double_t phi[], Double_t particleWeight[], Int_t harmonics[], Int_t nCorr)
472 {
473 // Method to compute the m-particle correlation using the numerator for the generic framework computed with the recursion method
474 // Organisation of the method
475  // 1.) Declaration of the local variables
476  // 2.) Filling of the array for the numerator
477  // 3.) Computation of the m-particle correlation
478 
479 // 1.) Declaration of the local variables
480  std::vector<Int_t> numeratorHarmonics(nCorr); // Harmonics with values from harmonics array
481  std::vector<Int_t> denominatorHarmonics(nCorr); // Harmonics with value 0 for the denominator
482  memset(numeratorHarmonics.data(), 0, sizeof(Int_t) * numeratorHarmonics.size());
483  memset(denominatorHarmonics.data(), 0, sizeof(Int_t) * denominatorHarmonics.size());
484  //Int_t denominatorHarmonics[14] = {0};
485  Double_t denominator = 0.; // Denominator of <m>_(n1...nm) and event weight for the TProfile
486  TComplex mParticleCorrelation = TComplex(0,0); // m-particle correlation
487  TComplex eventWeight = TComplex(0,0);// Event weight
488 
489 // 2.) Filling of the array for the numerator
490  for (Int_t iCorr = 0; iCorr < nCorr; iCorr++)
491  {
492  numeratorHarmonics[iCorr] = harmonics[iCorr];
493  } // End of for (Int_t iCorr = 0; iCorr < nCorr; iCorr++)
494 
495 // 3.) Computation of the m-particle correlation
496  denominator = (CalculateRecursionWithQvectors(nParticles, phi, particleWeight, nCorr, denominatorHarmonics.data())).Re();
497  mParticleCorrelation = CalculateRecursionWithQvectors(nParticles, phi, particleWeight, nCorr, numeratorHarmonics.data())/denominator;
498  //eventWeight = (CalculateRecursionWithQvectors(nParticles, phi, particleWeight, nCorr, denominatorHarmonics)).Re();
499 
500 // 4.) Filling of the TProfile
501  fCorrelationWithQvectorsProfile->Fill(0.5, mParticleCorrelation.Re(), denominator);
502 
503 } // End of void AliAnalysisTaskTwoMultiCorrelations::ComputeCorrelationsWithQvectors(Int_t n, Int_t nParticles, Double_t *phi[], Double_t *particleWeight[], Int_t *harmonics[], Int_t nCorr)
504 
505 //******************************************************************************
506 
508 {
509 // Method to compute the 2-particle correlation with two nested loops (for cross-checking results)
510 // Organisation of the method
511  // 1.) Declaration of the local variables
512  // 2.) Computation of the 2-p correlation, <2>
513  // 3.) Reset of the local variables before changing the event
514 
515 // 1.) Declaration of the local variables
516  Double_t twoParticleCorrelation = 0.; // Single-event 2-p correlation, <2>_(n1...nm)
517  Double_t totalParticleWeight = 0.; // Particle weight for the 2-p correlation
518 
519 // 2.) Computation of the 2-p correlation, <2>
520  for (Int_t k = 0; k < nParticles; k++)
521  {
522  for (Int_t l = 0; l < nParticles; l++)
523  {
524  // Removal of the autocorrelations k == l
525  if (k == l) continue;
526 
527  // Computation of <2> for a pair of particles
528  twoParticleCorrelation = cos(nOne*phi[k] + nTwo*phi[l]);
529  totalParticleWeight = particleWeight[k] * particleWeight[l];
530 
531  // Filling of the TProfile
532  fCorrelationWithNestedLoopsProfile->Fill(0.5, twoParticleCorrelation, totalParticleWeight);
533 
534  } // End of the loop over the second particle of the pair
535  } // End of the loop over the first particle of the pair
536 
537 // 3.) Reset of the local variables before changing the event
538  twoParticleCorrelation = 0.;
539  totalParticleWeight = 0.;
540 
541 } // End of void AliAnalysisTaskTwoMultiCorrelations::ComputeCorrelationsWithTwoNestedLoops(Int_t nOne, Int nTwo, Int_t nParticles, Double_t phi[], Double_t particleWeight[])
542 
543 //******************************************************************************
544 
546 {
547 // Method to compute the 4-particle correlation with four nested loops (for cross-checking results)
548 // Organisation of the method
549  // 1.) Declaration of the local variables
550  // 2.) Computation of the 4-p correlation, <4>
551  // 3.) Reset of the local variables before changing the event
552 
553 // 1.) Declaration of the local variables
554  Double_t fourParticleCorrelation = 0.; // Single-event 4-p correlation, <4>_(n1,... nm)
555  Double_t totalParticleWeight = 0.;
556 
557 // 2.) Computation of the 4-p correlation, <4>
558  for (Int_t k = 0; k < nParticles; k++)
559  {
560  for (Int_t l = 0; l < nParticles; l++)
561  {
562  // Removal of the autocorrelations k == l
563  if (k == l) continue;
564 
565  for (Int_t m = 0; m < nParticles; m++)
566  {
567  // Removal of the autocorrelations k == m, l == m
568  if ((k == m) || (l == m)) continue;
569 
570  for (Int_t n = 0; n < nParticles; n++)
571  {
572  // Removal of the autocorrelations k == n, l == n, m == n
573  if ((k == n) || (l == n) || (m == n)) continue;
574 
575  // Computation of <4> for a quadruplet of particles
576  fourParticleCorrelation = cos(nOne*phi[k] + nTwo*phi[l] + nThree*phi[m] + nFour*phi[n]);
577  totalParticleWeight = particleWeight[k]*particleWeight[l]*particleWeight[m]*particleWeight[n];
578 
579  // Filling of the TProfile
580  fCorrelationWithNestedLoopsProfile->Fill(0.5, fourParticleCorrelation, totalParticleWeight);
581 
582  } // End of the loop over the fourth particle of the quadruplet
583  } // End of the loop over the third particle of the quadruplet
584  } // End of the loop over the second particle of the quadruplet
585  } // End of the loop over the first particle of the quadruplet
586 
587 // 3.) Reset of the local variables before changing the event
588  fourParticleCorrelation = 0.;
589  totalParticleWeight = 0.;
590 
591 } // End of void AliAnalysisTaskTwoMultiCorrelations::ComputeCorrelationsWithFourNestedLoops(Int_t nOne, Int_t nTwo, Int_t nThree, Int_t nFour, Int_t nParticles, Double_t phi[], Double_t particleWeight[])
592 
593 //******************************************************************************
594 
596 {
597 // Method to compute the 2-p correlation with Q-vectors, stand alone formula (second cross-check for the recursion method
598 // Organisation of the method
599  // 1.) Declaration of the local variables
600  // 2.) Computation of the 2-p correlation
601  // 3.) Filling of the TProfile
602  // 4.) Security: reset to 0 of the variables
603 
604 // 1.) Declaration of the local variables
605  Double_t twoParticleCorrelation = 0.;
606  Int_t twoParticleWeight = 0;
607 
608 // 2.) Computation of the 2-p correlation
609  twoParticleCorrelation = (1./(2.*TMath::Binomial(nParticles, 2))) * (CalculateQvector(n, p, nParticles, phi, particleWeight).Rho2() - nParticles);
610  twoParticleWeight = nParticles * (nParticles - 1);
611 
612 // 3.) Filling of the TProfile
613  fCorrelationWithQvectorsSaProfile->Fill(0.5, twoParticleCorrelation, twoParticleWeight);
614 
615 // 4.) Security: reset to 0 of the variables
616  twoParticleCorrelation = 0.;
617  twoParticleWeight = 0;
618 
619 } // End of void AliAnalysisTaskTwoMultiCorrelations::ComputeCorrelationsWithStandAloneQvectors()
double Double_t
Definition: External.C:58
virtual void ComputeCorrelationsWithStandAloneQvectors(Int_t n, Int_t p, Int_t nParticles, Double_t phi[], Double_t particleWeight[])
virtual void ComputeCorrelationsWithQvectors(Int_t nParticles, Double_t phi[], Double_t particleWeight[], Int_t harmonics[], Int_t nCorr)
virtual void ComputeCorrelationsWithTwoNestedLoops(Int_t nOne, Int_t nTwo, Int_t nParticles, Double_t phi[], Double_t particleWeight[])
int Int_t
Definition: External.C:63
virtual void ComputeCorrelationsWithFourNestedLoops(Int_t nOne, Int_t nTwo, Int_t nThree, Int_t nFour, Int_t nParticles, Double_t phi[], Double_t particleWeight[])
TComplex CalculateQvector(Int_t n, Int_t p, Int_t nParticles, Double_t phi[], Double_t particleWeight[])
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
TComplex CalculateRecursionWithQvectors(Int_t nParticles, Double_t phi[], Double_t particleWeight[], Int_t nCorr, Int_t harmonics[], Int_t p=1, Int_t skip=0)