AliPhysics  2c89552 (2c89552)
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  fV0AQ2xVsCentRun(NULL),
118  fV0AQ2yVsCentRun(NULL),
119  fV0CQ2xVsCentRun(NULL),
120  fV0CQ2yVsCentRun(NULL),
121  fV0AQ3xVsCentRun(NULL),
122  fV0AQ3yVsCentRun(NULL),
123  fV0CQ3xVsCentRun(NULL),
124  fV0CQ3yVsCentRun(NULL),
125  fTPCQ2xVsCentRun(NULL),
126  fTPCQ2yVsCentRun(NULL),
127  fTPCQ3xVsCentRun(NULL),
128  fTPCQ3yVsCentRun(NULL),
129  mListNUAPos(NULL),
130  mListNUANeg(NULL),
131  fileNUApos(NULL),
132  fileNUAneg(NULL),
133  fAvgMultCentRun(NULL),
134  fAvgWgtMultCentRun(NULL),
135  fAvgPOIposCentRun(NULL),
136  fAvgPOInegCentRun(NULL),
137  fAvgPOIPPCentRun(NULL),
138  fAvgPOINNCentRun(NULL),
139  fAvgPOIOSCentRun(NULL),
140  fV0MultChVsRun(NULL),
141  fEventStatvsRun(NULL),
142  fEtaBinFinderForQA(NULL),
143  fVzBinFinderForNUA(NULL),
144  fHistVtxZvsRun(NULL),
145  fHistVtxXvsRun(NULL),
146  fHistVtxYvsRun(NULL),
147  fRejectRatioVsCR(NULL),
148  fCentDistvsRun(NULL),
149  fHCorrectV0M(NULL),
150  fCentV0MvsVzRun(NULL),
151  fCent3pvsVzRun(NULL),
152  fTPCvsGlobalTrk(NULL),
153  fTPCuncutvsGlobal(NULL),
154  fGlobalTracks(NULL),
155  fTPCvsITSfb96(NULL),
156  fTPCvsITSfb32(NULL),
157  fTPCFEvsITSfb96(NULL),
158  fCentCL1vsVzRun(NULL),
159  fdPhiFemtoCut(NULL),
160  fVzDistribuion(NULL)
161 {
162  for(int i=0;i<5;i++){
163  fHCorrectNUApos[i] = NULL;
164  fHCorrectNUAneg[i] = NULL;
165  }
166  for(int i=0;i<90;i++){
167  runNums[i] = 0;
168  for(int j=0;j<5;j++){
169  fHist3DEtaPhiVz_Pos_Run[j][i] = NULL;
170  fHist3DEtaPhiVz_Neg_Run[j][i] = NULL;
171  }
172  }
173  for(int i=0;i<10;i++){
174  fFB_Efficiency_Cent[i] = NULL;
175  fFB_Efficiency_Pos[i] = NULL;
176  fFB_Efficiency_Neg[i] = NULL;
177  }
178  for(int i=0;i<2;i++){
179  for(int j=0;j<3;j++){
180  fHist_Corr3p_SP_Norm_PN[i][j] = NULL;
181  fHist_Corr3p_SP_Norm_PP[i][j] = NULL;
182  fHist_Corr3p_SP_Norm_NN[i][j] = NULL;
183  fHist_Reso2n_SP_Norm_Det[i][j] = NULL;
184  }
185  }
186  for(int i=0;i<2;i++){
187  for(int j=0;j<3;j++){
188  fHist_Corr3p_EP_Norm_PN[i][j] = NULL;
189  fHist_Corr3p_EP_Norm_PP[i][j] = NULL;
190  fHist_Corr3p_EP_Norm_NN[i][j] = NULL;
191  fHist_Reso2n_EP_Norm_Det[i][j] = NULL;
192  }
193  }
194  for(int i=0;i<2;i++){
195  fHist_Corr3p_vsRun_EP_PN[i] = NULL;
196  fHist_Corr3p_vsRun_EP_PP[i] = NULL;
197  fHist_Corr3p_vsRun_EP_NN[i] = NULL;
198  }
199  for(int i=0;i<3;i++){
200  fHist_Corr3p_ZDN_SP_PN[i] = NULL;
201  fHist_Corr3p_ZDN_SP_PP[i] = NULL;
202  fHist_Corr3p_ZDN_SP_NN[i] = NULL;
203  fHist_Reso2n_ZDN_SP_Det[i] = NULL;
204  }
205  for(int i=0;i<2;i++){
206  for(int j=0;j<6;j++){
207  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = NULL;
208  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = NULL;
209  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = NULL;
210  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = NULL;
211  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = NULL;
212  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = NULL;
213 
214  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = NULL;
215  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = NULL;
216  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = NULL;
217  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = NULL;
218  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = NULL;
219  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = NULL;
220 
221  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = NULL;
222  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = NULL;
223  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = NULL;
224  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = NULL;
225  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = NULL;
226  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = NULL;
227  }
228  }
229  for(int i=0;i<10;i++){
230  fHistChPosvsEtaPtRun[i] = NULL;
231  fHistChNegvsEtaPtRun[i] = NULL;
232  }
233  for(int i=0;i<2;i++){
234  fHist_Corr3p_QAEta_SP_V0A_PN[i] = NULL;
235  fHist_Corr3p_QAEta_SP_V0A_PP[i] = NULL;
236  fHist_Corr3p_QAEta_SP_V0A_NN[i] = NULL;
237  }
238  for(int i=0;i<2;i++){
239  fHist_Corr3p_QAEta_SP_V0C_PN[i] = NULL;
240  fHist_Corr3p_QAEta_SP_V0C_PP[i] = NULL;
241  fHist_Corr3p_QAEta_SP_V0C_NN[i] = NULL;
242  }
243  for(int i=0;i<4;i++){
244  fHCos1nPosChEtaVz[i] = NULL;
245  fHCos2nPosChEtaVz[i] = NULL;
246  fHCos3nPosChEtaVz[i] = NULL;
247  fHCos4nPosChEtaVz[i] = NULL;
248  fHSin1nPosChEtaVz[i] = NULL;
249  fHSin2nPosChEtaVz[i] = NULL;
250  fHSin3nPosChEtaVz[i] = NULL;
251  fHSin4nPosChEtaVz[i] = NULL;
252 
253  fHCos1nNegChEtaVz[i] = NULL;
254  fHCos2nNegChEtaVz[i] = NULL;
255  fHCos3nNegChEtaVz[i] = NULL;
256  fHCos4nNegChEtaVz[i] = NULL;
257  fHSin1nNegChEtaVz[i] = NULL;
258  fHSin2nNegChEtaVz[i] = NULL;
259  fHSin3nNegChEtaVz[i] = NULL;
260  fHSin4nNegChEtaVz[i] = NULL;
261 
262  fHCos2nDWPosChEtaVz[i] = NULL;
263  fHSin2nDWPosChEtaVz[i] = NULL;
264  fHCos2nDWNegChEtaVz[i] = NULL;
265  fHSin2nDWNegChEtaVz[i] = NULL;
266  }
267  for(int i=0;i<2;i++){
268  fHist_NonIso_SP_PP_Mag0[i] = NULL;
269  fHist_NonIso_SP_NN_Mag0[i] = NULL;
270  fHist_NonIso_SP_PP_Mag1[i] = NULL;
271  fHist_NonIso_SP_NN_Mag1[i] = NULL;
272  }
273  for(int i=0;i<2;i++){
274  fHist_Corr2p_EP_Norm_PN[i] = NULL;
275  fHist_Corr2p_EP_Norm_PP[i] = NULL;
276  fHist_Corr2p_EP_Norm_NN[i] = NULL;
277  }
278 
279  DefineInput(1, AliFlowEventSimple::Class()); // Input slot #1: AliFlowEventSimple
280 
281  DefineOutput(1,TList::Class());
282  DefineOutput(2,TList::Class());
283  DefineOutput(3,TList::Class());
284 
285 }//-------- real ---------
286 
288  fEvent(NULL),
289  fMultSelection(NULL),
290  fAnalysisUtil(NULL),
291  fListHistos(NULL),
292  fListCalibs(NULL),
293  fListNUAHist(NULL),
294  fListFBHijing(NULL),
295  fListNUACorr(NULL),
296  fListZDNCorr(NULL),
297  fListV0MCorr(NULL),
298  fRejectPileUp(kTRUE),
299  fRejectPileUpTight(kTRUE),
300  bFillAvgTPCQn(kFALSE),
301  bFillEtaPhiNUA(kFALSE),
302  bApplyNUACorr(kFALSE),
303  bApplyZDCCorr(kFALSE),
304  bApplyNUAforEP(kFALSE),
305  bFillZDCinfo(kFALSE),
306  bSkipNestedTrk(kFALSE),
307  bRemNegTrkRndm(kFALSE),
308  bApplyV0MCorr(kFALSE),
309  sDataSet("2015"),
310  sAnalysisSet("DoGainEq"),
311  sCentEstimator("V0"),
312  sFileNUA("NewR"),
313  sMCdimension("1D"),
314  fRunFlag(0),
315  fOldRunNum(0),
316  fievent(0),
317  EvtCent(0.0),
318  fHarmonicN(1),
319  fHarmonicM(1),
320  fHarmonicPsi(2),
321  fPileUpSlopeParm(3.43),
322  fPileUpConstParm(43),
323  fHist_Event_count(NULL),
324  fPileUpMultSelCount(NULL),
325  fPileUpCount(NULL),
326  fTaskConfigParm(NULL),
327  fMultV0(NULL),
328  fQxnmV0A(NULL),
329  fQynmV0A(NULL),
330  fQxnsV0A(NULL),
331  fQynsV0A(NULL),
332  fQxnmV0C(NULL),
333  fQynmV0C(NULL),
334  fQxnsV0C(NULL),
335  fQynsV0C(NULL),
336  fHV0AEventPlaneVsCent(NULL),
337  fHV0CEventPlaneVsCent(NULL),
338  fHTPCEventPlaneVsCent(NULL),
339  fHEnergyZNCvsCent(NULL),
340  fHEnergyZNAvsCent(NULL),
341  fHEnergyZPCvsCent(NULL),
342  fHEnergyZPAvsCent(NULL),
343  fHEnergyZNCvsCentRun(NULL),
344  fHEnergyZNAvsCentRun(NULL),
345  fHEnergyZPCvsCentRun(NULL),
346  fHEnergyZPAvsCentRun(NULL),
347  fHEnergyZPCvsZPA(NULL),
348  fHEnergyZNCvsZNA(NULL),
349  hUnderOverBinNUApos(NULL),
350  hUnderOverBinNUAneg(NULL),
351  fHCentBinTrkRecenter(NULL),
352  fHCorrectZDNP(NULL),
353  fV0AQ2xVsCentRun(NULL),
354  fV0AQ2yVsCentRun(NULL),
355  fV0CQ2xVsCentRun(NULL),
356  fV0CQ2yVsCentRun(NULL),
357  fV0AQ3xVsCentRun(NULL),
358  fV0AQ3yVsCentRun(NULL),
359  fV0CQ3xVsCentRun(NULL),
360  fV0CQ3yVsCentRun(NULL),
361  fTPCQ2xVsCentRun(NULL),
362  fTPCQ2yVsCentRun(NULL),
363  fTPCQ3xVsCentRun(NULL),
364  fTPCQ3yVsCentRun(NULL),
365  mListNUAPos(NULL),
366  mListNUANeg(NULL),
367  fileNUApos(NULL),
368  fileNUAneg(NULL),
369  fAvgMultCentRun(NULL),
370  fAvgWgtMultCentRun(NULL),
371  fAvgPOIposCentRun(NULL),
372  fAvgPOInegCentRun(NULL),
373  fAvgPOIPPCentRun(NULL),
374  fAvgPOINNCentRun(NULL),
375  fAvgPOIOSCentRun(NULL),
376  fV0MultChVsRun(NULL),
377  fEventStatvsRun(NULL),
378  fEtaBinFinderForQA(NULL),
379  fVzBinFinderForNUA(NULL),
380  fHistVtxZvsRun(NULL),
381  fHistVtxXvsRun(NULL),
382  fHistVtxYvsRun(NULL),
383  fRejectRatioVsCR(NULL),
384  fCentDistvsRun(NULL),
385  fHCorrectV0M(NULL),
386  fCentV0MvsVzRun(NULL),
387  fCent3pvsVzRun(NULL),
388  fTPCvsGlobalTrk(NULL),
389  fTPCuncutvsGlobal(NULL),
390  fGlobalTracks(NULL),
391  fTPCvsITSfb96(NULL),
392  fTPCvsITSfb32(NULL),
393  fTPCFEvsITSfb96(NULL),
394  fCentCL1vsVzRun(NULL),
395  fdPhiFemtoCut(NULL),
396  fVzDistribuion(NULL)
397 {
398  for(int i=0;i<5;i++){
399  fHCorrectNUApos[i] = NULL;
400  fHCorrectNUAneg[i] = NULL;
401  }
402  for(int i=0;i<90;i++){
403  runNums[i] = 0;
404  for(int j=0;j<5;j++){
405  fHist3DEtaPhiVz_Pos_Run[j][i] = NULL;
406  fHist3DEtaPhiVz_Neg_Run[j][i] = NULL;
407  }
408  }
409  for(int i=0;i<10;i++){
410  fFB_Efficiency_Cent[i] = NULL;
411  fFB_Efficiency_Pos[i] = NULL;
412  fFB_Efficiency_Neg[i] = NULL;
413  }
414  for(int i=0;i<2;i++){
415  for(int j=0;j<3;j++){
416  fHist_Corr3p_SP_Norm_PN[i][j] = NULL;
417  fHist_Corr3p_SP_Norm_PP[i][j] = NULL;
418  fHist_Corr3p_SP_Norm_NN[i][j] = NULL;
419  fHist_Reso2n_SP_Norm_Det[i][j] = NULL;
420  }
421  }
422  for(int i=0;i<2;i++){
423  for(int j=0;j<3;j++){
424  fHist_Corr3p_EP_Norm_PN[i][j] = NULL;
425  fHist_Corr3p_EP_Norm_PP[i][j] = NULL;
426  fHist_Corr3p_EP_Norm_NN[i][j] = NULL;
427  fHist_Reso2n_EP_Norm_Det[i][j] = NULL;
428  }
429  }
430  for(int i=0;i<2;i++){
431  fHist_Corr3p_vsRun_EP_PN[i] = NULL;
432  fHist_Corr3p_vsRun_EP_PP[i] = NULL;
433  fHist_Corr3p_vsRun_EP_NN[i] = NULL;
434  }
435  for(int i=0;i<3;i++){
436  fHist_Corr3p_ZDN_SP_PN[i] = NULL;
437  fHist_Corr3p_ZDN_SP_PP[i] = NULL;
438  fHist_Corr3p_ZDN_SP_NN[i] = NULL;
439  fHist_Reso2n_ZDN_SP_Det[i] = NULL;
440  }
441  for(int i=0;i<2;i++){
442  for(int j=0;j<6;j++){
443  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = NULL;
444  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = NULL;
445  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = NULL;
446  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = NULL;
447  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = NULL;
448  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = NULL;
449 
450  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = NULL;
451  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = NULL;
452  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = NULL;
453  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = NULL;
454  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = NULL;
455  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = NULL;
456 
457  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = NULL;
458  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = NULL;
459  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = NULL;
460  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = NULL;
461  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = NULL;
462  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = NULL;
463  }
464  }
465  for(int i=0;i<10;i++){
466  fHistChPosvsEtaPtRun[i] = NULL;
467  fHistChNegvsEtaPtRun[i] = NULL;
468  }
469  for(int i=0;i<2;i++){
473  }
474  for(int i=0;i<2;i++){
478  }
479  for(int i=0;i<4;i++){
480  fHCos1nPosChEtaVz[i] = NULL;
481  fHCos2nPosChEtaVz[i] = NULL;
482  fHCos3nPosChEtaVz[i] = NULL;
483  fHCos4nPosChEtaVz[i] = NULL;
484  fHSin1nPosChEtaVz[i] = NULL;
485  fHSin2nPosChEtaVz[i] = NULL;
486  fHSin3nPosChEtaVz[i] = NULL;
487  fHSin4nPosChEtaVz[i] = NULL;
488 
489  fHCos1nNegChEtaVz[i] = NULL;
490  fHCos2nNegChEtaVz[i] = NULL;
491  fHCos3nNegChEtaVz[i] = NULL;
492  fHCos4nNegChEtaVz[i] = NULL;
493  fHSin1nNegChEtaVz[i] = NULL;
494  fHSin2nNegChEtaVz[i] = NULL;
495  fHSin3nNegChEtaVz[i] = NULL;
496  fHSin4nNegChEtaVz[i] = NULL;
497 
498  fHCos2nDWPosChEtaVz[i] = NULL;
499  fHSin2nDWPosChEtaVz[i] = NULL;
500  fHCos2nDWNegChEtaVz[i] = NULL;
501  fHSin2nDWNegChEtaVz[i] = NULL;
502  }
503  for(int i=0;i<2;i++){
504  fHist_NonIso_SP_PP_Mag0[i] = NULL;
505  fHist_NonIso_SP_NN_Mag0[i] = NULL;
506  fHist_NonIso_SP_PP_Mag1[i] = NULL;
507  fHist_NonIso_SP_NN_Mag1[i] = NULL;
508  }
509  for(int i=0;i<2;i++){
510  fHist_Corr2p_EP_Norm_PN[i] = NULL;
511  fHist_Corr2p_EP_Norm_PP[i] = NULL;
512  fHist_Corr2p_EP_Norm_NN[i] = NULL;
513  }
514 
515 }//-----------
516 
517 
518 
519 
521 {
523 
524  fAnalysisUtil = new AliAnalysisUtils();
525  fAnalysisUtil->SetUseMVPlpSelection(kTRUE);
526  fAnalysisUtil->SetUseOutOfBunchPileUp(kTRUE);
527 
528 
529  if(fListFBHijing) {
530  if(sMCdimension=="1D"){
531  for(int i=0;i<10;i++) {
532  fFB_Efficiency_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_%d",i));
533  }
534  }
535  else if(sMCdimension=="3D"){
536  Int_t centFB[11] = {0,5,10,20,30,40,50,60,70,80,90};
537  for(int i=0;i<10;i++) {
538  fFB_Efficiency_Pos[i] = (TH3F *) fListFBHijing->FindObject(Form("fHistCorrectionPlus%d-%d",centFB[i],centFB[i+1]));
539  fFB_Efficiency_Neg[i] = (TH3F *) fListFBHijing->FindObject(Form("fHistCorrectionMinus%d-%d",centFB[i],centFB[i+1]));
540  }
541  }
542  else{
543  printf("\n\n!!***** Warning *****!!\n Enter correct Dimention !!\n\n"); exit(1);
544  }
545  }
546  else{ // if MC efficiency not found then use weight = 1.
547  printf("\n\n!!***** Warning *****!!\n FilterBit efficiency not found, use = 1.0 !!\n\n");
548  for(int i=0;i<10;i++){
549  fFB_Efficiency_Cent[i] = new TH1D(Form("eff_unbiased_%d",i),"",1,0,50.);
550  fFB_Efficiency_Cent[i]->SetBinContent(1,1.0);
551  fFB_Efficiency_Pos[i] = new TH3F(Form("eff_unbiased_Pos_%d",i),"",1,-0.9,0.9,1,0,50,1,0,7);
552  fFB_Efficiency_Pos[i]->SetBinContent(1,1,1,1.0);
553  fFB_Efficiency_Neg[i] = new TH3F(Form("eff_unbiased_Neg_%d",i),"",1,-0.9,0.9,1,0,50,1,0,7);
554  fFB_Efficiency_Neg[i]->SetBinContent(1,1,1,1.0);
555  }
556  }
557 
558 
559 
560  fListHistos = new TList();
561  fListHistos->SetOwner(kTRUE);
562 
563  fListCalibs = new TList();
564  fListCalibs->SetOwner(kTRUE);
565 
566  fListNUAHist = new TList();
567  fListNUAHist->SetOwner(kTRUE);
568 
569  this->DefineHistograms();
570 
571  if(fListFBHijing){
572  fTaskConfigParm->SetBinContent(11,1.0);
573  }
574  if(bApplyNUACorr){
575  fTaskConfigParm->SetBinContent(12,1.0);
576  }
577  if(bApplyV0MCorr){
578  fTaskConfigParm->SetBinContent(13,1.0);
579  }
580  if(bApplyZDCCorr){
581  fTaskConfigParm->SetBinContent(14,1.0);
582  }
583 
584  fTaskConfigParm->SetBinContent(15,fHarmonicN);
585  fTaskConfigParm->SetBinContent(16,fHarmonicM);
586  fTaskConfigParm->SetBinContent(17,fHarmonicPsi);
587 
588  PostData(1,fListHistos);
589  PostData(2,fListCalibs);
590  PostData(3,fListNUAHist);
591 
592  //printf("\n ... ::UserCreateOutPutObject Called....... \n");
593 
594 }
595 
597 {
598  delete fListHistos;
599  delete fListCalibs;
600  delete fListNUAHist;
601 
602  if(fAnalysisUtil) delete fAnalysisUtil; // it is '= new' !!!
603 
604  delete fHCentBinTrkRecenter;
605 
606  if(fHCorrectV0M) delete fHCorrectV0M;
607  if(fHCorrectZDNP) delete fHCorrectZDNP;
608 
609  for(int i=0;i<5;i++){
610  if(fHCorrectNUApos[i]) delete fHCorrectNUApos[i];
611  if(fHCorrectNUAneg[i]) delete fHCorrectNUAneg[i];
612  }
613  for(int i=0;i<10;i++){
614  if(fFB_Efficiency_Cent[i]) delete fFB_Efficiency_Cent[i];
615  if(fFB_Efficiency_Pos[i]) delete fFB_Efficiency_Pos[i];
616  if(fFB_Efficiency_Neg[i]) delete fFB_Efficiency_Neg[i];
617  }
618 }
619 
620 
621 
622 
623 
624 
625 
627 {
628 
629  Float_t stepCount = 0.5;
630  fHist_Event_count->Fill(stepCount); //1
631  stepCount++;
632 
633  AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
634  fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(1));
635 
636  if(!aod || !fEvent){
637  printf("\n ... ::UserExec = no AOD or Flow Event, \n.... EXIT ..... \n");
638  return;
639  }
640 
641  fHist_Event_count->Fill(stepCount); //2
642  stepCount++;
643 
644 
645  //---------pileup rejection: --------
646 
647  Bool_t kPileupEvent = kFALSE;
648 
649  kPileupEvent = CheckEventIsPileUp(aod);
650 
651  if(kPileupEvent) return;
652 
653 
654 
655  fHist_Event_count->Fill(stepCount); //3
656  stepCount++;
657 
658 
659 
660  Double_t centrV0M = -1;
661  Double_t centrCL1 = -1;
662  Double_t centrCL0 = -1;
663  Double_t centrTRK = -1;
664 
665  EvtCent = -1;
666 
667  if(sDataSet=="2010"||sDataSet=="2011"){
668  centrV0M = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("V0M");
669  centrCL1 = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL1");
670  centrCL0 = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL0");
671  centrTRK = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("TRK");
672  }
673  else{
674  fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection");
675  if(!fMultSelection) {
676  printf("\n\n **WARNING** ::UserExec() AliMultSelection object not found.\n\n");
677  exit(1);
678  }
679  centrV0M = fMultSelection->GetMultiplicityPercentile("V0M");
680  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
681  centrCL0 = fMultSelection->GetMultiplicityPercentile("CL0");
682  centrTRK = fMultSelection->GetMultiplicityPercentile("TRK");
683  }
684 
685 
686 
687  if(sCentEstimator=="V0" || sCentEstimator=="V0M"){
688  EvtCent = centrV0M;
689  }
690  else{
691  EvtCent = centrCL1;
692  }
693 
694 
695  Int_t iCentSPD = centrCL1;
696 
697  if(iCentSPD > 90) return;
698 
699  fHist_Event_count->Fill(stepCount); //4
700  stepCount++;
701 
702 
703 
704 
705  Int_t cIndex = 0;
706  Int_t cForNUA = 0;
707  Int_t cInputNUA = 0;
708 
709  if(EvtCent<5.0) {
710  cIndex = 0;
711  cForNUA = 0; //0=0-5,
712  cInputNUA = 0;
713  }
714  else if(EvtCent>=5.0 && EvtCent<10){
715  cIndex = 1;
716  cForNUA = 1; // 1=5-10,
717  cInputNUA = 1;
718  }
719  else if(EvtCent>=10.0) {
720  cIndex = abs(EvtCent/10.0) + 1;
721  cForNUA = cIndex; //2 = 10-20,
722 
723  if(EvtCent>=10 && EvtCent<40.0)
724  cInputNUA = 2;
725 
726  if(EvtCent>=20 && EvtCent<40.0){
727  cForNUA = 3; // 3=20-40
728  }
729  if(EvtCent>=40.0){
730  cForNUA = 4; // 4=40-90
731  cInputNUA = 3;
732  }
733  }
734 
735 
736 
737  //------- load v0 calib file of Alex --------
738  Int_t runindex = -111;
739  Int_t runNumber = aod->GetRunNumber();
740  Float_t psiN = fHarmonicPsi;
741  runindex = GetCurrentRunIndex(runNumber);
742 
743  if(runNumber!=fOldRunNum){
744 
745 
746  if(sDataSet=="2015" || sDataSet=="2015HI"){
747  OpenInfoCalbration(runNumber, psiN);
748  }
749  if(bApplyV0MCorr){
750  GetV0MCorrectionHist(runNumber);
751  }
752  if(bApplyNUACorr){
753  GetNUACorrectionHist(runNumber,sFileNUA);
754  }
756  GetZDCCorrectionHist(runNumber);
757  }
758 
759  fOldRunNum = runNumber;
760  }
761 
762 
763 
764 
765  Double_t fMagField = aod->GetMagneticField();
766  Int_t QAindex = -1;
767  //Femto:
768  Int_t bSign = (fMagField > 0) ? 1 : -1;
769  Double_t fHBTCutValue = 0.02;
770 
771 
772  if(fMagField<0)
773  QAindex = 0;
774  else if(fMagField>0)
775  QAindex = 1;
776 
777 //-------- V0 info ---------------
778  const AliAODVZERO *fAODV0 = aod->GetVZEROData();
779 
780 
781  Double_t QyanCor = 0., QycnCor = 0.;
782  Double_t QxanCor = 0., QxcnCor = 0.;
783  Double_t Qxan2 = 0., Qyan2 = 0.;
784  Double_t Qxcn2 = 0., Qycn2 = 0.;
785  Double_t sumMa = 0., sumMc = 0.;
786  Double_t fMultv0 = 0.;
787  Double_t phiV0 = 0.;
788 
789 
790  if(sDataSet=="2015" || sDataSet=="2015HI") {
791  GetV0QvectAndMult(fAODV0, psiN, Qxan2, Qyan2, sumMa, Qxcn2, Qycn2, sumMc);
792 
793  QyanCor = (Qyan2 - fQynmV0A->GetBinContent(iCentSPD+1))/fQynsV0A->GetBinContent(iCentSPD+1);
794  QycnCor = (Qycn2 - fQynmV0C->GetBinContent(iCentSPD+1))/fQynsV0C->GetBinContent(iCentSPD+1);
795 
796  QxanCor = Qxan2;
797  QxcnCor = Qxcn2;
798 
799  if(psiN != 4.){
800  QxanCor = (Qxan2 - fQxnmV0A->GetBinContent(iCentSPD+1))/fQxnsV0A->GetBinContent(iCentSPD+1);
801  QxcnCor = (Qxcn2 - fQxnmV0C->GetBinContent(iCentSPD+1))/fQxnsV0C->GetBinContent(iCentSPD+1);
802  }
803  }
804  //else{
805 
806  Double_t Qxan3 = 0., Qyan3 = 0.;
807  Double_t Qxcn3 = 0., Qycn3 = 0.;
808  Qxan2 = 0., Qyan2 = 0.;
809  Qxcn2 = 0., Qycn2 = 0.;
810 
811  for(int iV0 = 0; iV0 < 64; iV0++) { //0-31 is V0C, 32-63 VOA
812 
813  fMultv0 = fAODV0->GetMultiplicity(iV0);
814 
815  if(fHCorrectV0M){
816  fMultv0 = fMultv0 * fHCorrectV0M->GetBinContent(iV0+1); // Gain Correction
817  }
818 
819  fV0MultChVsRun->Fill(iV0+0.5,runindex,fMultv0);
820 
821  phiV0 = TMath::PiOver4()*(0.5 + iV0 % 8);
822 
823  if(iV0 < 32){
824  Qxcn2 += TMath::Cos(2*phiV0) * fMultv0;
825  Qycn2 += TMath::Sin(2*phiV0) * fMultv0;
826  Qxcn3 += TMath::Cos(3*phiV0) * fMultv0;
827  Qycn3 += TMath::Sin(3*phiV0) * fMultv0;
828  sumMc += fMultv0;
829  }
830  else if(iV0 >= 32){
831  Qxan2 += TMath::Cos(2*phiV0) * fMultv0;
832  Qyan2 += TMath::Sin(2*phiV0) * fMultv0;
833  Qxan3 += TMath::Cos(3*phiV0) * fMultv0;
834  Qyan3 += TMath::Sin(3*phiV0) * fMultv0;
835  sumMa += fMultv0;
836  }
837  }//channel loop
838 
839  //For V0-Qn Recenter
840  fV0CQ2xVsCentRun->Fill(centrCL1,runindex,Qxcn2);
841  fV0CQ2yVsCentRun->Fill(centrCL1,runindex,Qycn2);
842  fV0AQ2xVsCentRun->Fill(centrCL1,runindex,Qxan2);
843  fV0AQ2yVsCentRun->Fill(centrCL1,runindex,Qyan2);
844 
845  fV0CQ3xVsCentRun->Fill(centrCL1,runindex,Qxcn3);
846  fV0CQ3yVsCentRun->Fill(centrCL1,runindex,Qycn3);
847  fV0AQ3xVsCentRun->Fill(centrCL1,runindex,Qxan3);
848  fV0AQ3yVsCentRun->Fill(centrCL1,runindex,Qyan3);
849 
850 
851  if(sDataSet=="2015pPb" || sDataSet=="pPb"){
852  if(psiN==3.0){
853  QxanCor = Qxan3; //3rd
854  QxcnCor = Qxcn3;
855  QyanCor = Qyan3;
856  QycnCor = Qycn3;
857  }
858  else{
859  QxanCor = Qxan2; //2nd or higher
860  QxcnCor = Qxcn2;
861  QyanCor = Qyan2;
862  QycnCor = Qycn2;
863  }
864  }
865 
866 
867 
868  //} else (other than 2015o_pass1 HI data)
869 
870 
871 
872  //Fill V0M Mult for all System: filled above
873  /*for(int iV0 = 0; iV0 < 64; iV0++) { //0-31 is V0C, 32-63 VOA
874  fMultv0 = fAODV0->GetMultiplicity(iV0);
875  fV0MultChVsRun->Fill(iV0+0.5,runindex,fMultv0);
876  }*/
877 
878 
879 
880 
881 
882  if(sumMa <= 0 || sumMc <= 0) return;
883  fHist_Event_count->Fill(stepCount); //5
884  stepCount++;
885 
886 
887  AliAODVertex *pVertex = aod->GetPrimaryVertex();
888  Double_t VtxZ = pVertex->GetZ();
889  Double_t VtxX = pVertex->GetX();
890  Double_t VtxY = pVertex->GetY();
891 
892  fVzDistribuion->Fill(VtxZ);
893 
894  if(sDataSet=="2015pPb" || sDataSet=="pPb"){
895 
896  if(VtxZ < 1.e-4 && VtxX < 1.e-4 && VtxY < 1.e-4)
897  return;
898 
899  fHistVtxZvsRun->Fill(runindex,VtxZ);
900  fHistVtxXvsRun->Fill(runindex,VtxX);
901  fHistVtxYvsRun->Fill(runindex,VtxY);
902  }
903 
904 
905  //------------- Load ZDC info: -----------
906  Double_t energyZNC=0.,energyZNA=0.,energyZPC=0.,energyZPA=0.;
907 
908  energyZNC = ((AliVAODHeader*)aod->GetHeader())->GetZDCN1Energy();
909  energyZNA = ((AliVAODHeader*)aod->GetHeader())->GetZDCN2Energy();
910  energyZPC = ((AliVAODHeader*)aod->GetHeader())->GetZDCP1Energy();
911  energyZPA = ((AliVAODHeader*)aod->GetHeader())->GetZDCP2Energy();
912 
913 
914  //Apply Gain Correction:
915  if(fHCorrectZDNP){
916  energyZNC = energyZNC * fHCorrectZDNP->GetBinContent((abs(EvtCent)+1),1);
917  energyZNA = energyZNA * fHCorrectZDNP->GetBinContent((abs(EvtCent)+1),2);
918  energyZPC = energyZPC * fHCorrectZDNP->GetBinContent((abs(EvtCent)+1),3);
919  energyZPA = energyZPA * fHCorrectZDNP->GetBinContent((abs(EvtCent)+1),4);
920  }
921 
922  //fill ZDC info: Uses
923  if(bFillZDCinfo){
924 
925  fHEnergyZNCvsCentRun->Fill(EvtCent,runindex,energyZNC);
926  fHEnergyZNAvsCentRun->Fill(EvtCent,runindex,energyZNA);
927  fHEnergyZPCvsCentRun->Fill(EvtCent,runindex,energyZPC);
928  fHEnergyZPAvsCentRun->Fill(EvtCent,runindex,energyZPA);
929 
930  //if(EvtCent>30. && EvtCent<40.){
931  //fHEnergyZPCvsZPA->Fill(energyZPC,energyZPA);
932  //fHEnergyZNCvsZNA->Fill(energyZNC,energyZNA);
933  //}
934  }
935 
936 
937 
938 
939 
940  Int_t BadRuns[10] = {246871,246870,246867,246865,246864,246859,246858,246676,246675,246540};
941  Int_t iBadrun = 10;
942  Int_t isBadRun = 0;
943 
944  for(int ib=0;ib<iBadrun;ib++){
945  if(runNumber==BadRuns[ib]){
946  isBadRun = 1;
947  break;
948  }
949  }
950 
951 
952 
953  //Store Qvector for tracks:
954  Double_t QxPos[2] = {0.,}; //[0]=n*phi,[1]=2*n*phi
955  Double_t QyPos[2] = {0.,};
956  Double_t QxNeg[2] = {0.,};
957  Double_t QyNeg[2] = {0.,};
958 
959  //Store Qvector for Auto-correlations
960  Double_t QxAutoPos[2] = {0.,};
961  Double_t QyAutoPos[2] = {0.,};
962  Double_t QxAutoNeg[2] = {0.,};
963  Double_t QyAutoNeg[2] = {0.,};
964 
965 
966  //temp: for QA only
967  Double_t QxPosQAEta[80] = {0.,};
968  Double_t QyPosQAEta[80] = {0.,};
969  Double_t QxNegQAEta[80] = {0.,};
970  Double_t QyNegQAEta[80] = {0.,};
971  Double_t QxAutoPosQAEta[80] = {0.,};
972  Double_t QyAutoPosQAEta[80] = {0.,};
973  Double_t QxAutoNegQAEta[80] = {0.,};
974  Double_t QyAutoNegQAEta[80] = {0.,};
975  Double_t MPOIposQAEta[80] = {0.,};
976  Double_t MPOInegQAEta[80] = {0.,};
977  Int_t iEtaQA = -1;
978 
979  Double_t AvgCos1n=0.,AvgSin1n=0.;
980  //Double_t AvgCos2n=0.,AvgSin2n=0.;
981  Double_t AvgDWCos2n=0.,AvgDWSin2n=0.;
982 
983 
984 
985 
986 
987  //Multiplicity of POIs:
988  Double_t MPOIpos = 0;
989  Double_t MPOIneg = 0;
990  Double_t McorrPos = 0.;
991  Double_t McorrNeg = 0.;
992 
993  //TPC Event plane Qvectors:
994  Double_t QxTPC[3] = {0.,};
995  Double_t QyTPC[3] = {0.,};
996 
997  Int_t ptBin;
998  Int_t nRefMult = 0;
999  Int_t n = fHarmonicN;
1000  Int_t m = fHarmonicM;
1001  Int_t p = (fHarmonicN+fHarmonicM); // cos(nphi1 + mphi2 - p*Psi)
1002 
1003  Double_t nRefMultWgt = 0.;
1004 
1005 
1006 
1007 
1008  //Int_t iCentRec = 0; //centrality bin for track recenter
1009  //iCentRec = fHCentBinTrkRecenter->FindBin(EvtCent);
1010 
1011  //Int_t nBinVz=1,nBinPhi=1,nBinEta=1;
1012 
1013  //CME using Event plane:
1014  Double_t pi = TMath::Pi();
1015  Double_t Psi2V0C = 1./psiN*TMath::ATan2(QycnCor,QxcnCor);
1016  if(Psi2V0C<0.) Psi2V0C += 2*pi/psiN;
1017 
1018  Double_t Psi2V0A = 1./psiN*TMath::ATan2(QyanCor,QxanCor);
1019  if(Psi2V0A<0.) Psi2V0A += 2*pi/psiN;
1020 
1021  /*
1022  fV0AQ2xVsCentRun->Fill(centrCL1,runindex,QycnCor); // For V0-Q Recenter QA.
1023  fV0AQ2yVsCentRun->Fill(centrCL1,runindex,QyanCor);
1024  fV0CQ2xVsCentRun->Fill(centrCL1,runindex,QxcnCor);
1025  fV0CQ2yVsCentRun->Fill(centrCL1,runindex,QycnCor);*/
1026 
1027 
1028 
1029  Int_t iBinNUA = 1;
1030  Int_t iVzNUA = -1;
1031  iVzNUA = fVzBinFinderForNUA->FindBin(VtxZ) - 1;
1032 
1033 
1034 
1035  Int_t iTracks = fEvent->NumberOfTracks();
1036 
1037  Int_t icReject = 0;
1038 
1039 
1040  AliFlowTrackSimple* pTrack1 = NULL;
1041  AliFlowTrackSimple* pTrack2 = NULL;
1042 
1043  Double_t dPhi1,dPt1,dEta1,dChrg1;
1044  Double_t dPhi2,dPt2,dEta2,dChrg2;
1045  Double_t WgtEP = 1.0;
1046 
1047  Double_t ptw1 = 1.0, w1NUA = 1.0;
1048  Double_t ptw2 = 1.0;
1049  Double_t w2NUA = 1.0;
1050 
1051  //Femto:
1052  Double_t deltaPhi=0.,deltaEta=0.;
1053 
1054 
1055 
1056  for(int i=0; i<iTracks; i++) {
1057  pTrack1 = fEvent->GetTrack(i);
1058  if(!pTrack1) continue;
1059  dPhi1 = pTrack1->Phi(); //0-2pi range
1060  dPt1 = pTrack1-> Pt();
1061  dEta1 = pTrack1->Eta();
1062  dChrg1 = pTrack1->Charge();
1063 
1064  if(!pTrack1->InPOISelection())
1065  continue;
1066 
1067  //remove randomly -Ve tracks:
1068  //if(bRemNegTrkRndm && dChrg1<0 && fRand.Rndm()<0.15){
1069  //icReject++;
1070  //continue;
1071  //}
1072 
1073 
1074  if(bFillEtaPhiNUA){
1075  if(dChrg1>0){
1076  fHist3DEtaPhiVz_Pos_Run[cForNUA][runindex]->Fill(VtxZ,dPhi1,dEta1);
1077  }
1078  else if(dChrg1<0){
1079  fHist3DEtaPhiVz_Neg_Run[cForNUA][runindex]->Fill(VtxZ,dPhi1,dEta1);
1080  }
1081  }
1082  /*
1083  if(bFillEtaPhiNUA){
1084  if(dChrg1>0){
1085  fHist3DEtaPhiVz_Pos_Run[iVzNUA][runindex]->Fill(dPt1,dPhi1,dEta1);
1086  }
1087  else if(dChrg1<0){
1088  fHist3DEtaPhiVz_Neg_Run[iVzNUA][runindex]->Fill(dPt1,dPhi1,dEta1);
1089  }
1090  }*/
1091 
1092  if(bApplyNUACorr){
1093  //get NUA weights:
1094  if(sFileNUA=="New2018"){
1095  if(dChrg1>0){
1096  iBinNUA = fHCorrectNUApos[cForNUA]->FindBin(VtxZ,dPhi1,dEta1);
1097  w1NUA = fHCorrectNUApos[cForNUA]->GetBinContent(iBinNUA);
1098  }
1099  else if(dChrg1<0){
1100  iBinNUA = fHCorrectNUAneg[cForNUA]->FindBin(VtxZ,dPhi1,dEta1);
1101  w1NUA = fHCorrectNUAneg[cForNUA]->GetBinContent(iBinNUA);
1102  }
1103  }
1104  else if(sFileNUA=="OldJ"||sFileNUA=="NewR"){
1105  if(dChrg1>0){
1106  iBinNUA = fHCorrectNUApos[cInputNUA]->FindBin(VtxZ,dPhi1,dEta1);
1107  w1NUA = fHCorrectNUApos[cInputNUA]->GetBinContent(iBinNUA);
1108  }
1109  else if(dChrg1<0){
1110  iBinNUA = fHCorrectNUAneg[cInputNUA]->FindBin(VtxZ,dPhi1,dEta1);
1111  w1NUA = fHCorrectNUAneg[cInputNUA]->GetBinContent(iBinNUA);
1112  }
1113  if(sFileNUA=="OldJ") w1NUA = 1./w1NUA;
1114  }
1115  else if(sFileNUA=="NewPt"||sFileNUA=="NewpT"){
1116  if(dChrg1>0){
1117  iBinNUA = fHCorrectNUApos[iVzNUA]->FindBin(dPt1,dPhi1,dEta1);
1118  w1NUA = fHCorrectNUApos[iVzNUA]->GetBinContent(iBinNUA);
1119  }
1120  else if(dChrg1<0){
1121  iBinNUA = fHCorrectNUAneg[iVzNUA]->FindBin(dPt1,dPhi1,dEta1);
1122  w1NUA = fHCorrectNUAneg[iVzNUA]->GetBinContent(iBinNUA);
1123  }
1124  }
1125  if(w1NUA > 1e3 ) w1NUA = 1.0;
1126  }
1127 
1128 
1129 
1130  if(dChrg1>0){
1131  fHistChPosvsEtaPtRun[cIndex]->Fill(dPt1,dEta1,runindex,w1NUA);
1132  }
1133  else if(dChrg1<0){
1134  fHistChNegvsEtaPtRun[cIndex]->Fill(dPt1,dEta1,runindex,w1NUA);
1135  }
1136 
1137 
1138 
1139  if(sMCdimension=="1D"){
1140  ptBin = fFB_Efficiency_Cent[cIndex]->FindBin(dPt1);
1141  ptw1 = 1.0/fFB_Efficiency_Cent[cIndex]->GetBinContent(ptBin);
1142  }
1143  else if(sMCdimension=="3D"){
1144  if(dChrg1>0){
1145  ptBin = fFB_Efficiency_Pos[cIndex]->FindBin(dEta1,dPt1,dPhi1); //left here
1146  ptw1 = fFB_Efficiency_Pos[cIndex]->GetBinContent(ptBin);
1147  }
1148  else if(dChrg1<0){
1149  ptBin = fFB_Efficiency_Neg[cIndex]->FindBin(dEta1,dPt1,dPhi1); //left here
1150  ptw1 = fFB_Efficiency_Neg[cIndex]->GetBinContent(ptBin);
1151  }
1152  }
1153 
1154  if (ptw1>1e3) ptw1 = 1.0;
1155 
1156 
1157 
1158 
1159  //if(bFillAvgTPCQn) { //fill TPC Q-vect:
1160  if(VtxZ>0 && dEta1>=0){
1161  if(dChrg1>0){
1162  //fHCos1nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1163  //fHSin1nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1164  fHCos2nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1165  fHSin2nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1166  fHCos3nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1167  fHSin3nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1168  //fHCos4nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1169  //fHSin4nPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1170  //fHCos2nDWPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1171  //fHSin2nDWPosChEtaVz[0]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1172  }
1173  else if(dChrg1<0){
1174  //fHCos1nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1175  //fHSin1nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1176  fHCos2nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1177  fHSin2nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1178  fHCos3nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1179  fHSin3nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1180  //fHCos4nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1181  //fHSin4nNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1182  //fHCos2nDWNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1183  //fHSin2nDWNegChEtaVz[0]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1184  }
1185  }
1186  else if(VtxZ>0 && dEta1<0){
1187  if(dChrg1>0){
1188  //fHCos1nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1189  //fHSin1nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1190  fHCos2nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1191  fHSin2nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1192  fHCos3nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1193  fHSin3nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1194  //fHCos4nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1195  //fHSin4nPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1196  //fHCos2nDWPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1197  //fHSin2nDWPosChEtaVz[1]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1198  }
1199  else if(dChrg1<0){
1200  // fHCos1nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1201  // fHSin1nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1202  fHCos2nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1203  fHSin2nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1204  fHCos3nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1205  fHSin3nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1206  // fHCos4nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1207  // fHSin4nNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1208  // fHCos2nDWNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1209  // fHSin2nDWNegChEtaVz[1]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1210  }
1211  }
1212  else if(VtxZ<0 && dEta1>=0){
1213  if(dChrg1>0){
1214  // fHCos1nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1215  // fHSin1nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1216  fHCos2nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1217  fHSin2nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1218  fHCos3nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1219  fHSin3nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1220  // fHCos4nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1221  // fHSin4nPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1222  // fHCos2nDWPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1223  // fHSin2nDWPosChEtaVz[2]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1224  }
1225  else if(dChrg1<0){
1226  // fHCos1nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1227  // fHSin1nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1228  fHCos2nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1229  fHSin2nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1230  fHCos3nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1231  fHSin3nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1232  // fHCos4nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1233  // fHSin4nNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1234  // fHCos2nDWNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1235  // fHSin2nDWNegChEtaVz[2]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1236  }
1237 
1238  }
1239  else if(VtxZ<0 && dEta1<0){
1240  if(dChrg1>0){
1241  // fHCos1nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1242  // fHSin1nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1243  fHCos2nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1244  fHSin2nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1245  fHCos3nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1246  fHSin3nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1247  // fHCos4nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1248  // fHSin4nPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1249  // fHCos2nDWPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1250  // fHSin2nDWPosChEtaVz[3]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1251  }
1252  else if(dChrg1<0){
1253  // fHCos1nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(dPhi1));
1254  // fHSin1nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(dPhi1));
1255  fHCos2nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(2.*dPhi1));
1256  fHSin2nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(2.*dPhi1));
1257  fHCos3nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(3.*dPhi1));
1258  fHSin3nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(3.*dPhi1));
1259  // fHCos4nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Cos(4.*dPhi1));
1260  // fHSin4nNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*TMath::Sin(4.*dPhi1));
1261  // fHCos2nDWNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Cos(2.*dPhi1));
1262  // fHSin2nDWNegChEtaVz[3]->Fill(EvtCent,runindex,ptw1*ptw1*TMath::Sin(2.*dPhi1));
1263  }
1264  }
1265  //} //if(fillFlag==kTRUE)
1266 
1267 
1268 
1269 
1270 
1271 
1272  iEtaQA = fEtaBinFinderForQA->FindBin(dEta1) - 1;
1273 
1274  if(dChrg1>0){
1275  QxPos[0] += (ptw1*w1NUA*TMath::Cos(n*dPhi1) - AvgCos1n);
1276  QyPos[0] += (ptw1*w1NUA*TMath::Sin(n*dPhi1) - AvgSin1n);
1277  QxAutoPos[0] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Cos(2.*n*dPhi1) - AvgDWCos2n);
1278  QyAutoPos[0] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Sin(2.*n*dPhi1) - AvgDWSin2n);
1279  MPOIpos += w1NUA*ptw1;
1280  McorrPos += w1NUA*ptw1*w1NUA*ptw1;
1281  //QA: eta dependence
1282  if(EvtCent>=10 && EvtCent<20){
1283  QxPosQAEta[iEtaQA] += (ptw1*w1NUA*TMath::Cos(n*dPhi1) - AvgCos1n);
1284  QyPosQAEta[iEtaQA] += (ptw1*w1NUA*TMath::Sin(n*dPhi1) - AvgSin1n);
1285  QxAutoPosQAEta[iEtaQA] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Cos(2.*n*dPhi1) - AvgDWCos2n);
1286  QyAutoPosQAEta[iEtaQA] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Sin(2.*n*dPhi1) - AvgDWSin2n);
1287  MPOIposQAEta[iEtaQA] += ptw1*w1NUA;
1288  }
1289  }
1290  else if(dChrg1<0){
1291  QxNeg[0] += (ptw1*w1NUA*TMath::Cos(n*dPhi1) - AvgCos1n);
1292  QyNeg[0] += (ptw1*w1NUA*TMath::Sin(n*dPhi1) - AvgSin1n);
1293  QxAutoNeg[0] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Cos(2.*n*dPhi1) - AvgDWCos2n);
1294  QyAutoNeg[0] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Sin(2.*n*dPhi1) - AvgDWSin2n);
1295  MPOIneg += w1NUA*ptw1;
1296  McorrNeg += w1NUA*ptw1*w1NUA*ptw1;
1297  //QA: eta dependence
1298  if(EvtCent>=10 && EvtCent<20){
1299  QxNegQAEta[iEtaQA] += (ptw1*w1NUA*TMath::Cos(n*dPhi1) - AvgCos1n);
1300  QyNegQAEta[iEtaQA] += (ptw1*w1NUA*TMath::Sin(n*dPhi1) - AvgSin1n);
1301  QxAutoNegQAEta[iEtaQA] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Cos(2.*n*dPhi1) - AvgDWCos2n);
1302  QyAutoNegQAEta[iEtaQA] += (ptw1*ptw1*w1NUA*w1NUA*TMath::Sin(2.*n*dPhi1) - AvgDWSin2n);
1303  MPOInegQAEta[iEtaQA] += ptw1*w1NUA;
1304  }
1305  }
1306 
1307  //QxTPC[0] += ptw1*w1NUA*TMath::Cos(n*dPhi1);
1308  //QyTPC[0] += ptw1*w1NUA*TMath::Sin(n*dPhi1);
1309  QxTPC[1] += ptw1*w1NUA*TMath::Cos(2*dPhi1);
1310  QyTPC[1] += ptw1*w1NUA*TMath::Sin(2*dPhi1);
1311 
1312  QxTPC[2] += ptw1*w1NUA*TMath::Cos(3*dPhi1);
1313  QyTPC[2] += ptw1*w1NUA*TMath::Sin(3*dPhi1);
1314 
1315  nRefMult++;
1316  nRefMultWgt += ptw1*w1NUA;
1317 
1318 
1319  //if(i%10==0)
1320  //cout<<" track "<<i<<" eta = "<<dEta1<<"\tdPhi1 = "<<dPhi1<<"\tptw1 = "<<ptw1<<"\tw1NUA = "<<w1NUA<<"\tAvgCos1n = "<<AvgCos1n<<endl;
1321 
1322  if(bSkipNestedTrk) continue;
1323 
1324  //2nd track loop:
1325  for(int j=0; j<iTracks; j++) {
1326 
1327  if(j==i) continue; //Auto-correlation removed.
1328 
1329  pTrack2 = fEvent->GetTrack(j);
1330  if(!pTrack2) continue;
1331  dPhi2 = pTrack2->Phi(); //0-2pi range
1332  dPt2 = pTrack2-> Pt();
1333  dEta2 = pTrack2->Eta();
1334  dChrg2 = pTrack2->Charge();
1335 
1336  if(!pTrack2->InPOISelection())
1337  continue;
1338 
1339  //remove randomly -Ve tracks:
1340  //if(bRemNegTrkRndm && dChrg1<0 && fRand.Rndm()<0.15){
1341  //continue;
1342  //}
1343 
1344 
1345  if(sMCdimension=="1D"){
1346  ptBin = fFB_Efficiency_Cent[cIndex]->FindBin(dPt2);
1347  ptw2 = 1.0/fFB_Efficiency_Cent[cIndex]->GetBinContent(ptBin);
1348  }
1349  else if(sMCdimension=="3D"){
1350  if(dChrg2>0){
1351  ptBin = fFB_Efficiency_Pos[cIndex]->FindBin(dEta2,dPt2,dPhi2); //left here
1352  ptw2 = fFB_Efficiency_Pos[cIndex]->GetBinContent(ptBin);
1353  }
1354  else if(dChrg2<0){
1355  ptBin = fFB_Efficiency_Neg[cIndex]->FindBin(dEta2,dPt2,dPhi2); //left here
1356  ptw2 = fFB_Efficiency_Neg[cIndex]->GetBinContent(ptBin);
1357  }
1358  }
1359 
1360  if (ptw2>1e3) ptw1 = 1.0;
1361 
1362 
1363  if(bApplyNUACorr) {
1364  //get NUA weights:
1365  if(sFileNUA=="New2018"){
1366  if(dChrg2>0){
1367  iBinNUA = fHCorrectNUApos[cForNUA]->FindBin(VtxZ,dPhi1,dEta1);
1368  w1NUA = fHCorrectNUApos[cForNUA]->GetBinContent(iBinNUA);
1369  }
1370  else if(dChrg2<0){
1371  iBinNUA = fHCorrectNUAneg[cForNUA]->FindBin(VtxZ,dPhi1,dEta1);
1372  w1NUA = fHCorrectNUAneg[cForNUA]->GetBinContent(iBinNUA);
1373  }
1374  }
1375  else if(sFileNUA=="OldJ"||sFileNUA=="NewR"){
1376  if(dChrg2>0){
1377  iBinNUA = fHCorrectNUApos[cInputNUA]->FindBin(VtxZ,dPhi2,dEta2);
1378  w2NUA = fHCorrectNUApos[cInputNUA]->GetBinContent(iBinNUA);
1379  }
1380  else if(dChrg2<0){
1381  iBinNUA = fHCorrectNUAneg[cInputNUA]->FindBin(VtxZ,dPhi2,dEta2);
1382  w2NUA = fHCorrectNUAneg[cInputNUA]->GetBinContent(iBinNUA);
1383  }
1384  if(sFileNUA=="OldJ") w2NUA = 1./w2NUA;
1385  }
1386  else if(sFileNUA=="NewPt"||sFileNUA=="NewpT"){
1387  if(dChrg2>0){
1388  iBinNUA = fHCorrectNUApos[iVzNUA]->FindBin(dPt2,dPhi2,dEta2);
1389  w2NUA = fHCorrectNUApos[iVzNUA]->GetBinContent(iBinNUA);
1390  }
1391  else if(dChrg2<0){
1392  iBinNUA = fHCorrectNUAneg[iVzNUA]->FindBin(dPt2,dPhi2,dEta2);
1393  w2NUA = fHCorrectNUAneg[iVzNUA]->GetBinContent(iBinNUA);
1394  }
1395  }
1396  if(w2NUA > 1e3 ) w2NUA = 1.0;
1397  }
1398  if(bApplyNUAforEP){
1399  WgtEP = ptw1*ptw2*w1NUA*w2NUA;
1400  }
1401  else{
1402  WgtEP = 1.0;
1403  }
1404 
1405 
1406  //------------- test ------ before femto cuts:
1407  if(dChrg1!=dChrg2){
1408  fHist_Corr3p_SP_Norm_PN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1409  fHist_Corr3p_SP_Norm_PN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1410  }
1411  else if(dChrg1>0 && dChrg2>0){
1412  fHist_Corr3p_SP_Norm_PP[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1413  fHist_Corr3p_SP_Norm_PP[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1414  }
1415  else if(dChrg1<0 && dChrg2<0){
1416  fHist_Corr3p_SP_Norm_NN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1417  fHist_Corr3p_SP_Norm_NN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1418  }
1419 
1420  if(dChrg1==dChrg2) {
1421  fdPhiFemtoCut->Fill(2.5,1e-8);
1422  }
1423  else{
1424  fdPhiFemtoCut->Fill(0.5,1e-8);
1425  }
1426 
1427 
1428  //---------- Femto Cuts ----------
1429  deltaEta = dEta1 - dEta2;
1430  deltaPhi = dPhi1 - dPhi2;
1431 
1432  if(TMath::Abs(deltaEta) < fHBTCutValue * 2.5 * 3) //fHBTCutValue = 0.02 [default for dphicorrelations]
1433  {
1434  Float_t phi1rad = dPhi1; // phi in rad
1435  Float_t phi2rad = dPhi2;
1436 
1437  // check first boundaries to see if is worth to loop and find the minimum
1438  Float_t dphistar1 = GetDPhiStar(phi1rad, dPt1, dChrg1, phi2rad, dPt2, dChrg2, 0.8, bSign);
1439  Float_t dphistar2 = GetDPhiStar(phi1rad, dPt1, dChrg1, phi2rad, dPt2, dChrg2, 2.5, bSign);
1440 
1441  const Float_t kLimit = fHBTCutValue * 3;
1442 
1443  Float_t dphistarminabs = 1e5;
1444  Float_t dphistarmin = 1e5;
1445 
1446  if(TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0 ) {
1447 
1448  for(Double_t rad=0.8; rad<2.51; rad+=0.01) {
1449  Float_t dphistar = GetDPhiStar(phi1rad, dPt1, dChrg1, phi2rad, dPt2, dChrg2, rad, bSign);
1450  Float_t dphistarabs = TMath::Abs(dphistar);
1451 
1452  if(dphistarabs < dphistarminabs) {
1453  dphistarmin = dphistar;
1454  dphistarminabs = dphistarabs;
1455  }
1456  }
1457  //Float_t dPtDiff = fabs(dPt1-dPt2);
1458  if(dChrg1==dChrg2){
1459  if(dphistarminabs < fHBTCutValue && TMath::Abs(deltaEta) < fHBTCutValue) {
1460  //cout<<"dEta "<<deltaEta<<" dphi "<<deltaPhi<<" Eta1 "<<dEta1<<" Eta2 "<<dEta2<<"\t"<<dChrg1<<" Ch2 "<<dChrg2<<" phi1 = "<<phi1rad<<" phi2 = "<<phi2rad<<" |dPt| = "<<dPtDiff<<endl;
1461  if(dChrg1==dChrg2) {
1462  fdPhiFemtoCut->Fill(3.5,1e-8);
1463  }
1464  else{
1465  fdPhiFemtoCut->Fill(1.5,1e-8);
1466  }
1467  continue;
1468  }
1469  }
1470  }
1471  }
1472 
1473  //---------------- Femto Cuts done --------------------
1474 
1475 
1476 
1477 
1478 
1479 
1480 
1481 
1482 
1483 
1484 
1485 
1486  if(dChrg1!=dChrg2){
1487  fHist_Corr3p_EP_Norm_PN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1488  fHist_Corr3p_EP_Norm_PN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1489 
1490  if(EvtCent>=10. && EvtCent<20){
1491  fCent3pvsVzRun->Fill(VtxZ,runindex,TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A));
1492  }
1493 
1494  //fHist_Corr3p_vsRun_EP_PN[0]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1495  //fHist_Corr3p_vsRun_EP_PN[1]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1496 
1497  fHist_Corr2p_EP_Norm_PN[QAindex]->Fill(EvtCent,0.5,TMath::Cos((dPhi1 - dPhi2)),WgtEP);
1498  fHist_Corr2p_EP_Norm_PN[QAindex]->Fill(EvtCent,1.5,TMath::Cos(2.*(dPhi1 - dPhi2)),WgtEP);
1499  fHist_Corr2p_EP_Norm_PN[QAindex]->Fill(EvtCent,2.5,TMath::Cos(3.*(dPhi1 - dPhi2)),WgtEP);
1500  fHist_Corr2p_EP_Norm_PN[QAindex]->Fill(EvtCent,3.5,TMath::Cos(4.*(dPhi1 - dPhi2)),WgtEP);
1501 
1502  if(cIndex<6){
1503  fHist_Corr3p_pTSum_EP_V0A_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1504  fHist_Corr3p_pTSum_EP_V0C_PN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1505  fHist_Corr3p_pTDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1506  fHist_Corr3p_pTDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1507  fHist_Corr3p_EtaDiff_EP_V0A_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1508  fHist_Corr3p_EtaDiff_EP_V0C_PN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1509  }
1510  }
1511  else if(dChrg1>0 && dChrg2>0){
1512  fHist_Corr3p_EP_Norm_PP[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1513  fHist_Corr3p_EP_Norm_PP[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1514 
1515  //fHist_Corr3p_vsRun_EP_PP[0]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1516  //fHist_Corr3p_vsRun_EP_PP[1]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1517 
1518  fHist_Corr2p_EP_Norm_PP[QAindex]->Fill(EvtCent,0.5,TMath::Cos((dPhi1 - dPhi2)),WgtEP);
1519  fHist_Corr2p_EP_Norm_PP[QAindex]->Fill(EvtCent,1.5,TMath::Cos(2.*(dPhi1 - dPhi2)),WgtEP);
1520  fHist_Corr2p_EP_Norm_PP[QAindex]->Fill(EvtCent,2.5,TMath::Cos(3.*(dPhi1 - dPhi2)),WgtEP);
1521  fHist_Corr2p_EP_Norm_PP[QAindex]->Fill(EvtCent,3.5,TMath::Cos(4.*(dPhi1 - dPhi2)),WgtEP);
1522 
1523  if(cIndex<6){
1524  fHist_Corr3p_pTSum_EP_V0A_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1525  fHist_Corr3p_pTSum_EP_V0C_PP[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1526  fHist_Corr3p_pTDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1527  fHist_Corr3p_pTDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1528  fHist_Corr3p_EtaDiff_EP_V0A_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1529  fHist_Corr3p_EtaDiff_EP_V0C_PP[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1530  }
1531  }
1532  else if(dChrg1<0 && dChrg2<0){
1533  fHist_Corr3p_EP_Norm_NN[QAindex][0]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1534  fHist_Corr3p_EP_Norm_NN[QAindex][1]->Fill(EvtCent, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1535 
1536  //fHist_Corr3p_vsRun_EP_NN[0]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1537  //fHist_Corr3p_vsRun_EP_NN[1]->Fill(EvtCent, runindex, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1538 
1539  fHist_Corr2p_EP_Norm_NN[QAindex]->Fill(EvtCent,0.5,TMath::Cos((dPhi1 - dPhi2)),WgtEP);
1540  fHist_Corr2p_EP_Norm_NN[QAindex]->Fill(EvtCent,1.5,TMath::Cos(2.*(dPhi1 - dPhi2)),WgtEP);
1541  fHist_Corr2p_EP_Norm_NN[QAindex]->Fill(EvtCent,2.5,TMath::Cos(3.*(dPhi1 - dPhi2)),WgtEP);
1542  fHist_Corr2p_EP_Norm_NN[QAindex]->Fill(EvtCent,3.5,TMath::Cos(4.*(dPhi1 - dPhi2)),WgtEP);
1543 
1544  if(cIndex<6){
1545  fHist_Corr3p_pTSum_EP_V0A_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1546  fHist_Corr3p_pTSum_EP_V0C_NN[QAindex][cIndex]->Fill((dPt1+dPt2)*0.5, TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1547  fHist_Corr3p_pTDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1548  fHist_Corr3p_pTDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dPt1-dPt2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1549  fHist_Corr3p_EtaDiff_EP_V0A_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0A),WgtEP);
1550  fHist_Corr3p_EtaDiff_EP_V0C_NN[QAindex][cIndex]->Fill(TMath::Abs(dEta1-dEta2), TMath::Cos(n*dPhi1 + m*dPhi2 - p*Psi2V0C),WgtEP);
1551  }
1552  }
1553  }//nested loop ends
1554  }//------ track loop ends ------
1555 
1556  fEventStatvsRun->Fill(runindex);
1557 
1558  fCentDistvsRun->Fill(EvtCent,runindex);
1559 
1560 
1561  if(EvtCent<=20){
1562  fCentV0MvsVzRun->Fill(VtxZ,runindex,EvtCent);
1563  fCentCL1vsVzRun->Fill(VtxZ,runindex,(centrCL1-EvtCent));
1564  }
1565 
1566 
1567  Double_t QTPCRe = QxTPC[1];
1568  Double_t QTPCIm = QyTPC[1];
1569 
1570  Double_t Psi2TPC = 1./2*(TMath::ATan2(QTPCIm,QTPCRe));
1571  if(Psi2TPC < 0.) Psi2TPC += TMath::Pi();
1572 
1573  fTPCQ2xVsCentRun->Fill(EvtCent,runindex,TMath::Cos(Psi2TPC));
1574  fTPCQ2yVsCentRun->Fill(EvtCent,runindex,TMath::Sin(Psi2TPC));//centrCL1
1575 
1576  Double_t QTPCRe3 = QxTPC[2];
1577  Double_t QTPCIm3 = QyTPC[2];
1578 
1579  Double_t Psi3TPC = 1./3*(TMath::ATan2(QTPCIm3,QTPCRe3));
1580  if(Psi3TPC < 0.) Psi3TPC += 2./3*TMath::Pi();
1581 
1582  fTPCQ3xVsCentRun->Fill(EvtCent,runindex,TMath::Cos(Psi3TPC));
1583  fTPCQ3yVsCentRun->Fill(EvtCent,runindex,TMath::Sin(Psi3TPC));//centrCL1
1584 
1585 
1586 
1587 
1588 
1589  PostData(3,fListNUAHist); // Store NUA for all Runs including bad one.
1590 
1591 
1592  if(QTPCRe==0 && QTPCIm==0) return; // is this is one to one with bad run list?
1593  fHist_Event_count->Fill(stepCount); //6
1594  stepCount++;
1595 
1596 
1597  if(isBadRun) return;
1598  fHist_Event_count->Fill(stepCount); //7
1599  stepCount++;
1600 
1601 
1602 
1603  Float_t fNegTracks = iTracks*0.5;
1604  Float_t ratioReject = (Float_t) icReject/fNegTracks;
1605 
1606  fRejectRatioVsCR->Fill(EvtCent,runindex,ratioReject);
1607 
1608 
1609 
1610 
1611 
1612 
1613 
1614 //V0A-V0C EP resolution:
1615  fHist_Reso2n_EP_Norm_Det[QAindex][0]->Fill(EvtCent, TMath::Cos(psiN*(Psi2V0A-Psi2V0C)));
1616 //V0A-TPC EP resolution:
1617  fHist_Reso2n_EP_Norm_Det[QAindex][1]->Fill(EvtCent, TMath::Cos(psiN*(Psi2V0A-Psi2TPC)));
1618 //V0C-TPC EP resolution:
1619  fHist_Reso2n_EP_Norm_Det[QAindex][2]->Fill(EvtCent, TMath::Cos(psiN*(Psi2V0C-Psi2TPC)));
1620 
1621  fHV0AEventPlaneVsCent->Fill(EvtCent,Psi2V0A);
1622  fHV0CEventPlaneVsCent->Fill(EvtCent,Psi2V0C);
1623  fHTPCEventPlaneVsCent->Fill(EvtCent,Psi2TPC);
1624 
1625 
1626 
1627 
1628 
1629 
1630  //------- SP Method -------------
1631 
1632 
1633  Double_t uPRe=0.,uNRe=0.,uPIm=0.,uNIm=0.,uN2Re=0.,uN2Im=0.,uP2Re=0.,uP2Im=0.;
1634  Double_t uPM=0.,uNM=0.;
1635  //Double_t VCIm=0., VPRe=0.,VPIm=0.;
1636 
1637 
1638  uPM = MPOIpos; uNM = MPOIneg;
1639 
1640  uPRe = QxPos[0]; uNRe = QxNeg[0];
1641  uPIm = QyPos[0]; uNIm = QyNeg[0];
1642 
1643  uP2Re = QxAutoPos[0]; uP2Im = QyAutoPos[0];
1644  uN2Re = QxAutoNeg[0]; uN2Im = QyAutoNeg[0];
1645 
1646  Double_t TwoQpQnV = 0.,TwoQpQpV=0.,TwoQnQnV=0.;
1647 
1648  if(uPM > 1 && uNM > 1) {
1649  //CME w.r.t V0A EP:
1650  TwoQpQnV = ((uPRe*uNRe-uPIm*uNIm)*QxanCor + (uPRe*uNIm+uPIm*uNRe)*QyanCor) / (uPM*uNM) ;
1651  TwoQpQpV = ((uPRe*uPRe-uPIm*uPIm-uP2Re)*QxanCor + (2.*uPRe*uPIm-uP2Im)*QyanCor) / (uPM*(uPM-1)) ;
1652  TwoQnQnV = ((uNRe*uNRe-uNIm*uNIm-uN2Re)*QxanCor + (2.*uNRe*uNIm-uN2Im)*QyanCor) / (uNM*(uNM-1)) ;
1653  //Fill profiles:
1654  /*
1655  fHist_Corr3p_SP_Norm_PN[QAindex][0]->Fill(EvtCent, TwoQpQnV, uPM*uNM);
1656  fHist_Corr3p_SP_Norm_PP[QAindex][0]->Fill(EvtCent, TwoQpQpV, (uPM*(uPM-1)));
1657  fHist_Corr3p_SP_Norm_NN[QAindex][0]->Fill(EvtCent, TwoQnQnV, (uNM*(uNM-1)));
1658  */
1659  //-------- Fill NonIsotropic terms ------
1660 
1661  Double_t QnNonIsoRe = 0.,QnNonIsoIm=0.;
1662 
1663  if(QAindex==0){ //B < 0
1664  //charge pos:
1665  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 0.5,uPRe/uPM,uPM); //<Cos(nPhi)> ChPos
1666  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 1.5,uPIm/uPM,uPM); //<Sin(nPhi)> ChPos
1667 
1668  QnNonIsoRe = (uPRe*QxanCor + uPIm*QyanCor)/uPM;
1669  QnNonIsoIm = (uPIm*QxanCor - uPRe*QyanCor)/uPM;
1670  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 2.5,QnNonIsoRe,uPM); //<Cos(nPhi-mPsi)> ChPos
1671  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 3.5,QnNonIsoIm,uPM); //<Sin(nPhi-mPsi)> ChPos
1672 
1673  QnNonIsoRe = (uPRe*uPRe-uPIm*uPIm-uP2Re)/(uPM*(uPM-1));
1674  QnNonIsoIm = (2.*uPRe*uPIm-uP2Im)/(uPM*(uPM-1));
1675  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 4.5,QnNonIsoRe,(uPM*(uPM-1))); //<Cos(nPhi1+nPhi2)> ChPos
1676  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 5.5,QnNonIsoIm,(uPM*(uPM-1))); //<Sin(nPhi1+nPhi2)> ChPos
1677 
1678  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1679  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1680  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1681  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1682 
1683  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 8.5,QxanCor,uPM); //<Cos(mPsiEP)>
1684  fHist_NonIso_SP_PP_Mag0[0]->Fill(EvtCent, 9.5,QyanCor,uPM); //<Sin(mPsiEP)>
1685 
1686  //charge neg:
1687  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 0.5,uNRe/uNM,uNM); //<Cos(nPhi)> ChNeg
1688  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 1.5,uNIm/uNM,uNM); //<Sin(nPhi)> ChNeg
1689 
1690  QnNonIsoRe = (uNRe*QxanCor + uNIm*QyanCor)/uNM;
1691  QnNonIsoIm = (uNIm*QxanCor - uNRe*QyanCor)/uNM;
1692  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 2.5,QnNonIsoRe,uNM); //<Cos(nPhi-mPsi)> ChNeg
1693  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 3.5,QnNonIsoIm,uNM); //<Cos(nPhi-mPsi)> ChNeg
1694 
1695  QnNonIsoRe = (uNRe*uNRe-uNIm*uNIm-uN2Re)/(uNM*(uNM-1));
1696  QnNonIsoIm = (2.*uNRe*uNIm-uN2Im)/(uNM*(uNM-1));
1697  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 4.5,QnNonIsoRe,(uNM*(uNM-1))); //<Cos(nPhi1+nPhi2)> ChNeg
1698  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 5.5,QnNonIsoIm,(uNM*(uNM-1))); //<Sin(nPhi1+nPhi2)> ChNeg
1699 
1700  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1701  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1702  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1703  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1704 
1705  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 8.5,QxanCor,uNM); //<Cos(mPsiEP)>
1706  fHist_NonIso_SP_NN_Mag0[0]->Fill(EvtCent, 9.5,QyanCor,uNM); //<Sin(mPsiEP)>
1707  }
1708  else if(QAindex==1){ //B > 0
1709  //charge pos:
1710  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 0.5,uPRe/uPM,uPM); //<Cos(nPhi)> ChPos
1711  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 1.5,uPIm/uPM,uPM); //<Sin(nPhi)> ChPos
1712 
1713  QnNonIsoRe = (uPRe*QxanCor + uPIm*QyanCor)/uPM;
1714  QnNonIsoIm = (uPIm*QxanCor - uPRe*QyanCor)/uPM;
1715  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 2.5,QnNonIsoRe,uPM); //<Cos(nPhi-mPsi)> ChPos
1716  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 3.5,QnNonIsoIm,uPM); //<Sin(nPhi-mPsi)> ChPos
1717 
1718  QnNonIsoRe = (uPRe*uPRe-uPIm*uPIm-uP2Re)/(uPM*(uPM-1));
1719  QnNonIsoIm = (2.*uPRe*uPIm-uP2Im)/(uPM*(uPM-1));
1720  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 4.5,QnNonIsoRe,(uPM*(uPM-1))); //<Cos(nPhi1+nPhi2)> ChPos
1721  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 5.5,QnNonIsoIm,(uPM*(uPM-1))); //<Sin(nPhi1+nPhi2)> ChPos
1722 
1723  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1724  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1725  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1726  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1727 
1728  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 8.5,QxanCor,uPM); //<Cos(mPsiEP)>
1729  fHist_NonIso_SP_PP_Mag1[0]->Fill(EvtCent, 9.5,QyanCor,uPM); //<Sin(mPsiEP)>
1730 
1731  //charge neg:
1732  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 0.5,uNRe/uNM,uNM); //<Cos(nPhi)> ChNeg
1733  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 1.5,uNIm/uNM,uNM); //<Sin(nPhi)> ChNeg
1734 
1735  QnNonIsoRe = (uNRe*QxanCor + uNIm*QyanCor)/uNM;
1736  QnNonIsoIm = (uNIm*QxanCor - uNRe*QyanCor)/uNM;
1737  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 2.5,QnNonIsoRe,uNM); //<Cos(nPhi-mPsi)> ChNeg
1738  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 3.5,QnNonIsoIm,uNM); //<Cos(nPhi-mPsi)> ChNeg
1739 
1740  QnNonIsoRe = (uNRe*uNRe-uNIm*uNIm-uN2Re)/(uNM*(uNM-1));
1741  QnNonIsoIm = (2.*uNRe*uNIm-uN2Im)/(uNM*(uNM-1));
1742  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 4.5,QnNonIsoRe,(uNM*(uNM-1))); //<Cos(nPhi1+nPhi2)> ChNeg
1743  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 5.5,QnNonIsoIm,(uNM*(uNM-1))); //<Sin(nPhi1+nPhi2)> ChNeg
1744 
1745  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1746  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1747  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1748  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1749 
1750  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 8.5,QxanCor,uNM); //<Cos(mPsiEP)>
1751  fHist_NonIso_SP_NN_Mag1[0]->Fill(EvtCent, 9.5,QyanCor,uNM); //<Sin(mPsiEP)>
1752  }
1753 
1754 
1755  //-------- CME - ZDN correlators:---------
1756  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 0., TwoQpQnV, uPM*uNM);
1757  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 1., energyZPA, 1.);
1758  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 2., energyZPC, 1.);
1759  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1760  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 4., energyZNA, 1.);
1761  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 5., energyZNC, 1.);
1762  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1763  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 7., TwoQpQnV*energyZPA, uPM*uNM);
1764  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 8., TwoQpQnV*energyZPC, uPM*uNM);
1765  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 9., TwoQpQnV*(energyZPC+energyZPA), uPM*uNM);
1766  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 10., TwoQpQnV*energyZNA, uPM*uNM);
1767  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 11., TwoQpQnV*energyZNC, uPM*uNM);
1768  fHist_Corr3p_ZDN_SP_PN[0]->Fill(EvtCent, 12., TwoQpQnV*(energyZNC+energyZNA), uPM*uNM);
1769 
1770  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 0., TwoQpQpV, (uPM*(uPM-1)));
1771  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 1., energyZPA, 1.);
1772  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 2., energyZPC, 1.);
1773  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1774  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 4., energyZNA, 1.);
1775  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 5., energyZNC, 1.);
1776  //fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1777  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 7., TwoQpQpV*energyZPA, (uPM*(uPM-1)));
1778  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 8., TwoQpQpV*energyZPC, (uPM*(uPM-1)));
1779  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 9., TwoQpQpV*(energyZPC+energyZPA), (uPM*(uPM-1)));
1780  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 10., TwoQpQpV*energyZNA, (uPM*(uPM-1)));
1781  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 11., TwoQpQpV*energyZNC, (uPM*(uPM-1)));
1782  fHist_Corr3p_ZDN_SP_PP[0]->Fill(EvtCent, 12., TwoQpQpV*(energyZNC+energyZNA), (uPM*(uPM-1)));
1783 
1784  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 0., TwoQnQnV, (uNM*(uNM-1)));
1785  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 1., energyZPA, 1.);
1786  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 2., energyZPC, 1.);
1787  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1788  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 4., energyZNA, 1.);
1789  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 5., energyZNC, 1.);
1790  //fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1791  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 7., TwoQnQnV*energyZPA, (uNM*(uNM-1)));
1792  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 8., TwoQnQnV*energyZPC, (uNM*(uNM-1)));
1793  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 9., TwoQnQnV*(energyZPC+energyZPA), (uNM*(uNM-1)));
1794  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 10., TwoQnQnV*energyZNA, (uNM*(uNM-1)));
1795  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 11., TwoQnQnV*energyZNC, (uNM*(uNM-1)));
1796  fHist_Corr3p_ZDN_SP_NN[0]->Fill(EvtCent, 12., TwoQnQnV*(energyZNC+energyZNA), (uNM*(uNM-1)));
1797  //-----------------------------------------
1798 
1799 
1800 
1801 
1802  //CME w.r.t V0C EP:
1803  TwoQpQnV = 0.; TwoQpQpV = 0.; TwoQnQnV = 0.;
1804  TwoQpQnV = ((uPRe*uNRe-uPIm*uNIm)*QxcnCor + (uPRe*uNIm+uPIm*uNRe)*QycnCor) / (uPM*uNM) ;
1805  TwoQpQpV = ((uPRe*uPRe-uPIm*uPIm-uP2Re)*QxcnCor + (2.*uPRe*uPIm-uP2Im)*QycnCor) / (uPM*(uPM-1)) ;
1806  TwoQnQnV = ((uNRe*uNRe-uNIm*uNIm-uN2Re)*QxcnCor + (2.*uNRe*uNIm-uN2Im)*QycnCor) / (uNM*(uNM-1)) ;
1807 
1808  //Fill profiles:
1809  /*
1810  fHist_Corr3p_SP_Norm_PN[QAindex][1]->Fill(EvtCent, TwoQpQnV, uPM*uNM);
1811  fHist_Corr3p_SP_Norm_PP[QAindex][1]->Fill(EvtCent, TwoQpQpV, (uPM*(uPM-1)));
1812  fHist_Corr3p_SP_Norm_NN[QAindex][1]->Fill(EvtCent, TwoQnQnV, (uNM*(uNM-1)));
1813  */
1814 
1815  if(QAindex==0){ //B < 0
1816  //charge pos:
1817  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 0.5,uPRe/uPM,uPM); //<Cos(nPhi)> ChPos
1818  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 1.5,uPIm/uPM,uPM); //<Sin(nPhi)> ChPos
1819 
1820  QnNonIsoRe = (uPRe*QxcnCor + uPIm*QycnCor)/uPM;
1821  QnNonIsoIm = (uPIm*QxcnCor - uPRe*QycnCor)/uPM;
1822  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 2.5,QnNonIsoRe,uPM); //<Cos(nPhi-mPsi)> ChPos
1823  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 3.5,QnNonIsoIm,uPM); //<Sin(nPhi-mPsi)> ChPos
1824 
1825  QnNonIsoRe = (uPRe*uPRe-uPIm*uPIm-uP2Re)/(uPM*(uPM-1));
1826  QnNonIsoIm = (2.*uPRe*uPIm-uP2Im)/(uPM*(uPM-1));
1827  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 4.5,QnNonIsoRe,(uPM*(uPM-1))); //<Cos(nPhi1+nPhi2)> ChPos
1828  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 5.5,QnNonIsoIm,(uPM*(uPM-1))); //<Sin(nPhi1+nPhi2)> ChPos
1829 
1830  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1831  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1832  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1833  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1834 
1835  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 8.5,QxcnCor,uPM); //<Cos(mPsiEP)>
1836  fHist_NonIso_SP_PP_Mag0[1]->Fill(EvtCent, 9.5,QycnCor,uPM); //<Sin(mPsiEP)>
1837 
1838  //charge neg:
1839  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 0.5,uNRe/uNM,uNM); //<Cos(nPhi)> ChNeg
1840  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 1.5,uNIm/uNM,uNM); //<Sin(nPhi)> ChNeg
1841 
1842  QnNonIsoRe = (uNRe*QxcnCor + uNIm*QycnCor)/uNM;
1843  QnNonIsoIm = (uNIm*QxcnCor - uNRe*QycnCor)/uNM;
1844  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 2.5,QnNonIsoRe,uNM); //<Cos(nPhi-mPsi)> ChNeg
1845  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 3.5,QnNonIsoIm,uNM); //<Cos(nPhi-mPsi)> ChNeg
1846 
1847  QnNonIsoRe = (uNRe*uNRe-uNIm*uNIm-uN2Re)/(uNM*(uNM-1));
1848  QnNonIsoIm = (2.*uNRe*uNIm-uN2Im)/(uNM*(uNM-1));
1849  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 4.5,QnNonIsoRe,(uNM*(uNM-1))); //<Cos(nPhi1+nPhi2)> ChNeg
1850  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 5.5,QnNonIsoIm,(uNM*(uNM-1))); //<Sin(nPhi1+nPhi2)> ChNeg
1851 
1852  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1853  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1854  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1855  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1856 
1857  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 8.5,QxcnCor,uNM); //<Cos(mPsiEP)>
1858  fHist_NonIso_SP_NN_Mag0[1]->Fill(EvtCent, 9.5,QycnCor,uNM); //<Sin(mPsiEP)>
1859  }
1860  else if(QAindex==1) { //B > 0
1861  //charge pos:
1862  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 0.5,uPRe/uPM,uPM); //<Cos(nPhi)> ChPos
1863  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 1.5,uPIm/uPM,uPM); //<Sin(nPhi)> ChPos
1864 
1865  QnNonIsoRe = (uPRe*QxcnCor + uPIm*QycnCor)/uPM;
1866  QnNonIsoIm = (uPIm*QxcnCor - uPRe*QycnCor)/uPM;
1867  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 2.5,QnNonIsoRe,uPM); //<Cos(nPhi-mPsi)> ChPos
1868  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 3.5,QnNonIsoIm,uPM); //<Sin(nPhi-mPsi)> ChPos
1869 
1870  QnNonIsoRe = (uPRe*uPRe-uPIm*uPIm-uP2Re)/(uPM*(uPM-1));
1871  QnNonIsoIm = (2.*uPRe*uPIm-uP2Im)/(uPM*(uPM-1));
1872  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 4.5,QnNonIsoRe,(uPM*(uPM-1))); //<Cos(nPhi1+nPhi2)> ChPos
1873  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 5.5,QnNonIsoIm,(uPM*(uPM-1))); //<Sin(nPhi1+nPhi2)> ChPos
1874 
1875  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1876  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1877  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1878  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1879 
1880  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 8.5,QxcnCor,uPM); //<Cos(mPsiEP)>
1881  fHist_NonIso_SP_PP_Mag1[1]->Fill(EvtCent, 9.5,QycnCor,uPM); //<Sin(mPsiEP)>
1882 
1883  //charge neg:
1884  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 0.5,uNRe/uNM,uNM); //<Cos(nPhi)> ChNeg
1885  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 1.5,uNIm/uNM,uNM); //<Sin(nPhi)> ChNeg
1886 
1887  QnNonIsoRe = (uNRe*QxcnCor + uNIm*QycnCor)/uNM;
1888  QnNonIsoIm = (uNIm*QxcnCor - uNRe*QycnCor)/uNM;
1889  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 2.5,QnNonIsoRe,uNM); //<Cos(nPhi-mPsi)> ChNeg
1890  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 3.5,QnNonIsoIm,uNM); //<Cos(nPhi-mPsi)> ChNeg
1891 
1892  QnNonIsoRe = (uNRe*uNRe-uNIm*uNIm-uN2Re)/(uNM*(uNM-1));
1893  QnNonIsoIm = (2.*uNRe*uNIm-uN2Im)/(uNM*(uNM-1));
1894  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 4.5,QnNonIsoRe,(uNM*(uNM-1))); //<Cos(nPhi1+nPhi2)> ChNeg
1895  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 5.5,QnNonIsoIm,(uNM*(uNM-1))); //<Sin(nPhi1+nPhi2)> ChNeg
1896 
1897  QnNonIsoRe = (uPRe*uNRe-uPIm*uNIm)/(uPM*uNM);
1898  QnNonIsoIm = (uPRe*uNIm+uPIm*uNRe)/(uPM*uNM);
1899  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 6.5,QnNonIsoRe,(uPM*uNM)); //<Cos(nPhi1+nPhi2)> phi1,phi2 opposite charge
1900  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 7.5,QnNonIsoIm,(uPM*uNM)); //<Sin(nPhi1+nPhi2)> phi1,phi2 opposite charge
1901 
1902  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 8.5,QxcnCor,uNM); //<Cos(mPsiEP)>
1903  fHist_NonIso_SP_NN_Mag1[1]->Fill(EvtCent, 9.5,QycnCor,uNM); //<Sin(mPsiEP)>
1904  }
1905 
1906 
1907  //-------- CME - ZDN correlators:---------
1908  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 0., TwoQpQnV, uPM*uNM);
1909  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 1., energyZPA, 1.);
1910  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 2., energyZPC, 1.);
1911  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1912  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 4., energyZNA, 1.);
1913  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 5., energyZNC, 1.);
1914  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1915  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 7., TwoQpQnV*energyZPA, uPM*uNM);
1916  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 8., TwoQpQnV*energyZPC, uPM*uNM);
1917  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 9., TwoQpQnV*(energyZPC+energyZPA), uPM*uNM);
1918  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 10., TwoQpQnV*energyZNA, uPM*uNM);
1919  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 11., TwoQpQnV*energyZNC, uPM*uNM);
1920  fHist_Corr3p_ZDN_SP_PN[1]->Fill(EvtCent, 12., TwoQpQnV*(energyZNC+energyZNA), uPM*uNM);
1921 
1922  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 0., TwoQpQpV, (uPM*(uPM-1)));
1923  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 1., energyZPA, 1.);
1924  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 2., energyZPC, 1.);
1925  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1926  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 4., energyZNA, 1.);
1927  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 5., energyZNC, 1.);
1928  //fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1929  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 7., TwoQpQpV*energyZPA, (uPM*(uPM-1)));
1930  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 8., TwoQpQpV*energyZPC, (uPM*(uPM-1)));
1931  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 9., TwoQpQpV*(energyZPC+energyZPA), (uPM*(uPM-1)));
1932  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 10., TwoQpQpV*energyZNA, (uPM*(uPM-1)));
1933  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 11., TwoQpQpV*energyZNC, (uPM*(uPM-1)));
1934  fHist_Corr3p_ZDN_SP_PP[1]->Fill(EvtCent, 12., TwoQpQpV*(energyZNC+energyZNA), (uPM*(uPM-1)));
1935 
1936  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 0., TwoQnQnV, (uNM*(uNM-1)));
1937  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 1., energyZPA, 1.);
1938  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 2., energyZPC, 1.);
1939  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 3., (energyZPA+energyZPC), 1.);
1940  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 4., energyZNA, 1.);
1941  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 5., energyZNC, 1.);
1942  //fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 6., (energyZNA+energyZNC), 1.);
1943  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 7., TwoQnQnV*energyZPA, (uNM*(uNM-1)));
1944  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 8., TwoQnQnV*energyZPC, (uNM*(uNM-1)));
1945  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 9., TwoQnQnV*(energyZPC+energyZPA), (uNM*(uNM-1)));
1946  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 10., TwoQnQnV*energyZNA, (uNM*(uNM-1)));
1947  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 11., TwoQnQnV*energyZNC, (uNM*(uNM-1)));
1948  fHist_Corr3p_ZDN_SP_NN[1]->Fill(EvtCent, 12., TwoQnQnV*(energyZNC+energyZNA), (uNM*(uNM-1)));
1949  //-----------------------------------------
1950 
1951 
1952  //Fill Mult, POIs vs cent:
1953 
1954  fAvgMultCentRun->Fill(EvtCent,runindex,nRefMult);
1955  fAvgWgtMultCentRun->Fill(EvtCent,runindex,nRefMultWgt);
1956  fAvgPOIposCentRun->Fill(EvtCent,runindex,uPM);
1957  fAvgPOInegCentRun->Fill(EvtCent,runindex,uNM);
1958  fAvgPOIPPCentRun->Fill(EvtCent,runindex,(uPM*(uPM-1)));
1959  fAvgPOINNCentRun->Fill(EvtCent,runindex,(uNM*(uNM-1)));
1960  fAvgPOIOSCentRun->Fill(EvtCent,runindex,uPM*uNM);
1961 
1962 
1963  //------------ eta depedence -----------------
1964  Double_t fEtaCent = -100.;
1965  Int_t nBinsX = fEtaBinFinderForQA->GetNbinsX();
1966 
1967  for(int ie=0; ie<nBinsX; ie++){
1968 
1969  uPM = MPOIposQAEta[ie];
1970  uNM = MPOInegQAEta[ie];
1971 
1972  if(uPM>1 && uNM>1){
1973 
1974  uPRe = QxPosQAEta[ie];
1975  uNRe = QxNegQAEta[ie];
1976  uPIm = QyPosQAEta[ie];
1977  uNIm = QyNegQAEta[ie];
1978 
1979  uP2Re = QxAutoPosQAEta[ie];
1980  uP2Im = QyAutoPosQAEta[ie];
1981  uN2Re = QxAutoNegQAEta[ie];
1982  uN2Im = QyAutoNegQAEta[ie];
1983 
1984 
1985  fEtaCent = fEtaBinFinderForQA->GetBinCenter(ie+1);
1986 
1987  //w.r.t V0A:
1988  TwoQpQnV = 0.; TwoQpQpV = 0.; TwoQnQnV = 0.;
1989  TwoQpQnV = ((uPRe*uNRe-uPIm*uNIm)*QxanCor + (uPRe*uNIm+uPIm*uNRe)*QyanCor) / (uPM*uNM) ;
1990  TwoQpQpV = ((uPRe*uPRe-uPIm*uPIm-uP2Re)*QxanCor + (2.*uPRe*uPIm-uP2Im)*QyanCor) / (uPM*(uPM-1.)) ;
1991  TwoQnQnV = ((uNRe*uNRe-uNIm*uNIm-uN2Re)*QxanCor + (2.*uNRe*uNIm-uN2Im)*QyanCor) / (uNM*(uNM-1.)) ;
1992 
1993  fHist_Corr3p_QAEta_SP_V0A_PN[QAindex]->Fill(fEtaCent,TwoQpQnV,uPM*uNM);
1994  fHist_Corr3p_QAEta_SP_V0A_PP[QAindex]->Fill(fEtaCent,TwoQpQpV,uPM*(uPM-1.));
1995  fHist_Corr3p_QAEta_SP_V0A_NN[QAindex]->Fill(fEtaCent,TwoQnQnV,uNM*(uNM-1.));
1996 
1997  //w.r.t V0C:
1998  TwoQpQnV = 0.; TwoQpQpV = 0.; TwoQnQnV = 0.;
1999  TwoQpQnV = ((uPRe*uNRe-uPIm*uNIm)*QxcnCor + (uPRe*uNIm+uPIm*uNRe)*QycnCor) / (uPM*uNM) ;
2000  TwoQpQpV = ((uPRe*uPRe-uPIm*uPIm-uP2Re)*QxcnCor + (2.*uPRe*uPIm-uP2Im)*QycnCor) / (uPM*(uPM-1.)) ;
2001  TwoQnQnV = ((uNRe*uNRe-uNIm*uNIm-uN2Re)*QxcnCor + (2.*uNRe*uNIm-uN2Im)*QycnCor) / (uNM*(uNM-1.)) ;
2002 
2003  fHist_Corr3p_QAEta_SP_V0C_PN[QAindex]->Fill(fEtaCent,TwoQpQnV,uPM*uNM);
2004  fHist_Corr3p_QAEta_SP_V0C_PP[QAindex]->Fill(fEtaCent,TwoQpQpV,uPM*(uPM-1.));
2005  fHist_Corr3p_QAEta_SP_V0C_NN[QAindex]->Fill(fEtaCent,TwoQnQnV,uNM*(uNM-1.));
2006  }
2007  }
2008  //---------------------------------------
2009 
2010 
2011 
2012 
2013  if(MPOIpos>1 && MPOIneg>1){
2014  //V0A-V0C SP resolution:
2015  fHist_Reso2n_SP_Norm_Det[QAindex][0]->Fill(EvtCent, (QxcnCor*QxanCor+QycnCor*QyanCor));
2016  //V0A-TPC SP resolution:
2017  fHist_Reso2n_SP_Norm_Det[QAindex][1]->Fill(EvtCent, (QTPCRe*QxanCor+QTPCIm*QyanCor));
2018  //V0C-TPC SP resolution:
2019  fHist_Reso2n_SP_Norm_Det[QAindex][2]->Fill(EvtCent, (QTPCRe*QxcnCor+QTPCIm*QycnCor));
2020 
2021 
2022  //V0A-V0C:
2023  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 0., (QxcnCor*QxanCor+QycnCor*QyanCor));
2024  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 1., (QxcnCor*QxanCor+QycnCor*QyanCor)*energyZPA);
2025  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 2., (QxcnCor*QxanCor+QycnCor*QyanCor)*energyZPC);
2026  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 3., (QxcnCor*QxanCor+QycnCor*QyanCor)*(energyZPA+energyZPC));
2027  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 4., (QxcnCor*QxanCor+QycnCor*QyanCor)*energyZNA);
2028  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 5., (QxcnCor*QxanCor+QycnCor*QyanCor)*energyZNC);
2029  fHist_Reso2n_ZDN_SP_Det[0]->Fill(EvtCent, 6., (QxcnCor*QxanCor+QycnCor*QyanCor)*(energyZNA+energyZNC));
2030 
2031  //V0A-TPC
2032  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 0., (QTPCRe*QxanCor+QTPCIm*QyanCor));
2033  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 1., (QTPCRe*QxanCor+QTPCIm*QyanCor)*energyZPA);
2034  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 2., (QTPCRe*QxanCor+QTPCIm*QyanCor)*energyZPC);
2035  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 3., (QTPCRe*QxanCor+QTPCIm*QyanCor)*(energyZPA+energyZPC));
2036  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 4., (QTPCRe*QxanCor+QTPCIm*QyanCor)*energyZNA);
2037  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 5., (QTPCRe*QxanCor+QTPCIm*QyanCor)*energyZNC);
2038  fHist_Reso2n_ZDN_SP_Det[1]->Fill(EvtCent, 6., (QTPCRe*QxanCor+QTPCIm*QyanCor)*(energyZNA+energyZNC));
2039 
2040  //V0C-TPC
2041  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 0., (QTPCRe*QxcnCor+QTPCIm*QycnCor));
2042  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 1., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*energyZPA);
2043  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 2., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*energyZPC);
2044  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 3., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*(energyZPA+energyZPC));
2045  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 1., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*energyZNA);
2046  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 2., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*energyZNC);
2047  fHist_Reso2n_ZDN_SP_Det[2]->Fill(EvtCent, 3., (QTPCRe*QxcnCor+QTPCIm*QycnCor)*(energyZNA+energyZNC));
2048  }
2049 
2050  }//---- SP method -------
2051 
2052 
2053  PostData(1,fListHistos);
2054  PostData(2,fListCalibs);
2055 
2056  fHist_Event_count->Fill(9.5);
2057 
2058  //if(fievent%100==0) {
2059  //cout<<"irun = "<<runindex<<" n "<<n<<" m = "<<m<<" p = "<<p<<" cent= "<<EvtCent<<"\tiCentSPD = "<<iCentSPD<<"\tQRe= "<<QTPCRe<<"\tQIm= "<<QTPCIm<<"\tpsiN = "<<psiN<<endl;
2060  //cout<<" cent= "<<EvtCent<<"\teZNC= "<<energyZNC<<"\teZPC = "<<energyZPC<<"\teZNA= "<<energyZNA<<"\teZPA = "<<energyZPA<<endl;
2061  //}
2062 
2063  fievent++;
2064 
2065 }
2066 //======================= UserExec done =========================
2067 
2068 
2069 
2071 {
2072  AliDebug(2,"\n ... AliAnalysisTaskCMEV0::Terminate() is being called ... \n");
2073 }
2074 
2075 
2076 
2077 
2078 
2079 
2080 
2081 
2082 
2083 
2084 
2085 
2086 
2087 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)
2088 {
2089  for(Int_t iV0 = 0; iV0 < 64; iV0++) {
2090  /*if(fRemChV0A){
2091  if(iV0 == 46)
2092  continue;
2093  }*/
2094  Double_t phiV0 = TMath::PiOver4()*(0.5 + iV0 % 8);
2095  Float_t multv0 = aodV0->GetMultiplicity(iV0);
2096 
2097  if(iV0 < 32) {
2098  Double_t multCorC = -10;
2099 
2100  if(iV0 < 8)
2101  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(1);
2102  else if(iV0 >= 8 && iV0 < 16)
2103  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(9);
2104  else if(iV0 >= 16 && iV0 < 24)
2105  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(17);
2106  else if(iV0 >= 24 && iV0 < 32)
2107  multCorC = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(25);
2108 
2109  if(multCorC < 0){
2110  cout<<"Problem with multiplicity in V0C"<<endl;
2111  continue;
2112  }
2113  Qxcn += TMath::Cos(fHarmonic*phiV0) * multCorC;
2114  Qycn += TMath::Sin(fHarmonic*phiV0) * multCorC;
2115 
2116  sumMc = sumMc + multCorC;
2117  }
2118  else{
2119  Double_t multCorA = -10;
2120 
2121  if(iV0 >= 32 && iV0 < 40)
2122  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(33);
2123  else if(iV0 >= 40 && iV0 < 48)
2124  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(41);
2125  else if(iV0 >= 48 && iV0 < 56)
2126  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(49);
2127  else if(iV0 >= 56 && iV0 < 64)
2128  multCorA = multv0/fMultV0->GetBinContent(iV0+1)*fMultV0->GetBinContent(57);
2129 
2130  if(multCorA < 0){
2131  cout<<"Problem with multiplicity in V0A"<<endl;
2132  continue;
2133  }
2134  Qxan += TMath::Cos(fHarmonic*phiV0) * multCorA;
2135  Qyan += TMath::Sin(fHarmonic*phiV0) * multCorA;
2136 
2137  sumMa = sumMa + multCorA;
2138  }
2139  }
2140 }//-------- Get V0 QVect and Multiplicity -----
2141 
2143 {
2144  if(fListZDNCorr){
2145  fHCorrectZDNP = (TH2D *) fListZDNCorr->FindObject(Form("fHist_ZDC_All_Wgt_VsCent_Run%d",run));
2146  }
2147  else{
2148  fHCorrectZDNP = new TH2D("fHCorrectZDNP","",100,0,100,4,0,4) ;
2149  for(int i=1;i<=100;i++){
2150  for(int j=1;j<=4;j++){
2151  fHCorrectZDNP->SetBinContent(i,j,1.0);
2152  }
2153  }
2154  //printf("\n\n ********** ZDC Wgt Histograms NotFound ***************\n\n");
2155  //exit(1);
2156  }
2157 }
2158 
2160 {
2161 
2162  //old method
2163  /*
2164  Int_t centBin = -1;
2165  if(cent<5.0){ centBin = 0;}
2166  else if(cent>=5.0 && cent<10.0){centBin = 1;}
2167  else if(cent>=10.0 && cent<40.0){centBin = 2;}
2168  else if(cent>=40.0) {centBin = 3;}
2169  if(fListNUACorr){
2170  fHCorrectNUApos = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pos_Cent%d_Run%d",centBin,run));
2171  fHCorrectNUAneg = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Neg_Cent%d_Run%d",centBin,run));
2172  } */
2173 
2174  if(sfileNUA=="New2018" && fListNUACorr){
2175  for(int i=0;i<5;i++){
2176  fHCorrectNUApos[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pos_Cent%d_Run%d",i,run));
2177  fHCorrectNUAneg[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Neg_Cent%d_Run%d",i,run));
2178  }
2179  //cout<<"\n sfileNUA = "<<sfileNUA<<" opening Rihan's NUA file.\n "<<endl;
2180  }
2181  else if(sfileNUA=="NewR" && fListNUACorr){
2182  for(int i=0;i<4;i++){
2183  fHCorrectNUApos[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pos_Cent%d_Run%d",i,run));
2184  fHCorrectNUAneg[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Neg_Cent%d_Run%d",i,run));
2185  }
2186  //cout<<"\n sfileNUA = "<<sfileNUA<<" opening Rihan's NUA file.\n "<<endl;
2187  }
2188  else if(sfileNUA=="NewPt"|| sfileNUA=="NewpT"){
2189  if(fListNUACorr){
2190  for(int i=0;i<4;i++){
2191  fHCorrectNUApos[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_pTPhiEta_Pos_Vz%d_Run%d",i,run));
2192  fHCorrectNUAneg[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_pTPhiEta_Neg_Vz%d_Run%d",i,run));
2193  }
2194  }
2195  }
2196  else if(sfileNUA=="OldJ") {//from Jacopo's NUA file:
2197  if(!gGrid){
2198  TGrid::Connect("alien://");
2199  }
2200  if(!fileNUApos){
2201  fileNUApos = TFile::Open("alien:///alice/cern.ch/user/m/mhaque/calib_files/15oHI_FB768_PosCh_CenPhiEtaWeights_VtxRbR.root");
2202  mListNUAPos = dynamic_cast<TList*> (fileNUApos->FindObjectAny("CenPhiEta Weights"));
2203  }
2204  if(!fileNUAneg){
2205  fileNUAneg = TFile::Open("alien:///alice/cern.ch/user/m/mhaque/calib_files/15oHI_FB768_NegCh_CenPhiEtaWeights_VtxRbR.root");
2206  mListNUANeg = dynamic_cast<TList*> (fileNUAneg->FindObjectAny("CenPhiEta Weights"));
2207  }
2208  if(mListNUAPos){
2209  for(int i=0;i<4;i++){
2210  fHCorrectNUApos[i] = (TH3D *) mListNUAPos->FindObject(Form("CRCQVecPhiHistVtx[%d][%d]",i,run));
2211  }
2212  }
2213  if(mListNUANeg){
2214  for(int i=0;i<4;i++){
2215  fHCorrectNUAneg[i] = (TH3D *) mListNUANeg->FindObject(Form("CRCQVecPhiHistVtx[%d][%d]",i,run));
2216  }
2217  }
2218  }
2219 
2220 
2221  if(!fHCorrectNUApos[0] || !fHCorrectNUAneg[0]){
2222  printf("\n\n ******** could not open NUA Histograms for run %d, Use Wgt = 1.0 *********\n\n",run);
2223  if(sfileNUA=="New2018"){
2224  for(int i=0;i<5;i++){
2225  fHCorrectNUApos[i] = new TH3D(Form("fHCorrectNUApos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2226  fHCorrectNUAneg[i] = new TH3D(Form("fHCorrectNUAneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2227  fHCorrectNUApos[i]->SetBinContent(1,1,1,1.0);
2228  fHCorrectNUAneg[i]->SetBinContent(1,1,1,1.0);
2229  //exit(1);
2230  }
2231  }
2232  else if(sfileNUA=="OldJ"|| sfileNUA=="NewR"){
2233  for(int i=0;i<4;i++){
2234  fHCorrectNUApos[i] = new TH3D(Form("fHCorrectNUApos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2235  fHCorrectNUAneg[i] = new TH3D(Form("fHCorrectNUAneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2236  fHCorrectNUApos[i]->SetBinContent(1,1,1,1.0);
2237  fHCorrectNUAneg[i]->SetBinContent(1,1,1,1.0);
2238  //exit(1);
2239  }
2240  }
2241  else if(sfileNUA=="NewPt"|| sfileNUA=="NewpT"){
2242  for(int i=0;i<4;i++){
2243  fHCorrectNUApos[i] = new TH3D(Form("fHCorrectNUApos_cent%d",i),"",1,0,10,1,0,6.284,1,-0.9,0.9);
2244  fHCorrectNUAneg[i] = new TH3D(Form("fHCorrectNUAneg_cent%d",i),"",1,0,10,1,0,6.284,1,-0.9,0.9);
2245  fHCorrectNUApos[i]->SetBinContent(1,1,1,1.0);
2246  fHCorrectNUAneg[i]->SetBinContent(1,1,1,1.0);
2247  //exit(1);
2248  }
2249  }
2250  }
2251 }
2252 
2253 
2254 
2256 {
2257  if(!gGrid){
2258  TGrid::Connect("alien://");
2259  }
2260 
2261  TFile* foadb = 0;
2262  //if(!fRemChV0A)
2263  foadb = TFile::Open("alien:///alice/cern.ch/user/a/adobrin/calibV0HIR.root");
2264  //else
2265  //foadb = TFile::Open("alien:///alice/cern.ch/user/a/adobrin/calibV0HIRNoCh46V0A.root");
2266 
2267  if(!foadb){
2268  printf("OADB V0 calibration file cannot be opened\n");
2269  return;
2270  }
2271 
2272  AliOADBContainer* cont = (AliOADBContainer*) foadb->Get("hMultV0BefCorPfpx");
2273  if(!cont){
2274  printf("OADB object hMultV0BefCorr is not available in the file\n");
2275  return;
2276  }
2277  if(!(cont->GetObject(run))){
2278  printf("OADB object hMultV0BefCorPfpx is not available for run %i\n", run);
2279  return;
2280  }
2281  fMultV0 = ((TH1D*) cont->GetObject(run));
2282 
2283  AliOADBContainer* contQxnam = 0;
2284  if (fHarmonic == 2.)
2285  contQxnam = (AliOADBContainer*) foadb->Get("fqxa2m");
2286  else
2287  contQxnam = (AliOADBContainer*) foadb->Get("fqxa3m");
2288 
2289  if(!contQxnam){
2290  printf("OADB object fqxanm is not available in the file\n");
2291  return;
2292  }
2293  if(!(contQxnam->GetObject(run))){
2294  printf("OADB object fqxanm is not available for run %i\n", run);
2295  return;
2296  }
2297  fQxnmV0A = ((TH1D*) contQxnam->GetObject(run));
2298 
2299  AliOADBContainer* contQynam = 0;
2300  if (fHarmonic == 2.)
2301  contQynam = (AliOADBContainer*) foadb->Get("fqya2m");
2302  else if (fHarmonic == 3.)
2303  contQynam = (AliOADBContainer*) foadb->Get("fqya3m");
2304  else if (fHarmonic == 4.)
2305  contQynam = (AliOADBContainer*) foadb->Get("fqya4m");
2306 
2307  if(!contQynam){
2308  printf("OADB object fqyanm is not available in the file\n");
2309  return;
2310  }
2311  if(!(contQynam->GetObject(run))){
2312  printf("OADB object fqyanm is not available for run %i\n", run);
2313  return;
2314  }
2315  fQynmV0A = ((TH1D*) contQynam->GetObject(run));
2316 
2317  AliOADBContainer* contQxnas = 0;
2318  if (fHarmonic == 2.)
2319  contQxnas = (AliOADBContainer*) foadb->Get("fqxa2s");
2320  else
2321  contQxnas = (AliOADBContainer*) foadb->Get("fqxa3s");
2322 
2323  if(!contQxnas){
2324  printf("OADB object fqxans is not available in the file\n");
2325  return;
2326  }
2327  if(!(contQxnas->GetObject(run))){
2328  printf("OADB object fqxans is not available for run %i\n", run);
2329  return;
2330  }
2331  fQxnsV0A = ((TH1D*) contQxnas->GetObject(run));
2332 
2333  AliOADBContainer* contQynas = 0;
2334  if (fHarmonic == 2.)
2335  contQynas = (AliOADBContainer*) foadb->Get("fqya2s");
2336  else if (fHarmonic == 3.)
2337  contQynas = (AliOADBContainer*) foadb->Get("fqya3s");
2338  else if (fHarmonic == 4.)
2339  contQynas = (AliOADBContainer*) foadb->Get("fqya4s");
2340 
2341  if(!contQynas){
2342  printf("OADB object fqyans is not available in the file\n");
2343  return;
2344  }
2345  if(!(contQynas->GetObject(run))){
2346  printf("OADB object fqyans is not available for run %i\n", run);
2347  return;
2348  }
2349  fQynsV0A = ((TH1D*) contQynas->GetObject(run));
2350 
2351 
2352 
2353  AliOADBContainer* contQxncm = 0;
2354  if (fHarmonic == 2.)
2355  contQxncm = (AliOADBContainer*) foadb->Get("fqxc2m");
2356  else
2357  contQxncm = (AliOADBContainer*) foadb->Get("fqxc3m");
2358 
2359  if(!contQxncm){
2360  printf("OADB object fqxcnm is not available in the file\n");
2361  return;
2362  }
2363  if(!(contQxncm->GetObject(run))){
2364  printf("OADB object fqxcnm is not available for run %i\n", run);
2365  return;
2366  }
2367  fQxnmV0C = ((TH1D*) contQxncm->GetObject(run));
2368 
2369 
2370 
2371  AliOADBContainer* contQyncm = 0;
2372  if (fHarmonic == 2.)
2373  contQyncm = (AliOADBContainer*) foadb->Get("fqyc2m");
2374  else if (fHarmonic == 3.)
2375  contQyncm = (AliOADBContainer*) foadb->Get("fqyc3m");
2376  else if (fHarmonic == 4.)
2377  contQyncm = (AliOADBContainer*) foadb->Get("fqyc4m");
2378 
2379  if(!contQyncm){
2380  printf("OADB object fqyc2m is not available in the file\n");
2381  return;
2382  }
2383  if(!(contQyncm->GetObject(run))){
2384  printf("OADB object fqyc2m is not available for run %i\n", run);
2385  return;
2386  }
2387  fQynmV0C = ((TH1D*) contQyncm->GetObject(run));
2388 
2389 
2390  AliOADBContainer* contQxncs = 0;
2391  if (fHarmonic == 2.)
2392  contQxncs = (AliOADBContainer*) foadb->Get("fqxc2s");
2393  else
2394  contQxncs = (AliOADBContainer*) foadb->Get("fqxc3s");
2395 
2396  if(!contQxncs){
2397  printf("OADB object fqxc2s is not available in the file\n");
2398  return;
2399  }
2400  if(!(contQxncs->GetObject(run))){
2401  printf("OADB object fqxc2s is not available for run %i\n", run);
2402  return;
2403  }
2404  fQxnsV0C = ((TH1D*) contQxncs->GetObject(run));
2405 
2406 
2407  AliOADBContainer* contQyncs = 0;
2408  if (fHarmonic == 2.)
2409  contQyncs = (AliOADBContainer*) foadb->Get("fqyc2s");
2410  else if (fHarmonic == 3.)
2411  contQyncs = (AliOADBContainer*) foadb->Get("fqyc3s");
2412  else if (fHarmonic == 4.)
2413  contQyncs = (AliOADBContainer*) foadb->Get("fqyc4s");
2414 
2415  if(!contQyncs){
2416  printf("OADB object fqycnm is not available in the file\n");
2417  return;
2418  }
2419  if(!(contQyncs->GetObject(run))){
2420  printf("OADB object fqycns is not available for run %i\n", run);
2421  return;
2422  }
2423  fQynsV0C = ((TH1D*) contQyncs->GetObject(run));
2424 }//------- OADB container ------
2425 
2426 
2427 
2428 
2429 double AliAnalysisTaskCMEV0::GetWDist(const AliVVertex* v0, const AliVVertex* v1)
2430 {
2431  // calculate sqrt of weighted distance to other vertex
2432  if (!v0 || !v1) {
2433  AliDebug(2,"\n\n ::GetWDist => One of vertices is not valid\n\n");
2434  return 0;
2435  }
2436  static TMatrixDSym vVb(3);
2437  double dist = -1;
2438  double dx = v0->GetX()-v1->GetX();
2439  double dy = v0->GetY()-v1->GetY();
2440  double dz = v0->GetZ()-v1->GetZ();
2441  double cov0[6],cov1[6];
2442  v0->GetCovarianceMatrix(cov0);
2443  v1->GetCovarianceMatrix(cov1);
2444  vVb(0,0) = cov0[0]+cov1[0];
2445  vVb(1,1) = cov0[2]+cov1[2];
2446  vVb(2,2) = cov0[5]+cov1[5];
2447  vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];
2448  vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;
2449  vVb.InvertFast();
2450  if (!vVb.IsValid()) {
2451  AliDebug(2,"Singular Matrix\n");
2452  return dist;
2453  }
2454  dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz
2455  + 2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;
2456  return dist>0 ? TMath::Sqrt(dist) : -1;
2457 }
2458 
2460  { // check for multi-vertexer pile-up
2461  const int kMinPlpContrib = 5;
2462  const double kMaxPlpChi2 = 5.0;
2463  const double kMinWDist = 15;
2464 
2465  const AliVVertex* vtPrm = 0;
2466  const AliVVertex* vtPlp = 0;
2467 
2468  int nPlp = 0;
2469 
2470  if(!(nPlp=faod->GetNumberOfPileupVerticesTracks()))
2471  return kFALSE;
2472 
2473  vtPrm = faod->GetPrimaryVertex();
2474  if(vtPrm == faod->GetPrimaryVertexSPD())
2475  return kTRUE; // there are pile-up vertices but no primary
2476 
2477  //int bcPrim = vtPrm->GetBC();
2478 
2479  for(int ipl=0;ipl<nPlp;ipl++) {
2480  vtPlp = (const AliVVertex*)faod->GetPileupVertexTracks(ipl);
2481  if (vtPlp->GetNContributors() < kMinPlpContrib) continue;
2482  if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;
2483  //int bcPlp = vtPlp->GetBC();
2484  //if (bcPlp!=AliVTrack::kTOFBCNA && TMath::Abs(bcPlp-bcPrim)>2)
2485  // return kTRUE; // pile-up from other BC
2486 
2487  double wDst = GetWDist(vtPrm,vtPlp);
2488  if (wDst<kMinWDist) continue;
2489 
2490  return kTRUE; // pile-up: well separated vertices
2491  }
2492  return kFALSE;
2493 }
2494 
2495 
2496 
2498 {
2499 /*
2500  if(!gGrid){
2501  TGrid::Connect("alien://");
2502  }
2503 
2504  TFile *fileV0M = TFile::Open(fFileV0MCorr);
2505  if(!fileV0M){
2506  printf("\n\n ********** File for V0M gain eq. not found ***************\n\n");
2507  }
2508 
2509  TList *mListV0M = dynamic_cast<TList*> (fileV0M->FindObjectAny("fV0MChWgts"));
2510 */
2511  if(fListV0MCorr){
2512  fHCorrectV0M = (TH1D *) fListV0MCorr->FindObject(Form("fHistV0Gain_Run%d",run));
2513  //TH2D *fV0QnAvgTemp = (TH2D *) mListV0M->FindObject(Form("fHistV0_AvgQnAC_Run%d",run));
2514  //fV0Qn_AvgCorr = (TH2D *) fV0QnAvgTemp->Clone("fV0Qn_AvgCorr");
2515  //TH2D *fV0QnSigTemp = (TH2D *) mListV0M->FindObject(Form("fHistV0_SigQnAC_Run%d",run));
2516  //fV0Qn_SigCorr = (TH2D *) fV0QnSigTemp->Clone("fV0Qn_SigCorr");
2517  }
2518  else{
2519  fHCorrectV0M = new TH1D("fHCorrectV0M","",64,0,64);
2520  for(int i=1;i<=64;i++){
2521  fHCorrectV0M->SetBinContent(i,1.0);
2522  }
2523  //fV0Qn_AvgCorr = NULL;
2524  //fV0Qn_SigCorr = NULL;
2525  //printf("\n\n ********** V0M ch wgt Histograms NotFound, use Wgt = 1.0 ***************\n\n");
2526  //exit(1);
2527  }
2528  //fileV0M->Close();
2529 }
2530 
2531 
2532 
2533 
2534 
2536 
2537  Bool_t BisPileup=kFALSE;
2538 
2539  Double_t centrV0M=300;
2540  Double_t centrCL1=300;
2541  Double_t centrCL0=300;
2542  Double_t centrTRK=300;
2543 
2544  if(sDataSet=="2010"||sDataSet=="2011"){
2545  centrV0M = ((AliVAODHeader*)faod->GetHeader())->GetCentralityP()->GetCentralityPercentile("V0M");
2546  centrCL1 = ((AliVAODHeader*)faod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL1");
2547  centrCL0 = ((AliVAODHeader*)faod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL0");
2548  centrTRK = ((AliVAODHeader*)faod->GetHeader())->GetCentralityP()->GetCentralityPercentile("TRK");
2549  }
2550  else{
2551  fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection");
2552  if(!fMultSelection) {
2553  printf("\n\n **WARNING** ::UserExec() AliMultSelection object not found.\n\n");
2554  exit(1);
2555  }
2556  centrV0M = fMultSelection->GetMultiplicityPercentile("V0M");
2557  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
2558  centrCL0 = fMultSelection->GetMultiplicityPercentile("CL0");
2559  centrTRK = fMultSelection->GetMultiplicityPercentile("TRK");
2560  }// 2015
2561 
2562 
2563  if(fRejectPileUp && InputEvent()) {
2564  //if(!fCutsEvent->IsSelected(InputEvent(),MCEvent())) return;
2565  if(sDataSet!="2015" && sDataSet!="2015LI") {
2566  if(PileUpMultiVertex(faod)) {
2567  fPileUpCount->Fill(0.5);
2568  BisPileup=kTRUE;
2569  }
2570  Int_t isPileup = faod->IsPileupFromSPD(3);
2571  if(isPileup != 0) {
2572  fPileUpCount->Fill(1.5);
2573  //BisPileup=kTRUE; //
2574  }
2575  if(((AliAODHeader*)faod->GetHeader())->GetRefMultiplicityComb08() < 0) {
2576  fPileUpCount->Fill(2.5);
2577  BisPileup=kTRUE;
2578  }
2579  if(faod->IsIncompleteDAQ()) {
2580  fPileUpCount->Fill(3.5);
2581  BisPileup=kTRUE;
2582  }
2583 
2584  //check vertex consistency
2585  const AliAODVertex* vtTrc = faod->GetPrimaryVertex();
2586  const AliAODVertex* vtSPD = faod->GetPrimaryVertexSPD();
2587 
2588  if(vtTrc->GetNContributors() < 2 || vtSPD->GetNContributors()<1) {
2589  fPileUpCount->Fill(5.5);
2590  BisPileup=kTRUE;
2591  }
2592 
2593  double covTrc[6], covSPD[6];
2594  vtTrc->GetCovarianceMatrix(covTrc);
2595  vtSPD->GetCovarianceMatrix(covSPD);
2596 
2597  double dz = vtTrc->GetZ() - vtSPD->GetZ();
2598 
2599  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
2600  double errTrc = TMath::Sqrt(covTrc[5]);
2601  double nsigTot = dz/errTot;
2602  double nsigTrc = dz/errTrc;
2603 
2604  if(TMath::Abs(dz)>0.2 || TMath::Abs(nsigTot)>10 || TMath::Abs(nsigTrc)>20) {
2605  fPileUpCount->Fill(6.5);
2606  BisPileup=kTRUE;
2607  }
2608  if(fAnalysisUtil->IsPileUpEvent(InputEvent())) {
2609  fPileUpCount->Fill(7.5);
2610  BisPileup=kTRUE;
2611  }
2612  }
2613 
2614  else { //------------ pileup for 2015 HI, LI data -----------------
2615  if(!fMultSelection->GetThisEventIsNotPileup())
2616  fPileUpMultSelCount->Fill(0.5);
2617  if(!fMultSelection->GetThisEventIsNotPileupMV())
2618  fPileUpMultSelCount->Fill(1.5);
2619  if(!fMultSelection->GetThisEventIsNotPileupInMultBins())
2620  fPileUpMultSelCount->Fill(2.5);
2621  if(!fMultSelection->GetThisEventHasNoInconsistentVertices())
2622  fPileUpMultSelCount->Fill(3.5);
2623  if(!fMultSelection->GetThisEventPassesTrackletVsCluster())
2624  fPileUpMultSelCount->Fill(4.5);
2625  if(!fMultSelection->GetThisEventIsNotAsymmetricInVZERO())
2626  fPileUpMultSelCount->Fill(5.5);
2627  if(!fMultSelection->GetThisEventIsNotIncompleteDAQ())
2628  fPileUpMultSelCount->Fill(6.5);
2629  if(!fMultSelection->GetThisEventHasGoodVertex2016())
2630  fPileUpMultSelCount->Fill(7.5);
2631 
2632  BisPileup=kFALSE;
2633 
2634  //-- pile-up a la Dobrin for LHC15o -----
2635  if(PileUpMultiVertex(faod)) {
2636  fPileUpCount->Fill(0.5);
2637  BisPileup=kTRUE;
2638  }
2639  Int_t isPileup = faod->IsPileupFromSPD(3);
2640  if(isPileup != 0) {
2641  fPileUpCount->Fill(1.5);
2642  BisPileup=kTRUE;
2643  }
2644  if(((AliAODHeader*)faod->GetHeader())->GetRefMultiplicityComb08() < 0) {
2645  fPileUpCount->Fill(2.5);
2646  BisPileup=kTRUE;
2647  }
2648  if(faod->IsIncompleteDAQ()) {
2649  fPileUpCount->Fill(3.5);
2650  BisPileup=kTRUE;
2651  }
2652  if(fabs(centrV0M-centrCL1)> 5.0) {//default: 7.5
2653  fPileUpCount->Fill(4.5);
2654  BisPileup=kTRUE;
2655  }
2656 
2657  // check vertex consistency
2658  const AliAODVertex* vtTrc = faod->GetPrimaryVertex();
2659  const AliAODVertex* vtSPD = faod->GetPrimaryVertexSPD();
2660 
2661  if(vtTrc->GetNContributors() < 2 || vtSPD->GetNContributors()<1) {
2662  fPileUpCount->Fill(5.5);
2663  BisPileup=kTRUE;
2664  }
2665 
2666  double covTrc[6], covSPD[6];
2667  vtTrc->GetCovarianceMatrix(covTrc);
2668  vtSPD->GetCovarianceMatrix(covSPD);
2669 
2670  double dz = vtTrc->GetZ() - vtSPD->GetZ();
2671 
2672  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
2673  double errTrc = TMath::Sqrt(covTrc[5]);
2674  double nsigTot = dz/errTot;
2675  double nsigTrc = dz/errTrc;
2676 
2677  if(TMath::Abs(dz)>0.2 || TMath::Abs(nsigTot)>10 || TMath::Abs(nsigTrc)>20) {
2678  fPileUpCount->Fill(6.5);
2679  BisPileup=kTRUE;
2680  }
2681 
2682  //cuts on tracks
2683  //Int_t multTrk = 0;
2684  //Int_t multTrkBefC = 0;
2685  //Int_t multTrkTOFBefC = 0;
2686 
2687  Int_t multTPC = 0;
2688  Int_t multITSfb96 = 0;
2689  Int_t multITSfb32 = 0;
2690 
2691  Int_t multTPCFE = 0;
2692  Int_t multGlobal = 0;
2693  Int_t multTPCuncut = 0;
2694 
2695  Int_t multEsd = ((AliAODHeader*)faod->GetHeader())->GetNumberOfESDTracks();
2696 
2697  const Int_t nTracks = faod->GetNumberOfTracks();
2698 
2699  for(Int_t iTracks = 0; iTracks < nTracks; iTracks++) {
2700  //AliNanoAODTrack* track = dynamic_cast<AliNanoAODTrack*>(faod->GetTrack(iTracks));
2701  AliAODTrack* track = (AliAODTrack*)faod->GetTrack(iTracks);
2702  if(!track) continue;
2703  //---------- old method -----------
2704  if(track->TestFilterBit(128))
2705  multTPC++;
2706  if(track->TestFilterBit(96))
2707  multITSfb96++;
2708  //----------------------------------
2709  if(track->TestFilterBit(1)) multTPCuncut++;
2710  if(track->TestFilterBit(32)) multITSfb32++;
2711 
2712 
2713  if(track->Pt()<0.2 || track->Pt()>5.0 || TMath::Abs(track->Eta())>0.8 || track->GetTPCNcls()<70 || track->GetTPCsignal()<10.0)
2714  continue;
2715  if(track->TestFilterBit(1) && track->Chi2perNDF()>0.2) multTPCFE++;
2716  if(!track->TestFilterBit(16) || track->Chi2perNDF()<0.1) continue;
2717 
2718  Double_t b[2] = {-99., -99.};
2719  Double_t bCov[3] = {-99., -99., -99.};
2720 
2721  AliAODTrack copy(*track);
2722  Double_t magField = faod->GetMagneticField();
2723 
2724  if(magField!=0){
2725  if(track->PropagateToDCA(faod->GetPrimaryVertex(), magField, 100., b, bCov) && TMath::Abs(b[0]) < 0.3 && TMath::Abs(b[1]) < 0.3) multGlobal++;
2726  }
2727  }
2728 
2729 
2730  /*
2731  for(Int_t it = 0; it < nTracks; it++) {
2732  AliAODTrack* aodTrk = (AliAODTrack*)faod->GetTrack(it);
2733  if(!aodTrk) {
2734  delete aodTrk;
2735  continue;
2736  }
2737  //if(aodTrk->TestFilterBit(32)){
2738  // multTrkBefC++;
2739  // if(TMath::Abs(aodTrk->GetTOFsignalDz()) <= 10. && aodTrk->GetTOFsignal() >= 12000. && aodTrk->GetTOFsignal() <= 25000.)
2740  // multTrkTOFBefC++;
2741  // if((TMath::Abs(aodTrk->Eta()) < 0.8) && (aodTrk->GetTPCNcls() >= 70) && (aodTrk->Pt() >= 0.2) && (aodTrk->Pt() < 20.))
2742  // multTrk++;
2743  //}
2744  if(aodTrk->TestFilterBit(128))
2745  multTPC++;
2746  if(aodTrk->TestFilterBit(96))
2747  multITSfb96++;
2748  } // end of for AOD track loop
2749 
2750  */
2751 
2752  Double_t multTPCn = multTPC;
2753  Double_t multEsdn = multEsd;
2754 
2755  Double_t multESDTPCDif = multEsdn - fPileUpSlopeParm*multTPCn;
2756  Double_t multTPCGlobDif = multTPCFE - fPileUpSlopeParm*multGlobal;
2757 
2758  fTPCvsITSfb96->Fill(multITSfb96,multTPC); //multITSfb96 = FB 96, multTPC = FB 128
2759  fTPCvsITSfb32->Fill(multITSfb32,multTPC); //multITSfb32 = FB 32
2760  fTPCFEvsITSfb96->Fill(multITSfb96,multTPCFE); //multTPCFE = FB 1
2761 
2762  fGlobalTracks->Fill(multGlobal);
2763  fTPCvsGlobalTrk->Fill(multGlobal,multTPCFE);
2764  fTPCuncutvsGlobal->Fill(multGlobal,multTPCuncut);
2765 
2766 
2767 
2768  /*if(multESDTPCDif > (fRejectPileUpTight?700.:15000.)) {
2769  fPileUpCount->Fill(7.5);
2770  BisPileup=kTRUE;
2771  }*/
2772  /*if(multESDTPCDif > 15000.){ //default: 15000
2773  fPileUpCount->Fill(7.5);
2774  BisPileup=kTRUE;
2775  }*/
2776 
2777  if(fRejectPileUpTight) {
2778  if(multESDTPCDif > fPileUpConstParm) {
2779  fPileUpCount->Fill(7.5);
2780  BisPileup=kTRUE;
2781  }
2782  if(multTPCGlobDif > fPileUpConstParm) {
2783  fPileUpCount->Fill(8.5);
2784  //BisPileup=kTRUE;
2785  }
2786  if(BisPileup==kFALSE) {
2787  if(!fMultSelection->GetThisEventIsNotPileup()) BisPileup=kTRUE;
2788  if(!fMultSelection->GetThisEventIsNotPileupMV()) BisPileup=kTRUE;
2789  if(!fMultSelection->GetThisEventIsNotPileupInMultBins()) BisPileup=kTRUE;
2790  if(!fMultSelection->GetThisEventHasNoInconsistentVertices()) BisPileup=kTRUE;
2791  if(!fMultSelection->GetThisEventPassesTrackletVsCluster()) BisPileup=kTRUE;
2792  if(!fMultSelection->GetThisEventIsNotIncompleteDAQ()) BisPileup=kTRUE;
2793  if(!fMultSelection->GetThisEventHasGoodVertex2016()) BisPileup=kTRUE;
2794  if(BisPileup) fPileUpCount->Fill(9.5);
2795  }
2796  }
2797  }
2798  }
2799 
2800  return BisPileup;
2801 }//-------pile up function ------
2802 
2803 
2804 
2805 Float_t AliAnalysisTaskCMEV0::GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign) {
2806 
2807  static const Double_t kPi = TMath::Pi();
2808 
2809  Float_t dphistar = phi1 - phi2 - charge1 * bSign * TMath::ASin(0.075 * radius / pt1) + charge2 * bSign * TMath::ASin(0.075 * radius / pt2);
2810 
2811  if(dphistar < -kPi)
2812  dphistar = -kPi * 2 - dphistar;
2813 
2814  if(dphistar > kPi) // might look funny but is needed
2815  dphistar = kPi * 2 - dphistar;
2816 
2817  return dphistar;
2818 }
2819 
2820 
2821 
2822 
2823 
2824 
2825 
2827 
2828  Int_t irun = -1;
2829 
2830  for(int i=0;i<fRunFlag;i++){
2831  if(run==runNums[i])
2832  {
2833  irun = i;
2834  break;
2835  }
2836  }
2837  if(irun<0) {
2838  printf("\n ... **WARNING** \n::UserExec() runnumber not listed.\n EXIT..\n");
2839  }
2840 
2841  return irun;
2842 }//------ GetCurrentRunIndex --------
2843 
2844 
2846 
2847  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};
2848 
2849  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};
2850 
2851  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};
2852 
2853  Int_t runArray_2015LI[13] = {244917, 244918, 244975, 244980, 244982, 244983, 245061, 245064, 245066, 245068, 246390, 246391, 246392};
2854 
2855 //Int_t runArray_pPb_13cpass2[14] = {195677, 195675, 195673, 195644, 195635, 195633, 195596, 195593, 195592, 195568, 195567, 195566, 195531, 195529};
2856 
2857  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};
2858 
2859 
2860 
2861 
2862  if(sPeriod=="2010"){
2863  fRunFlag = 89;
2864  for(int i=0;i<fRunFlag;i++)
2865  runNums[i] = runArray_2010[i];
2866  }
2867  else if(sPeriod=="2011"){
2868  fRunFlag = 68; //<-- 2011 check
2869  for(int i=0;i<fRunFlag;i++)
2870  runNums[i] = runArray_2011[i];
2871  }
2872  else if(sPeriod=="2015" || sPeriod=="2015PbPb"){
2873  fRunFlag = 90;
2874  for(int i=0;i<fRunFlag;i++)
2875  runNums[i] = runArray_2015[i];
2876  }
2877  else if(sPeriod=="2015pPb" || sPeriod=="pPb"){
2878  fRunFlag = 32;
2879  for(int i=0;i<fRunFlag;i++)
2880  runNums[i] = runArray_pPb_16q_pass1[i];
2881  }
2882  else if(sPeriod=="2015LI"){
2883  fRunFlag = 13;
2884  for(int i=0;i<fRunFlag;i++)
2885  runNums[i] = runArray_2015LI[i];
2886  }
2887 
2888 
2889  else{
2890  printf("\n\n ***** Run Number not defined for this data set. *******\n\n Please modify code..\n\n");
2891  exit(1);
2892  }
2893 
2894 }//------- InitializeRunArray ---------
2895 
2896 
2897 
2899 
2900  fHist_Event_count = new TH1F("fHist_Event_count"," ",20,0,20);
2901  fHist_Event_count->GetXaxis()->SetBinLabel(1,"Called Exec()");
2902  fHist_Event_count->GetXaxis()->SetBinLabel(2,"AOD Exist");
2903  fHist_Event_count->GetXaxis()->SetBinLabel(3,"PileUp");
2904  fHist_Event_count->GetXaxis()->SetBinLabel(4,"iCentSPD<90");
2905  fHist_Event_count->GetXaxis()->SetBinLabel(5,"V0 Mult>0");
2906  fHist_Event_count->GetXaxis()->SetBinLabel(6,"TPC Q!=0");
2907  fHist_Event_count->GetXaxis()->SetBinLabel(7,"Bad Runs");
2908  fHist_Event_count->GetXaxis()->SetBinLabel(8,"..TBA..");
2909 
2910  fHist_Event_count->GetXaxis()->SetBinLabel(10,"Final Event");
2912 
2913  fPileUpMultSelCount = new TH1F("fPileUpMultSelCount", "fPileUpMultSelCount", 10, 0., 10.);
2914  fPileUpMultSelCount->GetXaxis()->SetBinLabel(1,"IsNotPileup");
2915  fPileUpMultSelCount->GetXaxis()->SetBinLabel(2,"IsNotPileupMV");
2916  fPileUpMultSelCount->GetXaxis()->SetBinLabel(3,"IsNotPileupInMultBins");
2917  fPileUpMultSelCount->GetXaxis()->SetBinLabel(4,"InconsistentVertices");
2918  fPileUpMultSelCount->GetXaxis()->SetBinLabel(5,"TrackletVsCluster");
2919  fPileUpMultSelCount->GetXaxis()->SetBinLabel(6,"AsymmetricInVZERO");
2920  fPileUpMultSelCount->GetXaxis()->SetBinLabel(7,"IncompleteDAQ");
2921  fPileUpMultSelCount->GetXaxis()->SetBinLabel(8,"GoodVertex2016");
2923 
2924  fPileUpCount = new TH1F("fPileUpCount", "fPileUpCount", 12, 0., 12.);
2925  fPileUpCount->GetXaxis()->SetBinLabel(1,"plpMV");
2926  fPileUpCount->GetXaxis()->SetBinLabel(2,"fromSPD");
2927  fPileUpCount->GetXaxis()->SetBinLabel(3,"RefMultiplicityComb08");
2928  fPileUpCount->GetXaxis()->SetBinLabel(4,"IncompleteDAQ");
2929  fPileUpCount->GetXaxis()->SetBinLabel(5,"abs(V0M-CL1)>5.0");
2930  fPileUpCount->GetXaxis()->SetBinLabel(6,"missingVtx");
2931  fPileUpCount->GetXaxis()->SetBinLabel(7,"inconsistentVtx");
2932  Int_t puConst = fPileUpConstParm;
2933  fPileUpCount->GetXaxis()->SetBinLabel(8,Form("multESDTPCDif>%d",puConst));
2934  fPileUpCount->GetXaxis()->SetBinLabel(9,Form("multGlobTPCDif>%d",puConst));
2935  fPileUpCount->GetXaxis()->SetBinLabel(10,"extraPileUpMultSel");
2936  fListHistos->Add(fPileUpCount);
2937 
2938  //To be implemented fully:
2939  fTaskConfigParm = new TH1F("fTaskConfigParm", "Connfig Values", 20, 0., 20.);
2940  fTaskConfigParm->GetXaxis()->SetBinLabel(1,"CentMin");
2941  fTaskConfigParm->GetXaxis()->SetBinLabel(2,"CentMax");
2942  fTaskConfigParm->GetXaxis()->SetBinLabel(3,"VzMin");
2943  fTaskConfigParm->GetXaxis()->SetBinLabel(4,"VzMax");
2944  fTaskConfigParm->GetXaxis()->SetBinLabel(5,"EtaMin");
2945  fTaskConfigParm->GetXaxis()->SetBinLabel(6,"EtaMax");
2946  fTaskConfigParm->GetXaxis()->SetBinLabel(7,"PtMin");
2947  fTaskConfigParm->GetXaxis()->SetBinLabel(8,"PtMax");
2948  fTaskConfigParm->GetXaxis()->SetBinLabel(9,"DCAxy");
2949  fTaskConfigParm->GetXaxis()->SetBinLabel(10,"DCAz");
2950  fTaskConfigParm->GetXaxis()->SetBinLabel(11,"MCcorrected?");
2951  fTaskConfigParm->GetXaxis()->SetBinLabel(12,"NUACorrected?");
2952  fTaskConfigParm->GetXaxis()->SetBinLabel(13,"V0gainCorr?");
2953  fTaskConfigParm->GetXaxis()->SetBinLabel(14,"ZDCgainCorr?");
2954  fTaskConfigParm->GetXaxis()->SetBinLabel(15,"harmonic N");
2955  fTaskConfigParm->GetXaxis()->SetBinLabel(16,"harmonic M");
2956  fTaskConfigParm->GetXaxis()->SetBinLabel(17,"harmonicPsi");
2958 
2959  if(sDataSet=="2015pPb" || sDataSet=="pPb") {
2960  fHistVtxZvsRun = new TH2F("fHistVtxZvsRun", " Vz (cm) ",fRunFlag,0,fRunFlag,200, -10, 10.);
2962  fHistVtxXvsRun = new TH2F("fHistVtxXvsRun", " Vx (cm) ",fRunFlag,0,fRunFlag,100, -1, 1.);
2964  fHistVtxYvsRun = new TH2F("fHistVtxYvsRun", " Vy (cm) ",fRunFlag,0,fRunFlag,100, -1, 1.);
2966  }
2967 
2968 
2969  //----- CME-ZDN correlator SP method---------
2970  for(int i=0;i<3;i++){ //ZDN_SP
2971  //Detector: 0 = V0A, 1 = V0C, 3 = Q-cumulant
2972  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,"");
2973  fHist_Corr3p_ZDN_SP_PN[i]->Sumw2();
2975  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,"");
2976  fHist_Corr3p_ZDN_SP_PP[i]->Sumw2();
2978  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,"");
2979  fHist_Corr3p_ZDN_SP_NN[i]->Sumw2();
2981  }
2982  //SP Resolution:
2983  for(int i=0;i<3;i++){
2984  //Det: 0 = v0c-v0a, 1 = v0a-TPC, 2 = v0c-TPC,
2985  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,"");
2986  fHist_Reso2n_ZDN_SP_Det[i]->Sumw2();
2988  }
2989  //--------------------------------------------
2990 
2991  Double_t centRange[11] = {0,5,10,20,30,40,50,60,70,80,90};
2992 
2993 
2994  fRejectRatioVsCR = new TProfile2D("fRejectRatioVsCentRun","",10,centRange,fRunFlag,0,fRunFlag);
2996 
2997 
2998 
2999  //----- CME SP method histograms ---------
3000  for(int i=0;i<2;i++){
3001  for(int j=0;j<3;j++){
3002  //Detector: 0 = V0A, 1 = V0C, 3 = Q-cumulant
3003  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,"");
3004  fHist_Corr3p_SP_Norm_PN[i][j]->Sumw2();
3006  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,"");
3007  fHist_Corr3p_SP_Norm_PP[i][j]->Sumw2();
3009  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,"");
3010  fHist_Corr3p_SP_Norm_NN[i][j]->Sumw2();
3012  }
3013  //EP Resolution:
3014  for(int j=0;j<3;j++){
3015  //Det: 0 = v0c-v0a, 1 = v0a-TPC, 2 = v0c-TPC,
3016  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,"");
3017  fHist_Reso2n_SP_Norm_Det[i][j]->Sumw2();
3019  }
3020  }
3021 
3022 
3023 
3024  //----- CME EP method histograms ---------
3025  for(int i=0;i<2;i++){
3026  for(int j=0;j<3;j++){
3027  //Detector: 0 = V0A, 1 = V0C, 3 = Q-cumulant
3028  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,"");
3029  fHist_Corr3p_EP_Norm_PN[i][j]->Sumw2();
3031  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,"");
3032  fHist_Corr3p_EP_Norm_PP[i][j]->Sumw2();
3034  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,"");
3035  fHist_Corr3p_EP_Norm_NN[i][j]->Sumw2();
3037  }
3038  //EP Resolution:
3039  for(int j=0;j<3;j++){
3040  //Det: 0 = v0c-v0a, 1 = v0a-TPC, 2 = v0c-TPC,
3041  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,"");
3042  fHist_Reso2n_EP_Norm_Det[i][j]->Sumw2();
3044  }
3045  }
3046 
3047 
3048 
3049 
3050 
3051 
3052  fHV0AEventPlaneVsCent = new TH2F("fHV0AEventPlaneVsCent","Psi2 from V0A",10,centRange,50,0,3.1415);
3054  fHV0CEventPlaneVsCent = new TH2F("fHV0CEventPlaneVsCent","Psi2 from V0C",10,centRange,50,0,3.1415);
3056  fHTPCEventPlaneVsCent = new TH2F("fHTPCEventPlaneVsCent","Psi2 from TPC",10,centRange,50,0,3.1415);
3058 
3059 
3060 
3061 
3062  //TH1::SetDefaultSumw2();
3063 
3064  Char_t name[100], title[100];
3065 
3066 
3067 
3068  //Differential in pT:
3069  //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.};
3070 
3071  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};
3072 
3073  for(int i=0;i<2;i++){
3074  for(int j=0;j<6;j++){
3075  sprintf(name,"fHist_Corr3p_pTSum_EP_V0A_PN_Mag%d_Cent%d",i,j);
3076  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3077  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
3078  fHist_Corr3p_pTSum_EP_V0A_PN[i][j]->Sumw2();
3080 
3081  sprintf(name,"fHist_Corr3p_pTSum_EP_V0A_PP_Mag%d_Cent%d",i,j);
3082  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3083  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
3084  fHist_Corr3p_pTSum_EP_V0A_PP[i][j]->Sumw2();
3086 
3087  sprintf(name,"fHist_Corr3p_pTSum_EP_V0A_NN_Mag%d_Cent%d",i,j);
3088  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3089  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
3090  fHist_Corr3p_pTSum_EP_V0A_NN[i][j]->Sumw2();
3092  //-----v0c----
3093  sprintf(name,"fHist_Corr3p_pTSum_EP_V0C_PN_Mag%d_Cent%d",i,j);
3094  sprintf(title,"PN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3095  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
3096  fHist_Corr3p_pTSum_EP_V0C_PN[i][j]->Sumw2();
3098 
3099  sprintf(name,"fHist_Corr3p_pTSum_EP_V0C_PP_Mag%d_Cent%d",i,j);
3100  sprintf(title,"PP 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3101  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
3102  fHist_Corr3p_pTSum_EP_V0C_PP[i][j]->Sumw2();
3104 
3105  sprintf(name,"fHist_Corr3p_pTSum_EP_V0C_NN_Mag%d_Cent%d",i,j);
3106  sprintf(title,"NN 3p vs (pT1+pT2)/2, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3107  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
3108  fHist_Corr3p_pTSum_EP_V0C_NN[i][j]->Sumw2();
3110  }
3111  }
3112 
3113  for(int i=0;i<2;i++){
3114  for(int j=0;j<6;j++){
3115  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
3116  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3117  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = new TProfile(name,title,20,pTRange,"");
3118  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j]->Sumw2();
3120 
3121  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
3122  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3123  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = new TProfile(name,title,20,pTRange,"");
3124  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j]->Sumw2();
3126 
3127  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
3128  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3129  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = new TProfile(name,title,20,pTRange,"");
3130  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j]->Sumw2();
3132  //-----v0c----
3133  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
3134  sprintf(title,"PN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3135  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = new TProfile(name,title,20,pTRange,"");
3136  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j]->Sumw2();
3138 
3139  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
3140  sprintf(title,"PP 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3141  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = new TProfile(name,title,20,pTRange,"");
3142  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j]->Sumw2();
3144 
3145  sprintf(name,"fHist_Corr3p_pTDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
3146  sprintf(title,"NN 3p vs |pT1-pT2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3147  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = new TProfile(name,title,20,pTRange,"");
3148  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j]->Sumw2();
3150  }
3151  }
3152 
3153  //Double_t EtaRange[9] = {0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6}; //Use this after tests done
3154  //Now Eta binning: 160,0,1.6 for test
3155 
3156  for(int i=0;i<2;i++){
3157  for(int j=0;j<6;j++){
3158  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0A_PN_Mag%d_Cent%d",i,j);
3159  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3160  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = new TProfile(name,title,160,0,1.6,"");
3161  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j]->Sumw2();
3163 
3164  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0A_PP_Mag%d_Cent%d",i,j);
3165  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3166  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = new TProfile(name,title,160,0,1.6,"");
3167  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j]->Sumw2();
3169 
3170  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0A_NN_Mag%d_Cent%d",i,j);
3171  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3172  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = new TProfile(name,title,160,0,1.6,"");
3173  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j]->Sumw2();
3175  //-----v0c----
3176  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0C_PN_Mag%d_Cent%d",i,j);
3177  sprintf(title,"PN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3178  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = new TProfile(name,title,160,0,1.6,"");
3179  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j]->Sumw2();
3181 
3182  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0C_PP_Mag%d_Cent%d",i,j);
3183  sprintf(title,"PP 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3184  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = new TProfile(name,title,160,0,1.6,"");
3185  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j]->Sumw2();
3187 
3188  sprintf(name,"fHist_Corr3p_EtaDiff_EP_V0C_NN_Mag%d_Cent%d",i,j);
3189  sprintf(title,"NN 3p vs |Eta1-Eta2|, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3190  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = new TProfile(name,title,160,0,1.6,"");
3191  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j]->Sumw2();
3193  }
3194  }
3195 
3196 
3197 
3198 
3199  //non-Isotropic terms for correction:
3200  for(int i=0;i<2;i++){
3201  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,"");
3203  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,"");
3205 
3206  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,"");
3208  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,"");
3210  }
3211 
3212  for(int i=0;i<2;i++){
3213  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,"");
3215  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,"");
3217  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,"");
3219  }
3220 
3221 
3222 
3223 
3224 
3225 
3226 
3227 
3228 
3229  //=========== Calibtation Histograms etc ==================
3230 
3231 
3232 
3234 
3235  fdPhiFemtoCut = new TH1F("fdPhiFemtoCut"," total comb ",5,0,5);
3236  fdPhiFemtoCut->GetXaxis()->SetBinLabel(1,"US Total");
3237  fdPhiFemtoCut->GetXaxis()->SetBinLabel(2,"US Reject");
3238  fdPhiFemtoCut->GetXaxis()->SetBinLabel(3,"LS Total");
3239  fdPhiFemtoCut->GetXaxis()->SetBinLabel(4,"LS Reject");
3240  fListCalibs->Add(fdPhiFemtoCut);
3241 
3242  fVzDistribuion = new TH1F("fVzDistribuion","Vz (cm)",100,-10,10);
3244 
3245  fEventStatvsRun = new TH1F("fEventStatvsRun","Event stat per run",fRunFlag,0,fRunFlag);
3247 
3248  fCentDistvsRun = new TH2F("fCentStatvsRun","Cent Dist. vs run",90,0,90,fRunFlag,0,fRunFlag);
3250 
3251 
3252  fCentV0MvsVzRun = new TProfile2D("fCentV0MvsVzRun","",100,-10,10,fRunFlag,0,fRunFlag);
3254 
3255  fCent3pvsVzRun = new TProfile2D("fCent3pvsVzRun","",100,-10,10,fRunFlag,0,fRunFlag);
3257 
3258  fCentCL1vsVzRun = new TH3F("fCentCL1vsVzRun","",80,-10,10,fRunFlag,0,fRunFlag,20,-10,10);
3260 
3261 
3262 
3263  fTPCvsGlobalTrk = new TH2F("fTPCvsGlobalTrk","ESDTrk vs TPC(FB128)",500,0,5000,500,0,5000);
3265 
3266  fTPCuncutvsGlobal = new TH2F("fTPCuncutvsGlobal","ESDTrk vs ITS(FB96) ",500,0,5000,500,0,5000);
3268 
3269  fTPCvsITSfb96 = new TH2F("fTPCvsITSfb96","FB96 vs TPC(FB128)",500,0,5000,500,0,5000);
3270  fListCalibs->Add(fTPCvsITSfb96);
3271 
3272  fTPCvsITSfb32 = new TH2F("fTPCvsITSfb32","FB32 vs TPC(FB128)",500,0,5000,500,0,5000);
3273  fListCalibs->Add(fTPCvsITSfb32);
3274 
3275  fTPCFEvsITSfb96 = new TH2F("fTPCFEvsITSfb96","FB96 vs TPC(FB1)",500,0,5000,500,0,5000);
3277 
3278  fGlobalTracks = new TH1F("fGlobalTracks","Global Multiplilcity",5000,0,5000);
3279  fListCalibs->Add(fGlobalTracks);
3280 
3281 
3282  //for debug only, remove after stable code
3283  hUnderOverBinNUApos = new TH1F("hUnderOverBinNUApos","",90,0,90);
3285  hUnderOverBinNUAneg = new TH1F("hUnderOverBinNUAneg","",90,0,90);
3287 
3288  Double_t fCentBinQvect[16] = {0.,2.5,5,10,15,20,25,30,35,40,45,50,60,70,80,90};
3289 
3290  fHEnergyZNCvsCent = new TH2F("fHEnergyZNCvsCent","ZNC Energy vs cent",15,fCentBinQvect,4000,0,200000);
3292  fHEnergyZNAvsCent = new TH2F("fHEnergyZNAvsCent","ZNA Energy vs cent",15,fCentBinQvect,4000,0,200000);
3294  fHEnergyZPCvsCent = new TH2F("fHEnergyZPCvsCent","ZPC Energy vs cent",15,fCentBinQvect,2000,0,50000);
3296  fHEnergyZPAvsCent = new TH2F("fHEnergyZPAvsCent","ZPA Energy vs cent",15,fCentBinQvect,2000,0,50000);
3298 
3299  fHEnergyZNCvsCentRun = new TProfile2D("fHEnergyZNCvsCentRun","",90,0,90,fRunFlag,0,fRunFlag);
3301  fHEnergyZNAvsCentRun = new TProfile2D("fHEnergyZNAvsCentRun","",90,0,90,fRunFlag,0,fRunFlag);
3303  fHEnergyZPCvsCentRun = new TProfile2D("fHEnergyZPCvsCentRun","",90,0,90,fRunFlag,0,fRunFlag);
3305  fHEnergyZPAvsCentRun = new TProfile2D("fHEnergyZPAvsCentRun","",90,0,90,fRunFlag,0,fRunFlag);
3307 
3308  fHEnergyZPCvsZPA = new TH2F("fHEnergyZPCvsZPA","ZNC Energy vs cent",500,0,50000,500,0,50000);
3310  fHEnergyZNCvsZNA = new TH2F("fHEnergyZNCvsZNA","ZNC Energy vs cent",500,50000,150000,500,50000,150000);
3312 
3313  fHCentBinTrkRecenter = new TH1F("fHCentBinTrkRecenter","centrality Binning",15,fCentBinQvect);
3314 
3315 
3316 
3317 
3318  Int_t magField[2] = {0,1}; //0 = Neg, 1 = Pos
3319 
3320  for(int i=0;i<2;i++){
3321  fHist_Corr3p_QAEta_SP_V0A_PN[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0A_PN_Mag%d",magField[i]),"PN, Cent 10-20%",80,-0.8,0.8,"");
3322  fHist_Corr3p_QAEta_SP_V0A_PN[i]->Sumw2();
3324  fHist_Corr3p_QAEta_SP_V0A_PP[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0A_PP_Mag%d",magField[i]),"PP, Cent 10-20%",80,-0.8,0.8,"");
3325  fHist_Corr3p_QAEta_SP_V0A_PP[i]->Sumw2();
3327  fHist_Corr3p_QAEta_SP_V0A_NN[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0A_NN_Mag%d",magField[i]),"NN, Cent 10-20%",80,-0.8,0.8,"");
3328  fHist_Corr3p_QAEta_SP_V0A_NN[i]->Sumw2();
3330  }
3331  for(int i=0;i<2;i++){
3332  fHist_Corr3p_QAEta_SP_V0C_PN[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0C_PN_Mag%d",magField[i]),"PN, Cent 10-20%",80,-0.8,0.8,"");
3333  fHist_Corr3p_QAEta_SP_V0C_PN[i]->Sumw2();
3335  fHist_Corr3p_QAEta_SP_V0C_PP[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0C_PP_Mag%d",magField[i]),"PP, Cent 10-20%",80,-0.8,0.8,"");
3336  fHist_Corr3p_QAEta_SP_V0C_PP[i]->Sumw2();
3338  fHist_Corr3p_QAEta_SP_V0C_NN[i] = new TProfile(Form("fHist_Corr3p_QAEta_SP_V0C_NN_Mag%d",magField[i]),"NN, Cent 10-20%",80,-0.8,0.8,"");
3339  fHist_Corr3p_QAEta_SP_V0C_NN[i]->Sumw2();
3341  }
3342 
3343  fEtaBinFinderForQA = new TH1F("fEtaBinFinderForQA","",80,-0.8,0.8);
3345 
3346 
3347 
3348 
3349 
3350 
3351  Int_t suffixEta[4] = {1,0,1,0}; //{"Pos","Neg","Pos","Neg"};
3352  Int_t suffixVz[4] = {1,1,0,0}; //{"Pos","Pos","Neg","Neg"};
3353 
3354  if(bFillAvgTPCQn){
3355  for(int i=0;i<4;i++){
3356  fHCos1nPosChEtaVz[i] = new TProfile2D(Form("fHCos1nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos1n>",90,0,90,fRunFlag,0,fRunFlag);
3357  fListCalibs->Add(fHCos1nPosChEtaVz[i]);
3358  fHSin1nPosChEtaVz[i] = new TProfile2D(Form("fHSin1nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin1n>",90,0,90,fRunFlag,0,fRunFlag);
3359  fListCalibs->Add(fHSin1nPosChEtaVz[i]);
3360  fHCos1nNegChEtaVz[i] = new TProfile2D(Form("fHCos1nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos1n>",90,0,90,fRunFlag,0,fRunFlag);
3361  fListCalibs->Add(fHCos1nNegChEtaVz[i]);
3362  fHSin1nNegChEtaVz[i] = new TProfile2D(Form("fHSin1nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin1n>",90,0,90,fRunFlag,0,fRunFlag);
3363  fListCalibs->Add(fHSin1nNegChEtaVz[i]);
3364  /*
3365  fHCos2nPosChEtaVz[i] = new TProfile2D(Form("fHCos2nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3366  fListCalibs->Add(fHCos2nPosChEtaVz[i]);
3367  fHSin2nPosChEtaVz[i] = new TProfile2D(Form("fHSin2nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin2n>",90,0,90,fRunFlag,0,fRunFlag);
3368  fListCalibs->Add(fHSin2nPosChEtaVz[i]);
3369  fHCos2nNegChEtaVz[i] = new TProfile2D(Form("fHCos2nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3370  fListCalibs->Add(fHCos2nNegChEtaVz[i]);
3371  fHSin2nNegChEtaVz[i] = new TProfile2D(Form("fHSin2nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin2n>",90,0,90,fRunFlag,0,fRunFlag);
3372  fListCalibs->Add(fHSin2nNegChEtaVz[i]);
3373 
3374  fHCos3nPosChEtaVz[i] = new TProfile2D(Form("fHCos3nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos3n>",90,0,90,fRunFlag,0,fRunFlag);
3375  fListCalibs->Add(fHCos3nPosChEtaVz[i]);
3376  fHSin3nPosChEtaVz[i] = new TProfile2D(Form("fHSin3nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin3n>",90,0,90,fRunFlag,0,fRunFlag);
3377  fListCalibs->Add(fHSin3nPosChEtaVz[i]);
3378  fHCos3nNegChEtaVz[i] = new TProfile2D(Form("fHCos3nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos3n>",90,0,90,fRunFlag,0,fRunFlag);
3379  fListCalibs->Add(fHCos3nNegChEtaVz[i]);
3380  fHSin3nNegChEtaVz[i] = new TProfile2D(Form("fHSin3nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin3n>",90,0,90,fRunFlag,0,fRunFlag);
3381  fListCalibs->Add(fHSin3nNegChEtaVz[i]);
3382  */
3383  fHCos4nPosChEtaVz[i] = new TProfile2D(Form("fHCos4nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos4n>",90,0,90,fRunFlag,0,fRunFlag);
3384  fListCalibs->Add(fHCos4nPosChEtaVz[i]);
3385  fHSin4nPosChEtaVz[i] = new TProfile2D(Form("fHSin4nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin4n>",90,0,90,fRunFlag,0,fRunFlag);
3386  fListCalibs->Add(fHSin4nPosChEtaVz[i]);
3387  fHCos4nNegChEtaVz[i] = new TProfile2D(Form("fHCos4nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos4n>",90,0,90,fRunFlag,0,fRunFlag);
3388  fListCalibs->Add(fHCos4nNegChEtaVz[i]);
3389  fHSin4nNegChEtaVz[i] = new TProfile2D(Form("fHSin4nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin4n>",90,0,90,fRunFlag,0,fRunFlag);
3390  fListCalibs->Add(fHSin4nNegChEtaVz[i]);
3391 
3392  //Double weighted <..>
3393  fHCos2nDWPosChEtaVz[i] = new TProfile2D(Form("fHCos2nDWPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3395  fHSin2nDWPosChEtaVz[i] = new TProfile2D(Form("fHSin2nDWPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3397  fHCos2nDWNegChEtaVz[i] = new TProfile2D(Form("fHCos2nDWNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3399  fHSin2nDWNegChEtaVz[i] = new TProfile2D(Form("fHSin2nDWNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3401  }
3402  }
3403 
3404  //fill <Q2x> and <Q2y> track by track: for Test
3405  for(int i=0;i<4;i++){
3406  fHCos2nPosChEtaVz[i] = new TProfile2D(Form("fHCos2nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3407  fListCalibs->Add(fHCos2nPosChEtaVz[i]);
3408  fHSin2nPosChEtaVz[i] = new TProfile2D(Form("fHSin2nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin2n>",90,0,90,fRunFlag,0,fRunFlag);
3409  fListCalibs->Add(fHSin2nPosChEtaVz[i]);
3410  fHCos2nNegChEtaVz[i] = new TProfile2D(Form("fHCos2nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos2n>",90,0,90,fRunFlag,0,fRunFlag);
3411  fListCalibs->Add(fHCos2nNegChEtaVz[i]);
3412  fHSin2nNegChEtaVz[i] = new TProfile2D(Form("fHSin2nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin2n>",90,0,90,fRunFlag,0,fRunFlag);
3413  fListCalibs->Add(fHSin2nNegChEtaVz[i]);
3414 
3415  fHCos3nPosChEtaVz[i] = new TProfile2D(Form("fHCos3nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos3n>",90,0,90,fRunFlag,0,fRunFlag);
3416  fListCalibs->Add(fHCos3nPosChEtaVz[i]);
3417  fHSin3nPosChEtaVz[i] = new TProfile2D(Form("fHSin3nPosChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin3n>",90,0,90,fRunFlag,0,fRunFlag);
3418  fListCalibs->Add(fHSin3nPosChEtaVz[i]);
3419  fHCos3nNegChEtaVz[i] = new TProfile2D(Form("fHCos3nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*cos3n>",90,0,90,fRunFlag,0,fRunFlag);
3420  fListCalibs->Add(fHCos3nNegChEtaVz[i]);
3421  fHSin3nNegChEtaVz[i] = new TProfile2D(Form("fHSin3nNegChEta%dVz%d",suffixEta[i],suffixVz[i]),"<ptw*sin3n>",90,0,90,fRunFlag,0,fRunFlag);
3422  fListCalibs->Add(fHSin3nNegChEtaVz[i]);
3423  }
3424 
3425 
3426 
3427  //Average Multiplicity, same-sign, opposite-sign pair vs Centrality 1% :
3428 
3429  fAvgMultCentRun = new TProfile2D("fAvgMultCentRun","<Mult> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3431  fAvgWgtMultCentRun = new TProfile2D("fAvgWgtMultCentRun","<wgt*Mult> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3433  fAvgPOIposCentRun = new TProfile2D("fAvgPOIposCentRun","<wgt*POIs> ch-pos vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3435  fAvgPOInegCentRun = new TProfile2D("fAvgPOInegCentRun","<wgt*POIs> ch-neg vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3437  fAvgPOIPPCentRun = new TProfile2D("fAvgPOIPPCentRun","<wgt*POIs> Pos-Pos vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3439  fAvgPOINNCentRun = new TProfile2D("fAvgPOINNCentRun","<wgt*POIs> Neg-Neg vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3441  fAvgPOIOSCentRun = new TProfile2D("fAvgPOIOSCentRun","<wgt*POIs> oppo.-sign vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3443 
3444 
3445 
3446  //Store CME run by Run: Not used for huge memory usage.
3447  /*
3448  for(int i=0;i<2;i++){//0=V0A,1=V0C
3449  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,"");
3450  fListHistos->Add(fHist_Corr3p_vsRun_EP_PN[i]);
3451  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,"");
3452  fListHistos->Add(fHist_Corr3p_vsRun_EP_PP[i]);
3453  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,"");
3454  fListHistos->Add(fHist_Corr3p_vsRun_EP_NN[i]);
3455  }*/
3456 
3457 
3458 
3459 
3460 
3461 
3462 
3463 
3464  //======== Following are all type of NUA written in List: fListNUAHist ================
3465 
3466 
3467  //---------- V0 histograms ---------
3468  fV0MultChVsRun = new TProfile2D("fV0MultChVsRun","1-32 V0C, 33-64 V0A",64,0,64,fRunFlag,0,fRunFlag,"");
3470 
3471  fV0AQ2xVsCentRun = new TProfile2D("fV0ACos2nVsCentRun","<Cos2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3473  fV0AQ2yVsCentRun = new TProfile2D("fV0ASin2nVsCentRun","<Sin2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3475  fV0CQ2xVsCentRun = new TProfile2D("fV0CCos2nVsCentRun","<Cos2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3477  fV0CQ2yVsCentRun = new TProfile2D("fV0CSin2nVsCentRun","<Sin2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3479 
3480  fV0AQ3xVsCentRun = new TProfile2D("fV0ACos3nVsCentRun","<Cos3> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3482  fV0AQ3yVsCentRun = new TProfile2D("fV0ASin3nVsCentRun","<Sin3> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3484  fV0CQ3xVsCentRun = new TProfile2D("fV0CCos3nVsCentRun","<Cos3> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3486  fV0CQ3yVsCentRun = new TProfile2D("fV0CSin3nVsCentRun","<Sin3> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3488  //-----------------------------------
3489 
3490 
3491  fTPCQ2xVsCentRun = new TProfile2D("fTPCCos2nVsCentRun","<Cos2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3493  fTPCQ2yVsCentRun = new TProfile2D("fTPCSin2nVsCentRun","<Sin2> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3495 
3496  fTPCQ3xVsCentRun = new TProfile2D("fTPCCos3nVsCentRun","<Cos3> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3498  fTPCQ3yVsCentRun = new TProfile2D("fTPCSin3nVsCentRun","<Sin3> vs cent,Run",90,0,90,fRunFlag,0,fRunFlag,"");
3500 
3501 
3502  for(int i=0;i<10;i++){
3503  sprintf(name,"fHistChPosvsEtaPtRun_Cent%d",i);
3504  sprintf(title,"Pos Ch, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3505  fHistChPosvsEtaPtRun[i] = new TH3F(name,title,25,0.2,5.2,16,-0.8,0.8,fRunFlag,0,fRunFlag);
3507  sprintf(name,"fHistChNegvsEtaPtRun_Cent%d",i);
3508  sprintf(title,"Neg Ch, Cent %2.0f-%2.0f",centRange[i],centRange[i+1]);
3509  fHistChNegvsEtaPtRun[i] = new TH3F(name,title,25,0.2,5.2,16,-0.8,0.8,fRunFlag,0,fRunFlag);
3511  }
3512 
3513 
3514  Int_t gCentForNUA[6] = {0,5,10,20,40,90};
3515 
3516  if(bFillEtaPhiNUA) {
3517  for(int i=0;i<5;i++){
3518  for(int j=0;j<fRunFlag;j++){
3519  sprintf(name,"fHistEtaPhiVz_Pos_Cent%d_Run%d",i,runNums[j]);
3520  sprintf(title,"eta,phi,Vz Pos Cent%d-%d%%",gCentForNUA[i],gCentForNUA[i+1]);
3521  fHist3DEtaPhiVz_Pos_Run[i][j] = new TH3F(name,title,10,-10,10,50,0,6.283185,16,-0.8,0.8);
3523 
3524  sprintf(name,"fHistEtaPhiVz_Neg_Cent%d_Run%d",i,runNums[j]);
3525  sprintf(title,"eta,phi,Vz Pos Cent%d-%d%%",gCentForNUA[i],gCentForNUA[i+1]);
3526  fHist3DEtaPhiVz_Neg_Run[i][j] = new TH3F(name,title,10,-10,10,50,0,6.283185,16,-0.8,0.8);
3528  }
3529  }
3530  }
3531 
3532  fVzBinFinderForNUA = new TH1F("fVzBinFinderForNUA","",4,-10,10); //only needed for pT dependent NUA.
3534 
3535  /*
3536  // pT Dependent NUA correction:
3537  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};
3538  Double_t etabinNUA[9] = {-0.8,-0.6,-0.4,-0.2,0.0,0.2,0.4,0.6,0.8};
3539  Double_t phibinNUA[51] = {0.,};
3540  Double_t fPhi = 6.2832/50;
3541  for(int i=0;i<51;i++){
3542  phibinNUA[i] = fPhi*i;
3543  }
3544 
3545  if(bFillEtaPhiNUA) {
3546  for(int i=0;i<5;i++){
3547  for(int j=0;j<fRunFlag;j++){
3548  sprintf(name,"fHistEtaPhiPt_Pos_Vz%d_Run%d",i,runNums[j]);
3549  sprintf(title,"eta,phi,Pt Pos Vz%d",i);
3550  fHist3DEtaPhiVz_Pos_Run[i][j] = new TH3F(name,title,15,pTbinNUA,50,phibinNUA,8,etabinNUA);
3551  fListNUAHist->Add(fHist3DEtaPhiVz_Pos_Run[i][j]);
3552 
3553  sprintf(name,"fHistEtaPhiPt_Neg_Vz%d_Run%d",i,runNums[j]);
3554  sprintf(title,"eta,phi,Pt Pos Vz%d",i);
3555  fHist3DEtaPhiVz_Neg_Run[i][j] = new TH3F(name,title,15,pTbinNUA,50,phibinNUA,8,etabinNUA);
3556  fListNUAHist->Add(fHist3DEtaPhiVz_Neg_Run[i][j]);
3557  }
3558  }
3559  } */
3560 
3561 
3562 
3563 }
3564 
3565 
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]
Float_t GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1, Float_t phi2, Float_t pt2, Float_t charge2, Float_t radius, Float_t bSign)
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.