]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowCommon/AliFlowAnalysisWithMixedHarmonics.cxx
Added method to calculate flow using mixed harmonics e.g. calculate v1 with v2 or...
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommon / AliFlowAnalysisWithMixedHarmonics.cxx
1 /*************************************************************************\r
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *\r
3 *                                                                        *\r
4 * Author: The ALICE Off-line Project.                                    *\r
5 * Contributors are mentioned in the code where appropriate.              *\r
6 *                                                                        *\r
7 * Permission to use, copy, modify and distribute this software and its   *\r
8 * documentation strictly for non-commercial purposes is hereby granted   *\r
9 * without fee, provided that the above copyright notice appears in all   *\r
10 * copies and that both the copyright notice and this permission notice   *\r
11 * appear in the supporting documentation. The authors make no claims     *\r
12 * about the suitability of this software for any purpose. It is          *\r
13 * provided "as is" without express or implied warranty.                  * \r
14 **************************************************************************/
15
16 /* $Id$ */\r
17 \r
18 /********************************************************** 
19  * In this class azimuthal correlators in mixed harmonics *
20  * are implemented in terms of Q-vectors. This approach   *
21  * doesn't require evaluation of nested loops. This class *
22  * can be used to:                                        *
23  *                                                        *  
24  *  a) Extract subdominant harmonics (like v1 and v4);    *
25  *  b) Study strong parity violation.                     * 
26  *                                                        * 
27  * Author: Ante Bilandzic (abilandzic@gmail.com)          *
28  *********************************************************/ \r
29 \r
30 #define AliFlowAnalysisWithMixedHarmonics_cxx\r
31 \r
32 #include "Riostream.h"\r
33 #include "AliFlowCommonConstants.h"\r
34 #include "AliFlowCommonHist.h"\r
35 #include "AliFlowCommonHistResults.h"\r
36 \r
37 #include "TMath.h"\r
38 #include "TFile.h"\r
39 #include "TList.h"\r
40 #include "TProfile.h"
41 #include "TProfile2D.h"\r
42 \r
43 #include "AliFlowEventSimple.h"\r
44 #include "AliFlowTrackSimple.h"\r
45 #include "AliFlowAnalysisWithMixedHarmonics.h"\r
46 \r
47 class TH1;\r
48 class TList;\r\r
49 ClassImp(AliFlowAnalysisWithMixedHarmonics)\r
50 \r
51 //================================================================================================================
52
53 AliFlowAnalysisWithMixedHarmonics::AliFlowAnalysisWithMixedHarmonics(): \r
54 fHistList(NULL),
55 fHistListName(NULL),\r
56 fAnalysisLabel(NULL),
57 fAnalysisSettings(NULL),
58 fCorrelatorInteger(2),
59 fNoOfMultipicityBins(10),
60 fMultipicityBinWidth(2),
61 fMinMultiplicity(1),
62 fCorrectForDetectorEffects(kTRUE),\r
63 fCommonHists(NULL),
64 fnBinsPhi(0),\r
65 fPhiMin(0),\r
66 fPhiMax(0),\r
67 fPhiBinWidth(0),\r
68 fnBinsPt(0),\r
69 fPtMin(0),\r
70 fPtMax(0),\r
71 fPtBinWidth(0),\r
72 fnBinsEta(0),\r
73 fEtaMin(0),\r
74 fEtaMax(0),\r
75 fEtaBinWidth(0),
76 fWeightsList(NULL),\r
77 fUsePhiWeights(kFALSE),\r
78 fUsePtWeights(kFALSE),\r
79 fUseEtaWeights(kFALSE),\r
80 fUseParticleWeights(NULL),\r
81 fPhiWeights(NULL),\r
82 fPtWeights(NULL),\r
83 fEtaWeights(NULL),
84 fReQnk(NULL),\r
85 fImQnk(NULL),\r
86 fSpk(NULL),
87 f3pCorrelatorEBE(NULL),
88 fNonIsotropicTermsEBE(NULL),
89 f3pCorrelatorPro(NULL),
90 fNonIsotropicTermsPro(NULL),
91 f3pCorrelatorVsMPro(NULL),
92 fNonIsotropicTermsVsMPro(NULL),
93 fResultsList(NULL),
94 f3pCorrelatorHist(NULL),
95 fDetectorBiasHist(NULL),
96 fNonIsotropicTermsHist(NULL),
97 f3pCorrelatorVsMHist(NULL),
98 fDetectorBiasVsMHist(NULL),
99 fNonIsotropicTermsVsMHist(NULL)\r
100 {\r
101  // Constructor. \r
102  \r // Base list to hold all output objects:\r
103  fHistList = new TList();
104  fHistListName = new TString("cobjMH");\r
105  fHistList->SetName(fHistListName->Data());\r
106  fHistList->SetOwner(kTRUE);
107  
108  // List to hold histograms with phi, pt and eta weights:      \r
109  fWeightsList = new TList();
110  
111  // List to hold objects with final results:      \r
112  fResultsList = new TList();
113  \r
114 } // AliFlowAnalysisWithMixedHarmonics::AliFlowAnalysisWithMixedHarmonics()\r
115  \r
116 //================================================================================================================  \r
117 \r
118 AliFlowAnalysisWithMixedHarmonics::~AliFlowAnalysisWithMixedHarmonics()\r
119 {\r
120  // Destructor.\r
121  \r
122  delete fHistList;\r
123 \r
124 } // end of AliFlowAnalysisWithMixedHarmonics::~AliFlowAnalysisWithMixedHarmonics()\r
125 \r
126 //================================================================================================================\r
127 \r
128 void AliFlowAnalysisWithMixedHarmonics::Init()\r
129 {
130  // Initialize and book all objects. 
131  
132  // a) Cross check if the user settings make sense before starting; 
133  // b) Access all common constants;
134  // c) Book and nest all lists in the base list fHistList;\r
135  // d) Book common control histograms;
136  // e) Book all event-by-event quantities;
137  // f) Book all all-event quantities;
138  // g) Book and fill histograms to hold phi, pt and eta weights.
139  
140  this->CrossCheckSettings();\r
141  this->AccessConstants();
142  this->BookAndNestAllLists();
143  this->BookProfileHoldingSettings();\r
144  this->BookCommonHistograms();
145  this->BookAllEventByEventQuantities();
146  this->BookAllAllEventQuantities();
147  this->BookAndFillWeightsHistograms();\r
148 \r
149 } // end of void AliFlowAnalysisWithMixedHarmonics::Init()\r
150 \r
151 //================================================================================================================\r
152 \r
153 void AliFlowAnalysisWithMixedHarmonics::Make(AliFlowEventSimple* anEvent)\r
154 {\r
155  // Running over data only in this method.\r
156  
157  // a) Define local variables;
158  // b) Fill common control histograms;
159  // c) Loop over data and calculate e-b-e quantities Q_{n,k} and S_{p,k};
160  // d) Calculate 3-p azimuthal correlator and non-isotropic terms in terms of Q_{n,k} and S_{p,k};
161  // e) Reset all event-by-event quantities.\r
162  
163  this->CheckPointersUsedInMake();
164  
165  // a) Define local variables:
166  Double_t dPhi = 0.; // azimuthal angle in the laboratory frame\r
167  Double_t dPt  = 0.; // transverse momentum\r
168  Double_t dEta = 0.; // pseudorapidity\r
169  Double_t wPhi = 1.; // phi weight\r
170  Double_t wPt  = 1.; // pt weight\r
171  Double_t wEta = 1.; // eta weight
172  AliFlowTrackSimple *aftsTrack = NULL; // simple track
173  
174  // b) Fill common control histograms.
175  fCommonHists->FillControlHistograms(anEvent);  
176  
177  // c) Loop over data and calculate e-b-e quantities:\r
178  Int_t nPrim = anEvent->NumberOfTracks();  // nPrim = total number of primary tracks, i.e. nPrim = nRP + nPOI + rest, where:\r
179                                            // nRP   = # of particles used to determine the reaction plane ("Reference Particles");\r
180                                            // nPOI  = # of particles of interest for a detailed flow analysis ("Particles of Interest");\r
181                                            // rest  = # of particles which are not niether RPs nor POIs.  \r
182  // Start loop over data:
183  for(Int_t i=0;i<nPrim;i++) \r
184  { \r
185   aftsTrack=anEvent->GetTrack(i);\r
186   if(aftsTrack)\r
187   {\r
188    if(!(aftsTrack->InRPSelection() || aftsTrack->InPOISelection())) continue; // consider only tracks which are either RPs or POIs\r
189    Int_t n = fCorrelatorInteger; // integer n in the correlator cos[n(2phi1-phi2-phi3)]\r
190    if(aftsTrack->InRPSelection()) // checking RP condition:\r
191    {    \r
192     dPhi = aftsTrack->Phi();\r
193     dPt  = aftsTrack->Pt();\r
194     dEta = aftsTrack->Eta();\r
195     if(fUsePhiWeights && fPhiWeights && fnBinsPhi) // determine phi-weight for this particle:\r
196     {\r
197      wPhi = fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*fnBinsPhi/TMath::TwoPi())));\r
198     }\r
199     if(fUsePtWeights && fPtWeights && fnBinsPt) // determine pt-weight for this particle:\r
200     {\r
201      wPt = fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-fPtMin)/fPtBinWidth))); \r
202     }              \r
203     if(fUseEtaWeights && fEtaWeights && fEtaBinWidth) // determine eta-weight for this particle: \r
204     {\r
205      wEta = fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-fEtaMin)/fEtaBinWidth))); \r
206     } \r
207     // Calculate Re[Q_{m*n,k}] and Im[Q_{m*n,k}], (m = 1,2 and k = 0,1,2,3) for this event:\r
208     for(Int_t m=0;m<2;m++)\r
209     {\r
210      for(Int_t k=0;k<4;k++) // to be improved (what is maximum k that I need?)\r
211      {\r
212       (*fReQnk)(m,k)+=pow(wPhi*wPt*wEta,k)*TMath::Cos((m+1)*n*dPhi); \r
213       (*fImQnk)(m,k)+=pow(wPhi*wPt*wEta,k)*TMath::Sin((m+1)*n*dPhi); \r
214      } \r
215     }\r
216     // Calculate partially S_{p,k} for this event (final calculation of S_{p,k} follows after the loop over data bellow):\r
217     for(Int_t p=0;p<4;p++) // to be improved (what is maximum p that I need?)\r
218     {\r
219      for(Int_t k=0;k<4;k++) // to be improved (what is maximum k that I need?)\r
220      {     \r
221       (*fSpk)(p,k)+=pow(wPhi*wPt*wEta,k);\r
222      }\r
223     }    \r
224    } // end of if(aftsTrack->InRPSelection())  \r
225   } else // to if(aftsTrack)\r
226     {\r
227      cout<<endl;\r
228      cout<<" WARNING (MH): No particle! (i.e. aftsTrack is a NULL pointer in AFAWMH::Make().)"<<endl;\r
229      cout<<endl;       \r
230     }\r
231  } // end of for(Int_t i=0;i<nPrim;i++) \r
232 \r
233  // Calculate the final expressions for S_{p,k}:\r
234  for(Int_t p=0;p<4;p++) // to be improved (what is maximum p that I need?)\r
235  {\r
236   for(Int_t k=0;k<4;k++) // to be improved (what is maximum  that I need?)\r
237   {\r
238    (*fSpk)(p,k)=pow((*fSpk)(p,k),p+1);\r
239   }  \r
240  } 
241  
242  // d) Calculate 3-p azimuthal correlator in terms of Q_{n,k} and S_{p,k}:
243  if(anEvent->GetEventNSelTracksRP() >= 3) 
244  {
245   this->Calculate3pCorrelator();
246  }             
247  if(anEvent->GetEventNSelTracksRP() >= 0) // to be improved (is this correct if statement?)  
248  {
249   this->CalculateNonIsotropicTerms();                          
250  }
251                  
252  // e) Reset all event-by-event quantities: \r
253  this->ResetEventByEventQuantities();
254   \r
255 } // end of AliFlowAnalysisWithMixedHarmonics::Make(AliFlowEventSimple* anEvent)\r\r
256 //================================================================================================================\r
257 \r
258 void AliFlowAnalysisWithMixedHarmonics::Finish()\r
259 {\r
260  // Calculate the final results.
261  
262  // a) Check all pointers used in this method;
263  // b) Access settings for analysis with mixed harmonics;
264  // c) Calculate errors for non-isotropic terms;
265  // d) Correct for detector effects;
266  // e) Quantify bias to 3-p correlator coming from detector effects.
267  
268  this->CheckPointersUsedInFinish();
269  this->AccessSettings();
270  this->FinalizeNonIsotropicTerms();
271  this->CorrectForDetectorEffects();
272  this->QuantifyBiasFromDetectorEffects();
273  \r
274  cout<<endl;\r
275  cout<<"*************************************"<<endl;\r
276  cout<<"*************************************"<<endl;\r
277  cout<<" flow estimates from mixed harmonics "<<endl; 
278  cout<<endl;\r
279  if(fCorrelatorInteger!=1)
280  {
281   cout<< "  cos["<<fCorrelatorInteger<<"(2phi1-phi2-phi3)] = "<<f3pCorrelatorPro->GetBinContent(1)<<endl;
282  } else
283    {
284     cout<< "  cos(2phi1-phi2-phi3) = "<<f3pCorrelatorPro->GetBinContent(1)<<endl;
285    } 
286  
287  cout<<endl;
288  cout<<"*************************************"<<endl;\r
289  cout<<"*************************************"<<endl;\r
290                                                                                                                                                                                                                                                                                                                \r
291 } // end of AliFlowAnalysisWithMixedHarmonics::Finish()\r
292 \r
293 //================================================================================================================\r
294 \r
295 void AliFlowAnalysisWithMixedHarmonics::GetOutputHistograms(TList *outputListHistos)\r
296 {\r
297  // Get pointers to all objects saved in the output file.
298  
299  // a) Get pointers for common control histograms.\r \r
300  if(outputListHistos)\r
301  {      \r
302   this->SetHistList(outputListHistos);
303   if(!fHistList)
304   {
305    cout<<endl;
306    cout<<" WARNING (MH): fHistList is NULL in AFAWMH::GOH() !!!!"<<endl;
307    cout<<endl;
308    exit(0);
309   }
310   this->GetPointersForCommonHistograms();
311   this->GetPointersForResultsHistograms();\r
312  } else 
313    {
314     cout<<endl;
315     cout<<" WARNING (MH): outputListHistos is NULL in AFAWMH::GOH() !!!!"<<endl;
316     cout<<endl;
317     exit(0);
318    }
319    \r
320 } // end of void AliFlowAnalysisWithMixedHarmonics::GetOutputHistograms(TList *outputListHistos)\r
321 \r
322 //================================================================================================================
323
324 void AliFlowAnalysisWithMixedHarmonics::GetPointersForCommonHistograms() \r
325 {\r
326  // Get pointers to common control histograms.\r
327  \r
328  TString commonHistsName = "AliFlowCommonHistMH";\r
329  AliFlowCommonHist *commonHist = dynamic_cast<AliFlowCommonHist*>(fHistList->FindObject(commonHistsName.Data()));\r
330  if(commonHist) 
331  {
332   this->SetCommonHists(commonHist); 
333  } else
334    {
335     cout<<endl;
336     cout<<" WARNING (MH): commonHist is NULL in AFAWMH::GPFCH() !!!!"<<endl;
337     cout<<endl;
338     exit(0);  
339    }
340  
341 } // end of void AliFlowAnalysisWithMixedHarmonics::GetPointersForCommonHistograms()
342
343 //================================================================================================================
344
345 void AliFlowAnalysisWithMixedHarmonics::GetPointersForResultsHistograms() \r
346 {\r
347  // Get pointers to histograms holding final results.\r
348  \r
349  TList *resultsList = NULL;\r
350  resultsList = dynamic_cast<TList*>(fHistList->FindObject("Results"));\r
351  if(!resultsList) \r
352  {\r
353   cout<<"WARNING: resultsList is NULL in AFAWMH::GPFRH() !!!!"<<endl;\r
354   exit(0); \r
355  }  
356  
357  TString s3pCorrelatorHistName = "f3pCorrelatorHist";\r
358  TH1D *h3pCorrelatorHist = dynamic_cast<TH1D*>(resultsList->FindObject(s3pCorrelatorHistName.Data()));\r
359  if(h3pCorrelatorHist)\r
360  {\r
361   this->Set3pCorrelatorHist(h3pCorrelatorHist);  \r
362  }
363  TString detectorBiasHistName = "fDetectorBiasHist";\r
364  TH1D *detectorBiasHist = dynamic_cast<TH1D*>(resultsList->FindObject(detectorBiasHistName.Data()));\r
365  if(detectorBiasHist)\r
366  {\r
367   this->SetDetectorBiasHist(detectorBiasHist);  \r
368  }
369  TString nonIsotropicTermsHistName = "fNonIsotropicTermsHist";\r
370  TH1D *nonIsotropicTermsHist = dynamic_cast<TH1D*>(resultsList->FindObject(nonIsotropicTermsHistName.Data()));\r
371  if(nonIsotropicTermsHist)\r
372  {\r
373   this->SetNonIsotropicTermsHist(nonIsotropicTermsHist);  \r
374  }
375   
376 } // end of void AliFlowAnalysisWithMixedHarmonics::GetPointersForResultsHistograms()
377 \r
378 //================================================================================================================
379
380 void AliFlowAnalysisWithMixedHarmonics::WriteHistograms(TString outputFileName)\r
381 {\r
382  // Store the final results in output .root file.\r
383  TFile *output = new TFile(outputFileName.Data(),"RECREATE");\r
384  fHistList->Write(fHistList->GetName(),TObject::kSingleKey);\r
385  delete output;\r
386 }\r
387 \r
388 //================================================================================================================\r
389
390 void AliFlowAnalysisWithMixedHarmonics::WriteHistograms(TDirectoryFile *outputFileName)
391 {
392  // Store the final results in output .root file.
393  fHistList->SetName("cobjMH");
394  fHistList->SetOwner(kTRUE);
395  outputFileName->Add(fHistList);
396  outputFileName->Write(outputFileName->GetName(),TObject::kSingleKey);
397 }
398
399 //================================================================================================================
400
401 void AliFlowAnalysisWithMixedHarmonics::BookAndNestAllLists()\r
402 {
403  // Book and nest all list in base list fHistList.
404
405  // Weights:
406  fWeightsList->SetName("Weights");\r
407  fWeightsList->SetOwner(kTRUE);   \r
408  fHistList->Add(fWeightsList); 
409  // Results:
410  fResultsList->SetName("Results");\r
411  fResultsList->SetOwner(kTRUE);   \r
412  fHistList->Add(fResultsList); 
413
414 } // end of void AliFlowAnalysisWithMixedHarmonics::BookAndNestAllLists()
415
416 //================================================================================================================
417
418 void AliFlowAnalysisWithMixedHarmonics::BookProfileHoldingSettings()\r
419 {
420  // Book profile to hold all analysis settings.
421
422  TString analysisSettingsName = "fAnalysisSettings";\r
423  fAnalysisSettings = new TProfile(analysisSettingsName.Data(),"Settings for analysis with mixed harmonics",5,0,5);
424  fAnalysisSettings->GetXaxis()->SetBinLabel(1,"Integer n in cos(n(2#phi_{1}-#phi_{2}-#phi_{3}))");
425  fAnalysisSettings->Fill(0.5,fCorrelatorInteger);\r
426  fAnalysisSettings->GetXaxis()->SetBinLabel(2,"Corrected for detector effects?");
427  fAnalysisSettings->Fill(1.5,(Int_t)fCorrectForDetectorEffects); 
428  fAnalysisSettings->GetXaxis()->SetBinLabel(3,"# of multiplicity bins");
429  fAnalysisSettings->Fill(2.5,fNoOfMultipicityBins); 
430  fAnalysisSettings->GetXaxis()->SetBinLabel(4,"Width of multiplicity bins");
431  fAnalysisSettings->Fill(3.5,fMultipicityBinWidth);  
432  fAnalysisSettings->GetXaxis()->SetBinLabel(5,"Minimal multiplicity");
433  fAnalysisSettings->Fill(4.5,fMinMultiplicity);
434  fHistList->Add(fAnalysisSettings);
435  
436 } // end of void AliFlowAnalysisWithMixedHarmonics::BookProfileHoldingSettings()
437 \r
438 //================================================================================================================
439
440 void AliFlowAnalysisWithMixedHarmonics::BookCommonHistograms()\r
441 {\r
442  // Book common control histograms and common histograms for final results.
443  \r
444  TString commonHistsName = "AliFlowCommonHistMH";\r
445  fCommonHists = new AliFlowCommonHist(commonHistsName.Data());\r
446  fHistList->Add(fCommonHists);  \r
447  \r
448 } // end of void AliFlowAnalysisWithMixedHarmonics::BookCommonHistograms()\r
449
450 //================================================================================================================
451
452 void AliFlowAnalysisWithMixedHarmonics::BookAllEventByEventQuantities()\r
453 {\r
454  // Book all event-by-event quantitites.
455  
456  // Q_{n,k} and S{p,k}:
457  fReQnk = new TMatrixD(2,4); // to be improved(bound on k)\r
458  fImQnk = new TMatrixD(2,4); // to be improved(bound on k)\r
459  fSpk = new TMatrixD(4,4); // to be improved(bound on p and k)
460  // 3-p correlator <cos[n(2phi1-phi2-phi3)]> for single event:
461  TString s3pCorrelatorEBEName = "f3pCorrelatorEBE";\r
462  f3pCorrelatorEBE = new TH1D(s3pCorrelatorEBEName.Data(),"<cos[n(2#phi_{1}-#phi_{2}-#phi_{3})]> for single event",1,0,1);
463  // Correction terms for non-uniform acceptance to <cos[n(2phi1-phi2-phi3)]> for single event:
464  TString nonIsotropicTermsEBEName = "fNonIsotropicTermsEBE";\r
465  fNonIsotropicTermsEBE = new TH1D(nonIsotropicTermsEBEName.Data(),"Non-isotropic terms for single event",10,0,10);
466
467 } // end fo void AliFlowAnalysisWithMixedHarmonics::BookAllEventByEventQuantities()\r
468 //================================================================================================================
469
470 void AliFlowAnalysisWithMixedHarmonics::BookAllAllEventQuantities()
471 {
472  // Book all all-event quantitites.
473  
474  // a) Book quantites without multiplicity binning;
475  // b) Book quantites with multiplicity binning.
476  
477  // a) Book quantites without multiplicity binning:
478  // 3-p correlator <<cos[n(2phi1-phi2-phi3)]>> for all events (with wrong error):
479  TString s3pCorrelatorProName = "f3pCorrelatorPro";\r
480  f3pCorrelatorPro = new TProfile(s3pCorrelatorProName.Data(),"<<cos[n(2#phi_{1}-#phi_{2}-#phi_{3})]>> for all events (errors are wrong here!)",1,0,1,"s");
481  fHistList->Add(f3pCorrelatorPro);
482  // 3-p correlator <<cos[n(2phi1-phi2-phi3)]>> for all events (with correct error):
483  TString s3pCorrelatorHistName = "f3pCorrelatorHist";\r
484  f3pCorrelatorHist = new TH1D(s3pCorrelatorHistName.Data(),"<<cos[n(2#phi_{1}-#phi_{2}-#phi_{3})]>> for all events",1,0,1);
485  fResultsList->Add(f3pCorrelatorHist);
486  // Correction terms for non-uniform acceptance to <cos[n(2phi1-phi2-phi3)]> for all events (with wrong errors):
487  TString nonIsotropicTermsProName = "fNonIsotropicTermsPro";\r
488  fNonIsotropicTermsPro = new TProfile(nonIsotropicTermsProName.Data(),"Non-isotropic terms for all events (errors are wrong here!)",10,0,10,"s");
489  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(1,"cos(n(#phi_{1}))");\r
490  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(2,"sin(n(#phi_{1}))");
491  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(3,"cos(2n(#phi_{1}))");\r
492  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(4,"sin(2n(#phi_{1}))");\r
493  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(5,"cos(n(#phi_{1}+#phi_{2}))");\r
494  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(6,"sin(n(#phi_{1}+#phi_{2}))");
495  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(7,"cos(n(2#phi_{1}-#phi_{2}))");\r
496  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(8,"sin(n(2#phi_{1}-#phi_{2}))");
497  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(9,"cos(n(#phi_{1}-#phi_{2}-#phi_{3}))");\r
498  fNonIsotropicTermsPro->GetXaxis()->SetBinLabel(10,"sin(n(#phi_{1}-#phi_{2}-#phi_{3})");  
499  fHistList->Add(fNonIsotropicTermsPro);
500  // Correction terms for non-uniform acceptance to <cos[n(2phi1-phi2-phi3)]> for all events (with correct errors):
501  TString nonIsotropicTermsHistName = "fNonIsotropicTermsHist";\r
502  fNonIsotropicTermsHist = new TH1D(nonIsotropicTermsHistName.Data(),"Non-isotropic terms for all events",10,0,10);
503  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(1,"cos(n(#phi_{1}))");\r
504  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(2,"sin(n(#phi_{1}))");
505  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(3,"cos(2n(#phi_{1}))");\r
506  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(4,"sin(2n(#phi_{1}))");\r
507  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(5,"cos(n(#phi_{1}+#phi_{2}))");\r
508  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(6,"sin(n(#phi_{1}+#phi_{2}))");
509  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(7,"cos(n(2#phi_{1}-#phi_{2}))");\r
510  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(8,"sin(n(2#phi_{1}-#phi_{2}))");
511  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(9,"cos(n(#phi_{1}-#phi_{2}-#phi_{3}))");\r
512  fNonIsotropicTermsHist->GetXaxis()->SetBinLabel(10,"sin(n(#phi_{1}-#phi_{2}-#phi_{3})");  
513  fResultsList->Add(fNonIsotropicTermsHist);
514  // Quantified bias comming from detector inefficiencies to 3-p correlator <<cos[n(2phi1-phi2-phi3)]>> (in %)
515  TString detectorBiasHistName = "fDetectorBiasHist";\r
516  fDetectorBiasHist = new TH1D(detectorBiasHistName.Data(),"Bias coming from detector inefficiences",1,0,1);
517  fDetectorBiasHist->GetXaxis()->SetBinLabel(1,"#left|1 - #frac{corrected}{not-corrected}#right| (in %)");
518  fResultsList->Add(fDetectorBiasHist);
519  
520  // b) Book quantites with multiplicity binning.
521  // 3-p correlator <<cos[n(2phi1-phi2-phi3)]>> for all events versus multiplicity (with wrong error):
522  TString s3pCorrelatorVsMProName = "f3pCorrelatorVsMPro";\r
523  f3pCorrelatorVsMPro = new TProfile(s3pCorrelatorVsMProName.Data(),"<<cos[n(2#phi_{1}-#phi_{2}-#phi_{3})]>> vs M for all events (errors are wrong here!)",fNoOfMultipicityBins+1,0,fNoOfMultipicityBins+1,"s");
524  for(Int_t b=1;b<=fNoOfMultipicityBins;b++)
525  {
526   f3pCorrelatorVsMPro->GetXaxis()->SetBinLabel(b,Form("%d #leq M < %d",(Int_t)(fMinMultiplicity+(b-1)*fMultipicityBinWidth),(Int_t)(fMinMultiplicity+b*fMultipicityBinWidth)));
527  }
528  f3pCorrelatorVsMPro->GetXaxis()->SetBinLabel(fNoOfMultipicityBins+1,Form(" M #geq %d",(Int_t)(fMinMultiplicity+fNoOfMultipicityBins*fMultipicityBinWidth)));
529  fHistList->Add(f3pCorrelatorVsMPro);
530  // 3-p correlator <<cos[n(2phi1-phi2-phi3)]>> for all events (with correct error):
531  TString s3pCorrelatorVsMHistName = "f3pCorrelatorVsMHist";\r
532  f3pCorrelatorVsMHist = new TH1D(s3pCorrelatorVsMHistName.Data(),"<<cos[n(2#phi_{1}-#phi_{2}-#phi_{3})]>> vs M for all events",fNoOfMultipicityBins+1,0,fNoOfMultipicityBins+1);
533  for(Int_t b=1;b<=fNoOfMultipicityBins;b++)
534  {
535   f3pCorrelatorVsMHist->GetXaxis()->SetBinLabel(b,Form("%d #leq M < %d",(Int_t)(fMinMultiplicity+(b-1)*fMultipicityBinWidth),(Int_t)(fMinMultiplicity+b*fMultipicityBinWidth)));
536  }
537  f3pCorrelatorVsMHist->GetXaxis()->SetBinLabel(fNoOfMultipicityBins+1,Form(" M #geq %d",(Int_t)(fMinMultiplicity+fNoOfMultipicityBins*fMultipicityBinWidth)));
538  fResultsList->Add(f3pCorrelatorVsMHist);
539  // Correction terms for non-uniform acceptance to <cos[n(2phi1-phi2-phi3)]> for all events vs M (with wrong errors):
540  TString nonIsotropicTermsVsMProName = "fNonIsotropicTermsVsMPro";\r
541  fNonIsotropicTermsVsMPro = new TProfile2D(nonIsotropicTermsVsMProName.Data(),"Non-isotropic terms for all events vs M (errors are wrong here!)",10,0,10,fNoOfMultipicityBins+1,0,fNoOfMultipicityBins+1,"s");
542  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(1,"cos(n(#phi_{1}))");\r
543  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(2,"sin(n(#phi_{1}))");
544  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(3,"cos(2n(#phi_{1}))");\r
545  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(4,"sin(2n(#phi_{1}))");\r
546  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(5,"cos(n(#phi_{1}+#phi_{2}))");\r
547  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(6,"sin(n(#phi_{1}+#phi_{2}))");
548  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(7,"cos(n(2#phi_{1}-#phi_{2}))");\r
549  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(8,"sin(n(2#phi_{1}-#phi_{2}))");
550  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(9,"cos(n(#phi_{1}-#phi_{2}-#phi_{3}))");\r
551  fNonIsotropicTermsVsMPro->GetXaxis()->SetBinLabel(10,"sin(n(#phi_{1}-#phi_{2}-#phi_{3})");  
552  for(Int_t b=1;b<=fNoOfMultipicityBins;b++)
553  {
554   fNonIsotropicTermsVsMPro->GetYaxis()->SetBinLabel(b,Form("%d #leq M < %d",(Int_t)(fMinMultiplicity+(b-1)*fMultipicityBinWidth),(Int_t)(fMinMultiplicity+b*fMultipicityBinWidth)));
555  }
556  fNonIsotropicTermsVsMPro->GetYaxis()->SetBinLabel(fNoOfMultipicityBins+1,Form(" M #geq %d",(Int_t)(fMinMultiplicity+fNoOfMultipicityBins*fMultipicityBinWidth)));
557  fHistList->Add(fNonIsotropicTermsVsMPro);
558  // Correction terms for non-uniform acceptance to <cos[n(2phi1-phi2-phi3)]> for all events (with correct errors):
559  TString nonIsotropicTermsVsMHistName = "fNonIsotropicTermsVsMHist";\r
560  fNonIsotropicTermsVsMHist = new TH2D(nonIsotropicTermsVsMHistName.Data(),"Non-isotropic terms for all events vs M ",10,0,10,fNoOfMultipicityBins+1,0,fNoOfMultipicityBins+1);
561  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(1,"cos(n(#phi_{1}))");\r
562  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(2,"sin(n(#phi_{1}))");
563  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(3,"cos(2n(#phi_{1}))");\r
564  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(4,"sin(2n(#phi_{1}))");\r
565  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(5,"cos(n(#phi_{1}+#phi_{2}))");\r
566  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(6,"sin(n(#phi_{1}+#phi_{2}))");
567  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(7,"cos(n(2#phi_{1}-#phi_{2}))");\r
568  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(8,"sin(n(2#phi_{1}-#phi_{2}))");
569  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(9,"cos(n(#phi_{1}-#phi_{2}-#phi_{3}))");\r
570  fNonIsotropicTermsVsMHist->GetXaxis()->SetBinLabel(10,"sin(n(#phi_{1}-#phi_{2}-#phi_{3})");  
571  for(Int_t b=1;b<=fNoOfMultipicityBins;b++)
572  {
573   fNonIsotropicTermsVsMHist->GetYaxis()->SetBinLabel(b,Form("%d #leq M < %d",(Int_t)(fMinMultiplicity+(b-1)*fMultipicityBinWidth),(Int_t)(fMinMultiplicity+b*fMultipicityBinWidth)));
574  }
575  fNonIsotropicTermsVsMHist->GetYaxis()->SetBinLabel(fNoOfMultipicityBins+1,Form(" M #geq %d",(Int_t)(fMinMultiplicity+fNoOfMultipicityBins*fMultipicityBinWidth)));
576  fResultsList->Add(fNonIsotropicTermsVsMHist);
577  // Quantified bias comming from detector inefficiencies to 3-p correlator <<cos[n(2phi1-phi2-phi3)]>> (in %)
578  TString detectorBiasVsMHistName = "fDetectorBiasVsMHist";\r
579  fDetectorBiasVsMHist = new TH1D(detectorBiasVsMHistName.Data(),"#left|1 - #frac{corrected}{not-corrected}#right| (in %)",fNoOfMultipicityBins+1,0,fNoOfMultipicityBins+1);
580  for(Int_t b=1;b<=fNoOfMultipicityBins;b++)
581  {
582   fDetectorBiasVsMHist->GetXaxis()->SetBinLabel(b,Form("%d #leq M < %d",(Int_t)(fMinMultiplicity+(b-1)*fMultipicityBinWidth),(Int_t)(fMinMultiplicity+b*fMultipicityBinWidth)));
583  }
584  fDetectorBiasVsMHist->GetXaxis()->SetBinLabel(fNoOfMultipicityBins+1,Form(" M #geq %d",(Int_t)(fMinMultiplicity+fNoOfMultipicityBins*fMultipicityBinWidth)));
585  fResultsList->Add(fDetectorBiasVsMHist);
586  
587 } // end of void AliFlowAnalysisWithMixedHarmonics::BookAllAllEventQuantities()
588 \r
589 //================================================================================================================
590
591 void AliFlowAnalysisWithMixedHarmonics::AccessConstants()\r
592 {\r
593  // Access needed common constants from AliFlowCommonConstants.\r
594  \r
595  fnBinsPhi = AliFlowCommonConstants::GetMaster()->GetNbinsPhi();\r
596  fPhiMin = AliFlowCommonConstants::GetMaster()->GetPhiMin();         \r
597  fPhiMax = AliFlowCommonConstants::GetMaster()->GetPhiMax();\r
598  if(fnBinsPhi) fPhiBinWidth = (fPhiMax-fPhiMin)/fnBinsPhi;  \r
599  fnBinsPt = AliFlowCommonConstants::GetMaster()->GetNbinsPt();\r
600  fPtMin = AliFlowCommonConstants::GetMaster()->GetPtMin();           \r
601  fPtMax = AliFlowCommonConstants::GetMaster()->GetPtMax();\r
602  if(fnBinsPt) fPtBinWidth = (fPtMax-fPtMin)/fnBinsPt;  \r
603  fnBinsEta = AliFlowCommonConstants::GetMaster()->GetNbinsEta();\r
604  fEtaMin = AliFlowCommonConstants::GetMaster()->GetEtaMin();         \r
605  fEtaMax = AliFlowCommonConstants::GetMaster()->GetEtaMax();\r
606  if(fnBinsEta) fEtaBinWidth = (fEtaMax-fEtaMin)/fnBinsEta;  \r
607  \r
608 } // end of void AliFlowAnalysisWithMixedHarmonics::AccessConstants()
609
610 //================================================================================================================\r
611 \r
612 void AliFlowAnalysisWithMixedHarmonics::CrossCheckSettings()\r
613 {\r
614  // Cross-check if the user settings make sense. \r
615  \r
616 } // end of void AliFlowAnalysisWithMixedHarmonics::CrossCheckSettings()\r
617
618 //================================================================================================================\r
619
620 void AliFlowAnalysisWithMixedHarmonics::BookAndFillWeightsHistograms()\r
621 {\r
622  // Book and fill (by accessing file "weights.root") histograms which hold phi, pt and eta weights.\r
623 \r
624  if(!fWeightsList)\r
625  {\r
626   cout<<"WARNING: fWeightsList is NULL in AFAWMH::BAFWH() !!!!"<<endl;\r
627   exit(0);  \r
628  }\r
629  // Profile to hold flags for weights:   \r
630  TString fUseParticleWeightsName = "fUseParticleWeightsMH";\r
631  fUseParticleWeights = new TProfile(fUseParticleWeightsName.Data(),"0 = particle weight not used, 1 = particle weight used ",3,0,3);\r
632  fUseParticleWeights->SetLabelSize(0.06);\r
633  (fUseParticleWeights->GetXaxis())->SetBinLabel(1,"w_{#phi}");\r
634  (fUseParticleWeights->GetXaxis())->SetBinLabel(2,"w_{p_{T}}");\r
635  (fUseParticleWeights->GetXaxis())->SetBinLabel(3,"w_{#eta}");\r
636  fUseParticleWeights->Fill(0.5,(Int_t)fUsePhiWeights);\r
637  fUseParticleWeights->Fill(1.5,(Int_t)fUsePtWeights);\r
638  fUseParticleWeights->Fill(2.5,(Int_t)fUseEtaWeights);\r
639  fWeightsList->Add(fUseParticleWeights); \r
640  // Phi-weights: \r
641  if(fUsePhiWeights)\r
642  {\r
643   if(fWeightsList->FindObject("phi_weights"))\r
644   {\r
645    fPhiWeights = dynamic_cast<TH1F*>(fWeightsList->FindObject("phi_weights"));\r
646    if(TMath::Abs(fPhiWeights->GetBinWidth(1)-fPhiBinWidth)>pow(10.,-6.))\r
647    {\r
648     cout<<endl;
649     cout<<"WARNING (MH): Inconsistent binning in histograms for phi-weights throughout the code."<<endl;\r
650     cout<<endl;
651     exit(0);\r
652    }\r
653   } else \r
654     {\r
655      cout<<"WARNING (MH): fWeightsList->FindObject(\"phi_weights\") is NULL in AFAWMH::BAFWH() !!!!"<<endl;\r
656      exit(0);\r
657     }\r
658  } // end of if(fUsePhiWeights)\r
659  // Pt-weights:\r
660  if(fUsePtWeights) \r
661  {\r
662   if(fWeightsList->FindObject("pt_weights"))\r
663   {\r
664    fPtWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("pt_weights"));\r
665    if(TMath::Abs(fPtWeights->GetBinWidth(1)-fPtBinWidth)>pow(10.,-6.))\r
666    {\r
667     cout<<endl;
668     cout<<"WARNING (MH): Inconsistent binning in histograms for pt-weights throughout the code."<<endl;\r
669     cout<<endl;
670     exit(0);\r
671    }\r
672   } else \r
673     {\r
674      cout<<"WARNING (MH): fWeightsList->FindObject(\"pt_weights\") is NULL in AFAWMH::BAFWH() !!!!"<<endl;\r
675      exit(0);\r
676     }\r
677  } // end of if(fUsePtWeights)    \r
678  // Eta-weights:\r
679  if(fUseEtaWeights) \r
680  {\r
681   if(fWeightsList->FindObject("eta_weights"))\r
682   {\r
683    fEtaWeights = dynamic_cast<TH1D*>(fWeightsList->FindObject("eta_weights"));\r
684    if(TMath::Abs(fEtaWeights->GetBinWidth(1)-fEtaBinWidth)>pow(10.,-6.))\r
685    {\r
686     cout<<endl;
687     cout<<"WARNING (MH): Inconsistent binning in histograms for eta-weights throughout the code."<<endl;\r
688     cout<<endl;
689     exit(0);\r
690    }\r
691   } else \r
692     {\r
693      cout<<"WARNING: fUseEtaWeights && fWeightsList->FindObject(\"eta_weights\") is NULL in AFAWMH::BAFWH() !!!!"<<endl;\r
694      exit(0);\r
695     }\r
696  } // end of if(fUseEtaWeights)\r
697  \r
698 } // end of AliFlowAnalysisWithMixedHarmonics::BookAndFillWeightsHistograms()
699
700 //================================================================================================================
701 \r
702 void AliFlowAnalysisWithMixedHarmonics::CheckPointersUsedInMake()\r
703 {\r
704  // Check pointers used in method Make().\r
705                         
706  if(!fReQnk || !fImQnk || !fSpk || !f3pCorrelatorEBE)
707  {                        
708   cout<<endl;
709   cout<<" WARNING (MH): (!fReQnk || !fImQnk || !fSpk || !f3pCorrelatorEBE) is NULL !!!!"<<endl;
710   cout<<endl;
711   exit(0);
712  }
713  if(!f3pCorrelatorPro)
714  {
715   cout<<endl;
716   cout<<" WARNING (MH): (!f3pCorrelatorPro) is NULL !!!!"<<endl;
717   cout<<endl;
718   exit(0); 
719  }
720                                                                                                                                                                                                                                                                                                                                    \r
721 } // end of AliFlowAnalysisWithMixedHarmonics::CheckPointersUsedInMake()
722
723 //================================================================================================================
724 \r
725 void AliFlowAnalysisWithMixedHarmonics::CheckPointersUsedInFinish()\r
726 {\r
727  // Check pointers used in method Finish().
728                                                                                                                                                                                                                                                                                                                                    \r
729 } // end of AliFlowAnalysisWithMixedHarmonics::CheckPointersUsedInFinish()\r
730
731 //================================================================================================================
732 \r
733 void AliFlowAnalysisWithMixedHarmonics::AccessSettings()\r
734 {\r
735  // Access the settings for analysis with mixed harmonics.
736  
737  fCorrelatorInteger = (Int_t)fAnalysisSettings->GetBinContent(1);
738  fCorrectForDetectorEffects = (Bool_t)fAnalysisSettings->GetBinContent(2);
739  fNoOfMultipicityBins = (Int_t)fAnalysisSettings->GetBinContent(3);
740  fMultipicityBinWidth = (Double_t)fAnalysisSettings->GetBinContent(4);
741  fMinMultiplicity = (Double_t)fAnalysisSettings->GetBinContent(5);
742                                                                                                                                                                                                                                                                                                                                    \r
743 } // end of AliFlowAnalysisWithMixedHarmonics::AccessSettings()
744
745 //================================================================================================================
746 \r
747 void AliFlowAnalysisWithMixedHarmonics::CorrectForDetectorEffects()\r
748 {\r
749  // Correct measured 3-p correlator cos[n(2phi1-phi2-phi3)] for detector effects.
750  
751  Double_t measured3pCorrelator = f3pCorrelatorPro->GetBinContent(1); // biased by detector effects
752  Double_t corrected3pCorrelator = 0.; // corrected for detector effects
753  Double_t nonIsotropicTerms[10] = {0.}; // there are 10 distinct non-isotropic terms
754  for(Int_t nit=0;nit<10;nit++)
755  {
756   nonIsotropicTerms[nit] = fNonIsotropicTermsPro->GetBinContent(nit+1);
757  }                    
758  // Calculate corrected 3-p correlator:                     
759  corrected3pCorrelator = measured3pCorrelator
760                        - nonIsotropicTerms[2]*nonIsotropicTerms[4]                                                                                
761                        - nonIsotropicTerms[3]*nonIsotropicTerms[5]                                                              
762                        - 2.*nonIsotropicTerms[0]*nonIsotropicTerms[6]                                       
763                        - 2.*nonIsotropicTerms[1]*nonIsotropicTerms[7]                                       
764                        + 2.*nonIsotropicTerms[2]*(pow(nonIsotropicTerms[0],2.)-pow(nonIsotropicTerms[1],2.))                                       
765                        + 4.*nonIsotropicTerms[3]*nonIsotropicTerms[0]*nonIsotropicTerms[1];                                       
766  // Store corrected 3-p correlator:
767  f3pCorrelatorHist->SetBinContent(1,corrected3pCorrelator);                 
768                                                                                                                                                                                                                                                                                                                                    \r
769 } // end of AliFlowAnalysisWithMixedHarmonics::CorrectForDetectorEffects()
770
771 //================================================================================================================
772 \r
773 void AliFlowAnalysisWithMixedHarmonics::FinalizeNonIsotropicTerms()\r
774 {\r
775  // Calculate correctly the errors of non-isotropic terms.
776  
777  // Transfer mean values from profiles to histograms: // to be improved
778  for(Int_t mv=1;mv<=10;mv++)
779  {
780   fNonIsotropicTermsHist->SetBinContent(mv,fNonIsotropicTermsPro->GetBinContent(mv));
781  }
782  
783 } // end of void AliFlowAnalysisWithMixedHarmonics::FinalizeNonIsotropicTerms() 
784
785 //================================================================================================================
786 \r
787 void AliFlowAnalysisWithMixedHarmonics::QuantifyBiasFromDetectorEffects()\r
788 {\r
789  // Quantify bias from detector inefficiences to 3-p correlator.
790  
791  // Remark: Bias is quantified as 1 - |corrected/nonCorrected| (in %) and stored in histogram fDetectorBias
792  
793  Double_t bias = 0.;
794  if(f3pCorrelatorPro->GetBinContent(1))
795  {
796   bias = 100.*TMath::Abs(1.-f3pCorrelatorHist->GetBinContent(1)/f3pCorrelatorPro->GetBinContent(1));
797  }
798  fDetectorBiasHist->SetBinContent(1,bias);
799  
800 } // end of void AliFlowAnalysisWithMixedHarmonics::QuantifyBiasFromDetectorEffects()
801
802 //================================================================================================================\r\r
803 void AliFlowAnalysisWithMixedHarmonics::ResetEventByEventQuantities()\r
804 {\r
805  // Reset all event by event quantities.\r
806  \r
807  fReQnk->Zero();\r
808  fImQnk->Zero();\r
809  fSpk->Zero();
810  
811  f3pCorrelatorEBE->Reset();\r
812
813 } // end of void AliFlowAnalysisWithMixedHarmonics::ResetEventByEventQuantities()
814
815 //================================================================================================================
816
817 void AliFlowAnalysisWithMixedHarmonics::Calculate3pCorrelator()\r
818 {\r
819  // Calculate 3-p azimuthal correlator cos[n(2phi1-phi2-phi3)] in terms of Q_{n,k} and S_{p,k}.\r
820  
821  // a) Calculate 3-p correlator without using particle weights;
822  // b) Calculate 3-p correlator with using particle weights.
823
824  // a) Calculate 3-p correlator without using particle weights: \r
825  if(!(fUsePhiWeights || fUsePtWeights || fUseEtaWeights))
826  {
827   // Multiplicity (number of RPs):\r
828   Double_t dMult = (*fSpk)(0,0);\r
829   // Real and imaginary parts of non-weighted Q-vectors (Q_{n,0}) evaluated in harmonics n and 2n: \r
830   Double_t dReQ1n = (*fReQnk)(0,0);\r
831   Double_t dReQ2n = (*fReQnk)(1,0);\r
832   Double_t dImQ1n = (*fImQnk)(0,0);\r
833   Double_t dImQ2n = (*fImQnk)(1,0);
834   // 3-particle azimuthal correlator <cos(n*(2.*phi1-phi2-phi3))>:\r
835   Double_t three2n1n1n = (pow(dReQ1n,2.)*dReQ2n + 2.*dReQ1n*dImQ1n*dImQ2n - pow(dImQ1n,2.)*dReQ2n
836                        - 2.*(pow(dReQ1n,2.)+pow(dImQ1n,2.))\r
837                        - (pow(dReQ2n,2.)+pow(dImQ2n,2.))+2.*dMult)\r
838                        / (dMult*(dMult-1.)*(dMult-2.));                 
839   // Fill event-by-event histogram and all-events profile:                     
840   f3pCorrelatorEBE->SetBinContent(1,three2n1n1n);
841   f3pCorrelatorPro->Fill(0.5,three2n1n1n,dMult*(dMult-1.)*(dMult-2.));
842
843   // Correlator vs multiplicity: // to be improved
844   f3pCorrelatorVsMPro->Fill(0.5+(Int_t)((dMult-fMinMultiplicity)/fMultipicityBinWidth),dMult*(dMult-1.)*(dMult-2.)); // to be improved (cross-checked)
845  } // end of if(!(fUsePhiWeights || fUsePtWeights || fUseEtaWeights)) 
846
847  // b) Calculate 3-p correlator without using particle weights: \r
848  if(fUsePhiWeights || fUsePtWeights || fUseEtaWeights)
849  {
850  
851  } // end of if(fUsePhiWeights || fUsePtWeights || fUseEtaWeights)
852  
853 } // end of void AliFlowAnalysisWithMixedHarmonics::Calculate3pCorrelator() 
854
855 //================================================================================================================
856
857 void AliFlowAnalysisWithMixedHarmonics::CalculateNonIsotropicTerms()
858 {
859  // Calculate correction terms for non-uniform acceptance to 3-p correlator <cos[n(2phi1-phi2-phi3)]>.
860  
861  // a) Calculate using particle weights; 
862  // b) Calculate without using particle weights. 
863  
864  // These non-isotropic terms are stored in fNonIsotropicTermsPro. The same results but with
865  // correct errors are stored in fNonIsotropicTermsHist. Binning of fNonIsotropicTermsPro and 
866  // fNonIsotropicTermsHist is organized as follows:
867  //  1st bin: <<cos(n*phi1)>>\r
868  //  2nd bin: <<sin(n*phi1)>>
869  //  3rd bin: <<cos(2n*phi1)>>\r
870  //  4th bin: <<sin(2n*phi1)>>
871  //  5th bin: <<cos(n*(phi1+phi2)>>\r
872  //  6th bin: <<sin(n*(phi1+phi2)>>
873  //  7th bin: <<cos(n*(2phi1-phi2)>>\r
874  //  8th bin: <<sin(n*(2phi1-phi2)>>
875  //  9th bin: <<cos(n*(phi1-phi2-phi3)>>\r
876  // 10th bin: <<sin(n*(phi1-phi2-phi3)>> 
877  
878  // a) Calculate using particle weights: 
879  if(!(fUsePhiWeights || fUsePtWeights || fUseEtaWeights))
880  {
881   // Multiplicity (number of RPs):\r
882   Double_t dMult = (*fSpk)(0,0);\r
883   // Real and imaginary parts of non-weighted Q-vectors (Q_{n,0}) evaluated in harmonics n and 2n: \r
884   Double_t dReQ1n = (*fReQnk)(0,0);\r
885   Double_t dReQ2n = (*fReQnk)(1,0);\r
886   Double_t dImQ1n = (*fImQnk)(0,0);\r
887   Double_t dImQ2n = (*fImQnk)(1,0);
888   // 1-particle terms:\r
889   Double_t cosP1n = 0.; // <cos(n*(phi1))>  
890   Double_t sinP1n = 0.; // <sin(n*(phi1))>
891   Double_t cosP2n = 0.; // <cos(2n*(phi1))>  
892   Double_t sinP2n = 0.; // <sin(2n*(phi1))>\r
893   if(dMult>0)\r
894   { \r
895    cosP1n = dReQ1n/dMult; 
896    sinP1n = dImQ1n/dMult;
897    cosP2n = dReQ2n/dMult; 
898    sinP2n = dImQ2n/dMult;   
899    // Single event avarages:\r
900    fNonIsotropicTermsEBE->SetBinContent(1,cosP1n); // <cos(n*(phi1))>\r
901    fNonIsotropicTermsEBE->SetBinContent(2,sinP1n); // <sin(n*(phi1))>\r
902    fNonIsotropicTermsEBE->SetBinContent(3,cosP2n); // <cos(2n*(phi1))>\r
903    fNonIsotropicTermsEBE->SetBinContent(4,sinP2n); // <sin(2n*(phi1))>
904    // All-events avarages:\r
905    fNonIsotropicTermsPro->Fill(0.5,cosP1n,dMult); // <<cos(n*(phi1))>> 
906    fNonIsotropicTermsPro->Fill(1.5,sinP1n,dMult); // <<sin(n*(phi1))>>   
907    fNonIsotropicTermsPro->Fill(2.5,cosP2n,dMult); // <<cos(2n*(phi1))>> 
908    fNonIsotropicTermsPro->Fill(3.5,sinP2n,dMult); // <<sin(2n*(phi1))>>   \r
909   } \r
910   // 2-particle terms:\r
911   Double_t cosP1nP1n = 0.; // <cos(n*(phi1+phi2))>
912   Double_t sinP1nP1n = 0.; // <sin(n*(phi1+phi2))>
913   Double_t cosP2nM1n = 0.; // <cos(n*(2phi1-phi2))>
914   Double_t sinP2nM1n = 0.; // <sin(n*(2phi1-phi2))>\r
915   if(dMult>1)\r
916   {\r
917    cosP1nP1n = (pow(dReQ1n,2)-pow(dImQ1n,2)-dReQ2n)/(dMult*(dMult-1)); 
918    sinP1nP1n = (2.*dReQ1n*dImQ1n-dImQ2n)/(dMult*(dMult-1)); \r
919    cosP2nM1n = (dReQ2n*dReQ1n+dImQ2n*dImQ1n-dReQ1n)/(dMult*(dMult-1)); 
920    sinP2nM1n = (dImQ2n*dReQ1n-dReQ2n*dImQ1n-dImQ1n)/(dMult*(dMult-1)); \r
921    // Single event avarages:\r
922    fNonIsotropicTermsEBE->SetBinContent(5,cosP1nP1n); // <cos(n*(phi1+phi2))>\r
923    fNonIsotropicTermsEBE->SetBinContent(6,sinP1nP1n); // <sin(n*(phi1+phi2))>
924    fNonIsotropicTermsEBE->SetBinContent(7,cosP2nM1n); // <cos(n*(2phi1-phi2))>\r
925    fNonIsotropicTermsEBE->SetBinContent(8,sinP2nM1n); // <sin(n*(2phi1-phi2))>\r
926    // All-events avarages:\r
927    fNonIsotropicTermsPro->Fill(4.5,cosP1nP1n,dMult*(dMult-1.)); // <<cos(n*(phi1+phi2))>> 
928    fNonIsotropicTermsPro->Fill(5.5,sinP1nP1n,dMult*(dMult-1.)); // <<sin(n*(phi1+phi2))>>   \r
929    fNonIsotropicTermsPro->Fill(6.5,cosP2nM1n,dMult*(dMult-1.)); // <<cos(n*(2phi1-phi2))>> 
930    fNonIsotropicTermsPro->Fill(7.5,sinP2nM1n,dMult*(dMult-1.)); // <<sin(n*(2phi1-phi2))>>   \r
931   } \r
932  \r
933   // 3-particle:\r
934   Double_t cosP1nM1nM1n = 0.; // <cos(n*(phi1-phi2-phi3))>\r
935   Double_t sinP1nM1nM1n = 0.; // <sin(n*(phi1-phi2-phi3))>\r
936   if(dMult>2)\r
937   {\r
938    cosP1nM1nM1n = (dReQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))-dReQ1n*dReQ2n-dImQ1n*dImQ2n-2.*(dMult-1)*dReQ1n)\r
939                 / (dMult*(dMult-1)*(dMult-2)); 
940    sinP1nM1nM1n = (-dImQ1n*(pow(dReQ1n,2)+pow(dImQ1n,2))+dReQ1n*dImQ2n-dImQ1n*dReQ2n+2.*(dMult-1)*dImQ1n)\r
941                 / (dMult*(dMult-1)*(dMult-2));              \r
942    // Single event avarages:\r
943    fNonIsotropicTermsEBE->SetBinContent(9,cosP1nM1nM1n); // <cos(n*(phi1-phi2-phi3))>
944    fNonIsotropicTermsEBE->SetBinContent(10,sinP1nM1nM1n); // <sin(n*(phi1-phi2-phi3))>\r
945    // All-events avarages:\r
946    fNonIsotropicTermsPro->Fill(8.5,cosP1nM1nM1n,dMult*(dMult-1.)*(dMult-2.)); // <<cos(n*(phi1-phi2-phi3))>> 
947    fNonIsotropicTermsPro->Fill(9.5,sinP1nM1nM1n,dMult*(dMult-1.)*(dMult-2.)); // <<sin(n*(phi1-phi2-phi3))>>   \r
948   } 
949  } // end of if(!(fUsePhiWeights || fUsePtWeights || fUseEtaWeights))
950  
951  // b) Calculate without using particle weights:\r
952  if(fUsePhiWeights || fUsePtWeights || fUseEtaWeights)
953  {
954  
955  } // end of if(fUsePhiWeights || fUsePtWeights || fUseEtaWeights)
956  
957 } // end of void AliFlowAnalysisWithMixedHarmonics::CalculateNonIsotropicTerms()
958