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