AliPhysics  32e057f (32e057f)
AliAnalysisTaskCMEV0.cxx
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
17 // CME correlator study using VO.
18 // Author: Rihan Haque (mhaque@cern.ch)
20 
21 
22 
23 #include <TGrid.h>
24 #include <TFile.h>
25 #include <TList.h>
26 #include "TMatrixDSym.h"
27 #include "Riostream.h"
28 #include "AliAnalysisManager.h"
29 #include "AliInputEventHandler.h"
30 #include "AliOADBContainer.h"
31 #include "AliMultSelection.h"
32 #include "AliMultiplicity.h"
33 #include "AliAnalysisUtils.h"
34 #include "AliVVertex.h"
35 #include "AliAODTrack.h"
36 #include "AliAODEvent.h"
37 #include "AliAODHeader.h"
38 #include "AliAODVertex.h"
39 #include "AliAODVZERO.h"
40 #include "AliAODZDC.h"
41 #include "AliFlowEvent.h"
42 #include "AliFlowEventSimple.h"
43 #include "AliAnalysisTaskCMEV0.h"
44 
45 
46 using std::endl;
47 using std::cout;
48 
49 ClassImp(AliAnalysisTaskCMEV0)
50 
52  fEvent(NULL),
53  fMultSelection(NULL),
54  fAnalysisUtil(NULL),
55  fListHistos(NULL),
56  fListCalibs(NULL),
57  fListNUAHist(NULL),
58  fListFBHijing(NULL),
59  fListNUACorr(NULL),
60  fListZDNCorr(NULL),
61  fListV0MCorr(NULL),
62  fRejectPileUp(kTRUE),
63  fRejectPileUpTight(kTRUE),
64  bFillAvgTPCQn(kFALSE),
65  bFillEtaPhiNUA(kFALSE),
66  bApplyNUACorr(kFALSE),
67  bApplyZDCCorr(kFALSE),
68  bApplyNUAforEP(kFALSE),
69  bFillZDCinfo(kFALSE),
70  bSkipNestedTrk(kFALSE),
71  bRemNegTrkRndm(kFALSE),
72  bApplyV0MCorr(kFALSE),
73  sDataSet("2015"),
74  sAnalysisSet("DoGainEq"),
75  sCentEstimator("V0"),
76  sFileNUA("NewR"),
77  sMCdimension("1D"),
78  fRunFlag(0),
79  fOldRunNum(0),
80  fievent(0),
81  EvtCent(0.0),
82  fHarmonicN(1),
83  fHarmonicM(1),
84  fHarmonicPsi(2),
85  fPileUpSlopeParm(3.43),
86  fPileUpConstParm(43),
87  fHist_Event_count(NULL),
88  fPileUpMultSelCount(NULL),
89  fPileUpCount(NULL),
90  fTaskConfigParm(NULL),
91  fMultV0(NULL),
92  fQxnmV0A(NULL),
93  fQynmV0A(NULL),
94  fQxnsV0A(NULL),
95  fQynsV0A(NULL),
96  fQxnmV0C(NULL),
97  fQynmV0C(NULL),
98  fQxnsV0C(NULL),
99  fQynsV0C(NULL),
100  fHV0AEventPlaneVsCent(NULL),
101  fHV0CEventPlaneVsCent(NULL),
102  fHTPCEventPlaneVsCent(NULL),
103  fHEnergyZNCvsCent(NULL),
104  fHEnergyZNAvsCent(NULL),
105  fHEnergyZPCvsCent(NULL),
106  fHEnergyZPAvsCent(NULL),
107  fHEnergyZNCvsCentRun(NULL),
108  fHEnergyZNAvsCentRun(NULL),
109  fHEnergyZPCvsCentRun(NULL),
110  fHEnergyZPAvsCentRun(NULL),
111  fHEnergyZPCvsZPA(NULL),
112  fHEnergyZNCvsZNA(NULL),
113  hUnderOverBinNUApos(NULL),
114  hUnderOverBinNUAneg(NULL),
115  fHCentBinTrkRecenter(NULL),
116  fHCorrectZDNP(NULL),
117  fV0AQnxVsCentRun(NULL),
118  fV0AQnyVsCentRun(NULL),
119  fV0CQnxVsCentRun(NULL),
120  fV0CQnyVsCentRun(NULL),
121  fTPCQnxVsCentRun(NULL),
122  fTPCQnyVsCentRun(NULL),
123  mListNUAPos(NULL),
124  mListNUANeg(NULL),
125  fileNUApos(NULL),
126  fileNUAneg(NULL),
127  fAvgMultCentRun(NULL),
128  fAvgWgtMultCentRun(NULL),
129  fAvgPOIposCentRun(NULL),
130  fAvgPOInegCentRun(NULL),
131  fAvgPOIPPCentRun(NULL),
132  fAvgPOINNCentRun(NULL),
133  fAvgPOIOSCentRun(NULL),
134  fV0MultChVsRun(NULL),
135  fEventStatvsRun(NULL),
136  fEtaBinFinderForQA(NULL),
137  fVzBinFinderForNUA(NULL),
138  fHistVtxZvsRun(NULL),
139  fHistVtxXvsRun(NULL),
140  fHistVtxYvsRun(NULL),
141  fRejectRatioVsCR(NULL),
142  fCentDistvsRun(NULL),
143  fHCorrectV0M(NULL),
144  fCentV0MvsVzRun(NULL),
145  fCent3pvsVzRun(NULL),
146  fTPCvsGlobalTrk(NULL),
147  fTPCvsITSTrk(NULL),
148  fITSvsESDMult(NULL),
149  fGlobalITSMult(NULL),
150  fCentCL1vsVzRun(NULL)
151 {
152  for(int i=0;i<5;i++){
153  fHCorrectNUApos[i] = NULL;
154  fHCorrectNUAneg[i] = NULL;
155  }
156  for(int i=0;i<90;i++){
157  runNums[i] = 0;
158  for(int j=0;j<5;j++){
159  fHist3DEtaPhiVz_Pos_Run[j][i] = NULL;
160  fHist3DEtaPhiVz_Neg_Run[j][i] = NULL;
161  }
162  }
163  for(int i=0;i<10;i++){
164  fFB_Efficiency_Cent[i] = NULL;
165  fFB_Efficiency_Pos[i] = NULL;
166  fFB_Efficiency_Neg[i] = NULL;
167  }
168  for(int i=0;i<2;i++){
169  for(int j=0;j<3;j++){
170  fHist_Corr3p_SP_Norm_PN[i][j] = NULL;
171  fHist_Corr3p_SP_Norm_PP[i][j] = NULL;
172  fHist_Corr3p_SP_Norm_NN[i][j] = NULL;
173  fHist_Reso2n_SP_Norm_Det[i][j] = NULL;
174  }
175  }
176  for(int i=0;i<2;i++){
177  for(int j=0;j<3;j++){
178  fHist_Corr3p_EP_Norm_PN[i][j] = NULL;
179  fHist_Corr3p_EP_Norm_PP[i][j] = NULL;
180  fHist_Corr3p_EP_Norm_NN[i][j] = NULL;
181  fHist_Reso2n_EP_Norm_Det[i][j] = NULL;
182  }
183  }
184  for(int i=0;i<2;i++){
185  fHist_Corr3p_vsRun_EP_PN[i] = NULL;
186  fHist_Corr3p_vsRun_EP_PP[i] = NULL;
187  fHist_Corr3p_vsRun_EP_NN[i] = NULL;
188  }
189  for(int i=0;i<3;i++){
190  fHist_Corr3p_ZDN_SP_PN[i] = NULL;
191  fHist_Corr3p_ZDN_SP_PP[i] = NULL;
192  fHist_Corr3p_ZDN_SP_NN[i] = NULL;
193  fHist_Reso2n_ZDN_SP_Det[i] = NULL;
194  }
195  for(int i=0;i<2;i++){
196  for(int j=0;j<6;j++){
197  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = NULL;
198  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = NULL;
199  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = NULL;
200  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = NULL;
201  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = NULL;
202  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = NULL;
203 
204  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = NULL;
205  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = NULL;
206  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = NULL;
207  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = NULL;
208  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = NULL;
209  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = NULL;
210 
211  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = NULL;
212  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = NULL;
213  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = NULL;
214  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = NULL;
215  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = NULL;
216  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = NULL;
217  }
218  }
219  for(int i=0;i<10;i++){
220  fHistChPosvsEtaPtRun[i] = NULL;
221  fHistChNegvsEtaPtRun[i] = NULL;
222  }
223  for(int i=0;i<2;i++){
224  fHist_Corr3p_QAEta_SP_V0A_PN[i] = NULL;
225  fHist_Corr3p_QAEta_SP_V0A_PP[i] = NULL;
226  fHist_Corr3p_QAEta_SP_V0A_NN[i] = NULL;
227  }
228  for(int i=0;i<2;i++){
229  fHist_Corr3p_QAEta_SP_V0C_PN[i] = NULL;
230  fHist_Corr3p_QAEta_SP_V0C_PP[i] = NULL;
231  fHist_Corr3p_QAEta_SP_V0C_NN[i] = NULL;
232  }
233  for(int i=0;i<4;i++){
234  fHCos1nPosChEtaVz[i] = NULL;
235  fHCos2nPosChEtaVz[i] = NULL;
236  fHCos3nPosChEtaVz[i] = NULL;
237  fHCos4nPosChEtaVz[i] = NULL;
238  fHSin1nPosChEtaVz[i] = NULL;
239  fHSin2nPosChEtaVz[i] = NULL;
240  fHSin3nPosChEtaVz[i] = NULL;
241  fHSin4nPosChEtaVz[i] = NULL;
242 
243  fHCos1nNegChEtaVz[i] = NULL;
244  fHCos2nNegChEtaVz[i] = NULL;
245  fHCos3nNegChEtaVz[i] = NULL;
246  fHCos4nNegChEtaVz[i] = NULL;
247  fHSin1nNegChEtaVz[i] = NULL;
248  fHSin2nNegChEtaVz[i] = NULL;
249  fHSin3nNegChEtaVz[i] = NULL;
250  fHSin4nNegChEtaVz[i] = NULL;
251 
252  fHCos2nDWPosChEtaVz[i] = NULL;
253  fHSin2nDWPosChEtaVz[i] = NULL;
254  fHCos2nDWNegChEtaVz[i] = NULL;
255  fHSin2nDWNegChEtaVz[i] = NULL;
256  }
257  for(int i=0;i<2;i++){
258  fHist_NonIso_SP_PP_Mag0[i] = NULL;
259  fHist_NonIso_SP_NN_Mag0[i] = NULL;
260  fHist_NonIso_SP_PP_Mag1[i] = NULL;
261  fHist_NonIso_SP_NN_Mag1[i] = NULL;
262  }
263  for(int i=0;i<2;i++){
264  fHist_Corr2p_EP_Norm_PN[i] = NULL;
265  fHist_Corr2p_EP_Norm_PP[i] = NULL;
266  fHist_Corr2p_EP_Norm_NN[i] = NULL;
267  }
268 
269  DefineInput(1, AliFlowEventSimple::Class()); // Input slot #1: AliFlowEventSimple
270 
271  DefineOutput(1,TList::Class());
272  DefineOutput(2,TList::Class());
273  DefineOutput(3,TList::Class());
274 
275 }//-------- real ---------
276 
278  fEvent(NULL),
279  fMultSelection(NULL),
280  fAnalysisUtil(NULL),
281  fListHistos(NULL),
282  fListCalibs(NULL),
283  fListNUAHist(NULL),
284  fListFBHijing(NULL),
285  fListNUACorr(NULL),
286  fListZDNCorr(NULL),
287  fListV0MCorr(NULL),
288  fRejectPileUp(kTRUE),
289  fRejectPileUpTight(kTRUE),
290  bFillAvgTPCQn(kFALSE),
291  bFillEtaPhiNUA(kFALSE),
292  bApplyNUACorr(kFALSE),
293  bApplyZDCCorr(kFALSE),
294  bApplyNUAforEP(kFALSE),
295  bFillZDCinfo(kFALSE),
296  bSkipNestedTrk(kFALSE),
297  bRemNegTrkRndm(kFALSE),
298  bApplyV0MCorr(kFALSE),
299  sDataSet("2015"),
300  sAnalysisSet("DoGainEq"),
301  sCentEstimator("V0"),
302  sFileNUA("NewR"),
303  sMCdimension("1D"),
304  fRunFlag(0),
305  fOldRunNum(0),
306  fievent(0),
307  EvtCent(0.0),
308  fHarmonicN(1),
309  fHarmonicM(1),
310  fHarmonicPsi(2),
311  fPileUpSlopeParm(3.43),
312  fPileUpConstParm(43),
313  fHist_Event_count(NULL),
314  fPileUpMultSelCount(NULL),
315  fPileUpCount(NULL),
316  fTaskConfigParm(NULL),
317  fMultV0(NULL),
318  fQxnmV0A(NULL),
319  fQynmV0A(NULL),
320  fQxnsV0A(NULL),
321  fQynsV0A(NULL),
322  fQxnmV0C(NULL),
323  fQynmV0C(NULL),
324  fQxnsV0C(NULL),
325  fQynsV0C(NULL),
326  fHV0AEventPlaneVsCent(NULL),
327  fHV0CEventPlaneVsCent(NULL),
328  fHTPCEventPlaneVsCent(NULL),
329  fHEnergyZNCvsCent(NULL),
330  fHEnergyZNAvsCent(NULL),
331  fHEnergyZPCvsCent(NULL),
332  fHEnergyZPAvsCent(NULL),
333  fHEnergyZNCvsCentRun(NULL),
334  fHEnergyZNAvsCentRun(NULL),
335  fHEnergyZPCvsCentRun(NULL),
336  fHEnergyZPAvsCentRun(NULL),
337  fHEnergyZPCvsZPA(NULL),
338  fHEnergyZNCvsZNA(NULL),
339  hUnderOverBinNUApos(NULL),
340  hUnderOverBinNUAneg(NULL),
341  fHCentBinTrkRecenter(NULL),
342  fHCorrectZDNP(NULL),
343  fV0AQnxVsCentRun(NULL),
344  fV0AQnyVsCentRun(NULL),
345  fV0CQnxVsCentRun(NULL),
346  fV0CQnyVsCentRun(NULL),
347  fTPCQnxVsCentRun(NULL),
348  fTPCQnyVsCentRun(NULL),
349  mListNUAPos(NULL),
350  mListNUANeg(NULL),
351  fileNUApos(NULL),
352  fileNUAneg(NULL),
353  fAvgMultCentRun(NULL),
354  fAvgWgtMultCentRun(NULL),
355  fAvgPOIposCentRun(NULL),
356  fAvgPOInegCentRun(NULL),
357  fAvgPOIPPCentRun(NULL),
358  fAvgPOINNCentRun(NULL),
359  fAvgPOIOSCentRun(NULL),
360  fV0MultChVsRun(NULL),
361  fEventStatvsRun(NULL),
362  fEtaBinFinderForQA(NULL),
363  fVzBinFinderForNUA(NULL),
364  fHistVtxZvsRun(NULL),
365  fHistVtxXvsRun(NULL),
366  fHistVtxYvsRun(NULL),
367  fRejectRatioVsCR(NULL),
368  fCentDistvsRun(NULL),
369  fHCorrectV0M(NULL),
370  fCentV0MvsVzRun(NULL),
371  fCent3pvsVzRun(NULL),
372  fTPCvsGlobalTrk(NULL),
373  fTPCvsITSTrk(NULL),
374  fITSvsESDMult(NULL),
375  fGlobalITSMult(NULL),
376  fCentCL1vsVzRun(NULL)
377 {
378  for(int i=0;i<5;i++){
379  fHCorrectNUApos[i] = NULL;
380  fHCorrectNUAneg[i] = NULL;
381  }
382  for(int i=0;i<90;i++){
383  runNums[i] = 0;
384  for(int j=0;j<5;j++){
385  fHist3DEtaPhiVz_Pos_Run[j][i] = NULL;
386  fHist3DEtaPhiVz_Neg_Run[j][i] = NULL;
387  }
388  }
389  for(int i=0;i<10;i++){
390  fFB_Efficiency_Cent[i] = NULL;
391  fFB_Efficiency_Pos[i] = NULL;
392  fFB_Efficiency_Neg[i] = NULL;
393  }
394  for(int i=0;i<2;i++){
395  for(int j=0;j<3;j++){
396  fHist_Corr3p_SP_Norm_PN[i][j] = NULL;
397  fHist_Corr3p_SP_Norm_PP[i][j] = NULL;
398  fHist_Corr3p_SP_Norm_NN[i][j] = NULL;
399  fHist_Reso2n_SP_Norm_Det[i][j] = NULL;
400  }
401  }
402  for(int i=0;i<2;i++){
403  for(int j=0;j<3;j++){
404  fHist_Corr3p_EP_Norm_PN[i][j] = NULL;
405  fHist_Corr3p_EP_Norm_PP[i][j] = NULL;
406  fHist_Corr3p_EP_Norm_NN[i][j] = NULL;
407  fHist_Reso2n_EP_Norm_Det[i][j] = NULL;
408  }
409  }
410  for(int i=0;i<2;i++){
411  fHist_Corr3p_vsRun_EP_PN[i] = NULL;
412  fHist_Corr3p_vsRun_EP_PP[i] = NULL;
413  fHist_Corr3p_vsRun_EP_NN[i] = NULL;
414  }
415  for(int i=0;i<3;i++){
416  fHist_Corr3p_ZDN_SP_PN[i] = NULL;
417  fHist_Corr3p_ZDN_SP_PP[i] = NULL;
418  fHist_Corr3p_ZDN_SP_NN[i] = NULL;
419  fHist_Reso2n_ZDN_SP_Det[i] = NULL;
420  }
421  for(int i=0;i<2;i++){
422  for(int j=0;j<6;j++){
423  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = NULL;
424  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = NULL;
425  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = NULL;
426  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = NULL;
427  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = NULL;
428  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = NULL;
429 
430  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = NULL;
431  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = NULL;
432  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = NULL;
433  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = NULL;
434  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = NULL;
435  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = NULL;
436 
437  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = NULL;
438  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = NULL;
439  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = NULL;
440  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = NULL;
441  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = NULL;
442  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = NULL;
443  }
444  }
445  for(int i=0;i<10;i++){
446  fHistChPosvsEtaPtRun[i] = NULL;
447  fHistChNegvsEtaPtRun[i] = NULL;
448  }
449  for(int i=0;i<2;i++){
453  }
454  for(int i=0;i<2;i++){
458  }
459  for(int i=0;i<4;i++){
460  fHCos1nPosChEtaVz[i] = NULL;
461  fHCos2nPosChEtaVz[i] = NULL;
462  fHCos3nPosChEtaVz[i] = NULL;
463  fHCos4nPosChEtaVz[i] = NULL;
464  fHSin1nPosChEtaVz[i] = NULL;
465  fHSin2nPosChEtaVz[i] = NULL;
466  fHSin3nPosChEtaVz[i] = NULL;
467  fHSin4nPosChEtaVz[i] = NULL;
468 
469  fHCos1nNegChEtaVz[i] = NULL;
470  fHCos2nNegChEtaVz[i] = NULL;
471  fHCos3nNegChEtaVz[i] = NULL;
472  fHCos4nNegChEtaVz[i] = NULL;
473  fHSin1nNegChEtaVz[i] = NULL;
474  fHSin2nNegChEtaVz[i] = NULL;
475  fHSin3nNegChEtaVz[i] = NULL;
476  fHSin4nNegChEtaVz[i] = NULL;
477 
478  fHCos2nDWPosChEtaVz[i] = NULL;
479  fHSin2nDWPosChEtaVz[i] = NULL;
480  fHCos2nDWNegChEtaVz[i] = NULL;
481  fHSin2nDWNegChEtaVz[i] = NULL;
482  }
483  for(int i=0;i<2;i++){
484  fHist_NonIso_SP_PP_Mag0[i] = NULL;
485  fHist_NonIso_SP_NN_Mag0[i] = NULL;
486  fHist_NonIso_SP_PP_Mag1[i] = NULL;
487  fHist_NonIso_SP_NN_Mag1[i] = NULL;
488  }
489  for(int i=0;i<2;i++){
490  fHist_Corr2p_EP_Norm_PN[i] = NULL;
491  fHist_Corr2p_EP_Norm_PP[i] = NULL;
492  fHist_Corr2p_EP_Norm_NN[i] = NULL;
493  }
494 
495 }//-----------
496 
497 
498 
499 
501 {
503 
504  fAnalysisUtil = new AliAnalysisUtils();
505  fAnalysisUtil->SetUseMVPlpSelection(kTRUE);
506  fAnalysisUtil->SetUseOutOfBunchPileUp(kTRUE);
507 
508 
509  if(fListFBHijing) {
510  if(sMCdimension=="1D"){
511  for(int i=0;i<10;i++) {
512  fFB_Efficiency_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_%d",i));
513  }
514  }
515  else if(sMCdimension=="3D"){
516  Int_t centFB[11] = {0,5,10,20,30,40,50,60,70,80,90};
517  for(int i=0;i<10;i++) {
518  fFB_Efficiency_Pos[i] = (TH3F *) fListFBHijing->FindObject(Form("fHistCorrectionPlus%d-%d",centFB[i],centFB[i+1]));
519  fFB_Efficiency_Neg[i] = (TH3F *) fListFBHijing->FindObject(Form("fHistCorrectionMinus%d-%d",centFB[i],centFB[i+1]));
520  }
521  }
522  else{
523  printf("\n\n!!***** Warning *****!!\n Enter correct Dimention !!\n\n"); exit(1);
524  }
525  }
526  else{ // if MC efficiency not found then use weight = 1.
527  printf("\n\n!!***** Warning *****!!\n FilterBit efficiency not found, use = 1.0 !!\n\n");
528  for(int i=0;i<10;i++){
529  fFB_Efficiency_Cent[i] = new TH1D(Form("eff_unbiased_%d",i),"",1,0,50.);
530  fFB_Efficiency_Cent[i]->SetBinContent(1,1.0);
531  fFB_Efficiency_Pos[i] = new TH3F(Form("eff_unbiased_Pos_%d",i),"",1,-0.9,0.9,1,0,50,1,0,7);
532  fFB_Efficiency_Pos[i]->SetBinContent(1,1,1,1.0);
533  fFB_Efficiency_Neg[i] = new TH3F(Form("eff_unbiased_Neg_%d",i),"",1,-0.9,0.9,1,0,50,1,0,7);
534  fFB_Efficiency_Neg[i]->SetBinContent(1,1,1,1.0);
535  }
536  }
537 
538 
539 
540  fListHistos = new TList();
541  fListHistos->SetOwner(kTRUE);
542 
543  fListCalibs = new TList();
544  fListCalibs->SetOwner(kTRUE);
545 
546  fListNUAHist = new TList();
547  fListNUAHist->SetOwner(kTRUE);
548 
549  this->DefineHistograms();
550 
551 
552  fTaskConfigParm->Fill(14.5,fHarmonicN);
553  fTaskConfigParm->Fill(15.5,fHarmonicM);
554  fTaskConfigParm->Fill(16.5,fHarmonicPsi);
555 
556 
557  PostData(1,fListHistos);
558  PostData(2,fListCalibs);
559 
560 }
561 
563 {
564  delete fListHistos;
565  delete fListCalibs;
566 
567  if(fAnalysisUtil) delete fAnalysisUtil; // it is '= new' !!!
568 
569  delete fHCentBinTrkRecenter;
570 
571  if(fHCorrectV0M) delete fHCorrectV0M;
572 
573  for(int i=0;i<5;i++){
574  if(fHCorrectNUApos[i]) delete fHCorrectNUApos[i];
575  if(fHCorrectNUAneg[i]) delete fHCorrectNUAneg[i];
576  }
577  for(int i=0;i<10;i++){
578  if(fFB_Efficiency_Cent[i]) delete fFB_Efficiency_Cent[i];
579  if(fFB_Efficiency_Pos[i]) delete fFB_Efficiency_Pos[i];
580  if(fFB_Efficiency_Neg[i]) delete fFB_Efficiency_Neg[i];
581  }
582 }
583 
584 
585 
586 
587 
588 
589 
591 {
592 
593  Float_t stepCount = 0.5;
594  fHist_Event_count->Fill(stepCount); //1
595  stepCount++;
596 
597  AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
598  fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(1));
599 
600  if(!aod || !fEvent){
601  printf("\n ... ::UserExec = no AOD or Flow Event, \n.... EXIT ..... \n");
602  return;
603  }
604 
605  fHist_Event_count->Fill(stepCount); //2
606  stepCount++;
607 
608 
609  //---------pileup rejection: --------
610 
611  Bool_t kPileupEvent = kFALSE;
612 
613  kPileupEvent = CheckEventIsPileUp(aod);
614 
615  if(kPileupEvent) return;
616 
617 
618 
619  fHist_Event_count->Fill(stepCount); //3
620  stepCount++;
621 
622 
623 
624  Double_t centrV0M = -1;
625  Double_t centrCL1 = -1;
626  Double_t centrCL0 = -1;
627  Double_t centrTRK = -1;
628  EvtCent = -1;
629 
630  if(sDataSet=="2010"||sDataSet=="2011"){
631  centrV0M = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("V0M");
632  centrCL1 = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL1");
633  centrCL0 = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL0");
634  centrTRK = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("TRK");
635  }
636  else{
637  fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection");
638  if(!fMultSelection) {
639  printf("\n\n **WARNING** ::UserExec() AliMultSelection object not found.\n\n");
640  exit(1);
641  }
642  centrV0M = fMultSelection->GetMultiplicityPercentile("V0M");
643  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
644  centrCL0 = fMultSelection->GetMultiplicityPercentile("CL0");
645  centrTRK = fMultSelection->GetMultiplicityPercentile("TRK");
646  }
647 
648 
649 
650  if(sCentEstimator=="V0" || sCentEstimator=="V0M"){
651  EvtCent = centrV0M;
652  }
653  else{
654  EvtCent = centrCL1;
655  }
656 
657 
658  Int_t iCentSPD = centrCL1;
659 
660  if(iCentSPD > 90) return;
661 
662  fHist_Event_count->Fill(stepCount); //4
663  stepCount++;
664 
665 
666 
667 
668  Int_t cIndex = 0;
669  Int_t cForNUA = 0;
670  Int_t cInputNUA = 0;
671 
672  if(EvtCent<5.0) {
673  cIndex = 0;
674  cForNUA = 0; //0=0-5,
675  cInputNUA = 0;
676  }
677  else if(EvtCent>=5.0 && EvtCent<10){
678  cIndex = 1;
679  cForNUA = 1; // 1=5-10,
680  cInputNUA = 1;
681  }
682  else if(EvtCent>=10.0) {
683  cIndex = abs(EvtCent/10.0) + 1;
684  cForNUA = cIndex; //2 = 10-20,
685 
686  if(EvtCent>=10 && EvtCent<40.0)
687  cInputNUA = 2;
688 
689  if(EvtCent>=20 && EvtCent<40.0){
690  cForNUA = 3; // 3=20-40
691  }
692  if(EvtCent>=40.0){
693  cForNUA = 4; // 4=40-90
694  cInputNUA = 3;
695  }
696  }
697 
698 
699 
700  //------- load v0 calib file of Alex --------
701  Int_t runindex = -111;
702  Int_t runNumber = aod->GetRunNumber();
703  Float_t psiN = fHarmonicPsi;
704  runindex = GetCurrentRunIndex(runNumber);
705 
706  if(runNumber!=fOldRunNum){
707 
708  if(sDataSet=="2015" || sDataSet=="2015PbPb")
709  OpenInfoCalbration(runNumber, psiN);
710  if(bApplyNUACorr){
711  GetNUACorrectionHist(runNumber,sFileNUA);
712  }
713  //if(bApplyZDCCorr && sDataSet=="2015"){
715  GetZDCCorrectionHist(runNumber);
716  }
717 
718  if(sDataSet=="2015pPb"||sDataSet=="pPb"){
719  if(bApplyV0MCorr) GetV0MCorrectionHist(runNumber);
720  }
721 
722  fOldRunNum = runNumber;
723  }
724 
725 
726 
727 
728  Double_t fMagField = aod->GetMagneticField();
729  Int_t QAindex = -1;
730 
731  if(fMagField<0)
732  QAindex = 0;
733  else if(fMagField>0)
734  QAindex = 1;
735 
736 //-------- V0 info ---------------
737  const AliAODVZERO *fAODV0 = aod->GetVZEROData();
738 
739 
740 
741  Double_t QyanCor = 0., QycnCor = 0.;
742  Double_t QxanCor = 0., QxcnCor = 0.;
743  Double_t Qxan = 0., Qyan = 0.;
744  Double_t Qxcn = 0., Qycn = 0.;
745  Double_t sumMa = 0., sumMc = 0.;
746  Double_t fMultv0 = 0.;
747  Double_t phiV0 = 0.;
748 
749 
750  if(sDataSet=="2015" || sDataSet=="2015PbPb") {
751  GetV0QvectAndMult(fAODV0, psiN, Qxan, Qyan, sumMa, Qxcn, Qycn, sumMc);
752 
753  QyanCor = (Qyan - fQynmV0A->GetBinContent(iCentSPD+1))/fQynsV0A->GetBinContent(iCentSPD+1);
754  QycnCor = (Qycn - fQynmV0C->GetBinContent(iCentSPD+1))/fQynsV0C->GetBinContent(iCentSPD+1);
755 
756  QxanCor = Qxan;
757  QxcnCor = Qxcn;
758 
759  if(psiN != 4.){
760  QxanCor = (Qxan - fQxnmV0A->GetBinContent(iCentSPD+1))/fQxnsV0A->GetBinContent(iCentSPD+1);
761  QxcnCor = (Qxcn - fQxnmV0C->GetBinContent(iCentSPD+1))/fQxnsV0C->GetBinContent(iCentSPD+1);
762  }
763  }
764  else{
765 
766  for(int iV0 = 0; iV0 < 64; iV0++) { //0-31 is V0C, 32-63 VOA
767 
768  fMultv0 = fAODV0->GetMultiplicity(iV0);
769 
770  if(fHCorrectV0M){
771  fMultv0 = fMultv0 * fHCorrectV0M->GetBinContent(iV0+1); // Gain Correction
772  }
773 
774  phiV0 = TMath::PiOver4()*(0.5 + iV0 % 8);
775 
776  if(iV0 < 32){
777  Qxcn += TMath::Cos(fHarmonicPsi*phiV0) * fMultv0;
778  Qycn += TMath::Sin(fHarmonicPsi*phiV0) * fMultv0;
779  sumMc += fMultv0;
780  }
781  else if(iV0 >= 32){
782  Qxan += TMath::Cos(fHarmonicPsi*phiV0) * fMultv0;
783  Qyan += TMath::Sin(fHarmonicPsi*phiV0) * fMultv0;
784  sumMa += fMultv0;
785  }
786  }
787 
788  QxanCor = Qxan;
789  QxcnCor = Qxcn;
790  QyanCor = Qyan;
791  QycnCor = Qycn;
792 
793  }
794 
795 
796  //Fill V0M Mult for all System:
797  for(int iV0 = 0; iV0 < 64; iV0++) { //0-31 is V0C, 32-63 VOA
798  fMultv0 = fAODV0->GetMultiplicity(iV0);
799  fV0MultChVsRun->Fill(iV0+0.5,runindex,fMultv0);
800  }
801 
802 
803 
804 
805  if(sumMa <= 0 || sumMc <= 0) return;
806  fHist_Event_count->Fill(stepCount); //5
807  stepCount++;
808 
809 
810  AliAODVertex *pVertex = aod->GetPrimaryVertex();
811  Double_t VtxZ = pVertex->GetZ();
812  Double_t VtxX = pVertex->GetX();
813  Double_t VtxY = pVertex->GetY();
814 
815  if(sDataSet=="2015pPb" || sDataSet=="pPb"){
816 
817  if(VtxZ < 1.e-4 && VtxX < 1.e-4 && VtxY < 1.e-4)
818  return;
819 
820  fHistVtxZvsRun->Fill(runindex,VtxZ);
821  fHistVtxXvsRun->Fill(runindex,VtxX);
822  fHistVtxYvsRun->Fill(runindex,VtxY);
823  }
824 
825 
826  //------------- Load ZDC info: -----------
827  Double_t energyZNC=0.,energyZNA=0.,energyZPC=0.,energyZPA=0.;
828 
829  energyZNC = ((AliVAODHeader*)aod->GetHeader())->GetZDCN1Energy();
830  energyZNA = ((AliVAODHeader*)aod->GetHeader())->GetZDCN2Energy();
831  energyZPC = ((AliVAODHeader*)aod->GetHeader())->GetZDCP1Energy();
832  energyZPA = ((AliVAODHeader*)aod->GetHeader())->GetZDCP2Energy();
833 
834 
835  //Apply Gain Correction:
837  energyZNC = energyZNC * fHCorrectZDNP->GetBinContent((abs(EvtCent)+1),1);
838  energyZNA = energyZNA * fHCorrectZDNP->GetBinContent((abs(EvtCent)+1),2);
839  energyZPC = energyZPC * fHCorrectZDNP->GetBinContent((abs(EvtCent)+1),3);
840  energyZPA = energyZPA * fHCorrectZDNP->GetBinContent((abs(EvtCent)+1),4);
841  }
842 
843  //fill ZDC info: Uses
844  if(bFillZDCinfo){
845  //fHEnergyZNCvsCent->Fill(EvtCent,energyZNC);
846  //fHEnergyZNAvsCent->Fill(EvtCent,energyZNA);
847  //fHEnergyZPCvsCent->Fill(EvtCent,energyZPC);
848  //fHEnergyZPAvsCent->Fill(EvtCent,energyZPA);
849 
850  fHEnergyZNCvsCentRun->Fill(EvtCent,runindex,energyZNC);
851  fHEnergyZNAvsCentRun->Fill(EvtCent,runindex,energyZNA);
852  fHEnergyZPCvsCentRun->Fill(EvtCent,runindex,energyZPC);
853  fHEnergyZPAvsCentRun->Fill(EvtCent,runindex,energyZPA);
854 
855  //if(EvtCent>30. && EvtCent<40.){
856  //fHEnergyZPCvsZPA->Fill(energyZPC,energyZPA);
857  //fHEnergyZNCvsZNA->Fill(energyZNC,energyZNA);
858  //}
859  }
860 
861 
862 
863 
864 
865  Int_t BadRuns[10] = {246871,246870,246867,246865,246864,246859,246858,246676,246675,246540};
866  Int_t iBadrun = 10;
867  Int_t isBadRun = 0;
868 
869  for(int ib=0;ib<iBadrun;ib++){
870  if(runNumber==BadRuns[ib]){
871  isBadRun = 1;
872  break;
873  }
874  }
875 
876 
877 
878  //Store Qvector for tracks:
879  Double_t QxPos[2] = {0.,}; //[0]=n*phi,[1]=2*n*phi
880  Double_t QyPos[2] = {0.,};
881  Double_t QxNeg[2] = {0.,};
882  Double_t QyNeg[2] = {0.,};
883 
884  //Store Qvector for Auto-correlations
885  Double_t QxAutoPos[2] = {0.,};
886  Double_t QyAutoPos[2] = {0.,};
887  Double_t QxAutoNeg[2] = {0.,};
888  Double_t QyAutoNeg[2] = {0.,};
889 
890 
891  //temp: for QA only
892  Double_t QxPosQAEta[16] = {0.,};
893  Double_t QyPosQAEta[16] = {0.,};
894  Double_t QxNegQAEta[16] = {0.,};
895  Double_t QyNegQAEta[16] = {0.,};
896  Double_t QxAutoPosQAEta[16] = {0.,};
897  Double_t QyAutoPosQAEta[16] = {0.,};
898  Double_t QxAutoNegQAEta[16] = {0.,};
899  Double_t QyAutoNegQAEta[16] = {0.,};
900  Double_t MPOIposQAEta[16] = {0.,};
901  Double_t MPOInegQAEta[16] = {0.,};
902  Int_t iEtaQA = -1;
903 
904  Double_t AvgCos1n=0.,AvgSin1n=0.;
905  //Double_t AvgCos2n=0.,AvgSin2n=0.;
906  Double_t AvgDWCos2n=0.,AvgDWSin2n=0.;
907 
908 
909 
910 
911 
912  //Multiplicity of POIs:
913  Double_t MPOIpos = 0;
914  Double_t MPOIneg = 0;
915  Double_t McorrPos = 0.;
916  Double_t McorrNeg = 0.;
917 
918  //TPC Event plane Qvectors:
919  Double_t QxTPC[2] = {0.,};
920  Double_t QyTPC[2] = {0.,};
921 
922  Int_t ptBin;
923  Int_t nRefMult = 0;
924  Int_t n = fHarmonicN;
925  Int_t m = fHarmonicM;
926  Int_t p = (fHarmonicN+fHarmonicM); // cos(nphi1 + mphi2 - p*Psi)
927 
928  Double_t nRefMultWgt = 0.;
929 
930 
931 
932 
933  //Int_t iCentRec = 0; //centrality bin for track recenter
934  //iCentRec = fHCentBinTrkRecenter->FindBin(EvtCent);
935 
936  //Int_t nBinVz=1,nBinPhi=1,nBinEta=1;
937 
938  //CME using Event plane:
939  Double_t pi = TMath::Pi();
940  Double_t Psi2V0C = 1./psiN*TMath::ATan2(QycnCor,QxcnCor);
941  if(Psi2V0C<0.) Psi2V0C += 2*pi/psiN;
942 
943  Double_t Psi2V0A = 1./psiN*TMath::ATan2(QyanCor,QxanCor);
944  if(Psi2V0A<0.) Psi2V0A += 2*pi/psiN;
945 
946  fV0AQnxVsCentRun->Fill(centrCL1,runindex,QycnCor); // For V0-Q Recenter QA.
947  fV0AQnyVsCentRun->Fill(centrCL1,runindex,QyanCor);
948  fV0CQnxVsCentRun->Fill(centrCL1,runindex,QxcnCor);
949  fV0CQnyVsCentRun->Fill(centrCL1,runindex,QycnCor);
950 
951 
952 
953  Int_t iBinNUA = 1;
954  Int_t iVzNUA = -1;
955  iVzNUA = fVzBinFinderForNUA->FindBin(VtxZ) - 1;
956 
957 
958 
959  Int_t iTracks = fEvent->NumberOfTracks();
960 
961  Int_t icReject = 0;
962 
963 
964  AliFlowTrackSimple* pTrack1 = NULL;
965  AliFlowTrackSimple* pTrack2 = NULL;
966 
967  Double_t dPhi1,dPt1,dEta1,dChrg1;
968  Double_t dPhi2,dPt2,dEta2,dChrg2;
969  Double_t WgtEP = 1.0;
970 
971  Double_t ptw1 = 1.0, w1NUA = 1.0;
972  Double_t ptw2 = 1.0;
973  Double_t w2NUA = 1.0;
974 
975 
976  for(int i=0; i<iTracks; i++) {
977  pTrack1 = fEvent->GetTrack(i);
978  if(!pTrack1) continue;
979  dPhi1 = pTrack1->Phi(); //0-2pi range
980  dPt1 = pTrack1-> Pt();
981  dEta1 = pTrack1->Eta();
982  dChrg1 = pTrack1->Charge();
983 
984  if(!pTrack1->InPOISelection())
985  continue;
986 
987  //remove randomly -Ve tracks:
988  //if(bRemNegTrkRndm && dChrg1<0 && fRand.Rndm()<0.15){
989  //icReject++;
990  //continue;
991  //}
992 
993 
994  if(bFillEtaPhiNUA){
995  if(dChrg1>0){
996  fHist3DEtaPhiVz_Pos_Run[cForNUA][runindex]->Fill(VtxZ,dPhi1,dEta1);
997  }
998  else if(dChrg1<0){
999  fHist3DEtaPhiVz_Neg_Run[cForNUA][runindex]->Fill(VtxZ,dPhi1,dEta1);
1000  }
1001  }
1002  /*
1003  if(bFillEtaPhiNUA){
1004  if(dChrg1>0){
1005  fHist3DEtaPhiVz_Pos_Run[iVzNUA][runindex]->Fill(dPt1,dPhi1,dEta1);
1006  }
1007  else if(dChrg1<0){
1008  fHist3DEtaPhiVz_Neg_Run[iVzNUA][runindex]->Fill(dPt1,dPhi1,dEta1);
1009  }
1010  }*/
1011 
1012  if(bApplyNUACorr){
1013  //get NUA weights:
1014  if(sFileNUA=="New2018"){
1015  if(dChrg1>0){
1016  iBinNUA = fHCorrectNUApos[cForNUA]->FindBin(VtxZ,dPhi1,dEta1);
1017  w1NUA = fHCorrectNUApos[cForNUA]->GetBinContent(iBinNUA);
1018  }
1019  else if(dChrg1<0){
1020  iBinNUA = fHCorrectNUAneg[cForNUA]->FindBin(VtxZ,dPhi1,dEta1);
1021  w1NUA = fHCorrectNUAneg[cForNUA]->GetBinContent(iBinNUA);
1022  }
1023  }
1024  else if(sFileNUA=="OldJ"||sFileNUA=="NewR"){
1025  if(dChrg1>0){
1026  iBinNUA = fHCorrectNUApos[cInputNUA]->FindBin(VtxZ,dPhi1,dEta1);
1027  w1NUA = fHCorrectNUApos[cInputNUA]->GetBinContent(iBinNUA);
1028  }
1029  else if(dChrg1<0){
1030  iBinNUA = fHCorrectNUAneg[cInputNUA]->FindBin(VtxZ,dPhi1,dEta1);
1031  w1NUA = fHCorrectNUAneg[cInputNUA]->GetBinContent(iBinNUA);
1032  }
1033  if(sFileNUA=="OldJ") w1NUA = 1./w1NUA;
1034  }
1035  else if(sFileNUA=="NewPt"||sFileNUA=="NewpT"){
1036  if(dChrg1>0){
1037  iBinNUA = fHCorrectNUApos[iVzNUA]->FindBin(dPt1,dPhi1,dEta1);
1038  w1NUA = fHCorrectNUApos[iVzNUA]->GetBinContent(iBinNUA);
1039  }
1040  else if(dChrg1<0){
1041  iBinNUA = fHCorrectNUAneg[iVzNUA]->FindBin(dPt1,dPhi1,dEta1);
1042  w1NUA = fHCorrectNUAneg[iVzNUA]->GetBinContent(iBinNUA);
1043  }
1044  }
1045  if(w1NUA > 1e3 ) w1NUA = 1.0;
1046  }
1047 
1048 
1049 
1050  if(dChrg1>0){
1051  fHistChPosvsEtaPtRun[cIndex]->Fill(dPt1,dEta1,runindex,w1NUA);
1052  }
1053  else if(dChrg1<0){
1054  fHistChNegvsEtaPtRun[cIndex]->Fill(dPt1,dEta1,runindex,w1NUA);
1055  }
1056 
1057 
1058 
1059  if(sMCdimension=="1D"){
1060  ptBin = fFB_Efficiency_Cent[cIndex]->FindBin(dPt1);
1061  ptw1 = 1.0/fFB_Efficiency_Cent[cIndex]->GetBinContent(ptBin);
1062  }
1063  else if(sMCdimension=="3D"){
1064  if(dChrg1>0){
1065  ptBin = fFB_Efficiency_Pos[cIndex]->FindBin(dEta1,dPt1,dPhi1); //left here
1066  ptw1 = fFB_Efficiency_Pos[cIndex]->GetBinContent(ptBin);
1067  }
1068  else if(dChrg1<0){
1069  ptBin = fFB_Efficiency_Neg[cIndex]->FindBin(dEta1,dPt1,dPhi1); //left here
1070  ptw1 = fFB_Efficiency_Neg[cIndex]->GetBinContent(ptBin);
1071  }
1072  }
1073 
1074  if (ptw1>1e3) ptw1 = 1.0;
1075 
1076  /*
1077  if(bFillAvgTPCQn) { //fill TPC Q-vect:
1078  if(VtxZ>0 && dEta1>=0){
1079  if(dChrg1>0){
1080  fHCos1nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1081  fHSin1nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1082  fHCos2nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1083  fHSin2nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1084  fHCos3nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1085  fHSin3nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1086  fHCos4nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1087  fHSin4nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1088  fHCos2nDWPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1089  fHSin2nDWPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1090  }
1091  else if(dChrg1<0){
1092  fHCos1nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1093  fHSin1nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1094  fHCos2nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1095  fHSin2nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1096  fHCos3nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1097  fHSin3nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1098  fHCos4nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1099  fHSin4nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1100  fHCos2nDWNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1101  fHSin2nDWNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1102  }
1103  }
1104  else if(VtxZ>0 && dEta1<0){
1105  if(dChrg1>0){
1106  fHCos1nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1107  fHSin1nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1108  fHCos2nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1109  fHSin2nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1110  fHCos3nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1111  fHSin3nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1112  fHCos4nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1113  fHSin4nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1114  fHCos2nDWPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1115  fHSin2nDWPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1116  }
1117  else if(dChrg1<0){
1118  fHCos1nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1119  fHSin1nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1120  fHCos2nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1121  fHSin2nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1122  fHCos3nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1123  fHSin3nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1124  fHCos4nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1125  fHSin4nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1126  fHCos2nDWNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1127  fHSin2nDWNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1128  }
1129  }
1130  else if(VtxZ<0 && dEta1>=0){
1131  if(dChrg1>0){
1132  fHCos1nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1133  fHSin1nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1134  fHCos2nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1135  fHSin2nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1136  fHCos3nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1137  fHSin3nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1138  fHCos4nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1139  fHSin4nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1140  fHCos2nDWPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1141  fHSin2nDWPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1142  }
1143  else if(dChrg1<0){
1144  fHCos1nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1145  fHSin1nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1146  fHCos2nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1147  fHSin2nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1148  fHCos3nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1149  fHSin3nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1150  fHCos4nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1151  fHSin4nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1152  fHCos2nDWNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1153  fHSin2nDWNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1154  }
1155 
1156  }
1157  else if(VtxZ<0 && dEta1<0){
1158  if(dChrg1>0){
1159  fHCos1nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1160  fHSin1nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1161  fHCos2nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1162  fHSin2nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1163  fHCos3nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1164  fHSin3nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1165  fHCos4nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1166  fHSin4nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1167  fHCos2nDWPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1168  fHSin2nDWPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1169  }
1170  else if(dChrg1<0){
1171  fHCos1nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1172  fHSin1nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1173  fHCos2nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1174  fHSin2nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1175  fHCos3nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1176  fHSin3nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1177  fHCos4nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1178  fHSin4nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1179  fHCos2nDWNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1180  fHSin2nDWNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1181  }
1182  }
1183  }*/
1184 
1185 
1186  if(isBadRun) continue;
1187 
1188 
1189 
1190  iEtaQA = fEtaBinFinderForQA->FindBin(dEta1) - 1;
1191 
1192  if(dChrg1>0){
1193  QxPos[0] += (ptw1*w1NUA*TMath::Cos(n*dPhi1) - AvgCos1n);
1194  QyPos[0] += (ptw1*w1NUA*TMath::Sin(n*dPhi1) - AvgSin1n);
1195  QxAutoPos[0] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Cos(2.*n*dPhi1) - AvgDWCos2n);
1196  QyAutoPos[0] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Sin(2.*n*dPhi1) - AvgDWSin2n);
1197  MPOIpos += w1NUA*ptw1;
1198  McorrPos += w1NUA*ptw1*w1NUA*ptw1;
1199  //QA: eta dependence
1200  if(EvtCent>=10 && EvtCent<20){
1201  QxPosQAEta[iEtaQA] += (ptw1*w1NUA*TMath::Cos(n*dPhi1) - AvgCos1n);
1202  QyPosQAEta[iEtaQA] += (ptw1*w1NUA*TMath::Sin(n*dPhi1) - AvgSin1n);
1203  QxAutoPosQAEta[iEtaQA] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Cos(2.*n*dPhi1) - AvgDWCos2n);
1204  QyAutoPosQAEta[iEtaQA] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Sin(2.*n*dPhi1) - AvgDWSin2n);
1205  MPOIposQAEta[iEtaQA] += ptw1*w1NUA;
1206  }
1207  }
1208  else if(dChrg1<0){
1209  QxNeg[0] += (ptw1*w1NUA*TMath::Cos(n*dPhi1) - AvgCos1n);
1210  QyNeg[0] += (ptw1*w1NUA*TMath::Sin(n*dPhi1) - AvgSin1n);
1211  QxAutoNeg[0] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Cos(2.*n*dPhi1) - AvgDWCos2n);
1212  QyAutoNeg[0] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Sin(2.*n*dPhi1) - AvgDWSin2n);
1213  MPOIneg += w1NUA*ptw1;
1214  McorrNeg += w1NUA*ptw1*w1NUA*ptw1;
1215  //QA: eta dependence
1216  if(EvtCent>=10 && EvtCent<20){
1217  QxNegQAEta[iEtaQA] += (ptw1*w1NUA*TMath::Cos(n*dPhi1) - AvgCos1n);
1218  QyNegQAEta[iEtaQA] += (ptw1*w1NUA*TMath::Sin(n*dPhi1) - AvgSin1n);
1219  QxAutoNegQAEta[iEtaQA] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Cos(2.*n*dPhi1) - AvgDWCos2n);
1220  QyAutoNegQAEta[iEtaQA] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Sin(2.*n*dPhi1) - AvgDWSin2n);
1221  MPOInegQAEta[iEtaQA] += ptw1*w1NUA;
1222  }
1223  }
1224 
1225  //QxTPC[0] += ptw1*w1NUA*TMath::Cos(n*dPhi1);
1226  //QyTPC[0] += ptw1*w1NUA*TMath::Sin(n*dPhi1);
1227  QxTPC[1] += ptw1*w1NUA*TMath::Cos(psiN*dPhi1);
1228  QyTPC[1] += ptw1*w1NUA*TMath::Sin(psiN*dPhi1);
1229 
1230  nRefMult++;
1231  nRefMultWgt += ptw1*w1NUA;
1232 
1233 
1234  //if(i%10==0)
1235  //cout<<" track "<<i<<" eta = "<<dEta1<<"\tdPhi1 = "<<dPhi1<<"\tptw1 = "<<ptw1<<"\tw1NUA = "<<w1NUA<<"\tAvgCos1n = "<<AvgCos1n<<endl;
1236 
1237 
1238  if(bSkipNestedTrk) continue;
1239 
1240  //2nd track loop:
1241  for(int j=0; j<iTracks; j++) {
1242 
1243  if(j==i) continue; //Auto-correlation removed.
1244 
1245  pTrack2 = fEvent->GetTrack(j);
1246  if(!pTrack2) continue;
1247  dPhi2 = pTrack2->Phi(); //0-2pi range
1248  dPt2 = pTrack2-> Pt();
1249  dEta2 = pTrack2->Eta();
1250  dChrg2 = pTrack2->Charge();
1251 
1252  if(!pTrack2->InPOISelection())
1253  continue;
1254 
1255  //remove randomly -Ve tracks:
1256  //if(bRemNegTrkRndm && dChrg1<0 && fRand.Rndm()<0.15){
1257  //continue;
1258  //}
1259 
1260 
1261  if(sMCdimension=="1D"){
1262  ptBin = fFB_Efficiency_Cent[cIndex]->FindBin(dPt2);
1263  ptw2 = 1.0/fFB_Efficiency_Cent[cIndex]->GetBinContent(ptBin);
1264  }
1265  else if(sMCdimension=="3D"){
1266  if(dChrg2>0){
1267  ptBin = fFB_Efficiency_Pos[cIndex]->FindBin(dEta2,dPt2,dPhi2); //left here
1268  ptw2 = fFB_Efficiency_Pos[cIndex]->GetBinContent(ptBin);
1269  }
1270  else if(dChrg2<0){
1271  ptBin = fFB_Efficiency_Neg[cIndex]->FindBin(dEta2,dPt2,dPhi2); //left here
1272  ptw2 = fFB_Efficiency_Neg[cIndex]->GetBinContent(ptBin);
1273  }
1274  }
1275 
1276  if (ptw2>1e3) ptw1 = 1.0;
1277 
1278 
1279  if(bApplyNUACorr) {
1280  //get NUA weights:
1281  if(sFileNUA=="New2018"){
1282  if(dChrg2>0){
1283  iBinNUA = fHCorrectNUApos[cForNUA]->FindBin(VtxZ,dPhi1,dEta1);
1284  w1NUA = fHCorrectNUApos[cForNUA]->GetBinContent(iBinNUA);
1285  }
1286  else if(dChrg2<0){
1287  iBinNUA = fHCorrectNUAneg[cForNUA]->FindBin(VtxZ,dPhi1,dEta1);
1288  w1NUA = fHCorrectNUAneg[cForNUA]->GetBinContent(iBinNUA);
1289  }
1290  }
1291  else if(sFileNUA=="OldJ"||sFileNUA=="NewR"){
1292  if(dChrg2>0){
1293  iBinNUA = fHCorrectNUApos[cInputNUA]->FindBin(VtxZ,dPhi2,dEta2);
1294  w2NUA = fHCorrectNUApos[cInputNUA]->GetBinContent(iBinNUA);
1295  }
1296  else if(dChrg2<0){
1297  iBinNUA = fHCorrectNUAneg[cInputNUA]->FindBin(VtxZ,dPhi2,dEta2);
1298  w2NUA = fHCorrectNUAneg[cInputNUA]->GetBinContent(iBinNUA);
1299  }
1300  if(sFileNUA=="OldJ") w2NUA = 1./w2NUA;
1301  }
1302  else if(sFileNUA=="NewPt"||sFileNUA=="NewpT"){
1303  if(dChrg2>0){
1304  iBinNUA = fHCorrectNUApos[iVzNUA]->FindBin(dPt2,dPhi2,dEta2);
1305  w2NUA = fHCorrectNUApos[iVzNUA]->GetBinContent(iBinNUA);
1306  }
1307  else if(dChrg2<0){
1308  iBinNUA = fHCorrectNUAneg[iVzNUA]->FindBin(dPt2,dPhi2,dEta2);
1309  w2NUA = fHCorrectNUAneg[iVzNUA]->GetBinContent(iBinNUA);
1310  }
1311  }
1312  if(w2NUA > 1e3 ) w2NUA = 1.0;
1313  }
1314  if(bApplyNUAforEP){
1315  WgtEP = ptw1*ptw2*w1NUA*w2NUA;
1316  }
1317  else{
1318  WgtEP = 1.0;
1319  }
1320 
1321  if(dChrg1!=dChrg2){
1322  fHist_Corr3p_EP_Norm_PN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1323  fHist_Corr3p_EP_Norm_PN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1324 
1325  if(EvtCent>=10. && EvtCent<20){
1326  fCent3pvsVzRun->Fill(VtxZ,runindex,TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A));
1327  }
1328 
1329  //fHist_Corr3p_vsRun_EP_PN[0]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1330  //fHist_Corr3p_vsRun_EP_PN[1]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1331 
1332  fHist_Corr2p_EP_Norm_PN[QAindex]->Fill(EvtCent,0.5,TMath::Cos((dPhi1 - dPhi2)),WgtEP);
1333  fHist_Corr2p_EP_Norm_PN[QAindex]->Fill(EvtCent,1.5,TMath::Cos(2.*(dPhi1 - dPhi2)),WgtEP);
1334  fHist_Corr2p_EP_Norm_PN[QAindex]->Fill(EvtCent,2.5,TMath::Cos(3.*(dPhi1 - dPhi2)),WgtEP);
1335  fHist_Corr2p_EP_Norm_PN[QAindex]->Fill(EvtCent,3.5,TMath::Cos(4.*(dPhi1 - dPhi2)),WgtEP);
1336 
1337  if(cIndex<6){
1338  fHist_Corr3p_pTSum_EP_V0A_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1339  fHist_Corr3p_pTSum_EP_V0C_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1340  fHist_Corr3p_pTDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1341  fHist_Corr3p_pTDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1342  fHist_Corr3p_EtaDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1343  fHist_Corr3p_EtaDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1344  }
1345  }
1346  else if(dChrg1>0 && dChrg2>0){
1347  fHist_Corr3p_EP_Norm_PP[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1348  fHist_Corr3p_EP_Norm_PP[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1349 
1350  //fHist_Corr3p_vsRun_EP_PP[0]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1351  //fHist_Corr3p_vsRun_EP_PP[1]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1352 
1353  fHist_Corr2p_EP_Norm_PP[QAindex]->Fill(EvtCent,0.5,TMath::Cos((dPhi1 - dPhi2)),WgtEP);
1354  fHist_Corr2p_EP_Norm_PP[QAindex]->Fill(EvtCent,1.5,TMath::Cos(2.*(dPhi1 - dPhi2)),WgtEP);
1355  fHist_Corr2p_EP_Norm_PP[QAindex]->Fill(EvtCent,2.5,TMath::Cos(3.*(dPhi1 - dPhi2)),WgtEP);
1356  fHist_Corr2p_EP_Norm_PP[QAindex]->Fill(EvtCent,3.5,TMath::Cos(4.*(dPhi1 - dPhi2)),WgtEP);
1357 
1358  if(cIndex<6){
1359  fHist_Corr3p_pTSum_EP_V0A_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1360  fHist_Corr3p_pTSum_EP_V0C_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1361  fHist_Corr3p_pTDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1362  fHist_Corr3p_pTDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1363  fHist_Corr3p_EtaDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1364  fHist_Corr3p_EtaDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1365  }
1366  }
1367  else if(dChrg1<0 && dChrg2<0){
1368  fHist_Corr3p_EP_Norm_NN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1369  fHist_Corr3p_EP_Norm_NN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1370 
1371  //fHist_Corr3p_vsRun_EP_NN[0]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1372  //fHist_Corr3p_vsRun_EP_NN[1]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1373 
1374  fHist_Corr2p_EP_Norm_NN[QAindex]->Fill(EvtCent,0.5,TMath::Cos((dPhi1 - dPhi2)),WgtEP);
1375  fHist_Corr2p_EP_Norm_NN[QAindex]->Fill(EvtCent,1.5,TMath::Cos(2.*(dPhi1 - dPhi2)),WgtEP);
1376  fHist_Corr2p_EP_Norm_NN[QAindex]->Fill(EvtCent,2.5,TMath::Cos(3.*(dPhi1 - dPhi2)),WgtEP);
1377  fHist_Corr2p_EP_Norm_NN[QAindex]->Fill(EvtCent,3.5,TMath::Cos(4.*(dPhi1 - dPhi2)),WgtEP);
1378 
1379  if(cIndex<6){
1380  fHist_Corr3p_pTSum_EP_V0A_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1381  fHist_Corr3p_pTSum_EP_V0C_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1382  fHist_Corr3p_pTDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1383  fHist_Corr3p_pTDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1384  fHist_Corr3p_EtaDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1385  fHist_Corr3p_EtaDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1386  }
1387  }
1388  }//nested loop ends
1389  }//------ track loop ends ------
1390 
1391 
1392 
1393  fEventStatvsRun->Fill(runindex);
1394 
1395  fCentDistvsRun->Fill(EvtCent,runindex);
1396 
1397 
1398  if(EvtCent<=20){
1399  fCentV0MvsVzRun->Fill(VtxZ,runindex,EvtCent);
1400  fCentCL1vsVzRun->Fill(VtxZ,runindex,(centrCL1-EvtCent));
1401  }
1402 
1403 
1404  Double_t QTPCRe = QxTPC[1];
1405  Double_t QTPCIm = QyTPC[1];
1406 
1407  if(QTPCRe==0 && QTPCIm==0) return; // remove events with |Q| = 0
1408 
1409  fHist_Event_count->Fill(stepCount); //6
1410  stepCount++;
1411 
1412 
1413  Double_t Psi2TPC = 1./psiN*(TMath::ATan2(QTPCIm,QTPCRe));
1414  if(Psi2TPC < 0.) Psi2TPC += 2*pi/psiN;
1415 
1416  fTPCQnxVsCentRun->Fill(EvtCent,runindex,TMath::Cos(Psi2TPC));
1417  fTPCQnyVsCentRun->Fill(EvtCent,runindex,TMath::Sin(Psi2TPC));//centrCL1
1418 
1419 
1420 
1421 
1422  PostData(3,fListNUAHist); // Store NUA for all Runs including bad one.
1423  if(isBadRun) return;
1424 
1425 
1426  fHist_Event_count->Fill(stepCount); //7
1427  stepCount++;
1428 
1429 
1430 
1431  Float_t fNegTracks = iTracks*0.5;
1432  Float_t ratioReject = (Float_t) icReject/fNegTracks;
1433 
1434  fRejectRatioVsCR->Fill(EvtCent,runindex,ratioReject);
1435 
1436 
1437 
1438 
1439 
1440 
1441 
1442 //V0A-V0C EP resolution:
1443  fHist_Reso2n_EP_Norm_Det[QAindex][0]->Fill(EvtCent, TMath::Cos(psiN*(Psi2V0A-Psi2V0C)));
1444 //V0A-TPC EP resolution:
1445  fHist_Reso2n_EP_Norm_Det[QAindex][1]->Fill(EvtCent, TMath::Cos(psiN*(Psi2V0A-Psi2TPC)));
1446 //V0C-TPC EP resolution:
1447  fHist_Reso2n_EP_Norm_Det[QAindex][2]->Fill(EvtCent, TMath::Cos(psiN*(Psi2V0C-Psi2TPC)));
1448 
1449  fHV0AEventPlaneVsCent->Fill(EvtCent,Psi2V0A);
1450  fHV0CEventPlaneVsCent->Fill(EvtCent,Psi2V0C);
1451  fHTPCEventPlaneVsCent->Fill(EvtCent,Psi2TPC);
1452 
1453 
1454 
1455 
1456 
1457 
1458  //------- SP Method -------------
1459 
1460 
1461  Double_t uPRe=0.,uNRe=0.,uPIm=0.,uNIm=0.,uN2Re=0.,uN2Im=0.,uP2Re=0.,uP2Im=0.;
1462  Double_t uPM=0.,uNM=0.;
1463  //Double_t VCIm=0., VPRe=0.,VPIm=0.;
1464 
1465 
1466  uPM = MPOIpos; uNM = MPOIneg;
1467 
1468  uPRe = QxPos[0]; uNRe = QxNeg[0];
1469  uPIm = QyPos[0]; uNIm = QyNeg[0];
1470 
1471  uP2Re = QxAutoPos[0]; uP2Im = QyAutoPos[0];
1472  uN2Re = QxAutoNeg[0]; uN2Im = QyAutoNeg[0];
1473 
1474  Double_t TwoQpQnV = 0.,TwoQpQpV=0.,TwoQnQnV=0.;
1475 
1476  if(uPM > 1 && uNM > 1) {
1477  //CME w.r.t V0A EP:
1478  TwoQpQnV = ((uPRe*uNRe-uPIm*uNIm)*QxanCor + (uPRe*uNIm+uPIm*uNRe)*QyanCor) / (uPM*uNM) ;
1479  TwoQpQpV = ((uPRe*uPRe-uPIm*uPIm-uP2Re)*QxanCor + (2.*uPRe*uPIm-uP2Im)*QyanCor) / (uPM*(uPM-1)) ;
1480  TwoQnQnV = ((uNRe*uNRe-uNIm*uNIm-uN2Re)*QxanCor + (2.*uNRe*uNIm-uN2Im)*QyanCor) / (uNM*(uNM-1)) ;
1481  //Fill profiles:
1482  fHist_Corr3p_SP_Norm_PN[QAindex][0]->Fill(EvtCent, TwoQpQnV, uPM*uNM);
1483  fHist_Corr3p_SP_Norm_PP[QAindex][0]->Fill(EvtCent, TwoQpQpV, (uPM*(uPM-1)));
1484  fHist_Corr3p_SP_Norm_NN[QAindex][0]->Fill(EvtCent, TwoQnQnV, (uNM*(uNM-1)));
1485 
1486  //-------- Fill NonIsotropic terms ------
1487 
1488  Double_t QnNonIsoRe = 0.,QnNonIsoIm=0.;
1489 
1490  if(QAindex==0){ //B < 0
1491  //charge pos:
1492  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 0.5,uPRe/uPM,uPM); //<Cos(nPhi)> ChPos
1493  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 1.5,uPIm/uPM,uPM); //<Sin(nPhi)> ChPos
1494 
1495  QnNonIsoRe = (uPRe*QxanCor + uPIm*QyanCor)/uPM;
1496  QnNonIsoIm = (uPIm*QxanCor - uPRe*QyanCor)/uPM;
1497  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 2.5,QnNonIsoRe,uPM); //<Cos(nPhi-mPsi)> ChPos
1498  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 3.5,QnNonIsoIm,uPM); //<Sin(nPhi-mPsi)> ChPos
1499 
1500  QnNonIsoRe = (uPRe*uPRe-uPIm*uPIm-uP2Re)/(uPM*(uPM-1));
1501  QnNonIsoIm = (2.*uPRe*uPIm-uP2Im)/(uPM*(uPM-1));
1502  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 4.5,QnNonIsoRe,(uPM*(uPM-1))); //<Cos(nPhi1+nPhi2)> ChPos
1503  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 5.5,QnNonIsoIm,(uPM*(uPM-1))); //<Sin(nPhi1+nPhi2)> ChPos
1504 
1505  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1506  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1507  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1508  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1509 
1510  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 8.5,QxanCor,uPM); //<Cos(mPsiEP)>
1511  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 9.5,QyanCor,uPM); //<Sin(mPsiEP)>
1512 
1513  //charge neg:
1514  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 0.5,uNRe/uNM,uNM); //<Cos(nPhi)> ChNeg
1515  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 1.5,uNIm/uNM,uNM); //<Sin(nPhi)> ChNeg
1516 
1517  QnNonIsoRe = (uNRe*QxanCor + uNIm*QyanCor)/uNM;
1518  QnNonIsoIm = (uNIm*QxanCor - uNRe*QyanCor)/uNM;
1519  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 2.5,QnNonIsoRe,uNM); //<Cos(nPhi-mPsi)> ChNeg
1520  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 3.5,QnNonIsoIm,uNM); //<Cos(nPhi-mPsi)> ChNeg
1521 
1522  QnNonIsoRe = (uNRe*uNRe-uNIm*uNIm-uN2Re)/(uNM*(uNM-1));
1523  QnNonIsoIm = (2.*uNRe*uNIm-uN2Im)/(uNM*(uNM-1));
1524  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 4.5,QnNonIsoRe,(uNM*(uNM-1))); //<Cos(nPhi1+nPhi2)> ChNeg
1525  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 5.5,QnNonIsoIm,(uNM*(uNM-1))); //<Sin(nPhi1+nPhi2)> ChNeg
1526 
1527  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1528  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1529  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1530  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1531 
1532  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 8.5,QxanCor,uNM); //<Cos(mPsiEP)>
1533  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 9.5,QyanCor,uNM); //<Sin(mPsiEP)>
1534  }
1535  else if(QAindex==1){ //B > 0
1536  //charge pos:
1537  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 0.5,uPRe/uPM,uPM); //<Cos(nPhi)> ChPos
1538  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 1.5,uPIm/uPM,uPM); //<Sin(nPhi)> ChPos
1539 
1540  QnNonIsoRe = (uPRe*QxanCor + uPIm*QyanCor)/uPM;
1541  QnNonIsoIm = (uPIm*QxanCor - uPRe*QyanCor)/uPM;
1542  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 2.5,QnNonIsoRe,uPM); //<Cos(nPhi-mPsi)> ChPos
1543  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 3.5,QnNonIsoIm,uPM); //<Sin(nPhi-mPsi)> ChPos
1544 
1545  QnNonIsoRe = (uPRe*uPRe-uPIm*uPIm-uP2Re)/(uPM*(uPM-1));
1546  QnNonIsoIm = (2.*uPRe*uPIm-uP2Im)/(uPM*(uPM-1));
1547  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 4.5,QnNonIsoRe,(uPM*(uPM-1))); //<Cos(nPhi1+nPhi2)> ChPos
1548  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 5.5,QnNonIsoIm,(uPM*(uPM-1))); //<Sin(nPhi1+nPhi2)> ChPos
1549 
1550  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1551  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1552  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1553  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1554 
1555  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 8.5,QxanCor,uPM); //<Cos(mPsiEP)>
1556  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 9.5,QyanCor,uPM); //<Sin(mPsiEP)>
1557 
1558  //charge neg:
1559  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 0.5,uNRe/uNM,uNM); //<Cos(nPhi)> ChNeg
1560  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 1.5,uNIm/uNM,uNM); //<Sin(nPhi)> ChNeg
1561 
1562  QnNonIsoRe = (uNRe*QxanCor + uNIm*QyanCor)/uNM;
1563  QnNonIsoIm = (uNIm*QxanCor - uNRe*QyanCor)/uNM;
1564  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 2.5,QnNonIsoRe,uNM); //<Cos(nPhi-mPsi)> ChNeg
1565  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 3.5,QnNonIsoIm,uNM); //<Cos(nPhi-mPsi)> ChNeg
1566 
1567  QnNonIsoRe = (uNRe*uNRe-uNIm*uNIm-uN2Re)/(uNM*(uNM-1));
1568  QnNonIsoIm = (2.*uNRe*uNIm-uN2Im)/(uNM*(uNM-1));
1569  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 4.5,QnNonIsoRe,(uNM*(uNM-1))); //<Cos(nPhi1+nPhi2)> ChNeg
1570  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 5.5,QnNonIsoIm,(uNM*(uNM-1))); //<Sin(nPhi1+nPhi2)> ChNeg
1571 
1572  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1573  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1574  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1575  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1576 
1577  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 8.5,QxanCor,uNM); //<Cos(mPsiEP)>
1578  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 9.5,QyanCor,uNM); //<Sin(mPsiEP)>
1579  }
1580 
1581 
1582  //-------- CME - ZDN correlators:---------
1583  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 0., TwoQpQnV, uPM*uNM);
1584  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 1., energyZPA, 1.);
1585  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 2., energyZPC, 1.);
1586  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1587  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 4., energyZNA, 1.);
1588  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 5., energyZNC, 1.);
1589  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1590  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 7., TwoQpQnV*energyZPA, uPM*uNM);
1591  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 8., TwoQpQnV*energyZPC, uPM*uNM);
1592  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 9., TwoQpQnV*(energyZPC+energyZPA), uPM*uNM);
1593  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 10., TwoQpQnV*energyZNA, uPM*uNM);
1594  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 11., TwoQpQnV*energyZNC, uPM*uNM);
1595  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 12., TwoQpQnV*(energyZNC+energyZNA), uPM*uNM);
1596 
1597  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 0., TwoQpQpV, (uPM*(uPM-1)));
1598  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 1., energyZPA, 1.);
1599  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 2., energyZPC, 1.);
1600  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1601  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 4., energyZNA, 1.);
1602  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 5., energyZNC, 1.);
1603  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1604  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 7., TwoQpQpV*energyZPA, (uPM*(uPM-1)));
1605  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 8., TwoQpQpV*energyZPC, (uPM*(uPM-1)));
1606  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 9., TwoQpQpV*(energyZPC+energyZPA), (uPM*(uPM-1)));
1607  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 10., TwoQpQpV*energyZNA, (uPM*(uPM-1)));
1608  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 11., TwoQpQpV*energyZNC, (uPM*(uPM-1)));
1609  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 12., TwoQpQpV*(energyZNC+energyZNA), (uPM*(uPM-1)));
1610 
1611  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 0., TwoQnQnV, (uNM*(uNM-1)));
1612  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 1., energyZPA, 1.);
1613  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 2., energyZPC, 1.);
1614  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1615  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 4., energyZNA, 1.);
1616  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 5., energyZNC, 1.);
1617  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1618  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 7., TwoQnQnV*energyZPA, (uNM*(uNM-1)));
1619  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 8., TwoQnQnV*energyZPC, (uNM*(uNM-1)));
1620  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 9., TwoQnQnV*(energyZPC+energyZPA), (uNM*(uNM-1)));
1621  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 10., TwoQnQnV*energyZNA, (uNM*(uNM-1)));
1622  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 11., TwoQnQnV*energyZNC, (uNM*(uNM-1)));
1623  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 12., TwoQnQnV*(energyZNC+energyZNA), (uNM*(uNM-1)));
1624  //-----------------------------------------
1625 
1626 
1627 
1628 
1629  //CME w.r.t V0C EP:
1630  TwoQpQnV = 0.; TwoQpQpV = 0.; TwoQnQnV = 0.;
1631  TwoQpQnV = ((uPRe*uNRe-uPIm*uNIm)*QxcnCor + (uPRe*uNIm+uPIm*uNRe)*QycnCor) / (uPM*uNM) ;
1632  TwoQpQpV = ((uPRe*uPRe-uPIm*uPIm-uP2Re)*QxcnCor + (2.*uPRe*uPIm-uP2Im)*QycnCor) / (uPM*(uPM-1)) ;
1633  TwoQnQnV = ((uNRe*uNRe-uNIm*uNIm-uN2Re)*QxcnCor + (2.*uNRe*uNIm-uN2Im)*QycnCor) / (uNM*(uNM-1)) ;
1634 
1635  //Fill profiles:
1636  fHist_Corr3p_SP_Norm_PN[QAindex][1]->Fill(EvtCent, TwoQpQnV, uPM*uNM);
1637  fHist_Corr3p_SP_Norm_PP[QAindex][1]->Fill(EvtCent, TwoQpQpV, (uPM*(uPM-1)));
1638  fHist_Corr3p_SP_Norm_NN[QAindex][1]->Fill(EvtCent, TwoQnQnV, (uNM*(uNM-1)));
1639 
1640  if(QAindex==0){ //B < 0
1641  //charge pos:
1642  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 0.5,uPRe/uPM,uPM); //<Cos(nPhi)> ChPos
1643  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 1.5,uPIm/uPM,uPM); //<Sin(nPhi)> ChPos
1644 
1645  QnNonIsoRe = (uPRe*QxcnCor + uPIm*QycnCor)/uPM;
1646  QnNonIsoIm = (uPIm*QxcnCor - uPRe*QycnCor)/uPM;
1647  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 2.5,QnNonIsoRe,uPM); //<Cos(nPhi-mPsi)> ChPos
1648  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 3.5,QnNonIsoIm,uPM); //<Sin(nPhi-mPsi)> ChPos
1649 
1650  QnNonIsoRe = (uPRe*uPRe-uPIm*uPIm-uP2Re)/(uPM*(uPM-1));
1651  QnNonIsoIm = (2.*uPRe*uPIm-uP2Im)/(uPM*(uPM-1));
1652  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 4.5,QnNonIsoRe,(uPM*(uPM-1))); //<Cos(nPhi1+nPhi2)> ChPos
1653  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 5.5,QnNonIsoIm,(uPM*(uPM-1))); //<Sin(nPhi1+nPhi2)> ChPos
1654 
1655  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1656  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1657  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1658  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1659 
1660  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 8.5,QxcnCor,uPM); //<Cos(mPsiEP)>
1661  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 9.5,QycnCor,uPM); //<Sin(mPsiEP)>
1662 
1663  //charge neg:
1664  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 0.5,uNRe/uNM,uNM); //<Cos(nPhi)> ChNeg
1665  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 1.5,uNIm/uNM,uNM); //<Sin(nPhi)> ChNeg
1666 
1667  QnNonIsoRe = (uNRe*QxcnCor + uNIm*QycnCor)/uNM;
1668  QnNonIsoIm = (uNIm*QxcnCor - uNRe*QycnCor)/uNM;
1669  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 2.5,QnNonIsoRe,uNM); //<Cos(nPhi-mPsi)> ChNeg
1670  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 3.5,QnNonIsoIm,uNM); //<Cos(nPhi-mPsi)> ChNeg
1671 
1672  QnNonIsoRe = (uNRe*uNRe-uNIm*uNIm-uN2Re)/(uNM*(uNM-1));
1673  QnNonIsoIm = (2.*uNRe*uNIm-uN2Im)/(uNM*(uNM-1));
1674  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 4.5,QnNonIsoRe,(uNM*(uNM-1))); //<Cos(nPhi1+nPhi2)> ChNeg
1675  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 5.5,QnNonIsoIm,(uNM*(uNM-1))); //<Sin(nPhi1+nPhi2)> ChNeg
1676 
1677  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1678  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1679  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1680  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1681 
1682  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 8.5,QxcnCor,uNM); //<Cos(mPsiEP)>
1683  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 9.5,QycnCor,uNM); //<Sin(mPsiEP)>
1684  }
1685  else if(QAindex==1) { //B > 0
1686  //charge pos:
1687  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 0.5,uPRe/uPM,uPM); //<Cos(nPhi)> ChPos
1688  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 1.5,uPIm/uPM,uPM); //<Sin(nPhi)> ChPos
1689 
1690  QnNonIsoRe = (uPRe*QxcnCor + uPIm*QycnCor)/uPM;
1691  QnNonIsoIm = (uPIm*QxcnCor - uPRe*QycnCor)/uPM;
1692  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 2.5,QnNonIsoRe,uPM); //<Cos(nPhi-mPsi)> ChPos
1693  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 3.5,QnNonIsoIm,uPM); //<Sin(nPhi-mPsi)> ChPos
1694 
1695  QnNonIsoRe = (uPRe*uPRe-uPIm*uPIm-uP2Re)/(uPM*(uPM-1));
1696  QnNonIsoIm = (2.*uPRe*uPIm-uP2Im)/(uPM*(uPM-1));
1697  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 4.5,QnNonIsoRe,(uPM*(uPM-1))); //<Cos(nPhi1+nPhi2)> ChPos
1698  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 5.5,QnNonIsoIm,(uPM*(uPM-1))); //<Sin(nPhi1+nPhi2)> ChPos
1699 
1700  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1701  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1702  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1703  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1704 
1705  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 8.5,QxcnCor,uPM); //<Cos(mPsiEP)>
1706  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 9.5,QycnCor,uPM); //<Sin(mPsiEP)>
1707 
1708  //charge neg:
1709  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 0.5,uNRe/uNM,uNM); //<Cos(nPhi)> ChNeg
1710  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 1.5,uNIm/uNM,uNM); //<Sin(nPhi)> ChNeg
1711 
1712  QnNonIsoRe = (uNRe*QxcnCor + uNIm*QycnCor)/uNM;
1713  QnNonIsoIm = (uNIm*QxcnCor - uNRe*QycnCor)/uNM;
1714  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 2.5,QnNonIsoRe,uNM); //<Cos(nPhi-mPsi)> ChNeg
1715  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 3.5,QnNonIsoIm,uNM); //<Cos(nPhi-mPsi)> ChNeg
1716 
1717  QnNonIsoRe = (uNRe*uNRe-uNIm*uNIm-uN2Re)/(uNM*(uNM-1));
1718  QnNonIsoIm = (2.*uNRe*uNIm-uN2Im)/(uNM*(uNM-1));
1719  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 4.5,QnNonIsoRe,(uNM*(uNM-1))); //<Cos(nPhi1+nPhi2)> ChNeg
1720  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 5.5,QnNonIsoIm,(uNM*(uNM-1))); //<Sin(nPhi1+nPhi2)> ChNeg
1721 
1722  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1723  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1724  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1725  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1726 
1727  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 8.5,QxcnCor,uNM); //<Cos(mPsiEP)>
1728  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 9.5,QycnCor,uNM); //<Sin(mPsiEP)>
1729  }
1730 
1731 
1732  //-------- CME - ZDN correlators:---------
1733  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 0., TwoQpQnV, uPM*uNM);
1734  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 1., energyZPA, 1.);
1735  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 2., energyZPC, 1.);
1736  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1737  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 4., energyZNA, 1.);
1738  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 5., energyZNC, 1.);
1739  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1740  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 7., TwoQpQnV*energyZPA, uPM*uNM);
1741  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 8., TwoQpQnV*energyZPC, uPM*uNM);
1742  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 9., TwoQpQnV*(energyZPC+energyZPA), uPM*uNM);
1743  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 10., TwoQpQnV*energyZNA, uPM*uNM);
1744  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 11., TwoQpQnV*energyZNC, uPM*uNM);
1745  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 12., TwoQpQnV*(energyZNC+energyZNA), uPM*uNM);
1746 
1747  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 0., TwoQpQpV, (uPM*(uPM-1)));
1748  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 1., energyZPA, 1.);
1749  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 2., energyZPC, 1.);
1750  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1751  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 4., energyZNA, 1.);
1752  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 5., energyZNC, 1.);
1753  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1754  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 7., TwoQpQpV*energyZPA, (uPM*(uPM-1)));
1755  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 8., TwoQpQpV*energyZPC, (uPM*(uPM-1)));
1756  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 9., TwoQpQpV*(energyZPC+energyZPA), (uPM*(uPM-1)));
1757  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 10., TwoQpQpV*energyZNA, (uPM*(uPM-1)));
1758  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 11., TwoQpQpV*energyZNC, (uPM*(uPM-1)));
1759  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 12., TwoQpQpV*(energyZNC+energyZNA), (uPM*(uPM-1)));
1760 
1761  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 0., TwoQnQnV, (uNM*(uNM-1)));
1762  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 1., energyZPA, 1.);
1763  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 2., energyZPC, 1.);
1764  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1765  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 4., energyZNA, 1.);
1766  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 5., energyZNC, 1.);
1767  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1768  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 7., TwoQnQnV*energyZPA, (uNM*(uNM-1)));
1769  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 8., TwoQnQnV*energyZPC, (uNM*(uNM-1)));
1770  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 9., TwoQnQnV*(energyZPC+energyZPA), (uNM*(uNM-1)));
1771  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 10., TwoQnQnV*energyZNA, (uNM*(uNM-1)));
1772  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 11., TwoQnQnV*energyZNC, (uNM*(uNM-1)));
1773  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 12., TwoQnQnV*(energyZNC+energyZNA), (uNM*(uNM-1)));
1774  //-----------------------------------------
1775 
1776 
1777  //Fill Mult, POIs vs cent:
1778 
1779  fAvgMultCentRun->Fill(EvtCent,runindex,nRefMult);
1780  fAvgWgtMultCentRun->Fill(EvtCent,runindex,nRefMultWgt);
1781  fAvgPOIposCentRun->Fill(EvtCent,runindex,uPM);
1782  fAvgPOInegCentRun->Fill(EvtCent,runindex,uNM);
1783  fAvgPOIPPCentRun->Fill(EvtCent,runindex,(uPM*(uPM-1)));
1784  fAvgPOINNCentRun->Fill(EvtCent,runindex,(uNM*(uNM-1)));
1785  fAvgPOIOSCentRun->Fill(EvtCent,runindex,uPM*uNM);
1786 
1787 
1788  //------------ eta depedence -----------------
1789  Double_t fEtaCent = -100.;
1790 
1791  for(int ie=0; ie<16; ie++){
1792 
1793  uPM = MPOIposQAEta[ie];
1794  uNM = MPOInegQAEta[ie];
1795 
1796  if(uPM>1 && uNM>1){
1797 
1798  uPRe = QxPosQAEta[ie];
1799  uNRe = QxNegQAEta[ie];
1800  uPIm = QyPosQAEta[ie];
1801  uNIm = QyNegQAEta[ie];
1802 
1803  uP2Re = QxAutoPosQAEta[ie];
1804  uP2Im = QyAutoPosQAEta[ie];
1805  uN2Re = QxAutoNegQAEta[ie];
1806  uN2Im = QyAutoNegQAEta[ie];
1807 
1808 
1809  fEtaCent = fEtaBinFinderForQA->GetBinCenter(ie+1);
1810 
1811  //w.r.t V0A:
1812  TwoQpQnV = 0.; TwoQpQpV = 0.; TwoQnQnV = 0.;
1813  TwoQpQnV = ((uPRe*uNRe-uPIm*uNIm)*QxanCor + (uPRe*uNIm+uPIm*uNRe)*QyanCor) / (uPM*uNM) ;
1814  TwoQpQpV = ((uPRe*uPRe-uPIm*uPIm-uP2Re)*QxanCor + (2.*uPRe*uPIm-uP2Im)*QyanCor) / (uPM*(uPM-1.)) ;
1815  TwoQnQnV = ((uNRe*uNRe-uNIm*uNIm-uN2Re)*QxanCor + (2.*uNRe*uNIm-uN2Im)*QyanCor) / (uNM*(uNM-1.)) ;
1816 
1817  fHist_Corr3p_QAEta_SP_V0A_PN[QAindex]->Fill(fEtaCent,TwoQpQnV,uPM*uNM);
1818  fHist_Corr3p_QAEta_SP_V0A_PP[QAindex]->Fill(fEtaCent,TwoQpQpV,uPM*(uPM-1.));
1819  fHist_Corr3p_QAEta_SP_V0A_NN[QAindex]->Fill(fEtaCent,TwoQnQnV,uNM*(uNM-1.));
1820 
1821  //w.r.t V0C:
1822  TwoQpQnV = 0.; TwoQpQpV = 0.; TwoQnQnV = 0.;
1823  TwoQpQnV = ((uPRe*uNRe-uPIm*uNIm)*QxcnCor + (uPRe*uNIm+uPIm*uNRe)*QycnCor) / (uPM*uNM) ;
1824  TwoQpQpV = ((uPRe*uPRe-uPIm*uPIm-uP2Re)*QxcnCor + (2.*uPRe*uPIm-uP2Im)*QycnCor) / (uPM*(uPM-1.)) ;
1825  TwoQnQnV = ((uNRe*uNRe-uNIm*uNIm-uN2Re)*QxcnCor + (2.*uNRe*uNIm-uN2Im)*QycnCor) / (uNM*(uNM-1.)) ;
1826 
1827  fHist_Corr3p_QAEta_SP_V0C_PN[QAindex]->Fill(fEtaCent,TwoQpQnV,uPM*uNM);
1828  fHist_Corr3p_QAEta_SP_V0C_PP[QAindex]->Fill(fEtaCent,TwoQpQpV,uPM*(uPM-1.));
1829  fHist_Corr3p_QAEta_SP_V0C_NN[QAindex]->Fill(fEtaCent,TwoQnQnV,uNM*(uNM-1.));
1830  }
1831  }
1832  //---------------------------------------
1833 
1834 
1835 
1836 
1837  if(MPOIpos>1 && MPOIneg>1){
1838  //V0A-V0C SP resolution:
1839  fHist_Reso2n_SP_Norm_Det[QAindex][0]->Fill(EvtCent, (QxcnCor*QxanCor+QycnCor*QyanCor));
1840  //V0A-TPC SP resolution:
1841  fHist_Reso2n_SP_Norm_Det[QAindex][1]->Fill(EvtCent, (QTPCRe*QxanCor+QTPCIm*QyanCor));
1842  //V0C-TPC SP resolution:
1843  fHist_Reso2n_SP_Norm_Det[QAindex][2]->Fill(EvtCent, (QTPCRe*QxcnCor+QTPCIm*QycnCor));
1844 
1845 
1846  //V0A-V0C:
1847  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 0., (QxcnCor*QxanCor+QycnCor*QyanCor));
1848  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 1., (QxcnCor*QxanCor+QycnCor*QyanCor)*energyZPA);
1849  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 2., (QxcnCor*QxanCor+QycnCor*QyanCor)*energyZPC);
1850  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 3., (QxcnCor*QxanCor+QycnCor*QyanCor)*(energyZPA+energyZPC));
1851  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 4., (QxcnCor*QxanCor+QycnCor*QyanCor)*energyZNA);
1852  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 5., (QxcnCor*QxanCor+QycnCor*QyanCor)*energyZNC);
1853  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 6., (QxcnCor*QxanCor+QycnCor*QyanCor)*(energyZNA+energyZNC));
1854 
1855  //V0A-TPC
1856  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 0., (QTPCRe*QxanCor+QTPCIm*QyanCor));
1857  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 1., (QTPCRe*QxanCor+QTPCIm*QyanCor)*energyZPA);
1858  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 2., (QTPCRe*QxanCor+QTPCIm*QyanCor)*energyZPC);
1859  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 3., (QTPCRe*QxanCor+QTPCIm*QyanCor)*(energyZPA+energyZPC));
1860  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 4., (QTPCRe*QxanCor+QTPCIm*QyanCor)*energyZNA);
1861  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 5., (QTPCRe*QxanCor+QTPCIm*QyanCor)*energyZNC);
1862  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 6., (QTPCRe*QxanCor+QTPCIm*QyanCor)*(energyZNA+energyZNC));
1863 
1864  //V0C-TPC
1865  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 0., (QTPCRe*QxcnCor+QTPCIm*QycnCor));
1866  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 1., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*energyZPA);
1867  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 2., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*energyZPC);
1868  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 3., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*(energyZPA+energyZPC));
1869  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 1., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*energyZNA);
1870  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 2., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*energyZNC);
1871  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 3., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*(energyZNA+energyZNC));
1872  }
1873 
1874  }//---- SP method -------
1875 
1876 
1877  PostData(1,fListHistos);
1878  PostData(2,fListCalibs);
1879 
1880  fHist_Event_count->Fill(9.5);
1881 
1882  //if(fievent%100==0) {
1883  //cout<<"irun = "<<runindex<<" n "<<n<<" m = "<<m<<" p = "<<p<<" cent= "<<EvtCent<<"\tiCentSPD = "<<iCentSPD<<"\tQRe= "<<QTPCRe<<"\tQIm= "<<QTPCIm<<"\tpsiN = "<<psiN<<endl;
1884  //cout<<" cent= "<<EvtCent<<"\teZNC= "<<energyZNC<<"\teZPC = "<<energyZPC<<"\teZNA= "<<energyZNA<<"\teZPA = "<<energyZPA<<endl;
1885  //}
1886 
1887  fievent++;
1888 
1889 }
1890 //======================= UserExec done =========================
1891 
1892 
1893 
1895 {
1896  AliDebug(2,"\n ... AliAnalysisTaskCMEV0::Terminate() is being called ... \n");
1897 }
1898 
1899 
1900 
1901 
1902 
1903 
1904 
1905 
1906 
1907 
1908 
1909 
1910 
1911 void AliAnalysisTaskCMEV0::GetV0QvectAndMult(const AliAODVZERO *aodV0,Float_t fHarmonic, Double_t& Qxan,Double_t& Qyan,Double_t& sumMa,Double_t& Qxcn,Double_t& Qycn,Double_t& sumMc)
1912 {
1913  for(Int_t iV0 = 0; iV0 < 64; iV0++) {
1914  /*if(fRemChV0A){
1915  if(iV0 == 46)
1916  continue;
1917  }*/
1918  Double_t phiV0 = TMath::PiOver4()*(0.5 + iV0 % 8);
1919  Float_t multv0 = aodV0->GetMultiplicity(iV0);
1920 
1921  if(iV0 < 32) {
1922  Double_t multCorC = -10;
1923 
1924  if(iV0 < 8)
1925  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(1);
1926  else if(iV0 >= 8 && iV0 < 16)
1927  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(9);
1928  else if(iV0 >= 16 && iV0 < 24)
1929  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(17);
1930  else if(iV0 >= 24 && iV0 < 32)
1931  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(25);
1932 
1933  if(multCorC < 0){
1934  cout<<"Problem with multiplicity in V0C"<<endl;
1935  continue;
1936  }
1937  Qxcn += TMath::Cos(fHarmonic*phiV0) * multCorC;
1938  Qycn += TMath::Sin(fHarmonic*phiV0) * multCorC;
1939 
1940  sumMc = sumMc + multCorC;
1941  }
1942  else{
1943  Double_t multCorA = -10;
1944 
1945  if(iV0 >= 32 && iV0 < 40)
1946  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(33);
1947  else if(iV0 >= 40 && iV0 < 48)
1948  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(41);
1949  else if(iV0 >= 48 && iV0 < 56)
1950  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(49);
1951  else if(iV0 >= 56 && iV0 < 64)
1952  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(57);
1953 
1954  if(multCorA < 0){
1955  cout<<"Problem with multiplicity in V0A"<<endl;
1956  continue;
1957  }
1958  Qxan += TMath::Cos(fHarmonic*phiV0) * multCorA;
1959  Qyan += TMath::Sin(fHarmonic*phiV0) * multCorA;
1960 
1961  sumMa = sumMa + multCorA;
1962  }
1963  }
1964 }//-------- Get V0 QVect and Multiplicity -----
1965 
1967 {
1968  if(fListZDNCorr){
1969  fHCorrectZDNP = (TH2D *) fListZDNCorr->FindObject(Form("fHist_ZDC_All_Wgt_VsCent_Run%d",run));
1970  }
1971  else{
1972  fHCorrectZDNP = NULL;
1973  printf("\n\n ********** ZDC Wgt Histograms NotFound ***************\n\n");
1974  exit(1);
1975  }
1976 }
1977 
1979 {
1980 
1981  //old method
1982  /*
1983  Int_t centBin = -1;
1984  if(cent<5.0){ centBin = 0;}
1985  else if(cent>=5.0 && cent<10.0){centBin = 1;}
1986  else if(cent>=10.0 && cent<40.0){centBin = 2;}
1987  else if(cent>=40.0) {centBin = 3;}
1988  if(fListNUACorr){
1989  fHCorrectNUApos = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pos_Cent%d_Run%d",centBin,run));
1990  fHCorrectNUAneg = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Neg_Cent%d_Run%d",centBin,run));
1991  } */
1992 
1993  if(sfileNUA=="New2018" && fListNUACorr){
1994  for(int i=0;i<5;i++){
1995  fHCorrectNUApos[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pos_Cent%d_Run%d",i,run));
1996  fHCorrectNUAneg[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Neg_Cent%d_Run%d",i,run));
1997  }
1998  //cout<<"\n sfileNUA = "<<sfileNUA<<" opening Rihan's NUA file.\n "<<endl;
1999  }
2000  else if(sfileNUA=="NewR" && fListNUACorr){
2001  for(int i=0;i<4;i++){
2002  fHCorrectNUApos[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pos_Cent%d_Run%d",i,run));
2003  fHCorrectNUAneg[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Neg_Cent%d_Run%d",i,run));
2004  }
2005  //cout<<"\n sfileNUA = "<<sfileNUA<<" opening Rihan's NUA file.\n "<<endl;
2006  }
2007  else if(sfileNUA=="NewPt"|| sfileNUA=="NewpT"){
2008  if(fListNUACorr){
2009  for(int i=0;i<4;i++){
2010  fHCorrectNUApos[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_pTPhiEta_Pos_Vz%d_Run%d",i,run));
2011  fHCorrectNUAneg[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_pTPhiEta_Neg_Vz%d_Run%d",i,run));
2012  }
2013  }
2014  }
2015  else if(sfileNUA=="OldJ") {//from Jacopo's NUA file:
2016  if(!gGrid){
2017  TGrid::Connect("alien://");
2018  }
2019  if(!fileNUApos){
2020  fileNUApos = TFile::Open("alien:///alice/cern.ch/user/m/mhaque/calib_files/15oHI_FB768_PosCh_CenPhiEtaWeights_VtxRbR.root");
2021  mListNUAPos = dynamic_cast<TList*> (fileNUApos->FindObjectAny("CenPhiEta Weights"));
2022  }
2023  if(!fileNUAneg){
2024  fileNUAneg = TFile::Open("alien:///alice/cern.ch/user/m/mhaque/calib_files/15oHI_FB768_NegCh_CenPhiEtaWeights_VtxRbR.root");
2025  mListNUANeg = dynamic_cast<TList*> (fileNUAneg->FindObjectAny("CenPhiEta Weights"));
2026  }
2027  if(mListNUAPos){
2028  for(int i=0;i<4;i++){
2029  fHCorrectNUApos[i] = (TH3D *) mListNUAPos->FindObject(Form("CRCQVecPhiHistVtx[%d][%d]",i,run));
2030  }
2031  }
2032  if(mListNUANeg){
2033  for(int i=0;i<4;i++){
2034  fHCorrectNUAneg[i] = (TH3D *) mListNUANeg->FindObject(Form("CRCQVecPhiHistVtx[%d][%d]",i,run));
2035  }
2036  }
2037  }
2038 
2039 
2040  if(!fHCorrectNUApos[0] || !fHCorrectNUAneg[0]){
2041  printf("\n\n ******** could not open NUA Histograms for run %d, Use Wgt = 1.0 *********\n\n",run);
2042  if(sfileNUA=="New2018"){
2043  for(int i=0;i<5;i++){
2044  fHCorrectNUApos[i] = new TH3D(Form("fHCorrectNUApos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2045  fHCorrectNUAneg[i] = new TH3D(Form("fHCorrectNUAneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2046  fHCorrectNUApos[i]->SetBinContent(1,1,1,1.0);
2047  fHCorrectNUAneg[i]->SetBinContent(1,1,1,1.0);
2048  //exit(1);
2049  }
2050  }
2051  else if(sfileNUA=="OldJ"|| sfileNUA=="NewR"){
2052  for(int i=0;i<4;i++){
2053  fHCorrectNUApos[i] = new TH3D(Form("fHCorrectNUApos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2054  fHCorrectNUAneg[i] = new TH3D(Form("fHCorrectNUAneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2055  fHCorrectNUApos[i]->SetBinContent(1,1,1,1.0);
2056  fHCorrectNUAneg[i]->SetBinContent(1,1,1,1.0);
2057  //exit(1);
2058  }
2059  }
2060  else if(sfileNUA=="NewPt"|| sfileNUA=="NewpT"){
2061  for(int i=0;i<4;i++){
2062  fHCorrectNUApos[i] = new TH3D(Form("fHCorrectNUApos_cent%d",i),"",1,0,10,1,0,6.284,1,-0.9,0.9);
2063  fHCorrectNUAneg[i] = new TH3D(Form("fHCorrectNUAneg_cent%d",i),"",1,0,10,1,0,6.284,1,-0.9,0.9);
2064  fHCorrectNUApos[i]->SetBinContent(1,1,1,1.0);
2065  fHCorrectNUAneg[i]->SetBinContent(1,1,1,1.0);
2066  //exit(1);
2067  }
2068  }
2069  }
2070 }
2071 
2072 
2073 
2075 {
2076  if(!gGrid){
2077  TGrid::Connect("alien://");
2078  }
2079 
2080  TFile* foadb = 0;
2081  //if(!fRemChV0A)
2082  foadb = TFile::Open("alien:///alice/cern.ch/user/a/adobrin/calibV0HIR.root");
2083  //else
2084  //foadb = TFile::Open("alien:///alice/cern.ch/user/a/adobrin/calibV0HIRNoCh46V0A.root");
2085 
2086  if(!foadb){
2087  printf("OADB V0 calibration file cannot be opened\n");
2088  return;
2089  }
2090 
2091  AliOADBContainer* cont = (AliOADBContainer*) foadb->Get("hMultV0BefCorPfpx");
2092  if(!cont){
2093  printf("OADB object hMultV0BefCorr is not available in the file\n");
2094  return;
2095  }
2096  if(!(cont->GetObject(run))){
2097  printf("OADB object hMultV0BefCorPfpx is not available for run %i\n", run);
2098  return;
2099  }
2100  fMultV0 = ((TH1D*) cont->GetObject(run));
2101 
2102  AliOADBContainer* contQxnam = 0;
2103  if (fHarmonic == 2.)
2104  contQxnam = (AliOADBContainer*) foadb->Get("fqxa2m");
2105  else
2106  contQxnam = (AliOADBContainer*) foadb->Get("fqxa3m");
2107 
2108  if(!contQxnam){
2109  printf("OADB object fqxanm is not available in the file\n");
2110  return;
2111  }
2112  if(!(contQxnam->GetObject(run))){
2113  printf("OADB object fqxanm is not available for run %i\n", run);
2114  return;
2115  }
2116  fQxnmV0A = ((TH1D*) contQxnam->GetObject(run));
2117 
2118  AliOADBContainer* contQynam = 0;
2119  if (fHarmonic == 2.)
2120  contQynam = (AliOADBContainer*) foadb->Get("fqya2m");
2121  else if (fHarmonic == 3.)
2122  contQynam = (AliOADBContainer*) foadb->Get("fqya3m");
2123  else if (fHarmonic == 4.)
2124  contQynam = (AliOADBContainer*) foadb->Get("fqya4m");
2125 
2126  if(!contQynam){
2127  printf("OADB object fqyanm is not available in the file\n");
2128  return;
2129  }
2130  if(!(contQynam->GetObject(run))){
2131  printf("OADB object fqyanm is not available for run %i\n", run);
2132  return;
2133  }
2134  fQynmV0A = ((TH1D*) contQynam->GetObject(run));
2135 
2136  AliOADBContainer* contQxnas = 0;
2137  if (fHarmonic == 2.)
2138  contQxnas = (AliOADBContainer*) foadb->Get("fqxa2s");
2139  else
2140  contQxnas = (AliOADBContainer*) foadb->Get("fqxa3s");
2141 
2142  if(!contQxnas){
2143  printf("OADB object fqxans is not available in the file\n");
2144  return;
2145  }
2146  if(!(contQxnas->GetObject(run))){
2147  printf("OADB object fqxans is not available for run %i\n", run);
2148  return;
2149  }
2150  fQxnsV0A = ((TH1D*) contQxnas->GetObject(run));
2151 
2152  AliOADBContainer* contQynas = 0;
2153  if (fHarmonic == 2.)
2154  contQynas = (AliOADBContainer*) foadb->Get("fqya2s");
2155  else if (fHarmonic == 3.)
2156  contQynas = (AliOADBContainer*) foadb->Get("fqya3s");
2157  else if (fHarmonic == 4.)
2158  contQynas = (AliOADBContainer*) foadb->Get("fqya4s");
2159 
2160  if(!contQynas){
2161  printf("OADB object fqyans is not available in the file\n");
2162  return;
2163  }
2164  if(!(contQynas->GetObject(run))){
2165  printf("OADB object fqyans is not available for run %i\n", run);
2166  return;
2167  }
2168  fQynsV0A = ((TH1D*) contQynas->GetObject(run));
2169 
2170 
2171 
2172  AliOADBContainer* contQxncm = 0;
2173  if (fHarmonic == 2.)
2174  contQxncm = (AliOADBContainer*) foadb->Get("fqxc2m");
2175  else
2176  contQxncm = (AliOADBContainer*) foadb->Get("fqxc3m");
2177 
2178  if(!contQxncm){
2179  printf("OADB object fqxcnm is not available in the file\n");
2180  return;
2181  }
2182  if(!(contQxncm->GetObject(run))){
2183  printf("OADB object fqxcnm is not available for run %i\n", run);
2184  return;
2185  }
2186  fQxnmV0C = ((TH1D*) contQxncm->GetObject(run));
2187 
2188 
2189 
2190  AliOADBContainer* contQyncm = 0;
2191  if (fHarmonic == 2.)
2192  contQyncm = (AliOADBContainer*) foadb->Get("fqyc2m");
2193  else if (fHarmonic == 3.)
2194  contQyncm = (AliOADBContainer*) foadb->Get("fqyc3m");
2195  else if (fHarmonic == 4.)
2196  contQyncm = (AliOADBContainer*) foadb->Get("fqyc4m");
2197 
2198  if(!contQyncm){
2199  printf("OADB object fqyc2m is not available in the file\n");
2200  return;
2201  }
2202  if(!(contQyncm->GetObject(run))){
2203  printf("OADB object fqyc2m is not available for run %i\n", run);
2204  return;
2205  }
2206  fQynmV0C = ((TH1D*) contQyncm->GetObject(run));
2207 
2208 
2209  AliOADBContainer* contQxncs = 0;
2210  if (fHarmonic == 2.)
2211  contQxncs = (AliOADBContainer*) foadb->Get("fqxc2s");
2212  else
2213  contQxncs = (AliOADBContainer*) foadb->Get("fqxc3s");
2214 
2215  if(!contQxncs){
2216  printf("OADB object fqxc2s is not available in the file\n");
2217  return;
2218  }
2219  if(!(contQxncs->GetObject(run))){
2220  printf("OADB object fqxc2s is not available for run %i\n", run);
2221  return;
2222  }
2223  fQxnsV0C = ((TH1D*) contQxncs->GetObject(run));
2224 
2225 
2226  AliOADBContainer* contQyncs = 0;
2227  if (fHarmonic == 2.)
2228  contQyncs = (AliOADBContainer*) foadb->Get("fqyc2s");
2229  else if (fHarmonic == 3.)
2230  contQyncs = (AliOADBContainer*) foadb->Get("fqyc3s");
2231  else if (fHarmonic == 4.)
2232  contQyncs = (AliOADBContainer*) foadb->Get("fqyc4s");
2233 
2234  if(!contQyncs){
2235  printf("OADB object fqycnm is not available in the file\n");
2236  return;
2237  }
2238  if(!(contQyncs->GetObject(run))){
2239  printf("OADB object fqycns is not available for run %i\n", run);
2240  return;
2241  }
2242  fQynsV0C = ((TH1D*) contQyncs->GetObject(run));
2243 }//------- OADB container ------
2244 
2245 
2246 
2247 
2248 double AliAnalysisTaskCMEV0::GetWDist(const AliVVertex* v0, const AliVVertex* v1)
2249 {
2250  // calculate sqrt of weighted distance to other vertex
2251  if (!v0 || !v1) {
2252  AliDebug(2,"\n\n ::GetWDist => One of vertices is not valid\n\n");
2253  return 0;
2254  }
2255  static TMatrixDSym vVb(3);
2256  double dist = -1;
2257  double dx = v0->GetX()-v1->GetX();
2258  double dy = v0->GetY()-v1->GetY();
2259  double dz = v0->GetZ()-v1->GetZ();
2260  double cov0[6],cov1[6];
2261  v0->GetCovarianceMatrix(cov0);
2262  v1->GetCovarianceMatrix(cov1);
2263  vVb(0,0) = cov0[0]+cov1[0];
2264  vVb(1,1) = cov0[2]+cov1[2];
2265  vVb(2,2) = cov0[5]+cov1[5];
2266  vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];
2267  vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;
2268  vVb.InvertFast();
2269  if (!vVb.IsValid()) {
2270  AliDebug(2,"Singular Matrix\n");
2271  return dist;
2272  }
2273  dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz
2274  + 2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;
2275  return dist>0 ? TMath::Sqrt(dist) : -1;
2276 }
2277 
2279  { // check for multi-vertexer pile-up
2280  const int kMinPlpContrib = 5;
2281  const double kMaxPlpChi2 = 5.0;
2282  const double kMinWDist = 15;
2283 
2284  const AliVVertex* vtPrm = 0;
2285  const AliVVertex* vtPlp = 0;
2286 
2287  int nPlp = 0;
2288 
2289  if(!(nPlp=faod->GetNumberOfPileupVerticesTracks()))
2290  return kFALSE;
2291 
2292  vtPrm = faod->GetPrimaryVertex();
2293  if(vtPrm == faod->GetPrimaryVertexSPD())
2294  return kTRUE; // there are pile-up vertices but no primary
2295 
2296  //int bcPrim = vtPrm->GetBC();
2297 
2298  for(int ipl=0;ipl<nPlp;ipl++) {
2299  vtPlp = (const AliVVertex*)faod->GetPileupVertexTracks(ipl);
2300  if (vtPlp->GetNContributors() < kMinPlpContrib) continue;
2301  if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;
2302  //int bcPlp = vtPlp->GetBC();
2303  //if (bcPlp!=AliVTrack::kTOFBCNA && TMath::Abs(bcPlp-bcPrim)>2)
2304  // return kTRUE; // pile-up from other BC
2305 
2306  double wDst = GetWDist(vtPrm,vtPlp);
2307  if (wDst<kMinWDist) continue;
2308 
2309  return kTRUE; // pile-up: well separated vertices
2310  }
2311  return kFALSE;
2312 }
2313 
2314 
2315 
2317 {
2318 /*
2319  if(!gGrid){
2320  TGrid::Connect("alien://");
2321  }
2322 
2323  TFile *fileV0M = TFile::Open(fFileV0MCorr);
2324  if(!fileV0M){
2325  printf("\n\n ********** File for V0M gain eq. not found ***************\n\n");
2326  }
2327 
2328  TList *mListV0M = dynamic_cast<TList*> (fileV0M->FindObjectAny("fV0MChWgts"));
2329 */
2330  if(fListV0MCorr){
2331  fHCorrectV0M = (TH1D *) fListV0MCorr->FindObject(Form("fHistV0Gain_Run%d",run));
2332  //TH2D *fV0QnAvgTemp = (TH2D *) mListV0M->FindObject(Form("fHistV0_AvgQnAC_Run%d",run));
2333  //fV0Qn_AvgCorr = (TH2D *) fV0QnAvgTemp->Clone("fV0Qn_AvgCorr");
2334  //TH2D *fV0QnSigTemp = (TH2D *) mListV0M->FindObject(Form("fHistV0_SigQnAC_Run%d",run));
2335  //fV0Qn_SigCorr = (TH2D *) fV0QnSigTemp->Clone("fV0Qn_SigCorr");
2336  }
2337  else{
2338  fHCorrectV0M = new TH1D("fHCorrectV0M","",64,0,64);
2339  for(int i=1;i<=64;i++){
2340  fHCorrectV0M->SetBinContent(i,1.0);
2341  }
2342  //fV0Qn_AvgCorr = NULL;
2343  //fV0Qn_SigCorr = NULL;
2344  printf("\n\n ********** V0M ch wgt Histograms NotFound, use Wgt = 1.0 ***************\n\n");
2345  //exit(1);
2346  }
2347  //fileV0M->Close();
2348 }
2349 
2350 
2351 
2352 
2353 
2355 
2356  Bool_t BisPileup=kFALSE;
2357 
2358  Double_t centrV0M=300;
2359  Double_t centrCL1=300;
2360  Double_t centrCL0=300;
2361  Double_t centrTRK=300;
2362 
2363  if(sDataSet=="2010"||sDataSet=="2011"){
2364  centrV0M = ((AliVAODHeader*)faod->GetHeader())->GetCentralityP()->GetCentralityPercentile("V0M");
2365  centrCL1 = ((AliVAODHeader*)faod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL1");
2366  centrCL0 = ((AliVAODHeader*)faod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL0");
2367  centrTRK = ((AliVAODHeader*)faod->GetHeader())->GetCentralityP()->GetCentralityPercentile("TRK");
2368  }
2369  else{
2370  fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection");
2371  if(!fMultSelection) {
2372  printf("\n\n **WARNING** ::UserExec() AliMultSelection object not found.\n\n");
2373  exit(1);
2374  }
2375  centrV0M = fMultSelection->GetMultiplicityPercentile("V0M");
2376  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
2377  centrCL0 = fMultSelection->GetMultiplicityPercentile("CL0");
2378  centrTRK = fMultSelection->GetMultiplicityPercentile("TRK");
2379  }// 2015
2380 
2381 
2382  if(fRejectPileUp && InputEvent()) {
2383  //if(!fCutsEvent->IsSelected(InputEvent(),MCEvent())) return;
2384  if(sDataSet!="2015") {
2385  if(PileUpMultiVertex(faod)) {
2386  fPileUpCount->Fill(0.5);
2387  BisPileup=kTRUE;
2388  }
2389  Int_t isPileup = faod->IsPileupFromSPD(3);
2390  if(isPileup != 0) {
2391  fPileUpCount->Fill(1.5);
2392  //BisPileup=kTRUE; //
2393  }
2394  if(((AliAODHeader*)faod->GetHeader())->GetRefMultiplicityComb08() < 0) {
2395  fPileUpCount->Fill(2.5);
2396  BisPileup=kTRUE;
2397  }
2398  if(faod->IsIncompleteDAQ()) {
2399  fPileUpCount->Fill(3.5);
2400  BisPileup=kTRUE;
2401  }
2402 
2403  //check vertex consistency
2404  const AliAODVertex* vtTrc = faod->GetPrimaryVertex();
2405  const AliAODVertex* vtSPD = faod->GetPrimaryVertexSPD();
2406 
2407  if(vtTrc->GetNContributors() < 2 || vtSPD->GetNContributors()<1) {
2408  fPileUpCount->Fill(5.5);
2409  BisPileup=kTRUE;
2410  }
2411 
2412  double covTrc[6], covSPD[6];
2413  vtTrc->GetCovarianceMatrix(covTrc);
2414  vtSPD->GetCovarianceMatrix(covSPD);
2415 
2416  double dz = vtTrc->GetZ() - vtSPD->GetZ();
2417 
2418  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
2419  double errTrc = TMath::Sqrt(covTrc[5]);
2420  double nsigTot = dz/errTot;
2421  double nsigTrc = dz/errTrc;
2422 
2423  if(TMath::Abs(dz)>0.2 || TMath::Abs(nsigTot)>10 || TMath::Abs(nsigTrc)>20) {
2424  fPileUpCount->Fill(6.5);
2425  BisPileup=kTRUE;
2426  }
2427  if(fAnalysisUtil->IsPileUpEvent(InputEvent())) {
2428  fPileUpCount->Fill(7.5);
2429  BisPileup=kTRUE;
2430  }
2431  }
2432 
2433  else{ //------------ pileup for 2015 data -----------------
2434  if(!fMultSelection->GetThisEventIsNotPileup())
2435  fPileUpMultSelCount->Fill(0.5);
2436  if(!fMultSelection->GetThisEventIsNotPileupMV())
2437  fPileUpMultSelCount->Fill(1.5);
2438  if(!fMultSelection->GetThisEventIsNotPileupInMultBins())
2439  fPileUpMultSelCount->Fill(2.5);
2440  if(!fMultSelection->GetThisEventHasNoInconsistentVertices())
2441  fPileUpMultSelCount->Fill(3.5);
2442  if(!fMultSelection->GetThisEventPassesTrackletVsCluster())
2443  fPileUpMultSelCount->Fill(4.5);
2444  if(!fMultSelection->GetThisEventIsNotAsymmetricInVZERO())
2445  fPileUpMultSelCount->Fill(5.5);
2446  if(!fMultSelection->GetThisEventIsNotIncompleteDAQ())
2447  fPileUpMultSelCount->Fill(6.5);
2448  if(!fMultSelection->GetThisEventHasGoodVertex2016())
2449  fPileUpMultSelCount->Fill(7.5);
2450 
2451  BisPileup=kFALSE;
2452 
2453  //-- pile-up a la Dobrin for LHC15o -----
2454  if(PileUpMultiVertex(faod)) {
2455  fPileUpCount->Fill(0.5);
2456  BisPileup=kTRUE;
2457  }
2458  Int_t isPileup = faod->IsPileupFromSPD(3);
2459  if(isPileup != 0) {
2460  fPileUpCount->Fill(1.5);
2461  BisPileup=kTRUE;
2462  }
2463  if(((AliAODHeader*)faod->GetHeader())->GetRefMultiplicityComb08() < 0) {
2464  fPileUpCount->Fill(2.5);
2465  BisPileup=kTRUE;
2466  }
2467  if(faod->IsIncompleteDAQ()) {
2468  fPileUpCount->Fill(3.5);
2469  BisPileup=kTRUE;
2470  }
2471  if(fabs(centrV0M-centrCL1)> 5.0) {//default: 7.5
2472  fPileUpCount->Fill(4.5);
2473  BisPileup=kTRUE;
2474  }
2475 
2476  // check vertex consistency
2477  const AliAODVertex* vtTrc = faod->GetPrimaryVertex();
2478  const AliAODVertex* vtSPD = faod->GetPrimaryVertexSPD();
2479 
2480  if(vtTrc->GetNContributors() < 2 || vtSPD->GetNContributors()<1) {
2481  fPileUpCount->Fill(5.5);
2482  BisPileup=kTRUE;
2483  }
2484 
2485  double covTrc[6], covSPD[6];
2486  vtTrc->GetCovarianceMatrix(covTrc);
2487  vtSPD->GetCovarianceMatrix(covSPD);
2488 
2489  double dz = vtTrc->GetZ() - vtSPD->GetZ();
2490 
2491  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
2492  double errTrc = TMath::Sqrt(covTrc[5]);
2493  double nsigTot = dz/errTot;
2494  double nsigTrc = dz/errTrc;
2495 
2496  if(TMath::Abs(dz)>0.2 || TMath::Abs(nsigTot)>10 || TMath::Abs(nsigTrc)>20) {
2497  fPileUpCount->Fill(6.5);
2498  BisPileup=kTRUE;
2499  }
2500 
2501  //cuts on tracks
2502  const Int_t nTracks = faod->GetNumberOfTracks();
2503  Int_t multEsd = ((AliAODHeader*)faod->GetHeader())->GetNumberOfESDTracks();
2504 
2505  //Int_t multTrk = 0;
2506  //Int_t multTrkBefC = 0;
2507  //Int_t multTrkTOFBefC = 0;
2508  Int_t multTPC = 0;
2509  Int_t multITS = 0;
2510 
2511  for(Int_t it = 0; it < nTracks; it++) {
2512  AliAODTrack* aodTrk = (AliAODTrack*)faod->GetTrack(it);
2513  if(!aodTrk) {
2514  delete aodTrk;
2515  continue;
2516  }
2517  //if(aodTrk->TestFilterBit(32)){
2518  // multTrkBefC++;
2519  // if(TMath::Abs(aodTrk->GetTOFsignalDz()) <= 10. && aodTrk->GetTOFsignal() >= 12000. && aodTrk->GetTOFsignal() <= 25000.)
2520  // multTrkTOFBefC++;
2521  // if((TMath::Abs(aodTrk->Eta()) < 0.8) && (aodTrk->GetTPCNcls() >= 70) && (aodTrk->Pt() >= 0.2) && (aodTrk->Pt() < 20.))
2522  // multTrk++;
2523  //}
2524  if(aodTrk->TestFilterBit(128))
2525  multTPC++;
2526  if(aodTrk->TestFilterBit(96))
2527  multITS++;
2528  } // end of for AOD track loop
2529 
2530  Double_t multTPCn = multTPC;
2531  Double_t multEsdn = multEsd;
2532  //Double_t multESDTPCDif = multEsdn - multTPCn*3.39;
2533  Double_t multESDTPCDif = multEsdn - multTPCn*fPileUpSlopeParm;
2534 
2535  fGlobalITSMult->Fill(multITS);
2536 
2537  fITSvsESDMult->Fill(multEsd,multITS);
2538  fTPCvsGlobalTrk->Fill(multEsd,multTPC);
2539  fTPCvsITSTrk->Fill(multITS,multTPC);
2540 
2541 
2542 
2543  /*if(multESDTPCDif > (fRejectPileUpTight?700.:15000.)) {
2544  fPileUpCount->Fill(7.5);
2545  BisPileup=kTRUE;
2546  }*/
2547  if(multESDTPCDif > 15000.){ //default: 15000
2548  fPileUpCount->Fill(7.5);
2549  BisPileup=kTRUE;
2550  }
2551  else if(fRejectPileUpTight) {
2552  if(multESDTPCDif > fPileUpConstParm) { //default: 700
2553  fPileUpCount->Fill(8.5);
2554  BisPileup=kTRUE;
2555  }
2556  if(BisPileup==kFALSE) {
2557  if(!fMultSelection->GetThisEventIsNotPileup()) BisPileup=kTRUE;
2558  if(!fMultSelection->GetThisEventIsNotPileupMV()) BisPileup=kTRUE;
2559  if(!fMultSelection->GetThisEventIsNotPileupInMultBins()) BisPileup=kTRUE;
2560  if(!fMultSelection->GetThisEventHasNoInconsistentVertices()) BisPileup=kTRUE;
2561  if(!fMultSelection->GetThisEventPassesTrackletVsCluster()) BisPileup=kTRUE;
2562  if(!fMultSelection->GetThisEventIsNotIncompleteDAQ()) BisPileup=kTRUE;
2563  if(!fMultSelection->GetThisEventHasGoodVertex2016()) BisPileup=kTRUE;
2564  if(BisPileup) fPileUpCount->Fill(9.5);
2565  }
2566  }
2567  }
2568  }
2569 
2570  return BisPileup;
2571 }//-------pile up function ------
2572 
2573 
2574 
2575 
2577 
2578  Int_t irun = -1;
2579 
2580  for(int i=0;i<fRunFlag;i++){
2581  if(run==runNums[i])
2582  {
2583  irun = i;
2584  break;
2585  }
2586  }
2587  if(irun<0) {
2588  printf("\n ... **WARNING** \n::UserExec() runnumber not listed.\n EXIT..\n");
2589  }
2590 
2591  return irun;
2592 }//------ GetCurrentRunIndex --------
2593 
2594 
2596 
2597  Int_t runArray_2010[89] = {139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137546, 137544, 137541, 137539, 137531, 137530, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137243, 137236, 137235, 137232, 137231, 137162, 137161};
2598 
2599  Int_t runArray_2011[68] = {167915, 168115, 168460, 169035, 169238, 169859, 170228, 167920, 168310, 168464, 169091, 169411, 169923, 170230, 167985, 168311, 168467, 169094, 169415, 170027, 170268, 167987, 168322, 168511, 169138, 169417, 170081, 170269, 167988, 168325, 168512, 169144, 169835, 170155, 170270, 168069, 168341, 168514, 169145, 169837, 170159, 170306, 168076, 168342, 168777, 169148, 169838, 170163, 170308, 168105, 168361, 168826, 169156, 169846, 170193, 170309, 168107, 168362, 168988, 169160, 169855, 170203, 168108, 168458, 168992, 169167, 169858, 170204};
2600 
2601  Int_t runArray_2015[90] = {246994, 246991, 246989, 246984, 246982, 246980, 246948, 246945, 246928, 246871, 246870, 246867, 246865, 246864, 246859, 246858, 246851, 246847, 246846, 246845, 246844, 246810, 246809, 246808, 246807, 246805, 246804, 246766, 246765, 246763, 246760, 246759, 246758, 246757, 246751, 246750, 246676, 246675, 246540, 246495, 246493, 246488, 246487, 246434, 246431, 246428, 246424, 246276, 246275, 246272, 246271, 246225, 246222, 246217, 246185, 246182, 246181, 246180, 246178, 246153, 246152, 246151, 246148, 246115, 246113, 246089, 246087, 246053, 246052, 246049, 246048, 246042, 246037, 246036, 246012, 246003, 246001, 245963, 245954, 245952, 245949, 245923, 245833, 245831, 245829, 245705, 245702, 245700, 245692, 245683};
2602 
2603 //Int_t runArray_pPb_13cpass2[14] = {195677, 195675, 195673, 195644, 195635, 195633, 195596, 195593, 195592, 195568, 195567, 195566, 195531, 195529};
2604 
2605  Int_t runArray_pPb_16q_pass1[32] = {265309, 265332, 265334, 265335, 265336, 265338, 265339, 265342, 265343, 265344, 265377, 265378, 265381, 265383, 265384, 265385, 265387, 265388, 265419, 265420, 265421, 265422, 265424, 265425, 265426, 265427, 265435, 265499, 265500, 265501, 265521, 265525};
2606 
2607 
2608 
2609 
2610  if(sPeriod=="2010"){
2611  fRunFlag = 89;
2612  for(int i=0;i<fRunFlag;i++)
2613  runNums[i] = runArray_2010[i];
2614  }
2615  else if(sPeriod=="2011"){
2616  fRunFlag = 68; //<-- 2011 check
2617  for(int i=0;i<fRunFlag;i++)
2618  runNums[i] = runArray_2011[i];
2619  }
2620  else if(sPeriod=="2015" || sPeriod=="2015PbPb"){
2621  fRunFlag = 90;
2622  for(int i=0;i<fRunFlag;i++)
2623  runNums[i] = runArray_2015[i];
2624  }
2625  else if(sPeriod=="2015pPb" || sPeriod=="pPb"){
2626  fRunFlag = 32;
2627  for(int i=0;i<fRunFlag;i++)
2628  runNums[i] = runArray_pPb_16q_pass1[i];
2629  }
2630 
2631 
2632  else{
2633  printf("\n\n ***** Run Number not defined for this data set. *******\n\n Please modify code..\n\n");
2634  exit(1);
2635  }
2636 
2637 }//------- InitializeRunArray ---------
2638 
2639 
2640 
2642 
2643  fHist_Event_count = new TH1F("fHist_Event_count"," ",20,0,20);
2644  fHist_Event_count->GetXaxis()->SetBinLabel(1,"Called Exec()");
2645  fHist_Event_count->GetXaxis()->SetBinLabel(2,"AOD Exist");
2646  fHist_Event_count->GetXaxis()->SetBinLabel(3,"PileUp");
2647  fHist_Event_count->GetXaxis()->SetBinLabel(4,"iCentSPD<90");
2648  fHist_Event_count->GetXaxis()->SetBinLabel(5,"V0 Mult>0");
2649  fHist_Event_count->GetXaxis()->SetBinLabel(6,"TPC Q!=0");
2650  fHist_Event_count->GetXaxis()->SetBinLabel(7,"Bad Runs");
2651  fHist_Event_count->GetXaxis()->SetBinLabel(8,"..TBA..");
2652 
2653  fHist_Event_count->GetXaxis()->SetBinLabel(10,"Final Event");
2655 
2656  fPileUpMultSelCount = new TH1F("fPileUpMultSelCount", "fPileUpMultSelCount", 10, 0., 10.);
2657  fPileUpMultSelCount->GetXaxis()->SetBinLabel(1,"IsNotPileup");
2658  fPileUpMultSelCount->GetXaxis()->SetBinLabel(2,"IsNotPileupMV");
2659  fPileUpMultSelCount->GetXaxis()->SetBinLabel(3,"IsNotPileupInMultBins");
2660  fPileUpMultSelCount->GetXaxis()->SetBinLabel(4,"InconsistentVertices");
2661  fPileUpMultSelCount->GetXaxis()->SetBinLabel(5,"TrackletVsCluster");
2662  fPileUpMultSelCount->GetXaxis()->SetBinLabel(6,"AsymmetricInVZERO");
2663  fPileUpMultSelCount->GetXaxis()->SetBinLabel(7,"IncompleteDAQ");
2664  fPileUpMultSelCount->GetXaxis()->SetBinLabel(8,"GoodVertex2016");
2666 
2667  fPileUpCount = new TH1F("fPileUpCount", "fPileUpCount", 12, 0., 12.);
2668  fPileUpCount->GetXaxis()->SetBinLabel(1,"plpMV");
2669  fPileUpCount->GetXaxis()->SetBinLabel(2,"fromSPD");
2670  fPileUpCount->GetXaxis()->SetBinLabel(3,"RefMultiplicityComb08");
2671  fPileUpCount->GetXaxis()->SetBinLabel(4,"IncompleteDAQ");
2672  fPileUpCount->GetXaxis()->SetBinLabel(5,"abs(V0M-CL1)>5.0");
2673  fPileUpCount->GetXaxis()->SetBinLabel(6,"missingVtx");
2674  fPileUpCount->GetXaxis()->SetBinLabel(7,"inconsistentVtx");
2675  fPileUpCount->GetXaxis()->SetBinLabel(8,"multESDTPCDif=15000");
2676  Int_t puConst = fPileUpConstParm;
2677  fPileUpCount->GetXaxis()->SetBinLabel(9,Form("multESDTPCDif>%d",puConst));
2678  fPileUpCount->GetXaxis()->SetBinLabel(10,"extraPileUpMultSel");
2679  fListHistos->Add(fPileUpCount);
2680 
2681  //To be implemented fully:
2682  fTaskConfigParm = new TH1F("fTaskConfigParm", "Connfig Values", 20, 0., 20.);
2683  fTaskConfigParm->GetXaxis()->SetBinLabel(1,"CentMin");
2684  fTaskConfigParm->GetXaxis()->SetBinLabel(2,"CentMax");
2685  fTaskConfigParm->GetXaxis()->SetBinLabel(3,"VzMin");
2686  fTaskConfigParm->GetXaxis()->SetBinLabel(4,"VzMax");
2687  fTaskConfigParm->GetXaxis()->SetBinLabel(5,"EtaMin");
2688  fTaskConfigParm->GetXaxis()->SetBinLabel(6,"EtaMax");
2689  fTaskConfigParm->GetXaxis()->SetBinLabel(7,"PtMin");
2690  fTaskConfigParm->GetXaxis()->SetBinLabel(8,"PtMax");
2691  fTaskConfigParm->GetXaxis()->SetBinLabel(9,"DCAxy");
2692  fTaskConfigParm->GetXaxis()->SetBinLabel(10,"DCAz");
2693  fTaskConfigParm->GetXaxis()->SetBinLabel(11,"FiltBit");
2694  fTaskConfigParm->GetXaxis()->SetBinLabel(12,"nClustTPC");
2695  fTaskConfigParm->GetXaxis()->SetBinLabel(13,"Chi2ClusMin");
2696  fTaskConfigParm->GetXaxis()->SetBinLabel(14,"Chi2ClusMax");
2697  fTaskConfigParm->GetXaxis()->SetBinLabel(15,"harmonic N");
2698  fTaskConfigParm->GetXaxis()->SetBinLabel(16,"harmonic M");
2699  fTaskConfigParm->GetXaxis()->SetBinLabel(17,"harmonicPsi");
2701 
2702  if(sDataSet=="2015pPb" || sDataSet=="pPb") {
2703  fHistVtxZvsRun = new TH2F("fHistVtxZvsRun", " Vz (cm) ",fRunFlag,0,fRunFlag,400, -10, 10.);
2705  fHistVtxXvsRun = new TH2F("fHistVtxXvsRun", " Vx (cm) ",fRunFlag,0,fRunFlag,200, -1, 1.);
2707  fHistVtxYvsRun = new TH2F("fHistVtxYvsRun", " Vy (cm) ",fRunFlag,0,fRunFlag,200, -1, 1.);
2709  }
2710 
2711 
2712  //----- CME-ZDN correlator SP method---------
2713  for(int i=0;i<3;i++){ //ZDN_SP
2714  //Detector: 0 = V0A, 1 = V0C, 3 = Q-cumulant
2715  fHist_Corr3p_ZDN_SP_PN[i] = new TProfile2D(Form("fHist_Corr3p_ZDN_SP_PosNeg_Det%d",i+1),"opposit charge correlator",90,0,90,15,0,15,"");
2716  fHist_Corr3p_ZDN_SP_PN[i]->Sumw2();
2718  fHist_Corr3p_ZDN_SP_PP[i] = new TProfile2D(Form("fHist_Corr3p_ZDN_SP_PosPos_Det%d",i+1),"pos-pos charge correlator",90,0,90,15,0,15,"");
2719  fHist_Corr3p_ZDN_SP_PP[i]->Sumw2();
2721  fHist_Corr3p_ZDN_SP_NN[i] = new TProfile2D(Form("fHist_Corr3p_ZDN_SP_NegNeg_Det%d",i+1),"neg-neg charge correlator",90,0,90,15,0,15,"");
2722  fHist_Corr3p_ZDN_SP_NN[i]->Sumw2();
2724  }
2725  //SP Resolution:
2726  for(int i=0;i<3;i++){
2727  //Det: 0 = v0c-v0a, 1 = v0a-TPC, 2 = v0c-TPC,
2728  fHist_Reso2n_ZDN_SP_Det[i] = new TProfile2D(Form("fHist_Reso2n_ZDN_SP_DetComb%d",i+1),"Event plane Resolution",90,0,90,8,0,8,"");
2729  fHist_Reso2n_ZDN_SP_Det[i]->Sumw2();
2731  }
2732  //--------------------------------------------
2733 
2734  Double_t centRange[11] = {0,5,10,20,30,40,50,60,70,80,90};
2735 
2736 
2737  fRejectRatioVsCR = new TProfile2D("fRejectRatioVsCentRun","",10,centRange,fRunFlag,0,fRunFlag);
2739 
2740 
2741 
2742  //----- CME SP method histograms ---------
2743  for(int i=0;i<2;i++){
2744  for(int j=0;j<3;j++){
2745  //Detector: 0 = V0A, 1 = V0C, 3 = Q-cumulant
2746  fHist_Corr3p_SP_Norm_PN[i][j] = new TProfile(Form("fHist_Corr3p_SP_Norm_PosNeg_Mag%d_Det%d",i,j+1),"opposit charge correlator",10,centRange,"");
2747  fHist_Corr3p_SP_Norm_PN[i][j]->Sumw2();
2749  fHist_Corr3p_SP_Norm_PP[i][j] = new TProfile(Form("fHist_Corr3p_SP_Norm_PosPos_Mag%d_Det%d",i,j+1),"pos-pos charge correlator",10,centRange,"");
2750  fHist_Corr3p_SP_Norm_PP[i][j]->Sumw2();
2752  fHist_Corr3p_SP_Norm_NN[i][j] = new TProfile(Form("fHist_Corr3p_SP_Norm_NegNeg_Mag%d_Det%d",i,j+1),"neg-neg charge correlator",10,centRange,"");
2753  fHist_Corr3p_SP_Norm_NN[i][j]->Sumw2();
2755  }
2756  //EP Resolution:
2757  for(int j=0;j<3;j++){
2758  //Det: 0 = v0c-v0a, 1 = v0a-TPC, 2 = v0c-TPC,
2759  fHist_Reso2n_SP_Norm_Det[i][j] = new TProfile(Form("fHist_Reso2n_SP_Norm_Mag%d_DetComb%d",i,j+1),"Event plane Resolution",10,centRange,"");
2760  fHist_Reso2n_SP_Norm_Det[i][j]->Sumw2();
2762  }
2763  }
2764 
2765 
2766 
2767  //----- CME EP method histograms ---------
2768  for(int i=0;i<2;i++){
2769  for(int j=0;j<3;j++){
2770  //Detector: 0 = V0A, 1 = V0C, 3 = Q-cumulant
2771  fHist_Corr3p_EP_Norm_PN[i][j] = new TProfile(Form("fHist_Corr3p_EP_Norm_PosNeg_Mag%d_Det%d",i,j+1),"opposit charge correlator",10,centRange,"");
2772  fHist_Corr3p_EP_Norm_PN[i][j]->Sumw2();
2774  fHist_Corr3p_EP_Norm_PP[i][j] = new TProfile(Form("fHist_Corr3p_EP_Norm_PosPos_Mag%d_Det%d",i,j+1),"pos-pos charge correlator",10,centRange,"");
2775  fHist_Corr3p_EP_Norm_PP[i][j]->Sumw2();
2777  fHist_Corr3p_EP_Norm_NN[i][j] = new TProfile(Form("fHist_Corr3p_EP_Norm_NegNeg_Mag%d_Det%d",i,j+1),"neg-neg charge correlator",10,centRange,"");
2778  fHist_Corr3p_EP_Norm_NN[i][j]->Sumw2();
2780  }
2781  //EP Resolution:
2782  for(int j=0;j<3;j++){
2783  //Det: 0 = v0c-v0a, 1 = v0a-TPC, 2 = v0c-TPC,
2784  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,"");
2785  fHist_Reso2n_EP_Norm_Det[i][j]->Sumw2();
2787  }
2788  }
2789 
2790 
2791 
2792 
2793 
2794 
2795  fHV0AEventPlaneVsCent = new TH2F("fHV0AEventPlaneVsCent","Psi2 from V0A",10,centRange,50,0,3.1415);
2797  fHV0CEventPlaneVsCent = new TH2F("fHV0CEventPlaneVsCent","Psi2 from V0C",10,centRange,50,0,3.1415);
2799  fHTPCEventPlaneVsCent = new TH2F("fHTPCEventPlaneVsCent","Psi2 from TPC",10,centRange,50,0,3.1415);
2801 
2802 
2803 
2804 
2805  //TH1::SetDefaultSumw2();
2806 
2807  Char_t name[100], title[100];
2808 
2809 
2810 
2811  //Differential in pT:
2812  //Double_t pTRange[24] = {0,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.,1.2,1.4,1.6,1.8,2.,2.33,2.66,3.,3.5,4.,5.,6.,8.,10.};
2813 
2814  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};
2815 
2816  for(int i=0;i<2;i++){
2817  for(int j=0;j<6;j++){
2818  sprintf(name,"fHist_Corr3p_pTSum_EP_V0A_PN_Mag%d_Cent%d",i,j);
2819  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2820  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
2821  fHist_Corr3p_pTSum_EP_V0A_PN[i][j]->Sumw2();
2823 
2824  sprintf(name,"fHist_Corr3p_pTSum_EP_V0A_PP_Mag%d_Cent%d",i,j);
2825  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2826  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
2827  fHist_Corr3p_pTSum_EP_V0A_PP[i][j]->Sumw2();
2829 
2830  sprintf(name,"fHist_Corr3p_pTSum_EP_V0A_NN_Mag%d_Cent%d",i,j);
2831  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2832  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
2833  fHist_Corr3p_pTSum_EP_V0A_NN[i][j]->Sumw2();
2835  //-----v0c----
2836  sprintf(name,"fHist_Corr3p_pTSum_EP_V0C_PN_Mag%d_Cent%d",i,j);
2837  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2838  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
2839  fHist_Corr3p_pTSum_EP_V0C_PN[i][j]->Sumw2();
2841 
2842  sprintf(name,"fHist_Corr3p_pTSum_EP_V0C_PP_Mag%d_Cent%d",i,j);
2843  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2844  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
2845  fHist_Corr3p_pTSum_EP_V0C_PP[i][j]->Sumw2();
2847 
2848  sprintf(name,"fHist_Corr3p_pTSum_EP_V0C_NN_Mag%d_Cent%d",i,j);
2849  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2850  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
2851  fHist_Corr3p_pTSum_EP_V0C_NN[i][j]->Sumw2();
2853  }
2854  }
2855 
2856  for(int i=0;i<2;i++){
2857  for(int j=0;j<6;j++){
2858  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
2859  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2860  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
2861  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j]->Sumw2();
2863 
2864  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
2865  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2866  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
2867  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j]->Sumw2();
2869 
2870  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
2871  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2872  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
2873  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j]->Sumw2();
2875  //-----v0c----
2876  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
2877  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2878  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
2879  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j]->Sumw2();
2881 
2882  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
2883  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2884  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
2885  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j]->Sumw2();
2887 
2888  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
2889  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2890  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
2891  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j]->Sumw2();
2893  }
2894  }
2895 
2896  Double_t EtaRange[9] = {0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6};
2897 
2898  for(int i=0;i<2;i++){
2899  for(int j=0;j<6;j++){
2900  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
2901  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2902  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = new TProfile(name,title,8,EtaRange,"");
2903  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j]->Sumw2();
2905 
2906  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
2907  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2908  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = new TProfile(name,title,8,EtaRange,"");
2909  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j]->Sumw2();
2911 
2912  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
2913  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2914  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = new TProfile(name,title,8,EtaRange,"");
2915  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j]->Sumw2();
2917  //-----v0c----
2918  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
2919  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2920  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = new TProfile(name,title,8,EtaRange,"");
2921  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j]->Sumw2();
2923 
2924  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
2925  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2926  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = new TProfile(name,title,8,EtaRange,"");
2927  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j]->Sumw2();
2929 
2930  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
2931  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
2932  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = new TProfile(name,title,8,EtaRange,"");
2933  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j]->Sumw2();
2935  }
2936  }
2937 
2938 
2939 
2940 
2941  //non-Isotropic terms for correction:
2942  for(int i=0;i<2;i++){
2943  fHist_NonIso_SP_PP_Mag0[i] = new TProfile2D(Form("fHist_NonIso_SP_PP_Mag0_Det%d",i),"Non Isotropic terms",10,centRange,10,0,10,"");
2945  fHist_NonIso_SP_NN_Mag0[i] = new TProfile2D(Form("fHist_NonIso_SP_NN_Mag0_Det%d",i),"Non Isotropic terms",10,centRange,10,0,10,"");
2947 
2948  fHist_NonIso_SP_PP_Mag1[i] = new TProfile2D(Form("fHist_NonIso_SP_PP_Mag1_Det%d",i),"Non Isotropic terms",10,centRange,10,0,10,"");
2950  fHist_NonIso_SP_NN_Mag1[i] = new TProfile2D(Form("fHist_NonIso_SP_NN_Mag1_Det%d",i),"Non Isotropic terms",10,centRange,10,0,10,"");
2952  }
2953 
2954  for(int i=0;i<2;i++){
2955  fHist_Corr2p_EP_Norm_PN[i] = new TProfile2D(Form("fHist_Corr2p_EP_Norm_PN_Mag%d",i),"<cos(n(phiA-phiB))>",10,centRange,4,0,4,"");
2957  fHist_Corr2p_EP_Norm_PP[i] = new TProfile2D(Form("fHist_Corr2p_EP_Norm_PP_Mag%d",i),"<cos(n(phiA-phiB))>",10,centRange,4,0,4,"");
2959  fHist_Corr2p_EP_Norm_NN[i] = new TProfile2D(Form("fHist_Corr2p_EP_Norm_NN_Mag%d",i),"<cos(n(phiA-phiB))>",10,centRange,4,0,4,"");
2961  }
2962 
2963 
2964 
2965 
2966 
2967 
2968 
2969 
2970 
2971  //=========== Calibtation Histograms etc ==================
2972 
2973 
2974 
2976 
2977  fEventStatvsRun = new TH1F("fEventStatvsRun","Event stat per run",fRunFlag,0,fRunFlag);
2979 
2980  fCentDistvsRun = new TH2F("fCentStatvsRun","Cent Dist. vs run",90,0,90,fRunFlag,0,fRunFlag);
2982 
2983 
2984  fCentV0MvsVzRun = new TProfile2D("fCentV0MvsVzRun","",100,-10,10,fRunFlag,0,fRunFlag);
2986 
2987  fCent3pvsVzRun = new TProfile2D("fCent3pvsVzRun","",100,-10,10,fRunFlag,0,fRunFlag);
2989 
2990  fCentCL1vsVzRun = new TH3F("fCentCL1vsVzRun","",80,-10,10,fRunFlag,0,fRunFlag,20,-10,10);
2992 
2993 
2994 
2995  fTPCvsGlobalTrk = new TH2F("fAODvsESDTrk","ESDTrk vs TPC(FB128)",2000,0,20000,1000,0,10000);
2997 
2998  fTPCvsITSTrk = new TH2F("fTPCvsITSTrk","Global(FB96) vs TPC(FB128)",1000,0,5000,1000,0,5000);
2999  fListCalibs->Add(fTPCvsITSTrk);
3000 
3001  fITSvsESDMult = new TH2F("fITSvsESDMult","ESDTrk vs ITS(FB96) ",2000,0,20000,1000,0,5000);
3002  fListCalibs->Add(fITSvsESDMult);
3003 
3004  fGlobalITSMult = new TH1F("fGlobalITSMult","Global(FB96) Multiplilcity",4000,0,4000);
3006 
3007 
3008 
3009 
3010 
3011  //for debug only, remove after stable code
3012  hUnderOverBinNUApos = new TH1F("hUnderOverBinNUApos","",90,0,90);
3014  hUnderOverBinNUAneg = new TH1F("hUnderOverBinNUAneg","",90,0,90);
3016 
3017  Double_t fCentBinQvect[16] = {0.,2.5,5,10,15,20,25,30,35,40,45,50,60,70,80,90};
3018 
3019  fHEnergyZNCvsCent = new TH2F("fHEnergyZNCvsCent","ZNC Energy vs cent",15,fCentBinQvect,4000,0,200000);
3021  fHEnergyZNAvsCent = new TH2F("fHEnergyZNAvsCent","ZNA Energy vs cent",15,fCentBinQvect,4000,0,200000);
3023  fHEnergyZPCvsCent = new TH2F("fHEnergyZPCvsCent","ZPC Energy vs cent",15,fCentBinQvect,2000,0,50000);
3025  fHEnergyZPAvsCent = new TH2F("fHEnergyZPAvsCent","ZPA Energy vs cent",15,fCentBinQvect,2000,0,50000);
3027 
3028  fHEnergyZNCvsCentRun = new TProfile2D("fHEnergyZNCvsCentRun","",90,0,90,fRunFlag,0,fRunFlag);
3030  fHEnergyZNAvsCentRun = new TProfile2D("fHEnergyZNAvsCentRun","",90,0,90,fRunFlag,0,fRunFlag);
3032  fHEnergyZPCvsCentRun = new TProfile2D("fHEnergyZPCvsCentRun","",90,0,90,fRunFlag,0,fRunFlag);
3034  fHEnergyZPAvsCentRun = new TProfile2D("fHEnergyZPAvsCentRun","",90,0,90,fRunFlag,0,fRunFlag);
3036 
3037  fHEnergyZPCvsZPA = new TH2F("fHEnergyZPCvsZPA","ZNC Energy vs cent",500,0,50000,500,0,50000);
3039  fHEnergyZNCvsZNA = new TH2F("fHEnergyZNCvsZNA","ZNC Energy vs cent",500,50000,150000,500,50000,150000);
3041 
3042  fHCentBinTrkRecenter = new TH1F("fHCentBinTrkRecenter","centrality Binning",15,fCentBinQvect);
3043 
3044 
3045 
3046 
3047  Int_t magField[2] = {0,1}; //0 = Neg, 1 = Pos
3048 
3049  for(int i=0;i<2;i++){
3050  fHist_Corr3p_QAEta_SP_V0A_PN[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0A_PN_Mag%d",magField[i]),"PN, Cent 10-20%",16,-0.8,0.8,"");
3051  fHist_Corr3p_QAEta_SP_V0A_PN[i]->Sumw2();
3053  fHist_Corr3p_QAEta_SP_V0A_PP[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0A_PP_Mag%d",magField[i]),"PP, Cent 10-20%",16,-0.8,0.8,"");
3054  fHist_Corr3p_QAEta_SP_V0A_PP[i]->Sumw2();
3056  fHist_Corr3p_QAEta_SP_V0A_NN[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0A_NN_Mag%d",magField[i]),"NN, Cent 10-20%",16,-0.8,0.8,"");
3057  fHist_Corr3p_QAEta_SP_V0A_NN[i]->Sumw2();
3059  }
3060  for(int i=0;i<2;i++){
3061  fHist_Corr3p_QAEta_SP_V0C_PN[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0C_PN_Mag%d",magField[i]),"PN, Cent 10-20%",16,-0.8,0.8,"");
3062  fHist_Corr3p_QAEta_SP_V0C_PN[i]->Sumw2();
3064  fHist_Corr3p_QAEta_SP_V0C_PP[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0C_PP_Mag%d",magField[i]),"PP, Cent 10-20%",16,-0.8,0.8,"");
3065  fHist_Corr3p_QAEta_SP_V0C_PP[i]->Sumw2();
3067  fHist_Corr3p_QAEta_SP_V0C_NN[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0C_NN_Mag%d",magField[i]),"NN, Cent 10-20%",16,-0.8,0.8,"");
3068  fHist_Corr3p_QAEta_SP_V0C_NN[i]->Sumw2();
3070  }
3071 
3072  fEtaBinFinderForQA = new TH1F("fEtaBinFinderForQA","",16,-0.8,0.8);
3074 
3075 
3076 
3077 
3078 
3079 
3080  Int_t suffixEta[4] = {1,0,1,0}; //{"Pos","Neg","Pos","Neg"};
3081  Int_t suffixVz[4] = {1,1,0,0}; //{"Pos","Pos","Neg","Neg"};
3082 
3083  if(bFillAvgTPCQn){
3084  for(int i=0;i<4;i++){
3085  fHCos1nPosChEtaVz[i] = new TProfile2D(Form("fHCos1nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos1n>",90,0,90,fRunFlag,0,fRunFlag);
3086  fListCalibs->Add(fHCos1nPosChEtaVz[i]);
3087  fHSin1nPosChEtaVz[i] = new TProfile2D(Form("fHSin1nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin1n>",90,0,90,fRunFlag,0,fRunFlag);
3088  fListCalibs->Add(fHSin1nPosChEtaVz[i]);
3089  fHCos1nNegChEtaVz[i] = new TProfile2D(Form("fHCos1nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos1n>",90,0,90,fRunFlag,0,fRunFlag);
3090  fListCalibs->Add(fHCos1nNegChEtaVz[i]);
3091  fHSin1nNegChEtaVz[i] = new TProfile2D(Form("fHSin1nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin1n>",90,0,90,fRunFlag,0,fRunFlag);
3092  fListCalibs->Add(fHSin1nNegChEtaVz[i]);
3093 
3094  fHCos2nPosChEtaVz[i] = new TProfile2D(Form("fHCos2nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3095  fListCalibs->Add(fHCos2nPosChEtaVz[i]);
3096  fHSin2nPosChEtaVz[i] = new TProfile2D(Form("fHSin2nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin2n>",90,0,90,fRunFlag,0,fRunFlag);
3097  fListCalibs->Add(fHSin2nPosChEtaVz[i]);
3098  fHCos2nNegChEtaVz[i] = new TProfile2D(Form("fHCos2nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3099  fListCalibs->Add(fHCos2nNegChEtaVz[i]);
3100  fHSin2nNegChEtaVz[i] = new TProfile2D(Form("fHSin2nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin2n>",90,0,90,fRunFlag,0,fRunFlag);
3101  fListCalibs->Add(fHSin2nNegChEtaVz[i]);
3102 
3103  fHCos3nPosChEtaVz[i] = new TProfile2D(Form("fHCos3nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos3n>",90,0,90,fRunFlag,0,fRunFlag);
3104  fListCalibs->Add(fHCos3nPosChEtaVz[i]);
3105  fHSin3nPosChEtaVz[i] = new TProfile2D(Form("fHSin3nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin3n>",90,0,90,fRunFlag,0,fRunFlag);
3106  fListCalibs->Add(fHSin3nPosChEtaVz[i]);
3107  fHCos3nNegChEtaVz[i] = new TProfile2D(Form("fHCos3nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos3n>",90,0,90,fRunFlag,0,fRunFlag);
3108  fListCalibs->Add(fHCos3nNegChEtaVz[i]);
3109  fHSin3nNegChEtaVz[i] = new TProfile2D(Form("fHSin3nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin3n>",90,0,90,fRunFlag,0,fRunFlag);
3110  fListCalibs->Add(fHSin3nNegChEtaVz[i]);
3111 
3112  fHCos4nPosChEtaVz[i] = new TProfile2D(Form("fHCos4nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos4n>",90,0,90,fRunFlag,0,fRunFlag);
3113  fListCalibs->Add(fHCos4nPosChEtaVz[i]);
3114  fHSin4nPosChEtaVz[i] = new TProfile2D(Form("fHSin4nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin4n>",90,0,90,fRunFlag,0,fRunFlag);
3115  fListCalibs->Add(fHSin4nPosChEtaVz[i]);
3116  fHCos4nNegChEtaVz[i] = new TProfile2D(Form("fHCos4nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos4n>",90,0,90,fRunFlag,0,fRunFlag);
3117  fListCalibs->Add(fHCos4nNegChEtaVz[i]);
3118  fHSin4nNegChEtaVz[i] = new TProfile2D(Form("fHSin4nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin4n>",90,0,90,fRunFlag,0,fRunFlag);
3119  fListCalibs->Add(fHSin4nNegChEtaVz[i]);
3120 
3121  //Double weighted <..>
3122  fHCos2nDWPosChEtaVz[i] = new TProfile2D(Form("fHCos2nDWPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3124  fHSin2nDWPosChEtaVz[i] = new TProfile2D(Form("fHSin2nDWPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3126  fHCos2nDWNegChEtaVz[i] = new TProfile2D(Form("fHCos2nDWNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3128  fHSin2nDWNegChEtaVz[i] = new TProfile2D(Form("fHSin2nDWNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3130  }
3131  }
3132 
3133 
3134  fV0MultChVsRun = new TProfile2D("fV0MultChVsRun","1-32 V0C, 33-64 V0A",64,0,64,fRunFlag,0,fRunFlag,"");
3136 
3137 
3138  fV0AQnxVsCentRun = new TProfile2D("fV0ACos2nVsCentRun","<Cos2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3140  fV0AQnyVsCentRun = new TProfile2D("fV0ASin2nVsCentRun","<Sin2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3142 
3143  fV0CQnxVsCentRun = new TProfile2D("fV0CCos2nVsCentRun","<Cos2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3145  fV0CQnyVsCentRun = new TProfile2D("fV0CSin2nVsCentRun","<Sin2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3147 
3148  fTPCQnxVsCentRun = new TProfile2D("fTPCCos2nVsCentRun","<Cos2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3150  fTPCQnyVsCentRun = new TProfile2D("fTPCSin2nVsCentRun","<Sin2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3152 
3153 
3154  //Average Multiplicity, same-sign, opposite-sign pair vs Centrality 1% :
3155 
3156  fAvgMultCentRun = new TProfile2D("fAvgMultCentRun","<Mult> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3158  fAvgWgtMultCentRun = new TProfile2D("fAvgWgtMultCentRun","<wgt*Mult> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3160  fAvgPOIposCentRun = new TProfile2D("fAvgPOIposCentRun","<wgt*POIs> ch-pos vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3162  fAvgPOInegCentRun = new TProfile2D("fAvgPOInegCentRun","<wgt*POIs> ch-neg vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3164  fAvgPOIPPCentRun = new TProfile2D("fAvgPOIPPCentRun","<wgt*POIs> Pos-Pos vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3166  fAvgPOINNCentRun = new TProfile2D("fAvgPOINNCentRun","<wgt*POIs> Neg-Neg vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3168  fAvgPOIOSCentRun = new TProfile2D("fAvgPOIOSCentRun","<wgt*POIs> oppo.-sign vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3170 
3171 
3172 
3173  //Store CME run by Run: Not used for huge memory usage.
3174  /*
3175  for(int i=0;i<2;i++){//0=V0A,1=V0C
3176  fHist_Corr3p_vsRun_EP_PN[i] = new TProfile2D(Form("fHist_Corr3p_vsRun_EP_PN_Det%d",i+1),"opposit charge correlator",90,0,90,fRunFlag,0,fRunFlag,"");
3177  fListHistos->Add(fHist_Corr3p_vsRun_EP_PN[i]);
3178  fHist_Corr3p_vsRun_EP_PP[i] = new TProfile2D(Form("fHist_Corr3p_vsRun_EP_PP_Det%d",i+1),"PosPos charge correlator",90,0,90,fRunFlag,0,fRunFlag,"");
3179  fListHistos->Add(fHist_Corr3p_vsRun_EP_PP[i]);
3180  fHist_Corr3p_vsRun_EP_NN[i] = new TProfile2D(Form("fHist_Corr3p_vsRun_EP_NN_Det%d",i+1),"NegNeg charge correlator",90,0,90,fRunFlag,0,fRunFlag,"");
3181  fListHistos->Add(fHist_Corr3p_vsRun_EP_NN[i]);
3182  }*/
3183 
3184 
3185 
3186 
3187 
3188 
3189 
3190 
3191  //======== Following are eta,phi plots and written in List: fListNUAHist ================
3192 
3193  for(int i=0;i<10;i++){
3194  sprintf(name,"fHistChPosvsEtaPtRun_Cent%d",i);
3195  sprintf(title,"Pos Ch, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3196  fHistChPosvsEtaPtRun[i] = new TH3F(name,title,25,0.2,5.2,16,-0.8,0.8,fRunFlag,0,fRunFlag);
3198  sprintf(name,"fHistChNegvsEtaPtRun_Cent%d",i);
3199  sprintf(title,"Neg Ch, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3200  fHistChNegvsEtaPtRun[i] = new TH3F(name,title,25,0.2,5.2,16,-0.8,0.8,fRunFlag,0,fRunFlag);
3202  }
3203 
3204 
3205  Int_t gCentForNUA[6] = {0,5,10,20,40,90};
3206 
3207  if(bFillEtaPhiNUA) {
3208  for(int i=0;i<5;i++){
3209  for(int j=0;j<fRunFlag;j++){
3210  sprintf(name,"fHistEtaPhiVz_Pos_Cent%d_Run%d",i,runNums[j]);
3211  sprintf(title,"eta,phi,Vz Pos Cent%d-%d%%",gCentForNUA[i],gCentForNUA[i+1]);
3212  fHist3DEtaPhiVz_Pos_Run[i][j] = new TH3F(name,title,10,-10,10,50,0,6.283185,16,-0.8,0.8);
3214 
3215  sprintf(name,"fHistEtaPhiVz_Neg_Cent%d_Run%d",i,runNums[j]);
3216  sprintf(title,"eta,phi,Vz Pos Cent%d-%d%%",gCentForNUA[i],gCentForNUA[i+1]);
3217  fHist3DEtaPhiVz_Neg_Run[i][j] = new TH3F(name,title,10,-10,10,50,0,6.283185,16,-0.8,0.8);
3219  }
3220  }
3221  }
3222 
3223  fVzBinFinderForNUA = new TH1F("fVzBinFinderForNUA","",4,-10,10); //only needed for pT dependent NUA.
3225 
3226  /*
3227  // pT Dependent NUA correction:
3228  Double_t pTbinNUA[16] = {0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.4,2.6,3.0,3.5,4.0,5.0};
3229  Double_t etabinNUA[9] = {-0.8,-0.6,-0.4,-0.2,0.0,0.2,0.4,0.6,0.8};
3230  Double_t phibinNUA[51] = {0.,};
3231  Double_t fPhi = 6.2832/50;
3232  for(int i=0;i<51;i++){
3233  phibinNUA[i] = fPhi*i;
3234  }
3235 
3236  if(bFillEtaPhiNUA) {
3237  for(int i=0;i<5;i++){
3238  for(int j=0;j<fRunFlag;j++){
3239  sprintf(name,"fHistEtaPhiPt_Pos_Vz%d_Run%d",i,runNums[j]);
3240  sprintf(title,"eta,phi,Pt Pos Vz%d",i);
3241  fHist3DEtaPhiVz_Pos_Run[i][j] = new TH3F(name,title,15,pTbinNUA,50,phibinNUA,8,etabinNUA);
3242  fListNUAHist->Add(fHist3DEtaPhiVz_Pos_Run[i][j]);
3243 
3244  sprintf(name,"fHistEtaPhiPt_Neg_Vz%d_Run%d",i,runNums[j]);
3245  sprintf(title,"eta,phi,Pt Pos Vz%d",i);
3246  fHist3DEtaPhiVz_Neg_Run[i][j] = new TH3F(name,title,15,pTbinNUA,50,phibinNUA,8,etabinNUA);
3247  fListNUAHist->Add(fHist3DEtaPhiVz_Neg_Run[i][j]);
3248  }
3249  }
3250  } */
3251 
3252 
3253 
3254 }
3255 
3256 
virtual void Terminate(Option_t *)
Bool_t CheckEventIsPileUp(AliAODEvent *faod)
TProfile2D * fHist_Corr3p_ZDN_SP_NN[3]
TProfile * fHist_Corr3p_EtaDiff_EP_V0C_NN[2][6]
TProfile * fHist_Reso2n_EP_Norm_Det[2][3]
TProfile * fHist_Corr3p_EtaDiff_EP_V0A_NN[2][6]
double Double_t
Definition: External.C:58
Definition: External.C:260
TProfile2D * fHist_Corr3p_ZDN_SP_PP[3]
Norm = 10 centrality bins along X.
TProfile2D * fHSin3nPosChEtaVz[4]
TH1D * fQynsV0C
sigma Qx2 V0C
Int_t fOldRunNum
number of total run
Definition: External.C:236
Bool_t PileUpMultiVertex(const AliAODEvent *faod)
const char * title
Definition: MakeQAPdf.C:27
TProfile * fHist_Corr3p_pTSum_EP_V0A_PP[2][6]
TProfile2D * fHCos4nPosChEtaVz[4]
TH1D * fQxnmV0A
profile from V0 multiplicity
AliFlowTrackSimple * GetTrack(Int_t i)
TList * fListHistos
Event selection.
TProfile2D * fHist_Corr2p_EP_Norm_NN[2]
AliAnalysisUtils * fAnalysisUtil
MultSelection (RUN2 centrality estimator)
TProfile * fHist_Corr3p_QAEta_SP_V0C_PP[2]
Pos and Neg Mag field.
TProfile2D * fHCos2nNegChEtaVz[4]
TProfile * fHist_Corr3p_pTDiff_EP_V0C_PN[2][6]
TProfile2D * fHSin1nNegChEtaVz[4]
TList * fListFBHijing
collection of NUA Histograms
char Char_t
Definition: External.C:18
TProfile * fHist_Corr3p_QAEta_SP_V0A_PP[2]
Pos and Neg Mag field.
Int_t GetCurrentRunIndex(Int_t run)
TProfile * fHist_Corr3p_EP_Norm_PP[2][3]
TProfile2D * fHSin3nNegChEtaVz[4]
TProfile2D * fHSin2nPosChEtaVz[4]
TList * fListCalibs
collection of output
TProfile * fHist_Corr3p_EP_Norm_PN[2][3]
TH3F * fFB_Efficiency_Neg[10]
3d correction Map
TProfile * fHist_Corr3p_pTDiff_EP_V0A_NN[2][6]
TProfile2D * fHist_Corr3p_ZDN_SP_PN[3]
TProfile2D * fHCos1nPosChEtaVz[4]
TH1F * hUnderOverBinNUAneg
//temporary Debug, remove for stable code
TProfile * fHist_Corr3p_EP_Norm_NN[2][3]
TProfile2D * fHist_Corr3p_vsRun_EP_PN[2]
TProfile2D * fCentV0MvsVzRun
for V0-Mult Gain Correction per channel.
AliMultSelection * fMultSelection
input event
TH1F * fPileUpMultSelCount
event count with different cuts
TProfile * fHist_Corr3p_pTSum_EP_V0A_PN[2][6]
TProfile2D * fHist_NonIso_SP_PP_Mag0[2]
TProfile * fHist_Corr3p_EtaDiff_EP_V0A_PN[2][6]
TProfile2D * fHCos4nNegChEtaVz[4]
TH3F * fHist3DEtaPhiVz_Neg_Run[5][90]
5 centrality bin 90 Bins for Run. NUA
Double_t Phi() const
TProfile * fHist_Corr3p_QAEta_SP_V0A_PN[2]
TProfile2D * fHCos3nPosChEtaVz[4]
void OpenInfoCalbration(Int_t run, Float_t fHarmonic)
TProfile2D * fHist_Reso2n_ZDN_SP_Det[3]
int Int_t
Definition: External.C:63
TH1D * fQynsV0A
sigma Qx2 V0A
TProfile2D * fHCos2nDWPosChEtaVz[4]
TList * fListNUAHist
collection of Calib Histos
TH1D * fMultV0
Cut parameters which were used.
TProfile2D * fHSin2nNegChEtaVz[4]
float Float_t
Definition: External.C:68
TProfile * fHist_Corr3p_SP_Norm_PP[2][3]
Norm = 10 centrality bins along X.
void GetNUACorrectionHist(Int_t run, TString sfileNUA)
Definition: External.C:252
TProfile * fHist_Corr3p_pTSum_EP_V0A_NN[2][6]
Definition: External.C:228
Definition: External.C:212
TProfile * fHist_Corr3p_pTDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_pTSum_EP_V0C_PN[2][6]
TProfile2D * fHSin2nDWPosChEtaVz[4]
TProfile2D * fHCos2nDWNegChEtaVz[4]
TProfile2D * fHCos3nNegChEtaVz[4]
TH3F * fHistChNegvsEtaPtRun[10]
10 Centrality Bin
TProfile2D * fHist_NonIso_SP_NN_Mag1[2]
Mag1 = B > 0.
TProfile2D * fHCos2nPosChEtaVz[4]
Int_t fRunFlag
array of runnumbers
TProfile * fHist_Corr3p_QAEta_SP_V0C_NN[2]
AliFlowEventSimple * fEvent
TProfile * fHist_Reso2n_SP_Norm_Det[2][3]
TProfile2D * fHist_Corr2p_EP_Norm_PN[2]
virtual void UserCreateOutputObjects()
TProfile * fHist_Corr3p_pTDiff_EP_V0C_PP[2][6]
TProfile2D * fV0MultChVsRun
opposite sign pairs
void InitializeRunArray(TString sPeriod)
TProfile * fHist_Corr3p_QAEta_SP_V0A_NN[2]
void GetV0MCorrectionHist(Int_t run)
TH1F * fHCentBinTrkRecenter
//temporary Debug, remove for stable code
TProfile2D * fHSin4nNegChEtaVz[4]
TProfile * fHist_Corr3p_pTSum_EP_V0C_NN[2][6]
TProfile2D * fHist_NonIso_SP_PP_Mag1[2]
TProfile * fHist_Corr3p_SP_Norm_PN[2][3]
TProfile2D * fHSin4nPosChEtaVz[4]
TProfile * fHist_Corr3p_EtaDiff_EP_V0C_PP[2][6]
void GetV0QvectAndMult(const AliAODVZERO *aodV0, Float_t fHarmonic, Double_t &Qxan, Double_t &Qyan, Double_t &sumMa, Double_t &Qxcn, Double_t &Qycn, Double_t &sumMc)
TProfile * fHist_Corr3p_EtaDiff_EP_V0A_PP[2][6]
Float_t EvtCent
counter of event for cout
TProfile * fHist_Corr3p_QAEta_SP_V0C_PN[2]
TProfile2D * fHist_Corr3p_vsRun_EP_NN[2]
Int_t fHarmonicN
Event centrality.
TProfile2D * fHist_NonIso_SP_NN_Mag0[2]
Mag0 = B < 0.
TProfile * fHist_Corr3p_EtaDiff_EP_V0C_PN[2][6]
const char Option_t
Definition: External.C:48
void GetZDCCorrectionHist(Int_t run)
TProfile2D * fAvgPOIOSCentRun
same sign Neg-Neg pairs
Bool_t InPOISelection(Int_t poiType=1) const
TH1D * fQxnmV0C
sigma Qy2 V0A
Double_t Eta() const
const Double_t pi
TProfile2D * fHist_Corr3p_vsRun_EP_PP[2]
TProfile * fHist_Corr3p_SP_Norm_NN[2][3]
bool Bool_t
Definition: External.C:53
TProfile2D * fHSin1nPosChEtaVz[4]
TH3D * fHCorrectNUAneg[5]
5 centrality bin
virtual void UserExec(Option_t *option)
TProfile * fHist_Corr3p_pTDiff_EP_V0C_NN[2][6]
TH1D * fFB_Efficiency_Cent[10]
5 centrality bin 90 Bins for Run. NUA
double GetWDist(const AliVVertex *v0, const AliVVertex *v1)
TProfile2D * fHSin2nDWNegChEtaVz[4]
TProfile2D * fAvgPOINNCentRun
same sign Pos-Pos pairs
TH3F * fHist3DEtaPhiVz_Pos_Run[5][90]
5 centrality bin
TProfile * fHist_Corr3p_pTSum_EP_V0C_PP[2][6]
TProfile2D * fHCos1nNegChEtaVz[4]
Int_t NumberOfTracks() const
TProfile * fHist_Corr3p_pTDiff_EP_V0A_PP[2][6]
TProfile2D * fHist_Corr2p_EP_Norm_PP[2]
Two magnetic fields.