implementing suggestions from V. Koch (differential 2p correlators)
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommon / AliFlowAnalysisWithMixedHarmonics.h
1 /* 
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. 
3  * See cxx source for full Copyright notice 
4  * $Id$ 
5  */
6
7 /********************************************************** 
8  * In this class azimuthal correlators in mixed harmonics *
9  * are implemented in terms of Q-vectors. This approach   *
10  * doesn't require evaluation of nested loops. This class *
11  * can be used to:                                        *
12  *                                                        *  
13  *  a) Extract subdominant harmonics (like v1 and v4);    *
14  *  b) Study flow of two-particle resonances;             *
15  *  c) Study strong parity violation.                     * 
16  *                                                        * 
17  *     Author: Ante Bilandzic (abilandzic@gmail.com)      *
18  *********************************************************/ 
19
20 #ifndef ALIFLOWANALYSISWITHMIXEDHARMONICS_H
21 #define ALIFLOWANALYSISWITHMIXEDHARMONICS_H
22
23 #include "AliFlowCommonConstants.h" // needed as include
24 #include "TMatrixD.h"
25
26 class TDirectoryFile;
27 class TList;
28 class TFile;
29 class TH1F;
30 class TH1D;
31 class TH2D;
32 class TProfile;
33 class TProfile2D;
34
35 class AliFlowEventSimple;
36 class AliFlowCommonHist;
37 class AliFlowCommonHistResults;
38
39 //================================================================================================================
40
41 class AliFlowAnalysisWithMixedHarmonics
42 {
43  public:
44   AliFlowAnalysisWithMixedHarmonics();
45   virtual ~AliFlowAnalysisWithMixedHarmonics(); 
46   // 0.) Methods called in the constructor:
47   virtual void InitializeArrays();
48
49   // 1.) Method Init() and methods called within Init():
50   virtual void Init();
51   virtual void CrossCheckSettings();
52   virtual void AccessConstants();
53   virtual void BookAndNestAllLists();
54   virtual void BookProfileHoldingSettings();
55   virtual void BookCommonHistograms();
56   virtual void BookAllEventByEventQuantities();
57   virtual void BookAllAllEventQuantities();
58   virtual void BookDefault(); // book histos and profiles without any binning in multiplicity, pt or eta
59   virtual void BookVsM();
60   virtual void BookDifferential();
61   virtual void BookAndFillWeightsHistograms();
62   virtual void StoreHarmonic();    
63   
64   // 2.) Method Make() and methods called within Make():
65   virtual void Make(AliFlowEventSimple *anEvent);
66   virtual void CheckPointersUsedInMake();
67   virtual void Calculate3pCorrelator();
68   virtual void CalculateNonIsotropicTerms();
69   virtual void CalculateDifferential3pCorrelator(Double_t &gIntegratedValue);
70                                                  
71   virtual void ResetEventByEventQuantities();
72   
73   // 3.) Method Finish() and methods called within Finish():
74   virtual void Finish();  
75   virtual void AccessSettings();       
76   virtual void CheckPointersUsedInFinish(); 
77   virtual void CorrectForDetectorEffects();
78   virtual void CorrectForDetectorEffectsVsM();
79   virtual void PrintOnTheScreen();  
80   virtual void GetCorrelatorAndError(TProfile *g3pCorrelatorVsPt, 
81                                      Double_t &g3pCorrelatorValue, 
82                                      Double_t &g3pCorrelatorError);
83
84   // 4.) Method GetOutputHistograms and method called within it:
85   virtual void GetOutputHistograms(TList *outputListHistos);
86   virtual void GetPointersForBaseHistograms();
87   virtual void GetPointersForCommonHistograms();
88   virtual void GetPointersForAllEventProfiles();
89   virtual void GetPointersForResultsHistograms();
90   
91   // 5.) Other methods:   
92   virtual void WriteHistograms(TString outputFileName);
93   virtual void WriteHistograms(TDirectoryFile *outputFileName);  
94   
95   // 6.) Setters and getters:
96   void SetHistList(TList* const hl) {this->fHistList = hl;}
97   TList* GetHistList() const {return this->fHistList;}  
98   void SetHistListName(const char *hln) {this->fHistListName->Append(*hln);}; 
99   TString *GetHistListName() const {return this->fHistListName;};
100   void SetHarmonic(Int_t const harmonic) {this->fHarmonic = harmonic;};
101   Int_t GetHarmonic() const {return this->fHarmonic;};  
102   void SetAnalysisLabel(const char *al) {this->fAnalysisLabel->Append(*al);}; 
103   TString *GetAnalysisLabel() const {return this->fAnalysisLabel;};
104   void SetAnalysisSettings(TProfile* const as) {this->fAnalysisSettings = as;};
105   TProfile* GetAnalysisSettings() const {return this->fAnalysisSettings;};
106   void SetNoOfMultipicityBins(Int_t const nomb) {this->fNoOfMultipicityBins = nomb;};
107   Int_t GetNoOfMultipicityBins() const {return this->fNoOfMultipicityBins;};   
108   void SetMultipicityBinWidth(Double_t const mbw) {this->fMultipicityBinWidth = mbw;};
109   Double_t GetMultipicityBinWidth() const {return this->fMultipicityBinWidth;};   
110   void SetMinMultiplicity(Double_t const mm) {this->fMinMultiplicity = mm;};
111   Double_t GetMinMultiplicity() const {return this->fMinMultiplicity;}; 
112   void SetOppositeChargesPOI(Bool_t const ocp) {this->fOppositeChargesPOI = ocp;};
113   Bool_t GetOppositeChargesPOI() const {return this->fOppositeChargesPOI;};   
114   void SetEvaluateDifferential3pCorrelator(Bool_t const ed3pc) {this->fEvaluateDifferential3pCorrelator = ed3pc;};
115   Bool_t GetEvaluateDifferential3pCorrelator() const {return this->fEvaluateDifferential3pCorrelator;}; 
116   void SetCorrectForDetectorEffects(Bool_t const cfde) {this->fCorrectForDetectorEffects = cfde;};
117   Bool_t GetCorrectForDetectorEffects() const {return this->fCorrectForDetectorEffects;}; 
118   void SetPrintOnTheScreen(Bool_t const pots) {this->fPrintOnTheScreen = pots;};
119   Bool_t GetPrintOnTheScreen() const {return this->fPrintOnTheScreen;};  
120   void SetCalculateVsM(Bool_t const cvm) {this->fCalculateVsM = cvm;};
121   Bool_t GetCalculateVsM() const {return this->fCalculateVsM;};  
122   void SetShowBinLabelsVsM(Bool_t const sblvm) {this->fShowBinLabelsVsM = sblvm;};
123   Bool_t GetShowBinLabelsVsM() const {return this->fShowBinLabelsVsM;};  
124   void SetCommonHists(AliFlowCommonHist* const ch) {this->fCommonHists = ch;};
125   AliFlowCommonHist* GetCommonHists() const {return this->fCommonHists;};
126   void SetWeightsList(TList* const wl) {this->fWeightsList = (TList*)wl->Clone();}
127   TList* GetWeightsList() const {return this->fWeightsList;}  
128   void SetUsePhiWeights(Bool_t const uPhiW) {this->fUsePhiWeights = uPhiW;};
129   Bool_t GetUsePhiWeights() const {return this->fUsePhiWeights;};
130   void SetUsePtWeights(Bool_t const uPtW) {this->fUsePtWeights = uPtW;};
131   Bool_t GetUsePtWeights() const {return this->fUsePtWeights;};
132   void SetUseEtaWeights(Bool_t const uEtaW) {this->fUseEtaWeights = uEtaW;};
133   Bool_t GetUseEtaWeights() const {return this->fUseEtaWeights;};
134   void SetUseParticleWeights(TProfile* const uPW) {this->fUseParticleWeights = uPW;};
135   TProfile* GetUseParticleWeights() const {return this->fUseParticleWeights;};
136   void SetPhiWeights(TH1F* const histPhiWeights) {this->fPhiWeights = histPhiWeights;};
137   TH1F* GetPhiWeights() const {return this->fPhiWeights;};
138   void SetPtWeights(TH1D* const histPtWeights) {this->fPtWeights = histPtWeights;};
139   TH1D* GetPtWeights() const {return this->fPtWeights;};
140   void SetEtaWeights(TH1D* const histEtaWeights) {this->fEtaWeights = histEtaWeights;};
141   TH1D* GetEtaWeights() const {return this->fEtaWeights;};
142   void SetProfileList(TList* const plist) {this->fProfileList = plist;}
143   TList* GetProfileList() const {return this->fProfileList;}  
144   void Set3pCorrelatorPro(TProfile* const s3pPro) {this->f3pCorrelatorPro = s3pPro;};
145   TProfile* Get3pCorrelatorPro() const {return this->f3pCorrelatorPro;};
146   void SetNonIsotropicTermsPro(TProfile* const nitPro) {this->fNonIsotropicTermsPro = nitPro;};
147   TProfile* GetNonIsotropicTermsPro() const {return this->fNonIsotropicTermsPro;};
148   void Set3pCorrelatorVsMPro(TProfile* const s3pVsMPro) {this->f3pCorrelatorVsMPro = s3pVsMPro;};
149   TProfile* Get3pCorrelatorVsMPro() const {return this->f3pCorrelatorVsMPro;};
150   void Set3pPOICorrelatorVsM(TProfile* const s3pPOIVsM) {this->f3pPOICorrelatorVsM = s3pPOIVsM;};
151   TProfile* Get3pPOICorrelatorVsM() const {return this->f3pPOICorrelatorVsM;};
152   void SetNonIsotropicTermsVsMPro(TProfile2D* const nitVsMPro) {this->fNonIsotropicTermsVsMPro = nitVsMPro;};
153   TProfile2D* GetNonIsotropicTermsVsMPro() const {return this->fNonIsotropicTermsVsMPro;};
154   void Set2pCorrelatorCosPsiDiff(TProfile* const g2pCorrelatorCosPsiDiff) {this->f2pCorrelatorCosPsiDiff = g2pCorrelatorCosPsiDiff;};
155   TProfile* Get2pCorrelatorCosPsiDiff() const {return this->f2pCorrelatorCosPsiDiff;};
156   void Set2pCorrelatorCosPsiSum(TProfile* const g2pCorrelatorCosPsiSum) {this->f2pCorrelatorCosPsiSum = g2pCorrelatorCosPsiSum;};
157   TProfile* Get2pCorrelatorCosPsiSum() const {return this->f2pCorrelatorCosPsiSum;};
158   void Set2pCorrelatorSinPsiDiff(TProfile* const g2pCorrelatorSinPsiDiff) {this->f2pCorrelatorSinPsiDiff = g2pCorrelatorSinPsiDiff;};
159   TProfile* Get2pCorrelatorSinPsiDiff() const {return this->f2pCorrelatorSinPsiDiff;};
160   void Set2pCorrelatorSinPsiSum(TProfile* const g2pCorrelatorSinPsiSum) {this->f2pCorrelatorSinPsiSum = g2pCorrelatorSinPsiSum;};
161   TProfile* Get2pCorrelatorSinPsiSum() const {return this->f2pCorrelatorSinPsiSum;};
162
163
164   void SetResultsList(TList* const rlist) {this->fResultsList = rlist;}
165   TList* GetResultsList() const {return this->fResultsList;}    
166   void Set3pCorrelatorHist(TH1D* const s3pHist) {this->f3pCorrelatorHist = s3pHist;};
167   TH1D* Get3pCorrelatorHist() const {return this->f3pCorrelatorHist;};    
168   void Set3pCorrelatorVsMHist(TH1D* const s3pVsMHist) {this->f3pCorrelatorVsMHist = s3pVsMHist;};
169   TH1D* Get3pCorrelatorVsMHist() const {return this->f3pCorrelatorVsMHist;};
170   void SetDetectorBiasHist(TH1D* const dbHist) {this->fDetectorBiasHist = dbHist;};
171   TH1D* GetDetectorBiasHist() const {return this->fDetectorBiasHist;};  
172   void SetDetectorBiasVsMHist(TH1D* const dbVsMHist) {this->fDetectorBiasVsMHist = dbVsMHist;};
173   TH1D* GetDetectorBiasVsMHist() const {return this->fDetectorBiasVsMHist;};  
174   void Set3pCorrelatorVsPtSumDiffPro(TProfile* const s3pcvpsd, Int_t const sd) {this->f3pCorrelatorVsPtSumDiffPro[sd] = s3pcvpsd;};
175   TProfile* Get3pCorrelatorVsPtSumDiffPro(Int_t sd) const {return this->f3pCorrelatorVsPtSumDiffPro[sd];};
176   void Set3pCorrelatorVsEtaSumDiffPro(TProfile* const s3pcvpsd, Int_t const sd) {this->f3pCorrelatorVsEtaSumDiffPro[sd] = s3pcvpsd;};
177   TProfile* Get3pCorrelatorVsEtaSumDiffPro(Int_t sd) const {return this->f3pCorrelatorVsEtaSumDiffPro[sd];};
178
179   //void Set2pCorrelatorHist(TH1D* const s2pHist) {this->f2pCorrelatorHist = s2pHist;};
180   //TH1D* Get2pCorrelatorHist() const {return this->f2pCorrelatorHist;};    
181
182  private:
183   AliFlowAnalysisWithMixedHarmonics(const AliFlowAnalysisWithMixedHarmonics& afawQc);
184   AliFlowAnalysisWithMixedHarmonics& operator=(const AliFlowAnalysisWithMixedHarmonics& afawQc); 
185   
186   // 0.) Base:
187   TList *fHistList; // base list to hold all output objects
188   TString *fHistListName; // name of base list
189   Int_t fHarmonic; // harmonic n in cos[n*(phi1+phi2-2phi3)] and cos[n*(psi1+psi2-2phi3)]
190   TString *fAnalysisLabel; // analysis label 
191   TProfile *fAnalysisSettings; // profile to hold analysis settings
192   Int_t fNoOfMultipicityBins; // number of multiplicity bins
193   Double_t fMultipicityBinWidth; // width of multiplicity bin
194   Double_t fMinMultiplicity; // minimal multiplicity
195   Bool_t fOppositeChargesPOI; // two POIs, psi1 and psi2, in correlator <<cos[psi1+psi2-2phi3)]>> will be taken with opposite charges
196   Bool_t fEvaluateDifferential3pCorrelator; // evaluate <<cos[psi1+psi2-2phi3)]>>, where psi1 and psi2 are two POIs 
197   Bool_t fCorrectForDetectorEffects; // correct 3-p correlator for detector effects
198   Bool_t fPrintOnTheScreen; // print or not the final results on the screen
199   Bool_t fCalculateVsM; // calculate correlators vs multiplicity
200   Bool_t fShowBinLabelsVsM; // in histograms holding results vs multiplicity show bin labels in the format M_lowEdge \leq M < M_upperEdge
201   
202   // 1.) Common:
203   AliFlowCommonHist *fCommonHists; // common control histograms (filled only with events with 3 or more tracks for 3-p correlators) 
204   Int_t fnBinsPhi; // number of phi bins
205   Double_t fPhiMin; // minimum phi   
206   Double_t fPhiMax; // maximum phi 
207   Double_t fPhiBinWidth; // bin width for phi histograms  
208   Int_t fnBinsPt; // number of pt bins
209   Double_t fPtMin; // minimum pt   
210   Double_t fPtMax; // maximum pt  
211   Double_t fPtBinWidth; // bin width for pt histograms  
212   Int_t fnBinsEta; // number of eta bins
213   Double_t fEtaMin; // minimum eta   
214   Double_t fEtaMax; // maximum eta
215   Double_t fEtaBinWidth; // bin width for eta histograms 
216   
217   // 2a.) Particle weights:
218   TList *fWeightsList; // list to hold all histograms with particle weights: fUseParticleWeights, fPhiWeights, fPtWeights and fEtaWeights
219   Bool_t fUsePhiWeights; // use phi weights
220   Bool_t fUsePtWeights; // use pt weights
221   Bool_t fUseEtaWeights; // use eta weights
222   TProfile *fUseParticleWeights; // profile with three bins to hold values of fUsePhiWeights, fUsePtWeights and fUseEtaWeights
223   TH1F *fPhiWeights; // histogram holding phi weights
224   TH1D *fPtWeights; // histogram holding phi weights
225   TH1D *fEtaWeights; // histogram holding phi weights 
226   
227   // 3.) Event-by-event quantities:
228   TMatrixD *fReQnk; // fReQ[n][k] = Re[Q_{n,k}] = sum_{i=1}^{M} w_{i}^{k} cos(n*phi_{i})
229   TMatrixD *fImQnk; // fImQ[n][k] = Im[Q_{n,k}] = sum_{i=1}^{M} w_{i}^{k} sin(n*phi_{i})
230   TMatrixD *fSpk; // fS[p][k] = S_{p,k} = (sum_{i=1}^{M} w_{i}^{k})^{p+1} // note p+1 in the power to use 0th index in p in non-trivial way
231   TProfile *fRePEBE[2]; // real part of p_n vs [(p1+p2)/2,|p1-p2|]
232   TProfile *fImPEBE[2]; // imaginary part of p_n vs [(p1+p2)/2,|p1-p2|]
233   TProfile *fOverlapEBE[2][2]; // cos[n(psi-phi)] vs [(p1+p2)/2,|p1-p2|], where phi stands for 1st/2nd POI which is also RP 
234   TProfile *fReEtaEBE[2]; // real part of p_n vs [(eta1+eta2)/2,|eta1-eta2|]
235   TProfile *fImEtaEBE[2]; // imaginary part of p_n vs [(eta1+eta2)/2,|eta1-eta2|]
236   TProfile *fOverlapEBE2[2][2]; // cos[n(psi-phi)] vs [(eta1+eta2)/2,|eta1-eta2|], where phi stands for 1st/2nd POI which is also RP 
237   
238   // 4.) Profiles:
239   TList *fProfileList; // list holding all all-event profiles 
240   TProfile *f3pCorrelatorPro; // 3-p correlator <<cos[n(phi1+phi2-2phi3)]>> (not corrected for detector effects)
241   TProfile *fNonIsotropicTermsPro; // non-isotropic terms in the decomposition of 3-p correlator <<cos[n(phi1+phi2-2phi3)]>>
242   TProfile *f3pCorrelatorVsMPro; // 3-p correlator <<cos[n(phi1+phi2-2phi3)]>> vs multiplicity
243   TProfile *f3pPOICorrelatorVsM; // 3-p correlator <<cos[n(psi1+psi2-2phi3)]>> vs multiplicity
244   TProfile2D *fNonIsotropicTermsVsMPro; // non-isotropic terms in the decomposition of <cos[n(phi1+phi2-2phi3))]> vs multiplicity
245   TProfile *f3pCorrelatorVsPtSumDiffPro[2]; // differential 3-p correlator <<cos[psi1+psi2-2phi3)]>> vs [(p1+p2)/2,|p1-p2|]
246   TProfile *f3pCorrelatorVsEtaSumDiffPro[2]; // differential 3-p correlator <<cos[psi1+psi2-2phi3)]>> vs [(eta1+eta2)/2,|eta1-eta2|]
247   TProfile *f2pCorrelatorCosPsiDiff; // <<cos[n(psi1-psi2)] 
248   TProfile *f2pCorrelatorCosPsiSum; // <<cos[n(psi1+psi2)] 
249   TProfile *f2pCorrelatorSinPsiDiff; // <<sin[n(psi1-psi2)] 
250   TProfile *f2pCorrelatorSinPsiSum; // <<sin[n(psi1+psi2)] 
251
252   // 5.) Final results:
253   TList *fResultsList; // list holding objects with final results 
254   TH1D *f3pCorrelatorHist; // 3-p correlator <<cos[n(phi1+phi2-2phi3)]>> corrected for detector effects
255   TH1D *fDetectorBiasHist; // bias coming from detector inefficiencies to 3-p correlator <<cos[n(phi1+phi2-2phi3)]>> (in %)
256   TH1D *f3pCorrelatorVsMHist; // 3-p correlator <<cos[n(phi1+phi2-2phi3)]>> vs multiplicity corrected for detector effects
257   TH1D *fDetectorBiasVsMHist; // bias coming from detector inefficiencies to 3-p correlator <<cos[n(phi1+phi2-2phi3)]>> (in %) versus multiplicity
258   //TH1D *f2pCorrelatorHist;//<<cos[(psi1-psi2)]>>
259
260   ClassDef(AliFlowAnalysisWithMixedHarmonics, 0);
261
262 };
263
264 //================================================================================================================
265
266 #endif
267
268
269
270
271