AliPhysics  608b256 (608b256)
AliAnalysisTaskCMEMC.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id: AliAnalysisTaskCMEMC.cxx Rihan Haque 14/02/2018 $ */
17 
18 //-- general include---
19 #include "TChain.h"
20 #include "TTree.h"
21 #include "TGrid.h"
22 #include "TROOT.h"
23 #include "TObjArray.h"
24 #include "TMatrixDSym.h"
25 
26 #include "TMath.h"
27 #include "stdio.h"
28 #include "Riostream.h"
29 
30 //---- manager and handler---
31 #include "AliAnalysisManager.h"
32 #include "AliInputEventHandler.h"
33 
34 //---V0 and ZDC info---
35 #include "AliAODZDC.h"
36 #include "AliAODVZERO.h"
37 #include "AliAODVertex.h"
38 
39 //---AOD,ESD,MC event--
40 #include "AliMCEvent.h"
41 #include "AliAODMCParticle.h"
42 #include "AliAODMCHeader.h"
43 #include "AliGenEventHeader.h"
44 #include "AliESDEvent.h"
45 #include "AliAODHeader.h"
46 #include "AliAODEvent.h"
47 #include "AliAODTrack.h"
48 
49 //----for PID-----
50 #include "AliPIDResponse.h"
51 #include "AliPIDCombined.h"
52 
53 //----- Vevent and tracks
54 #include "AliVEventHandler.h"
55 #include "AliVEvent.h"
56 #include "AliVTrack.h"
57 #include "AliVParticle.h"
58 #include "AliCentrality.h"
59 
60 //----- must include-------
61 #include "AliMultSelection.h"
62 #include "AliAnalysisUtils.h"
63 #include "AliPhysicsSelection.h"
64 #include "AliFlowEventSimple.h"
65 #include "AliAnalysisTaskSE.h"
66 #include "AliAnalysisTaskCMEMC.h"
67 
68 //using namespace std;
69 
70 using std::cout;
71 using std::endl;
72 using std::vector;
73 
74 
75 ClassImp(AliAnalysisTaskCMEMC)
76 
77 
79  fVevent(NULL),
80  fESD(NULL),
81  fAOD(NULL),
82  fPIDResponse(NULL),
83  fMultSelection(NULL),
84  fAnalysisUtil(NULL),
85  fListHist(NULL),
86  mfileFBHijing(NULL),
87  fListFBHijing(NULL),
88  fListNUACorr(NULL),
89  fListV0MCorr(NULL),
90  fHistTaskConfigParameters(NULL),
91  fHistPileUpCount(NULL),
92  fHistMultSelPUCount(NULL),
93  fHistEtaPtBefore(NULL),
94  fHistEtaPtAfter(NULL),
95  fHistTPCvsGlobalMultBefore(NULL),
96  fHistTPCvsGlobalMultAfter(NULL),
97  fHistTPCdEdxvsPBefore(NULL),
98  fHistTPCdEdxvsPAfter(NULL),
99  fHistTOFBetavsPBefore(NULL),
100  fHistTOFBetavsPAfter(NULL),
101  fHistTOFMassvsPtBefore(NULL),
102  fHistTOFMatchCount(NULL),
103  fHistTPCVsESDTrkBefore(NULL),
104  fHistTPCVsESDTrkAfter(NULL),
105  fHistTPConlyVsCL1Before(NULL),
106  fHistTPConlyVsV0MBefore(NULL),
107  fHistTPConlyVsCL1After(NULL),
108  fHistTPConlyVsV0MAfter(NULL),
109  fHistGlobalVsV0MBefore(NULL),
110  fHistGlobalVsV0MAfter(NULL),
111  fHistRawVsCorrMultFB(NULL),
112  hCentvsTPCmultCuts(NULL),
113  fHV0AEventPlaneVsCent(NULL),
114  fHV0CEventPlaneVsCent(NULL),
115  fHTPCAEventPlaneVsCent(NULL),
116  fHTPCCEventPlaneVsCent(NULL),
117  fHTPCEventPlaneVsCent(NULL),
118  fV0MultChVsRun(NULL),
119  fCentDistBefore(NULL),
120  fCentDistAfter(NULL),
121  fHCorrectV0M(NULL),
122  fHAvgerageQnV0A(NULL),
123  fHAvgerageQnV0C(NULL),
124  fHCentWeightForRun(NULL),
125  fQAEtaPhiAfterNUA(NULL),
126  fQAEtaPhiAfterNUAPion(NULL),
127  fQAEtaPhiAfterNUAKaon(NULL),
128  fQAEtaPhiAfterNUAProton(NULL),
129  fV0AQ2xVsCentRun(NULL),
130  fV0AQ2yVsCentRun(NULL),
131  fV0CQ2xVsCentRun(NULL),
132  fV0CQ2yVsCentRun(NULL),
133  fV0AQ3xVsCentRun(NULL),
134  fV0AQ3yVsCentRun(NULL),
135  fV0CQ3xVsCentRun(NULL),
136  fV0CQ3yVsCentRun(NULL),
137  fTPCAQ2xVsCentRun(NULL),
138  fTPCAQ2yVsCentRun(NULL),
139  fTPCCQ2xVsCentRun(NULL),
140  fTPCCQ2yVsCentRun(NULL),
141  fTPCAQ3xVsCentRun(NULL),
142  fTPCAQ3yVsCentRun(NULL),
143  fTPCCQ3xVsCentRun(NULL),
144  fTPCCQ3yVsCentRun(NULL),
145  fTPCAQ4xVsCentRun(NULL),
146  fTPCAQ4yVsCentRun(NULL),
147  fTPCCQ4xVsCentRun(NULL),
148  fTPCCQ4yVsCentRun(NULL),
149  fTPCFQ2xVsCentRun(NULL),
150  fTPCFQ2yVsCentRun(NULL),
151  fFilterBit(1),
152  gN(1),
153  gM(1),
154  gPsiN(2),
155  fOldRunNum(111),
156  fEventCount(0),
157  fTPCclustMin(70),
158  fNSigmaCut(2),
159  fMinPtCut(0.2),
160  fMaxPtCut(5.0),
161  fMinEtaCut(-0.8),
162  fMaxEtaCut(0.8),
163  fTrkChi2Min(0.1),
164  fDCAxyMax(2.4),
165  fDCAzMax(3.2),
166  fdEdxMin(10.),
167  fCentralityPercentMin(0),
168  fCentralityPercentMax(90),
169  fPileUpSlopeParm(3.43),
170  fPileUpConstParm(43),
171  fMinVzCut(-10.0),
172  fMaxVzCut(10.0),
173  bApplyMCcorr(kFALSE),
174  bV0MGainCorr(kFALSE),
175  bSkipPileUpCut(kFALSE),
176  bFillNUAHistPID(kFALSE),
177  bUseKinkTracks(kFALSE),
178  sPathOfMCFile("/alien"),
179  sNucleiTP("PbPb"),
180  sCentrEstimator("V0M"),
181  fHistEventCount(NULL)
182 {
183  for(int i=0;i<4;i++){
184  for(int j=0;j<10;j++){
185  fHistPtwithoutPIDcut[i][j]=NULL;
186  fHistPtwithTPCNsigma[i][j]=NULL;
187  fHistPtwithTPCTOFNsigma[i][j]=NULL;
188  fHistPtwithNoPIDCuts[i][j]=NULL;
189  }
190  }
191  for(int i=0;i<3;i++){
192  fHistPtwithTOFSignal[i]=NULL;
193  fHistTOFnSigmavsPtAfter[i]=NULL;
194  fHistTPCnSigmavsPtAfter[i]=NULL;
195  fHistTPCTOFnSigmavsPtAfter[i]=NULL;
196  fHistTPCdEdxvsPtPIDAfter[i]=NULL;
197  V2IntProQC[i]=NULL;
198  fResolution_TPCEP[i]=NULL;
199  }
200  for(int i=0;i<8;i++){
201  fDnnPro[i] = NULL;
202  fCMEPro[i] = NULL;
203  }
204  for(int i=0;i<5;i++){
205  fHCorrectNUApos[i] = NULL;
206  fHCorrectNUAneg[i] = NULL;
207  }
208  for(int i=0;i<5;i++){ // for PID
209  fHCorrectNUAposPion[i] = NULL;
210  fHCorrectNUAnegPion[i] = NULL;
211  fHCorrectNUAposKaon[i] = NULL;
212  fHCorrectNUAnegKaon[i] = NULL;
213  fHCorrectNUAposProton[i] = NULL;
214  fHCorrectNUAnegProton[i] = NULL;
215  }
216  //3p vs centrality
217  for(int i=0;i<2;i++){
218  for(int j=0;j<4;j++){
219  fHist_Corr3p_EP_Norm_PN[i][j] = NULL;
220  fHist_Corr3p_EP_Norm_PP[i][j] = NULL;
221  fHist_Corr3p_EP_Norm_NN[i][j] = NULL;
222  }
223  for(int j=0;j<4;j++) {
224  fHist_Reso2n_EP_Norm_Det[i][j] = NULL;
225  }
226  //PID:
227  for(int j=0;j<4;j++){
228  fHist_Corr3p_Pion_EP_Norm_PN[i][j] = NULL;
229  fHist_Corr3p_Pion_EP_Norm_PP[i][j] = NULL;
230  fHist_Corr3p_Pion_EP_Norm_NN[i][j] = NULL;
231  fHist_Corr3p_Kaon_EP_Norm_PN[i][j] = NULL;
232  fHist_Corr3p_Kaon_EP_Norm_PP[i][j] = NULL;
233  fHist_Corr3p_Kaon_EP_Norm_NN[i][j] = NULL;
234  fHist_Corr3p_Proton_EP_Norm_PN[i][j] = NULL;
235  fHist_Corr3p_Proton_EP_Norm_PP[i][j] = NULL;
236  fHist_Corr3p_Proton_EP_Norm_NN[i][j] = NULL;
237  }
238  }
239  //3p vs RefMult
240  for(int i=0;i<2;i++){
241  for(int j=0;j<4;j++){
242  fHist_Corr3p_EP_Refm_PN[i][j] = NULL;
243  fHist_Corr3p_EP_Refm_PP[i][j] = NULL;
244  fHist_Corr3p_EP_Refm_NN[i][j] = NULL;
245  }
246  for(int j=0;j<4;j++) {
247  fHist_Reso2n_EP_Refm_Det[i][j] = NULL;
248  }
249  //PID:
250  for(int j=0;j<4;j++){
251  fHist_Corr3p_Pion_EP_Refm_PN[i][j] = NULL;
252  fHist_Corr3p_Pion_EP_Refm_PP[i][j] = NULL;
253  fHist_Corr3p_Pion_EP_Refm_NN[i][j] = NULL;
254  fHist_Corr3p_Kaon_EP_Refm_PN[i][j] = NULL;
255  fHist_Corr3p_Kaon_EP_Refm_PP[i][j] = NULL;
256  fHist_Corr3p_Kaon_EP_Refm_NN[i][j] = NULL;
257  fHist_Corr3p_Proton_EP_Refm_PN[i][j] = NULL;
258  fHist_Corr3p_Proton_EP_Refm_PP[i][j] = NULL;
259  fHist_Corr3p_Proton_EP_Refm_NN[i][j] = NULL;
260  }
261  }
262 
263 
264 //2p vs Centrality:
265  for(int i=0;i<2;i++){
266  for(int j=0;j<4;j++){
267  fHist_Corr2p_EP_Norm_PN[i][j] = NULL;
268  fHist_Corr2p_EP_Norm_PP[i][j] = NULL;
269  fHist_Corr2p_EP_Norm_NN[i][j] = NULL;
270  }
271  //PID:
272  for(int j=0;j<4;j++){
273  fHist_Corr2p_Pion_EP_Norm_PN[i][j] = NULL;
274  fHist_Corr2p_Pion_EP_Norm_PP[i][j] = NULL;
275  fHist_Corr2p_Pion_EP_Norm_NN[i][j] = NULL;
276  fHist_Corr2p_Kaon_EP_Norm_PN[i][j] = NULL;
277  fHist_Corr2p_Kaon_EP_Norm_PP[i][j] = NULL;
278  fHist_Corr2p_Kaon_EP_Norm_NN[i][j] = NULL;
279  fHist_Corr2p_Proton_EP_Norm_PN[i][j] = NULL;
280  fHist_Corr2p_Proton_EP_Norm_PP[i][j] = NULL;
281  fHist_Corr2p_Proton_EP_Norm_NN[i][j] = NULL;
282  }
283  }
284 
285 //2p vs Refm:
286  for(int i=0;i<2;i++){
287  for(int j=0;j<4;j++){
288  fHist_Corr2p_EP_Refm_PN[i][j] = NULL;
289  fHist_Corr2p_EP_Refm_PP[i][j] = NULL;
290  fHist_Corr2p_EP_Refm_NN[i][j] = NULL;
291  }
292  //PID:
293  for(int j=0;j<4;j++){
294  fHist_Corr2p_Pion_EP_Refm_PN[i][j] = NULL;
295  fHist_Corr2p_Pion_EP_Refm_PP[i][j] = NULL;
296  fHist_Corr2p_Pion_EP_Refm_NN[i][j] = NULL;
297  fHist_Corr2p_Kaon_EP_Refm_PN[i][j] = NULL;
298  fHist_Corr2p_Kaon_EP_Refm_PP[i][j] = NULL;
299  fHist_Corr2p_Kaon_EP_Refm_NN[i][j] = NULL;
300  fHist_Corr2p_Proton_EP_Refm_PN[i][j] = NULL;
301  fHist_Corr2p_Proton_EP_Refm_PP[i][j] = NULL;
302  fHist_Corr2p_Proton_EP_Refm_NN[i][j] = NULL;
303  }
304  }
305 
306 
307 
308 
309 
310 
311 
312 
313 
314 
315  //Differential 3p Charge:
316  for(int i=0;i<2;i++){
317  for(int j=0;j<6;j++){
318  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = NULL;
319  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = NULL;
320  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = NULL;
321  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = NULL;
322  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = NULL;
323  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = NULL;
324 
325  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = NULL;
326  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = NULL;
327  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = NULL;
328  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = NULL;
329  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = NULL;
330  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = NULL;
331 
332  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = NULL;
333  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = NULL;
334  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = NULL;
335  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = NULL;
336  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = NULL;
337  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = NULL;
338  }
339  }
340  //Differential 3p PID:
341  for(int i=0;i<2;i++){
342  for(int j=0;j<6;j++){
343  //Pion
344  fHist_Corr3p_Pion_pTSum_EP_V0A_PN[i][j] = NULL;
345  fHist_Corr3p_Pion_pTSum_EP_V0A_PP[i][j] = NULL;
346  fHist_Corr3p_Pion_pTSum_EP_V0A_NN[i][j] = NULL;
347  fHist_Corr3p_Pion_pTSum_EP_V0C_PN[i][j] = NULL;
348  fHist_Corr3p_Pion_pTSum_EP_V0C_PP[i][j] = NULL;
349  fHist_Corr3p_Pion_pTSum_EP_V0C_NN[i][j] = NULL;
350 
351  fHist_Corr3p_Pion_pTDiff_EP_V0A_PN[i][j] = NULL;
352  fHist_Corr3p_Pion_pTDiff_EP_V0A_PP[i][j] = NULL;
353  fHist_Corr3p_Pion_pTDiff_EP_V0A_NN[i][j] = NULL;
354  fHist_Corr3p_Pion_pTDiff_EP_V0C_PN[i][j] = NULL;
355  fHist_Corr3p_Pion_pTDiff_EP_V0C_PP[i][j] = NULL;
356  fHist_Corr3p_Pion_pTDiff_EP_V0C_NN[i][j] = NULL;
357 
358  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PN[i][j] = NULL;
359  fHist_Corr3p_Pion_EtaDiff_EP_V0A_PP[i][j] = NULL;
360  fHist_Corr3p_Pion_EtaDiff_EP_V0A_NN[i][j] = NULL;
361  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PN[i][j] = NULL;
362  fHist_Corr3p_Pion_EtaDiff_EP_V0C_PP[i][j] = NULL;
363  fHist_Corr3p_Pion_EtaDiff_EP_V0C_NN[i][j] = NULL;
364  //Kaon
365  fHist_Corr3p_Kaon_pTSum_EP_V0A_PN[i][j] = NULL;
366  fHist_Corr3p_Kaon_pTSum_EP_V0A_PP[i][j] = NULL;
367  fHist_Corr3p_Kaon_pTSum_EP_V0A_NN[i][j] = NULL;
368  fHist_Corr3p_Kaon_pTSum_EP_V0C_PN[i][j] = NULL;
369  fHist_Corr3p_Kaon_pTSum_EP_V0C_PP[i][j] = NULL;
370  fHist_Corr3p_Kaon_pTSum_EP_V0C_NN[i][j] = NULL;
371 
372  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PN[i][j] = NULL;
373  fHist_Corr3p_Kaon_pTDiff_EP_V0A_PP[i][j] = NULL;
374  fHist_Corr3p_Kaon_pTDiff_EP_V0A_NN[i][j] = NULL;
375  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PN[i][j] = NULL;
376  fHist_Corr3p_Kaon_pTDiff_EP_V0C_PP[i][j] = NULL;
377  fHist_Corr3p_Kaon_pTDiff_EP_V0C_NN[i][j] = NULL;
378 
379  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PN[i][j] = NULL;
380  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PP[i][j] = NULL;
381  fHist_Corr3p_Kaon_EtaDiff_EP_V0A_NN[i][j] = NULL;
382  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PN[i][j] = NULL;
383  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PP[i][j] = NULL;
384  fHist_Corr3p_Kaon_EtaDiff_EP_V0C_NN[i][j] = NULL;
385  //Proton
386  fHist_Corr3p_Proton_pTSum_EP_V0A_PN[i][j] = NULL;
387  fHist_Corr3p_Proton_pTSum_EP_V0A_PP[i][j] = NULL;
388  fHist_Corr3p_Proton_pTSum_EP_V0A_NN[i][j] = NULL;
389  fHist_Corr3p_Proton_pTSum_EP_V0C_PN[i][j] = NULL;
390  fHist_Corr3p_Proton_pTSum_EP_V0C_PP[i][j] = NULL;
391  fHist_Corr3p_Proton_pTSum_EP_V0C_NN[i][j] = NULL;
392 
393  fHist_Corr3p_Proton_pTDiff_EP_V0A_PN[i][j] = NULL;
394  fHist_Corr3p_Proton_pTDiff_EP_V0A_PP[i][j] = NULL;
395  fHist_Corr3p_Proton_pTDiff_EP_V0A_NN[i][j] = NULL;
396  fHist_Corr3p_Proton_pTDiff_EP_V0C_PN[i][j] = NULL;
397  fHist_Corr3p_Proton_pTDiff_EP_V0C_PP[i][j] = NULL;
398  fHist_Corr3p_Proton_pTDiff_EP_V0C_NN[i][j] = NULL;
399 
400  fHist_Corr3p_Proton_EtaDiff_EP_V0A_PN[i][j] = NULL;
401  fHist_Corr3p_Proton_EtaDiff_EP_V0A_PP[i][j] = NULL;
402  fHist_Corr3p_Proton_EtaDiff_EP_V0A_NN[i][j] = NULL;
403  fHist_Corr3p_Proton_EtaDiff_EP_V0C_PN[i][j] = NULL;
404  fHist_Corr3p_Proton_EtaDiff_EP_V0C_PP[i][j] = NULL;
405  fHist_Corr3p_Proton_EtaDiff_EP_V0C_NN[i][j] = NULL;
406  }
407  }
408 
409 
410 
411  //Differential 2p Charge:
412  for(int i=0;i<2;i++){
413  for(int j=0;j<6;j++){
414  fHist_Corr2p_pTSum_EP_Harm1_PN[i][j] = NULL;
415  fHist_Corr2p_pTSum_EP_Harm1_PP[i][j] = NULL;
416  fHist_Corr2p_pTSum_EP_Harm1_NN[i][j] = NULL;
417  fHist_Corr2p_pTSum_EP_Harm2_PN[i][j] = NULL;
418  fHist_Corr2p_pTSum_EP_Harm2_PP[i][j] = NULL;
419  fHist_Corr2p_pTSum_EP_Harm2_NN[i][j] = NULL;
420 
421  fHist_Corr2p_pTDiff_EP_Harm1_PN[i][j] = NULL;
422  fHist_Corr2p_pTDiff_EP_Harm1_PP[i][j] = NULL;
423  fHist_Corr2p_pTDiff_EP_Harm1_NN[i][j] = NULL;
424  fHist_Corr2p_pTDiff_EP_Harm2_PN[i][j] = NULL;
425  fHist_Corr2p_pTDiff_EP_Harm2_PP[i][j] = NULL;
426  fHist_Corr2p_pTDiff_EP_Harm2_NN[i][j] = NULL;
427 
428  fHist_Corr2p_EtaDiff_EP_Harm1_PN[i][j] = NULL;
429  fHist_Corr2p_EtaDiff_EP_Harm1_PP[i][j] = NULL;
430  fHist_Corr2p_EtaDiff_EP_Harm1_NN[i][j] = NULL;
431  fHist_Corr2p_EtaDiff_EP_Harm2_PN[i][j] = NULL;
432  fHist_Corr2p_EtaDiff_EP_Harm2_PP[i][j] = NULL;
433  fHist_Corr2p_EtaDiff_EP_Harm2_NN[i][j] = NULL;
434  }
435  }
436 
437 
438 
439 
440 
441  for(int i=0;i<4;i++){
442  for(int j=0;j<5;j++){
443  fHist3DEtaPhiVz_Pos_Run[i][j]=NULL;
444  fHist3DEtaPhiVz_Neg_Run[i][j]=NULL;
445  }
446  }
447  for(int i=0;i<10;i++){
448  fFB_Efficiency_Cent[i] = NULL;
449  fFB_Efficiency_Pion_Cent[i] = NULL;
450  fFB_Efficiency_Kaon_Cent[i] = NULL;
451  fFB_Efficiency_Proton_Cent[i] = NULL;
452  }
453 
454 
455  DefineInput(0,TChain::Class());
456  DefineOutput(1,TList::Class());
457 }
458 //______________________________empty constructor_______________________
461  fVevent(NULL),
462  fESD(NULL),
463  fAOD(NULL),
464  fPIDResponse(NULL),
465  fMultSelection(NULL),
466  fAnalysisUtil(NULL),
467  fListHist(NULL),
468  mfileFBHijing(NULL),
469  fListFBHijing(NULL),
470  fListNUACorr(NULL),
471  fListV0MCorr(NULL),
472  fHistTaskConfigParameters(NULL),
473  fHistPileUpCount(NULL),
474  fHistMultSelPUCount(NULL),
475  fHistEtaPtBefore(NULL),
476  fHistEtaPtAfter(NULL),
477  fHistTPCvsGlobalMultBefore(NULL),
478  fHistTPCvsGlobalMultAfter(NULL),
479  fHistTPCdEdxvsPBefore(NULL),
480  fHistTPCdEdxvsPAfter(NULL),
481  fHistTOFBetavsPBefore(NULL),
482  fHistTOFBetavsPAfter(NULL),
483  fHistTOFMassvsPtBefore(NULL),
484  fHistTOFMatchCount(NULL),
485  fHistTPCVsESDTrkBefore(NULL),
486  fHistTPCVsESDTrkAfter(NULL),
487  fHistTPConlyVsCL1Before(NULL),
488  fHistTPConlyVsV0MBefore(NULL),
489  fHistTPConlyVsCL1After(NULL),
490  fHistTPConlyVsV0MAfter(NULL),
491  fHistGlobalVsV0MBefore(NULL),
492  fHistGlobalVsV0MAfter(NULL),
493  fHistRawVsCorrMultFB(NULL),
494  hCentvsTPCmultCuts(NULL),
495  fHV0AEventPlaneVsCent(NULL),
496  fHV0CEventPlaneVsCent(NULL),
497  fHTPCAEventPlaneVsCent(NULL),
498  fHTPCCEventPlaneVsCent(NULL),
499  fHTPCEventPlaneVsCent(NULL),
500  fV0MultChVsRun(NULL),
501  fCentDistBefore(NULL),
502  fCentDistAfter(NULL),
503  fHCorrectV0M(NULL),
504  fHAvgerageQnV0A(NULL),
505  fHAvgerageQnV0C(NULL),
506  fHCentWeightForRun(NULL),
507  fQAEtaPhiAfterNUA(NULL),
508  fQAEtaPhiAfterNUAPion(NULL),
509  fQAEtaPhiAfterNUAKaon(NULL),
510  fQAEtaPhiAfterNUAProton(NULL),
511  fV0AQ2xVsCentRun(NULL),
512  fV0AQ2yVsCentRun(NULL),
513  fV0CQ2xVsCentRun(NULL),
514  fV0CQ2yVsCentRun(NULL),
515  fV0AQ3xVsCentRun(NULL),
516  fV0AQ3yVsCentRun(NULL),
517  fV0CQ3xVsCentRun(NULL),
518  fV0CQ3yVsCentRun(NULL),
519  fTPCAQ2xVsCentRun(NULL),
520  fTPCAQ2yVsCentRun(NULL),
521  fTPCCQ2xVsCentRun(NULL),
522  fTPCCQ2yVsCentRun(NULL),
523  fTPCAQ3xVsCentRun(NULL),
524  fTPCAQ3yVsCentRun(NULL),
525  fTPCCQ3xVsCentRun(NULL),
526  fTPCCQ3yVsCentRun(NULL),
527  fTPCAQ4xVsCentRun(NULL),
528  fTPCAQ4yVsCentRun(NULL),
529  fTPCCQ4xVsCentRun(NULL),
530  fTPCCQ4yVsCentRun(NULL),
531  fTPCFQ2xVsCentRun(NULL),
532  fTPCFQ2yVsCentRun(NULL),
533  fFilterBit(1),
534  gN(1),
535  gM(1),
536  gPsiN(2),
537  fOldRunNum(111),
538  fEventCount(0),
539  fTPCclustMin(70),
540  fNSigmaCut(2),
541  fMinPtCut(0.2),
542  fMaxPtCut(5.0),
543  fMinEtaCut(-0.8),
544  fMaxEtaCut(0.8),
545  fTrkChi2Min(0.1),
546  fDCAxyMax(2.4),
547  fDCAzMax(3.2),
548  fdEdxMin(10.),
549  fCentralityPercentMin(0),
550  fCentralityPercentMax(90),
551  fPileUpSlopeParm(3.43),
552  fPileUpConstParm(43),
553  fMinVzCut(-10.0),
554  fMaxVzCut(10.0),
555  bApplyMCcorr(kFALSE),
556  bV0MGainCorr(kFALSE),
557  bSkipPileUpCut(kFALSE),
558  bFillNUAHistPID(kFALSE),
559  bUseKinkTracks(kFALSE),
560  sPathOfMCFile("/alien"),
561  sNucleiTP("PbPb"),
562  sCentrEstimator("V0M"),
563  fHistEventCount(NULL)
564 {
565  for(int i=0;i<4;i++){
566  for(int j=0;j<10;j++){
567  fHistPtwithoutPIDcut[i][j]=NULL;
568  fHistPtwithTPCNsigma[i][j]=NULL;
569  fHistPtwithTPCTOFNsigma[i][j]=NULL;
570  fHistPtwithNoPIDCuts[i][j]=NULL;
571  }
572  }
573  for(int i=0;i<3;i++){
574  fHistPtwithTOFSignal[i]=NULL;
575  fHistTOFnSigmavsPtAfter[i]=NULL;
576  fHistTPCnSigmavsPtAfter[i]=NULL;
578  fHistTPCdEdxvsPtPIDAfter[i]=NULL;
579  V2IntProQC[i]=NULL;
580  fResolution_TPCEP[i]=NULL;
581  }
582  for(int i=0;i<8;i++){
583  fDnnPro[i] = NULL;
584  fCMEPro[i] = NULL;
585  }
586  for(int i=0;i<5;i++){
587  fHCorrectNUApos[i] = NULL;
588  fHCorrectNUAneg[i] = NULL;
589  }
590  for(int i=0;i<5;i++){ // for PID NUA
591  fHCorrectNUAposPion[i] = NULL;
592  fHCorrectNUAnegPion[i] = NULL;
593  fHCorrectNUAposKaon[i] = NULL;
594  fHCorrectNUAnegKaon[i] = NULL;
595  fHCorrectNUAposProton[i] = NULL;
596  fHCorrectNUAnegProton[i] = NULL;
597  }
598  //3p vs Centrality
599  for(int i=0;i<2;i++){
600  for(int j=0;j<4;j++){
601  fHist_Corr3p_EP_Norm_PN[i][j] = NULL;
602  fHist_Corr3p_EP_Norm_PP[i][j] = NULL;
603  fHist_Corr3p_EP_Norm_NN[i][j] = NULL;
604  }
605  for(int j=0;j<4;j++) {
606  fHist_Reso2n_EP_Norm_Det[i][j] = NULL;
607  }
608  //PID:
609  for(int j=0;j<4;j++){
610  fHist_Corr3p_Pion_EP_Norm_PN[i][j] = NULL;
611  fHist_Corr3p_Pion_EP_Norm_PP[i][j] = NULL;
612  fHist_Corr3p_Pion_EP_Norm_NN[i][j] = NULL;
613  fHist_Corr3p_Kaon_EP_Norm_PN[i][j] = NULL;
614  fHist_Corr3p_Kaon_EP_Norm_PP[i][j] = NULL;
615  fHist_Corr3p_Kaon_EP_Norm_NN[i][j] = NULL;
616  fHist_Corr3p_Proton_EP_Norm_PN[i][j] = NULL;
617  fHist_Corr3p_Proton_EP_Norm_PP[i][j] = NULL;
618  fHist_Corr3p_Proton_EP_Norm_NN[i][j] = NULL;
619  }
620  }
621  //3p vs RefMult
622  for(int i=0;i<2;i++){
623  for(int j=0;j<4;j++){
624  fHist_Corr3p_EP_Refm_PN[i][j] = NULL;
625  fHist_Corr3p_EP_Refm_PP[i][j] = NULL;
626  fHist_Corr3p_EP_Refm_NN[i][j] = NULL;
627  }
628  for(int j=0;j<4;j++) {
629  fHist_Reso2n_EP_Refm_Det[i][j] = NULL;
630  }
631  //PID:
632  for(int j=0;j<4;j++){
633  fHist_Corr3p_Pion_EP_Refm_PN[i][j] = NULL;
634  fHist_Corr3p_Pion_EP_Refm_PP[i][j] = NULL;
635  fHist_Corr3p_Pion_EP_Refm_NN[i][j] = NULL;
636  fHist_Corr3p_Kaon_EP_Refm_PN[i][j] = NULL;
637  fHist_Corr3p_Kaon_EP_Refm_PP[i][j] = NULL;
638  fHist_Corr3p_Kaon_EP_Refm_NN[i][j] = NULL;
639  fHist_Corr3p_Proton_EP_Refm_PN[i][j] = NULL;
640  fHist_Corr3p_Proton_EP_Refm_PP[i][j] = NULL;
641  fHist_Corr3p_Proton_EP_Refm_NN[i][j] = NULL;
642  }
643  }
644 
645 
646 
647 //2p vs Centrality:
648  for(int i=0;i<2;i++){
649  for(int j=0;j<4;j++){
650  fHist_Corr2p_EP_Norm_PN[i][j] = NULL;
651  fHist_Corr2p_EP_Norm_PP[i][j] = NULL;
652  fHist_Corr2p_EP_Norm_NN[i][j] = NULL;
653  }
654  //PID:
655  for(int j=0;j<4;j++){
656  fHist_Corr2p_Pion_EP_Norm_PN[i][j] = NULL;
657  fHist_Corr2p_Pion_EP_Norm_PP[i][j] = NULL;
658  fHist_Corr2p_Pion_EP_Norm_NN[i][j] = NULL;
659  fHist_Corr2p_Kaon_EP_Norm_PN[i][j] = NULL;
660  fHist_Corr2p_Kaon_EP_Norm_PP[i][j] = NULL;
661  fHist_Corr2p_Kaon_EP_Norm_NN[i][j] = NULL;
662  fHist_Corr2p_Proton_EP_Norm_PN[i][j] = NULL;
663  fHist_Corr2p_Proton_EP_Norm_PP[i][j] = NULL;
664  fHist_Corr2p_Proton_EP_Norm_NN[i][j] = NULL;
665  }
666  }
667 //2p vs Refm:
668  for(int i=0;i<2;i++){
669  for(int j=0;j<4;j++){
670  fHist_Corr2p_EP_Refm_PN[i][j] = NULL;
671  fHist_Corr2p_EP_Refm_PP[i][j] = NULL;
672  fHist_Corr2p_EP_Refm_NN[i][j] = NULL;
673  }
674  //PID:
675  for(int j=0;j<4;j++){
676  fHist_Corr2p_Pion_EP_Refm_PN[i][j] = NULL;
677  fHist_Corr2p_Pion_EP_Refm_PP[i][j] = NULL;
678  fHist_Corr2p_Pion_EP_Refm_NN[i][j] = NULL;
679  fHist_Corr2p_Kaon_EP_Refm_PN[i][j] = NULL;
680  fHist_Corr2p_Kaon_EP_Refm_PP[i][j] = NULL;
681  fHist_Corr2p_Kaon_EP_Refm_NN[i][j] = NULL;
682  fHist_Corr2p_Proton_EP_Refm_PN[i][j] = NULL;
683  fHist_Corr2p_Proton_EP_Refm_PP[i][j] = NULL;
684  fHist_Corr2p_Proton_EP_Refm_NN[i][j] = NULL;
685  }
686  }
687 
688 
689 
690 
691 
692 
693 
694 
695 
696 
697 
698 
699 
700 
701 
702  //Differential Charge:
703  for(int i=0;i<2;i++){
704  for(int j=0;j<6;j++){
705  fHist_Corr3p_pTSum_EP_V0A_PN[i][j] = NULL;
706  fHist_Corr3p_pTSum_EP_V0A_PP[i][j] = NULL;
707  fHist_Corr3p_pTSum_EP_V0A_NN[i][j] = NULL;
708  fHist_Corr3p_pTSum_EP_V0C_PN[i][j] = NULL;
709  fHist_Corr3p_pTSum_EP_V0C_PP[i][j] = NULL;
710  fHist_Corr3p_pTSum_EP_V0C_NN[i][j] = NULL;
711 
712  fHist_Corr3p_pTDiff_EP_V0A_PN[i][j] = NULL;
713  fHist_Corr3p_pTDiff_EP_V0A_PP[i][j] = NULL;
714  fHist_Corr3p_pTDiff_EP_V0A_NN[i][j] = NULL;
715  fHist_Corr3p_pTDiff_EP_V0C_PN[i][j] = NULL;
716  fHist_Corr3p_pTDiff_EP_V0C_PP[i][j] = NULL;
717  fHist_Corr3p_pTDiff_EP_V0C_NN[i][j] = NULL;
718 
719  fHist_Corr3p_EtaDiff_EP_V0A_PN[i][j] = NULL;
720  fHist_Corr3p_EtaDiff_EP_V0A_PP[i][j] = NULL;
721  fHist_Corr3p_EtaDiff_EP_V0A_NN[i][j] = NULL;
722  fHist_Corr3p_EtaDiff_EP_V0C_PN[i][j] = NULL;
723  fHist_Corr3p_EtaDiff_EP_V0C_PP[i][j] = NULL;
724  fHist_Corr3p_EtaDiff_EP_V0C_NN[i][j] = NULL;
725  }
726  }
727  //Differential PID:
728  for(int i=0;i<2;i++){
729  for(int j=0;j<6;j++){
730  //Pion
737 
744 
751  //Kaon
758 
765 
772  //Proton
779 
786 
793  }
794  }
795 
796 
797 
798  //Differential 2p Charge:
799  for(int i=0;i<2;i++){
800  for(int j=0;j<6;j++){
801  fHist_Corr2p_pTSum_EP_Harm1_PN[i][j] = NULL;
802  fHist_Corr2p_pTSum_EP_Harm1_PP[i][j] = NULL;
803  fHist_Corr2p_pTSum_EP_Harm1_NN[i][j] = NULL;
804  fHist_Corr2p_pTSum_EP_Harm2_PN[i][j] = NULL;
805  fHist_Corr2p_pTSum_EP_Harm2_PP[i][j] = NULL;
806  fHist_Corr2p_pTSum_EP_Harm2_NN[i][j] = NULL;
807 
808  fHist_Corr2p_pTDiff_EP_Harm1_PN[i][j] = NULL;
809  fHist_Corr2p_pTDiff_EP_Harm1_PP[i][j] = NULL;
810  fHist_Corr2p_pTDiff_EP_Harm1_NN[i][j] = NULL;
811  fHist_Corr2p_pTDiff_EP_Harm2_PN[i][j] = NULL;
812  fHist_Corr2p_pTDiff_EP_Harm2_PP[i][j] = NULL;
813  fHist_Corr2p_pTDiff_EP_Harm2_NN[i][j] = NULL;
814 
821  }
822  }
823 
824 
825 
826 
827 
828  for(int i=0;i<4;i++){
829  for(int j=0;j<5;j++){
830  fHist3DEtaPhiVz_Pos_Run[i][j]=NULL;
831  fHist3DEtaPhiVz_Neg_Run[i][j]=NULL;
832  }
833  }
834  for(int i=0;i<10;i++){
835  fFB_Efficiency_Cent[i] = NULL;
836  fFB_Efficiency_Pion_Cent[i] = NULL;
837  fFB_Efficiency_Kaon_Cent[i] = NULL;
838  fFB_Efficiency_Proton_Cent[i] = NULL;
839  }
840 }
841 
842 //___________________________ destructor ___________________________
844 {
845  //Destructor
846  //if(fPIDResponse) delete fPIDResponse;
847  //if(fMultSelection) delete fMultSelection;
848 
849  /*
850  if(fHCorrectV0M) delete fHCorrectV0M;
851  if(fHAvgerageQnV0A) delete fHAvgerageQnV0A;
852  if(fHAvgerageQnV0C) delete fHAvgerageQnV0C;
853 
854  if(mfileFBHijing->IsOpen()){
855  mfileFBHijing->Close();
856  if(fListFBHijing) delete fListFBHijing;
857  }
858  for(int i=0;i<10;i++){
859  if(fFB_Efficiency_Cent[i])
860  delete fFB_Efficiency_Cent[i];
861  }
862  for(int i=0;i<5;i++){
863  if(fHCorrectNUApos[i]) delete fHCorrectNUApos[i];
864  if(fHCorrectNUAneg[i]) delete fHCorrectNUAneg[i];
865  }
866  for(int i=0;i<5;i++){ // for PID
867  if(fHCorrectNUAposPion[i]) delete fHCorrectNUAposPion[i];
868  if(fHCorrectNUAnegPion[i]) delete fHCorrectNUAnegPion[i];
869  if(fHCorrectNUAposKaon[i]) delete fHCorrectNUAposKaon[i];
870  if(fHCorrectNUAnegKaon[i]) delete fHCorrectNUAnegKaon[i];
871  if(fHCorrectNUAposProton[i]) delete fHCorrectNUAposProton[i];
872  if(fHCorrectNUAnegProton[i]) delete fHCorrectNUAnegProton[i];
873  }
874 */
875 
876  //Delete the clones
877  if(fListFBHijing) delete fListFBHijing;
878  if(fListNUACorr) delete fListNUACorr;
879  if(fListV0MCorr) delete fListV0MCorr;
880 
881  if(fListHist) delete fListHist;
882  if(fAnalysisUtil) delete fAnalysisUtil; // its 'new' !!
883 
884 }//---------------- sanity ------------------------
885 
886 
887 
889 {
890 
891  //std::cout<<"\n..UserCreateOutputObject called.. with isCorr = "<<isCorr<<"\n ....check if succeeded...\n"<<endl;
892 
893  //input hander
894  AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();
895  AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(mgr->GetInputEventHandler());
896  if (!inputHandler) { printf("\n ...Input handler missing!!!...\n"); return; }
897 
898  //PileUp Multi-Vertex
899  fAnalysisUtil = new AliAnalysisUtils();
900  fAnalysisUtil->SetUseMVPlpSelection(kTRUE);
901  fAnalysisUtil->SetUseOutOfBunchPileUp(kTRUE);
902 
903  //pid response object
904  fPIDResponse=inputHandler->GetPIDResponse();
905 
906  fListHist = new TList();
907  fListHist->SetOwner(kTRUE);
908 
909 
911 
912  if(!gGrid){
913  TGrid::Connect("alien://");
914  }
915 
917 
918 
919 
920  hCentvsTPCmultCuts = new TH2F("hCentvsTPCmultCuts","TPCmult Low,high",100,0,100,5,0,5);
921  hCentvsTPCmultCuts->GetYaxis()->SetBinLabel(1,"mean");
922  hCentvsTPCmultCuts->GetYaxis()->SetBinLabel(2,"sigma");
924 
926 
927  fHistTOFMatchCount = new TH2F("fHistTOFMatchCount","TofMatchFlag vs mismatch Prob",10,0,10,200,-5,5);
929 
930  fHistEtaPtBefore = new TH2F("fHistEtaPtBefore","Eta vs pT",100,-1.25,1.25,100,0,10);
932 
933  fHistEtaPtAfter = new TH2F("fHistEtaPtAfter","Eta vs pT",100,-1.25,1.25,100,0,10);
935 
936 
937  Int_t gMaxTPCFB1mult = 0;
938  Int_t gMaxGlobalmult = 0;
939  Int_t gMaxTPCcorrmult = 0;
940  Int_t gMaxESDtracks = 0;
941  Int_t nBinRefMult = 200;
942  Int_t nRefMultMax = 4000;
943 
944 
945 
946  if(sNucleiTP=="pp"||sNucleiTP=="PP"){
947  gMaxGlobalmult = 200;
948  gMaxTPCFB1mult = 200;
949  gMaxTPCcorrmult = 500;
950  gMaxESDtracks = 1000;
951  nBinRefMult = 100; //change binning for pp
952  nRefMultMax = 500;
953  //fSkipOutlierCut = 1;
954  }
955  else if(sNucleiTP=="pPb"||sNucleiTP=="Pbp"||sNucleiTP=="PbP"||sNucleiTP=="PPb"){
956  gMaxGlobalmult = 400;
957  gMaxTPCFB1mult = 400;
958  gMaxTPCcorrmult = 500;
959  gMaxESDtracks = 2000;
960  nBinRefMult = 100; //change binning for pPb
961  nRefMultMax = 1000;
962  //fSkipOutlierCut = 1;
963  }
964  else{
965  gMaxGlobalmult = 4000;
966  gMaxTPCFB1mult = 4000;
967  gMaxTPCcorrmult = 5000;
968  gMaxESDtracks = 20000;
969  //fSkipOutlierCut = 0;
970  }
971 
972 
973 
974  //if(bSkipPileUpCut) { fSkipOutlierCut = 1;}
975 
976 
977  fHistTPCVsESDTrkBefore = new TH2F("fHistTPCVsESDTrkBefore","Before; TPC1; ESD trk",500,0,gMaxTPCcorrmult,200,0,gMaxESDtracks);
979  fHistTPCVsESDTrkAfter = new TH2F("fHistTPCVsESDTrkAfter"," After; TPC1; ESD trk",500,0,gMaxTPCcorrmult,200,0,gMaxESDtracks);
981 
982  fHistTPCvsGlobalMultBefore = new TH2F("fHistTPCvsGlobalMultBefore","Before; Global; TPC(fb1) ",200,0,gMaxGlobalmult,200,0,gMaxTPCFB1mult);
984  fHistTPCvsGlobalMultAfter = new TH2F("fHistTPCvsGlobalMultAfter"," After; Global; TPC(fb1) ",200,0,gMaxGlobalmult,200,0,gMaxTPCFB1mult);
986 
987  fHistGlobalVsV0MBefore = new TH2F("fHistGlobalVsV0MBefore","Before;Cent(V0M);Global",100,0,100,500,0,gMaxGlobalmult);
989  fHistGlobalVsV0MAfter = new TH2F("fHistGlobalVsV0MAfter"," After; Cent(V0M);Global",100,0,100,500,0,gMaxGlobalmult);
991 
992  fHistTPConlyVsCL1Before = new TH2F("fHistTPConlyVsCL1Before","Before;Cent(CL1); TPC(FB1)",100,0,100,250,0,gMaxTPCcorrmult);
994  fHistTPConlyVsCL1After = new TH2F("fHistTPConlyVsCL1After","After; Cent(CL1); TPC(FB1) ",100,0,100,250,0,gMaxTPCcorrmult);
996 
997  fHistTPConlyVsV0MBefore = new TH2F("fHistTPConlyVsV0MBefore","Before;Cent(V0M); TPC(FB1)",100,0,100,250,0,gMaxTPCcorrmult);
999  fHistTPConlyVsV0MAfter = new TH2F("fHistTPConlyVsV0MAfter","After; Cent(V0M); TPC(FB1) ",100,0,100,250,0,gMaxTPCcorrmult);
1001 
1002  fHistRawVsCorrMultFB = new TH2F("fHistRawVsCorrMultFB",Form("FB%d;Mult_{raw};Mult_{corr}",fFilterBit),gMaxTPCFB1mult,0,gMaxTPCFB1mult,gMaxTPCcorrmult,0,gMaxTPCcorrmult);
1004 
1005 
1006 
1007 
1008 
1009 
1010  // Turn off PID QA histograms
1011  //---------------- PID QA Histograms ---------------------
1012  /*
1013  fHistTPCdEdxvsPBefore = new TH2F("fHistTPCdEdxvsPBefore","Before; p (GeV/c); dEdx (arb)",200,-5,5,200,0,250);
1014  fListHist->Add(fHistTPCdEdxvsPBefore);
1015  fHistTPCdEdxvsPAfter = new TH2F("fHistTPCdEdxvsPAfter"," After; p (GeV/c); dEdx (arb)",200,-5,5, 200,0,250);
1016  fListHist->Add(fHistTPCdEdxvsPAfter);
1017 
1018  fHistTOFBetavsPBefore = new TH2F("fHistTOFBetavsPBefore","Before; p (GeV/c); beta ",200,-5,5,100,0.0,1.2);
1019  fListHist->Add(fHistTOFBetavsPBefore);
1020  fHistTOFBetavsPAfter = new TH2F("fHistTOFBetavsPAfter"," After; p (GeV/c); beta ",200,-5,5,100,0.0,1.2);
1021  fListHist->Add(fHistTOFBetavsPAfter);
1022 
1023  fHistTOFMassvsPtBefore = new TH2F("fHistTOFMassvsPtBefore","Before; p_{T}(GeV/c); m^{2}(GeV^{2}/c^{4})",200,-5,5,500,-0.5,4.5);
1024  fListHist->Add(fHistTOFMassvsPtBefore);
1025 
1026  //const char *gSpecies[4] = {"Pion","Kaon","proton","Charge"};
1027  */
1028 
1029  for(int i=0;i<4;i++){
1030  for(int j=0;j<10;j++){
1031  fHistPtwithoutPIDcut[i][j] = new TH1F(Form("fHistPtwithoutPIDcut_Species%d_Cent%d",i,j), Form("Particle%d;p_{T}(GeV/c))",i),200,-5,5); //i
1032  fListHist->Add(fHistPtwithoutPIDcut[i][j]);
1033  fHistPtwithTPCNsigma[i][j] = new TH1F(Form("fHistPtwithTPCNsigma_Species%d_Cent%d",i,j), Form("Particle%d;p_{T}(GeV/c))",i),200,-5,5); //i
1034  fListHist->Add(fHistPtwithTPCNsigma[i][j]);
1035  fHistPtwithTPCTOFNsigma[i][j] = new TH1F(Form("fHistPtwithTPCTOFNsigma_Species%d_Cent%d",i,j),Form("Particle%d;p_{T}(GeV/c))",i),200,-5,5);
1036  fListHist->Add(fHistPtwithTPCTOFNsigma[i][j]);
1037  fHistPtwithNoPIDCuts[i][j] = new TH1F(Form("fHistPtwithNoPIDCuts_Species%d_Cent%d",i,j),Form("Particle%d;p_{T}(GeV/c))",i),200,-5,5);
1038  fListHist->Add(fHistPtwithNoPIDCuts[i][j]);
1039  }
1040  }
1041 
1042 
1043  for(int i=0;i<3;i++){
1044  /*
1045  //These are not filled:
1046  fHistPtwithTOFSignal[i] = new TH1F(Form("fHistPtwithTOFSignal_%d", i),Form("%d;p_{T}(GeV/c))",i),200,-10,10);
1047  fListHist->Add(fHistPtwithTOFSignal[i]);
1048  fHistTOFnSigmavsPtAfter[i] = new TH2F(Form("fHistTOFnSigmavsPtAfter_%d",i),Form("%d;p_{T}(GeV/c);n#sigma_{TOF}",i),200,-10,10,200,-10.0,10.0);
1049  fListHist->Add(fHistTOFnSigmavsPtAfter[i]);
1050  fHistTPCnSigmavsPtAfter[i] = new TH2F(Form("fHistTPCnSigmavsPtAfter_%d",i),Form("%d;p_{T}(GeV/c);n#sigma_{TPC}",i),200,-10,10,200,-10.0,10.0);
1051  fListHist->Add(fHistTPCnSigmavsPtAfter[i]); */
1052 
1053  //These are filled:
1054  fHistTPCTOFnSigmavsPtAfter[i] = new TH3F(Form("fHistTPCTOFnSigmavsPtAfter_%d",i),Form("%d; p_{T}(GeV/c); n#sigma_{TPC}; n#sigma_{TOF}",i),100,0,5,200,-10,10,200,-10,10);
1056 
1057  fHistTPCdEdxvsPtPIDAfter[i] = new TH2F(Form("fHistTPCdEdxvsPtAfter_%d",i),"AfterCut; p_{T} (GeV/c); dEdx (arb)",200,0,10,250,0,250);
1059  }// PID histograms done
1060 
1061 
1062 
1063 
1064 
1065  Double_t centRange[11] = {0,5,10,20,30,40,50,60,70,80,90};
1066  //const char *gDetForEP[4] = {"V0A","V0C","TPC-A","TPC-C"};
1067 
1068 
1069  //--------------------- v2, delta and gamma ------------------
1070  for(int i=0;i<3;i++){
1071  V2IntProQC[i] = new TProfile(Form("V%dIntProQC",i+2),Form("V%dIntProQC",i+2),10,centRange,"s");
1072  V2IntProQC[i]->Sumw2();
1073  fListHist->Add(V2IntProQC[i]);
1074  }
1075 
1076  for(Int_t i=0; i<8; i++) {
1077  fDnnPro[i] = new TProfile(Form("fDnnPro_%d",i),Form("fDnnPro_%d",i),10,centRange,"s");
1078  fDnnPro[i]->Sumw2();
1079  fListHist->Add(fDnnPro[i]);
1080  }
1081  for(Int_t i=0; i<8; i++) {
1082  fCMEPro[i] = new TProfile(Form("CMEPro_%d",i),Form("CMEPro_%d",i),10,centRange,"");
1083  //fCMEPro[i]->Sumw2();
1084  fListHist->Add(fCMEPro[i]);
1085  }
1086 
1087  for(int i=0;i<3;i++){
1088  fResolution_TPCEP[i] = new TProfile(Form("fResolutionTPCPsi%d",i+2),Form("Resolution #Psi_{%d}",i+2),10,centRange,"");
1089  //V2IntProQC[i]->Sumw2();
1090  fListHist->Add(fResolution_TPCEP[i]);
1091  }
1092 
1093  //------------------------------------------------------------
1094 
1095 
1096 
1097 
1098 
1099 
1100  fCentDistBefore = new TH1F("fMultDistMC","Mult Dist; Events ",2000,0,4000);
1101  fListHist->Add(fCentDistBefore);
1102 
1103  //fCentDistBefore = new TH1F("fCentDistBefore","no Cut; Cent (%); Events ",100,0,100);
1104  //fListHist->Add(fCentDistBefore);
1105 
1106  fCentDistAfter = new TH1F("fCentDistAfter","with Cut; Cent (%); Events ",100,0,100);
1107  fListHist->Add(fCentDistAfter);
1108 
1109 
1110 
1111 
1112 
1113 
1114 
1115 
1116 
1117 
1118 
1119 
1120 
1121 
1122 
1123 
1124 
1125 
1126  //---- to store NUA and calib histograms -----
1127 
1128  TList *fListNUACalib = new TList();
1129  fListNUACalib->SetName("fListNUACalib");
1130  fListNUACalib->SetOwner(kTRUE);
1131 
1132 
1133  Double_t truncPi = 3.1416;
1134 
1135  //-------------- Event plane distributions --------------
1136  fHV0AEventPlaneVsCent = new TH2F("fHV0AEventPlaneVsCent",Form("Psi %d from V0A", gPsiN), 10,centRange,50,-0.0,truncPi);
1137  fListNUACalib->Add(fHV0AEventPlaneVsCent);
1138 
1139  fHV0CEventPlaneVsCent = new TH2F("fHV0CEventPlaneVsCent",Form("Psi %d from V0C", gPsiN), 10,centRange,50,-0.0,truncPi);
1140  fListNUACalib->Add(fHV0CEventPlaneVsCent);
1141 
1142  fHTPCAEventPlaneVsCent = new TH2F("fPsi2TPCVsCent",Form("Psi %d from TPC",2),10,centRange,50,-0.0,truncPi);
1143  fListNUACalib->Add(fHTPCAEventPlaneVsCent);
1144 
1145  fHTPCCEventPlaneVsCent = new TH2F("fPsi3TPCVsCent",Form("Psi %d from TPC",3),10,centRange,50,-0.0,truncPi);
1146  fListNUACalib->Add(fHTPCCEventPlaneVsCent);
1147 
1148  fHTPCEventPlaneVsCent = new TH2F("fPsi4TPCVsCent",Form("Psi %d from TPC",4),10,centRange,50,-0.0,truncPi);
1149  fListNUACalib->Add(fHTPCEventPlaneVsCent);
1150 
1151 
1152 
1153  //-------------------- QA: how does the eta-phi looks after NUA correction ----------------
1154  fQAEtaPhiAfterNUA = new TH2F("fQAEtaPhiAfterNUA","eta vs phi with NUA corr",50,0,6.283185,16,-0.8,0.8);
1155  fListNUACalib->Add(fQAEtaPhiAfterNUA);
1156 
1157  fQAEtaPhiAfterNUAPion = new TH2F("fQAEtaPhiAfterNUAPion","Pion eta vs phi with NUA corr",50,0,6.283185,16,-0.8,0.8);
1158  fListNUACalib->Add(fQAEtaPhiAfterNUAPion);
1159 
1160  fQAEtaPhiAfterNUAKaon = new TH2F("fQAEtaPhiAfterNUAKaon","Kaon eta vs phi with NUA corr",50,0,6.283185,16,-0.8,0.8);
1161  fListNUACalib->Add(fQAEtaPhiAfterNUAKaon);
1162 
1163  fQAEtaPhiAfterNUAProton = new TH2F("fQAEtaPhiAfterNUAProton","Proton eta vs phi with NUA corr",50,0,6.283185,16,-0.8,0.8);
1164  fListNUACalib->Add(fQAEtaPhiAfterNUAProton);
1165 
1166 
1167 
1168 
1169 
1170 
1171  //----------------- V0 Calibration hist: ---------------------
1172  fV0MultChVsRun = new TH2F("fV0MultChVsRun","1-32 V0C, 33-64 V0A",64,0,64,20,0,100);
1173  fListNUACalib->Add(fV0MultChVsRun);
1174 
1175  //const char *sCorrect[2]={"wo Corr","w Corr"};
1176  Int_t isCorr = 0;
1177 
1178  if(fListV0MCorr){
1179  isCorr = 1;
1180  }
1181 
1182 
1183  fV0AQ2xVsCentRun = new TProfile("fV0ACos2nVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,""); //sCorrect[isCorr]
1184  fListNUACalib->Add(fV0AQ2xVsCentRun);
1185  fV0AQ2yVsCentRun = new TProfile("fV0ASin2nVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1186  fListNUACalib->Add(fV0AQ2yVsCentRun);
1187  fV0CQ2xVsCentRun = new TProfile("fV0CCos2nVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,"");
1188  fListNUACalib->Add(fV0CQ2xVsCentRun);
1189  fV0CQ2yVsCentRun = new TProfile("fV0CSin2nVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1190  fListNUACalib->Add(fV0CQ2yVsCentRun);
1191 
1192  fV0AQ3xVsCentRun = new TProfile("fV0ACos3nVsCentRun",Form("<Cos3> vs cent (%d)",isCorr),90,0,90,"");
1193  fListNUACalib->Add(fV0AQ3xVsCentRun);
1194  fV0AQ3yVsCentRun = new TProfile("fV0ASin3nVsCentRun",Form("<Sin3> vs cent (%d)",isCorr),90,0,90,"");
1195  fListNUACalib->Add(fV0AQ3yVsCentRun);
1196  fV0CQ3xVsCentRun = new TProfile("fV0CCos3nVsCentRun",Form("<Cos3> vs cent (%d)",isCorr),90,0,90,"");
1197  fListNUACalib->Add(fV0CQ3xVsCentRun);
1198  fV0CQ3yVsCentRun = new TProfile("fV0CSin3nVsCentRun",Form("<Sin3> vs cent (%d)",isCorr),90,0,90,"");
1199  fListNUACalib->Add(fV0CQ3yVsCentRun);
1200 
1201  isCorr = 1;
1202  if(fListNUACorr){
1203  cout<<"\n =========> NUA file found for NUA correction <========== \n";
1204  isCorr = 0;
1205  }
1206  //------------------- TPC Qvector Recentering Histograms --------------
1207  fTPCAQ2xVsCentRun = new TProfile("fTPCACos2nVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,"");
1208  fListNUACalib->Add(fTPCAQ2xVsCentRun);
1209  fTPCAQ2yVsCentRun = new TProfile("fTPCASin2nVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1210  fListNUACalib->Add(fTPCAQ2yVsCentRun);
1211  fTPCCQ2xVsCentRun = new TProfile("fTPCCCos2nVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,"");
1212  fListNUACalib->Add(fTPCCQ2xVsCentRun);
1213  fTPCCQ2yVsCentRun = new TProfile("fTPCCSin2nVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1214  fListNUACalib->Add(fTPCCQ2yVsCentRun);
1215 
1216  fTPCAQ3xVsCentRun = new TProfile("fTPCACos3nVsCentRun",Form("<Cos3> vs cent (%d)",isCorr),90,0,90,"");
1217  fListNUACalib->Add(fTPCAQ3xVsCentRun);
1218  fTPCAQ3yVsCentRun = new TProfile("fTPCASin3nVsCentRun",Form("<Sin3> vs cent (%d)",isCorr),90,0,90,"");
1219  fListNUACalib->Add(fTPCAQ3yVsCentRun);
1220  fTPCCQ3xVsCentRun = new TProfile("fTPCCCos3nVsCentRun",Form("<Cos3> vs cent (%d)",isCorr),90,0,90,"");
1221  fListNUACalib->Add(fTPCCQ3xVsCentRun);
1222  fTPCCQ3yVsCentRun = new TProfile("fTPCCSin3nVsCentRun",Form("<Sin3> vs cent (%d)",isCorr),90,0,90,"");
1223  fListNUACalib->Add(fTPCCQ3yVsCentRun);
1224 
1225  fTPCAQ4xVsCentRun = new TProfile("fTPCACos4nVsCentRun",Form("<Cos4> vs cent (%d)",isCorr),90,0,90,"");
1226  fListNUACalib->Add(fTPCAQ4xVsCentRun);
1227  fTPCAQ4yVsCentRun = new TProfile("fTPCASin4nVsCentRun",Form("<Sin4> vs cent (%d)",isCorr),90,0,90,"");
1228  fListNUACalib->Add(fTPCAQ4yVsCentRun);
1229  fTPCCQ4xVsCentRun = new TProfile("fTPCCCos4nVsCentRun",Form("<Cos4> vs cent (%d)",isCorr),90,0,90,"");
1230  fListNUACalib->Add(fTPCCQ4xVsCentRun);
1231  fTPCCQ4yVsCentRun = new TProfile("fTPCCSin4nVsCentRun",Form("<Sin4> vs cent (%d)",isCorr),90,0,90,"");
1232  fListNUACalib->Add(fTPCCQ4yVsCentRun);
1233 
1234 
1235  fTPCFQ2xVsCentRun = new TProfile("fTPCFQ2xVsCentRun",Form("<Cos2> vs cent (%d)",isCorr),90,0,90,"");
1236  fListNUACalib->Add(fTPCFQ2xVsCentRun);
1237  fTPCFQ2yVsCentRun = new TProfile("fTPCFQ2yVsCentRun",Form("<Sin2> vs cent (%d)",isCorr),90,0,90,"");
1238  fListNUACalib->Add(fTPCFQ2yVsCentRun);
1239 
1240  //-------------------------------------------------------------------------------
1241 
1242 
1243 
1244 
1245  //-------------------------- Define NUA Hist for PID -----------------------------
1246  Int_t gCentForNUA[6] = {0,5,10,20,40,90};
1247  Char_t name[100];
1248  Char_t title[100];
1249 
1250  for(int i=0;i<4;i++){
1251  for(int j=0;j<5;j++){
1252  sprintf(name,"fHistEtaPhiVz_%d_Pos_Cent%d_Run%d",i,j,1); //gSpecies[i]
1253  sprintf(title,"eta,phi,Vz %dPos, Cent%d-%d, FB %d",i,gCentForNUA[j],gCentForNUA[j+1],fFilterBit);
1254  fHist3DEtaPhiVz_Pos_Run[i][j] = new TH3F(name,title,10,-10,10,50,0,6.283185,16,-0.8,0.8);
1255  fListNUACalib->Add(fHist3DEtaPhiVz_Pos_Run[i][j]);
1256 
1257  sprintf(name,"fHistEtaPhiVz_%d_Neg_Cent%d_Run%d",i,j,1); //gSpecies[i]
1258  sprintf(title,"eta,phi,Vz %dNeg, Cent%d-%d, FB %d",i,gCentForNUA[j],gCentForNUA[j+1],fFilterBit);
1259  fHist3DEtaPhiVz_Neg_Run[i][j] = new TH3F(name,title,10,-10,10,50,0,6.283185,16,-0.8,0.8);
1260  fListNUACalib->Add(fHist3DEtaPhiVz_Neg_Run[i][j]);
1261  }
1262  }
1263  //---------------------------------------------------------------------------------
1264 
1265 
1266  fListHist->Add(fListNUACalib);
1267 
1268  PostData(1,fListHist);
1269  cout<<"\n.........UserCreateOutputObject called.........\n fFilterBit = "<<fFilterBit<<" CentMax = "<<fCentralityPercentMax;
1270  cout<<" PU C = "<<fPileUpConstParm<<" gN = "<<gN<<" gM = "<<gM<<" PsiN = "<<gPsiN<<"\n\n"<<endl;
1271 
1272 }
1273 
1274 
1275 
1276 
1277 
1278 
1279 
1280 
1281 
1282 
1283 
1284 
1285 
1286 
1287 
1288 
1289 
1290 //______________________________________________________________________
1292  //debug only
1293 
1294  //cout<<"\n Info:UserExec() called ..!!!\n";
1295 
1296 
1297  //watch.Start(kTRUE);
1298  //if(fEventCount==501) return;
1299 
1300 
1301  Float_t stepCount = 0.5;
1302 
1303  fHistEventCount->Fill(stepCount); //1
1304  stepCount++;
1305 
1306  //fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
1307  //fESD = dynamic_cast<AliESDEvent*>(InputEvent());
1308  // if(!(fESD || fAOD)){ printf("ERROR: fESD & fAOD not available\n"); return; }
1309  //fVevent = dynamic_cast<AliVEvent*>(InputEvent());
1310  // if (!fVevent) { printf("ERROR: fVevent not available\n"); return; }
1311 
1312  fHistEventCount->Fill(stepCount); //2
1313  stepCount++;
1314 
1315 
1316  //--------- Load MC Event ---------
1317  AliVEvent *eventMain = dynamic_cast<AliVEvent*>(MCEvent());
1318  AliMCEvent* mcEvent = dynamic_cast<AliMCEvent*>(eventMain);
1319 
1320  if (!mcEvent) {
1321  printf("ERROR: Could not retrieve MC event");
1322  return;
1323  }
1324 
1325  //return;
1326 
1327 
1328 
1329  //--------- Check if I have PID response object --------
1330  // if(!fPIDResponse){
1331  // printf("\n\n...... PIDResponse object not found..... \n\n"); return;
1332  // }
1333 
1334 
1335  //-------------- Vtx cuts ---------------
1336  // const AliVVertex *pVtx = fVevent->GetPrimaryVertex();
1337  Double_t pVtxZ = 0.0;
1338  // pVtxZ = pVtx->GetZ();
1339 
1340 //if(TMath::Abs(pVtxZ)>10.) return;
1341  //User defined cut:
1342  // if(pVtxZ<fMinVzCut || pVtxZ>fMaxVzCut ) return;
1343 
1344 
1345  fHistEventCount->Fill(stepCount); //3
1346  stepCount++;
1347 
1348 
1349 
1350  Float_t centrality = -99.0;
1351  Float_t centrV0M = -99.0;
1352  Float_t centrCL1 = -99.0;
1353 
1354  //AliCentrality* Alicentr = mcEvent->GetCentrality(); // For Run1, 2010 data
1355  //centrality = Alicentr->GetCentralityPercentile("CL1");
1356 
1357 
1358  /*
1359  //---------- Centrality Estimators -------------
1360  AliCentrality* Alicentr = ((AliVAODHeader*)fAOD->GetHeader())->GetCentralityP(); // For Run1, 2010 data
1361 
1362  fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection"); // Must never comment this
1363  if(!fMultSelection) { printf("\n\n **WARNING** \n::UserExec() AliMultSelection object not found.\n\n"); exit(1); }
1364 
1365 
1366  if(sNucleiTP=="PbPb2010" || sNucleiTP=="2010") {
1367  if(Alicentr){
1368 
1369  centrV0M = Alicentr->GetCentralityPercentile("V0M");
1370  centrCL1 = Alicentr->GetCentralityPercentile("CL1");
1371 
1372  if(sCentrEstimator=="V0M" || sCentrEstimator=="V0"){
1373  centrality = centrV0M;
1374  }
1375  else if(sCentrEstimator=="CL1"){
1376  centrality = centrCL1;
1377  }
1378  else if(sCentrEstimator=="V0C"){
1379  centrality = Alicentr->GetCentralityPercentile("V0C");
1380  }
1381  else if(sCentrEstimator=="V0A"){
1382  centrality = Alicentr->GetCentralityPercentile("V0A");
1383  }
1384  else if(sCentrEstimator=="TRK"){
1385  centrality = Alicentr->GetCentralityPercentile("TRK");
1386  }
1387  }
1388  else{
1389  centrV0M = fMultSelection->GetMultiplicityPercentile("V0M");
1390  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
1391  if(sCentrEstimator=="V0M" || sCentrEstimator=="V0"){
1392  centrality = centrV0M;
1393  }
1394  else if(sCentrEstimator=="CL1"){
1395  centrality = centrCL1;
1396  }
1397  else if(sCentrEstimator=="V0C"){
1398  centrality = fMultSelection->GetMultiplicityPercentile("V0C");
1399  }
1400  else if(sCentrEstimator=="V0A"){
1401  centrality = fMultSelection->GetMultiplicityPercentile("V0A");
1402  }
1403  else if(sCentrEstimator=="TRK"){
1404  centrality = fMultSelection->GetMultiplicityPercentile("TRK");
1405  }
1406  }
1407  }
1408  else{ // fall back to MultSelection if other than 2010 data
1409 
1410  centrV0M = fMultSelection->GetMultiplicityPercentile("V0M");
1411  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
1412 
1413  if(sCentrEstimator=="V0M" || sCentrEstimator=="V0"){
1414  centrality = centrV0M;
1415  }
1416  else if(sCentrEstimator=="CL1"){
1417  centrality = centrCL1;
1418  }
1419  else if(sCentrEstimator=="V0C"){
1420  centrality = fMultSelection->GetMultiplicityPercentile("V0C");
1421  }
1422  else if(sCentrEstimator=="V0A"){
1423  centrality = fMultSelection->GetMultiplicityPercentile("V0A");
1424  }
1425  else if(sCentrEstimator=="TRK"){
1426  centrality = fMultSelection->GetMultiplicityPercentile("TRK");
1427  }
1428  }
1429 
1430 */
1431 
1432  //cout<<" vtx = "<<pVtxZ<<"\t cent = "<<centrality<<endl;
1433 
1434 
1435  //----------------- Cut on Centrality -----------------------
1436  // if(centrality<fCentralityPercentMin || centrality>fCentralityPercentMax){
1437  // return;
1438  // }
1439 
1440 
1441 
1442 
1443  fHistEventCount->Fill(stepCount); //4
1444  stepCount++;
1445 
1446  //fCentDistBefore->Fill(centrality);
1447 
1448 
1449 
1450 
1451 
1452 
1453  //Int_t ntracks=fAOD->GetNumberOfTracks();
1454  //if(ntracks<2) return; // Check this cut....!!!
1455 
1456  fHistEventCount->Fill(stepCount); //5
1457  stepCount++;
1458 
1459 
1460 
1461  centrality = 4.0;
1462 
1463 
1464 
1465 
1466  Int_t cent10bin = -1;
1467  Int_t cIndex = -1;
1468  //cent10bin = GetCentralityScaled0to10(centrality); //Centrality in 0-10 scale
1469 
1470  if(centrality<5.0) {
1471  cent10bin = 0;
1472  }
1473  else if(centrality>=5.0 && centrality<10){
1474  cent10bin = 1;
1475  }
1476  else if(centrality>=10.0) {
1477  cent10bin = abs(centrality/10.0)+1;
1478  }
1479 
1480  cIndex = cent10bin; //0,1,2,
1481 
1482 //Centrality array index for NUA correcion
1483  Int_t cForNUA = 0;
1484 
1485  if(centrality<5.0) {
1486  cForNUA = 0;
1487  }
1488  else if(centrality>=5.0 && centrality<10){
1489  cForNUA = 1; // 1=5-10,
1490  }
1491  else if(centrality>=10.0 && centrality<20) {
1492  cForNUA = 2; // 2 = 10-20,
1493  }
1494  else if(centrality>=20 && centrality<40){
1495  cForNUA = 3; // 3=20-40
1496  }
1497  else if(centrality>=40){
1498  cForNUA = 4; // 4=40-90
1499  }
1500 
1501 
1502 
1503 
1504 
1505 
1506  //---------- Magnetic field --------
1507  Double_t fMagField = -1.0; //fAOD->GetMagneticField();
1508 
1509  const Int_t QAindex = (fMagField > 0) ? 1 : 0;
1510  //---------------------------------
1511 
1512 
1513 
1514 
1515 
1516 
1517  //Load NUA and V0M correction map run by run:
1518  Int_t runNumber = 246087; //fAOD->GetRunNumber();
1519 
1520  if(runNumber!=fOldRunNum) {
1521 
1522  GetNUACorrectionHist(runNumber);
1523 
1524  if(bV0MGainCorr) {
1525  GetV0MCorrectionHist(runNumber);
1526  }
1527 
1528  fOldRunNum = runNumber;
1529  }
1530  //------------------------------------------
1531 
1532 
1533 
1534 
1535 
1536 
1537 
1538  //----- Event Plane variables:-------
1539  Double_t PsiNV0A = 0;
1540  Double_t PsiNV0C = 0;
1541 
1542  Double_t PsiNTPCA = 0; // eta <0
1543  Double_t PsiNTPCC = 0; // eta >0
1544  Double_t PsiNTPCF = 0; // Full TPC
1545 
1546  Double_t sumTPCQn2x[5] = {0,0,0}; //[0]= eta<0; [1]= eta>0; [2]= -0.8 < eta < 0.8
1547  Double_t sumTPCQn2y[5] = {0,0,0};
1548  Double_t sumTPCQn3x[5] = {0,0,0}; //[0]= eta<0; [1]= eta>0; [2]= -0.8 < eta < 0.8
1549  Double_t sumTPCQn3y[5] = {0,0,0};
1550  Double_t sumTPCQn4x[5] = {0,0,0}; //[0]= eta<0; [1]= eta>0; [2]= -0.8 < eta < 0.8
1551  Double_t sumTPCQn4y[5] = {0,0,0};
1552  //------------------------------------
1553 
1554 
1555 
1556 
1557 
1558 
1559 
1560  //Variables for MC tracking correction
1561  Int_t ptBinMC = 1;
1562  Int_t iBinNUA = 1;
1563  Double_t ptWgtMC = 1.0;
1564  Double_t WgtNUA = 1.0;
1565  Double_t ptTrk = 0.1;
1566  Double_t dEdx = 0.0;
1567  Double_t Chi2Trk = 0.0;
1568 
1569 
1570  //-------------- Track loop for outlier and PileUp cut -------------------
1571  /*
1572  //---------------- a dobrin --------------
1573 
1574  Bool_t bIsPileup=kFALSE;
1575 
1576  Int_t isPileup = fAOD->IsPileupFromSPD(3);
1577 
1578  if(isPileup != 0) {
1579  fHistPileUpCount->Fill(0.5);
1580  bIsPileup=kTRUE;
1581  }
1582  else if(PileUpMultiVertex(fAOD)) {
1583  fHistPileUpCount->Fill(1.5);
1584  bIsPileup=kTRUE;
1585  }
1586  else if(((AliAODHeader*)fAOD->GetHeader())->GetRefMultiplicityComb08() < 0) {
1587  fHistPileUpCount->Fill(2.5);
1588  bIsPileup=kTRUE;
1589  }
1590  else if(fAOD->IsIncompleteDAQ()) {
1591  fHistPileUpCount->Fill(3.5);
1592  bIsPileup=kTRUE;
1593  }
1594  else if(fabs(centrV0M-centrCL1)> 5.0) {//default: 7.5
1595 //else if(fabs(centrV0M-centrCL1)> 7.5) {//default: 7.5
1596  fHistPileUpCount->Fill(4.5);
1597  bIsPileup=kTRUE;
1598  }
1599 
1600  // check vertex consistency
1601  const AliAODVertex* vtTrc = fAOD->GetPrimaryVertex();
1602  const AliAODVertex* vtSPD = fAOD->GetPrimaryVertexSPD();
1603 
1604  if(vtTrc->GetNContributors() < 2 || vtSPD->GetNContributors()<1) {
1605  fHistPileUpCount->Fill(5.5);
1606  bIsPileup=kTRUE;
1607  }
1608 
1609  double covTrc[6], covSPD[6];
1610  vtTrc->GetCovarianceMatrix(covTrc);
1611  vtSPD->GetCovarianceMatrix(covSPD);
1612 
1613  double dz = vtTrc->GetZ() - vtSPD->GetZ();
1614 
1615  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
1616  double errTrc = TMath::Sqrt(covTrc[5]);
1617  double nsigTot = dz/errTot;
1618  double nsigTrc = dz/errTrc;
1619 
1620  if(TMath::Abs(dz)>0.2 || TMath::Abs(nsigTot)>10 || TMath::Abs(nsigTrc)>20) {
1621  fHistPileUpCount->Fill(6.5);
1622  bIsPileup=kTRUE;
1623  }
1624 
1625  */
1626 
1627 
1628  Float_t nSigPionTPC[40000] = {0.,};
1629  Float_t nSigKaonTPC[40000] = {0.,};
1630  Float_t nSigProtonTPC[40000] = {0.,};
1631  Float_t nSigPionTOF[40000] = {0.,};
1632  Float_t nSigKaonTOF[40000] = {0.,};
1633  Float_t nSigProtonTOF[40000] = {0.,};
1634 
1635  //if(ntracks > 40000) return; //Dont break segment for higher tracks:
1636 
1637 
1638  Float_t multTPC = 0; // tpc mult estimate
1639  //Float_t RefMultRaw = 0; // tpc mult estimate
1640  //Float_t RefMultCorr = 0; // tpc mult estimate
1641  Float_t RefMultRawFB = 0;
1642  Float_t RefMultCorrFB= 0;
1643 
1644  Float_t multTPCAll = 0; // tpc mult estimate
1645  Float_t multGlobal = 0; // global multiplicity
1646 
1647  Int_t multEtaNeg, multEtaPos, multEtaFull;
1648  Double_t SumWEtaNeg, SumWEtaPos, SumWEtaFull;
1649 
1650  Int_t ChTrk;
1651  Int_t nClustTPC;
1652 
1653  Double_t etaTrk, phiTrk; // Never define eta as float, always double.!!
1654 
1655  //Double_t fMaxPtEP = 5.0;
1656  //Double_t fMinPtEP = 0.2;
1657  Double_t fMaxEtaEP = 0.8;
1658  Double_t fMinEtaEP = -0.8;
1659 
1660  multEtaNeg = 0;
1661  multEtaPos = 0;
1662  multEtaFull= 0;
1663  SumWEtaNeg = 0;
1664  SumWEtaPos = 0;
1665  SumWEtaFull= 0;
1666 
1667 
1668  /*
1669  for(Int_t iTrack = 0; iTrack < ntracks; iTrack++) { //-------------------------
1670 
1671  AliAODTrack* AODtrack =dynamic_cast<AliAODTrack*>(fVevent->GetTrack(iTrack));
1672  if(!AODtrack) continue;
1673 
1674  nSigPionTPC[iTrack] = fPIDResponse->NumberOfSigmasTPC(AODtrack, AliPID::kPion);
1675  nSigKaonTPC[iTrack] = fPIDResponse->NumberOfSigmasTPC(AODtrack, AliPID::kKaon);
1676  nSigProtonTPC[iTrack] = fPIDResponse->NumberOfSigmasTPC(AODtrack, AliPID::kProton);
1677 
1678  nSigPionTOF[iTrack] = fPIDResponse->NumberOfSigmasTOF(AODtrack, AliPID::kPion);
1679  nSigKaonTOF[iTrack] = fPIDResponse->NumberOfSigmasTOF(AODtrack, AliPID::kKaon);
1680  nSigProtonTOF[iTrack] = fPIDResponse->NumberOfSigmasTOF(AODtrack, AliPID::kProton);
1681 
1682  //-----------------------------------------------------
1683 
1684 
1685  ptTrk = AODtrack->Pt();
1686  etaTrk = AODtrack->Eta();
1687  Chi2Trk = AODtrack->Chi2perNDF();
1688  nClustTPC = AODtrack->GetTPCNcls();
1689  //dEdx = AODtrack->GetDetPid()->GetTPCsignal(); // This one breaks the code if called before checking FilterBit.
1690 
1691 
1692  //Track cuts for POIs: Same to be used for EP calc.
1693  //if((dPt2 > fMaxPtCut) || (dPt2 < fMinPtCut) || (dEta2 > fMaxEtaCut) || (dEta2 < fMinEtaCut) || (dEdx2 < fdEdxMin) || (track2->GetTPCNcls() < fTPCclustMin) || (Chi2Trk2 < fTrkChi2Min) || (Chi2Trk2 > 4.0) || (track2->DCA() > fDCAxyMax)|| (track2->ZAtDCA() > fDCAzMax) || !(TMath::Abs(gCharge2)))
1694 
1695  //cuts for EP calculation:
1696  if(AODtrack->TestFilterBit(fFilterBit)){
1697 
1698  phiTrk = AODtrack->Phi();
1699  dEdx = AODtrack->GetDetPid()->GetTPCsignal();
1700  ChTrk = AODtrack->Charge();
1701 
1702  if(gPsiN > 0 && (ptTrk <= fMaxPtCut) && (ptTrk >= fMinPtCut) && (etaTrk <= fMaxEtaEP) && (etaTrk >= fMinEtaEP) && (dEdx >= fdEdxMin) && (nClustTPC >= fTPCclustMin) && (AODtrack->DCA() <= fDCAxyMax) && (AODtrack->ZAtDCA() <= fDCAzMax) && (Chi2Trk >= fTrkChi2Min) && (Chi2Trk <= 4.0) && TMath::Abs(ChTrk))
1703  {
1704 
1705  ptWgtMC = 1.0;
1706 
1707  if(fFB_Efficiency_Cent[cent10bin]){
1708  ptBinMC = fFB_Efficiency_Cent[cent10bin]->FindBin(ptTrk); //Charge independent MC correction atm.
1709  ptWgtMC = 1.0/fFB_Efficiency_Cent[cent10bin]->GetBinContent(ptBinMC);
1710  }
1711 
1712  RefMultRawFB++;
1713  RefMultCorrFB += ptWgtMC;
1714 
1715 
1716  //------> Get NUA weights for EP <----------
1717  WgtNUA = 1.0;
1718 
1719  if(ChTrk>0){
1720  if(fHCorrectNUApos[cForNUA]){
1721  iBinNUA = fHCorrectNUApos[cForNUA]->FindBin(pVtxZ,phiTrk,etaTrk);
1722  WgtNUA = fHCorrectNUApos[cForNUA]->GetBinContent(iBinNUA);
1723  }
1724  //else{ WgtNUA = 1.0; }
1725  }
1726  else{
1727  if(fHCorrectNUAneg[cForNUA]){
1728  iBinNUA = fHCorrectNUAneg[cForNUA]->FindBin(pVtxZ,phiTrk,etaTrk);
1729  WgtNUA = fHCorrectNUAneg[cForNUA]->GetBinContent(iBinNUA);
1730  }
1731  //else{ WgtNUA = 1.0; }
1732  }
1733 
1734  if(etaTrk < -0.05){
1735  sumTPCQn2x[0] += WgtNUA*TMath::Cos(gPsiN*phiTrk);
1736  sumTPCQn2y[0] += WgtNUA*TMath::Sin(gPsiN*phiTrk);
1737  sumTPCQn3x[0] += WgtNUA*TMath::Cos(3*phiTrk);
1738  sumTPCQn3y[0] += WgtNUA*TMath::Sin(3*phiTrk);
1739  sumTPCQn4x[0] += WgtNUA*TMath::Cos(4*phiTrk);
1740  sumTPCQn4y[0] += WgtNUA*TMath::Sin(4*phiTrk);
1741  multEtaNeg++;
1742  SumWEtaNeg += WgtNUA;
1743  }
1744  else if(etaTrk > 0.05){
1745  sumTPCQn2x[1] += WgtNUA*TMath::Cos(gPsiN*phiTrk);
1746  sumTPCQn2y[1] += WgtNUA*TMath::Sin(gPsiN*phiTrk);
1747  sumTPCQn3x[1] += WgtNUA*TMath::Cos(3*phiTrk);
1748  sumTPCQn3y[1] += WgtNUA*TMath::Sin(3*phiTrk);
1749  sumTPCQn4x[1] += WgtNUA*TMath::Cos(4*phiTrk);
1750  sumTPCQn4y[1] += WgtNUA*TMath::Sin(4*phiTrk);
1751  multEtaPos++;
1752  SumWEtaPos += WgtNUA;
1753  }
1754  sumTPCQn2x[3] += WgtNUA*TMath::Cos(gPsiN*phiTrk);
1755  sumTPCQn2y[3] += WgtNUA*TMath::Sin(gPsiN*phiTrk);
1756  sumTPCQn3x[3] += WgtNUA*TMath::Cos(3*phiTrk);
1757  sumTPCQn3y[3] += WgtNUA*TMath::Sin(3*phiTrk);
1758  sumTPCQn4x[3] += WgtNUA*TMath::Cos(4*phiTrk);
1759  sumTPCQn4y[3] += WgtNUA*TMath::Sin(4*phiTrk);
1760  multEtaFull++;
1761  SumWEtaFull += WgtNUA;
1762  }// track cuts
1763  } // AOD fiter bit
1764 
1765 
1766  if(AODtrack->TestFilterBit(128)) multTPCAll++; // A. Dobrin TPC vs ESD PileUp Cut.
1767 
1768  if(!(AODtrack->TestFilterBit(1))) continue; // cuts for Outlier as in FlowEvent Task
1769 
1770  dEdx = AODtrack->GetDetPid()->GetTPCsignal();
1771 
1772  if((ptTrk < 0.2) || (ptTrk > 5.0) || (TMath::Abs(etaTrk) > 0.8) || (nClustTPC < 70) || (dEdx < 10.0) || (Chi2Trk < 0.1)) continue;
1773 
1774  if(AODtrack->GetDetPid() && Chi2Trk > 0.2) multTPC++;
1775 
1776  if(!AODtrack->TestFilterBit(16) || AODtrack->Chi2perNDF() < 0.1) continue;
1777  Double_t b[2] = {-99., -99.};
1778  Double_t bCov[3] = {-99., -99., -99.};
1779  AliAODTrack copy(*AODtrack);
1780  if(copy.PropagateToDCA(fVevent->GetPrimaryVertex(), fVevent->GetMagneticField(), 100., b, bCov) && TMath::Abs(b[0]) < 0.3 && TMath::Abs(b[1]) < 0.3) multGlobal++;
1781 
1782  }//--- track loop outlier/PileUp ----
1783 
1784  */
1785 
1786 
1787  /*
1788 
1789  Int_t multEsd = ((AliAODHeader*)fAOD->GetHeader())->GetNumberOfESDTracks();
1790  Float_t multESDTPCDiff = (Float_t) multEsd - fPileUpSlopeParm*multTPCAll;
1791 
1792  //cout<<" Info:UserExec() called ... I am after PU cut... event = "<<fEventCount<<" \n";
1793 
1794  if(multESDTPCDiff > fPileUpConstParm) {
1795  fHistPileUpCount->Fill(7.5);
1796  bIsPileup=kTRUE;
1797  }
1798  else if(bIsPileup==kFALSE) {
1799 
1800  if(!fMultSelection->GetThisEventIsNotPileup()){
1801  fHistMultSelPUCount->Fill(0.5);
1802  bIsPileup=kTRUE;
1803  }
1804  if(!fMultSelection->GetThisEventIsNotPileupMV()){
1805  fHistMultSelPUCount->Fill(1.5);
1806  bIsPileup=kTRUE;
1807  }
1808  if(!fMultSelection->GetThisEventIsNotPileupInMultBins()){
1809  fHistMultSelPUCount->Fill(2.5);
1810  bIsPileup=kTRUE;
1811  }
1812  if(!fMultSelection->GetThisEventHasNoInconsistentVertices()){
1813  fHistMultSelPUCount->Fill(2.5);
1814  bIsPileup=kTRUE;
1815  }
1816  if(!fMultSelection->GetThisEventPassesTrackletVsCluster()){
1817  fHistMultSelPUCount->Fill(2.5);
1818  bIsPileup=kTRUE;
1819  }
1820  if(!fMultSelection->GetThisEventIsNotIncompleteDAQ()){
1821  fHistMultSelPUCount->Fill(2.5);
1822  bIsPileup=kTRUE;
1823  }
1824  if(!fMultSelection->GetThisEventHasGoodVertex2016()){
1825  fHistMultSelPUCount->Fill(2.5);
1826  bIsPileup=kTRUE;
1827  }
1828  if(bIsPileup) fHistPileUpCount->Fill(9.5);
1829  }
1830  //-----------------------------------------------------------------
1831 
1832 
1833 
1834 
1835 
1836 
1837 
1838 
1839 
1840  fHistTPCVsESDTrkBefore->Fill(multTPCAll,multEsd); //A. Dobrin
1841  fHistTPCvsGlobalMultBefore->Fill(multGlobal,multTPC);
1842 
1843 
1844  Bool_t bIsOutLier=kFALSE;
1845 
1846  if(multTPC < (-20.0+1.15*multGlobal) || multTPC > (200.+1.45*multGlobal)) { bIsOutLier = kTRUE;}
1847 
1848  fHistEventCount->Fill(stepCount); //6
1849  stepCount++;
1850 
1851 
1852  fHistTPConlyVsCL1Before->Fill(centrCL1,multTPCAll);
1853  fHistTPConlyVsV0MBefore->Fill(centrV0M,multTPCAll);
1854  fHistGlobalVsV0MBefore->Fill(centrV0M, multGlobal);
1855 
1856 
1857  //if bSkipPileUpCut is kTRUE then don't apply PileUp removal.
1858  if(!bSkipPileUpCut && bIsOutLier) return; //outlier TPC vs Global
1859 
1860  fHistTPCvsGlobalMultAfter->Fill(multGlobal,multTPC);
1861 
1862  fHistEventCount->Fill(stepCount); //7
1863  stepCount++;
1864 
1865 
1866  if(!bSkipPileUpCut && bIsPileup) return; //PileUp A. Dobrin
1867 
1868  fHistTPCVsESDTrkAfter->Fill(multTPCAll,multEsd);
1869 
1870  fHistEventCount->Fill(stepCount); //8
1871  stepCount++;
1872  */
1873 
1874 
1875 
1876  //cout<<"After PU cut multTPC = "<<multTPC<<" multGlobal = "<<multGlobal<<endl;
1877 
1878 
1879 
1880 
1881  fHistEventCount->Fill(stepCount); //9
1882  stepCount++;
1883 
1884 
1885 
1886  fHistTPConlyVsCL1After->Fill(centrCL1,multTPCAll);
1887  fHistTPConlyVsV0MAfter->Fill(centrV0M,multTPCAll);
1888  fHistGlobalVsV0MAfter->Fill(centrV0M, multGlobal);
1889 
1890 
1891  // MC corrected Refmult:
1892  fHistRawVsCorrMultFB->Fill(RefMultRawFB,RefMultCorrFB); // FB set by AddTask..
1893 
1894 
1895  Float_t EvtCent = centrality;
1896 
1897 
1898 
1899 
1900  // if(gPsiN > 0 && (multEtaNeg<2 || multEtaPos<2)) return; //Minimum 2 tracks in each eta
1901 
1902  fHistEventCount->Fill(stepCount); //10
1903  stepCount++;
1904 
1905  //--------------------------------------------------------
1906 
1907 
1908 
1909 
1910 
1911 
1912 
1913 
1914 
1915 
1916 
1917 
1918 
1919 
1920 
1921 
1922 
1923 
1924  //--------------- cent CL1 <= 90 cut ------------------
1925  Int_t icentV0Qn = centrCL1; // cent CL1 used for V0 calibration.
1926  icentV0Qn += 1;
1927 
1928  // if(icentV0Qn>90) return;
1929 
1930  fHistEventCount->Fill(stepCount); //11
1931  stepCount++;
1932 
1933 
1934 
1935  /*
1936 
1937  //-------- V0M info ---------------
1938  const AliAODVZERO *fAODV0 = fAOD->GetVZEROData();
1939 
1940  //do v0m recentering
1941  Double_t QxanCor = 0, QyanCor = 0;
1942  Double_t QxcnCor = 0, QycnCor = 0;
1943 
1944  Double_t Qxan3 = 0., Qyan3 = 0.;
1945  Double_t Qxcn3 = 0., Qycn3 = 0.;
1946  Double_t Qxan2 = 0., Qyan2 = 0.;
1947  Double_t Qxcn2 = 0., Qycn2 = 0.;
1948 
1949  Double_t phiV0;
1950  Float_t fMultv0 = 0;
1951  Float_t sumMa = 0;
1952  Float_t sumMc = 0;
1953 
1954 
1955  if(gPsiN>0) { // Calculate EP only for gPsiN > 0
1956 
1957  for(int iV0 = 0; iV0 < 64; iV0++) { //0-31 is V0C, 32-63 VOA
1958 
1959  fMultv0 = fAODV0->GetMultiplicity(iV0);
1960 
1961  if(fHCorrectV0M){
1962  fMultv0 = fMultv0 * fHCorrectV0M->GetBinContent(iV0+1); // Gain Correction
1963  //cout<<"info: run = "<<runNumber<<" cent = "<<centrCL1<<"\t channel = "<<iV0<<" gain = "<<fHCorrectV0M->GetBinContent(iV0+1)<<endl;
1964  }
1965 
1966  fV0MultChVsRun->Fill(iV0+0.5,centrCL1,fMultv0);
1967  //fV0MultChVsRun->Fill(iV0+0.5,runindex,fMultv0);
1968 
1969  phiV0 = TMath::PiOver4()*(0.5 + iV0 % 8);
1970 
1971  if(iV0 < 32){
1972  Qxcn2 += TMath::Cos(2*phiV0) * fMultv0;
1973  Qycn2 += TMath::Sin(2*phiV0) * fMultv0;
1974  Qxcn3 += TMath::Cos(3*phiV0) * fMultv0;
1975  Qycn3 += TMath::Sin(3*phiV0) * fMultv0;
1976  sumMc += fMultv0;
1977  }
1978  else if(iV0 >= 32){
1979  Qxan2 += TMath::Cos(2*phiV0) * fMultv0;
1980  Qyan2 += TMath::Sin(2*phiV0) * fMultv0;
1981  Qxan3 += TMath::Cos(3*phiV0) * fMultv0;
1982  Qyan3 += TMath::Sin(3*phiV0) * fMultv0;
1983  sumMa += fMultv0;
1984  }
1985  }//----- channel loop ----------
1986 
1987 
1988  if(gPsiN==3){
1989  QxanCor = Qxan3/sumMa; //3rd order event plane
1990  QyanCor = Qyan3/sumMa;
1991  QxcnCor = Qxcn3/sumMc;
1992  QycnCor = Qycn3/sumMc;
1993 
1994  if(fHAvgerageQnV0C && fHAvgerageQnV0A && icentV0Qn < 91){
1995  QxanCor -= fHAvgerageQnV0A->GetBinContent(icentV0Qn,3); //x = Cos
1996  QxcnCor -= fHAvgerageQnV0C->GetBinContent(icentV0Qn,3); //x = Cos
1997  QyanCor -= fHAvgerageQnV0A->GetBinContent(icentV0Qn,4); //y = Sin
1998  QycnCor -= fHAvgerageQnV0C->GetBinContent(icentV0Qn,4); //y = Sin
1999 
2000  fV0AQ3xVsCentRun->Fill(centrCL1,QxanCor);
2001  fV0AQ3yVsCentRun->Fill(centrCL1,QyanCor);
2002  fV0CQ3xVsCentRun->Fill(centrCL1,QxcnCor);
2003  fV0CQ3yVsCentRun->Fill(centrCL1,QycnCor);
2004  }
2005  //printf("\n .... I am using my own V0 gain correction for Psi3...\n");
2006  }
2007  else{
2008  QxanCor = Qxan2/sumMa; //2nd order Event plane
2009  QyanCor = Qyan2/sumMa;
2010  QxcnCor = Qxcn2/sumMc;
2011  QycnCor = Qycn2/sumMc;
2012 
2013  if(fHAvgerageQnV0C && fHAvgerageQnV0A && icentV0Qn < 91){
2014  QxanCor -= fHAvgerageQnV0A->GetBinContent(icentV0Qn,1); //x = Cos
2015  QxcnCor -= fHAvgerageQnV0C->GetBinContent(icentV0Qn,1); //x = Cos
2016  QyanCor -= fHAvgerageQnV0A->GetBinContent(icentV0Qn,2); //y = Sin
2017  QycnCor -= fHAvgerageQnV0C->GetBinContent(icentV0Qn,2); //y = Sin
2018 
2019  fV0AQ2xVsCentRun->Fill(centrCL1,QxanCor);
2020  fV0AQ2yVsCentRun->Fill(centrCL1,QyanCor);
2021  fV0CQ2xVsCentRun->Fill(centrCL1,QxcnCor);
2022  fV0CQ2yVsCentRun->Fill(centrCL1,QycnCor);
2023  }
2024  //printf("\n .... I am using my own V0 gain correction for Psi2...\n");
2025  }
2026 
2027  //------ For V0-Qn Recenter and Event plane: Uncorrectd ----------
2028  if(!fHAvgerageQnV0C && !fHAvgerageQnV0A){
2029  fV0CQ2xVsCentRun->Fill(centrCL1,Qxcn2/sumMc);
2030  fV0CQ2yVsCentRun->Fill(centrCL1,Qycn2/sumMc);
2031  fV0AQ2xVsCentRun->Fill(centrCL1,Qxan2/sumMa);
2032  fV0AQ2yVsCentRun->Fill(centrCL1,Qyan2/sumMa);
2033 
2034  fV0CQ3xVsCentRun->Fill(centrCL1,Qxcn3/sumMc);
2035  fV0CQ3yVsCentRun->Fill(centrCL1,Qycn3/sumMc);
2036  fV0AQ3xVsCentRun->Fill(centrCL1,Qxan3/sumMa);
2037  fV0AQ3yVsCentRun->Fill(centrCL1,Qyan3/sumMa);
2038  }
2039 
2040  if(gPsiN>2){
2041  PsiNV0C = 1.0/gPsiN*( TMath::ATan2(QycnCor,QxcnCor) + TMath::Pi() );
2042  PsiNV0A = 1.0/gPsiN*( TMath::ATan2(QyanCor,QxanCor) + TMath::Pi() );
2043  }
2044  else{
2045  PsiNV0C = 1.0/gPsiN*TMath::ATan2(QycnCor,QxcnCor) ;
2046  if(PsiNV0C<0.) PsiNV0C += 2*TMath::Pi()/gPsiN;
2047 
2048  PsiNV0A = 1.0/gPsiN*TMath::ATan2(QyanCor,QxanCor) ;
2049  if(PsiNV0A<0.) PsiNV0A += 2*TMath::Pi()/gPsiN;
2050  }
2051 
2052 
2053  fHV0CEventPlaneVsCent->Fill(EvtCent,PsiNV0C);
2054  fHV0AEventPlaneVsCent->Fill(EvtCent,PsiNV0A);
2055 
2056  } //--------------------- if(gPsiN>0) --------------------------
2057 
2058 
2059  */
2060 
2061 
2062 
2063 
2064 
2065 
2066 
2067 
2068 
2069 
2070 
2071 
2072  //---- Copies of TPC-Q vectors to remove track -by- track auto-correlation -----
2073 
2074  Double_t sumQxTPCneg;
2075  Double_t sumQyTPCneg;
2076  Double_t sumQxTPCpos;
2077  Double_t sumQyTPCpos;
2078  Double_t sumQxTPCneg2;
2079  Double_t sumQyTPCneg2;
2080  Double_t sumQxTPCpos2;
2081  Double_t sumQyTPCpos2;
2082  Double_t SumWgtNeg, SumWgtPos;
2083  Double_t SumWgtNeg2, SumWgtPos2;
2084 
2085 
2086 
2087  //--------- Track variable for PID/Charge studies ----------------
2088  Double_t PDGmassPion = 0.13957;
2089  Double_t PDGmassKaon = 0.49368;
2090  Double_t PDGmassProton = 0.93827;
2091 
2092  PDGmassProton *= PDGmassProton;
2093  PDGmassPion *= PDGmassPion;
2094  PDGmassKaon *= PDGmassKaon;
2095 
2096  Double_t dEdx1, dEdx2, dPhi1, dPhi2, dPt1, dPt2;
2097  Double_t dEta1, dEta2, ptw1, ptw2, deltaPhi;
2098  Double_t mom, w1NUA, w2NUA, WgtEP;
2099  Double_t nSigTOFpion, nSigTPCpion;
2100  Double_t nSigTOFkaon, nSigTPCkaon;
2101  Double_t nSigTOFproton,nSigTPCproton;
2102  Double_t nSigTOFpion2, nSigTPCpion2;
2103  Double_t nSigTOFkaon2, nSigTPCkaon2;
2104  Double_t nSigTOFproton2,nSigTPCproton2;
2105 
2106  //Tof variables
2107  //Double_t length, tofTime, probMis, mass, beta;
2108  //Double_t c = TMath::C()*1.E-9; //bright light m/ns
2109  //Int_t TOFmatch=0;
2110 
2111 
2112 
2113  Int_t ptBin,gCharge1,gCharge2;
2114 
2115  //Double_t dcaXY, dcaZ ;
2116 
2117 
2118  //----------- Set the desired Harmonic ------------
2119  Int_t n = gN;
2120  Int_t m = gM;
2121  Int_t p =n+m;
2122  //------------------------------------------------
2123 
2124 
2125  Int_t skipPairHBT = 0;
2126 
2127 
2128 
2129 
2130 
2131  Double_t Chi2Trk1,ptwPion1,ptwKaon1,ptwProton1;
2132  Double_t Chi2Trk2,ptwPion2,ptwKaon2,ptwProton2;
2133  Double_t wNUAPion1,wNUAKaon1,wNUAProton1;
2134  Double_t wNUAPion2,wNUAKaon2,wNUAProton2;
2135 
2136  Double_t WgtEPPion = 1.0;
2137  Double_t WgtEPKaon = 1.0;
2138  Double_t WgtEPProton = 1.0;
2139 
2140 
2141  Bool_t isPion1 = kFALSE;
2142  Bool_t isKaon1 = kFALSE;
2143  Bool_t isProton1 = kFALSE;
2144  Bool_t isPion2 = kFALSE;
2145  Bool_t isKaon2 = kFALSE;
2146  Bool_t isProton2 = kFALSE;
2147 
2148  Int_t multPOI1st = 0;
2149  Int_t multPOI2nd = 0;
2150 
2151 
2152 
2153 
2154 
2155 
2156 
2157  //Correct with Centrality Wgts : in second pass
2158  Int_t iCentBinWgt = (Int_t) centrality;
2159  iCentBinWgt += 1;
2160 
2161  Double_t fWgtCent = 1.0;
2162 
2163  if(fHCentWeightForRun){
2164  fWgtCent = fHCentWeightForRun->GetBinContent(iCentBinWgt);
2165  }
2166 
2167  //Fill Centrality for run-by-run: in first pass over data
2168  fCentDistAfter->Fill(centrality);
2169 
2170 
2171 
2172 
2173 
2174 
2175 
2176  // cout<<" Info:UserExec() I am before ... AliAODMCHeader, cent = "<<centrality<<" \n";
2177 
2178 
2179 
2180 
2181 
2182  // For productions with injected signals, figure out above which label to skip particles/tracks
2183  Int_t skipParticlesAbove = 0;
2184 
2185  AliGenEventHeader* eventHeader = 0;
2186  //Int_t headers = 0;
2187 
2188  // AOD only
2189  // AliAODMCHeader* header = (AliAODMCHeader*) fAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName());
2190  // if(!header) {
2191  // printf("fInjectedSignals set but no MC header found");
2192  // return;
2193  // }
2194 
2195  //headers = header->GetNCocktailHeaders();
2196  //eventHeader = header->GetCocktailHeader(0);
2197 
2198  // if(!eventHeader)
2199  // {
2200  // return;
2201  // }
2202 
2203  //skipParticlesAbove = eventHeader->NProduced();
2204  //AliInfo(Form("Injected signals in this event (%d headers). Keeping particles/tracks of %s. Will skip particles/tracks above %d.", headers, eventHeader->ClassName(), skipParticlesAbove));
2205 
2206 
2207 
2208 
2209 
2210 
2211 
2212 
2213 
2214 
2215 
2216 
2217 
2218 
2219 
2220 
2221 
2222 
2223 
2224 
2225 
2226  //++++++++++++++++++ MC tracks+++++++++++++++++++++//
2227  Int_t nMCLabelCounter = 0;
2228 
2229  //cout<<mcEvent<<endl;
2230 
2231  //Int_t nMCParticles = mcEvent->GetNumberOfTracks();
2232  Int_t nMCParticles = mcEvent->GetNumberOfPrimaries();
2233 
2234  // cout<<" number of mc primaries = "<<nMCParticles<<endl;
2235 
2236  TArrayI labelMCArray(nMCParticles);
2237  Bool_t labelTPC = kTRUE;
2238  Int_t pdgIndex = 0;
2239  Int_t LabelOfMother = 0;
2240 
2241  Double_t ReQn[3] = {0.,};
2242  Double_t ImQn[3] = {0.,};
2243 
2244  Double_t ReQ1P=0, ReQ1N=0, ImQ1P=0, ImQ1N=0;// = 0;
2245  Double_t ReQ2P=0, ImQ2P=0, ReQ2N=0, ImQ2N=0;// = 0;
2246  Double_t ReQ3P=0, ImQ3P=0, ReQ3N=0, ImQ3N=0;
2247  Double_t ReQ4P=0, ImQ4P=0, ReQ4N=0, ImQ4N=0;
2248  Double_t CMEres = 0, MQP=0, MQN=0, MQ=0;
2249  Double_t MEtaPos = 0, MEtaNeg = 0;
2250  Double_t QxEP[3] = {0.,};
2251  Double_t QyEP[3] = {0.,};
2252  Double_t QxEPPos[3] = {0.,};
2253  Double_t QyEPPos[3] = {0.,};
2254  Double_t QxEPNeg[3] = {0.,};
2255  Double_t QyEPNeg[3] = {0.,};
2256 
2257  //Array for Nested Loop:
2258  //Double_t pTMCtrack[5000] = {0,}; //dont need pT
2259  Double_t PhiMCtrack[5000] = {0,};
2260  Double_t EtaMCtrack[5000] = {0,};
2261  Int_t ChMCtrack[5000] = {0,};
2262  Int_t iLoop = 0;
2263 
2264 
2265 
2266  for (Int_t iTracks = 0; iTracks < nMCParticles; iTracks++) {
2267  //AliAODMCParticle *mcTrack = (AliAODMCParticle*) mcEvent->GetTrack(iTracks);
2268  AliMCParticle* mcTrack = dynamic_cast<AliMCParticle *> (mcEvent->GetTrack(iTracks));
2269  if(!mcTrack) {
2270  AliError(Form("ERROR: Could not receive track %d (mc loop)", iTracks));
2271  continue;
2272  }
2273 
2274  if(!(mcEvent->IsPhysicalPrimary(iTracks))) continue;
2275 
2276  //exclude particles generated out of the acceptance
2277  Double_t vz = mcTrack->Zv();
2278  if(TMath::Abs(vz) > 50.0) continue;
2279  //acceptance
2280  //if(mcTrack->Eta() > fMaxEtaCut || mcTrack->Eta() < fMinEtaCut)
2281  //continue;
2282  Double_t y = mcTrack->Y();
2283  if(TMath::Abs(y) > 0.8) continue; // why do I need this cut?
2284  //if(mcTrack->Pt() > 5.0 || mcTrack->Pt() < 0.1) continue;
2285 
2286  //TString generatorName;
2287  //Bool_t hasGenerator = mcEvent->GetCocktailGenerator(iTracks,generatorName);
2288  //cout<<" generator Name : "<<generatorName.Data()<<endl;
2289  //if((!hasGenerator) || (!generatorName.Contains("AMPT"))) continue;
2290 
2291  LabelOfMother = mcTrack->GetMother();
2292  if(LabelOfMother>0) continue;
2293 
2294  //if(!mcTrack->IsPhysicalPrimary()) continue; works for AODmc
2295 
2296 
2297  //--------- Now load mcTrack parameters ------------
2298  dPt1 = mcTrack->Pt();
2299  gCharge1 = mcTrack->Charge();
2300 
2301  if(gCharge1>0) gCharge1 = 1;
2302  else if(gCharge1<0) gCharge1 = -1;
2303 
2304  Int_t pdgcode = TMath::Abs(mcTrack->PdgCode());
2305 
2306  //cout<<" pdgcode : "<<pdgcode<<endl;
2307 
2308 
2309 
2310  /*
2311  //check PID strategy
2312  switch (pdgcode) {
2313  case 11:
2314  pdgIndex = 0; //e
2315  //hTrue[pdgIndex][chargeBin]->Fill(pt);
2316  break;
2317  case 13:
2318  pdgIndex = 1; //mu
2319  //hTrue[pdgIndex][chargeBin]->Fill(pt);
2320  break;
2321  case 211:
2322  pdgIndex = 2; //pi
2323  fHistPtwithoutPIDcut[0][cIndex]->Fill(dPt1*gCharge1); //Pion
2324  fHistPtwithoutPIDcut[3][cIndex]->Fill(dPt1*gCharge1); //charge
2325  break;
2326  case 321:
2327  pdgIndex = 3; //K
2328  //hTrue[pdgIndex][chargeBin]->Fill(pt);
2329  fHistPtwithoutPIDcut[1][cIndex]->Fill(dPt1*gCharge1); //Kaon
2330  fHistPtwithoutPIDcut[3][cIndex]->Fill(dPt1*gCharge1); //charge
2331  break;
2332  case 2212:
2333  pdgIndex = 4; //p
2334  //hTrue[pdgIndex][chargeBin]->Fill(pt);
2335  fHistPtwithoutPIDcut[2][cIndex]->Fill(dPt1*gCharge1); //Proton
2336  fHistPtwithoutPIDcut[3][cIndex]->Fill(dPt1*gCharge1); //charge
2337  break;
2338  } */
2339 
2340  if(pdgcode==211 || pdgcode==321 || pdgcode==2212){
2341 
2342  //labelMCArray.AddAt(iTracks,nMCLabelCounter);
2343 
2344  //------------- For v2 and gamma/delta calculation -----------
2345  if(dPt1>0.2 && dPt1<5.0){
2346 
2347  dEta1 = mcTrack->Eta();
2348 
2349  if(TMath::Abs(dEta1)<0.8){
2350  dPhi1 = mcTrack->Phi();
2351  //cout<<iTracks<<" pt = "<<dPt1<<"\t phi = "<<dPhi1<<"\t dEta1 = "<<dEta1<<"\tch = "<<gCharge1<<endl;
2352 
2353  //Storing for next loop
2354  PhiMCtrack[iLoop] = dPhi1;
2355  EtaMCtrack[iLoop] = dEta1;
2356  ChMCtrack[iLoop] = gCharge1;
2357  iLoop++;
2358 
2359  for(int h=0; h<3; h++) {
2360  ReQn[h] += TMath::Cos((h+2.)*dPhi1);
2361  ImQn[h] += TMath::Sin((h+2.)*dPhi1);
2362  //TPC Event plane for |n|<0.4
2363  if(TMath::Abs(dEta1)>0){
2364  QxEPPos[h] += TMath::Cos((h+2.)*dPhi1);
2365  QyEPPos[h] += TMath::Sin((h+2.)*dPhi1);
2366  MEtaPos++;
2367  }
2368  else if(TMath::Abs(dEta1)<0){
2369  QxEPNeg[h] += TMath::Cos((h+2.)*dPhi1);
2370  QyEPNeg[h] += TMath::Sin((h+2.)*dPhi1);
2371  MEtaNeg++;
2372  }
2373  }
2374  MQ++;
2375 
2376 
2377 
2378  if(gCharge1 > 0) {
2379  ReQ1P += TMath::Cos(dPhi1);
2380  ImQ1P += TMath::Sin(dPhi1);
2381  ReQ2P += TMath::Cos(2*dPhi1);
2382  ImQ2P += TMath::Sin(2*dPhi1);
2383  ReQ3P += TMath::Cos(3*dPhi1);
2384  ImQ3P += TMath::Sin(3*dPhi1);
2385  ReQ4P += TMath::Cos(4*dPhi1);
2386  ImQ4P += TMath::Sin(4*dPhi1);
2387  MQP++;
2388  } else {
2389  ReQ1N += TMath::Cos(dPhi1);
2390  ImQ1N += TMath::Sin(dPhi1);
2391  ReQ2N += TMath::Cos(2*dPhi1);
2392  ImQ2N += TMath::Sin(2*dPhi1);
2393  ReQ3N += TMath::Cos(3*dPhi1);
2394  ImQ3N += TMath::Sin(3*dPhi1);
2395  ReQ4N += TMath::Cos(4*dPhi1);
2396  ImQ4N += TMath::Sin(4*dPhi1);
2397  MQN++;
2398  }
2399  }//global EtaCut for tracks
2400 
2401  }
2402  //---------------------- upto this (v2,gamma) -----------------------
2403  }//PID check using PDG value
2404 
2405  if(nMCLabelCounter>40000) break;
2406  nMCLabelCounter++;
2407 
2408  }//------------ mc track loop
2409 
2410  // cout<<""<<" MQ = "<<MQ<<"\t MQP = "<<MQP<<"\t MQN = "<<MQN<<"\t centrality = "<<centrality<<endl;
2411 
2412 
2413 
2414 
2415 
2416  Double_t newQx2,newQx3,newQx4;
2417  Double_t newQy2,newQy3,newQy4;
2418 
2419  Double_t newQx2b,newQx3b,newQx4b;
2420  Double_t newQy2b,newQy3b,newQy4b;
2421 
2422  Double_t Psi2TPC=0,Psi3TPC=0,Psi4TPC=0;
2423 
2424  //Now nested loop for gamma Correlator:
2425  for(int i=0;i<iLoop;i++){
2426 
2427  dPhi1 = PhiMCtrack[i];
2428  dEta1 = EtaMCtrack[i];
2429  gCharge1 = ChMCtrack[i];
2430 
2431  //'newQn' should be restored to original value:
2432  newQx2 = QxEPPos[0];
2433  newQx3 = QxEPPos[1];
2434  newQx4 = QxEPPos[2];
2435 
2436  newQy2 = QyEPPos[0];
2437  newQy3 = QyEPPos[1];
2438  newQy4 = QyEPPos[2];
2439 
2440  if(dEta1>0){ //remove 1st track
2441  newQx2 -= TMath::Cos(2.*dPhi1);
2442  newQx3 -= TMath::Cos(3.*dPhi1);
2443  newQx4 -= TMath::Cos(4.*dPhi1);
2444 
2445  newQy2 -= TMath::Sin(2.*dPhi1);
2446  newQy3 -= TMath::Sin(3.*dPhi1);
2447  newQy4 -= TMath::Sin(4.*dPhi1);
2448  }
2449 
2450  //---------- 2nd loop -----------
2451  for(int j=0;j<iLoop;j++){
2452 
2453  if(i==j) continue;
2454 
2455  dPhi2 = PhiMCtrack[j];
2456  dEta2 = EtaMCtrack[j];
2457  gCharge2 = ChMCtrack[j];
2458 
2459  //'newQnb' should be restored to 1st track removed value;
2460  newQx2b = newQx2;
2461  newQx3b = newQx3;
2462  newQx4b = newQx4;
2463 
2464  newQy2b = newQy2;
2465  newQy3b = newQy3;
2466  newQy4b = newQy4;
2467 
2468  if(dEta2>0){ //remove 2nd track
2469  newQx2b -= TMath::Cos(2.*dPhi2);
2470  newQx3b -= TMath::Cos(3.*dPhi2);
2471  newQx4b -= TMath::Cos(4.*dPhi2);
2472 
2473  newQy2b -= TMath::Sin(2.*dPhi2);
2474  newQy3b -= TMath::Sin(3.*dPhi2);
2475  newQy4b -= TMath::Sin(4.*dPhi2);
2476  }
2477 
2478  //now form the EPs:
2479  Psi2TPC = (1/2.)*(TMath::ATan2(newQy2b,newQx2b));
2480  if(Psi2TPC<0.) Psi2TPC += 2*TMath::Pi()/2.0;
2481 
2482  Psi3TPC = (1/3.)*(TMath::ATan2(newQy3b,newQx3b) + TMath::Pi());
2483 
2484  Psi4TPC = (1/4.)*(TMath::ATan2(newQy4b,newQx4b));
2485  if(Psi4TPC<0.) Psi4TPC += 2*TMath::Pi()/4.0;
2486 
2487  if(gCharge1!=gCharge2){//Unlike Sign
2488  fCMEPro[1]->Fill(centrality, TMath::Cos( dPhi1 + dPhi1 - 2*Psi2TPC));
2489  fCMEPro[3]->Fill(centrality, TMath::Cos( dPhi1 + 2*dPhi1 - 3*Psi3TPC));
2490  fCMEPro[5]->Fill(centrality, TMath::Cos( dPhi1 - 3*dPhi1 + 2*Psi2TPC));
2491  fCMEPro[7]->Fill(centrality, TMath::Cos(2*dPhi1 + 2*dPhi1 - 4*Psi4TPC));
2492  }
2493  else{ //Like Sign
2494  fCMEPro[0]->Fill(centrality, TMath::Cos( dPhi1 + dPhi1 - 2*Psi2TPC));
2495  fCMEPro[2]->Fill(centrality, TMath::Cos( dPhi1 + 2*dPhi1 - 3*Psi3TPC));
2496  fCMEPro[4]->Fill(centrality, TMath::Cos( dPhi1 - 3*dPhi1 + 2*Psi2TPC));
2497  fCMEPro[6]->Fill(centrality, TMath::Cos(2*dPhi1 + 2*dPhi1 - 4*Psi4TPC));
2498  }
2499  }//j-loop
2500  }//i-loop
2501 
2502 
2503  fCentDistBefore->Fill(iLoop);
2504 
2505  // cout<<"track for nested loop: "<<iLoop<<"\t MQP = "<<MQP<<"\t MQN = "<<MQN<<"\t centrality = "<<centrality<<endl;
2506 
2507 
2508 
2509 
2510 
2511 
2512 
2513  Double_t Psi2TPCA = (1/2.)*(TMath::ATan2(QyEPPos[0],QxEPPos[0]));
2514  if(Psi2TPCA<0.) Psi2TPCA += 2*TMath::Pi()/2.0;
2515 
2516  Double_t Psi3TPCA = (1/3.)*(TMath::ATan2(QyEPPos[1],QxEPPos[1]) + TMath::Pi());
2517 
2518  Double_t Psi4TPCA = (1/4.)*(TMath::ATan2(QyEPPos[2],QxEPPos[2]));
2519  if(Psi4TPCA<0.) Psi4TPCA += 2*TMath::Pi()/4.0;
2520  //------------------
2521  Double_t Psi2TPCC = (1/2.)*(TMath::ATan2(QyEPNeg[0],QxEPNeg[0]));
2522  if(Psi2TPCC<0.) Psi2TPCC += 2*TMath::Pi()/2.0;
2523 
2524  Double_t Psi3TPCC = (1/3.)*(TMath::ATan2(QyEPNeg[1],QxEPNeg[1]) + TMath::Pi());
2525 
2526  Double_t Psi4TPCC = (1/4.)*(TMath::ATan2(QyEPNeg[2],QxEPNeg[2]));
2527  if(Psi4TPCC<0.) Psi4TPCC += 2*TMath::Pi()/4.0;
2528 
2529 
2530 
2531  fHTPCAEventPlaneVsCent->Fill(centrality,Psi2TPCA);
2532  fHTPCCEventPlaneVsCent->Fill(centrality,Psi3TPCA);
2533  fHTPCEventPlaneVsCent->Fill(centrality, Psi4TPCA);
2534 
2535  fResolution_TPCEP[0]->Fill(centrality,TMath::Cos(2.*(Psi2TPCA - Psi2TPCC)));
2536  fResolution_TPCEP[1]->Fill(centrality,TMath::Cos(3.*(Psi3TPCA - Psi3TPCC)));
2537  fResolution_TPCEP[2]->Fill(centrality,TMath::Cos(4.*(Psi4TPCA - Psi4TPCC)));
2538 
2539 
2540  //Fill v2 values: Rihan
2541  if(MQ>1){
2542  for(int h=0; h<3; h++) {
2543  V2IntProQC[h]->Fill(centrality,(ReQn[h]*ReQn[h]+ImQn[h]*ImQn[h]-MQ)/(MQ*(MQ-1.)),MQ*(MQ-1.));
2544  }
2545  }
2546 
2547  if(MQP>1 && MQN>1) {
2548  //Fill Delta Correlations:
2549  CMEres = (ReQ1P*ReQ1P+ImQ1P*ImQ1P-MQP)/(MQP*MQP-MQP);
2550  fDnnPro[0]->Fill(centrality,CMEres,MQP*MQP-MQP);
2551  CMEres = (ReQ1P*ReQ1N+ImQ1P*ImQ1N)/(MQP*MQN);
2552  fDnnPro[1]->Fill(centrality,CMEres,MQP*MQN);
2553 
2554  CMEres = (ReQ2P*ReQ2P+ImQ2P*ImQ2P-MQP)/(MQP*MQP-MQP);
2555  fDnnPro[2]->Fill(centrality,CMEres,MQP*MQP-MQP);
2556  CMEres = (ReQ2P*ReQ2N+ImQ2P*ImQ2N)/(MQP*MQN);
2557  fDnnPro[3]->Fill(centrality,CMEres,MQP*MQN);
2558 
2559  CMEres = (ReQ3P*ReQ3P+ImQ3P*ImQ3P-MQP)/(MQP*MQP-MQP);
2560  fDnnPro[4]->Fill(centrality,CMEres,MQP*MQP-MQP);
2561  CMEres = (ReQ3P*ReQ3N+ImQ3P*ImQ3N)/(MQP*MQN);
2562  fDnnPro[5]->Fill(centrality,CMEres,MQP*MQN);
2563 
2564  CMEres = (ReQ4P*ReQ4P+ImQ4P*ImQ4P-MQP)/(MQP*MQP-MQP);
2565  fDnnPro[6]->Fill(centrality,CMEres,MQP*MQP-MQP);
2566  CMEres = (ReQ4P*ReQ4N+ImQ4P*ImQ4N)/(MQP*MQN);
2567  fDnnPro[7]->Fill(centrality,CMEres,MQP*MQN);
2568 
2569 
2570  //----------- Gamma Correlators ------------
2571  /*
2572  //C112
2573  CMEres = ((ReQ1P*ReQ1P-ImQ1P*ImQ1P-ReQ2P)*cos(2.*Psi2TPC)+(2.*ReQ1P*ImQ1P-ImQ2P)*sin(2.*Psi2TPC))/(MQP*MQP-MQP);
2574  fCMEPro[0]->Fill(centrality,CMEres,MQP*MQP-MQP);
2575  CMEres = ((ReQ1P*ReQ1N-ImQ1P*ImQ1N)*cos(2.*Psi2TPC)+(ReQ1P*ImQ1N+ImQ1P*ReQ1N)*sin(2.*Psi2TPC))/(MQP*MQN);
2576  fCMEPro[1]->Fill(centrality,CMEres,MQP*MQN);
2577 
2578  //Rihan C123
2579  CMEres = ((ReQ1P*ReQ2P-ImQ1P*ImQ2P-ReQ3P)*cos(3.*Psi3TPC)+(ReQ1P*ImQ2P+ReQ2P*ImQ1P-ImQ3P)*sin(3.*Psi3TPC))/(MQP*(MQP-1.));
2580  fCMEPro[2]->Fill(centrality,CMEres,MQP*(MQP-1.));
2581  CMEres = ((ReQ1P*ReQ2N-ImQ1P*ImQ2N)*cos(3.*Psi3TPC)+(ReQ1P*ImQ2N+ImQ1P*ReQ2N)*sin(3.*Psi3TPC))/(MQP*MQN);
2582  fCMEPro[3]->Fill(centrality,CMEres,MQP*MQN);
2583 
2584  //Rihan C132
2585  CMEres = ((ReQ1P*ReQ3P+ImQ1P*ImQ3P-ReQ2P)*cos(2.*Psi2TPC)+(ReQ1P*ImQ3P-ImQ1P*ReQ3P-ImQ2P)*sin(2.*Psi2TPC))/(MQP*(MQP-1.));
2586  fCMEPro[4]->Fill(centrality,CMEres,MQP*(MQP-1.));
2587  CMEres = ((ReQ1P*ReQ3N+ImQ1P*ImQ3N)*cos(2.*Psi2TPC)+(ReQ1P*ImQ3N-ReQ3N*ImQ1P)*sin(2.*Psi2TPC))/(MQP*MQN);
2588  fCMEPro[5]->Fill(centrality,CMEres,MQP*MQN);
2589 
2590  //Rihan C224
2591  CMEres = ((ReQ2P*ReQ2P-ImQ2P*ImQ2P-ReQ4P)*cos(4.*Psi4TPC)+(2.*ReQ2P*ImQ2P-ImQ4P)*sin(4.*Psi4TPC))/(MQP*MQP-MQP);
2592  fCMEPro[6]->Fill(centrality,CMEres,MQP*MQP-MQP);
2593  CMEres = ((ReQ2P*ReQ2N-ImQ2P*ImQ2N)*cos(4.*Psi4TPC)+(ReQ2P*ImQ2N+ReQ2N*ImQ2P)*sin(4.*Psi4TPC))/(MQP*MQN);
2594  fCMEPro[7]->Fill(centrality,CMEres,MQP*MQN);
2595  */
2596  }
2597 
2598 
2599 
2600 
2601 
2602  PostData(1,fListHist);
2603 
2604  fHistEventCount->Fill(14.5); //15th bin is last one
2605  stepCount++;
2606 
2607 
2608 
2609 
2610 
2611 
2612 
2613  //if(fEventCount%5==0)
2614  //cout<<"Ev = "<<fEventCount<<"\tMult = "<<multEtaFull<<"\t nMCLabelCounter = "<<nMCLabelCounter<<"\t MatchedReco = "<< nMatchedRecoTrk <<endl;
2615 
2616 
2617  fEventCount++;
2618 
2619 
2620 }//================ UserExec ==============
2621 
2622 
2623 
2624 
2625 
2626 
2627 
2628 
2629 
2630 
2631 
2632 
2633 
2634 
2635 
2636 
2637 
2638 
2639 
2640 
2641 
2642 
2644 
2645 
2646 
2647 
2648 double AliAnalysisTaskCMEMC::GetWDist(const AliVVertex* v0, const AliVVertex* v1)
2649 {
2650  // calculate sqrt of weighted distance to other vertex
2651  if (!v0 || !v1) {
2652  AliDebug(2,"\n\n ::GetWDist => One of vertices is not valid\n\n");
2653  return 0;
2654  }
2655  static TMatrixDSym vVb(3);
2656  double dist = -1;
2657  double dx = v0->GetX()-v1->GetX();
2658  double dy = v0->GetY()-v1->GetY();
2659  double dz = v0->GetZ()-v1->GetZ();
2660  double cov0[6],cov1[6];
2661  v0->GetCovarianceMatrix(cov0);
2662  v1->GetCovarianceMatrix(cov1);
2663  vVb(0,0) = cov0[0]+cov1[0];
2664  vVb(1,1) = cov0[2]+cov1[2];
2665  vVb(2,2) = cov0[5]+cov1[5];
2666  vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];
2667  vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;
2668  vVb.InvertFast();
2669  if (!vVb.IsValid()) {
2670  AliDebug(2,"Singular Matrix\n");
2671  return dist;
2672  }
2673  dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz
2674  + 2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;
2675  return dist>0 ? TMath::Sqrt(dist) : -1;
2676 }
2677 
2678 
2680  { // check for multi-vertexer pile-up
2681  const int kMinPlpContrib = 5;
2682  const double kMaxPlpChi2 = 5.0;
2683  const double kMinWDist = 15;
2684 
2685  const AliVVertex* vtPrm = 0;
2686  const AliVVertex* vtPlp = 0;
2687 
2688  int nPlp = 0;
2689 
2690  if(!(nPlp=faod->GetNumberOfPileupVerticesTracks()))
2691  return kFALSE;
2692 
2693  vtPrm = faod->GetPrimaryVertex();
2694  if(vtPrm == faod->GetPrimaryVertexSPD())
2695  return kTRUE; // there are pile-up vertices but no primary
2696 
2697  //int bcPrim = vtPrm->GetBC();
2698 
2699  for(int ipl=0;ipl<nPlp;ipl++) {
2700  vtPlp = (const AliVVertex*)faod->GetPileupVertexTracks(ipl);
2701  if (vtPlp->GetNContributors() < kMinPlpContrib) continue;
2702  if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;
2703  //int bcPlp = vtPlp->GetBC();
2704  //if (bcPlp!=AliVTrack::kTOFBCNA && TMath::Abs(bcPlp-bcPrim)>2)
2705  // return kTRUE; // pile-up from other BC
2706 
2707  double wDst = GetWDist(vtPrm,vtPlp);
2708  if (wDst<kMinWDist) continue;
2709 
2710  return kTRUE; // pile-up: well separated vertices
2711  }
2712  return kFALSE;
2713 }
2714 
2715 
2716 
2718  /*if(bApplyMCcorr){
2719  if(!gGrid){
2720  TGrid::Connect("alien://");
2721  }
2722  if(!mfileFBHijing){
2723  mfileFBHijing = TFile::Open(sMCfilePath,"READ");
2724  fListFBHijing = dynamic_cast<TList*>(mfileFBHijing->FindObjectAny("fMcEffiHij")); */
2725 
2726  if(fListFBHijing) {
2727  cout<<"\n =========> Info: Using MC efficiency correction Map <=========== "<<endl;
2728  for(int i=0;i<10;i++) {
2729  fFB_Efficiency_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_%d",i));
2730  }
2731  //PID :
2732  for(int i=0;i<10;i++) {
2733  fFB_Efficiency_Pion_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_Pion_%d",i));
2734  fFB_Efficiency_Kaon_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_Kaon_%d",i));
2735  fFB_Efficiency_Proton_Cent[i] = (TH1D *) fListFBHijing->FindObject(Form("eff_unbiased_Proton_%d",i));
2736  }
2737 
2738  //------- Fill the flags: --------------
2740  fHistTaskConfigParameters->SetBinContent(19,1);
2741  }
2743  fHistTaskConfigParameters->SetBinContent(20,1);
2744  }
2746  fHistTaskConfigParameters->SetBinContent(21,1);
2747  }
2749  fHistTaskConfigParameters->SetBinContent(22,1);
2750  }
2751  }
2752  else if(!fListFBHijing){
2753  std::cout<<"\n\n !!!!**** Warning: FB Efficiency File/List not found Use Weight = 1.0 *****\n\n"<<std::endl;
2754  //exit(1);
2755  }
2756 }
2757 
2758 
2759 //____________________________________________________________________//
2761  //Checks if the label is used already
2762  Bool_t status = kFALSE;
2763  for(Int_t i = 0; i < labelArray.GetSize(); i++) {
2764  if(labelArray.At(i) == label)
2765  status = kTRUE;
2766  }
2767 
2768  return status;
2769 }
2770 
2771 
2772 
2774 
2775  Int_t cIndex = 0;
2776 
2777  if(fCent<5.0) {
2778  cIndex = 0;
2779  }
2780  else if(fCent>=5.0 && fCent<10){
2781  cIndex = 1;
2782  }
2783  else if(fCent>=10.0) {
2784  cIndex = abs(fCent/10.0)+1;
2785  }
2786  return cIndex;
2787 }
2788 
2790  //std::cout<<" centrality outlier function called "<<std::endl;
2791  Float_t fMeanTPC[100] = {2902.95,2758.33,2642.78,2536.67,2435.37,2340.06,2248.44,2163.71,2080.49,2001.54,1925.86,1852.64,1781.97,1715.56,1650.53,1587.23,1527.51,1468.19,1412.73,1357.86,1305.35,1254.33,1205.57,1157.28,1111.53,1066.42,1023.15,981.594,940.795,901.766,863.651,826.183,790.53,756.358,722.654,690.513,659.443,628.807,599.748,571.664,544.446,518.042,492.369,468.072,444.694,422.487,400.104,379.129,359.147,339.62,320.817,302.788,285.791,269.015,253.688,238.671,224.039,209.932,196.915,184.647,172.76,161.381,150.395,140.288,131.033,121.58,113.112,104.938,97.3078,90.2178,83.5974,77.2645,70.7126,65.4424,60.1404,55.5644,50.8314,46.3761,43.024,38.625,35.3435,32.2304,29.4192,26.821,24.3303,21.9332,19.4215,16.7163,14.9414,13.1092,0.};
2792 
2793  Float_t fSigmaTPC[100] = {122.209,107.901,103.452,100.498,97.7403,94.7845,93.2543,90.0548,88.1106,85.7382,84.0812,82.2978,80.3817,78.6002,77.3448,75.5086,73.6842,71.9733,70.3447,69.1999,67.878,66.3511,65.0406,63.4866,62.4409,60.7899,59.1328,58.426,56.8618,55.8871,54.1031,53.4959,52.0482,51.0441,49.6218,48.7646,47.5166,46.5247,45.0727,44.4311,43.4531,42.0404,41.0238,40.1384,39.2588,38.2461,36.5951,36.0552,35.3727,33.7883,32.7167,32.4486,31.3709,30.3444,29.505,28.5139,27.4471,26.5359,25.9506,25.127,24.3797,23.2985,22.279,21.4698,20.781,20.8193,19.9509,18.8036,17.9145,16.961,16.7375,15.852,14.9324,14.7663,13.5969,13.4533,12.3067,12.7835,11.7283,10.6758,10.6676,10.6492,9.04614,8.89065,8.66093,8.50997,7.98812,6.91087,7.12045,7.29593,0.};
2794 
2795  for(int i=0;i<90;i++) {
2796  hCentvsTPCmultCuts->SetBinContent(i+1,1,fMeanTPC[i]);
2797  hCentvsTPCmultCuts->SetBinContent(i+1,2,fSigmaTPC[i]);
2798  }
2799 }
2800 
2801 
2802 
2803 
2804 
2805 
2807 
2808  fHistTaskConfigParameters = new TH1F("fHistTaskConfigParameters","Task parameters",25,0,25);
2809  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(1,"FilterBit");
2810  fHistTaskConfigParameters->SetBinContent(1,fFilterBit);
2811  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(2,"n#sigmaTPC");
2812  fHistTaskConfigParameters->SetBinContent(2,fNSigmaCut);
2813  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(3,"MinPt");
2814  fHistTaskConfigParameters->SetBinContent(3,fMinPtCut);
2815  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(4,"MaxPt");
2816  fHistTaskConfigParameters->SetBinContent(4,fMaxPtCut);
2817  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(5,"MinEta");
2818  fHistTaskConfigParameters->SetBinContent(5,fMinEtaCut);
2819  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(6,"MaxEta");
2820  fHistTaskConfigParameters->SetBinContent(6,fMaxEtaCut);
2821 
2822  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(11,"CentralityMin");
2824  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(12,"CentralityMax");
2826 
2827  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(13,"VertexMin(cm)");
2828  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(14,"VertexMax(cm)");
2829 
2830 
2831  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(15,"NUA Charge");
2832  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(16,"NUA Pion");
2833  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(17,"NUA Kaon");
2834  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(18,"NUA Proton");
2835 
2836  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(19,"MC Charge");
2837  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(20,"MC Pion");
2838  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(21,"MC Kaon");
2839  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(22,"MC Proton");
2840 
2841  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(23,"V0 Gain Eq.");
2842  fHistTaskConfigParameters->GetXaxis()->SetBinLabel(24,"V0 Qn Recenter");
2843 
2844 
2846 
2847 
2848 
2849  fHistPileUpCount = new TH1F("fHistPileUpCount", "fHistPileUpCount", 15, 0., 15.);
2850  fHistPileUpCount->GetXaxis()->SetBinLabel(1,"plpMV");
2851  fHistPileUpCount->GetXaxis()->SetBinLabel(2,"fromSPD");
2852  fHistPileUpCount->GetXaxis()->SetBinLabel(3,"RefMultComb08");
2853  fHistPileUpCount->GetXaxis()->SetBinLabel(4,"IncompleteDAQ");
2854  fHistPileUpCount->GetXaxis()->SetBinLabel(5,"abs(V0M-CL1)>5.0");
2855  fHistPileUpCount->GetXaxis()->SetBinLabel(6,"missingVtx");
2856  fHistPileUpCount->GetXaxis()->SetBinLabel(7,"inconsistentVtx");
2857  Int_t puConst = fPileUpConstParm;
2858  fHistPileUpCount->GetXaxis()->SetBinLabel(8,Form("multESDTPCDif>%d",puConst));
2859  fHistPileUpCount->GetXaxis()->SetBinLabel(9,Form("multGlobTPCDif>%d",puConst));
2860  fHistPileUpCount->GetXaxis()->SetBinLabel(10,"PileUpMultSelTask");
2862 
2863 
2864  fHistMultSelPUCount = new TH1F("fHistMultSelPileUpCount", "no of PU Event from MultSelTask", 10, 0., 10);
2865  fHistMultSelPUCount->GetXaxis()->SetBinLabel(1,"PileUp");
2866  fHistMultSelPUCount->GetXaxis()->SetBinLabel(2,"PileUpMV");
2867  fHistMultSelPUCount->GetXaxis()->SetBinLabel(3,"PileUpMultBins");
2868  fHistMultSelPUCount->GetXaxis()->SetBinLabel(4,"InconsistentVtx");
2869  fHistMultSelPUCount->GetXaxis()->SetBinLabel(5,"TrackletVsCluster");
2870  fHistMultSelPUCount->GetXaxis()->SetBinLabel(6,"IncompleteDAQ");
2871  fHistMultSelPUCount->GetXaxis()->SetBinLabel(7,"NotGoodVertex2016");
2873 
2874 
2875  fHistEventCount = new TH1F("fHistEventCount","Event counts",15,0,15);
2876  fHistEventCount->GetXaxis()->SetBinLabel(1,"Called UserExec()");
2877  fHistEventCount->GetXaxis()->SetBinLabel(2,"Called Exec()");
2878  fHistEventCount->GetXaxis()->SetBinLabel(3,"AOD Exist");
2879  fHistEventCount->GetXaxis()->SetBinLabel(4,"Vz < 10");
2880  fHistEventCount->GetXaxis()->SetBinLabel(5,Form("%2.0f<Cent<%2.0f",fCentralityPercentMin,fCentralityPercentMax));
2881  fHistEventCount->GetXaxis()->SetBinLabel(6,"noAODtrack > 2 ");
2882  fHistEventCount->GetXaxis()->SetBinLabel(7,"TPC vs Global");
2883  fHistEventCount->GetXaxis()->SetBinLabel(8,"TPC128 vs ESD");
2884  fHistEventCount->GetXaxis()->SetBinLabel(9,"Cent vs TPC");
2885  fHistEventCount->GetXaxis()->SetBinLabel(10,"mult eta+/- > 2");
2886  fHistEventCount->GetXaxis()->SetBinLabel(11,"centCL1 < 90");
2887  fHistEventCount->GetXaxis()->SetBinLabel(15,"Survived Events");
2888  fListHist->Add(fHistEventCount);
2889 
2890  //fHistEventCount->Fill(1);
2891 
2892 }
2893 
2894 
2895 
2896 
2897 
2899 {
2900  /*
2901  TList *fListAppliedV0Corr = new TList();
2902  fListAppliedV0Corr->SetName("fListAppliedV0Corr");
2903  fListAppliedV0Corr->SetOwner(kTRUE);
2904  fListHist->Add(fListAppliedV0Corr);*/ // to be Tested later.
2905 
2906  if(fListV0MCorr){
2907  fHCorrectV0M = (TH1D *) fListV0MCorr->FindObject(Form("fHistV0Gain_Run%d",run));
2908  fHAvgerageQnV0A = (TH2D *) fListV0MCorr->FindObject(Form("fHistAvgQnV0A_Run%d",run));
2909  fHAvgerageQnV0C = (TH2D *) fListV0MCorr->FindObject(Form("fHistAvgQnV0C_Run%d",run));
2910 
2911  //Now the wgts for centrality is added inside VOM gain file.
2912  fHCentWeightForRun = (TH1D *) fListV0MCorr->FindObject(Form("fHistCentWeight_Run%d",run));
2913 
2914  if(fHCentWeightForRun){
2915  cout<<"\n =========== Info:: Using Centrality wgts for run = "<<run<<"============"<<endl;
2916  }
2917  else{
2918  cout<<"\n =========== Info:: No Centrality wgt. correction.!! for run = "<<run<<"============"<<endl;
2919  }
2920 
2921  if(fHCorrectV0M){
2922  cout<<"\n =========== Info:: Setting up V0 gain correction for run = "<<run<<"============"<<endl;
2923  fHistTaskConfigParameters->SetBinContent(23,1);
2924  }
2925  else{
2926  cout<<"\n =========== Info:: No V0 gain correction..!!! for run = "<<run<<"============"<<endl;
2927  }
2929  cout<<"\n =========== Info:: Setting up V0 <Qn> recentering for run = "<<run<<"============"<<endl;
2930  fHistTaskConfigParameters->SetBinContent(24,1);
2931  }
2932  else{
2933  cout<<"\n =========== Info:: No V0 <Qn> recentering..!!! for run = "<<run<<"============"<<endl;
2934  }
2935  }
2936  else{
2937  cout<<"\n ======== !!!! Error:: List For V0-Gain and Qn not found for run "<<run<<"============"<<endl;
2938  }
2939 
2940 }
2941 
2942 
2943 
2944 
2945 
2946 
2947 
2949 {
2950 
2951  if(fListNUACorr){
2952  for(int i=0;i<5;i++){
2953  fHCorrectNUApos[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pos_Cent%d_Run%d",i,run));
2954  fHCorrectNUAneg[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Neg_Cent%d_Run%d",i,run));
2955  }
2956  if(fHCorrectNUApos[3] && fHCorrectNUAneg[3]){
2957  cout<<"\n=========== Info:: Setting up NUA corrections for run "<<run<<"============"<<endl;
2958  fHistTaskConfigParameters->SetBinContent(15,1);
2959  }
2960  }
2961  else {
2962  printf("\n ******** Warning: No NUA Correction for Charge Particle in run %d, Use Wgt = 1.0 ********* \n",run);
2963  //Do not allocate memory:
2964  /*
2965  for(int i=0;i<5;i++){
2966  fHCorrectNUApos[i] = new TH3D(Form("fHCorrectNUApos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2967  fHCorrectNUAneg[i] = new TH3D(Form("fHCorrectNUAneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
2968  fHCorrectNUApos[i]->SetBinContent(1,1,1,1.0);
2969  fHCorrectNUAneg[i]->SetBinContent(1,1,1,1.0);
2970  //exit(1);
2971  }*/
2972  }
2973 
2974  //=================== PID: ==========================
2975  if(fListNUACorr){
2976  for(int i=0;i<5;i++){
2977  fHCorrectNUAposPion[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pion_Pos_Cent%d_Run%d",i,run)); //
2978  fHCorrectNUAnegPion[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Pion_Neg_Cent%d_Run%d",i,run));
2979  if(fHCorrectNUAposPion[3] && fHCorrectNUAnegPion[3]) fHistTaskConfigParameters->SetBinContent(16,1);
2980 
2981  fHCorrectNUAposKaon[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Kaon_Pos_Cent%d_Run%d",i,run)); //
2982  fHCorrectNUAnegKaon[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Kaon_Neg_Cent%d_Run%d",i,run));
2983  if(fHCorrectNUAposKaon[3] && fHCorrectNUAnegKaon[3]) fHistTaskConfigParameters->SetBinContent(17,1);
2984 
2985  fHCorrectNUAposProton[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Proton_Pos_Cent%d_Run%d",i,run));
2986  fHCorrectNUAnegProton[i] = (TH3D *) fListNUACorr->FindObject(Form("fHist_NUA_VzPhiEta_Proton_Neg_Cent%d_Run%d",i,run));
2987  if(fHCorrectNUAposProton[3] && fHCorrectNUAnegProton[3]) fHistTaskConfigParameters->SetBinContent(18,1);
2988  }
2990  cout<<"\n=========== Info:: Setting up --> PID NUA corrections for run = "<<run<<"============"<<endl;
2991  }
2992  else{
2993  cout<<"\n=========== WARNING :: PID NUA corrections NOT found for run = "<<run<<"============"<<endl;
2994  }
2995  }
2996  else {
2997  printf("\n ******** Error/Warning: No NUA Correction found for PID for run %d, Use PID Wgt = 1.0 ********* \n",run);
2998  /*
2999  for(int i=0;i<5;i++){
3000  fHCorrectNUAposPion[i] = new TH3D(Form("fHCorrectNUAPionpos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
3001  fHCorrectNUAposPion[i] = new TH3D(Form("fHCorrectNUAPionneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
3002  fHCorrectNUAposPion[i]->SetBinContent(1,1,1,1.0);
3003  fHCorrectNUAposPion[i]->SetBinContent(1,1,1,1.0);
3004 
3005  fHCorrectNUAposKaon[i] = new TH3D(Form("fHCorrectNUAKaonpos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
3006  fHCorrectNUAposKaon[i] = new TH3D(Form("fHCorrectNUAKaonneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
3007  fHCorrectNUAposKaon[i]->SetBinContent(1,1,1,1.0);
3008  fHCorrectNUAposKaon[i]->SetBinContent(1,1,1,1.0);
3009 
3010  fHCorrectNUAposProton[i] = new TH3D(Form("fHCorrectNUAProtonpos_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
3011  fHCorrectNUAposProton[i] = new TH3D(Form("fHCorrectNUAProtonneg_cent%d",i),"",1,-10,10,1,0,6.284,1,-0.9,0.9);
3012  fHCorrectNUAposProton[i]->SetBinContent(1,1,1,1.0);
3013  fHCorrectNUAposProton[i]->SetBinContent(1,1,1,1.0);
3014  //exit(1);
3015  }*/
3016  }
3017 
3018 }
3019 
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr2p_pTDiff_EP_Harm2_PN[2][6]
TProfile * fHist_Corr3p_EP_Refm_PP[2][4]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr2p_EtaDiff_EP_Harm1_NN[2][6]
TProfile * fHist_Corr2p_Pion_EP_Norm_NN[2][4]
TProfile * fHist_Corr3p_Kaon_EP_Norm_NN[2][4]
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0A_PN[2][6]
Bool_t IsLabelUsed(TArrayI labelArray, Int_t label)
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0A_PN[2][6]
double Double_t
Definition: External.C:58
TProfile * fHist_Corr2p_Kaon_EP_Norm_NN[2][4]
virtual void UserExec(Option_t *)
TProfile * fHist_Corr3p_Kaon_EP_Norm_PP[2][4]
Definition: External.C:260
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0A_NN[2][6]
Definition: External.C:236
const char * title
Definition: MakeQAPdf.C:27
AliAnalysisUtils * fAnalysisUtil
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0C_NN[2][6]
TProfile * fHist_Corr2p_pTSum_EP_Harm1_NN[2][6]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Kaon_EP_Refm_NN[2][4]
TProfile * fHist_Corr2p_Proton_EP_Refm_NN[2][4]
TProfile * fHist_Corr2p_Proton_EP_Refm_PP[2][4]
TH3D * fHCorrectNUAposProton[5]
5 centrality bin, read NUA from file
TH3D * fHCorrectNUAnegProton[5]
5 centrality bin, read NUA from file
TH2D * fHAvgerageQnV0C
V0A Average <Qn>, n=2,3.
TH1F * fHistPtwithTPCNsigma[4][10]
TProfile * fHist_Corr2p_EP_Norm_NN[2][4]
TProfile * fHist_Corr2p_Kaon_EP_Refm_PP[2][4]
TH2F * fQAEtaPhiAfterNUA
Event weights for non-flat centrality.
centrality
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0A_NN[2][6]
char Char_t
Definition: External.C:18
TProfile * fHist_Corr3p_EtaDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0A_PN[2][6]
TH3D * fHCorrectNUAneg[5]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_Pion_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_EP_Refm_NN[2][4]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_EtaDiff_EP_V0C_PP[2][6]
TH3D * fHCorrectNUAnegKaon[5]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_Pion_EP_Norm_PN[2][4]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0C_NN[2][6]
TProfile * fHist_Corr2p_Proton_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr2p_EP_Refm_PP[2][4]
Int_t GetCentralityScaled0to10(Double_t fCent)
TProfile * fHist_Corr2p_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0C_PN[2][6]
TProfile * fHist_Reso2n_EP_Refm_Det[2][4]
TProfile * fHist_Corr3p_pTDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_pTDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0A_PN[2][6]
TProfile * fHist_Corr2p_EP_Norm_PP[2][4]
TProfile * fHist_Corr2p_pTDiff_EP_Harm1_PP[2][6]
TProfile * fHist_Corr2p_pTSum_EP_Harm2_NN[2][6]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0C_PN[2][6]
TProfile * fHist_Corr2p_EtaDiff_EP_Harm2_PN[2][6]
TH3D * fHCorrectNUAposKaon[5]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_pTSum_EP_V0C_PN[2][6]
TProfile * fHist_Corr2p_pTDiff_EP_Harm2_NN[2][6]
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr2p_Proton_EP_Norm_PN[2][4]
double GetWDist(const AliVVertex *v0, const AliVVertex *v1)
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Pion_EP_Norm_PP[2][4]
AliPIDResponse * fPIDResponse
aod
void GetV0MCorrectionHist(Int_t run)
Bool_t PileUpMultiVertex(const AliAODEvent *faod)
TProfile * fHist_Corr2p_EtaDiff_EP_Harm2_PP[2][6]
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0C_PN[2][6]
int Int_t
Definition: External.C:63
TH2F * fHistEtaPtAfter
Eta-Pt acceptance.
TH1D * fFB_Efficiency_Pion_Cent[10]
for charge
void GetNUACorrectionHist(Int_t run)
float Float_t
Definition: External.C:68
TProfile * fHist_Corr2p_Pion_EP_Refm_PP[2][4]
TProfile * fHist_Corr2p_EtaDiff_EP_Harm2_NN[2][6]
TH1F * fHistPtwithNoPIDCuts[4][10]
Definition: External.C:252
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_pTDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr2p_Proton_EP_Norm_PP[2][4]
TH3D * fHCorrectNUAnegPion[5]
5 centrality bin, read NUA from file
TList * fListHist
Event selection.
Definition: External.C:228
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0C_PP[2][6]
Definition: External.C:212
TProfile * fHist_Corr2p_EP_Refm_NN[2][4]
TProfile * fHist_Corr3p_Kaon_EP_Norm_PN[2][4]
TProfile * fHist_Corr2p_EtaDiff_EP_Harm1_PP[2][6]
TProfile * fHist_Corr3p_EP_Norm_PP[2][4]
TProfile * fHist_Corr3p_pTSum_EP_V0A_NN[2][6]
TProfile * fHist_Corr2p_pTDiff_EP_Harm2_PP[2][6]
TProfile * fHist_Corr3p_Proton_EP_Norm_PP[2][4]
TProfile * fHist_Corr3p_EtaDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Proton_EP_Norm_NN[2][4]
TProfile * fHist_Corr3p_Pion_EP_Refm_PP[2][4]
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0A_NN[2][6]
virtual void UserCreateOutputObjects()
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0C_NN[2][6]
TProfile * fHist_Corr2p_Kaon_EP_Norm_PP[2][4]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0A_NN[2][6]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0C_PP[2][6]
TH1F * fHistPtwithoutPIDcut[4][10]
last in the list
TH1D * fFB_Efficiency_Cent[10]
4 particle 5 centrality bin
TProfile * fHist_Corr3p_pTSum_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr2p_Pion_EP_Norm_PN[2][4]
TH2F * fV0MultChVsRun
Full Event plane.
TProfile * fHist_Corr3p_EtaDiff_EP_V0A_NN[2][6]
TProfile * fHist_Corr2p_Pion_EP_Refm_NN[2][4]
TH2D * fHAvgerageQnV0A
To read Gain Correction file.
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0C_PP[2][6]
TProfile * fHist_Corr2p_pTSum_EP_Harm1_PN[2][6]
TProfile * fHist_Corr3p_Proton_EP_Refm_NN[2][4]
TProfile * fHist_Corr3p_Pion_EP_Refm_NN[2][4]
TProfile * fHist_Corr3p_pTDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr2p_Kaon_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_Proton_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_EP_Norm_PN[2][4]
5 centrality bin, read NUA from file
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Kaon_EP_Refm_PP[2][4]
TProfile * fHist_Corr3p_Proton_EP_Refm_PP[2][4]
TProfile * fHist_Corr2p_pTDiff_EP_Harm1_PN[2][6]
TProfile * fHist_Corr3p_Kaon_pTDiff_EP_V0A_NN[2][6]
TH3F * fHist3DEtaPhiVz_Pos_Run[4][5]
TProfile * fHist_Corr3p_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr2p_pTSum_EP_Harm2_PP[2][6]
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Pion_pTSum_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Pion_EP_Norm_NN[2][4]
TH1F * fHistPtwithTPCTOFNsigma[4][10]
TH2F * fHistTPCvsGlobalMultBefore
Eta-Pt acceptance.
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr2p_Pion_EP_Refm_PN[2][4]
TProfile * fHist_Corr3p_Pion_EtaDiff_EP_V0C_NN[2][6]
TH3F * fHist3DEtaPhiVz_Neg_Run[4][5]
4 particle 5 centrality bin
TProfile * fHist_Corr2p_EP_Norm_PN[2][4]
TProfile * fHist_Corr2p_Kaon_EP_Norm_PN[2][4]
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0A_PN[2][6]
TProfile * fHist_Corr2p_Kaon_EP_Refm_NN[2][4]
TProfile * fHist_Corr3p_Proton_EP_Norm_PN[2][4]
TProfile * fHist_Corr3p_Proton_pTDiff_EP_V0A_PN[2][6]
TH1D * fHCorrectV0M
with PileUp cut
TProfile * fHist_Corr3p_EtaDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0A_NN[2][6]
TH1D * fHCentWeightForRun
V0C Average <Qn>, n=2,3.
const char Option_t
Definition: External.C:48
TProfile * fHist_Corr3p_pTSum_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_pTDiff_EP_V0C_NN[2][6]
TProfile * fHist_Reso2n_EP_Norm_Det[2][4]
TProfile * fHist_Corr3p_pTDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr3p_Kaon_EP_Refm_PN[2][4]
bool Bool_t
Definition: External.C:53
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0A_PP[2][6]
TProfile * fHist_Corr2p_Proton_EP_Norm_NN[2][4]
TProfile * fHist_Corr3p_Kaon_pTSum_EP_V0C_NN[2][6]
TH3D * fHCorrectNUAposPion[5]
5 centrality bin, read NUA from file
TH1F * fCentDistAfter
without PileUp cut
TH1F * fHistPileUpCount
Task input parameters FB / cut values etc.
TProfile * fHist_Corr2p_pTSum_EP_Harm1_PP[2][6]
TProfile * fHist_Corr3p_Proton_pTSum_EP_V0A_PP[2][6]
TProfile * fHist_Corr3p_Proton_EtaDiff_EP_V0C_NN[2][6]
TH1F * fCentDistBefore
To fill VOM multiplicity.
TProfile * fHist_Corr2p_Pion_EP_Norm_PP[2][4]
TProfile * fHist_Corr2p_pTSum_EP_Harm2_PN[2][6]
TProfile * fHist_Corr3p_pTSum_EP_V0A_PN[2][6]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0C_PP[2][6]
TProfile * fHist_Corr3p_Pion_pTDiff_EP_V0C_PN[2][6]
TProfile * fHist_Corr2p_pTDiff_EP_Harm1_NN[2][6]
TProfile * fHist_Corr3p_EP_Norm_NN[2][4]
TProfile * fHist_Corr3p_EtaDiff_EP_V0C_NN[2][6]
TProfile * fHist_Corr3p_pTSum_EP_V0C_PP[2][6]
TProfile * fHist_Corr2p_EtaDiff_EP_Harm1_PN[2][6]
TProfile * fHist_Corr3p_Kaon_EtaDiff_EP_V0C_NN[2][6]