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