AliPhysics  aaf9c62 (aaf9c62)
AliAnalysisTaskCMEV0PID.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 /* $Id: AliAnalysisTaskCMEV0PID.cxx Rihan Haque 14/02/2018 $ */
17 
18 //-- general include---
19 #include "TChain.h"
20 #include "TTree.h"
21 #include "TGrid.h"
22 #include "TROOT.h"
23 #include "TObjArray.h"
24 #include "TMatrixDSym.h"
25 
26 #include "TMath.h"
27 #include "stdio.h"
28 #include "Riostream.h"
29 
30 //---- manager and handler---
31 #include "AliAnalysisManager.h"
32 #include "AliInputEventHandler.h"
33 
34 //---V0 and ZDC info---
35 #include "AliAODZDC.h"
36 #include "AliAODVZERO.h"
37 #include "AliAODVertex.h"
38 
39 //---AOD,ESD event--
40 #include "AliESDEvent.h"
41 #include "AliAODHeader.h"
42 #include "AliAODEvent.h"
43 #include "AliAODTrack.h"
44 
45 //----for PID-----
46 #include "AliPIDResponse.h"
47 #include "AliPIDCombined.h"
48 
49 //----- Vevent and tracks
50 #include "AliVEventHandler.h"
51 #include "AliVEvent.h"
52 #include "AliVTrack.h"
53 #include "AliVParticle.h"
54 #include "AliCentrality.h"
55 
56 //----- must include-------
57 #include "AliMultSelection.h"
58 #include "AliAnalysisUtils.h"
59 #include "AliPhysicsSelection.h"
60 #include "AliFlowEventSimple.h"
61 #include "AliAnalysisTaskSE.h"
63 
64 //using namespace std;
65 
66 using std::cout;
67 using std::endl;
68 using std::vector;
69 
70 
72 
73 
75  fVevent(NULL),
76  fESD(NULL),
77  fAOD(NULL),
78  fPIDResponse(NULL),
79  fMultSelection(NULL),
80  fAnalysisUtil(NULL),
81  fListHist(NULL),
82  mfileFBHijing(NULL),
83  fListFBHijing(NULL),
84  fListNUACorr(NULL),
85  fListV0MCorr(NULL),
86  fHistTaskConfigParameters(NULL),
87  fHistPileUpCount(NULL),
88  fHistMultSelPUCount(NULL),
89  fHistEtaPtBefore(NULL),
90  fHistEtaPtAfter(NULL),
91  fHistTPCvsGlobalMultBefore(NULL),
92  fHistTPCvsGlobalMultAfter(NULL),
93  fHistTPCdEdxvsPBefore(NULL),
94  fHistTPCdEdxvsPAfter(NULL),
95  fHistTOFBetavsPBefore(NULL),
96  fHistTOFBetavsPAfter(NULL),
97  fHistTOFMassvsPtBefore(NULL),
98  fHistTOFMatchCount(NULL),
99  fHistTPCVsESDTrkBefore(NULL),
100  fHistTPCVsESDTrkAfter(NULL),
101  fHistTPConlyVsCL1Before(NULL),
102  fHistTPConlyVsV0MBefore(NULL),
103  fHistTPConlyVsCL1After(NULL),
104  fHistTPConlyVsV0MAfter(NULL),
105  fHistGlobalVsV0MBefore(NULL),
106  fHistGlobalVsV0MAfter(NULL),
107  fHistRawVsCorrMultFB(NULL),
108  hCentvsTPCmultCuts(NULL),
109  fHV0AEventPlaneVsCent(NULL),
110  fHV0CEventPlaneVsCent(NULL),
111  fHTPCAEventPlaneVsCent(NULL),
112  fHTPCCEventPlaneVsCent(NULL),
113  fHTPCEventPlaneVsCent(NULL),
114  fV0MultChVsRun(NULL),
115  fCentDistBefore(NULL),
116  fCentDistAfter(NULL),
117  fHCorrectV0M(NULL),
118  fHAvgerageQnV0A(NULL),
119  fHAvgerageQnV0C(NULL),
120  fHCentWeightForRun(NULL),
121  fQAEtaPhiAfterNUA(NULL),
122  fQAEtaPhiAfterNUAPion(NULL),
123  fQAEtaPhiAfterNUAKaon(NULL),
124  fQAEtaPhiAfterNUAProton(NULL),
125  fV0AQ2xVsCentRun(NULL),
126  fV0AQ2yVsCentRun(NULL),
127  fV0CQ2xVsCentRun(NULL),
128  fV0CQ2yVsCentRun(NULL),
129  fV0AQ3xVsCentRun(NULL),
130  fV0AQ3yVsCentRun(NULL),
131  fV0CQ3xVsCentRun(NULL),
132  fV0CQ3yVsCentRun(NULL),
133  fTPCAQ2xVsCentRun(NULL),
134  fTPCAQ2yVsCentRun(NULL),
135  fTPCCQ2xVsCentRun(NULL),
136  fTPCCQ2yVsCentRun(NULL),
137  fTPCAQ3xVsCentRun(NULL),
138  fTPCAQ3yVsCentRun(NULL),
139  fTPCCQ3xVsCentRun(NULL),
140  fTPCCQ3yVsCentRun(NULL),
141  fTPCAQ4xVsCentRun(NULL),
142  fTPCAQ4yVsCentRun(NULL),
143  fTPCCQ4xVsCentRun(NULL),
144  fTPCCQ4yVsCentRun(NULL),
145  fTPCFQ2xVsCentRun(NULL),
146  fTPCFQ2yVsCentRun(NULL),
147  fFilterBit(1),
148  gN(1),
149  gM(1),
150  gPsiN(2),
151  fOldRunNum(111),
152  fEventCount(0),
153  fTPCclustMin(70),
154  fNSigmaCut(2),
155  fMinPtCut(0.2),
156  fMaxPtCut(5.0),
157  fMinEtaCut(-0.8),
158  fMaxEtaCut(0.8),
159  fTrkChi2Min(0.1),
160  fDCAxyMax(2.4),
161  fDCAzMax(3.2),
162  fdEdxMin(10.),
163  fCentralityPercentMin(0),
164  fCentralityPercentMax(90),
165  fPileUpSlopeParm(3.43),
166  fPileUpConstParm(43),
167  fMinVzCut(-10.0),
168  fMaxVzCut(10.0),
169  bApplyMCcorr(kFALSE),
170  bV0MGainCorr(kFALSE),
171  bSkipPileUpCut(kFALSE),
172  bFillNUAHistPID(kFALSE),
173  bUseKinkTracks(kFALSE),
174  sPathOfMCFile("/alien"),
175  sNucleiTP("PbPb"),
176  sCentrEstimator("V0M"),
177  fHistEventCount(NULL)
178 {
179  for(int i=0;i<3;i++){
180  fHistPtwithTPCNsigma[i]=NULL;
181  fHistPtwithTOFmasscut[i]=NULL;
182  fHistPtwithTOFSignal[i]=NULL;
183  fHistTOFnSigmavsPtAfter[i]=NULL;
184  fHistTPCnSigmavsPtAfter[i]=NULL;
185  fHistTPCTOFnSigmavsPtAfter[i]=NULL;
186  fHistTPCdEdxvsPtPIDAfter[i]=NULL;
187  }
188  for(int i=0;i<5;i++){
189  fHCorrectNUApos[i] = NULL;
190  fHCorrectNUAneg[i] = NULL;
191  }
192  for(int i=0;i<5;i++){ // for PID
193  fHCorrectNUAposPion[i] = NULL;
194  fHCorrectNUAnegPion[i] = NULL;
195  fHCorrectNUAposKaon[i] = NULL;
196  fHCorrectNUAnegKaon[i] = NULL;
197  fHCorrectNUAposProton[i] = NULL;
198  fHCorrectNUAnegProton[i] = NULL;
199  }
200  //3p vs centrality
201  for(int i=0;i<2;i++){
202  for(int j=0;j<4;j++){
203  fHist_Corr3p_EP_Norm_PN[i][j] = NULL;
204  fHist_Corr3p_EP_Norm_PP[i][j] = NULL;
205  fHist_Corr3p_EP_Norm_NN[i][j] = NULL;
206  }
207  for(int j=0;j<4;j++) {
208  fHist_Reso2n_EP_Norm_Det[i][j] = NULL;
209  }
210  //PID:
211  for(int j=0;j<4;j++){
212  fHist_Corr3p_Pion_EP_Norm_PN[i][j] = NULL;
213  fHist_Corr3p_Pion_EP_Norm_PP[i][j] = NULL;
214  fHist_Corr3p_Pion_EP_Norm_NN[i][j] = NULL;
215  fHist_Corr3p_Kaon_EP_Norm_PN[i][j] = NULL;
216  fHist_Corr3p_Kaon_EP_Norm_PP[i][j] = NULL;
217  fHist_Corr3p_Kaon_EP_Norm_NN[i][j] = NULL;
218  fHist_Corr3p_Proton_EP_Norm_PN[i][j] = NULL;
219  fHist_Corr3p_Proton_EP_Norm_PP[i][j] = NULL;
220  fHist_Corr3p_Proton_EP_Norm_NN[i][j] = NULL;
221  }
222  }
223  //3p vs RefMult
224  for(int i=0;i<2;i++){
225  for(int j=0;j<4;j++){
226  fHist_Corr3p_EP_Refm_PN[i][j] = NULL;
227  fHist_Corr3p_EP_Refm_PP[i][j] = NULL;
228  fHist_Corr3p_EP_Refm_NN[i][j] = NULL;
229  }
230  for(int j=0;j<4;j++) {
231  fHist_Reso2n_EP_Refm_Det[i][j] = NULL;
232  }
233  //PID:
234  for(int j=0;j<4;j++){
235  fHist_Corr3p_Pion_EP_Refm_PN[i][j] = NULL;
236  fHist_Corr3p_Pion_EP_Refm_PP[i][j] = NULL;
237  fHist_Corr3p_Pion_EP_Refm_NN[i][j] = NULL;
238  fHist_Corr3p_Kaon_EP_Refm_PN[i][j] = NULL;
239  fHist_Corr3p_Kaon_EP_Refm_PP[i][j] = NULL;
240  fHist_Corr3p_Kaon_EP_Refm_NN[i][j] = NULL;
241  fHist_Corr3p_Proton_EP_Refm_PN[i][j] = NULL;
242  fHist_Corr3p_Proton_EP_Refm_PP[i][j] = NULL;
243  fHist_Corr3p_Proton_EP_Refm_NN[i][j] = NULL;
244  }
245  }
246 
247 
248  //2p vs Centrality:
249 
250  //2p vs Refm:
251 
252 
253 
254 
255 
256 
257 
258 
259 
260  //Differential 3p Charge:
261  for(int i=0;i<2;i++){
262  for(int j=0;j<6;j++){
263  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = NULL;
264  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = NULL;
265  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = NULL;
266  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = NULL;
267  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = NULL;
268  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = NULL;
269 
270  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = NULL;
271  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = NULL;
272  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = NULL;
273  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = NULL;
274  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = NULL;
275  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = NULL;
276 
277  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = NULL;
278  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = NULL;
279  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = NULL;
280  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = NULL;
281  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = NULL;
282  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = NULL;
283  }
284  }
285  //Differential 3p PID:
286  for(int i=0;i<2;i++){
287  for(int j=0;j<6;j++){
288  //Pion
289  fHist_Corr3p_Pion_pTSum_EP_V0A_PN[i][j] = NULL;
290  fHist_Corr3p_Pion_pTSum_EP_V0A_PP[i][j] = NULL;
291  fHist_Corr3p_Pion_pTSum_EP_V0A_NN[i][j] = NULL;
292  fHist_Corr3p_Pion_pTSum_EP_V0C_PN[i][j] = NULL;
293  fHist_Corr3p_Pion_pTSum_EP_V0C_PP[i][j] = NULL;
294  fHist_Corr3p_Pion_pTSum_EP_V0C_NN[i][j] = NULL;
295 
296  fHist_Corr3p_Pion_pTDiff_EP_V0A_PN[i][j] = NULL;
297  fHist_Corr3p_Pion_pTDiff_EP_V0A_PP[i][j] = NULL;
298  fHist_Corr3p_Pion_pTDiff_EP_V0A_NN[i][j] = NULL;
299  fHist_Corr3p_Pion_pTDiff_EP_V0C_PN[i][j] = NULL;
300  fHist_Corr3p_Pion_pTDiff_EP_V0C_PP[i][j] = NULL;
301  fHist_Corr3p_Pion_pTDiff_EP_V0C_NN[i][j] = NULL;
302 
303  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PN[i][j] = NULL;
304  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PP[i][j] = NULL;
305  fHist_Corr3p_Pion_EtaDiff_EP_V0A_NN[i][j] = NULL;
306  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PN[i][j] = NULL;
307  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PP[i][j] = NULL;
308  fHist_Corr3p_Pion_EtaDiff_EP_V0C_NN[i][j] = NULL;
309  //Kaon
310  fHist_Corr3p_Kaon_pTSum_EP_V0A_PN[i][j] = NULL;
311  fHist_Corr3p_Kaon_pTSum_EP_V0A_PP[i][j] = NULL;
312  fHist_Corr3p_Kaon_pTSum_EP_V0A_NN[i][j] = NULL;
313  fHist_Corr3p_Kaon_pTSum_EP_V0C_PN[i][j] = NULL;
314  fHist_Corr3p_Kaon_pTSum_EP_V0C_PP[i][j] = NULL;
315  fHist_Corr3p_Kaon_pTSum_EP_V0C_NN[i][j] = NULL;
316 
317  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PN[i][j] = NULL;
318  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PP[i][j] = NULL;
319  fHist_Corr3p_Kaon_pTDiff_EP_V0A_NN[i][j] = NULL;
320  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PN[i][j] = NULL;
321  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PP[i][j] = NULL;
322  fHist_Corr3p_Kaon_pTDiff_EP_V0C_NN[i][j] = NULL;
323 
324  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PN[i][j] = NULL;
325  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PP[i][j] = NULL;
326  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_NN[i][j] = NULL;
327  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PN[i][j] = NULL;
328  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PP[i][j] = NULL;
329  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_NN[i][j] = NULL;
330  //Proton
331  fHist_Corr3p_Proton_pTSum_EP_V0A_PN[i][j] = NULL;
332  fHist_Corr3p_Proton_pTSum_EP_V0A_PP[i][j] = NULL;
333  fHist_Corr3p_Proton_pTSum_EP_V0A_NN[i][j] = NULL;
334  fHist_Corr3p_Proton_pTSum_EP_V0C_PN[i][j] = NULL;
335  fHist_Corr3p_Proton_pTSum_EP_V0C_PP[i][j] = NULL;
336  fHist_Corr3p_Proton_pTSum_EP_V0C_NN[i][j] = NULL;
337 
338  fHist_Corr3p_Proton_pTDiff_EP_V0A_PN[i][j] = NULL;
339  fHist_Corr3p_Proton_pTDiff_EP_V0A_PP[i][j] = NULL;
340  fHist_Corr3p_Proton_pTDiff_EP_V0A_NN[i][j] = NULL;
341  fHist_Corr3p_Proton_pTDiff_EP_V0C_PN[i][j] = NULL;
342  fHist_Corr3p_Proton_pTDiff_EP_V0C_PP[i][j] = NULL;
343  fHist_Corr3p_Proton_pTDiff_EP_V0C_NN[i][j] = NULL;
344 
345  fHist_Corr3p_Proton_EtaDiff_EP_V0A_PN[i][j] = NULL;
346  fHist_Corr3p_Proton_EtaDiff_EP_V0A_PP[i][j] = NULL;
347  fHist_Corr3p_Proton_EtaDiff_EP_V0A_NN[i][j] = NULL;
348  fHist_Corr3p_Proton_EtaDiff_EP_V0C_PN[i][j] = NULL;
349  fHist_Corr3p_Proton_EtaDiff_EP_V0C_PP[i][j] = NULL;
350  fHist_Corr3p_Proton_EtaDiff_EP_V0C_NN[i][j] = NULL;
351  }
352  }
353 
354  //Differential 2p Charge:
355 
356  for(int i=0;i<4;i++){
357  for(int j=0;j<5;j++){
358  fHist3DEtaPhiVz_Pos_Run[i][j]=NULL;
359  fHist3DEtaPhiVz_Neg_Run[i][j]=NULL;
360  }
361  }
362  for(int i=0;i<10;i++){
363  fFB_Efficiency_Cent[i] = NULL;
364  fFB_Efficiency_Pion_Cent[i] = NULL;
365  fFB_Efficiency_Kaon_Cent[i] = NULL;
366  //fFB_Efficiency_Proton_Cent[i] = NULL;
367  fFB_Efficiency_Proton_Pos_Cent[i] = NULL;
368  fFB_Efficiency_Proton_Neg_Cent[i] = NULL;
369  }
370 
371 
372  DefineInput(0,TChain::Class());
373  DefineOutput(1,TList::Class());
374 }
375 //______________________________empty constructor_______________________
378  fVevent(NULL),
379  fESD(NULL),
380  fAOD(NULL),
381  fPIDResponse(NULL),
382  fMultSelection(NULL),
383  fAnalysisUtil(NULL),
384  fListHist(NULL),
385  mfileFBHijing(NULL),
386  fListFBHijing(NULL),
387  fListNUACorr(NULL),
388  fListV0MCorr(NULL),
389  fHistTaskConfigParameters(NULL),
390  fHistPileUpCount(NULL),
391  fHistMultSelPUCount(NULL),
392  fHistEtaPtBefore(NULL),
393  fHistEtaPtAfter(NULL),
394  fHistTPCvsGlobalMultBefore(NULL),
395  fHistTPCvsGlobalMultAfter(NULL),
396  fHistTPCdEdxvsPBefore(NULL),
397  fHistTPCdEdxvsPAfter(NULL),
398  fHistTOFBetavsPBefore(NULL),
399  fHistTOFBetavsPAfter(NULL),
400  fHistTOFMassvsPtBefore(NULL),
401  fHistTOFMatchCount(NULL),
402  fHistTPCVsESDTrkBefore(NULL),
403  fHistTPCVsESDTrkAfter(NULL),
404  fHistTPConlyVsCL1Before(NULL),
405  fHistTPConlyVsV0MBefore(NULL),
406  fHistTPConlyVsCL1After(NULL),
407  fHistTPConlyVsV0MAfter(NULL),
408  fHistGlobalVsV0MBefore(NULL),
409  fHistGlobalVsV0MAfter(NULL),
410  fHistRawVsCorrMultFB(NULL),
411  hCentvsTPCmultCuts(NULL),
412  fHV0AEventPlaneVsCent(NULL),
413  fHV0CEventPlaneVsCent(NULL),
414  fHTPCAEventPlaneVsCent(NULL),
415  fHTPCCEventPlaneVsCent(NULL),
416  fHTPCEventPlaneVsCent(NULL),
417  fV0MultChVsRun(NULL),
418  fCentDistBefore(NULL),
419  fCentDistAfter(NULL),
420  fHCorrectV0M(NULL),
421  fHAvgerageQnV0A(NULL),
422  fHAvgerageQnV0C(NULL),
423  fHCentWeightForRun(NULL),
424  fQAEtaPhiAfterNUA(NULL),
425  fQAEtaPhiAfterNUAPion(NULL),
426  fQAEtaPhiAfterNUAKaon(NULL),
427  fQAEtaPhiAfterNUAProton(NULL),
428  fV0AQ2xVsCentRun(NULL),
429  fV0AQ2yVsCentRun(NULL),
430  fV0CQ2xVsCentRun(NULL),
431  fV0CQ2yVsCentRun(NULL),
432  fV0AQ3xVsCentRun(NULL),
433  fV0AQ3yVsCentRun(NULL),
434  fV0CQ3xVsCentRun(NULL),
435  fV0CQ3yVsCentRun(NULL),
436  fTPCAQ2xVsCentRun(NULL),
437  fTPCAQ2yVsCentRun(NULL),
438  fTPCCQ2xVsCentRun(NULL),
439  fTPCCQ2yVsCentRun(NULL),
440  fTPCAQ3xVsCentRun(NULL),
441  fTPCAQ3yVsCentRun(NULL),
442  fTPCCQ3xVsCentRun(NULL),
443  fTPCCQ3yVsCentRun(NULL),
444  fTPCAQ4xVsCentRun(NULL),
445  fTPCAQ4yVsCentRun(NULL),
446  fTPCCQ4xVsCentRun(NULL),
447  fTPCCQ4yVsCentRun(NULL),
448  fTPCFQ2xVsCentRun(NULL),
449  fTPCFQ2yVsCentRun(NULL),
450  fFilterBit(1),
451  gN(1),
452  gM(1),
453  gPsiN(2),
454  fOldRunNum(111),
455  fEventCount(0),
456  fTPCclustMin(70),
457  fNSigmaCut(2),
458  fMinPtCut(0.2),
459  fMaxPtCut(5.0),
460  fMinEtaCut(-0.8),
461  fMaxEtaCut(0.8),
462  fTrkChi2Min(0.1),
463  fDCAxyMax(2.4),
464  fDCAzMax(3.2),
465  fdEdxMin(10.),
466  fCentralityPercentMin(0),
467  fCentralityPercentMax(90),
468  fPileUpSlopeParm(3.43),
469  fPileUpConstParm(43),
470  fMinVzCut(-10.0),
471  fMaxVzCut(10.0),
472  bApplyMCcorr(kFALSE),
473  bV0MGainCorr(kFALSE),
474  bSkipPileUpCut(kFALSE),
475  bFillNUAHistPID(kFALSE),
476  bUseKinkTracks(kFALSE),
477  sPathOfMCFile("/alien"),
478  sNucleiTP("PbPb"),
479  sCentrEstimator("V0M"),
480  fHistEventCount(NULL)
481 {
482  for(int i=0;i<3;i++){
483  fHistPtwithTPCNsigma[i]=NULL;
484  fHistPtwithTOFmasscut[i]=NULL;
485  fHistPtwithTOFSignal[i]=NULL;
486  fHistTOFnSigmavsPtAfter[i]=NULL;
487  fHistTPCnSigmavsPtAfter[i]=NULL;
489  fHistTPCdEdxvsPtPIDAfter[i]=NULL;
490  }
491  for(int i=0;i<5;i++){
492  fHCorrectNUApos[i] = NULL;
493  fHCorrectNUAneg[i] = NULL;
494  }
495  for(int i=0;i<5;i++){ // for PID NUA
496  fHCorrectNUAposPion[i] = NULL;
497  fHCorrectNUAnegPion[i] = NULL;
498  fHCorrectNUAposKaon[i] = NULL;
499  fHCorrectNUAnegKaon[i] = NULL;
500  fHCorrectNUAposProton[i] = NULL;
501  fHCorrectNUAnegProton[i] = NULL;
502  }
503  //3p vs Centrality
504  for(int i=0;i<2;i++){
505  for(int j=0;j<4;j++){
506  fHist_Corr3p_EP_Norm_PN[i][j] = NULL;
507  fHist_Corr3p_EP_Norm_PP[i][j] = NULL;
508  fHist_Corr3p_EP_Norm_NN[i][j] = NULL;
509  }
510  for(int j=0;j<4;j++) {
511  fHist_Reso2n_EP_Norm_Det[i][j] = NULL;
512  }
513  //PID:
514  for(int j=0;j<4;j++){
515  fHist_Corr3p_Pion_EP_Norm_PN[i][j] = NULL;
516  fHist_Corr3p_Pion_EP_Norm_PP[i][j] = NULL;
517  fHist_Corr3p_Pion_EP_Norm_NN[i][j] = NULL;
518  fHist_Corr3p_Kaon_EP_Norm_PN[i][j] = NULL;
519  fHist_Corr3p_Kaon_EP_Norm_PP[i][j] = NULL;
520  fHist_Corr3p_Kaon_EP_Norm_NN[i][j] = NULL;
521  fHist_Corr3p_Proton_EP_Norm_PN[i][j] = NULL;
522  fHist_Corr3p_Proton_EP_Norm_PP[i][j] = NULL;
523  fHist_Corr3p_Proton_EP_Norm_NN[i][j] = NULL;
524  }
525  }
526  //3p vs RefMult
527  for(int i=0;i<2;i++){
528  for(int j=0;j<4;j++){
529  fHist_Corr3p_EP_Refm_PN[i][j] = NULL;
530  fHist_Corr3p_EP_Refm_PP[i][j] = NULL;
531  fHist_Corr3p_EP_Refm_NN[i][j] = NULL;
532  }
533  for(int j=0;j<4;j++) {
534  fHist_Reso2n_EP_Refm_Det[i][j] = NULL;
535  }
536  //PID:
537  for(int j=0;j<4;j++){
538  fHist_Corr3p_Pion_EP_Refm_PN[i][j] = NULL;
539  fHist_Corr3p_Pion_EP_Refm_PP[i][j] = NULL;
540  fHist_Corr3p_Pion_EP_Refm_NN[i][j] = NULL;
541  fHist_Corr3p_Kaon_EP_Refm_PN[i][j] = NULL;
542  fHist_Corr3p_Kaon_EP_Refm_PP[i][j] = NULL;
543  fHist_Corr3p_Kaon_EP_Refm_NN[i][j] = NULL;
544  fHist_Corr3p_Proton_EP_Refm_PN[i][j] = NULL;
545  fHist_Corr3p_Proton_EP_Refm_PP[i][j] = NULL;
546  fHist_Corr3p_Proton_EP_Refm_NN[i][j] = NULL;
547  }
548  }
549 
550 
551 
552  //2p vs Centrality:
553 
554  //2p vs Refm:
555 
556 
557 
558 
559 
560 
561 
562 
563 
564 
565 
566 
567 
568 
569  //Differential Charge:
570  for(int i=0;i<2;i++){
571  for(int j=0;j<6;j++){
572  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = NULL;
573  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = NULL;
574  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = NULL;
575  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = NULL;
576  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = NULL;
577  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = NULL;
578 
579  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = NULL;
580  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = NULL;
581  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = NULL;
582  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = NULL;
583  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = NULL;
584  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = NULL;
585 
586  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = NULL;
587  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = NULL;
588  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = NULL;
589  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = NULL;
590  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = NULL;
591  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = NULL;
592  }
593  }
594  //Differential PID:
595  for(int i=0;i<2;i++){
596  for(int j=0;j<6;j++){
597  //Pion
604 
611 
618  //Kaon
625 
632 
639  //Proton
646 
653 
660  }
661  }
662 
663  //Differential 2p Charge:
664 
665  for(int i=0;i<4;i++){
666  for(int j=0;j<5;j++){
667  fHist3DEtaPhiVz_Pos_Run[i][j]=NULL;
668  fHist3DEtaPhiVz_Neg_Run[i][j]=NULL;
669  }
670  }
671  for(int i=0;i<10;i++){
672  fFB_Efficiency_Cent[i] = NULL;
673  fFB_Efficiency_Pion_Cent[i] = NULL;
674  fFB_Efficiency_Kaon_Cent[i] = NULL;
675  //fFB_Efficiency_Proton_Cent[i] = NULL;
678  }
679 }
680 
681 //___________________________ destructor ___________________________
683 {
684  //Destructor
685  //if(fPIDResponse) delete fPIDResponse;
686  //if(fMultSelection) delete fMultSelection;
687 
688  /*
689  if(fHCorrectV0M) delete fHCorrectV0M;
690  if(fHAvgerageQnV0A) delete fHAvgerageQnV0A;
691  if(fHAvgerageQnV0C) delete fHAvgerageQnV0C;
692 
693  if(mfileFBHijing->IsOpen()){
694  mfileFBHijing->Close();
695  if(fListFBHijing) delete fListFBHijing;
696  }
697  for(int i=0;i<10;i++){
698  if(fFB_Efficiency_Cent[i])
699  delete fFB_Efficiency_Cent[i];
700  }
701  for(int i=0;i<5;i++){
702  if(fHCorrectNUApos[i]) delete fHCorrectNUApos[i];
703  if(fHCorrectNUAneg[i]) delete fHCorrectNUAneg[i];
704  }
705  for(int i=0;i<5;i++){ // for PID
706  if(fHCorrectNUAposPion[i]) delete fHCorrectNUAposPion[i];
707  if(fHCorrectNUAnegPion[i]) delete fHCorrectNUAnegPion[i];
708  if(fHCorrectNUAposKaon[i]) delete fHCorrectNUAposKaon[i];
709  if(fHCorrectNUAnegKaon[i]) delete fHCorrectNUAnegKaon[i];
710  if(fHCorrectNUAposProton[i]) delete fHCorrectNUAposProton[i];
711  if(fHCorrectNUAnegProton[i]) delete fHCorrectNUAnegProton[i];
712  }
713 */
714 
715  //Delete the clones
716  if(fListFBHijing) delete fListFBHijing;
717  if(fListNUACorr) delete fListNUACorr;
718  if(fListV0MCorr) delete fListV0MCorr;
719 
720  if(fListHist) delete fListHist;
721  if(fAnalysisUtil) delete fAnalysisUtil; // its 'new' !!
722 
723 }//---------------- sanity ------------------------
724 
725 
726 
728 {
729 
730  //std::cout<<"\n..UserCreateOutputObject called.. with isCorr = "<<isCorr<<"\n ....check if succeeded...\n"<<endl;
731 
732  //input hander
733  AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();
734  AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
735  if (!inputHandler) { printf("\n ...Input handler missing!!!...\n"); return; }
736 
737  //PileUp Multi-Vertex
738  fAnalysisUtil = new AliAnalysisUtils();
739  fAnalysisUtil->SetUseMVPlpSelection(kTRUE);
740  fAnalysisUtil->SetUseOutOfBunchPileUp(kTRUE);
741 
742  //pid response object
743  fPIDResponse=inputHandler->GetPIDResponse();
744 
745  fListHist = new TList();
746  fListHist->SetOwner(kTRUE);
747 
748 
750 
751  if(!gGrid){
752  TGrid::Connect("alien://");
753  }
754 
756 
757 
758 
759  hCentvsTPCmultCuts = new TH2F("hCentvsTPCmultCuts","TPCmult Low,high",100,0,100,5,0,5);
760  hCentvsTPCmultCuts->GetYaxis()->SetBinLabel(1,"mean");
761  hCentvsTPCmultCuts->GetYaxis()->SetBinLabel(2,"sigma");
763 
765 
766  fHistTOFMatchCount = new TH2F("fHistTOFMatchCount","TofMatchFlag vs mismatch Prob",10,0,10,200,-5,5);
768 
769  fHistEtaPtBefore = new TH2F("fHistEtaPtBefore","Eta vs pT",100,-1.25,1.25,100,0,10);
771 
772  fHistEtaPtAfter = new TH2F("fHistEtaPtAfter","Eta vs pT",100,-1.25,1.25,100,0,10);
774 
775 
776  Int_t gMaxTPCFB1mult = 0;
777  Int_t gMaxGlobalmult = 0;
778  Int_t gMaxTPCcorrmult = 0;
779  Int_t gMaxESDtracks = 0;
780  Int_t nBinRefMult = 200;
781  Int_t nRefMultMax = 4000;
782 
783 
784 
785  if(sNucleiTP=="pp"||sNucleiTP=="PP"){
786  gMaxGlobalmult = 200;
787  gMaxTPCFB1mult = 200;
788  gMaxTPCcorrmult = 500;
789  gMaxESDtracks = 1000;
790  nBinRefMult = 100; //change binning for pp
791  nRefMultMax = 500;
792  //fSkipOutlierCut = 1;
793  }
794  else if(sNucleiTP=="pPb"||sNucleiTP=="Pbp"||sNucleiTP=="PbP"||sNucleiTP=="PPb"){
795  gMaxGlobalmult = 400;
796  gMaxTPCFB1mult = 400;
797  gMaxTPCcorrmult = 500;
798  gMaxESDtracks = 2000;
799  nBinRefMult = 100; //change binning for pPb
800  nRefMultMax = 1000;
801  //fSkipOutlierCut = 1;
802  }
803  else{
804  gMaxGlobalmult = 4000;
805  gMaxTPCFB1mult = 4000;
806  gMaxTPCcorrmult = 5000;
807  gMaxESDtracks = 20000;
808  //fSkipOutlierCut = 0;
809  }
810 
811 
812 
813  //if(bSkipPileUpCut) { fSkipOutlierCut = 1;}
814 
815 
816  fHistTPCVsESDTrkBefore = new TH2F("fHistTPCVsESDTrkBefore","Before; TPC1; ESD trk",500,0,gMaxTPCcorrmult,200,0,gMaxESDtracks);
818  fHistTPCVsESDTrkAfter = new TH2F("fHistTPCVsESDTrkAfter"," After; TPC1; ESD trk",500,0,gMaxTPCcorrmult,200,0,gMaxESDtracks);
820 
821  fHistTPCvsGlobalMultBefore = new TH2F("fHistTPCvsGlobalMultBefore","Before; Global; TPC(fb1) ",200,0,gMaxGlobalmult,200,0,gMaxTPCFB1mult);
823  fHistTPCvsGlobalMultAfter = new TH2F("fHistTPCvsGlobalMultAfter"," After; Global; TPC(fb1) ",200,0,gMaxGlobalmult,200,0,gMaxTPCFB1mult);
825 
826  fHistGlobalVsV0MBefore = new TH2F("fHistGlobalVsV0MBefore","Before;Cent(V0M);Global",100,0,100,500,0,gMaxGlobalmult);
828  fHistGlobalVsV0MAfter = new TH2F("fHistGlobalVsV0MAfter"," After; Cent(V0M);Global",100,0,100,500,0,gMaxGlobalmult);
830 
831  fHistTPConlyVsCL1Before = new TH2F("fHistTPConlyVsCL1Before","Before;Cent(CL1); TPC(FB1)",100,0,100,250,0,gMaxTPCcorrmult);
833  fHistTPConlyVsCL1After = new TH2F("fHistTPConlyVsCL1After","After; Cent(CL1); TPC(FB1) ",100,0,100,250,0,gMaxTPCcorrmult);
835 
836  fHistTPConlyVsV0MBefore = new TH2F("fHistTPConlyVsV0MBefore","Before;Cent(V0M); TPC(FB1)",100,0,100,250,0,gMaxTPCcorrmult);
838  fHistTPConlyVsV0MAfter = new TH2F("fHistTPConlyVsV0MAfter","After; Cent(V0M); TPC(FB1) ",100,0,100,250,0,gMaxTPCcorrmult);
840 
841  fHistRawVsCorrMultFB = new TH2F("fHistRawVsCorrMultFB",Form("FB%d;Mult_{raw};Mult_{corr}",fFilterBit),gMaxTPCFB1mult,0,gMaxTPCFB1mult,gMaxTPCcorrmult,0,gMaxTPCcorrmult);
843 
844 
845 
846 
847 
848 
849  // Turn off PID QA histograms
850  //---------------- PID QA Histograms ---------------------
851  /*
852  fHistTPCdEdxvsPBefore = new TH2F("fHistTPCdEdxvsPBefore","Before; p (GeV/c); dEdx (arb)",200,-5,5,200,0,250);
853  fListHist->Add(fHistTPCdEdxvsPBefore);
854  fHistTPCdEdxvsPAfter = new TH2F("fHistTPCdEdxvsPAfter"," After; p (GeV/c); dEdx (arb)",200,-5,5, 200,0,250);
855  fListHist->Add(fHistTPCdEdxvsPAfter);
856 
857  fHistTOFBetavsPBefore = new TH2F("fHistTOFBetavsPBefore","Before; p (GeV/c); beta ",200,-5,5,100,0.0,1.2);
858  fListHist->Add(fHistTOFBetavsPBefore);
859  fHistTOFBetavsPAfter = new TH2F("fHistTOFBetavsPAfter"," After; p (GeV/c); beta ",200,-5,5,100,0.0,1.2);
860  fListHist->Add(fHistTOFBetavsPAfter);
861 
862  fHistTOFMassvsPtBefore = new TH2F("fHistTOFMassvsPtBefore","Before; p_{T}(GeV/c); m^{2}(GeV^{2}/c^{4})",200,-5,5,500,-0.5,4.5);
863  fListHist->Add(fHistTOFMassvsPtBefore);
864 
865  //const char *gSpecies[4] = {"Pion","Kaon","proton","Charge"};
866 
867  for(int i=0;i<3;i++){
868  fHistPtwithTPCNsigma[i] = new TH1F(Form("fHistPtwithTPCNsigma_%d",i), Form("%d;p_{T}(GeV/c))",i),200,-5,5); //i
869  fListHist->Add(fHistPtwithTPCNsigma[i]);
870  fHistPtwithTOFmasscut[i] = new TH1F(Form("fHistPtwithTOFmasscut_%d",i),Form("%d;p_{T}(GeV/c))",i),200,-5,5);
871  fListHist->Add(fHistPtwithTOFmasscut[i]);
872  fHistPtwithTOFSignal[i] = new TH1F(Form("fHistPtwithTOFSignal_%d", i),Form("%d;p_{T}(GeV/c))",i),200,-5,5);
873  fListHist->Add(fHistPtwithTOFSignal[i]);
874 
875  fHistTOFnSigmavsPtAfter[i] = new TH2F(Form("fHistTOFnSigmavsPtAfter_%d",i),Form("%d;p_{T}(GeV/c);n#sigma_{TOF}",i),200,-5,5,400,-10.0,10.0);
876  fListHist->Add(fHistTOFnSigmavsPtAfter[i]);
877 
878  fHistTPCnSigmavsPtAfter[i] = new TH2F(Form("fHistTPCnSigmavsPtAfter_%d",i),Form("%d;p_{T}(GeV/c);n#sigma_{TPC}",i),200,-5,5,400,-10.0,10.0);
879  fListHist->Add(fHistTPCnSigmavsPtAfter[i]);
880 
881  fHistTPCTOFnSigmavsPtAfter[i] = new TH3F(Form("fHistTPCTOFnSigmavsPtAfter_%d",i),Form("%d; p_{T}(GeV/c); n#sigma_{TPC}; n#sigma_{TOF}",i),100,0,5,400,-10,10,400,-10,10);
882  fListHist->Add(fHistTPCTOFnSigmavsPtAfter[i]);
883 
884  fHistTPCdEdxvsPtPIDAfter[i] = new TH2F(Form("fHistTPCdEdxvsPtAfter_%d",i),"AfterCut; p_{T} (GeV/c); dEdx (arb)",400,0,10,200,0,250);
885  fListHist->Add(fHistTPCdEdxvsPtPIDAfter[i]);
886  }// PID histograms done
887  */
888 
889 
890 
891 
892  fCentDistBefore = new TH1F("fCentDistBefore","no Cut; Cent (%); Events ",100,0,100);
894 
895  fCentDistAfter = new TH1F("fCentDistAfter","with Cut; Cent (%); Events ",100,0,100);
897 
898 
899 
900 
901 
902 
903 
904 
905 
906 
907 
908 
909 
910  Double_t centRange[11] = {0,5,10,20,30,40,50,60,70,80,90};
911  //const char *gDetForEP[4] = {"V0A","V0C","TPC-A","TPC-C"};
912  // 10,centRange
913  //------------------- 3p correlator vs Centrality (EP method) ------------------
914  for(int i=0;i<2;i++){
915  //Charged:
916  for(int j=0;j<4;j++){
917  //Detector: 0 = V0A, 1 = V0C, 3 = TPCA, 4 = TPCC
918  fHist_Corr3p_EP_Norm_PN[i][j] = new TProfile(Form("fHist_Corr3p_EP_Norm_PosNeg_Mag%d_Det%d",i,j+1),Form("US, #Psi_{2} %d",j),10,centRange,"");
919  fHist_Corr3p_EP_Norm_PN[i][j]->Sumw2();
921  fHist_Corr3p_EP_Norm_PP[i][j] = new TProfile(Form("fHist_Corr3p_EP_Norm_PosPos_Mag%d_Det%d",i,j+1),Form("P-P, #Psi_{2} %d",j),10,centRange,"");
922  fHist_Corr3p_EP_Norm_PP[i][j]->Sumw2();
924  fHist_Corr3p_EP_Norm_NN[i][j] = new TProfile(Form("fHist_Corr3p_EP_Norm_NegNeg_Mag%d_Det%d",i,j+1),Form("N-N, #Psi_{2}, %d",j),10,centRange,"");
925  fHist_Corr3p_EP_Norm_NN[i][j]->Sumw2();
927  }
928  //EP Resolution:
929  for(int j=0;j<4;j++){
930  //Det: 0 = v0c-v0a, 1 = v0a-TPC, 2 = v0c-TPC, 3 =TPC-A TPC-C
931  fHist_Reso2n_EP_Norm_Det[i][j] = new TProfile(Form("fHist_Reso2n_EP_Norm_Mag%d_DetComb%d",i,j+1),"Event plane Resolution",10,centRange,"");
932  fHist_Reso2n_EP_Norm_Det[i][j]->Sumw2();
934  }
935  //----------- PID -------------------
936  for(int j=0;j<4;j++){ //Detector: 0 = V0A, 1 = V0C, 3 = TPCA, 4 = TPCC
937  //----------> Pion:
938  fHist_Corr3p_Pion_EP_Norm_PN[i][j] = new TProfile(Form("fHist_Corr3p_Pion_EP_Norm_PosNeg_Mag%d_Det%d",i,j+1),Form("US, #Psi_{2} %d",j),10,centRange,"");
939  fHist_Corr3p_Pion_EP_Norm_PN[i][j]->Sumw2();
941  fHist_Corr3p_Pion_EP_Norm_PP[i][j] = new TProfile(Form("fHist_Corr3p_Pion_EP_Norm_PosPos_Mag%d_Det%d",i,j+1),Form("P-P, #Psi_{2} %d",j),10,centRange,"");
942  fHist_Corr3p_Pion_EP_Norm_PP[i][j]->Sumw2();
944  fHist_Corr3p_Pion_EP_Norm_NN[i][j] = new TProfile(Form("fHist_Corr3p_Pion_EP_Norm_NegNeg_Mag%d_Det%d",i,j+1),Form("N-N, #Psi_{2}, %d",j),10,centRange,"");
945  fHist_Corr3p_Pion_EP_Norm_NN[i][j]->Sumw2();
947  //----------> Kaon:
948  fHist_Corr3p_Kaon_EP_Norm_PN[i][j] = new TProfile(Form("fHist_Corr3p_Kaon_EP_Norm_PosNeg_Mag%d_Det%d",i,j+1),Form("US, #Psi_{2} %d",j),10,centRange,"");
949  fHist_Corr3p_Kaon_EP_Norm_PN[i][j]->Sumw2();
951  fHist_Corr3p_Kaon_EP_Norm_PP[i][j] = new TProfile(Form("fHist_Corr3p_Kaon_EP_Norm_PosPos_Mag%d_Det%d",i,j+1),Form("P-P, #Psi_{2} %d",j),10,centRange,"");
952  fHist_Corr3p_Kaon_EP_Norm_PP[i][j]->Sumw2();
954  fHist_Corr3p_Kaon_EP_Norm_NN[i][j] = new TProfile(Form("fHist_Corr3p_Kaon_EP_Norm_NegNeg_Mag%d_Det%d",i,j+1),Form("N-N, #Psi_{2}, %d",j),10,centRange,"");
955  fHist_Corr3p_Kaon_EP_Norm_NN[i][j]->Sumw2();
957  //----------> Proton:
958  fHist_Corr3p_Proton_EP_Norm_PN[i][j] = new TProfile(Form("fHist_Corr3p_Proton_EP_Norm_PosNeg_Mag%d_Det%d",i,j+1),Form("US, #Psi_{2} %d",j),10,centRange,"");
959  fHist_Corr3p_Proton_EP_Norm_PN[i][j]->Sumw2();
961  fHist_Corr3p_Proton_EP_Norm_PP[i][j] = new TProfile(Form("fHist_Corr3p_Proton_EP_Norm_PosPos_Mag%d_Det%d",i,j+1),Form("P-P, #Psi_{2} %d",j),10,centRange,"");
962  fHist_Corr3p_Proton_EP_Norm_PP[i][j]->Sumw2();
964  fHist_Corr3p_Proton_EP_Norm_NN[i][j] = new TProfile(Form("fHist_Corr3p_Proton_EP_Norm_NegNeg_Mag%d_Det%d",i,j+1),Form("N-N, #Psi_{2}, %d",j),10,centRange,"");
965  fHist_Corr3p_Proton_EP_Norm_NN[i][j]->Sumw2();
967  }//Det loop
968  }//magfield loop
969 
970 
971 
972 
973 
974 
975  /*
976  //------------------- 3p correlator vs RefMult (EP method) ------------------
977  for(int i=0;i<2;i++){
978  //Charged:
979  for(int j=0;j<4;j++){
980  //Detector: 0 = V0A, 1 = V0C, 3 = TPCA, 4 = TPCC
981  fHist_Corr3p_EP_Refm_PN[i][j] = new TProfile(Form("fHist_Corr3p_EP_Refm_PosNeg_Mag%d_Det%d",i,j+1),Form("US, #Psi_{2} %d",j),nBinRefMult,0,nRefMultMax,"");
982  //fHist_Corr3p_EP_Refm_PN[i][j]->Sumw2();
983  fListHist->Add(fHist_Corr3p_EP_Refm_PN[i][j]);
984  fHist_Corr3p_EP_Refm_PP[i][j] = new TProfile(Form("fHist_Corr3p_EP_Refm_PosPos_Mag%d_Det%d",i,j+1),Form("P-P, #Psi_{2} %d",j),nBinRefMult,0,nRefMultMax,"");
985  //fHist_Corr3p_EP_Refm_PP[i][j]->Sumw2();
986  fListHist->Add(fHist_Corr3p_EP_Refm_PP[i][j]);
987  fHist_Corr3p_EP_Refm_NN[i][j] = new TProfile(Form("fHist_Corr3p_EP_Refm_NegNeg_Mag%d_Det%d",i,j+1),Form("N-N, #Psi_{2}, %d",j),nBinRefMult,0,nRefMultMax,"");
988  //fHist_Corr3p_EP_Refm_NN[i][j]->Sumw2();
989  fListHist->Add(fHist_Corr3p_EP_Refm_NN[i][j]);
990  }
991  //EP Resolution:
992  for(int j=0;j<4;j++){
993  //Det: 0 = v0c-v0a, 1 = v0a-TPC, 2 = v0c-TPC, 3 =TPC-A TPC-C
994  fHist_Reso2n_EP_Refm_Det[i][j] = new TProfile(Form("fHist_Reso2n_EP_Refm_Mag%d_DetComb%d",i,j+1),"Event plane Resolution",nBinRefMult,0,nRefMultMax,"");
995  //fHist_Reso2n_EP_Refm_Det[i][j]->Sumw2();
996  fListHist->Add(fHist_Reso2n_EP_Refm_Det[i][j]);
997  }
998  //----------- PID -------------------
999  for(int j=0;j<4;j++){ //Detector: 0 = V0A, 1 = V0C, 3 = TPCA, 4 = TPCC
1000  //----------> Pion:
1001  fHist_Corr3p_Pion_EP_Refm_PN[i][j] = new TProfile(Form("fHist_Corr3p_Pion_EP_Refm_PosNeg_Mag%d_Det%d",i,j+1),Form("US, #Psi_{2} %d",j),nBinRefMult,0,nRefMultMax,"");
1002  //fHist_Corr3p_Pion_EP_Refm_PN[i][j]->Sumw2();
1003  fListHist->Add(fHist_Corr3p_Pion_EP_Refm_PN[i][j]);
1004  fHist_Corr3p_Pion_EP_Refm_PP[i][j] = new TProfile(Form("fHist_Corr3p_Pion_EP_Refm_PosPos_Mag%d_Det%d",i,j+1),Form("P-P, #Psi_{2} %d",j),nBinRefMult,0,nRefMultMax,"");
1005  //fHist_Corr3p_Pion_EP_Refm_PP[i][j]->Sumw2();
1006  fListHist->Add(fHist_Corr3p_Pion_EP_Refm_PP[i][j]);
1007  fHist_Corr3p_Pion_EP_Refm_NN[i][j] = new TProfile(Form("fHist_Corr3p_Pion_EP_Refm_NegNeg_Mag%d_Det%d",i,j+1),Form("N-N, #Psi_{2}, %d",j),nBinRefMult,0,nRefMultMax,"");
1008  //fHist_Corr3p_Pion_EP_Refm_NN[i][j]->Sumw2();
1009  fListHist->Add(fHist_Corr3p_Pion_EP_Refm_NN[i][j]);
1010  //----------> Kaon:
1011  fHist_Corr3p_Kaon_EP_Refm_PN[i][j] = new TProfile(Form("fHist_Corr3p_Kaon_EP_Refm_PosNeg_Mag%d_Det%d",i,j+1),Form("US,#Psi_{2},%d",j),nBinRefMult,0,nRefMultMax,"");
1012  //fHist_Corr3p_Kaon_EP_Refm_PN[i][j]->Sumw2();
1013  fListHist->Add(fHist_Corr3p_Kaon_EP_Refm_PN[i][j]);
1014  fHist_Corr3p_Kaon_EP_Refm_PP[i][j] = new TProfile(Form("fHist_Corr3p_Kaon_EP_Refm_PosPos_Mag%d_Det%d",i,j+1),Form("P-P,#Psi_{2},%d",j),nBinRefMult,0,nRefMultMax,"");
1015  //fHist_Corr3p_Kaon_EP_Refm_PP[i][j]->Sumw2();
1016  fListHist->Add(fHist_Corr3p_Kaon_EP_Refm_PP[i][j]);
1017  fHist_Corr3p_Kaon_EP_Refm_NN[i][j] = new TProfile(Form("fHist_Corr3p_Kaon_EP_Refm_NegNeg_Mag%d_Det%d",i,j+1),Form("N-N,#Psi_{2},%d",j),nBinRefMult,0,nRefMultMax,"");
1018  //fHist_Corr3p_Kaon_EP_Refm_NN[i][j]->Sumw2();
1019  fListHist->Add(fHist_Corr3p_Kaon_EP_Refm_NN[i][j]);
1020  //----------> Proton:
1021  fHist_Corr3p_Proton_EP_Refm_PN[i][j] = new TProfile(Form("fHist_Corr3p_Proton_EP_Refm_PosNeg_Mag%d_Det%d",i,j+1),Form("US,#Psi_{2},%d",j),nBinRefMult,0,nRefMultMax,"");
1022  //fHist_Corr3p_Proton_EP_Refm_PN[i][j]->Sumw2();
1023  fListHist->Add(fHist_Corr3p_Proton_EP_Refm_PN[i][j]);
1024  fHist_Corr3p_Proton_EP_Refm_PP[i][j] = new TProfile(Form("fHist_Corr3p_Proton_EP_Refm_PosPos_Mag%d_Det%d",i,j+1),Form("P-P,#Psi_{2},%d",j),nBinRefMult,0,nRefMultMax,"");
1025  //fHist_Corr3p_Proton_EP_Refm_PP[i][j]->Sumw2();
1026  fListHist->Add(fHist_Corr3p_Proton_EP_Refm_PP[i][j]);
1027  fHist_Corr3p_Proton_EP_Refm_NN[i][j] = new TProfile(Form("fHist_Corr3p_Proton_EP_Refm_NegNeg_Mag%d_Det%d",i,j+1),Form("N-N,#Psi_{2},%d",j),nBinRefMult,0,nRefMultMax,"");
1028  //fHist_Corr3p_Proton_EP_Refm_NN[i][j]->Sumw2();
1029  fListHist->Add(fHist_Corr3p_Proton_EP_Refm_NN[i][j]);
1030  }//Det loop
1031  }//magfield loop
1032  */
1033 
1034 
1035 
1036 
1037 
1038 
1039 
1040 
1041 
1042 
1043  //--------- Differential PID ------------
1044 
1045  Char_t name[100];
1046  Char_t title[100];
1047 
1048  Double_t pTRange[21] = {0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.2,3.4,3.6,3.8,4.0};
1049 //Double_t pTRange[11] = {0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0};
1050 
1051  //Charge:
1052  for(Int_t i=0;i<2;i++){
1053  for(Int_t j=0;j<6;j++){
1054  sprintf(name,"fHist_Corr3p_pTSum_EP_V0A_PN_Mag%d_Cent%d",i,j);
1055  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1056  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1057  fHist_Corr3p_pTSum_EP_V0A_PN[i][j]->Sumw2();
1059 
1060  sprintf(name,"fHist_Corr3p_pTSum_EP_V0A_PP_Mag%d_Cent%d",i,j);
1061  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1062  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1063  fHist_Corr3p_pTSum_EP_V0A_PP[i][j]->Sumw2();
1065 
1066  sprintf(name,"fHist_Corr3p_pTSum_EP_V0A_NN_Mag%d_Cent%d",i,j);
1067  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1068  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1069  fHist_Corr3p_pTSum_EP_V0A_NN[i][j]->Sumw2();
1071  //-----v0c----
1072  sprintf(name,"fHist_Corr3p_pTSum_EP_V0C_PN_Mag%d_Cent%d",i,j);
1073  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1074  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1075  fHist_Corr3p_pTSum_EP_V0C_PN[i][j]->Sumw2();
1077 
1078  sprintf(name,"fHist_Corr3p_pTSum_EP_V0C_PP_Mag%d_Cent%d",i,j);
1079  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1080  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1081  fHist_Corr3p_pTSum_EP_V0C_PP[i][j]->Sumw2();
1083 
1084  sprintf(name,"fHist_Corr3p_pTSum_EP_V0C_NN_Mag%d_Cent%d",i,j);
1085  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1086  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1087  fHist_Corr3p_pTSum_EP_V0C_NN[i][j]->Sumw2();
1089  }
1090  }
1091 
1092  for(Int_t i=0;i<2;i++){
1093  for(Int_t j=0;j<6;j++){
1094  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
1095  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1096  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1097  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j]->Sumw2();
1099 
1100  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
1101  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1102  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1103  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j]->Sumw2();
1105 
1106  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
1107  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1108  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1109  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j]->Sumw2();
1111  //-----v0c----
1112  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
1113  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1114  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1115  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j]->Sumw2();
1117 
1118  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
1119  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1120  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1121  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j]->Sumw2();
1123 
1124  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
1125  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1126  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1127  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j]->Sumw2();
1129  }
1130  }
1131 
1132  //Double_t EtaRange[9] = {0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6}; //Use this after tests done
1133  //Now Eta binning: 16,0,1.6 for test
1134 
1135  for(Int_t i=0;i<2;i++){
1136  for(Int_t j=0;j<6;j++){
1137  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
1138  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1139  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = new TProfile(name,title,8,0,1.6,"");
1140  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j]->Sumw2();
1142 
1143  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
1144  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1145  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = new TProfile(name,title,8,0,1.6,"");
1146  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j]->Sumw2();
1148 
1149  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
1150  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1151  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = new TProfile(name,title,8,0,1.6,"");
1152  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j]->Sumw2();
1154  //-----v0c----
1155  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
1156  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1157  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = new TProfile(name,title,8,0,1.6,"");
1158  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j]->Sumw2();
1160 
1161  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
1162  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1163  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = new TProfile(name,title,8,0,1.6,"");
1164  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j]->Sumw2();
1166 
1167  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
1168  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1169  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = new TProfile(name,title,8,0,1.6,"");
1170  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j]->Sumw2();
1172  }
1173  }
1174 
1175  // Pion
1176  for(Int_t i=0;i<2;i++){
1177  for(Int_t j=0;j<6;j++){
1178  sprintf(name,"fHist_Corr3p_Pion_pTSum_EP_V0A_PN_Mag%d_Cent%d",i,j);
1179  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1180  fHist_Corr3p_Pion_pTSum_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1181  fHist_Corr3p_Pion_pTSum_EP_V0A_PN[i][j]->Sumw2();
1183 
1184  sprintf(name,"fHist_Corr3p_Pion_pTSum_EP_V0A_PP_Mag%d_Cent%d",i,j);
1185  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1186  fHist_Corr3p_Pion_pTSum_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1187  fHist_Corr3p_Pion_pTSum_EP_V0A_PP[i][j]->Sumw2();
1189 
1190  sprintf(name,"fHist_Corr3p_Pion_pTSum_EP_V0A_NN_Mag%d_Cent%d",i,j);
1191  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1192  fHist_Corr3p_Pion_pTSum_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1193  fHist_Corr3p_Pion_pTSum_EP_V0A_NN[i][j]->Sumw2();
1195  //-----v0c----
1196  sprintf(name,"fHist_Corr3p_Pion_pTSum_EP_V0C_PN_Mag%d_Cent%d",i,j);
1197  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1198  fHist_Corr3p_Pion_pTSum_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1199  fHist_Corr3p_Pion_pTSum_EP_V0C_PN[i][j]->Sumw2();
1201 
1202  sprintf(name,"fHist_Corr3p_Pion_pTSum_EP_V0C_PP_Mag%d_Cent%d",i,j);
1203  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1204  fHist_Corr3p_Pion_pTSum_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1205  fHist_Corr3p_Pion_pTSum_EP_V0C_PP[i][j]->Sumw2();
1207 
1208  sprintf(name,"fHist_Corr3p_Pion_pTSum_EP_V0C_NN_Mag%d_Cent%d",i,j);
1209  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1210  fHist_Corr3p_Pion_pTSum_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1211  fHist_Corr3p_Pion_pTSum_EP_V0C_NN[i][j]->Sumw2();
1213  }
1214  }
1215 
1216  for(Int_t i=0;i<2;i++){
1217  for(Int_t j=0;j<6;j++){
1218  sprintf(name,"fHist_Corr3p_Pion_pTDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
1219  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1220  fHist_Corr3p_Pion_pTDiff_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1221  fHist_Corr3p_Pion_pTDiff_EP_V0A_PN[i][j]->Sumw2();
1223 
1224  sprintf(name,"fHist_Corr3p_Pion_pTDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
1225  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1226  fHist_Corr3p_Pion_pTDiff_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1227  fHist_Corr3p_Pion_pTDiff_EP_V0A_PP[i][j]->Sumw2();
1229 
1230  sprintf(name,"fHist_Corr3p_Pion_pTDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
1231  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1232  fHist_Corr3p_Pion_pTDiff_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1233  fHist_Corr3p_Pion_pTDiff_EP_V0A_NN[i][j]->Sumw2();
1235  //-----v0c----
1236  sprintf(name,"fHist_Corr3p_Pion_pTDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
1237  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1238  fHist_Corr3p_Pion_pTDiff_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1239  fHist_Corr3p_Pion_pTDiff_EP_V0C_PN[i][j]->Sumw2();
1241 
1242  sprintf(name,"fHist_Corr3p_Pion_pTDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
1243  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1244  fHist_Corr3p_Pion_pTDiff_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1245  fHist_Corr3p_Pion_pTDiff_EP_V0C_PP[i][j]->Sumw2();
1247 
1248  sprintf(name,"fHist_Corr3p_Pion_pTDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
1249  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1250  fHist_Corr3p_Pion_pTDiff_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1251  fHist_Corr3p_Pion_pTDiff_EP_V0C_NN[i][j]->Sumw2();
1253  }
1254  }
1255 
1256  //Double_t EtaRange[9] = {0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6}; //Use this after tests done
1257 
1258  for(Int_t i=0;i<2;i++){
1259  for(Int_t j=0;j<6;j++){
1260  sprintf(name,"fHist_Corr3p_Pion_EtaDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
1261  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1262  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PN[i][j] = new TProfile(name,title,16,0,1.6,"");
1263  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PN[i][j]->Sumw2();
1265 
1266  sprintf(name,"fHist_Corr3p_Pion_EtaDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
1267  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1268  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PP[i][j] = new TProfile(name,title,16,0,1.6,"");
1269  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PP[i][j]->Sumw2();
1271 
1272  sprintf(name,"fHist_Corr3p_Pion_EtaDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
1273  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1274  fHist_Corr3p_Pion_EtaDiff_EP_V0A_NN[i][j] = new TProfile(name,title,16,0,1.6,"");
1275  fHist_Corr3p_Pion_EtaDiff_EP_V0A_NN[i][j]->Sumw2();
1277  //-----v0c----
1278  sprintf(name,"fHist_Corr3p_Pion_EtaDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
1279  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1280  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PN[i][j] = new TProfile(name,title,16,0,1.6,"");
1281  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PN[i][j]->Sumw2();
1283 
1284  sprintf(name,"fHist_Corr3p_Pion_EtaDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
1285  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1286  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PP[i][j] = new TProfile(name,title,16,0,1.6,"");
1287  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PP[i][j]->Sumw2();
1289 
1290  sprintf(name,"fHist_Corr3p_Pion_EtaDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
1291  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1292  fHist_Corr3p_Pion_EtaDiff_EP_V0C_NN[i][j] = new TProfile(name,title,16,0,1.6,"");
1293  fHist_Corr3p_Pion_EtaDiff_EP_V0C_NN[i][j]->Sumw2();
1295  }
1296  }
1297 
1298  //Kaon
1299  for(Int_t i=0;i<2;i++){
1300  for(Int_t j=0;j<6;j++){
1301  sprintf(name,"fHist_Corr3p_Kaon_pTSum_EP_V0A_PN_Mag%d_Cent%d",i,j);
1302  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1303  fHist_Corr3p_Kaon_pTSum_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1304  fHist_Corr3p_Kaon_pTSum_EP_V0A_PN[i][j]->Sumw2();
1306 
1307  sprintf(name,"fHist_Corr3p_Kaon_pTSum_EP_V0A_PP_Mag%d_Cent%d",i,j);
1308  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1309  fHist_Corr3p_Kaon_pTSum_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1310  fHist_Corr3p_Kaon_pTSum_EP_V0A_PP[i][j]->Sumw2();
1312 
1313  sprintf(name,"fHist_Corr3p_Kaon_pTSum_EP_V0A_NN_Mag%d_Cent%d",i,j);
1314  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1315  fHist_Corr3p_Kaon_pTSum_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1316  fHist_Corr3p_Kaon_pTSum_EP_V0A_NN[i][j]->Sumw2();
1318  //-----v0c----
1319  sprintf(name,"fHist_Corr3p_Kaon_pTSum_EP_V0C_PN_Mag%d_Cent%d",i,j);
1320  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1321  fHist_Corr3p_Kaon_pTSum_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1322  fHist_Corr3p_Kaon_pTSum_EP_V0C_PN[i][j]->Sumw2();
1324 
1325  sprintf(name,"fHist_Corr3p_Kaon_pTSum_EP_V0C_PP_Mag%d_Cent%d",i,j);
1326  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1327  fHist_Corr3p_Kaon_pTSum_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1328  fHist_Corr3p_Kaon_pTSum_EP_V0C_PP[i][j]->Sumw2();
1330 
1331  sprintf(name,"fHist_Corr3p_Kaon_pTSum_EP_V0C_NN_Mag%d_Cent%d",i,j);
1332  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1333  fHist_Corr3p_Kaon_pTSum_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1334  fHist_Corr3p_Kaon_pTSum_EP_V0C_NN[i][j]->Sumw2();
1336  }
1337  }
1338 
1339  for(Int_t i=0;i<2;i++){
1340  for(Int_t j=0;j<6;j++){
1341  sprintf(name,"fHist_Corr3p_Kaon_pTDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
1342  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1343  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1344  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PN[i][j]->Sumw2();
1346 
1347  sprintf(name,"fHist_Corr3p_Kaon_pTDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
1348  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1349  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1350  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PP[i][j]->Sumw2();
1352 
1353  sprintf(name,"fHist_Corr3p_Kaon_pTDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
1354  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1355  fHist_Corr3p_Kaon_pTDiff_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1356  fHist_Corr3p_Kaon_pTDiff_EP_V0A_NN[i][j]->Sumw2();
1358  //-----v0c----
1359  sprintf(name,"fHist_Corr3p_Kaon_pTDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
1360  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1361  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1362  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PN[i][j]->Sumw2();
1364 
1365  sprintf(name,"fHist_Corr3p_Kaon_pTDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
1366  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1367  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1368  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PP[i][j]->Sumw2();
1370 
1371  sprintf(name,"fHist_Corr3p_Kaon_pTDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
1372  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1373  fHist_Corr3p_Kaon_pTDiff_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1374  fHist_Corr3p_Kaon_pTDiff_EP_V0C_NN[i][j]->Sumw2();
1376  }
1377  }
1378 
1379  //Double_t EtaRange[9] = {0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6}; //Use this after tests done
1380 
1381  for(Int_t i=0;i<2;i++){
1382  for(Int_t j=0;j<6;j++){
1383  sprintf(name,"fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
1384  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1385  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PN[i][j] = new TProfile(name,title,16,0,1.6,"");
1386  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PN[i][j]->Sumw2();
1388 
1389  sprintf(name,"fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
1390  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1391  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PP[i][j] = new TProfile(name,title,16,0,1.6,"");
1392  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PP[i][j]->Sumw2();
1394 
1395  sprintf(name,"fHist_Corr3p_Kaon_EtaDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
1396  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1397  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_NN[i][j] = new TProfile(name,title,16,0,1.6,"");
1398  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_NN[i][j]->Sumw2();
1400  //-----v0c----
1401  sprintf(name,"fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
1402  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1403  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PN[i][j] = new TProfile(name,title,16,0,1.6,"");
1404  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PN[i][j]->Sumw2();
1406 
1407  sprintf(name,"fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
1408  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1409  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PP[i][j] = new TProfile(name,title,16,0,1.6,"");
1410  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PP[i][j]->Sumw2();
1412 
1413  sprintf(name,"fHist_Corr3p_Kaon_EtaDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
1414  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1415  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_NN[i][j] = new TProfile(name,title,16,0,1.6,"");
1416  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_NN[i][j]->Sumw2();
1418  }
1419  }
1420 
1421  //Proton
1422  for(Int_t i=0;i<2;i++){
1423  for(Int_t j=0;j<6;j++){
1424  sprintf(name,"fHist_Corr3p_Proton_pTSum_EP_V0A_PN_Mag%d_Cent%d",i,j);
1425  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1426  fHist_Corr3p_Proton_pTSum_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1427  fHist_Corr3p_Proton_pTSum_EP_V0A_PN[i][j]->Sumw2();
1429 
1430  sprintf(name,"fHist_Corr3p_Proton_pTSum_EP_V0A_PP_Mag%d_Cent%d",i,j);
1431  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1432  fHist_Corr3p_Proton_pTSum_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1433  fHist_Corr3p_Proton_pTSum_EP_V0A_PP[i][j]->Sumw2();
1435 
1436  sprintf(name,"fHist_Corr3p_Proton_pTSum_EP_V0A_NN_Mag%d_Cent%d",i,j);
1437  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1438  fHist_Corr3p_Proton_pTSum_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1439  fHist_Corr3p_Proton_pTSum_EP_V0A_NN[i][j]->Sumw2();
1441  //-----v0c----
1442  sprintf(name,"fHist_Corr3p_Proton_pTSum_EP_V0C_PN_Mag%d_Cent%d",i,j);
1443  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1444  fHist_Corr3p_Proton_pTSum_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1445  fHist_Corr3p_Proton_pTSum_EP_V0C_PN[i][j]->Sumw2();
1447 
1448  sprintf(name,"fHist_Corr3p_Proton_pTSum_EP_V0C_PP_Mag%d_Cent%d",i,j);
1449  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1450  fHist_Corr3p_Proton_pTSum_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1451  fHist_Corr3p_Proton_pTSum_EP_V0C_PP[i][j]->Sumw2();
1453 
1454  sprintf(name,"fHist_Corr3p_Proton_pTSum_EP_V0C_NN_Mag%d_Cent%d",i,j);
1455  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1456  fHist_Corr3p_Proton_pTSum_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1457  fHist_Corr3p_Proton_pTSum_EP_V0C_NN[i][j]->Sumw2();
1459  }
1460  }
1461 
1462  for(Int_t i=0;i<2;i++){
1463  for(Int_t j=0;j<6;j++){
1464  sprintf(name,"fHist_Corr3p_Proton_pTDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
1465  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1466  fHist_Corr3p_Proton_pTDiff_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1467  fHist_Corr3p_Proton_pTDiff_EP_V0A_PN[i][j]->Sumw2();
1469 
1470  sprintf(name,"fHist_Corr3p_Proton_pTDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
1471  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1472  fHist_Corr3p_Proton_pTDiff_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1473  fHist_Corr3p_Proton_pTDiff_EP_V0A_PP[i][j]->Sumw2();
1475 
1476  sprintf(name,"fHist_Corr3p_Proton_pTDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
1477  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1478  fHist_Corr3p_Proton_pTDiff_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1479  fHist_Corr3p_Proton_pTDiff_EP_V0A_NN[i][j]->Sumw2();
1481  //-----v0c----
1482  sprintf(name,"fHist_Corr3p_Proton_pTDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
1483  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1484  fHist_Corr3p_Proton_pTDiff_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
1485  fHist_Corr3p_Proton_pTDiff_EP_V0C_PN[i][j]->Sumw2();
1487 
1488  sprintf(name,"fHist_Corr3p_Proton_pTDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
1489  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1490  fHist_Corr3p_Proton_pTDiff_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
1491  fHist_Corr3p_Proton_pTDiff_EP_V0C_PP[i][j]->Sumw2();
1493 
1494  sprintf(name,"fHist_Corr3p_Proton_pTDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
1495  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1496  fHist_Corr3p_Proton_pTDiff_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
1497  fHist_Corr3p_Proton_pTDiff_EP_V0C_NN[i][j]->Sumw2();
1499  }
1500  }
1501 
1502  //Double_t EtaRange[9] = {0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6}; //Use this after tests done
1503 
1504  for(Int_t i=0;i<2;i++){
1505  for(Int_t j=0;j<6;j++){
1506  sprintf(name,"fHist_Corr3p_Proton_EtaDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
1507  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1508  fHist_Corr3p_Proton_EtaDiff_EP_V0A_PN[i][j] = new TProfile(name,title,16,0,1.6,"");
1511 
1512  sprintf(name,"fHist_Corr3p_Proton_EtaDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
1513  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1514  fHist_Corr3p_Proton_EtaDiff_EP_V0A_PP[i][j] = new TProfile(name,title,16,0,1.6,"");
1517 
1518  sprintf(name,"fHist_Corr3p_Proton_EtaDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
1519  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1520  fHist_Corr3p_Proton_EtaDiff_EP_V0A_NN[i][j] = new TProfile(name,title,16,0,1.6,"");
1523  //-----v0c----
1524  sprintf(name,"fHist_Corr3p_Proton_EtaDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
1525  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1526  fHist_Corr3p_Proton_EtaDiff_EP_V0C_PN[i][j] = new TProfile(name,title,16,0,1.6,"");
1529 
1530  sprintf(name,"fHist_Corr3p_Proton_EtaDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
1531  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1532  fHist_Corr3p_Proton_EtaDiff_EP_V0C_PP[i][j] = new TProfile(name,title,16,0,1.6,"");
1535 
1536  sprintf(name,"fHist_Corr3p_Proton_EtaDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
1537  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
1538  fHist_Corr3p_Proton_EtaDiff_EP_V0C_NN[i][j] = new TProfile(name,title,16,0,1.6,"");
1541  }
1542  }
1543 
1544  //------------------ Differential 3p PID done -----------------------
1545 
1546 
1547 
1548  //------------------ Differential 2-part correlator -----------------------
1549 
1550 
1551 
1552 
1553 
1554 
1555  //---- to store NUA and calib histograms -----
1556  TList *fListNUACalib = new TList();
1557  fListNUACalib->SetName("fListNUACalib");
1558  fListNUACalib->SetOwner(kTRUE);
1559 
1560 
1561  Double_t truncPi = 3.1416;
1562 
1563  //-------------- Event plane distributions --------------
1564  fHV0AEventPlaneVsCent = new TH2F("fHV0AEventPlaneVsCent",Form("Psi %d from V0A", gPsiN), 10,centRange,50,-0.0,truncPi);
1565  fListNUACalib->Add(fHV0AEventPlaneVsCent);
1566 
1567  fHV0CEventPlaneVsCent = new TH2F("fHV0CEventPlaneVsCent",Form("Psi %d from V0C", gPsiN), 10,centRange,50,-0.0,truncPi);
1568  fListNUACalib->Add(fHV0CEventPlaneVsCent);
1569 
1570  fHTPCAEventPlaneVsCent = new TH2F("fHTPCAEventPlaneVsCent",Form("Psi %d from pos eta",gPsiN),10,centRange,50,-0.0,truncPi);
1571  fListNUACalib->Add(fHTPCAEventPlaneVsCent);
1572 
1573  fHTPCCEventPlaneVsCent = new TH2F("fHTPCCEventPlaneVsCent",Form("Psi %d from neg eta",gPsiN),10,centRange,50,-0.0,truncPi);
1574  fListNUACalib->Add(fHTPCCEventPlaneVsCent);
1575 
1576  fHTPCEventPlaneVsCent = new TH2F("fHTPCEventPlaneVsCent",Form("Psi %d from Full TPC",gPsiN),10,centRange,50,-0.0,truncPi);
1577  fListNUACalib->Add(fHTPCEventPlaneVsCent);
1578 
1579 
1580 
1581  //-------------------- QA: how does the eta-phi looks after NUA correction ----------------
1582  fQAEtaPhiAfterNUA = new TH2F("fQAEtaPhiAfterNUA","eta vs phi with NUA corr",50,0,6.283185,16,-0.8,0.8);
1583  fListNUACalib->Add(fQAEtaPhiAfterNUA);
1584 
1585  fQAEtaPhiAfterNUAPion = new TH2F("fQAEtaPhiAfterNUAPion","Pion eta vs phi with NUA corr",50,0,6.283185,16,-0.8,0.8);
1586  fListNUACalib->Add(fQAEtaPhiAfterNUAPion);
1587 
1588  fQAEtaPhiAfterNUAKaon = new TH2F("fQAEtaPhiAfterNUAKaon","Kaon eta vs phi with NUA corr",50,0,6.283185,16,-0.8,0.8);
1589  fListNUACalib->Add(fQAEtaPhiAfterNUAKaon);
1590 
1591  fQAEtaPhiAfterNUAProton = new TH2F("fQAEtaPhiAfterNUAProton","Proton eta vs phi with NUA corr",50,0,6.283185,16,-0.8,0.8);
1592  fListNUACalib->Add(fQAEtaPhiAfterNUAProton);
1593 
1594 
1595 
1596 
1597 
1598 
1599  //----------------- V0 Calibration hist: ---------------------
1600  fV0MultChVsRun = new TH2F("fV0MultChVsRun","1-32 V0C, 33-64 V0A",64,0,64,20,0,100);
1601  fListNUACalib->Add(fV0MultChVsRun);
1602 
1603  //const char *sCorrect[2]={"wo Corr","w Corr"};
1604  Int_t isCorr = 0;
1605 
1606  if(fListV0MCorr){
1607  isCorr = 1;
1608  }
1609 
1610 
1611  fV0AQ2xVsCentRun = new TProfile("fV0ACos2nVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,""); //sCorrect[isCorr]
1612  fListNUACalib->Add(fV0AQ2xVsCentRun);
1613  fV0AQ2yVsCentRun = new TProfile("fV0ASin2nVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1614  fListNUACalib->Add(fV0AQ2yVsCentRun);
1615  fV0CQ2xVsCentRun = new TProfile("fV0CCos2nVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,"");
1616  fListNUACalib->Add(fV0CQ2xVsCentRun);
1617  fV0CQ2yVsCentRun = new TProfile("fV0CSin2nVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1618  fListNUACalib->Add(fV0CQ2yVsCentRun);
1619 
1620  fV0AQ3xVsCentRun = new TProfile("fV0ACos3nVsCentRun",Form("<Cos3> vs cent (%d)",isCorr),90,0,90,"");
1621  fListNUACalib->Add(fV0AQ3xVsCentRun);
1622  fV0AQ3yVsCentRun = new TProfile("fV0ASin3nVsCentRun",Form("<Sin3> vs cent (%d)",isCorr),90,0,90,"");
1623  fListNUACalib->Add(fV0AQ3yVsCentRun);
1624  fV0CQ3xVsCentRun = new TProfile("fV0CCos3nVsCentRun",Form("<Cos3> vs cent (%d)",isCorr),90,0,90,"");
1625  fListNUACalib->Add(fV0CQ3xVsCentRun);
1626  fV0CQ3yVsCentRun = new TProfile("fV0CSin3nVsCentRun",Form("<Sin3> vs cent (%d)",isCorr),90,0,90,"");
1627  fListNUACalib->Add(fV0CQ3yVsCentRun);
1628 
1629  isCorr = 1;
1630  if(fListNUACorr){
1631  cout<<"\n =========> NUA file found for NUA correction <========== \n";
1632  isCorr = 0;
1633  }
1634  //------------------- TPC Qvector Recentering Histograms --------------
1635  fTPCAQ2xVsCentRun = new TProfile("fTPCACos2nVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,"");
1636  fListNUACalib->Add(fTPCAQ2xVsCentRun);
1637  fTPCAQ2yVsCentRun = new TProfile("fTPCASin2nVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1638  fListNUACalib->Add(fTPCAQ2yVsCentRun);
1639  fTPCCQ2xVsCentRun = new TProfile("fTPCCCos2nVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,"");
1640  fListNUACalib->Add(fTPCCQ2xVsCentRun);
1641  fTPCCQ2yVsCentRun = new TProfile("fTPCCSin2nVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1642  fListNUACalib->Add(fTPCCQ2yVsCentRun);
1643 
1644  fTPCAQ3xVsCentRun = new TProfile("fTPCACos3nVsCentRun",Form("<Cos3> vs cent (%d)",isCorr),90,0,90,"");
1645  fListNUACalib->Add(fTPCAQ3xVsCentRun);
1646  fTPCAQ3yVsCentRun = new TProfile("fTPCASin3nVsCentRun",Form("<Sin3> vs cent (%d)",isCorr),90,0,90,"");
1647  fListNUACalib->Add(fTPCAQ3yVsCentRun);
1648  fTPCCQ3xVsCentRun = new TProfile("fTPCCCos3nVsCentRun",Form("<Cos3> vs cent (%d)",isCorr),90,0,90,"");
1649  fListNUACalib->Add(fTPCCQ3xVsCentRun);
1650  fTPCCQ3yVsCentRun = new TProfile("fTPCCSin3nVsCentRun",Form("<Sin3> vs cent (%d)",isCorr),90,0,90,"");
1651  fListNUACalib->Add(fTPCCQ3yVsCentRun);
1652 
1653  fTPCAQ4xVsCentRun = new TProfile("fTPCACos4nVsCentRun",Form("<Cos4> vs cent (%d)",isCorr),90,0,90,"");
1654  fListNUACalib->Add(fTPCAQ4xVsCentRun);
1655  fTPCAQ4yVsCentRun = new TProfile("fTPCASin4nVsCentRun",Form("<Sin4> vs cent (%d)",isCorr),90,0,90,"");
1656  fListNUACalib->Add(fTPCAQ4yVsCentRun);
1657  fTPCCQ4xVsCentRun = new TProfile("fTPCCCos4nVsCentRun",Form("<Cos4> vs cent (%d)",isCorr),90,0,90,"");
1658  fListNUACalib->Add(fTPCCQ4xVsCentRun);
1659  fTPCCQ4yVsCentRun = new TProfile("fTPCCSin4nVsCentRun",Form("<Sin4> vs cent (%d)",isCorr),90,0,90,"");
1660  fListNUACalib->Add(fTPCCQ4yVsCentRun);
1661 
1662 
1663  fTPCFQ2xVsCentRun = new TProfile("fTPCFQ2xVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,"");
1664  fListNUACalib->Add(fTPCFQ2xVsCentRun);
1665  fTPCFQ2yVsCentRun = new TProfile("fTPCFQ2yVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1666  fListNUACalib->Add(fTPCFQ2yVsCentRun);
1667 
1668  //-------------------------------------------------------------------------------
1669 
1670 
1671 
1672 
1673  //-------------------------- Define NUA Hist for PID -----------------------------
1674  Int_t gCentForNUA[6] = {0,5,10,20,40,90};
1675  //Char_t name[100];
1676  //Char_t title[100];
1677 
1678  for(int i=0;i<4;i++){
1679  for(int j=0;j<5;j++){
1680  sprintf(name,"fHistEtaPhiVz_%d_Pos_Cent%d_Run%d",i,j,1); //gSpecies[i]
1681  sprintf(title,"eta,phi,Vz %dPos, Cent%d-%d, FB %d",i,gCentForNUA[j],gCentForNUA[j+1],fFilterBit);
1682  fHist3DEtaPhiVz_Pos_Run[i][j] = new TH3F(name,title,10,-10,10,50,0,6.283185,16,-0.8,0.8);
1683  fListNUACalib->Add(fHist3DEtaPhiVz_Pos_Run[i][j]);
1684 
1685  sprintf(name,"fHistEtaPhiVz_%d_Neg_Cent%d_Run%d",i,j,1); //gSpecies[i]
1686  sprintf(title,"eta,phi,Vz %dNeg, Cent%d-%d, FB %d",i,gCentForNUA[j],gCentForNUA[j+1],fFilterBit);
1687  fHist3DEtaPhiVz_Neg_Run[i][j] = new TH3F(name,title,10,-10,10,50,0,6.283185,16,-0.8,0.8);
1688  fListNUACalib->Add(fHist3DEtaPhiVz_Neg_Run[i][j]);
1689  }
1690  }
1691  //---------------------------------------------------------------------------------
1692 
1693 
1694  fListHist->Add(fListNUACalib);
1695 
1696  PostData(1,fListHist);
1697  cout<<"\n.........UserCreateOutputObject called.........\n fFilterBit = "<<fFilterBit<<" CentMax = "<<fCentralityPercentMax;
1698  cout<<" PU C = "<<fPileUpConstParm<<" gN = "<<gN<<" gM = "<<gM<<" PsiN = "<<gPsiN<<"\n\n"<<endl;
1699  //cout<<" *********** checking my commit...!! ***************** \n\n ";
1700 }
1701 
1702 
1703 
1704 
1705 
1706 
1707 
1708 
1709 
1710 
1711 
1712 
1713 
1714 
1715 
1716 
1717 
1718 //______________________________________________________________________
1720  //debug only
1721  //cout<<"\n Info:UserExec() called ..!!!\n";
1722  //watch.Start(kTRUE);
1723  //if(fEventCount==501) return;
1724 
1725 
1726  Float_t stepCount = 0.5;
1727 
1728  fHistEventCount->Fill(stepCount); //1
1729  stepCount++;
1730 
1731  fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
1732  fESD = dynamic_cast<AliESDEvent*>(InputEvent());
1733 
1734  if(!(fESD || fAOD)){ printf("ERROR: fESD & fAOD not available\n"); return; }
1735 
1736  fVevent = dynamic_cast<AliVEvent*>(InputEvent());
1737 
1738  if (!fVevent) { printf("ERROR: fVevent not available\n"); return; }
1739 
1740  fHistEventCount->Fill(stepCount); //2
1741  stepCount++;
1742 
1743 
1744 
1745 
1746 
1747 
1748  //--------- Check if I have PID response object --------
1749  if(!fPIDResponse){
1750  AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();
1751  AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
1752  if(inputHandler) fPIDResponse=inputHandler->GetPIDResponse();
1753  if(!fPIDResponse){
1754  printf("\n\n...... PIDResponse object not found..... \n\n");
1755  return;
1756  }
1757  }
1758 
1759 
1760 
1761 
1762 
1763  //-------------- Vtx cuts ---------------
1764  const AliVVertex *pVtx = fVevent->GetPrimaryVertex();
1765 
1766  Double_t pVtxZ = -999;
1767  pVtxZ = pVtx->GetZ();
1768 
1769 //if(TMath::Abs(pVtxZ)>10.) return;
1770  //User defined cut:
1771  if(pVtxZ<fMinVzCut || pVtxZ>fMaxVzCut ) return;
1772 
1773 
1774  fHistEventCount->Fill(stepCount); //3
1775  stepCount++;
1776 
1777 
1778 
1779  Float_t centrality = -99.0;
1780  Float_t centrV0M = -99.0;
1781  Float_t centrCL1 = -99.0;
1782 
1783 
1784 
1785  //---------- Centrality Estimators -------------
1786  AliCentrality* Alicentr = ((AliVAODHeader*)fAOD->GetHeader())->GetCentralityP(); // For Run1, 2010 data
1787 
1788  fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection"); // Must never comment this
1789  if(!fMultSelection) { printf("\n\n **WARNING** \n::UserExec() AliMultSelection object not found.\n\n"); exit(1); }
1790 
1791 
1792  if(sNucleiTP=="PbPb2010" || sNucleiTP=="2010") {
1793  if(Alicentr){
1794 
1795  centrV0M = Alicentr->GetCentralityPercentile("V0M");
1796  centrCL1 = Alicentr->GetCentralityPercentile("CL1");
1797 
1798  if(sCentrEstimator=="V0M" || sCentrEstimator=="V0"){
1799  centrality = centrV0M;
1800  }
1801  else if(sCentrEstimator=="CL1"){
1802  centrality = centrCL1;
1803  }
1804  else if(sCentrEstimator=="V0C"){
1805  centrality = Alicentr->GetCentralityPercentile("V0C");
1806  }
1807  else if(sCentrEstimator=="V0A"){
1808  centrality = Alicentr->GetCentralityPercentile("V0A");
1809  }
1810  else if(sCentrEstimator=="TRK"){
1811  centrality = Alicentr->GetCentralityPercentile("TRK");
1812  }
1813  }
1814  }
1815  else{ // fall back to MultSelection if other than 2010 data
1816 
1817  centrV0M = fMultSelection->GetMultiplicityPercentile("V0M");
1818  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
1819 
1820  if(sCentrEstimator=="V0M" || sCentrEstimator=="V0"){
1821  centrality = centrV0M;
1822  }
1823  else if(sCentrEstimator=="CL1"){
1824  centrality = centrCL1;
1825  }
1826  else if(sCentrEstimator=="V0C"){
1827  centrality = fMultSelection->GetMultiplicityPercentile("V0C");
1828  }
1829  else if(sCentrEstimator=="V0A"){
1830  centrality = fMultSelection->GetMultiplicityPercentile("V0A");
1831  }
1832  else if(sCentrEstimator=="TRK"){
1833  centrality = fMultSelection->GetMultiplicityPercentile("TRK");
1834  }
1835  }
1836 
1837  /*
1838  //--------- Centrality Estimators -------------
1839  centrV0M = fMultSelection->GetMultiplicityPercentile("V0M");
1840  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
1841 
1842  if(sCentrEstimator=="V0M" || sCentrEstimator=="V0"){
1843  centrality = centrV0M;
1844  }
1845  else if(sCentrEstimator=="CL1"){
1846  centrality = centrCL1;
1847  }
1848  else if(sCentrEstimator=="V0C"){
1849  centrality = fMultSelection->GetMultiplicityPercentile("V0C");
1850  }
1851  else if(sCentrEstimator=="V0A"){
1852  centrality = fMultSelection->GetMultiplicityPercentile("V0A");
1853  }
1854  else if(sCentrEstimator=="TRK"){
1855  centrality = fMultSelection->GetMultiplicityPercentile("TRK");
1856  } */
1857 
1858 
1859 
1860 
1862  return;
1863  }
1864 
1865  fHistEventCount->Fill(stepCount); //4
1866  stepCount++;
1867 
1868  fCentDistBefore->Fill(centrality);
1869 
1870 
1871 
1872 
1873 
1874 
1875  Int_t ntracks=fAOD->GetNumberOfTracks();
1876  if(ntracks<2) return; // Check this cut....!!!
1877 
1878  fHistEventCount->Fill(stepCount); //5
1879  stepCount++;
1880 
1881 
1882 
1883 
1884 
1885 
1886  Int_t cent10bin = -1;
1887  Int_t cIndex = -1;
1888  //cent10bin = GetCentralityScaled0to10(centrality); //Centrality in 0-10 scale
1889 
1890  if(centrality<5.0) {
1891  cent10bin = 0;
1892  }
1893  else if(centrality>=5.0 && centrality<10){
1894  cent10bin = 1;
1895  }
1896  else if(centrality>=10.0) {
1897  cent10bin = abs(centrality/10.0)+1;
1898  }
1899 
1900  cIndex = cent10bin;
1901 
1902 //Centrality array index for NUA correcion
1903  Int_t cForNUA = 0;
1904 
1905  if(centrality<5.0) {
1906  cForNUA = 0;
1907  }
1908  else if(centrality>=5.0 && centrality<10){
1909  cForNUA = 1; // 1=5-10,
1910  }
1911  else if(centrality>=10.0 && centrality<20) {
1912  cForNUA = 2; // 2 = 10-20,
1913  }
1914  else if(centrality>=20 && centrality<40){
1915  cForNUA = 3; // 3=20-40
1916  }
1917  else if(centrality>=40){
1918  cForNUA = 4; // 4=40-90
1919  }
1920 
1921 
1922 
1923 
1924 
1925 
1926  //---------- Magnetic field --------
1927  Double_t fMagField = fAOD->GetMagneticField();
1928 
1929  const Int_t QAindex = (fMagField > 0) ? 1 : 0;
1930  //---------------------------------
1931 
1932 
1933 
1934 
1935 
1936 
1937  //Load NUA and V0M correction map run by run:
1938  Int_t runNumber = fAOD->GetRunNumber();
1939 
1940  if(runNumber!=fOldRunNum) {
1941 
1942  GetNUACorrectionHist(runNumber);
1943 
1944  if(bV0MGainCorr) {
1945  GetV0MCorrectionHist(runNumber);
1946  }
1947 
1948  fOldRunNum = runNumber;
1949  }
1950  //------------------------------------------
1951 
1952 
1953 
1954 
1955 
1956 
1957 
1958  //----- Event Plane variables:-------
1959  Double_t PsiNV0A = 0;
1960  Double_t PsiNV0C = 0;
1961 
1962  Double_t PsiNTPCA = 0; // eta <0
1963  Double_t PsiNTPCC = 0; // eta >0
1964  Double_t PsiNTPCF = 0; // Full TPC
1965 
1966  Double_t sumTPCQn2x[5] = {0,0,0}; //[0]= eta<0; [1]= eta>0; [2]= -0.8 < eta < 0.8
1967  Double_t sumTPCQn2y[5] = {0,0,0};
1968  Double_t sumTPCQn3x[5] = {0,0,0}; //[0]= eta<0; [1]= eta>0; [2]= -0.8 < eta < 0.8
1969  Double_t sumTPCQn3y[5] = {0,0,0};
1970  Double_t sumTPCQn4x[5] = {0,0,0}; //[0]= eta<0; [1]= eta>0; [2]= -0.8 < eta < 0.8
1971  Double_t sumTPCQn4y[5] = {0,0,0};
1972  //------------------------------------
1973 
1974 
1975 
1976 
1977 
1978 
1979 
1980  //Variables for MC tracking correction
1981  Int_t ptBinMC = 1;
1982  Int_t iBinNUA = 1;
1983  Double_t ptWgtMC = 1.0;
1984  Double_t WgtNUA = 1.0;
1985  Double_t ptTrk = 0.1;
1986  Double_t dEdx = 0.0;
1987  Double_t Chi2Trk = 0.0;
1988 
1989 
1990  //-------------- Track loop for outlier and PileUp cut -------------------
1991 
1992  //---------------- a dobrin --------------
1993 
1994  Bool_t bIsPileup=kFALSE;
1995 
1996  Int_t isPileup = fAOD->IsPileupFromSPD(3);
1997 
1998  if(isPileup != 0) {
1999  fHistPileUpCount->Fill(0.5);
2000  bIsPileup=kTRUE;
2001  }
2002  else if(PileUpMultiVertex(fAOD)) {
2003  fHistPileUpCount->Fill(1.5);
2004  bIsPileup=kTRUE;
2005  }
2006  else if(((AliAODHeader*)fAOD->GetHeader())->GetRefMultiplicityComb08() < 0) {
2007  fHistPileUpCount->Fill(2.5);
2008  bIsPileup=kTRUE;
2009  }
2010  else if(fAOD->IsIncompleteDAQ()) {
2011  fHistPileUpCount->Fill(3.5);
2012  bIsPileup=kTRUE;
2013  }
2014  else if(fabs(centrV0M-centrCL1)> 5.0) {//default: 7.5
2015 //else if(fabs(centrV0M-centrCL1)> 7.5) {//default: 7.5
2016  fHistPileUpCount->Fill(4.5);
2017  bIsPileup=kTRUE;
2018  }
2019 
2020  // check vertex consistency
2021  const AliAODVertex* vtTrc = fAOD->GetPrimaryVertex();
2022  const AliAODVertex* vtSPD = fAOD->GetPrimaryVertexSPD();
2023 
2024  if(vtTrc->GetNContributors() < 2 || vtSPD->GetNContributors()<1) {
2025  fHistPileUpCount->Fill(5.5);
2026  bIsPileup=kTRUE;
2027  }
2028 
2029  double covTrc[6], covSPD[6];
2030  vtTrc->GetCovarianceMatrix(covTrc);
2031  vtSPD->GetCovarianceMatrix(covSPD);
2032 
2033  double dz = vtTrc->GetZ() - vtSPD->GetZ();
2034 
2035  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
2036  double errTrc = TMath::Sqrt(covTrc[5]);
2037  double nsigTot = dz/errTot;
2038  double nsigTrc = dz/errTrc;
2039 
2040  if(TMath::Abs(dz)>0.2 || TMath::Abs(nsigTot)>10 || TMath::Abs(nsigTrc)>20) {
2041  fHistPileUpCount->Fill(6.5);
2042  bIsPileup=kTRUE;
2043  }
2044 
2045 
2046 
2047  Float_t nSigPionTPC[40000] = {0.,};
2048  Float_t nSigKaonTPC[40000] = {0.,};
2049  Float_t nSigProtonTPC[40000] = {0.,};
2050  Float_t nSigPionTOF[40000] = {0.,};
2051  Float_t nSigKaonTOF[40000] = {0.,};
2052  Float_t nSigProtonTOF[40000] = {0.,};
2053 
2054  if(ntracks > 40000) return; //Dont break segment for higher tracks:
2055 
2056 
2057  /*
2058  std::vector<float> nSigPionTPC;
2059  std::vector<float> nSigKaonTPC;
2060  std::vector<float> nSigProtonTPC;
2061  std::vector<float> nSigPionTOF;
2062  std::vector<float> nSigKaonTOF;
2063  std::vector<float> nSigProtonTOF;
2064 
2065  nSigPionTPC.reserve(10000);
2066  nSigKaonTPC.reserve(10000);
2067  nSigProtonTPC.reserve(10000);
2068  nSigPionTOF.reserve(10000);
2069  nSigKaonTOF.reserve(10000);
2070  nSigProtonTOF.reserve(10000); */
2071 
2072 
2073 
2074 
2075  Float_t multTPC = 0; // tpc mult estimate
2076  //Float_t RefMultRaw = 0; // tpc mult estimate
2077  //Float_t RefMultCorr = 0; // tpc mult estimate
2078  Float_t RefMultRawFB = 0;
2079  Float_t RefMultCorrFB= 0;
2080 
2081  Float_t multTPCAll = 0; // tpc mult estimate
2082  Float_t multGlobal = 0; // global multiplicity
2083 
2084  Int_t multEtaNeg, multEtaPos, multEtaFull;
2085  Double_t SumWEtaNeg, SumWEtaPos, SumWEtaFull;
2086 
2087  Int_t ChTrk;
2088  Int_t nClustTPC;
2089 
2090  Double_t etaTrk, phiTrk; // Never define eta as float, always double.!!
2091 
2092  //Double_t fMaxPtEP = 5.0;
2093  //Double_t fMinPtEP = 0.2;
2094  Double_t fMaxEtaEP = 0.8;
2095  Double_t fMinEtaEP = -0.8;
2096 
2097  multEtaNeg = 0;
2098  multEtaPos = 0;
2099  multEtaFull= 0;
2100  SumWEtaNeg = 0;
2101  SumWEtaPos = 0;
2102  SumWEtaFull= 0;
2103 
2104 
2105 
2106  for(Int_t iTrack = 0; iTrack < ntracks; iTrack++) { //-------------------------
2107 
2108  AliAODTrack* AODtrack =dynamic_cast<AliAODTrack*>(fVevent->GetTrack(iTrack));
2109  if(!AODtrack) continue;
2110 
2111 
2112  //------ Store PID info in array to use later:---------
2113  //Vector method: //taking same time as arrays
2114  /*
2115  nSigPionTPC.push_back(fPIDResponse->NumberOfSigmasTPC(AODtrack, AliPID::kPion));
2116  nSigKaonTPC.push_back(fPIDResponse->NumberOfSigmasTPC( AODtrack, AliPID::kKaon));
2117  nSigProtonTPC.push_back(fPIDResponse->NumberOfSigmasTPC(AODtrack, AliPID::kProton));
2118 
2119  nSigPionTOF.push_back(fPIDResponse->NumberOfSigmasTOF(AODtrack, AliPID::kPion));
2120  nSigKaonTOF.push_back(fPIDResponse->NumberOfSigmasTOF( AODtrack, AliPID::kKaon));
2121  nSigProtonTOF.push_back(fPIDResponse->NumberOfSigmasTOF(AODtrack, AliPID::kProton)); */
2122 
2123  nSigPionTPC[iTrack] = fPIDResponse->NumberOfSigmasTPC(AODtrack, AliPID::kPion);
2124  nSigKaonTPC[iTrack] = fPIDResponse->NumberOfSigmasTPC(AODtrack, AliPID::kKaon);
2125  nSigProtonTPC[iTrack] = fPIDResponse->NumberOfSigmasTPC(AODtrack, AliPID::kProton);
2126 
2127  nSigPionTOF[iTrack] = fPIDResponse->NumberOfSigmasTOF(AODtrack, AliPID::kPion);
2128  nSigKaonTOF[iTrack] = fPIDResponse->NumberOfSigmasTOF(AODtrack, AliPID::kKaon);
2129  nSigProtonTOF[iTrack] = fPIDResponse->NumberOfSigmasTOF(AODtrack, AliPID::kProton);
2130 
2131  //-----------------------------------------------------
2132 
2133 
2134  ptTrk = AODtrack->Pt();
2135  etaTrk = AODtrack->Eta();
2136  Chi2Trk = AODtrack->Chi2perNDF();
2137  nClustTPC = AODtrack->GetTPCNcls();
2138  //dEdx = AODtrack->GetDetPid()->GetTPCsignal(); // This one breaks the code if called before checking FilterBit.
2139 
2140 
2141  //Track cuts for POIs: Same to be used for EP calc.
2142  //if((dPt2 > fMaxPtCut) || (dPt2 < fMinPtCut) || (dEta2 > fMaxEtaCut) || (dEta2 < fMinEtaCut) || (dEdx2 < fdEdxMin) || (track2->GetTPCNcls() < fTPCclustMin) || (Chi2Trk2 < fTrkChi2Min) || (Chi2Trk2 > 4.0) || (track2->DCA() > fDCAxyMax)|| (track2->ZAtDCA() > fDCAzMax) || !(TMath::Abs(gCharge2)))
2143 
2144  //cuts for EP calculation:
2145  if(AODtrack->TestFilterBit(fFilterBit)){
2146 
2147  phiTrk = AODtrack->Phi();
2148  dEdx = AODtrack->GetDetPid()->GetTPCsignal();
2149  ChTrk = AODtrack->Charge();
2150 
2151  if(gPsiN > 0 && (ptTrk <= fMaxPtCut) && (ptTrk >= fMinPtCut) && (etaTrk <= fMaxEtaEP) && (etaTrk >= fMinEtaEP) && (dEdx >= fdEdxMin) && (nClustTPC >= fTPCclustMin) && (AODtrack->DCA() <= fDCAxyMax) && (AODtrack->ZAtDCA() <= fDCAzMax) && (Chi2Trk >= fTrkChi2Min) && (Chi2Trk <= 4.0) && TMath::Abs(ChTrk))
2152  {
2153 
2154  ptWgtMC = 1.0;
2155 
2156  if(fFB_Efficiency_Cent[cent10bin]){
2157  ptBinMC = fFB_Efficiency_Cent[cent10bin]->FindBin(ptTrk); //Charge independent MC correction atm.
2158  ptWgtMC = 1.0/fFB_Efficiency_Cent[cent10bin]->GetBinContent(ptBinMC);
2159  }
2160 
2161  RefMultRawFB++;
2162  RefMultCorrFB += ptWgtMC;
2163 
2164 
2165  //------> Get NUA weights for EP <----------
2166  WgtNUA = 1.0;
2167 
2168  if(ChTrk>0){
2169  if(fHCorrectNUApos[cForNUA]){
2170  iBinNUA = fHCorrectNUApos[cForNUA]->FindBin(pVtxZ,phiTrk,etaTrk);
2171  WgtNUA = fHCorrectNUApos[cForNUA]->GetBinContent(iBinNUA);
2172  }
2173  //else{ WgtNUA = 1.0; }
2174  }
2175  else{
2176  if(fHCorrectNUAneg[cForNUA]){
2177  iBinNUA = fHCorrectNUAneg[cForNUA]->FindBin(pVtxZ,phiTrk,etaTrk);
2178  WgtNUA = fHCorrectNUAneg[cForNUA]->GetBinContent(iBinNUA);
2179  }
2180  //else{ WgtNUA = 1.0; }
2181  }
2182 
2183  if(etaTrk < -0.05){
2184  sumTPCQn2x[0] += WgtNUA*TMath::Cos(gPsiN*phiTrk);
2185  sumTPCQn2y[0] += WgtNUA*TMath::Sin(gPsiN*phiTrk);
2186  sumTPCQn3x[0] += WgtNUA*TMath::Cos(3*phiTrk);
2187  sumTPCQn3y[0] += WgtNUA*TMath::Sin(3*phiTrk);
2188  sumTPCQn4x[0] += WgtNUA*TMath::Cos(4*phiTrk);
2189  sumTPCQn4y[0] += WgtNUA*TMath::Sin(4*phiTrk);
2190  multEtaNeg++;
2191  SumWEtaNeg += WgtNUA;
2192  }
2193  else if(etaTrk > 0.05){
2194  sumTPCQn2x[1] += WgtNUA*TMath::Cos(gPsiN*phiTrk);
2195  sumTPCQn2y[1] += WgtNUA*TMath::Sin(gPsiN*phiTrk);
2196  sumTPCQn3x[1] += WgtNUA*TMath::Cos(3*phiTrk);
2197  sumTPCQn3y[1] += WgtNUA*TMath::Sin(3*phiTrk);
2198  sumTPCQn4x[1] += WgtNUA*TMath::Cos(4*phiTrk);
2199  sumTPCQn4y[1] += WgtNUA*TMath::Sin(4*phiTrk);
2200  multEtaPos++;
2201  SumWEtaPos += WgtNUA;
2202  }
2203  sumTPCQn2x[3] += WgtNUA*TMath::Cos(gPsiN*phiTrk);
2204  sumTPCQn2y[3] += WgtNUA*TMath::Sin(gPsiN*phiTrk);
2205  sumTPCQn3x[3] += WgtNUA*TMath::Cos(3*phiTrk);
2206  sumTPCQn3y[3] += WgtNUA*TMath::Sin(3*phiTrk);
2207  sumTPCQn4x[3] += WgtNUA*TMath::Cos(4*phiTrk);
2208  sumTPCQn4y[3] += WgtNUA*TMath::Sin(4*phiTrk);
2209  multEtaFull++;
2210  SumWEtaFull += WgtNUA;
2211  }// track cuts
2212  } // AOD fiter bit
2213 
2214 
2215  if(AODtrack->TestFilterBit(128)) multTPCAll++; // A. Dobrin TPC vs ESD PileUp Cut.
2216 
2217  if(!(AODtrack->TestFilterBit(1))) continue; // cuts for Outlier as in FlowEvent Task
2218 
2219  dEdx = AODtrack->GetDetPid()->GetTPCsignal();
2220 
2221  if((ptTrk < 0.2) || (ptTrk > 5.0) || (TMath::Abs(etaTrk) > 0.8) || (nClustTPC < 70) || (dEdx < 10.0) || (Chi2Trk < 0.1)) continue;
2222 
2223  if(AODtrack->GetDetPid() && Chi2Trk > 0.2) multTPC++;
2224 
2225  if(!AODtrack->TestFilterBit(16) || AODtrack->Chi2perNDF() < 0.1) continue;
2226  Double_t b[2] = {-99., -99.};
2227  Double_t bCov[3] = {-99., -99., -99.};
2228  AliAODTrack copy(*AODtrack);
2229  if(copy.PropagateToDCA(fVevent->GetPrimaryVertex(), fVevent->GetMagneticField(), 100., b, bCov) && TMath::Abs(b[0]) < 0.3 && TMath::Abs(b[1]) < 0.3) multGlobal++;
2230 
2231  }//--- track loop outlier/PileUp ----
2232 
2233 
2234 
2235 
2236 
2237 
2238  Int_t multEsd = ((AliAODHeader*)fAOD->GetHeader())->GetNumberOfESDTracks();
2239  Float_t multESDTPCDiff = (Float_t) multEsd - fPileUpSlopeParm*multTPCAll;
2240 
2241  //cout<<" Info:UserExec() called ... I am after PU cut... event = "<<fEventCount<<" \n";
2242 
2243  if(multESDTPCDiff > fPileUpConstParm) {
2244  fHistPileUpCount->Fill(7.5);
2245  bIsPileup=kTRUE;
2246  }
2247  else if(bIsPileup==kFALSE) {
2248 
2249  if(!fMultSelection->GetThisEventIsNotPileup()){
2250  fHistMultSelPUCount->Fill(0.5);
2251  bIsPileup=kTRUE;
2252  }
2253  if(!fMultSelection->GetThisEventIsNotPileupMV()){
2254  fHistMultSelPUCount->Fill(1.5);
2255  bIsPileup=kTRUE;
2256  }
2257  if(!fMultSelection->GetThisEventIsNotPileupInMultBins()){
2258  fHistMultSelPUCount->Fill(2.5);
2259  bIsPileup=kTRUE;
2260  }
2261  if(!fMultSelection->GetThisEventHasNoInconsistentVertices()){
2262  fHistMultSelPUCount->Fill(2.5);
2263  bIsPileup=kTRUE;
2264  }
2265  if(!fMultSelection->GetThisEventPassesTrackletVsCluster()){
2266  fHistMultSelPUCount->Fill(2.5);
2267  bIsPileup=kTRUE;
2268  }
2269  if(!fMultSelection->GetThisEventIsNotIncompleteDAQ()){
2270  fHistMultSelPUCount->Fill(2.5);
2271  bIsPileup=kTRUE;
2272  }
2273  if(!fMultSelection->GetThisEventHasGoodVertex2016()){
2274  fHistMultSelPUCount->Fill(2.5);
2275  bIsPileup=kTRUE;
2276  }
2277  if(bIsPileup) fHistPileUpCount->Fill(9.5);
2278  }
2279  //-----------------------------------------------------------------
2280 
2281 
2282 
2283 
2284 
2285 
2286 
2287 
2288 
2289  fHistTPCVsESDTrkBefore->Fill(multTPCAll,multEsd); //A. Dobrin
2290  fHistTPCvsGlobalMultBefore->Fill(multGlobal,multTPC);
2291 
2292 
2293  Bool_t bIsOutLier=kFALSE;
2294 
2295  if(multTPC < (-20.0+1.15*multGlobal) || multTPC > (200.+1.45*multGlobal)) { bIsOutLier = kTRUE;}
2296 
2297  fHistEventCount->Fill(stepCount); //6
2298  stepCount++;
2299 
2300 
2301  fHistTPConlyVsCL1Before->Fill(centrCL1,multTPCAll);
2302  fHistTPConlyVsV0MBefore->Fill(centrV0M,multTPCAll);
2303  fHistGlobalVsV0MBefore->Fill(centrV0M, multGlobal);
2304 
2305 
2306  //if bSkipPileUpCut is kTRUE then don't apply PileUp removal.
2307  if(!bSkipPileUpCut && bIsOutLier) return; //outlier TPC vs Global
2308 
2309  fHistTPCvsGlobalMultAfter->Fill(multGlobal,multTPC);
2310 
2311  fHistEventCount->Fill(stepCount); //7
2312  stepCount++;
2313 
2314 
2315  if(!bSkipPileUpCut && bIsPileup) return; //PileUp A. Dobrin
2316 
2317  fHistTPCVsESDTrkAfter->Fill(multTPCAll,multEsd);
2318 
2319  fHistEventCount->Fill(stepCount); //8
2320  stepCount++;
2321 
2322  //cout<<"After PU cut multTPC = "<<multTPC<<" multGlobal = "<<multGlobal<<endl;
2323 
2324 
2325 
2326 
2327 
2328  /*
2329  Int_t icentBin = centrality;
2330  icentBin++;
2331 
2332  Float_t TPCmultLowLimit = hCentvsTPCmultCuts->GetBinContent(icentBin,1);
2333  Float_t TPCmultHighLimit = hCentvsTPCmultCuts->GetBinContent(icentBin,1);
2334 
2335  TPCmultLowLimit -= 5.0 * hCentvsTPCmultCuts->GetBinContent(icentBin,2); //mean - 5sigma
2336  TPCmultHighLimit += 5.0 * hCentvsTPCmultCuts->GetBinContent(icentBin,2); //mean + 5sigma
2337  //std::cout<<" Cent = "<<centrality<<"\t icent = "<<icentBin<<" low = "<<TPCmultLowLimit<<"\t high = "<<TPCmultHighLimit<<std::endl;
2338 
2339  //centrality outlier
2340  if(!bSkipPileUpCut){ if(multTPC<TPCmultLowLimit || multTPC>TPCmultHighLimit) return; }
2341  */
2342 
2343 
2344 
2345 
2346 
2347  fHistEventCount->Fill(stepCount); //9
2348  stepCount++;
2349 
2350 
2351 
2352  fHistTPConlyVsCL1After->Fill(centrCL1,multTPCAll);
2353  fHistTPConlyVsV0MAfter->Fill(centrV0M,multTPCAll);
2354  fHistGlobalVsV0MAfter->Fill(centrV0M, multGlobal);
2355 
2356 
2357  // MC corrected Refmult:
2358  fHistRawVsCorrMultFB->Fill(RefMultRawFB,RefMultCorrFB); // FB set by AddTask..
2359 
2360 
2361  Float_t EvtCent = centrality;
2362 
2363 
2364 
2365 
2366  if(gPsiN > 0){
2367  if(multEtaNeg<2 || multEtaPos<2) return; //Minimum 2 tracks in each eta
2368  }
2369 
2370  fHistEventCount->Fill(stepCount); //10
2371  stepCount++;
2372 
2373  //--------------------------------------------------------
2374 
2375 
2376 
2377 
2378 
2379 
2380 
2381 
2382 
2383 
2384 
2385 
2386 
2387 
2388 
2389 
2390 
2391 
2392  //--------------- cent CL1 <= 90 cut ------------------
2393  Int_t icentV0Qn = centrCL1; // cent CL1 used for V0 calibration.
2394  icentV0Qn += 1;
2395 
2396  if(icentV0Qn>90) return;
2397 
2398  fHistEventCount->Fill(stepCount); //11
2399  stepCount++;
2400 
2401 
2402 
2403 
2404 
2405  //-------- V0M info ---------------
2406  const AliAODVZERO *fAODV0 = fAOD->GetVZEROData();
2407 
2408  //do v0m recentering
2409  Double_t QxanCor = 0, QyanCor = 0;
2410  Double_t QxcnCor = 0, QycnCor = 0;
2411 
2412  Double_t Qxan3 = 0., Qyan3 = 0.;
2413  Double_t Qxcn3 = 0., Qycn3 = 0.;
2414  Double_t Qxan2 = 0., Qyan2 = 0.;
2415  Double_t Qxcn2 = 0., Qycn2 = 0.;
2416 
2417  Double_t phiV0;
2418  Float_t fMultv0 = 0;
2419  Float_t sumMa = 0;
2420  Float_t sumMc = 0;
2421 
2422 
2423  if(gPsiN>0) { // Calculate EP only for gPsiN > 0
2424 
2425  for(int iV0 = 0; iV0 < 64; iV0++) { //0-31 is V0C, 32-63 VOA
2426 
2427  fMultv0 = fAODV0->GetMultiplicity(iV0);
2428 
2429  if(fHCorrectV0M){
2430  fMultv0 = fMultv0 * fHCorrectV0M->GetBinContent(iV0+1); // Gain Correction
2431  //cout<<"info: run = "<<runNumber<<" cent = "<<centrCL1<<"\t channel = "<<iV0<<" gain = "<<fHCorrectV0M->GetBinContent(iV0+1)<<endl;
2432  }
2433 
2434  fV0MultChVsRun->Fill(iV0+0.5,centrCL1,fMultv0);
2435  //fV0MultChVsRun->Fill(iV0+0.5,runindex,fMultv0);
2436 
2437  phiV0 = TMath::PiOver4()*(0.5 + iV0 % 8);
2438 
2439  if(iV0 < 32){
2440  Qxcn2 += TMath::Cos(2*phiV0) * fMultv0;
2441  Qycn2 += TMath::Sin(2*phiV0) * fMultv0;
2442  Qxcn3 += TMath::Cos(3*phiV0) * fMultv0;
2443  Qycn3 += TMath::Sin(3*phiV0) * fMultv0;
2444  sumMc += fMultv0;
2445  }
2446  else if(iV0 >= 32){
2447  Qxan2 += TMath::Cos(2*phiV0) * fMultv0;
2448  Qyan2 += TMath::Sin(2*phiV0) * fMultv0;
2449  Qxan3 += TMath::Cos(3*phiV0) * fMultv0;
2450  Qyan3 += TMath::Sin(3*phiV0) * fMultv0;
2451  sumMa += fMultv0;
2452  }
2453  }//----- channel loop ----------
2454 
2455 
2456  if(gPsiN==3){
2457  QxanCor = Qxan3/sumMa; //3rd order event plane
2458  QyanCor = Qyan3/sumMa;
2459  QxcnCor = Qxcn3/sumMc;
2460  QycnCor = Qycn3/sumMc;
2461 
2462  if(fHAvgerageQnV0C && fHAvgerageQnV0A && icentV0Qn < 91){
2463  QxanCor -= fHAvgerageQnV0A->GetBinContent(icentV0Qn,3); //x = Cos
2464  QxcnCor -= fHAvgerageQnV0C->GetBinContent(icentV0Qn,3); //x = Cos
2465  QyanCor -= fHAvgerageQnV0A->GetBinContent(icentV0Qn,4); //y = Sin
2466  QycnCor -= fHAvgerageQnV0C->GetBinContent(icentV0Qn,4); //y = Sin
2467 
2468  fV0AQ3xVsCentRun->Fill(centrCL1,QxanCor);
2469  fV0AQ3yVsCentRun->Fill(centrCL1,QyanCor);
2470  fV0CQ3xVsCentRun->Fill(centrCL1,QxcnCor);
2471  fV0CQ3yVsCentRun->Fill(centrCL1,QycnCor);
2472  }
2473  //printf("\n .... I am using my own V0 gain correction for Psi3...\n");
2474  }
2475  else{
2476  QxanCor = Qxan2/sumMa; //2nd order Event plane
2477  QyanCor = Qyan2/sumMa;
2478  QxcnCor = Qxcn2/sumMc;
2479  QycnCor = Qycn2/sumMc;
2480 
2481  if(fHAvgerageQnV0C && fHAvgerageQnV0A && icentV0Qn < 91){
2482  QxanCor -= fHAvgerageQnV0A->GetBinContent(icentV0Qn,1); //x = Cos
2483  QxcnCor -= fHAvgerageQnV0C->GetBinContent(icentV0Qn,1); //x = Cos
2484  QyanCor -= fHAvgerageQnV0A->GetBinContent(icentV0Qn,2); //y = Sin
2485  QycnCor -= fHAvgerageQnV0C->GetBinContent(icentV0Qn,2); //y = Sin
2486 
2487  fV0AQ2xVsCentRun->Fill(centrCL1,QxanCor);
2488  fV0AQ2yVsCentRun->Fill(centrCL1,QyanCor);
2489  fV0CQ2xVsCentRun->Fill(centrCL1,QxcnCor);
2490  fV0CQ2yVsCentRun->Fill(centrCL1,QycnCor);
2491  }
2492  //printf("\n .... I am using my own V0 gain correction for Psi2...\n");
2493  }
2494 
2495  //------ For V0-Qn Recenter and Event plane: Uncorrectd ----------
2497  fV0CQ2xVsCentRun->Fill(centrCL1,Qxcn2/sumMc);
2498  fV0CQ2yVsCentRun->Fill(centrCL1,Qycn2/sumMc);
2499  fV0AQ2xVsCentRun->Fill(centrCL1,Qxan2/sumMa);
2500  fV0AQ2yVsCentRun->Fill(centrCL1,Qyan2/sumMa);
2501 
2502  fV0CQ3xVsCentRun->Fill(centrCL1,Qxcn3/sumMc);
2503  fV0CQ3yVsCentRun->Fill(centrCL1,Qycn3/sumMc);
2504  fV0AQ3xVsCentRun->Fill(centrCL1,Qxan3/sumMa);
2505  fV0AQ3yVsCentRun->Fill(centrCL1,Qyan3/sumMa);
2506  }
2507 
2508  if(gPsiN>2){
2509  PsiNV0C = 1.0/gPsiN*( TMath::ATan2(QycnCor,QxcnCor) + TMath::Pi() );
2510  PsiNV0A = 1.0/gPsiN*( TMath::ATan2(QyanCor,QxanCor) + TMath::Pi() );
2511  }
2512  else{
2513  PsiNV0C = 1.0/gPsiN*TMath::ATan2(QycnCor,QxcnCor) ;
2514  if(PsiNV0C<0.) PsiNV0C += 2*TMath::Pi()/gPsiN;
2515 
2516  PsiNV0A = 1.0/gPsiN*TMath::ATan2(QyanCor,QxanCor) ;
2517  if(PsiNV0A<0.) PsiNV0A += 2*TMath::Pi()/gPsiN;
2518  }
2519 
2520 
2521  fHV0CEventPlaneVsCent->Fill(EvtCent,PsiNV0C);
2522  fHV0AEventPlaneVsCent->Fill(EvtCent,PsiNV0A);
2523 
2524  } //--------------------- if(gPsiN>0) --------------------------
2525 
2526 
2527 
2528 
2529 
2530 
2531 
2532  fEventCount++;
2533 
2534 
2535 
2536 
2537 
2538 
2539 
2540 
2541 
2542  //---- Copies of TPC-Q vectors to remove track -by- track auto-correlation -----
2543 
2544  Double_t sumQxTPCneg;
2545  Double_t sumQyTPCneg;
2546  Double_t sumQxTPCpos;
2547  Double_t sumQyTPCpos;
2548  Double_t sumQxTPCneg2;
2549  Double_t sumQyTPCneg2;
2550  Double_t sumQxTPCpos2;
2551  Double_t sumQyTPCpos2;
2552  Double_t SumWgtNeg, SumWgtPos;
2553  Double_t SumWgtNeg2, SumWgtPos2;
2554 
2555 
2556 
2557  //--------- Track variable for PID/Charge studies ----------------
2558  Double_t PDGmassPion = 0.13957;
2559  Double_t PDGmassKaon = 0.49368;
2560  Double_t PDGmassProton = 0.93827;
2561 
2562  PDGmassProton *= PDGmassProton;
2563  PDGmassPion *= PDGmassPion;
2564  PDGmassKaon *= PDGmassKaon;
2565 
2566  Double_t dEdx1, dEdx2, dPhi1, dPhi2, dPt1, dPt2;
2567  Double_t dEta1, dEta2, ptw1, ptw2, deltaPhi;
2568  Double_t mom, w1NUA, w2NUA, WgtEP;
2569  Double_t nSigTOFpion, nSigTPCpion;
2570  Double_t nSigTOFkaon, nSigTPCkaon;
2571  Double_t nSigTOFproton,nSigTPCproton;
2572  Double_t nSigTOFpion2, nSigTPCpion2;
2573  Double_t nSigTOFkaon2, nSigTPCkaon2;
2574  Double_t nSigTOFproton2,nSigTPCproton2;
2575 
2576  //Tof variables
2577  //Double_t length, tofTime, probMis, mass, beta;
2578  //Double_t c = TMath::C()*1.E-9; //bright light m/ns
2579  //Int_t TOFmatch=0;
2580 
2581 
2582 
2583  Int_t ptBin,gCharge1,gCharge2;
2584 
2585  //Double_t dcaXY, dcaZ ;
2586 
2587 
2588  //----------- Set the desired Harmonic ------------
2589  Int_t n = gN;
2590  Int_t m = gM;
2591  Int_t p =n+m;
2592  //------------------------------------------------
2593 
2594 
2595  Int_t skipPairHBT = 0;
2596 
2597 
2598 
2599 
2600 
2601  Double_t Chi2Trk1,ptwPion1,ptwKaon1,ptwProton1;
2602  Double_t Chi2Trk2,ptwPion2,ptwKaon2,ptwProton2;
2603  Double_t wNUAPion1,wNUAKaon1,wNUAProton1;
2604  Double_t wNUAPion2,wNUAKaon2,wNUAProton2;
2605 
2606  Double_t WgtEPPion = 1.0;
2607  Double_t WgtEPKaon = 1.0;
2608  Double_t WgtEPProton = 1.0;
2609 
2610 
2611  Bool_t isPion1 = kFALSE;
2612  Bool_t isKaon1 = kFALSE;
2613  Bool_t isProton1 = kFALSE;
2614  Bool_t isPion2 = kFALSE;
2615  Bool_t isKaon2 = kFALSE;
2616  Bool_t isProton2 = kFALSE;
2617 
2618  Int_t multPOI1st = 0;
2619  Int_t multPOI2nd = 0;
2620 
2621 
2622  //const Int_t maxTrack = 40000;
2623 
2624 
2625 
2626 
2627  //Calling fPIDResponse in nested loop is CPU expensive.
2628  //Store nSigma values in a array:
2629 
2630 
2631  /*
2632  for(int itrack = 0; itrack < ntracks; itrack++) {
2633 
2634  AliAODTrack *trackForPID=dynamic_cast<AliAODTrack*>(fVevent->GetTrack(itrack));
2635  if(!trackForPID) continue;
2636 
2637  // Array method:
2638  if(trackForPID){
2639  nSigPionTPC[itrack] = fPIDResponse->NumberOfSigmasTPC(trackForPID, AliPID::kPion);
2640  nSigKaonTPC[itrack] = fPIDResponse->NumberOfSigmasTPC(trackForPID, AliPID::kKaon);
2641  nSigProtonTPC[itrack] = fPIDResponse->NumberOfSigmasTPC(trackForPID, AliPID::kProton);
2642  nSigPionTOF[itrack] = fPIDResponse->NumberOfSigmasTOF(trackForPID, AliPID::kPion);
2643  nSigKaonTOF[itrack] = fPIDResponse->NumberOfSigmasTOF(trackForPID, AliPID::kKaon);
2644  nSigProtonTOF[itrack] = fPIDResponse->NumberOfSigmasTOF(trackForPID, AliPID::kProton);
2645  }
2646  else{
2647  nSigPionTPC[itrack] = -99;
2648  nSigKaonTPC[itrack] = -99;
2649  nSigProtonTPC[itrack] = -99;
2650  nSigPionTOF[itrack] = -99;
2651  nSigKaonTOF[itrack] = -99;
2652  nSigProtonTOF[itrack] = -99;
2653  }
2654 
2655  //if(itrack%10==0)
2656  //cout<< "nSig pi = " <<nSigPionTPC[itrack] << "nSig K = " << nSigKaonTPC[itrack] << "nSig p = " << nSigProtonTOF[itrack] << endl;
2657 
2658  // Vector method:
2659  //if(trackForPID){
2660  //nSigPionTPC.push_back(fPIDResponse->NumberOfSigmasTPC(trackForPID, AliPID::kPion));
2661  //nSigKaonTPC.push_back(fPIDResponse->NumberOfSigmasTPC(trackForPID, AliPID::kKaon));
2662  //nSigProtonTPC.push_back(fPIDResponse->NumberOfSigmasTPC(trackForPID, AliPID::kProton));
2663 
2664  //nSigPionTOF.push_back(fPIDResponse->NumberOfSigmasTOF(trackForPID, AliPID::kPion));
2665  //nSigKaonTOF.push_back(fPIDResponse->NumberOfSigmasTOF(trackForPID, AliPID::kKaon));
2666  //nSigProtonTOF.push_back(fPIDResponse->NumberOfSigmasTOF(trackForPID, AliPID::kProton));
2667  //}
2668  //else{
2669  //nSigPionTPC.push_back(-100.);
2670  //nSigKaonTPC.push_back(-100.);
2671  //nSigProtonTPC.push_back(-100.);
2672 
2673  //nSigPionTOF.push_back(-100.);
2674  //nSigKaonTOF.push_back(-100.);
2675  //nSigProtonTOF.push_back(-100.);
2676  //}
2677  }*/
2678 
2679 
2680 
2681 
2682 
2683 
2684  //Correct with Centrality Wgts : in second pass
2685  Int_t iCentBinWgt = (Int_t) centrality;
2686  iCentBinWgt += 1;
2687 
2688  Double_t fWgtCent = 1.0;
2689 
2690  /*
2691  if(fHCentWeightForRun){
2692  fWgtCent = fHCentWeightForRun->GetBinContent(iCentBinWgt);
2693  }*/
2694 
2695  //Fill Centrality for run-by-run: in first pass over data
2696  fCentDistAfter->Fill(centrality);
2697 
2698  //cout<<" Info:UserExec() called ... I am before track loop event = "<<fEventCount<<" \n";
2699 
2700 
2701 
2702  for(Int_t itrack = 0; itrack < ntracks; itrack++) {
2703 
2704  AliAODTrack *track=dynamic_cast<AliAODTrack*>(fVevent->GetTrack(itrack));
2705  if(!track) continue;
2706 
2707  if(!track->TestFilterBit(fFilterBit)) continue;
2708 
2709 
2710 
2711  mom = track->P();
2712  dPt1 = track->Pt();
2713  dPhi1 = track->Phi();
2714  dEta1 = track->Eta();
2715  gCharge1 = track->Charge();
2716  dEdx1 = track->GetDetPid()->GetTPCsignal();
2717  Chi2Trk1 = track->Chi2perNDF();
2718 
2719  //dcaXY = track->DCA();
2720  //dcaZ = track->ZAtDCA();
2721 
2722  /* Turn off QAs
2723  //-------------- Check TOF status ------------------
2724  AliPIDResponse::EDetPidStatus status;
2725  status = fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF,track);
2726  TOFmatch = 0;
2727  if(status==AliPIDResponse::kDetPidOk){
2728  TOFmatch++;
2729  }
2730  probMis = fPIDResponse->GetTOFMismatchProbability(track);
2731  fHistTOFMatchCount->Fill(TOFmatch,probMis);
2732 
2733  mass = -9.9;
2734  beta = -0.9;
2735 
2736  if(TOFmatch>0 && probMis < 0.01) {
2737  //This conditions are called when detector status is checked above :
2738  //if((track->IsOn(AliAODTrack::kTOFin)) && (track->IsOn(AliAODTrack::kTIME)) && (track->IsOn(AliAODTrack::kTOFout))) {
2739  //if((track->IsOn(AliAODTrack::kITSin)) && (track->IsOn(AliAODTrack::kTOFpid))) { //Naghmeh used it
2740  tofTime = track->GetTOFsignal(); // in pico seconds
2741  length = track->GetIntegratedLength();
2742  tofTime = tofTime*1.E-3; // ns
2743  if (tofTime <= 0) tofTime = 9999;
2744  length = length*0.01; // in meters
2745  tofTime = tofTime*c;
2746  beta = length/tofTime;
2747  mass = mom*mom*(1./(beta*beta) - 1);
2748  }//------------ TOF signal -------------------------
2749 
2750 
2751  //QA histograms before applying track cuts:
2752  fHistEtaPtBefore->Fill(dEta1,dPt1);
2753  fHistTPCdEdxvsPBefore->Fill(mom*gCharge1,dEdx1);
2754  fHistTOFBetavsPBefore->Fill(mom*gCharge1,beta);
2755  fHistTOFMassvsPtBefore->Fill(dPt1*gCharge1,mass); */
2756 
2757 
2758 
2759 
2760  //-------- Apply Default track cuts for analysis: ---------
2761  if((dPt1 > fMaxPtCut) || (dPt1 < fMinPtCut) || (dEta1 > fMaxEtaCut) || (dEta1 < fMinEtaCut) || (dEdx1 < fdEdxMin) || (track->GetTPCNcls() < fTPCclustMin) || (Chi2Trk1 < fTrkChi2Min) || (Chi2Trk1 > 4.0) || (track->DCA() > fDCAxyMax) || (track->ZAtDCA() > fDCAzMax) || !(TMath::Abs(gCharge1)))
2762  continue;
2763 
2764  multPOI1st++;
2765 
2766 
2767 
2768  //--------------------- PID signals 1st track-------------------------
2769  /*nSigTOFpion = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kPion);
2770  nSigTOFkaon = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kKaon);
2771  nSigTOFproton = fPIDResponse->NumberOfSigmasTOF(track, AliPID::kProton);
2772  nSigTPCpion = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kPion);
2773  nSigTPCkaon = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kKaon);
2774  nSigTPCproton = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kProton);*/
2775 
2776 
2777 
2778  //Vector/Array both works same way:
2779  nSigTPCpion = nSigPionTPC[itrack];
2780  nSigTPCkaon = nSigKaonTPC[itrack];
2781  nSigTPCproton = nSigProtonTPC[itrack];
2782  nSigTOFpion = nSigPionTOF[itrack];
2783  nSigTOFkaon = nSigKaonTOF[itrack];
2784  nSigTOFproton = nSigProtonTOF[itrack];
2785 
2786 
2787 
2788  //if(itrack%100==0)
2789  //cout<<"Trk "<<itrack<<" pt1 = "<<dPt1<<"\tnSigPion = "<<nSigTPCpion<<"\tnSigKaon = "<<nSigTPCkaon <<"\tnSigprot = "<<nSigTPCproton<<endl;
2790 
2791  isPion1 = kFALSE;
2792  isKaon1 = kFALSE;
2793  isProton1 = kFALSE;
2794 
2795 
2796  /*
2797  //------> Pion
2798  if(dPt1<0.6 && TMath::Abs(nSigTPCpion)<=2.5){
2799  isPion1 = kTRUE;
2800  }
2801  else if(dPt1>=0.6 && dPt1<=2.0 && TMath::Abs(nSigTPCpion)<=2.5 && TMath::Abs(nSigTOFpion)<=2.0 ){
2802  isPion1 = kTRUE;
2803  }
2804  //------> Kaon
2805  if(dPt1<0.6 && TMath::Abs(nSigTPCkaon)<=2.5){
2806  isKaon1 = kTRUE;
2807  }
2808  else if(dPt1>=0.6 && dPt1<=2.0 && TMath::Abs(nSigTPCkaon)<=2.5 && TMath::Abs(nSigTOFkaon)<=2.0){
2809  isKaon1 = kTRUE;
2810  }
2811  //------> Proton
2812  if(dPt1<0.8 && TMath::Abs(nSigTPCproton)<=2.5){
2813  isProton1 = kTRUE;
2814  }
2815  else if(dPt1>=0.8 && dPt1<=3.5 && TMath::Abs(nSigTPCproton)<=2.5 && TMath::Abs(nSigTOFproton)<=2.5){
2816  isProton1 = kTRUE;
2817  }
2818  //Proton below 0.4 GeV is garbage
2819  if(dPt1<0.4) isProton1 = kFALSE;
2820  */
2821 
2822  //------> Pion
2823  if(dPt1<=0.6 && TMath::Abs(nSigTPCpion)<=3.0){
2824  isPion1 = kTRUE;
2825  }
2826  else if(dPt1>0.6 && dPt1<=2.0 && TMath::Abs(nSigTPCpion)<=3.0 && TMath::Abs(nSigTOFpion)<=2.0 ){
2827  isPion1 = kTRUE;
2828  }
2829  //------> Kaon
2830  if(dPt1<=0.45 && TMath::Abs(nSigTPCkaon)<=3.0){
2831  isKaon1 = kTRUE;
2832  }
2833  else if(dPt1>0.45 && dPt1<=2.0 && TMath::Abs(nSigTPCkaon)<=3.0 && TMath::Abs(nSigTOFkaon)<=2.0){
2834  isKaon1 = kTRUE;
2835  }
2836  //------> Proton
2837  if(dPt1<=0.8 && TMath::Abs(nSigTPCproton)<=3.0){
2838  isProton1 = kTRUE;
2839  if(dPt1<0.4) isProton1 = kFALSE; //Proton below 0.4 GeV is garbage
2840  }
2841  else if(dPt1>0.8 && dPt1<=2.0 && TMath::Abs(nSigTPCproton)<=3.0 && TMath::Abs(nSigTOFproton)<=3.0){ //0.8 to 3.5 was used earlier.
2842  isProton1 = kTRUE;
2843  }
2844 
2845 
2846 
2847 
2848 
2849 
2850 
2851 
2852 
2853  //================= MC wgt and NUA wgt for PID =================
2854  ptwPion1 = 1.0;
2855  ptwKaon1 = 1.0;
2856  ptwProton1 = 1.0;
2857  wNUAPion1 = 1.0;
2858  wNUAKaon1 = 1.0;
2859  wNUAProton1 = 1.0;
2860 
2861  //------ get MC weight and NUA for Pion track1 --------------
2862  if(isPion1){
2863  if(fFB_Efficiency_Pion_Cent[cent10bin]){ // <-------------------- !!!! WARNING: use Pion Efficiency file when available.
2864  ptBin = fFB_Efficiency_Pion_Cent[cent10bin]->FindBin(dPt1);
2865  ptwPion1 = 1.0/fFB_Efficiency_Pion_Cent[cent10bin]->GetBinContent(ptBin);
2866  }
2867  //else{ ptwPion1 = 1.0; }
2868 
2869  if(gCharge1>0){
2870  if(fHCorrectNUAposPion[cForNUA]){
2871  iBinNUA = fHCorrectNUAposPion[cForNUA]->FindBin(pVtxZ,dPhi1,dEta1);
2872  wNUAPion1 = fHCorrectNUAposPion[cForNUA]->GetBinContent(iBinNUA);
2873  }
2874  //else{ wNUAPion1 = 1.0; }
2875  }
2876  else{
2877  if(fHCorrectNUAnegPion[cForNUA]){
2878  iBinNUA = fHCorrectNUAnegPion[cForNUA]->FindBin(pVtxZ,dPhi1,dEta1);
2879  wNUAPion1 = fHCorrectNUAnegPion[cForNUA]->GetBinContent(iBinNUA);
2880  }
2881  //else{ wNUAPion1 = 1.0; }
2882  }
2883  }
2884 
2885 
2886  //------ get MC weight and NUA for Kaon track1 --------------
2887  if(isKaon1){
2888  if(fFB_Efficiency_Kaon_Cent[cent10bin]){ // <-------------------- !!!! WARNING: use Kaon Efficiency file when available.
2889  ptBin = fFB_Efficiency_Kaon_Cent[cent10bin]->FindBin(dPt1);
2890  ptwKaon1 = 1.0/fFB_Efficiency_Kaon_Cent[cent10bin]->GetBinContent(ptBin);
2891  }
2892  //else{ ptwKaon1 = 1.0; }
2893 
2894  if(gCharge1>0){
2895  if(fHCorrectNUAposKaon[cForNUA]){
2896  iBinNUA = fHCorrectNUAposKaon[cForNUA]->FindBin(pVtxZ,dPhi1,dEta1);
2897  wNUAKaon1 = fHCorrectNUAposKaon[cForNUA]->GetBinContent(iBinNUA);
2898  }
2899  //else{ wNUAKaon1 = 1.0; }
2900  }
2901  else{
2902  if(fHCorrectNUAnegKaon[cForNUA]){
2903  iBinNUA = fHCorrectNUAnegKaon[cForNUA]->FindBin(pVtxZ,dPhi1,dEta1);
2904  wNUAKaon1 = fHCorrectNUAnegKaon[cForNUA]->GetBinContent(iBinNUA);
2905  }
2906  //else{ wNUAKaon1 = 1.0; }
2907  }
2908  }
2909  //------ get MC weight and NUA for Proton track1 --------------
2910  if(isProton1){
2911  if(gCharge1>0){
2912  if(fFB_Efficiency_Proton_Pos_Cent[cent10bin]){ // <-------------------- !!!! WARNING: use Proton Efficiency file when available.
2913  ptBin = fFB_Efficiency_Proton_Pos_Cent[cent10bin]->FindBin(dPt1);
2914  ptwProton1 = 1.0/fFB_Efficiency_Proton_Pos_Cent[cent10bin]->GetBinContent(ptBin);
2915  }
2916  if(fHCorrectNUAposProton[cForNUA]){
2917  iBinNUA = fHCorrectNUAposProton[cForNUA]->FindBin(pVtxZ,dPhi1,dEta1);
2918  wNUAProton1 = fHCorrectNUAposProton[cForNUA]->GetBinContent(iBinNUA);
2919  }
2920  }
2921  else{
2922  if(fFB_Efficiency_Proton_Neg_Cent[cent10bin]){ // <-------------------- !!!! WARNING: use Proton Efficiency file when available.
2923  ptBin = fFB_Efficiency_Proton_Neg_Cent[cent10bin]->FindBin(dPt1);
2924  ptwProton1 = 1.0/fFB_Efficiency_Proton_Neg_Cent[cent10bin]->GetBinContent(ptBin);
2925  }
2926  if(fHCorrectNUAnegProton[cForNUA]){
2927  iBinNUA = fHCorrectNUAnegProton[cForNUA]->FindBin(pVtxZ,dPhi1,dEta1);
2928  wNUAProton1 = fHCorrectNUAnegProton[cForNUA]->GetBinContent(iBinNUA);
2929  }
2930  }
2931  //else{ ptwProton1 = 1.0; }
2932  }
2933  //=========================== X ===============================
2934 
2935 
2936 
2937  //------ get MC weight and NUA for Charged track 1--------------
2938  ptw1 = 1.0;
2939  w1NUA = 1.0;
2940 
2941  if(fFB_Efficiency_Cent[cent10bin]){
2942  ptBin = fFB_Efficiency_Cent[cent10bin]->FindBin(dPt1);
2943  ptw1 = 1.0/fFB_Efficiency_Cent[cent10bin]->GetBinContent(ptBin);
2944  }
2945  //else{ ptw1 = 1.0; }
2946 
2947  if(gCharge1>0){
2948  if(fHCorrectNUApos[cForNUA]){
2949  iBinNUA = fHCorrectNUApos[cForNUA]->FindBin(pVtxZ,dPhi1,dEta1);
2950  w1NUA = fHCorrectNUApos[cForNUA]->GetBinContent(iBinNUA);
2951  }
2952  //else{ w1NUA = 1.0; }
2953  }
2954  else{
2955  if(fHCorrectNUAneg[cForNUA]){
2956  iBinNUA = fHCorrectNUAneg[cForNUA]->FindBin(pVtxZ,dPhi1,dEta1);
2957  w1NUA = fHCorrectNUAneg[cForNUA]->GetBinContent(iBinNUA);
2958  }
2959  //else{ w1NUA = 1.0; }
2960  }
2961 
2962  if(w1NUA==0) w1NUA = 1.0;
2963 
2964 
2965 
2966  //============= charged hadron analysis: ============
2967  sumQxTPCneg = sumTPCQn2x[0]; // first copy to remove 1st track fron Q vector (AutoCorrelation)
2968  sumQyTPCneg = sumTPCQn2y[0];
2969  sumQxTPCpos = sumTPCQn2x[1];
2970  sumQyTPCpos = sumTPCQn2y[1];
2971  SumWgtNeg = SumWEtaNeg;
2972  SumWgtPos = SumWEtaPos;
2973 
2974  //-------- Remove phi1 from EP calculation ----------
2975 
2976  if(dEta1 < -0.05){
2977  sumQxTPCneg -= w1NUA*TMath::Cos(gPsiN*dPhi1);
2978  sumQyTPCneg -= w1NUA*TMath::Sin(gPsiN*dPhi1); // [0] = eta <-0.05
2979  SumWgtNeg -= w1NUA;
2980  }
2981  else if(dEta1 > 0.05){
2982  sumQxTPCpos -= w1NUA*TMath::Cos(gPsiN*dPhi1);
2983  sumQyTPCpos -= w1NUA*TMath::Sin(gPsiN*dPhi1); // [1] = eta > 0.05
2984  SumWgtPos -= w1NUA;
2985  }
2986  //-----------------------------------------------------
2987 
2988 
2989 
2990 
2991 
2992 
2993 
2994 
2995 
2996 
2997 
2998 
2999  multPOI2nd = 0;
3000 
3001  //---2nd track loop (nested)---
3002  for(Int_t jtrack = 0; jtrack < ntracks; jtrack++) {
3003 
3004  if(jtrack==itrack) continue;
3005 
3006  if(n==0) continue;
3007 
3008  AliAODTrack *track2=dynamic_cast<AliAODTrack*>(fVevent->GetTrack(jtrack));
3009  if(!track2) continue;
3010 
3011  if(!(track2->TestFilterBit(fFilterBit))) continue;
3012 
3013  dPt2 = track2->Pt();
3014  dPhi2 = track2->Phi();
3015  dEta2 = track2->Eta();
3016  gCharge2= track2->Charge();
3017  dEdx2 = track2->GetDetPid()->GetTPCsignal();
3018  Chi2Trk2 = track2->Chi2perNDF();
3019 
3020  if((dPt2 > fMaxPtCut) || (dPt2 < fMinPtCut) || (dEta2 > fMaxEtaCut) || (dEta2 < fMinEtaCut) || (dEdx2 < fdEdxMin) || (track2->GetTPCNcls() < fTPCclustMin) || (Chi2Trk2 < fTrkChi2Min) || (Chi2Trk2 > 4.0) || (track2->DCA() > fDCAxyMax) || (track2->ZAtDCA() > fDCAzMax) || !(TMath::Abs(gCharge2)))
3021  continue;
3022 
3023  multPOI2nd++;
3024 
3025 
3026 
3027  /*
3028  if(track2->GetDetPid()->GetTPCsignal() < 10.0) continue;
3029  if(track2->GetTPCNcls() < 70) continue;
3030  if(track2->Chi2perNDF() < 0.2) continue;
3031  if(dPt2 < fMinPtCut || dPt2 > fMaxPtCut) continue;
3032  if(dEta2< fMinEtaCut || dEta2 > fMaxEtaCut) continue;
3033  if(!TMath::Abs(gCharge2)) continue;
3034  //if(!(track2->TestFilterBit(fFilterBit))) continue; */
3035  //-----------------------------------------------------
3036 
3037  //calling fPIDResponse is too costly for CPU
3038  //--------------------- PID signals 2nd track-------------------------
3039  /*nSigTOFpion2 = fPIDResponse->NumberOfSigmasTOF(track2, AliPID::kPion);
3040  nSigTOFkaon2 = fPIDResponse->NumberOfSigmasTOF(track2, AliPID::kKaon);
3041  nSigTOFproton2 = fPIDResponse->NumberOfSigmasTOF(track2, AliPID::kProton);
3042  nSigTPCpion2 = fPIDResponse->NumberOfSigmasTPC(track2, AliPID::kPion);
3043  nSigTPCkaon2 = fPIDResponse->NumberOfSigmasTPC(track2, AliPID::kKaon);
3044  nSigTPCproton2 = fPIDResponse->NumberOfSigmasTPC(track2, AliPID::kProton); */
3045 
3046 
3047 
3048  //Vector/Array both works same way:
3049  nSigTPCpion2 = nSigPionTPC[jtrack];
3050  nSigTPCkaon2 = nSigKaonTPC[jtrack];
3051  nSigTPCproton2 = nSigProtonTPC[jtrack];
3052  nSigTOFpion2 = nSigPionTOF[jtrack];
3053  nSigTOFkaon2 = nSigKaonTOF[jtrack];
3054  nSigTOFproton2 = nSigProtonTOF[jtrack];
3055 
3056 
3057 
3058 
3059 
3060  isPion2 = kFALSE;
3061  isKaon2 = kFALSE;
3062  isProton2 = kFALSE;
3063 
3064 
3065 
3066  //------> Pion
3067  if(dPt2<=0.6 && TMath::Abs(nSigTPCpion2)<=3.0){
3068  isPion2 = kTRUE;
3069  }
3070  else if(dPt2>0.6 && dPt2<=2.0 && TMath::Abs(nSigTPCpion2)<=3.0 && TMath::Abs(nSigTOFpion2)<=2.0 ){
3071  isPion2 = kTRUE;
3072  }
3073  //------> Kaon
3074  if(dPt2<=0.45 && TMath::Abs(nSigTPCkaon2)<=3.0){
3075  isKaon2 = kTRUE;
3076  }
3077  else if(dPt2>0.45 && dPt2<=2.0 && TMath::Abs(nSigTPCkaon2)<=3.0 && TMath::Abs(nSigTOFkaon2)<=2.0){
3078  isKaon2 = kTRUE;
3079  }
3080  //------> Proton
3081  if(dPt2<=0.8 && TMath::Abs(nSigTPCproton2)<=3.0){
3082  isProton2 = kTRUE;
3083  if(dPt2<0.4) isProton2 = kFALSE; //Proton below 0.4 GeV is garbage
3084  }
3085  else if(dPt2>0.8 && dPt2<=2.0 && TMath::Abs(nSigTPCproton2)<=3.0 && TMath::Abs(nSigTOFproton2)<=3.0){ //0.8 to 3.5 was used earlier.
3086  isProton2 = kTRUE;
3087  }
3088 
3089 
3090  /*
3091  //------> Pion 2
3092  if(dPt2<0.6 && TMath::Abs(nSigTPCpion2)<=2.5){
3093  isPion2 = kTRUE;
3094  }
3095  else if(dPt2>=0.6 && dPt2<=2.0 && TMath::Abs(nSigTPCpion2)<=2.5 && TMath::Abs(nSigTOFpion2)<=2.0 ){
3096  isPion2 = kTRUE;
3097  }
3098  //------> Kaon 2
3099  if(dPt2<0.6 && TMath::Abs(nSigTPCkaon2)<=2.5){
3100  isKaon2 = kTRUE;
3101  }
3102  else if(dPt2>=0.6 && dPt2<=2.0 && TMath::Abs(nSigTPCkaon2)<=2.5 && TMath::Abs(nSigTOFkaon2)<=2.0){
3103  isKaon2 = kTRUE;
3104  }
3105  //------> Proton 2
3106  if(dPt2<0.8 && TMath::Abs(nSigTPCproton2)<=2.5){
3107  isProton2 = kTRUE;
3108  }
3109  else if(dPt2>=0.8 && dPt2<=3.5 && TMath::Abs(nSigTPCproton2)<=2.5 && TMath::Abs(nSigTOFproton2)<=2.5){
3110  isProton2 = kTRUE;
3111  }
3112  //Proton below 0.4 GeV is garbage
3113  if(dPt2<0.4) isProton2 = kFALSE;
3114  */
3115  //----------------------------------------------------------------
3116 
3117 
3118 
3119 
3120 
3121  //================= MC wgt and NUA wgt for PID =================
3122  WgtEPPion = 1.0;
3123  WgtEPKaon = 1.0;
3124  WgtEPProton = 1.0;
3125 
3126  ptwPion2 = 1.0;
3127  ptwKaon2 = 1.0;
3128  ptwProton2 = 1.0;
3129  wNUAPion2 = 1.0;
3130  wNUAKaon2 = 1.0;
3131  wNUAProton2 = 1.0;
3132 
3133  //------ get MC weight and NUA for Pion track2 --------------
3134  if(isPion2){
3135  if(fFB_Efficiency_Pion_Cent[cent10bin]){
3136  ptBin = fFB_Efficiency_Pion_Cent[cent10bin]->FindBin(dPt2);
3137  ptwPion2 = 1.0/fFB_Efficiency_Pion_Cent[cent10bin]->GetBinContent(ptBin);
3138  }
3139  //else{ ptwPion2 = 1.0; }
3140 
3141  if(gCharge2>0){
3142  if(fHCorrectNUAposPion[cForNUA]){
3143  iBinNUA = fHCorrectNUAposPion[cForNUA]->FindBin(pVtxZ,dPhi2,dEta2);
3144  wNUAPion2 = fHCorrectNUAposPion[cForNUA]->GetBinContent(iBinNUA);
3145  }
3146  //else{ wNUAPion2 = 1.0; }
3147  }
3148  else{
3149  if(fHCorrectNUAnegPion[cForNUA]){
3150  iBinNUA = fHCorrectNUAnegPion[cForNUA]->FindBin(pVtxZ,dPhi2,dEta2);
3151  wNUAPion2 = fHCorrectNUAnegPion[cForNUA]->GetBinContent(iBinNUA);
3152  }
3153  //else{ wNUAPion2 = 1.0; }
3154  }
3155 
3156  WgtEPPion = ptwPion1*ptwPion2*wNUAPion1*wNUAPion2;
3157  }
3158 
3159  //------ get MC weight and NUA for Kaon track2 --------------
3160  if(isKaon2){
3161  if(fFB_Efficiency_Kaon_Cent[cent10bin]){
3162  ptBin = fFB_Efficiency_Kaon_Cent[cent10bin]->FindBin(dPt2);
3163  ptwKaon2 = 1.0/fFB_Efficiency_Kaon_Cent[cent10bin]->GetBinContent(ptBin);
3164  }
3165  //else{ ptwKaon2 = 1.0; }
3166 
3167  if(gCharge2>0){
3168  if(fHCorrectNUAposKaon[cForNUA]){
3169  iBinNUA = fHCorrectNUAposKaon[cForNUA]->FindBin(pVtxZ,dPhi2,dEta2);
3170  wNUAKaon2 = fHCorrectNUAposKaon[cForNUA]->GetBinContent(iBinNUA);
3171  }
3172  //else{ wNUAKaon2 = 1.0; }
3173  }
3174  else{
3175  if(fHCorrectNUAnegKaon[cForNUA]){
3176  iBinNUA = fHCorrectNUAnegKaon[cForNUA]->FindBin(pVtxZ,dPhi2,dEta2);
3177  wNUAKaon2 = fHCorrectNUAnegKaon[cForNUA]->GetBinContent(iBinNUA);
3178  }
3179  //else{ wNUAKaon2 = 1.0; }
3180  }
3181 
3182  WgtEPKaon = ptwKaon1*ptwKaon2*wNUAKaon1*wNUAKaon2;
3183  }
3184 
3185  //------ get MC weight and NUA for Proton track2 --------------
3186  if(isProton2){
3187  if(gCharge2>0){
3188  if(fFB_Efficiency_Proton_Pos_Cent[cent10bin]){
3189  ptBin = fFB_Efficiency_Proton_Pos_Cent[cent10bin]->FindBin(dPt2);
3190  ptwProton2 = 1.0/fFB_Efficiency_Proton_Pos_Cent[cent10bin]->GetBinContent(ptBin);
3191  }
3192  if(fHCorrectNUAposProton[cForNUA]){
3193  iBinNUA = fHCorrectNUAposProton[cForNUA]->FindBin(pVtxZ,dPhi2,dEta2);
3194  wNUAProton2 = fHCorrectNUAposProton[cForNUA]->GetBinContent(iBinNUA);
3195  }
3196  }
3197  else{
3198  if(fFB_Efficiency_Proton_Neg_Cent[cent10bin]){
3199  ptBin = fFB_Efficiency_Proton_Neg_Cent[cent10bin]->FindBin(dPt2);
3200  ptwProton2 = 1.0/fFB_Efficiency_Proton_Neg_Cent[cent10bin]->GetBinContent(ptBin);
3201  }
3202  if(fHCorrectNUAnegProton[cForNUA]){
3203  iBinNUA = fHCorrectNUAnegProton[cForNUA]->FindBin(pVtxZ,dPhi2,dEta2);
3204  wNUAProton2 = fHCorrectNUAnegProton[cForNUA]->GetBinContent(iBinNUA);
3205  }
3206  }
3207  //else{ ptwProton2 = 1.0; }
3208  WgtEPProton = ptwProton1*ptwProton2*wNUAProton1*wNUAProton2;
3209  }
3210  //========================== X ================================
3211 
3212 
3213 
3214 
3215 
3216  //------ get MC weight and NUA (Charged) for track 2--------------
3217  WgtEP = 1.0;
3218  ptw2 = 1.0;
3219  w2NUA = 1.0;
3220 
3221  if(fFB_Efficiency_Cent[cent10bin]){
3222  ptBin = fFB_Efficiency_Cent[cent10bin]->FindBin(dPt2);
3223  ptw2 = 1.0/fFB_Efficiency_Cent[cent10bin]->GetBinContent(ptBin);
3224  }
3225  //else{ ptw2 = 1.0; }
3226 
3227  if(gCharge2>0){
3228  if(fHCorrectNUApos[cForNUA]){
3229  iBinNUA = fHCorrectNUApos[cForNUA]->FindBin(pVtxZ,dPhi2,dEta2);
3230  w2NUA = fHCorrectNUApos[cForNUA]->GetBinContent(iBinNUA);
3231  }
3232  //else{ w2NUA = 1.0; }
3233  }
3234  else{
3235  if(fHCorrectNUAneg[cForNUA]){
3236  iBinNUA = fHCorrectNUAneg[cForNUA]->FindBin(pVtxZ,dPhi2,dEta2);
3237  w2NUA = fHCorrectNUAneg[cForNUA]->GetBinContent(iBinNUA);
3238  }
3239  //else{ w2NUA = 1.0; }
3240  }
3241 
3242  if(w2NUA==0) w2NUA = 1.0;
3243 
3244 
3245 
3246 
3247 
3248 
3249 
3250 
3251 
3252 
3253 
3254 
3255  //---------- Remove track2 from EP calculation ---------
3256  sumQxTPCneg2 = sumQxTPCneg; //second copy to remove 2nd track from EP
3257  sumQyTPCneg2 = sumQyTPCneg;
3258  sumQxTPCpos2 = sumQxTPCpos;
3259  sumQyTPCpos2 = sumQyTPCpos;
3260  SumWgtNeg2 = SumWgtNeg;
3261  SumWgtPos2 = SumWgtPos;
3262  //------------------------------------------------------
3263 
3264 
3265 
3266  if(dEta2 < -0.05){
3267  sumQxTPCneg2 -= w2NUA*TMath::Cos(gPsiN*dPhi2);
3268  sumQyTPCneg2 -= w2NUA*TMath::Sin(gPsiN*dPhi2); // [0] = eta <-0.05
3269  SumWgtNeg2 -= w2NUA;
3270  }
3271  else if(dEta2 > 0.05){
3272  sumQxTPCpos2 -= w2NUA*TMath::Cos(gPsiN*dPhi2);
3273  sumQyTPCpos2 -= w2NUA*TMath::Sin(gPsiN*dPhi2); // [1] = eta > 0.05
3274  SumWgtPos2 -= w2NUA;
3275  }
3276 
3277  if(SumWgtNeg2>0 && SumWgtPos2>0){
3278  sumQyTPCneg2 = sumQyTPCneg2/SumWgtNeg2;
3279  sumQxTPCneg2 = sumQxTPCneg2/SumWgtNeg2;
3280 
3281  sumQyTPCpos2 = sumQyTPCpos2/SumWgtPos2;
3282  sumQxTPCpos2 = sumQxTPCpos2/SumWgtPos2;
3283  }
3284 
3285  // track by track EP:
3286  if(gPsiN>0){
3287  PsiNTPCC = (1.0/gPsiN)*( TMath::ATan2(sumQyTPCneg2,sumQxTPCneg2) ) ; // negetive eta
3288  if(PsiNTPCC<0.) PsiNTPCC += 2*TMath::Pi()/gPsiN;
3289 
3290  PsiNTPCA = (1.0/gPsiN)*( TMath::ATan2(sumQyTPCpos2,sumQxTPCpos2) ) ; // positive eta
3291  if(PsiNTPCA<0.) PsiNTPCA += 2*TMath::Pi()/gPsiN;
3292  }
3293 
3294  //fHTPCAEventPlaneVsCent->Fill(EvtCent,PsiNTPCA);
3295  //fHTPCCEventPlaneVsCent->Fill(EvtCent,PsiNTPCC);
3296  //-----------------------------------------------------------
3297 
3298 
3299 
3300 
3301  // combined weight for EP:
3302  WgtEP = ptw1*ptw2*w1NUA*w2NUA;
3303 
3304 
3305 
3306  deltaPhi = dPhi1 - dPhi2; //for 2p correlator
3307 
3309 
3310  if(gCharge1!=gCharge2) {
3311  fHist_Corr3p_EP_Norm_PN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3312  fHist_Corr3p_EP_Norm_PN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3313  fHist_Corr3p_EP_Norm_PN[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3314  fHist_Corr3p_EP_Norm_PN[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3315  /*
3316  fHist_Corr3p_EP_Refm_PN[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3317  fHist_Corr3p_EP_Refm_PN[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3318  fHist_Corr3p_EP_Refm_PN[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3319  fHist_Corr3p_EP_Refm_PN[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3320  */
3321  //Differential
3322  if(cIndex<6){
3323  fHist_Corr3p_pTSum_EP_V0A_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEP*fWgtCent);
3324  fHist_Corr3p_pTSum_EP_V0C_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEP*fWgtCent);
3325  fHist_Corr3p_pTDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEP*fWgtCent);
3326  fHist_Corr3p_pTDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEP*fWgtCent);
3327  fHist_Corr3p_EtaDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEP*fWgtCent);
3328  fHist_Corr3p_EtaDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEP*fWgtCent);
3329  }
3330  //-------------> PID CME ---------------
3331  //Pion:
3332  if(isPion1 && isPion2){
3333  fHist_Corr3p_Pion_EP_Norm_PN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEPPion*fWgtCent);
3334  fHist_Corr3p_Pion_EP_Norm_PN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEPPion*fWgtCent);
3335  fHist_Corr3p_Pion_EP_Norm_PN[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEPPion*fWgtCent);
3336  fHist_Corr3p_Pion_EP_Norm_PN[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEPPion*fWgtCent);
3337  /*
3338  fHist_Corr3p_Pion_EP_Refm_PN[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3339  fHist_Corr3p_Pion_EP_Refm_PN[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3340  fHist_Corr3p_Pion_EP_Refm_PN[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3341  fHist_Corr3p_Pion_EP_Refm_PN[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3342 
3343  //Differential:
3344  if(cIndex<6){
3345  fHist_Corr3p_Pion_pTSum_EP_V0A_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPPion*fWgtCent);
3346  fHist_Corr3p_Pion_pTSum_EP_V0C_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPPion*fWgtCent);
3347  fHist_Corr3p_Pion_pTDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPPion*fWgtCent);
3348  fHist_Corr3p_Pion_pTDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPPion*fWgtCent);
3349  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPPion*fWgtCent);
3350  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPPion*fWgtCent);
3351  }
3352  */
3353  }
3354  //Kaon:
3355  if(isKaon1 && isKaon2){
3356  fHist_Corr3p_Kaon_EP_Norm_PN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEPKaon*fWgtCent);
3357  fHist_Corr3p_Kaon_EP_Norm_PN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEPKaon*fWgtCent);
3358  fHist_Corr3p_Kaon_EP_Norm_PN[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEPKaon*fWgtCent);
3359  fHist_Corr3p_Kaon_EP_Norm_PN[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEPKaon*fWgtCent);
3360  /*
3361  fHist_Corr3p_Kaon_EP_Refm_PN[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3362  fHist_Corr3p_Kaon_EP_Refm_PN[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3363  fHist_Corr3p_Kaon_EP_Refm_PN[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3364  fHist_Corr3p_Kaon_EP_Refm_PN[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3365 
3366  //Differential:
3367  if(cIndex<6){
3368  fHist_Corr3p_Kaon_pTSum_EP_V0A_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPKaon*fWgtCent);
3369  fHist_Corr3p_Kaon_pTSum_EP_V0C_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPKaon*fWgtCent);
3370  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPKaon*fWgtCent);
3371  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPKaon*fWgtCent);
3372  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPKaon*fWgtCent);
3373  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPKaon*fWgtCent);
3374  }
3375  */
3376  }
3377  //Proton:
3378  if(isProton1 && isProton2){
3379  //cout<<"#pair pt1 = "<<dPt1<<"\tpt2 = "<<dPt2<<"\tnSigp1 = "<<nSigTPCproton<<"\tnSigp2 = "<<nSigTPCproton2<<endl;
3380  fHist_Corr3p_Proton_EP_Norm_PN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEPProton*fWgtCent);
3381  fHist_Corr3p_Proton_EP_Norm_PN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEPProton*fWgtCent);
3382  fHist_Corr3p_Proton_EP_Norm_PN[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEPProton*fWgtCent);
3383  fHist_Corr3p_Proton_EP_Norm_PN[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEPProton*fWgtCent);
3384  /*
3385  fHist_Corr3p_Proton_EP_Refm_PN[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3386  fHist_Corr3p_Proton_EP_Refm_PN[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3387  fHist_Corr3p_Proton_EP_Refm_PN[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3388  fHist_Corr3p_Proton_EP_Refm_PN[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3389 
3390  //Differential:
3391  if(cIndex<6){
3392  fHist_Corr3p_Proton_pTSum_EP_V0A_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPProton*fWgtCent);
3393  fHist_Corr3p_Proton_pTSum_EP_V0C_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPProton*fWgtCent);
3394  fHist_Corr3p_Proton_pTDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPProton*fWgtCent);
3395  fHist_Corr3p_Proton_pTDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPProton*fWgtCent);
3396  fHist_Corr3p_Proton_EtaDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPProton*fWgtCent);
3397  fHist_Corr3p_Proton_EtaDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPProton*fWgtCent);
3398  }
3399  */
3400  }
3401  //------------------------------------
3402  }
3403 
3404 
3405 
3407 
3408 
3409 
3410  else if(gCharge1>0 && gCharge2>0 && skipPairHBT==0) {
3411  fHist_Corr3p_EP_Norm_PP[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3412  fHist_Corr3p_EP_Norm_PP[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3413  fHist_Corr3p_EP_Norm_PP[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3414  fHist_Corr3p_EP_Norm_PP[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3415  /*
3416  fHist_Corr3p_EP_Refm_PP[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3417  fHist_Corr3p_EP_Refm_PP[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3418  fHist_Corr3p_EP_Refm_PP[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3419  fHist_Corr3p_EP_Refm_PP[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3420  */
3421 
3422  //Differential:
3423  if(cIndex<6){
3424  fHist_Corr3p_pTSum_EP_V0A_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEP*fWgtCent);
3425  fHist_Corr3p_pTSum_EP_V0C_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEP*fWgtCent);
3426  fHist_Corr3p_pTDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEP*fWgtCent);
3427  fHist_Corr3p_pTDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEP*fWgtCent);
3428  fHist_Corr3p_EtaDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEP*fWgtCent);
3429  fHist_Corr3p_EtaDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEP*fWgtCent);
3430  }
3431  //-------------> PID CME ---------------
3432  //Pion:
3433  if(isPion1 && isPion2){
3434  fHist_Corr3p_Pion_EP_Norm_PP[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEPPion*fWgtCent);
3435  fHist_Corr3p_Pion_EP_Norm_PP[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEPPion*fWgtCent);
3436  fHist_Corr3p_Pion_EP_Norm_PP[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEPPion*fWgtCent);
3437  fHist_Corr3p_Pion_EP_Norm_PP[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEPPion*fWgtCent);
3438  /*
3439  fHist_Corr3p_Pion_EP_Refm_PP[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3440  fHist_Corr3p_Pion_EP_Refm_PP[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3441  fHist_Corr3p_Pion_EP_Refm_PP[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3442  fHist_Corr3p_Pion_EP_Refm_PP[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3443 
3444  //Differential:
3445  if(cIndex<6){
3446  fHist_Corr3p_Pion_pTSum_EP_V0A_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPPion*fWgtCent);
3447  fHist_Corr3p_Pion_pTSum_EP_V0C_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPPion*fWgtCent);
3448  fHist_Corr3p_Pion_pTDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPPion*fWgtCent);
3449  fHist_Corr3p_Pion_pTDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPPion*fWgtCent);
3450  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPPion*fWgtCent);
3451  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPPion*fWgtCent);
3452  }
3453  */
3454  }
3455  //Kaon:
3456  if(isKaon1 && isKaon2){
3457  fHist_Corr3p_Kaon_EP_Norm_PP[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEPKaon*fWgtCent);
3458  fHist_Corr3p_Kaon_EP_Norm_PP[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEPKaon*fWgtCent);
3459  fHist_Corr3p_Kaon_EP_Norm_PP[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEPKaon*fWgtCent);
3460  fHist_Corr3p_Kaon_EP_Norm_PP[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEPKaon*fWgtCent);
3461  /*
3462  fHist_Corr3p_Kaon_EP_Refm_PP[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3463  fHist_Corr3p_Kaon_EP_Refm_PP[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3464  fHist_Corr3p_Kaon_EP_Refm_PP[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3465  fHist_Corr3p_Kaon_EP_Refm_PP[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3466 
3467  //Differential:
3468  if(cIndex<6){
3469  fHist_Corr3p_Kaon_pTSum_EP_V0A_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPKaon*fWgtCent);
3470  fHist_Corr3p_Kaon_pTSum_EP_V0C_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPKaon*fWgtCent);
3471  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPKaon*fWgtCent);
3472  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPKaon*fWgtCent);
3473  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPKaon*fWgtCent);
3474  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPKaon*fWgtCent);
3475  }
3476  */
3477  }
3478  //Proton:
3479  if(isProton1 && isProton2){
3480  fHist_Corr3p_Proton_EP_Norm_PP[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEPProton*fWgtCent);
3481  fHist_Corr3p_Proton_EP_Norm_PP[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEPProton*fWgtCent);
3482  fHist_Corr3p_Proton_EP_Norm_PP[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEPProton*fWgtCent);
3483  fHist_Corr3p_Proton_EP_Norm_PP[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEPProton*fWgtCent);
3484  /*
3485  fHist_Corr3p_Proton_EP_Refm_PP[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3486  fHist_Corr3p_Proton_EP_Refm_PP[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3487  fHist_Corr3p_Proton_EP_Refm_PP[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3488  fHist_Corr3p_Proton_EP_Refm_PP[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3489 
3490  //Differential:
3491  if(cIndex<6){
3492  fHist_Corr3p_Proton_pTSum_EP_V0A_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPProton*fWgtCent);
3493  fHist_Corr3p_Proton_pTSum_EP_V0C_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPProton*fWgtCent);
3494  fHist_Corr3p_Proton_pTDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPProton*fWgtCent);
3495  fHist_Corr3p_Proton_pTDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPProton*fWgtCent);
3496  fHist_Corr3p_Proton_EtaDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPProton*fWgtCent);
3497  fHist_Corr3p_Proton_EtaDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPProton*fWgtCent);
3498  }
3499  */
3500  }
3501  //------------------------------------
3502  }
3503 
3504 
3505 
3506 
3507 
3509 
3510 
3511  else if(gCharge1<0 && gCharge2<0 && skipPairHBT==0){
3512  fHist_Corr3p_EP_Norm_NN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3513  fHist_Corr3p_EP_Norm_NN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3514  fHist_Corr3p_EP_Norm_NN[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3515  fHist_Corr3p_EP_Norm_NN[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3516  /*
3517  fHist_Corr3p_EP_Refm_NN[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3518  fHist_Corr3p_EP_Refm_NN[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3519  fHist_Corr3p_EP_Refm_NN[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3520  fHist_Corr3p_EP_Refm_NN[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3521  */
3522 
3523  if(cIndex<6){
3524  fHist_Corr3p_pTSum_EP_V0A_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEP*fWgtCent);
3525  fHist_Corr3p_pTSum_EP_V0C_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEP*fWgtCent);
3526  fHist_Corr3p_pTDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEP*fWgtCent);
3527  fHist_Corr3p_pTDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEP*fWgtCent);
3528  fHist_Corr3p_EtaDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEP*fWgtCent);
3529  fHist_Corr3p_EtaDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEP*fWgtCent);
3530  }
3531  //-------------> PID CME ---------------
3532  //Pion:
3533  if(isPion1 && isPion2){
3534  fHist_Corr3p_Pion_EP_Norm_NN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEPPion*fWgtCent);
3535  fHist_Corr3p_Pion_EP_Norm_NN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEPPion*fWgtCent);
3536  fHist_Corr3p_Pion_EP_Norm_NN[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEPPion*fWgtCent);
3537  fHist_Corr3p_Pion_EP_Norm_NN[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEPPion*fWgtCent);
3538  /*
3539  fHist_Corr3p_Pion_EP_Refm_NN[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3540  fHist_Corr3p_Pion_EP_Refm_NN[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3541  fHist_Corr3p_Pion_EP_Refm_NN[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3542  fHist_Corr3p_Pion_EP_Refm_NN[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3543 
3544  //Differential:
3545  if(cIndex<6){
3546  fHist_Corr3p_Pion_pTSum_EP_V0A_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPPion*fWgtCent);
3547  fHist_Corr3p_Pion_pTSum_EP_V0C_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPPion*fWgtCent);
3548  fHist_Corr3p_Pion_pTDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPPion*fWgtCent);
3549  fHist_Corr3p_Pion_pTDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPPion*fWgtCent);
3550  fHist_Corr3p_Pion_EtaDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPPion*fWgtCent);
3551  fHist_Corr3p_Pion_EtaDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPPion*fWgtCent);
3552  }
3553  */
3554  }
3555  //Kaon:
3556  if(isKaon1 && isKaon2){
3557  fHist_Corr3p_Kaon_EP_Norm_NN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEPKaon*fWgtCent);
3558  fHist_Corr3p_Kaon_EP_Norm_NN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEPKaon*fWgtCent);
3559  fHist_Corr3p_Kaon_EP_Norm_NN[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEPKaon*fWgtCent);
3560  fHist_Corr3p_Kaon_EP_Norm_NN[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEPKaon*fWgtCent);
3561  /*
3562  fHist_Corr3p_Kaon_EP_Refm_NN[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3563  fHist_Corr3p_Kaon_EP_Refm_NN[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3564  fHist_Corr3p_Kaon_EP_Refm_NN[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3565  fHist_Corr3p_Kaon_EP_Refm_NN[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3566 
3567  //Differential:
3568  if(cIndex<6){
3569  fHist_Corr3p_Kaon_pTSum_EP_V0A_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPKaon*fWgtCent);
3570  fHist_Corr3p_Kaon_pTSum_EP_V0C_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPKaon*fWgtCent);
3571  fHist_Corr3p_Kaon_pTDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPKaon*fWgtCent);
3572  fHist_Corr3p_Kaon_pTDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPKaon*fWgtCent);
3573  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPKaon*fWgtCent);
3574  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPKaon*fWgtCent);
3575  }
3576  */
3577  }
3578  //Proton:
3579  if(isProton1 && isProton2){
3580  fHist_Corr3p_Proton_EP_Norm_NN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEPProton*fWgtCent);
3581  fHist_Corr3p_Proton_EP_Norm_NN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEPProton*fWgtCent);
3582  fHist_Corr3p_Proton_EP_Norm_NN[QAindex][2]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEPProton*fWgtCent);
3583  fHist_Corr3p_Proton_EP_Norm_NN[QAindex][3]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEPProton*fWgtCent);
3584  /*
3585  fHist_Corr3p_Proton_EP_Refm_NN[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A), WgtEP*fWgtCent);
3586  fHist_Corr3p_Proton_EP_Refm_NN[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C), WgtEP*fWgtCent);
3587  fHist_Corr3p_Proton_EP_Refm_NN[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCA),WgtEP*fWgtCent);
3588  fHist_Corr3p_Proton_EP_Refm_NN[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNTPCC),WgtEP*fWgtCent);
3589 
3590  //Differential:
3591  if(cIndex<6){
3592  fHist_Corr3p_Proton_pTSum_EP_V0A_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPProton*fWgtCent);
3593  fHist_Corr3p_Proton_pTSum_EP_V0C_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPProton*fWgtCent);
3594  fHist_Corr3p_Proton_pTDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPProton*fWgtCent);
3595  fHist_Corr3p_Proton_pTDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPProton*fWgtCent);
3596  fHist_Corr3p_Proton_EtaDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0A),WgtEPProton*fWgtCent);
3597  fHist_Corr3p_Proton_EtaDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*PsiNV0C),WgtEPProton*fWgtCent);
3598  }
3599  */
3600  }
3601  //------------------------------------
3602  }
3603 
3604  //cout<<", passes 3 WgtEP = "<<WgtEP<<endl;
3605  }//-------- nested track loop ends ------------------
3606 
3607 
3608 
3609 
3610 
3611 
3612 
3613 
3614 
3615 
3616  //------------- Fill QA histograms ------------
3617  if(TMath::Abs(pVtxZ) < 8.0 && gCharge1 > 0){
3618 
3619  fQAEtaPhiAfterNUA->Fill(dPhi1,dEta1,w1NUA);
3620 
3621  if(isPion1){
3622  fQAEtaPhiAfterNUAPion->Fill(dPhi1,dEta1,wNUAPion1);
3623  }
3624  if(isKaon1){
3625  fQAEtaPhiAfterNUAKaon->Fill(dPhi1,dEta1,wNUAKaon1);
3626  }
3627  if(isProton1){
3628  fQAEtaPhiAfterNUAProton->Fill(dPhi1,dEta1,wNUAProton1);
3629  }
3630  }
3631 
3632 
3633 
3634 
3635 
3636 
3637 
3638 
3639  //-------------- Fill NUA for PID tracks ----------------
3640  if(bFillNUAHistPID) {
3641 
3642  /*
3643  //---------------- Temporary: redefine PID NUA cuts:
3644  isPion1 = kFALSE;
3645  isKaon1 = kFALSE;
3646  isProton1 = kFALSE;
3647 
3648  //------> Pion
3649  if(dPt1<=0.6 && TMath::Abs(nSigTPCpion)<=3.0){
3650  isPion1 = kTRUE;
3651  }
3652  else if(dPt1>0.6 && dPt1<=2.0 && TMath::Abs(nSigTPCpion)<=3.0 && TMath::Abs(nSigTOFpion)<=2.0 ){
3653  isPion1 = kTRUE;
3654  }
3655  //------> Kaon
3656  if(dPt1<=0.45 && TMath::Abs(nSigTPCkaon)<=3.0){
3657  isKaon1 = kTRUE;
3658  }
3659  else if(dPt1>0.45 && dPt1<=2.0 && TMath::Abs(nSigTPCkaon)<=3.0 && TMath::Abs(nSigTOFkaon)<=2.0){
3660  isKaon1 = kTRUE;
3661  }
3662  //------> Proton
3663  if(dPt1<=0.8 && TMath::Abs(nSigTPCproton)<=3.0){
3664  isProton1 = kTRUE;
3665  }
3666  else if(dPt1>0.8 && dPt1<=2.0 && TMath::Abs(nSigTPCproton)<=3.0 && TMath::Abs(nSigTOFproton)<=3.0){ //0.8 to 3.5 was used earlier.
3667  isProton1 = kTRUE;
3668  }
3669  //Proton below 0.4 GeV is garbage
3670  if(dPt1<0.4) isProton1 = kFALSE;
3671  //-----------------------------------------------------------------
3672  */
3673 
3674 
3675 
3676  // Pion
3677  if(isPion1){
3678  if(gCharge1>0){
3679  fHist3DEtaPhiVz_Pos_Run[0][cForNUA]->Fill(pVtxZ,dPhi1,dEta1);
3680  }
3681  else if(gCharge1<0){
3682  fHist3DEtaPhiVz_Neg_Run[0][cForNUA]->Fill(pVtxZ,dPhi1,dEta1);
3683  }
3684  }
3685 
3686  // Kaon
3687  if(isKaon1){
3688  if(gCharge1>0){
3689  fHist3DEtaPhiVz_Pos_Run[1][cForNUA]->Fill(pVtxZ,dPhi1,dEta1);
3690  }
3691  else if(gCharge1<0){
3692  fHist3DEtaPhiVz_Neg_Run[1][cForNUA]->Fill(pVtxZ,dPhi1,dEta1);
3693  }
3694  }
3695 
3696  // proton
3697  if(isProton1){
3698  if(gCharge1>0){
3699  fHist3DEtaPhiVz_Pos_Run[2][cForNUA]->Fill(pVtxZ,dPhi1,dEta1);
3700  }
3701  else if(gCharge1<0){
3702  fHist3DEtaPhiVz_Neg_Run[2][cForNUA]->Fill(pVtxZ,dPhi1,dEta1);
3703  }
3704  }
3705 
3706  // Charged
3707  if(gCharge1>0){
3708  fHist3DEtaPhiVz_Pos_Run[3][cForNUA]->Fill(pVtxZ,dPhi1,dEta1);
3709  }
3710  else if(gCharge1<0){
3711  fHist3DEtaPhiVz_Neg_Run[3][cForNUA]->Fill(pVtxZ,dPhi1,dEta1);
3712  }
3713 
3714  }// Fill NUA for PID or not?
3715 
3716 
3717 
3718 
3719 
3720  //============ PID business starts here =============
3721 
3722  /*
3723  fHistEtaPtAfter->Fill(dEta1,dPt1);
3724 
3725  fHistTPCdEdxvsPAfter->Fill(mom*gCharge1,dEdx1);
3726 
3727  if(TOFmatch>0 && probMis < 0.01){
3728  fHistTOFBetavsPAfter->Fill(mom*gCharge1,beta);
3729  }
3730 
3731  //nSigTOFpion=fPIDResponse->NumberOfSigmasTOF(track, AliPID::kPion);
3732  //nSigTOFkaon=fPIDResponse->NumberOfSigmasTOF(track, AliPID::kKaon);
3733  //nSigTOFproton=fPIDResponse->NumberOfSigmasTOF(track, AliPID::kProton);
3734 
3735  fHistTOFMatchCount->Fill(TOFmatch+2,nSigTOFpion);
3736  fHistTOFMatchCount->Fill(TOFmatch+4,nSigTOFkaon);
3737  fHistTOFMatchCount->Fill(TOFmatch+6,nSigTOFproton);
3738 
3739  if(!TOFmatch || probMis > 0.01){ // I dont want mismatched track in my signal distribution
3740  nSigTOFpion = -99;
3741  nSigTOFkaon = -99;
3742  nSigTOFproton = -99;
3743  }
3744 
3745  //nSigTPCpion = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kPion);
3746  //nSigTPCkaon = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kKaon);
3747  //nSigTPCproton = fPIDResponse->NumberOfSigmasTPC(track, AliPID::kProton);
3748 
3749 
3750  // Fill only 3D nSigma TOF and TPC:
3751  //0=pi, 1=K, 2=Proton
3752  fHistTPCTOFnSigmavsPtAfter[0]->Fill(dPt1,nSigTPCpion,nSigTOFpion);
3753  fHistTPCTOFnSigmavsPtAfter[1]->Fill(dPt1,nSigTPCkaon,nSigTOFkaon);
3754  fHistTPCTOFnSigmavsPtAfter[2]->Fill(dPt1,nSigTPCproton,nSigTOFproton);
3755 
3756 
3757  // Fill nSigTOF for fixed nSigmaTPC Cut
3758  if(TMath::Abs(nSigTPCpion)<=fNSigmaCut){
3759  fHistTOFnSigmavsPtAfter[0]->Fill(dPt1*gCharge1,nSigTOFpion);
3760  fHistPtwithTPCNsigma[0]->Fill(dPt1*gCharge1);
3761  fHistTPCdEdxvsPtPIDAfter[0]->Fill(dPt1,dEdx1);
3762  if(TOFmatch>0 && probMis < 0.01 && beta>0.2){
3763  fHistPtwithTOFSignal[0]->Fill(dPt1*gCharge1);
3764  }
3765  }
3766  if(TMath::Abs(nSigTPCkaon)<=fNSigmaCut){
3767  fHistPtwithTPCNsigma[1]->Fill(dPt1*gCharge1);
3768  fHistTOFnSigmavsPtAfter[1]->Fill(dPt1*gCharge1,nSigTOFkaon);
3769  fHistTPCdEdxvsPtPIDAfter[1]->Fill(dPt1,dEdx1);
3770  if(TOFmatch>0 && probMis < 0.01 && beta>0.2){
3771  fHistPtwithTOFSignal[1]->Fill(dPt1*gCharge1);
3772  }
3773  }
3774  if(TMath::Abs(nSigTPCproton)<=fNSigmaCut){
3775  fHistPtwithTPCNsigma[2]->Fill(dPt1*gCharge1);
3776  fHistTOFnSigmavsPtAfter[2]->Fill(dPt1*gCharge1,nSigTOFproton);
3777  fHistTPCdEdxvsPtPIDAfter[2]->Fill(dPt1,dEdx1);
3778  if(TOFmatch>0 && probMis < 0.01 && beta>0.2){
3779  fHistPtwithTOFSignal[2]->Fill(dPt1*gCharge1);
3780  }
3781  }
3782 
3783 
3784  // Fill dEdx Histograms
3785  if(TMath::Abs(nSigTPCpion)<=fNSigmaCut){
3786  fHistPtwithTPCNsigma[0]->Fill(dPt1*gCharge1);
3787  fHistTPCdEdxvsPtPIDAfter[0]->Fill(dPt1,dEdx1);
3788  }
3789  if(TMath::Abs(nSigTPCkaon)<=fNSigmaCut){
3790  fHistPtwithTPCNsigma[1]->Fill(dPt1*gCharge1);
3791  fHistTPCdEdxvsPtPIDAfter[1]->Fill(dPt1,dEdx1);
3792  }
3793  if(TMath::Abs(nSigTPCproton)<=fNSigmaCut){
3794  fHistPtwithTPCNsigma[2]->Fill(dPt1*gCharge1);
3795  fHistTPCdEdxvsPtPIDAfter[2]->Fill(dPt1,dEdx1);
3796  }
3797 
3798 
3799 
3800  //========> nSigmaTOF distribution for circular cut <===============
3801  //if(TMath::Sqrt(nSigTPCpion*nSigTPCpion+nSigTOFpion*nSigTOFpion)<=fNSigmaCut){
3802  //fHistTOFnSigmavsPtAfter[0]->Fill(dPt1*gCharge1,nSigTOFpion);
3803  //if(TOFmatch>0 && probMis < 0.01 && beta>0.2){
3804  //fHistPtwithTOFSignal[0]->Fill(dPt1*gCharge1);
3805  //}
3806  //}
3807  //if(TMath::Sqrt(nSigTPCkaon*nSigTPCkaon+nSigTOFkaon*nSigTOFkaon)<=fNSigmaCut){
3808  //fHistTOFnSigmavsPtAfter[1]->Fill(dPt1*gCharge1,nSigTOFkaon);
3809  //if(TOFmatch>0 && probMis < 0.01 && beta>0.2){
3810  //fHistPtwithTOFSignal[1]->Fill(dPt1*gCharge1);
3811  //}
3812  //}
3813  //if(TMath::Sqrt(nSigTPCproton*nSigTPCproton+nSigTOFproton*nSigTOFproton)<=fNSigmaCut){
3814  //fHistTOFnSigmavsPtAfter[2]->Fill(dPt1*gCharge1,nSigTOFproton);
3815  //if(TOFmatch>0 && probMis < 0.01 && beta>0.2){
3816  //fHistPtwithTOFSignal[2]->Fill(dPt1*gCharge1);
3817  //}
3818  //}
3819 
3820 
3821  //------------------------------------------------------------
3822 
3823  // TOF matching is not needed from data as done by Davide using MC.
3824 
3825  if(!TOFmatch || probMis > 0.01 || beta>0.2) continue;
3826 
3827  // nSigmaTPC distribution for Fixed nSigmaTOF cut
3828  if(TMath::Abs(nSigTOFpion)<=fNSigmaCut){
3829  fHistTPCnSigmavsPtAfter[0]->Fill(dPt1*gCharge1,nSigTPCpion);
3830  fHistPtwithTOFmasscut[0]->Fill(dPt1*gCharge1);
3831  }
3832  if(TMath::Abs(nSigTOFkaon)<=fNSigmaCut){
3833  fHistTPCnSigmavsPtAfter[1]->Fill(dPt1*gCharge1,nSigTPCkaon);
3834  fHistPtwithTOFmasscut[1]->Fill(dPt1*gCharge1);
3835  }
3836  if(TMath::Abs(nSigTOFproton)<=fNSigmaCut){
3837  fHistTPCnSigmavsPtAfter[2]->Fill(dPt1*gCharge1,nSigTPCproton);
3838  fHistPtwithTOFmasscut[2]->Fill(dPt1*gCharge1);
3839  } */
3840 
3841 
3842 
3843  }
3844 //===================== track loop ends ============================
3845 
3846 
3847 
3848 
3849 
3850 
3851 
3852  //---------- TPC Event Planes -------
3853  //Sub events //
3854  sumTPCQn2x[0] = sumTPCQn2x[0]/SumWEtaNeg;
3855  sumTPCQn2y[0] = sumTPCQn2y[0]/SumWEtaNeg;
3856  sumTPCQn3x[0] = sumTPCQn3x[0]/SumWEtaNeg;
3857  sumTPCQn3y[0] = sumTPCQn3y[0]/SumWEtaNeg;
3858  sumTPCQn4x[0] = sumTPCQn4x[0]/SumWEtaNeg;
3859  sumTPCQn4y[0] = sumTPCQn4y[0]/SumWEtaNeg;
3860 
3861  sumTPCQn2x[1] = sumTPCQn2x[1]/SumWEtaPos;
3862  sumTPCQn2y[1] = sumTPCQn2y[1]/SumWEtaPos;
3863  sumTPCQn3x[1] = sumTPCQn3x[1]/SumWEtaPos;
3864  sumTPCQn3y[1] = sumTPCQn3y[1]/SumWEtaPos;
3865  sumTPCQn4x[1] = sumTPCQn4x[1]/SumWEtaPos;
3866  sumTPCQn4y[1] = sumTPCQn4y[1]/SumWEtaPos;
3867 
3868  sumTPCQn2x[3] = sumTPCQn2x[3]/SumWEtaFull;
3869  sumTPCQn2y[3] = sumTPCQn2y[3]/SumWEtaFull;
3870  sumTPCQn3x[3] = sumTPCQn3x[3]/SumWEtaFull;
3871  sumTPCQn3y[3] = sumTPCQn3y[3]/SumWEtaFull;
3872  sumTPCQn4x[3] = sumTPCQn4x[3]/SumWEtaFull;
3873  sumTPCQn4y[3] = sumTPCQn4y[3]/SumWEtaFull;
3874 
3875 
3876  if(gPsiN>2){
3877  //Enable periodicity PsiN directly:
3878  PsiNTPCC = (1.0/gPsiN)*( TMath::ATan2(sumTPCQn2y[0],sumTPCQn2x[0]) + TMath::Pi() ) ; // negetive eta
3879  PsiNTPCA = (1.0/gPsiN)*( TMath::ATan2(sumTPCQn2y[1],sumTPCQn2x[1]) + TMath::Pi() ) ; // positive eta
3880  PsiNTPCF = (1.0/gPsiN)*( TMath::ATan2(sumTPCQn2y[3],sumTPCQn2x[3]) + TMath::Pi() ) ; // FUll TPC eta
3881  }
3882  else if(gPsiN!=0){
3883  PsiNTPCC = (1.0/gPsiN)*( TMath::ATan2(sumTPCQn2y[0],sumTPCQn2x[0]) ) ; // negetive eta
3884  if(PsiNTPCC<0.) PsiNTPCC += 2*TMath::Pi()/gPsiN;
3885  PsiNTPCA = (1.0/gPsiN)*( TMath::ATan2(sumTPCQn2y[1],sumTPCQn2x[1]) ) ; // positive eta
3886  if(PsiNTPCA<0.) PsiNTPCA += 2*TMath::Pi()/gPsiN;
3887  PsiNTPCF = (1.0/gPsiN)*( TMath::ATan2(sumTPCQn2y[3],sumTPCQn2x[3]) ) ; // FUll TPC eta
3888  if(PsiNTPCF<0.) PsiNTPCF += 2*TMath::Pi()/gPsiN;
3889  }
3890 
3891  fHTPCAEventPlaneVsCent->Fill(EvtCent,PsiNTPCA);
3892  fHTPCCEventPlaneVsCent->Fill(EvtCent,PsiNTPCC);
3893  fHTPCEventPlaneVsCent->Fill(EvtCent, PsiNTPCF);
3894 
3895 
3896 
3897 
3898 
3899  //-------------- vs Centrality -----------------
3900  //V0A-V0C
3901  fHist_Reso2n_EP_Norm_Det[QAindex][0]->Fill(EvtCent, TMath::Cos(gPsiN*(PsiNV0A-PsiNV0C)), fWgtCent);
3902  //V0A-TPC
3903  fHist_Reso2n_EP_Norm_Det[QAindex][1]->Fill(EvtCent, TMath::Cos(gPsiN*(PsiNV0A-PsiNTPCF)), fWgtCent);
3904  //V0C-TPC
3905  fHist_Reso2n_EP_Norm_Det[QAindex][2]->Fill(EvtCent, TMath::Cos(gPsiN*(PsiNV0C-PsiNTPCF)), fWgtCent);
3906  //TPCa -TPCc
3907  fHist_Reso2n_EP_Norm_Det[QAindex][3]->Fill(EvtCent, TMath::Cos(gPsiN*(PsiNTPCA-PsiNTPCC)), fWgtCent);
3908 
3909  //-------------- vs Refmult -----------------
3910  /*
3911  //V0A-V0C
3912  fHist_Reso2n_EP_Refm_Det[QAindex][0]->Fill(RefMultCorrFB, TMath::Cos(gPsiN*(PsiNV0A-PsiNV0C)), fWgtCent);
3913  //V0A-TPC
3914  fHist_Reso2n_EP_Refm_Det[QAindex][1]->Fill(RefMultCorrFB, TMath::Cos(gPsiN*(PsiNV0A-PsiNTPCF)), fWgtCent);
3915  //V0C-TPC
3916  fHist_Reso2n_EP_Refm_Det[QAindex][2]->Fill(RefMultCorrFB, TMath::Cos(gPsiN*(PsiNV0C-PsiNTPCF)), fWgtCent);
3917  //TPCa -TPCc
3918  fHist_Reso2n_EP_Refm_Det[QAindex][3]->Fill(RefMultCorrFB, TMath::Cos(gPsiN*(PsiNTPCA-PsiNTPCC)), fWgtCent);
3919  */
3920 
3921 
3922 
3923 
3924 
3925  //--------- Store TPC-Qn for Recenter ---------
3926  fTPCFQ2xVsCentRun->Fill(EvtCent,sumTPCQn2x[3]);
3927  fTPCFQ2yVsCentRun->Fill(EvtCent,sumTPCQn2y[3]);
3928 
3929  fTPCAQ2xVsCentRun->Fill(EvtCent,sumTPCQn2x[0]);
3930  fTPCAQ2yVsCentRun->Fill(EvtCent,sumTPCQn2y[0]);
3931  fTPCCQ2xVsCentRun->Fill(EvtCent,sumTPCQn2x[1]);
3932  fTPCCQ2yVsCentRun->Fill(EvtCent,sumTPCQn2y[1]);
3933 
3934  fTPCAQ3xVsCentRun->Fill(EvtCent,sumTPCQn3x[0]);
3935  fTPCAQ3yVsCentRun->Fill(EvtCent,sumTPCQn3y[0]);
3936  fTPCCQ3xVsCentRun->Fill(EvtCent,sumTPCQn3x[1]);
3937  fTPCCQ3yVsCentRun->Fill(EvtCent,sumTPCQn3y[1]);
3938 
3939  fTPCAQ4xVsCentRun->Fill(EvtCent,sumTPCQn4x[0]);
3940  fTPCAQ4yVsCentRun->Fill(EvtCent,sumTPCQn4y[0]);
3941  fTPCCQ4xVsCentRun->Fill(EvtCent,sumTPCQn4x[1]);
3942  fTPCCQ4yVsCentRun->Fill(EvtCent,sumTPCQn4y[1]);
3943 
3944 
3945 
3946 
3947 
3948 
3949 
3950 
3951 
3952 
3953 
3954 
3955  PostData(1,fListHist);
3956 
3957  fHistEventCount->Fill(14.5); //15th bin is last one
3958  stepCount++;
3959 
3960 
3961 
3962 
3963 
3964 
3965  //if(multPOI2nd!=(multPOI1st-1))
3966  //cout<<"mismatched "<< "\tPOIs1st = "<<multPOI1st<<"\tPOIs2nd = "<<multPOI2nd <<" for Event = "<<fEventCount<<endl;
3967 
3968  //if(multPOI1st!=multEtaFull)
3969  //cout<<"\n Mismatched track "<< "\t multEtaFull = "<<multEtaFull<<"\tPOIs1st = "<<multPOI1st<<" for Event = "<<fEventCount<<endl;
3970 
3971  //if(fEventCount%10==0)
3972  //cout<<"Ev = "<<fEventCount<<"\tMult = "<<multEtaFull<<"\tPOIs1st = "<<multPOI1st<<"\t POI2nd = "<< multPOI2nd <<endl;
3973 
3974  //if(multEtaFull>500)
3975  //cout<<"Ev = "<<fEventCount<<" ntracks = "<<ntracks<<"\tMult = "<<multEtaFull<<"\t RealTime = "<<watch.RealTime()<<"\t CPUTime = "<< watch.CpuTime() <<endl;
3976  //cout<<"Ev = "<<fEventCount<<" cent = "<<EvtCent<<"\tWEtaNeg = "<<SumWEtaNeg<<"\tnegMult = "<<multEtaNeg<<"\tWEtaPos = "<<SumWEtaPos<<"\tposMult = "<<multEtaPos<<endl;
3977  //watch.Stop();
3978 
3979 }//================ UserExec ==============
3980 
3981 
3982 
3983 
3984 
3985 
3986 
3987 
3988 
3989 
3990 
3991 
3992 
3993 
3994 
3995 
3996 
3997 
3998 
3999 
4000 
4001 
4003 
4004 
4005 
4006 
4007 double AliAnalysisTaskCMEV0PID::GetWDist(const AliVVertex* v0, const AliVVertex* v1)
4008 {
4009  // calculate sqrt of weighted distance to other vertex
4010  if (!v0 || !v1) {
4011  AliDebug(2,"\n\n ::GetWDist => One of vertices is not valid\n\n");
4012  return 0;
4013  }
4014  static TMatrixDSym vVb(3);
4015  double dist = -1;
4016  double dx = v0->GetX()-v1->GetX();
4017  double dy = v0->GetY()-v1->GetY();
4018  double dz = v0->GetZ()-v1->GetZ();
4019  double cov0[6],cov1[6];
4020  v0->GetCovarianceMatrix(cov0);
4021  v1->GetCovarianceMatrix(cov1);
4022  vVb(0,0) = cov0[0]+cov1[0];
4023  vVb(1,1) = cov0[2]+cov1[2];
4024  vVb(2,2) = cov0[5]+cov1[5];
4025  vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];
4026  vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;
4027  vVb.InvertFast();
4028  if (!vVb.IsValid()) {
4029  AliDebug(2,"Singular Matrix\n");
4030  return dist;
4031  }
4032  dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz
4033  + 2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;
4034  return dist>0 ? TMath::Sqrt(dist) : -1;
4035 }
4036 
4037 
4039  { // check for multi-vertexer pile-up
4040  const int kMinPlpContrib = 5;
4041  const double kMaxPlpChi2 = 5.0;
4042  const double kMinWDist = 15;
4043 
4044  const AliVVertex* vtPrm = 0;
4045  const AliVVertex* vtPlp = 0;
4046 
4047  int nPlp = 0;
4048 
4049  if(!(nPlp=faod->GetNumberOfPileupVerticesTracks()))
4050  return kFALSE;
4051 
4052  vtPrm = faod->GetPrimaryVertex();
4053  if(vtPrm == faod->GetPrimaryVertexSPD())
4054  return kTRUE; // there are pile-up vertices but no primary
4055 
4056  //int bcPrim = vtPrm->GetBC();
4057 
4058  for(int ipl=0;ipl<nPlp;ipl++) {
4059  vtPlp = (const AliVVertex*)faod->GetPileupVertexTracks(ipl);
4060  if (vtPlp->GetNContributors() < kMinPlpContrib) continue;
4061  if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;
4062  //int bcPlp = vtPlp->GetBC();
4063  //if (bcPlp!=AliVTrack::kTOFBCNA && TMath::Abs(bcPlp-bcPrim)>2)
4064  // return kTRUE; // pile-up from other BC
4065 
4066  double wDst = GetWDist(vtPrm,vtPlp);
4067  if (wDst<kMinWDist) continue;
4068 
4069  return kTRUE; // pile-up: well separated vertices
4070  }
4071  return kFALSE;
4072 }
4073 
4074 
4075 
4077  /*if(bApplyMCcorr){
4078  if(!gGrid){
4079  TGrid::Connect("alien://");
4080  }
4081  if(!mfileFBHijing){
4082  mfileFBHijing = TFile::Open(sMCfilePath,"READ");
4083  fListFBHijing = dynamic_cast<TList*>(mfileFBHijing->FindObjectAny("fMcEffiHij")); */
4084 
4085  if(fListFBHijing) {
4086  cout<<"\n =========> Info: Using MC efficiency correction Map <=========== "<<endl;
4087  for(int i=0;i<10;i++) {
4088  fFB_Efficiency_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_%d",i));
4089  }
4090  //PID :
4091  for(int i=0;i<10;i++) {
4092  fFB_Efficiency_Pion_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_Pion_%d",i));
4093  fFB_Efficiency_Kaon_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_Kaon_%d",i));
4094  //fFB_Efficiency_Proton_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_Proton_%d",i));
4095  fFB_Efficiency_Proton_Pos_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_ProtonPos_%d",i));
4096  fFB_Efficiency_Proton_Neg_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_ProtonNeg_%d",i));
4097  }
4098 
4099  //------- Fill the flags: --------------
4101  fHistTaskConfigParameters->SetBinContent(19,1);
4102  }
4104  fHistTaskConfigParameters->SetBinContent(20,1);
4105  }
4107  fHistTaskConfigParameters->SetBinContent(21,1);
4108  }
4110  fHistTaskConfigParameters->SetBinContent(22,1);
4111  }
4112  }
4113  else if(!fListFBHijing){
4114  std::cout<<"\n\n !!!!**** Warning: FB Efficiency File/List not found Use Weight = 1.0 *****\n\n"<<std::endl;
4115  //exit(1);
4116  }
4117 }
4118 
4119 
4120 
4121 
4123 
4124  Int_t cIndex = 0;
4125 
4126  if(fCent<5.0) {
4127  cIndex = 0;
4128  }
4129  else if(fCent>=5.0 && fCent<10){
4130  cIndex = 1;
4131  }
4132  else if(fCent>=10.0) {
4133  cIndex = abs(fCent/10.0)+1;
4134  }
4135  return cIndex;
4136 }
4137 
4139  //std::cout<<" centrality outlier function called "<<std::endl;
4140  Float_t fMeanTPC[100] = {2902.95,2758.33,2642.78,2536.67,2435.37,2340.06,2248.44,2163.71,2080.49,2001.54,1925.86,1852.64,1781.97,1715.56,1650.53,1587.23,1527.51,1468.19,1412.73,1357.86,1305.35,1254.33,1205.57,1157.28,1111.53,1066.42,1023.15,981.594,940.795,901.766,863.651,826.183,790.53,756.358,722.654,690.513,659.443,628.807,599.748,571.664,544.446,518.042,492.369,468.072,444.694,422.487,400.104,379.129,359.147,339.62,320.817,302.788,285.791,269.015,253.688,238.671,224.039,209.932,196.915,184.647,172.76,161.381,150.395,140.288,131.033,121.58,113.112,104.938,97.3078,90.2178,83.5974,77.2645,70.7126,65.4424,60.1404,55.5644,50.8314,46.3761,43.024,38.625,35.3435,32.2304,29.4192,26.821,24.3303,21.9332,19.4215,16.7163,14.9414,13.1092,0.};
4141 
4142  Float_t fSigmaTPC[100] = {122.209,107.901,103.452,100.498,97.7403,94.7845,93.2543,90.0548,88.1106,85.7382,84.0812,82.2978,80.3817,78.6002,77.3448,75.5086,73.6842,71.9733,70.3447,69.1999,67.878,66.3511,65.0406,63.4866,62.4409,60.7899,59.1328,58.426,56.8618,55.8871,54.1031,53.4959,52.0482,51.0441,49.6218,48.7646,47.5166,46.5247,45.0727,44.4311,43.4531,42.0404,41.0238,40.1384,39.2588,38.2461,36.5951,36.0552,35.3727,33.7883,32.7167,32.4486,31.3709,30.3444,29.505,28.5139,27.4471,26.5359,25.9506,25.127,24.3797,23.2985,22.279,21.4698,20.781,20.8193,19.9509,18.8036,17.9145,16.961,16.7375,15.852,14.9324,14.7663,13.5969,13.4533,12.3067,12.7835,11.7283,10.6758,10.6676,10.6492,9.04614,8.89065,8.66093,8.50997,7.98812,6.91087,7.12045,7.29593,0.};
4143 
4144  for(int i=0;i<90;i++) {
4145  hCentvsTPCmultCuts->SetBinContent(i+1,1,fMeanTPC[i]);
4146  hCentvsTPCmultCuts->SetBinContent(i+1,2,fSigmaTPC[i]);
4147  }
4148 }
4149 
4150 
4151 
4152 
4153 
4154 
4156 
4157  fHistTaskConfigParameters = new TH1F("fHistTaskConfigParameters","Task parameters",25,0,25);
4158  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(1,"FilterBit");
4159  fHistTaskConfigParameters->SetBinContent(1,fFilterBit);
4160  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(2,"n#sigmaTPC");
4161  fHistTaskConfigParameters->SetBinContent(2,fNSigmaCut);
4162  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(3,"MinPt");
4163  fHistTaskConfigParameters->SetBinContent(3,fMinPtCut);
4164  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(4,"MaxPt");
4165  fHistTaskConfigParameters->SetBinContent(4,fMaxPtCut);
4166  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(5,"MinEta");
4167  fHistTaskConfigParameters->SetBinContent(5,fMinEtaCut);
4168  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(6,"MaxEta");
4169  fHistTaskConfigParameters->SetBinContent(6,fMaxEtaCut);
4170 
4171  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(11,"CentralityMin");
4173  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(12,"CentralityMax");
4175 
4176  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(13,"VertexMin(cm)");
4177  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(14,"VertexMax(cm)");
4178 
4179 
4180  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(15,"NUA Charge");
4181  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(16,"NUA Pion");
4182  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(17,"NUA Kaon");
4183  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(18,"NUA Proton");
4184 
4185  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(19,"MC Charge");
4186  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(20,"MC Pion");
4187  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(21,"MC Kaon");
4188  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(22,"MC Proton");
4189 
4190  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(23,"V0 Gain Eq.");
4191  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(24,"V0 Qn Recenter");
4192 
4193 
4195 
4196 
4197 
4198  fHistPileUpCount = new TH1F("fHistPileUpCount", "fHistPileUpCount", 15, 0., 15.);
4199  fHistPileUpCount->GetXaxis()->SetBinLabel(1,"plpMV");
4200  fHistPileUpCount->GetXaxis()->SetBinLabel(2,"fromSPD");
4201  fHistPileUpCount->GetXaxis()->SetBinLabel(3,"RefMultComb08");
4202  fHistPileUpCount->GetXaxis()->SetBinLabel(4,"IncompleteDAQ");
4203  fHistPileUpCount->GetXaxis()->SetBinLabel(5,"abs(V0M-CL1)>5.0");
4204  fHistPileUpCount->GetXaxis()->SetBinLabel(6,"missingVtx");
4205  fHistPileUpCount->GetXaxis()->SetBinLabel(7,"inconsistentVtx");
4206  Int_t puConst = fPileUpConstParm;
4207  fHistPileUpCount->GetXaxis()->SetBinLabel(8,Form("multESDTPCDif>%d",puConst));
4208  fHistPileUpCount->GetXaxis()->SetBinLabel(9,Form("multGlobTPCDif>%d",puConst));
4209  fHistPileUpCount->GetXaxis()->SetBinLabel(10,"PileUpMultSelTask");
4211 
4212 
4213  fHistMultSelPUCount = new TH1F("fHistMultSelPileUpCount", "no of PU Event from MultSelTask", 10, 0., 10);
4214  fHistMultSelPUCount->GetXaxis()->SetBinLabel(1,"PileUp");
4215  fHistMultSelPUCount->GetXaxis()->SetBinLabel(2,"PileUpMV");
4216  fHistMultSelPUCount->GetXaxis()->SetBinLabel(3,"PileUpMultBins");
4217  fHistMultSelPUCount->GetXaxis()->SetBinLabel(4,"InconsistentVtx");
4218  fHistMultSelPUCount->GetXaxis()->SetBinLabel(5,"TrackletVsCluster");
4219  fHistMultSelPUCount->GetXaxis()->SetBinLabel(6,"IncompleteDAQ");
4220  fHistMultSelPUCount->GetXaxis()->SetBinLabel(7,"NotGoodVertex2016");
4222 
4223 
4224  fHistEventCount = new TH1F("fHistEventCount","Event counts",15,0,15);
4225  fHistEventCount->GetXaxis()->SetBinLabel(1,"Called UserExec()");
4226  fHistEventCount->GetXaxis()->SetBinLabel(2,"Called Exec()");
4227  fHistEventCount->GetXaxis()->SetBinLabel(3,"AOD Exist");
4228  fHistEventCount->GetXaxis()->SetBinLabel(4,"Vz < 10");
4229  fHistEventCount->GetXaxis()->SetBinLabel(5,Form("%2.0f<Cent<%2.0f",fCentralityPercentMin,fCentralityPercentMax));
4230  fHistEventCount->GetXaxis()->SetBinLabel(6,"noAODtrack > 2 ");
4231  fHistEventCount->GetXaxis()->SetBinLabel(7,"TPC vs Global");
4232  fHistEventCount->GetXaxis()->SetBinLabel(8,"TPC128 vs ESD");
4233  fHistEventCount->GetXaxis()->SetBinLabel(9,"Cent vs TPC");
4234  fHistEventCount->GetXaxis()->SetBinLabel(10,"mult eta+/- > 2");
4235  fHistEventCount->GetXaxis()->SetBinLabel(11,"centCL1 < 90");
4236  fHistEventCount->GetXaxis()->SetBinLabel(15,"Survived Events");
4237  fListHist->Add(fHistEventCount);
4238 
4239  //fHistEventCount->Fill(1);
4240 
4241 }
4242 
4243 
4244 
4245 
4246 
4248 {
4249  /*
4250  TList *fListAppliedV0Corr = new TList();
4251  fListAppliedV0Corr->SetName("fListAppliedV0Corr");
4252  fListAppliedV0Corr->SetOwner(kTRUE);
4253  fListHist->Add(fListAppliedV0Corr);*/ // to be Tested later.
4254 
4255  if(fListV0MCorr){
4256  fHCorrectV0M = (TH1D *) fListV0MCorr->FindObject(Form("fHistV0Gain_Run%d",run));
4257  fHAvgerageQnV0A = (TH2D *) fListV0MCorr->FindObject(Form("fHistAvgQnV0A_Run%d",run));
4258  fHAvgerageQnV0C = (TH2D *) fListV0MCorr->FindObject(Form("fHistAvgQnV0C_Run%d",run));
4259 
4260  //Now the wgts for centrality is added inside VOM gain file.
4261  fHCentWeightForRun = (TH1D *) fListV0MCorr->FindObject(Form("fHistCentWeight_Run%d",run));
4262 
4263  if(fHCentWeightForRun){
4264  cout<<"\n =========== Info:: Using Centrality wgts for run = "<<run<<"============"<<endl;
4265  }
4266  else{
4267  cout<<"\n =========== Info:: No Centrality wgt. correction.!! for run = "<<run<<"============"<<endl;
4268  }
4269 
4270  if(fHCorrectV0M){
4271  cout<<"\n =========== Info:: Setting up V0 gain correction for run = "<<run<<"============"<<endl;
4272  fHistTaskConfigParameters->SetBinContent(23,1);
4273  }
4274  else{
4275  cout<<"\n =========== Info:: No V0 gain correction..!!! for run = "<<run<<"============"<<endl;
4276  }
4278  cout<<"\n =========== Info:: Setting up V0 <Qn> recentering for run = "<<run<<"============"<<endl;
4279  fHistTaskConfigParameters->SetBinContent(24,1);
4280  }
4281  else{
4282  cout<<"\n =========== Info:: No V0 <Qn> recentering..!!! for run = "<<run<<"============"<<endl;
4283  }
4284  }
4285  else{
4286  cout<<"\n ======== !!!! Error:: List For V0-Gain and Qn not found for run "<<run<<"============"<<endl;
4287  }
4288 
4289 }
4290 
4291 
4292 
4293 
4294 
4295 
4296 
4298 {
4299 
4300  if(fListNUACorr){
4301  for(int i=0;i<5;i++){
4302  fHCorrectNUApos[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pos_Cent%d_Run%d",i,run));
4303  fHCorrectNUAneg[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Neg_Cent%d_Run%d",i,run));
4304  }
4305  if(fHCorrectNUApos[3] && fHCorrectNUAneg[3]){
4306  cout<<"\n=========== Info:: Setting up NUA corrections for run "<<run<<"============"<<endl;
4307  fHistTaskConfigParameters->SetBinContent(15,1);
4308  }
4309  }
4310  else {
4311  printf("\n ******** Warning: No NUA Correction for Charge Particle in run %d, Use Wgt = 1.0 ********* \n",run);
4312  //Do not allocate memory:
4313  /*
4314  for(int i=0;i<5;i++){
4315  fHCorrectNUApos[i] = new TH3D(Form("fHCorrectNUApos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
4316  fHCorrectNUAneg[i] = new TH3D(Form("fHCorrectNUAneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
4317  fHCorrectNUApos[i]->SetBinContent(1,1,1,1.0);
4318  fHCorrectNUAneg[i]->SetBinContent(1,1,1,1.0);
4319  //exit(1);
4320  }*/
4321  }
4322 
4323  //=================== PID: ==========================
4324  if(fListNUACorr){
4325  for(int i=0;i<5;i++){
4326  fHCorrectNUAposPion[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pion_Pos_Cent%d_Run%d",i,run)); //
4327  fHCorrectNUAnegPion[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pion_Neg_Cent%d_Run%d",i,run));
4328  if(fHCorrectNUAposPion[3] && fHCorrectNUAnegPion[3]) fHistTaskConfigParameters->SetBinContent(16,1);
4329 
4330  fHCorrectNUAposKaon[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Kaon_Pos_Cent%d_Run%d",i,run)); //
4331  fHCorrectNUAnegKaon[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Kaon_Neg_Cent%d_Run%d",i,run));
4332  if(fHCorrectNUAposKaon[3] && fHCorrectNUAnegKaon[3]) fHistTaskConfigParameters->SetBinContent(17,1);
4333 
4334  fHCorrectNUAposProton[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Proton_Pos_Cent%d_Run%d",i,run));
4335  fHCorrectNUAnegProton[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Proton_Neg_Cent%d_Run%d",i,run));
4336  if(fHCorrectNUAposProton[3] && fHCorrectNUAnegProton[3]) fHistTaskConfigParameters->SetBinContent(18,1);
4337  }
4339  cout<<"\n=========== Info:: Setting up --> PID NUA corrections for run = "<<run<<"============"<<endl;
4340  }
4341  else{
4342  cout<<"\n=========== WARNING :: PID NUA corrections NOT found for run = "<<run<<"============"<<endl;
4343  }
4344  }
4345  else {
4346  printf("\n ******** Error/Warning: No NUA Correction found for PID for run %d, Use PID Wgt = 1.0 ********* \n",run);
4347  /*
4348  for(int i=0;i<5;i++){
4349  fHCorrectNUAposPion[i] = new TH3D(Form("fHCorrectNUAPionpos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
4350  fHCorrectNUAposPion[i] = new TH3D(Form("fHCorrectNUAPionneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
4351  fHCorrectNUAposPion[i]->SetBinContent(1,1,1,1.0);
4352  fHCorrectNUAposPion[i]->SetBinContent(1,1,1,1.0);
4353 
4354  fHCorrectNUAposKaon[i] = new TH3D(Form("fHCorrectNUAKaonpos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
4355  fHCorrectNUAposKaon[i] = new TH3D(Form("fHCorrectNUAKaonneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
4356  fHCorrectNUAposKaon[i]->SetBinContent(1,1,1,1.0);
4357  fHCorrectNUAposKaon[i]->SetBinContent(1,1,1,1.0);
4358 
4359  fHCorrectNUAposProton[i] = new TH3D(Form("fHCorrectNUAProtonpos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
4360  fHCorrectNUAposProton[i] = new TH3D(Form("fHCorrectNUAProtonneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
4361  fHCorrectNUAposProton[i]->SetBinContent(1,1,1,1.0);
4362  fHCorrectNUAposProton[i]->SetBinContent(1,1,1,1.0);
4363  //exit(1);
4364  }*/
4365  }
4366 
4367 }
4368 
TProfile * fHist_Corr3p_pTSum_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_EP_Refm_NN[2][4]
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Proton_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Kaon_EP_Refm_NN[2][4]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0C_PP[2][6]
Int_t GetCentralityScaled0to10(Double_t fCent)
double Double_t
Definition: External.C:58
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0C_PN[2][6]
Definition: External.C:260
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PN[2][6]
TH2D * fHAvgerageQnV0A
To read Gain Correction file.
TProfile * fHist_Corr3p_pTDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0C_NN[2][6]
Definition: External.C:236
const char * title
Definition: MakeQAPdf.C:27
TProfile * fHist_Corr3p_Kaon_EP_Norm_PP[2][4]
TProfile * fHist_Corr3p_pTSum_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_pTSum_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_Proton_EP_Norm_NN[2][4]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PP[2][6]
AliMultSelection * fMultSelection
PID response Handler.
centrality
TProfile * fHist_Corr3p_Kaon_EP_Norm_PN[2][4]
char Char_t
Definition: External.C:18
TProfile * fHist_Corr3p_EtaDiff_EP_V0A_PN[2][6]
TH1F * fHistPtwithTPCNsigma[3]
last in the list
TProfile * fHist_Reso2n_EP_Norm_Det[2][4]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0C_PP[2][6]
TH1D * fFB_Efficiency_Pion_Cent[10]
for charge
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0C_NN[2][6]
TH2F * fHistEtaPtAfter
Eta-Pt acceptance.
TProfile * fHist_Corr3p_EP_Norm_NN[2][4]
TProfile * fHist_Corr3p_pTDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_EtaDiff_EP_V0C_PP[2][6]
TH3D * fHCorrectNUAnegProton[5]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0A_PN[2][6]
TH3D * fHCorrectNUAposPion[5]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0C_PP[2][6]
TH1F * fCentDistAfter
without PileUp cut
TProfile * fHist_Corr3p_Pion_EP_Norm_PP[2][4]
TH3D * fHCorrectNUAnegPion[5]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_EtaDiff_EP_V0A_NN[2][6]
AliPIDResponse * fPIDResponse
aod
TProfile * fHist_Corr3p_pTSum_EP_V0C_PN[2][6]
TH1D * fHCentWeightForRun
V0C Average <Qn>, n=2,3.
TProfile * fHist_Corr3p_EtaDiff_EP_V0A_PP[2][6]
int Int_t
Definition: External.C:63
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0C_PP[2][6]
float Float_t
Definition: External.C:68
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0C_NN[2][6]
Definition: External.C:252
TH3F * fHist3DEtaPhiVz_Neg_Run[4][5]
4 particle 5 centrality bin
TProfile * fHist_Corr3p_Proton_EP_Norm_PP[2][4]
Definition: External.C:228
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0A_NN[2][6]
Definition: External.C:212
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Kaon_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0C_PP[2][6]
TH1D * fHCorrectV0M
with PileUp cut
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0C_NN[2][6]
TH2F * fHistTPCvsGlobalMultBefore
Eta-Pt acceptance.
TH3D * fHCorrectNUAposKaon[5]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_Pion_EP_Norm_PN[2][4]
TProfile * fHist_Corr3p_Kaon_EP_Norm_NN[2][4]
TProfile * fHist_Corr3p_Pion_EP_Norm_NN[2][4]
TProfile * fHist_Corr3p_Pion_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_pTDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Proton_EP_Norm_PN[2][4]
TH1F * fCentDistBefore
To fill VOM multiplicity.
TList * fListHist
Event selection.
virtual void UserExec(Option_t *)
TH1F * fHistPileUpCount
Task input parameters FB / cut values etc.
Bool_t PileUpMultiVertex(const AliAODEvent *faod)
TH3D * fHCorrectNUAnegKaon[5]
5 centrality bin, read NUA from file
TH3D * fHCorrectNUAneg[5]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_Kaon_EP_Refm_PP[2][4]
double GetWDist(const AliVVertex *v0, const AliVVertex *v1)
TH1D * fFB_Efficiency_Cent[10]
4 particle 5 centrality bin
TProfile * fHist_Corr3p_EP_Norm_PN[2][4]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_EtaDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_pTSum_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_pTDiff_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Pion_EP_Refm_PP[2][4]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0A_NN[2][6]
TH2F * fQAEtaPhiAfterNUA
Event weights for non-flat centrality.
const char Option_t
Definition: External.C:48
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0A_PN[2][6]
TH3D * fHCorrectNUAposProton[5]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_EP_Refm_PN[2][4]
bool Bool_t
Definition: External.C:53
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_pTDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_pTDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Pion_EP_Refm_NN[2][4]
TH2F * fV0MultChVsRun
Full Event plane.
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Proton_EP_Refm_PP[2][4]
TProfile * fHist_Corr3p_EP_Refm_PP[2][4]
TProfile * fHist_Reso2n_EP_Refm_Det[2][4]
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_pTSum_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Proton_EP_Refm_NN[2][4]
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_EtaDiff_EP_V0C_NN[2][6]
TH2D * fHAvgerageQnV0C
V0A Average <Qn>, n=2,3.
TProfile * fHist_Corr3p_EP_Norm_PP[2][4]