AliPhysics  449db5a (449db5a)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskZDCGainEq.cxx
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
17 //
18 // Author: Rihan Haque (mhaque@cern.ch)
20 
21 
22 #include "Riostream.h" //needed as include
23 
24 class TFile;
25 class TList;
26 class AliAnalysisTaskSE;
27 
28 #include "TProfile.h" //needed as include
29 #include "TProfile2D.h"
30 #include "TList.h"
31 #include "TH1.h"
32 #include "TH2.h"
33 #include "TH3.h"
34 #include "AliMultSelection.h"
35 #include "AliVVertex.h"
36 
37 #include "AliAnalysisManager.h"
38 #include "AliFlowEvent.h"
39 #include "AliFlowEventSimple.h"
40 #include "AliFlowCommonHist.h"
42 
43 #include "AliAnalysisManager.h"
44 #include "AliInputEventHandler.h"
45 #include "AliVEvent.h"
46 #include "AliESD.h"
47 #include "AliESDEvent.h"
48 #include "AliESDHeader.h"
49 #include "AliESDInputHandler.h"
50 #include "AliESDZDC.h"
51 #include "AliMultiplicity.h"
52 #include "AliAnalysisUtils.h"
53 #include "AliAODHandler.h"
54 #include "AliAODTrack.h"
55 #include "AliAODEvent.h"
56 #include "AliAODHeader.h"
57 #include "AliAODVertex.h"
58 #include "AliAODVZERO.h"
59 #include "AliAODZDC.h"
60 #include "AliAODMCHeader.h"
61 #include "AliMCEventHandler.h"
62 #include "AliMCEvent.h"
63 #include "AliHeader.h"
64 #include "AliVParticle.h"
65 #include "AliStack.h"
66 #include "AliAODMCParticle.h"
67 #include "AliAnalysisTaskSE.h"
68 #include "AliGenEventHeader.h"
69 #include "AliPhysicsSelectionTask.h"
70 #include "AliPhysicsSelection.h"
71 #include "AliBackgroundSelection.h"
72 #include "AliTriggerAnalysis.h"
73 #include "AliCentrality.h"
74 #include "AliLog.h"
76 #include "AliFlowVector.h"
77 
78 using std::endl;
79 using std::cout;
80 
81 
83 
84 //________________________________________________________________________
86  AliAnalysisTaskSE(name),
87  fEvent(NULL),
88  fMultSelection(NULL),
89  fAnalysisUtil(NULL),
90  fListHistos(NULL),
91  fListZDCQxy(NULL),
92  fListZDCWgt(NULL),
93  fListDummy1(NULL),
94  fListHijing(NULL),
95  fListSubRun(NULL),
96  fRejectPileUpTight(kFALSE),
97  fRejectPileUp(kFALSE),
98  bFillCosSin(kFALSE),
99  bFillZDCQAon(kFALSE),
100  bRunAveragedQn(kFALSE),
101  bApplyRecent(kFALSE),
102  bCentCutShift(kFALSE),
103  fHarmonic(2),
104  frunflag(0),
105  fievent(0),
106  vxBin(0),
107  vyBin(0),
108  vzBin(0),
109  fcheckOnce(0),
110  fOldRunNum(0),
111  fHist_Event_count(NULL),
112  fPileUpMultSelCount(NULL),
113  fPileUpCount(NULL),
114  fHist_ChanWgt_ZDCC(NULL),
115  fHist_ChanWgt_ZDCA(NULL),
116  fHist_Vx_ArrayFinder(NULL),
117  fHist_Vy_ArrayFinder(NULL),
118  fHist_Vz_ArrayFinder(NULL),
119  fHist_Task_config(NULL),
120  fHist_Cent_woZDCcut(NULL),
121  fHist_Cent_wiZDCcut(NULL),
122  fHist_CutParameters(NULL),
123  fHist_Psi1_ZDCC_wGainCorr(NULL),
124  fHist_Psi1_ZDCA_wGainCorr(NULL),
125  fHist_Psi1_ZDCC_wRectCorr(NULL),
126  fHist_Psi1_ZDCA_wRectCorr(NULL),
127  fHist_Psi1_ZDCC_wCorrFull(NULL),
128  fHist_Psi1_ZDCA_wCorrFull(NULL),
129  fHist_Psi1_ZDCC_RunByRun(NULL),
130  fHist_Psi1_ZDCA_RunByRun(NULL),
131  fHist_v2xV1_ZDN_Norm_All(NULL),
132  fHist_v2xV1_ZDN_Refm_All(NULL),
133  fHist_v2xV1_ZDN_Cent_All(NULL),
134  fHist_v3xV1_ZDN_Norm_Comb1(NULL),
135  fHist_v3xV1_ZDN_Norm_Comb2(NULL),
136  fHist_v3xV1_ZDN_Cent_Comb1(NULL),
137  fHist_v3xV1_ZDN_Cent_Comb2(NULL),
138  fHist_v4xV1_ZDN_Norm_Comb1(NULL),
139  fHist_v4xV1_ZDN_Cent_Comb1(NULL),
140  fHist_ZDN_resol_Norm_All(NULL),
141  fHist_ZDN_resol_Cent_All(NULL),
142  fHist_ZDN_resol_Refm_All(NULL),
143  fHist_ZDN_resol_Norm_XX(NULL),
144  fHist_ZDN_resol_Norm_YY(NULL),
145  fHist_ZDN_resol_Cent_XX(NULL),
146  fHist_ZDN_resol_Cent_YY(NULL),
147  fHist_Vx_vs_runnum(NULL),
148  fHist_Vy_vs_runnum(NULL),
149  fHist_Vz_vs_runnum(NULL),
150  fWeight_Cent(NULL),
151  fHist_Vxy_RunAveraged(NULL),
152  fHist_Event_counter_vRun(NULL),
153  fHist_PsiSumAC_woCorr(NULL),
154  fHist_PsiSumAC_wiCorr(NULL),
155  fHist_ZeroQnXY_Conter(NULL),
156  fHist_ZDCC_AvgQx_VsRun(NULL),
157  fHist_ZDCC_AvgQy_VsRun(NULL),
158  fHist_ZDCA_AvgQx_VsRun(NULL),
159  fHist_ZDCA_AvgQy_VsRun(NULL),
160  fHist_ZDC_AvgXXminusYY_VsRun(NULL),
161  fHist_ZDC_AvgXYplusXY_VsRun(NULL),
162  fHist_ZDCC_AvgQx_VsCR(NULL),
163  fHist_ZDCC_AvgQy_VsCR(NULL),
164  fHist_ZDCA_AvgQx_VsCR(NULL),
165  fHist_ZDCA_AvgQy_VsCR(NULL),
166  fDataSet("2010"),
167  fAnalysisSet("DoGainEq"),
168  sCentEstimator("V0")
169 {
170  for(int i=0;i<90;i++){
171  runNums[i] = 0;
172  fHist_ZDCA_En_Run[i] = NULL;
173  fHist_ZDCC_En_Run[i] = NULL;
174 
175  for(int j=0;j<10;j++){
176  fHist_znCx_V0_VxVy[i][j] = NULL;
177  fHist_znCy_V0_VxVy[i][j] = NULL;
178  fHist_znAx_V0_VxVy[i][j] = NULL;
179  fHist_znAy_V0_VxVy[i][j] = NULL;
180  }
181  }
182 
183  for(int i=0;i<4;i++){
184  fHist_Qx_wiCorr_RunByRun[i] = NULL;
185  fHist_Qx_Trig_woCorr[i] = NULL;
186  fHist_XX_Trig_woCorr[i] = NULL;
187  fHist_Qx_Trig_wiCorr[i] = NULL;
188  fHist_XX_Trig_wiCorr[i] = NULL;
189  for(int j=0;j<5;j++){
190  fHist_Qx_vs_Obs_woCorr[i][j] = NULL;
191  fHist_XX_vs_Obs_woCorr[i][j] = NULL;
192  fHist_Qx_vs_Obs_wiCorr[i][j] = NULL;
193  fHist_XX_vs_Obs_wiCorr[i][j] = NULL;
194  }
195  }
196  for(int i=0;i<20;i++){
197  fHist_Recenter_ZDCCx[i] = NULL;
198  fHist_Recenter_ZDCCy[i] = NULL;
199  fHist_Recenter_ZDCAx[i] = NULL;
200  fHist_Recenter_ZDCAy[i] = NULL;
201  }
202  for(int i=0;i<20;i++){
203  fHist_ZDCC_En_CommonCh[i] = NULL;
204  fHist_ZDCA_En_CommonCh[i] = NULL;
205  }
206 
207  for(int i=0;i<2;i++){
208  VxCut[i] = 0;
209  VyCut[i] = 0;
210  VzCut[i] = 0;
211  }
212 
213  for(int i=0;i<10;i++){
214  fFB_Efficiency_Cent[i] = NULL;
215  fHist_v2xV1_ZDN_pTDiff_All[i] = NULL;
216  fHist_v4xV1_ZDN_pTDiff_All[i] = NULL;
217  fHist_v3xV1_ZDN_EtaDiff_Comb1[i]= NULL;
218  fHist_v3xV1_ZDN_EtaDiff_Comb2[i]= NULL;
219 
220  for(int j=0;j<4;j++){
221  fHist_v1xV1_ZDN_EtaDiff[j][i] = NULL;
222  fHist_v1xV1_ZDN_pTDiff[j][i] = NULL;
223  }
224  }
225 
226  for(int i=0;i<4;i++){
227  fHist_v2xV1_ZDN_Norm_Sep[i] = NULL;
228  fHist_v2xV1_ZDN_Cent_Sep[i] = NULL;
229  }
230  for(int i=0;i<2;i++){
231  fHist_ZDN_resol_Norm_Sep[i] = NULL;
232  fHist_ZDN_resol_Cent_Sep[i] = NULL;
233  }
234  for(int i=0;i<4;i++){
235  //here
236  fHist_ZDCC_AvgCosNPsi[i] = NULL;
237  fHist_ZDCC_AvgSinNPsi[i] = NULL;
238  fHist_ZDCA_AvgCosNPsi[i] = NULL;
239  fHist_ZDCA_AvgSinNPsi[i] = NULL;
240  fHist_ZDC_AvgCosNPsiAC[i] = NULL;
241  fHist_ZDC_AvgSinNPsiAC[i] = NULL;
242  }
243  for(int i=0;i<4;i++){
244  fHist_ZDCC_AvgCos_VsRun[i] = NULL;
245  fHist_ZDCC_AvgSin_VsRun[i] = NULL;
246  fHist_ZDCA_AvgCos_VsRun[i] = NULL;
247  fHist_ZDCA_AvgSin_VsRun[i] = NULL;
248  fHist_ZDC_AvgCosPsiSum_VsRun[i] = NULL;
249  fHist_ZDC_AvgSinPsiSum_VsRun[i] = NULL;
250  }
251  for(int i=0;i<2;i++){
252  fHist_XXYY_vs_Cent_woCorr[i] = NULL;
253  fHist_XXYY_vs_Cent_wiCorr[i] = NULL;
254  }
255 
256  DefineInput(1, AliFlowEventSimple::Class()); // Input slot #1 works with an AliFlowEventSimple
257  DefineInput(2, AliFlowEventSimple::Class()); // Input slot #2 for ZDC flow event
258 
259 
260  DefineOutput(1,TList::Class());
261  DefineOutput(2,TList::Class());
262 
263  //fDataSet="2010";
264  //fAnalysisSet="DoGainEq";
265  //sCentEstimator="V0";
266 
267  //fTotalQvector = new TString("QaQb"); // "QaQb" (means Qa+Qb), "Qa" or "Qb"
268 
269 }//-------------constructor-----------------
270 
271 //________________________________________________
274  fEvent(NULL),
275  fMultSelection(NULL),
276  fAnalysisUtil(NULL),
277  fListHistos(NULL),
278  fListZDCQxy(NULL),
279  fListZDCWgt(NULL),
280  fListDummy1(NULL),
281  fListHijing(NULL),
282  fListSubRun(NULL),
283  fRejectPileUpTight(kFALSE),
284  fRejectPileUp(kFALSE),
285  bFillCosSin(kFALSE),
286  bFillZDCQAon(kFALSE),
287  bRunAveragedQn(kFALSE),
288  bApplyRecent(kFALSE),
289  bCentCutShift(kFALSE),
290  fHarmonic(2),
291  frunflag(0),
292  fievent(0),
293  vxBin(0),
294  vyBin(0),
295  vzBin(0),
296  fcheckOnce(0),
297  fOldRunNum(0),
298  fHist_Event_count(NULL),
299  fPileUpMultSelCount(NULL),
300  fPileUpCount(NULL),
301  fHist_ChanWgt_ZDCC(NULL),
302  fHist_ChanWgt_ZDCA(NULL),
303  fHist_Vx_ArrayFinder(NULL),
304  fHist_Vy_ArrayFinder(NULL),
305  fHist_Vz_ArrayFinder(NULL),
306  fHist_Task_config(NULL),
307  fHist_Cent_woZDCcut(NULL),
308  fHist_Cent_wiZDCcut(NULL),
309  fHist_CutParameters(NULL),
310  fHist_Psi1_ZDCC_wGainCorr(NULL),
311  fHist_Psi1_ZDCA_wGainCorr(NULL),
312  fHist_Psi1_ZDCC_wRectCorr(NULL),
313  fHist_Psi1_ZDCA_wRectCorr(NULL),
314  fHist_Psi1_ZDCC_wCorrFull(NULL),
315  fHist_Psi1_ZDCA_wCorrFull(NULL),
316  fHist_Psi1_ZDCC_RunByRun(NULL),
317  fHist_Psi1_ZDCA_RunByRun(NULL),
318  fHist_v2xV1_ZDN_Norm_All(NULL),
319  fHist_v2xV1_ZDN_Refm_All(NULL),
320  fHist_v2xV1_ZDN_Cent_All(NULL),
321  fHist_v3xV1_ZDN_Norm_Comb1(NULL),
322  fHist_v3xV1_ZDN_Norm_Comb2(NULL),
323  fHist_v3xV1_ZDN_Cent_Comb1(NULL),
324  fHist_v3xV1_ZDN_Cent_Comb2(NULL),
325  fHist_v4xV1_ZDN_Norm_Comb1(NULL),
326  fHist_v4xV1_ZDN_Cent_Comb1(NULL),
327  fHist_ZDN_resol_Norm_All(NULL),
328  fHist_ZDN_resol_Cent_All(NULL),
329  fHist_ZDN_resol_Refm_All(NULL),
330  fHist_ZDN_resol_Norm_XX(NULL),
331  fHist_ZDN_resol_Norm_YY(NULL),
332  fHist_ZDN_resol_Cent_XX(NULL),
333  fHist_ZDN_resol_Cent_YY(NULL),
334  fHist_Vx_vs_runnum(NULL),
335  fHist_Vy_vs_runnum(NULL),
336  fHist_Vz_vs_runnum(NULL),
337  fWeight_Cent(NULL),
338  fHist_Vxy_RunAveraged(NULL),
339  fHist_Event_counter_vRun(NULL),
340  fHist_PsiSumAC_woCorr(NULL),
341  fHist_PsiSumAC_wiCorr(NULL),
342  fHist_ZeroQnXY_Conter(NULL),
343  fHist_ZDCC_AvgQx_VsRun(NULL),
344  fHist_ZDCC_AvgQy_VsRun(NULL),
345  fHist_ZDCA_AvgQx_VsRun(NULL),
346  fHist_ZDCA_AvgQy_VsRun(NULL),
347  fHist_ZDC_AvgXXminusYY_VsRun(NULL),
348  fHist_ZDC_AvgXYplusXY_VsRun(NULL),
349  fHist_ZDCC_AvgQx_VsCR(NULL),
350  fHist_ZDCC_AvgQy_VsCR(NULL),
351  fHist_ZDCA_AvgQx_VsCR(NULL),
352  fHist_ZDCA_AvgQy_VsCR(NULL),
353  fDataSet("2010"),
354  fAnalysisSet("DoGainEq"),
355  sCentEstimator("V0")
356 {
357  for(int i=0;i<90;i++){
358  runNums[i] = 0;
359  fHist_ZDCA_En_Run[i] = NULL;
360  fHist_ZDCC_En_Run[i] = NULL;
361 
362  for(int j=0;j<10;j++){
363  fHist_znCx_V0_VxVy[i][j] = NULL;
364  fHist_znCy_V0_VxVy[i][j] = NULL;
365  fHist_znAx_V0_VxVy[i][j] = NULL;
366  fHist_znAy_V0_VxVy[i][j] = NULL;
367  }
368  }
369 
370  for(int i=0;i<4;i++){
371  fHist_Qx_wiCorr_RunByRun[i] = NULL;
372  fHist_Qx_Trig_woCorr[i] = NULL;
373  fHist_XX_Trig_woCorr[i] = NULL;
374  fHist_Qx_Trig_wiCorr[i] = NULL;
375  fHist_XX_Trig_wiCorr[i] = NULL;
376 
377  for(int j=0;j<5;j++){
378  fHist_Qx_vs_Obs_woCorr[i][j] = NULL;
379  fHist_XX_vs_Obs_woCorr[i][j] = NULL;
380  fHist_Qx_vs_Obs_wiCorr[i][j] = NULL;
381  fHist_XX_vs_Obs_wiCorr[i][j] = NULL;
382  }
383  }
384  for(int i=0;i<20;i++){
385  fHist_Recenter_ZDCCx[i] = NULL;
386  fHist_Recenter_ZDCCy[i] = NULL;
387  fHist_Recenter_ZDCAx[i] = NULL;
388  fHist_Recenter_ZDCAy[i] = NULL;
389  }
390  for(int i=0;i<20;i++){
391  fHist_ZDCC_En_CommonCh[i] = NULL;
392  fHist_ZDCA_En_CommonCh[i] = NULL;
393  }
394 
395  for(int i=0;i<2;i++){
396  VxCut[i] = 0;
397  VyCut[i] = 0;
398  VzCut[i] = 0;
399  }
400 
401  for(int i=0;i<10;i++){
402  fFB_Efficiency_Cent[i] = NULL;
403  fHist_v2xV1_ZDN_pTDiff_All[i] = NULL;
404  fHist_v4xV1_ZDN_pTDiff_All[i] = NULL;
407 
408  for(int j=0;j<4;j++){
409  fHist_v1xV1_ZDN_EtaDiff[j][i] = NULL;
410  fHist_v1xV1_ZDN_pTDiff[j][i] = NULL;
411  }
412  }
413 
414  for(int i=0;i<4;i++){
415  fHist_v2xV1_ZDN_Norm_Sep[i] = NULL;
416  fHist_v2xV1_ZDN_Cent_Sep[i] = NULL;
417  }
418  for(int i=0;i<2;i++){
419  fHist_ZDN_resol_Norm_Sep[i] = NULL;
420  fHist_ZDN_resol_Cent_Sep[i] = NULL;
421  }
422  for(int i=0;i<4;i++){
423  fHist_ZDCC_AvgCosNPsi[i] = NULL;
424  fHist_ZDCC_AvgSinNPsi[i] = NULL;
425  fHist_ZDCA_AvgCosNPsi[i] = NULL;
426  fHist_ZDCA_AvgSinNPsi[i] = NULL;
427  fHist_ZDC_AvgCosNPsiAC[i] = NULL;
428  fHist_ZDC_AvgSinNPsiAC[i] = NULL;
429  }
430  for(int i=0;i<4;i++){
431  fHist_ZDCC_AvgCos_VsRun[i] = NULL;
432  fHist_ZDCC_AvgSin_VsRun[i] = NULL;
433  fHist_ZDCA_AvgCos_VsRun[i] = NULL;
434  fHist_ZDCA_AvgSin_VsRun[i] = NULL;
437  }
438  for(int i=0;i<2;i++){
439  fHist_XXYY_vs_Cent_woCorr[i] = NULL;
440  fHist_XXYY_vs_Cent_wiCorr[i] = NULL;
441  }
442 
443  //fDataSet="2010";
444  //fAnalysisSet="DoGainEq";
445  //sCentEstimator="V0";
446 }
447 
448 
449 
450 
451 
452 //________________________________________________________________________
454 {
455  delete fListHistos;
456  delete fListZDCQxy;
457  delete fListZDCWgt;
458  delete fListDummy1;
459  delete fListHijing;
460 
461  delete fMultSelection;
462  delete fAnalysisUtil; // it is '= new' !!!
463 
464 
465  //these histograms are not in any list:
466  //therefore, deleted manually.
467  //delete *fHist_ChanWgt_ZDCC; //can't delete, Execption thrown.!! why?
468  //delete *fHist_ChanWgt_ZDCA;
469  //delete *fHist_Vx_ArrayFinder;
470  //delete *fHist_Vy_ArrayFinder;
471  //delete *fHist_Vz_ArrayFinder;
472 
473 
474  //printf("\n\n ~AliAnalysisTaskZDCGainEq::Destructor is called..!!\n\n");
475 }
476 
477 //________________________________________________________________________
479 {
480 
481  Int_t runArray_2010[89] = {139510, 139507, 139505, 139503, 139465, 139438, 139437, 139360, 139329, 139328, 139314, 139310, 139309, 139173, 139107, 139105, 139038, 139037, 139036, 139029, 139028, 138872, 138871, 138870, 138837, 138732, 138730, 138666, 138662, 138653, 138652, 138638, 138624, 138621, 138583, 138582, 138579, 138578, 138534, 138469, 138442, 138439, 138438, 138396, 138364, 138275, 138225, 138201, 138197, 138192, 138190, 137848, 137844, 137752, 137751, 137724, 137722, 137718, 137704, 137693, 137692, 137691, 137686, 137685, 137639, 137638, 137608, 137595, 137549, 137546, 137544, 137541, 137539, 137531, 137530, 137443, 137441, 137440, 137439, 137434, 137432, 137431, 137243, 137236, 137235, 137232, 137231, 137162, 137161};
482 
483  Int_t runArray_2011[68] = {167915, 168115, 168460, 169035, 169238, 169859, 170228, 167920, 168310, 168464, 169091, 169411, 169923, 170230, 167985, 168311, 168467, 169094, 169415, 170027, 170268, 167987, 168322, 168511, 169138, 169417, 170081, 170269, 167988, 168325, 168512, 169144, 169835, 170155, 170270, 168069, 168341, 168514, 169145, 169837, 170159, 170306, 168076, 168342, 168777, 169148, 169838, 170163, 170308, 168105, 168361, 168826, 169156, 169846, 170193, 170309, 168107, 168362, 168988, 169160, 169855, 170203, 168108, 168458, 168992, 169167, 169858, 170204};
484 
485  Int_t runArray_2015[90] = {246994, 246991, 246989, 246984, 246982, 246980, 246948, 246945, 246928, 246871, 246870, 246867, 246865, 246864, 246859, 246858, 246851, 246847, 246846, 246845, 246844, 246810, 246809, 246808, 246807, 246805, 246804, 246766, 246765, 246763, 246760, 246759, 246758, 246757, 246751, 246750, 246676, 246675, 246540, 246495, 246493, 246488, 246487, 246434, 246431, 246428, 246424, 246276, 246275, 246272, 246271, 246225, 246222, 246217, 246185, 246182, 246181, 246180, 246178, 246153, 246152, 246151, 246148, 246115, 246113, 246089, 246087, 246053, 246052, 246049, 246048, 246042, 246037, 246036, 246012, 246003, 246001, 245963, 245954, 245952, 245949, 245923, 245833, 245831, 245829, 245705, 245702, 245700, 245692, 245683};
486 
487 
488  if(fDataSet=="2010"){
489  frunflag = 89;
490  for(int i=0;i<frunflag;i++)
491  runNums[i] = runArray_2010[i];
492  }
493  if(fDataSet=="2011"){
494  frunflag = 10; //<--------- 2011 runnumbers have to be checked and put...
495  for(int i=0;i<frunflag;i++)
496  runNums[i] = runArray_2011[i];
497  }
498  if(fDataSet=="2015"){
499  frunflag = 90;
500  for(int i=0;i<frunflag;i++)
501  runNums[i] = runArray_2015[i];
502  }
503 
504  fListHistos = new TList();
505  fListHistos->SetOwner(kTRUE);
506 
507  fHist_Event_count = new TH1F("fHist_Event_count"," ",20,0,20);
508  fHist_Event_count->GetXaxis()->SetBinLabel(1,"Called Exec()");
509  fHist_Event_count->GetXaxis()->SetBinLabel(2,"AOD Exist");
510  fHist_Event_count->GetXaxis()->SetBinLabel(3,"Pass VzCut");
511  fHist_Event_count->GetXaxis()->SetBinLabel(4,"Pass VxCut");
512  fHist_Event_count->GetXaxis()->SetBinLabel(5,"Pass VyCut");
513  fHist_Event_count->GetXaxis()->SetBinLabel(6,"NotPileUp");
514  fHist_Event_count->GetXaxis()->SetBinLabel(7,"ZNC Ei>=0");
515  fHist_Event_count->GetXaxis()->SetBinLabel(8,"ZNA Ei>=0");
516  fHist_Event_count->GetXaxis()->SetBinLabel(9,"|QnC| < 1.5");
517  fHist_Event_count->GetXaxis()->SetBinLabel(10,"|QnA| < 1.5");
518  fHist_Event_count->GetXaxis()->SetBinLabel(11,"#Psi_{A}=0 && #Psi_{C}=0");
519  fHist_Event_count->GetXaxis()->SetBinLabel(12,"QyA=0 && QyC=0");
521 
522  fPileUpCount = new TH1F("fPileUpCount", "fPileUpCount", 9, 0., 9.);
523  fPileUpCount->GetXaxis()->SetBinLabel(1,"plpMV");
524  fPileUpCount->GetXaxis()->SetBinLabel(2,"fromSPD");
525  fPileUpCount->GetXaxis()->SetBinLabel(3,"RefMultiplicityComb08");
526  fPileUpCount->GetXaxis()->SetBinLabel(4,"IncompleteDAQ");
527  fPileUpCount->GetXaxis()->SetBinLabel(5,"abs(V0M-CL1)>7.5");
528  fPileUpCount->GetXaxis()->SetBinLabel(6,"missingVtx");
529  fPileUpCount->GetXaxis()->SetBinLabel(7,"inconsistentVtx");
530  fPileUpCount->GetXaxis()->SetBinLabel(8,"multESDTPCDif");
531  fPileUpCount->GetXaxis()->SetBinLabel(9,"extraPileUpMultSel");
533 
534  fPileUpMultSelCount = new TH1F("fPileUpMultSelCount", "fPileUpMultSelCount", 8, 0., 8.);
535  fPileUpMultSelCount->GetXaxis()->SetBinLabel(1,"IsNotPileup");
536  fPileUpMultSelCount->GetXaxis()->SetBinLabel(2,"IsNotPileupMV");
537  fPileUpMultSelCount->GetXaxis()->SetBinLabel(3,"IsNotPileupInMultBins");
538  fPileUpMultSelCount->GetXaxis()->SetBinLabel(4,"InconsistentVertices");
539  fPileUpMultSelCount->GetXaxis()->SetBinLabel(5,"TrackletVsCluster");
540  fPileUpMultSelCount->GetXaxis()->SetBinLabel(6,"AsymmetricInVZERO");
541  fPileUpMultSelCount->GetXaxis()->SetBinLabel(7,"IncompleteDAQ");
542  fPileUpMultSelCount->GetXaxis()->SetBinLabel(8,"GoodVertex2016");
544 
545  fHist_Task_config = new TH1F("fTask_Configuration", "Task Configuration", 20, 0., 20.);
546  fHist_Task_config->GetXaxis()->SetBinLabel(1,"IsZDCQAon");
547  fHist_Task_config->GetXaxis()->SetBinLabel(2,"IsCentV0M");
548  fHist_Task_config->GetXaxis()->SetBinLabel(3,"IsCentTPC");
549  fHist_Task_config->GetXaxis()->SetBinLabel(4,"IsCentCL1");
550  fHist_Task_config->GetXaxis()->SetBinLabel(5,"IsPileUpOn");
551  fHist_Task_config->GetXaxis()->SetBinLabel(6,"IsPileUpTightOn");
552  fHist_Task_config->GetXaxis()->SetBinLabel(7,"IsFillGainEq");
553  fHist_Task_config->GetXaxis()->SetBinLabel(8,"IsDoGainEq");
554  fHist_Task_config->GetXaxis()->SetBinLabel(9,"IsAvailGainFile");
555  fHist_Task_config->GetXaxis()->SetBinLabel(10,"IsFillCosSin");
556  fHist_Task_config->GetXaxis()->SetBinLabel(11,"IsDoRecenter");
557  fHist_Task_config->GetXaxis()->SetBinLabel(12,"IsAvailRecntFile");
558  fHist_Task_config->GetXaxis()->SetBinLabel(13,"IsRunByRun");
559  fHist_Task_config->GetXaxis()->SetBinLabel(14,"IsCentCutforShift");
560  fHist_Task_config->GetXaxis()->SetBinLabel(15,"IsApplyShiftCorr");
561  fHist_Task_config->GetXaxis()->SetBinLabel(16,"IsShiftCorrVsCent");
562  fHist_Task_config->GetXaxis()->SetBinLabel(17,"IsTrigonoMetricQn");
564 
565 
566  fHist_CutParameters = new TH1F("fTask_CutParameters", "Variable Cut Values", 10, 0., 10.);
567  fHist_CutParameters->GetXaxis()->SetBinLabel(1,"VzCutLowValue");
568  fHist_CutParameters->GetXaxis()->SetBinLabel(2,"VzCutHighValue");
569  fHist_CutParameters->GetXaxis()->SetBinLabel(3,"NBins_Vz");
570  fHist_CutParameters->GetXaxis()->SetBinLabel(4,"VxCutHighValue");
571  fHist_CutParameters->GetXaxis()->SetBinLabel(5,"VxCutLowValue");
572  fHist_CutParameters->GetXaxis()->SetBinLabel(6,"NBins_Vx");
573  fHist_CutParameters->GetXaxis()->SetBinLabel(7,"VyCutHighValue");
574  fHist_CutParameters->GetXaxis()->SetBinLabel(8,"VyCutLowValue");
575  fHist_CutParameters->GetXaxis()->SetBinLabel(9,"NBins_Vy");
577 
578  fHist_ZeroQnXY_Conter = new TH1F("fHist_ZeroQnXY_Conter","", 20, 0, 20);
579  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(1,"QxC = 0 (w/o)");
580  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(2,"QxC = 0 (wi)");
581  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(3,"QyC = 0 (w/o)");
582  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(4,"QyC = 0 (wi)");
583  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(5,"QxA = 0 (w/o)");
584  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(6,"QxA = 0 (wi)");
585  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(7,"QyA = 0 (w/o)");
586  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(8,"QyA = 0 (wi)");
587  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(9, "QxC = 0 && QyC = 0 (w/o)");
588  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(10,"QxC = 0 && QyC = 0 (wi)");
589  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(11,"QxA = 0 && QyA = 0 (w/o)");
590  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(12,"QxA = 0 && QyA = 0 (wi)");
591  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(13,"QxA,QyA,QxC,QyC= 0 (w/o)");
592  fHist_ZeroQnXY_Conter->GetXaxis()->SetBinLabel(14,"QxA,QyA,QxC,QyC= 0 (wi)");
594 
595 
596 
597  fHist_Cent_woZDCcut = new TH1F("fHist_Cent_before_ZDCcut"," ",100,0,100);
599  fHist_Cent_wiZDCcut = new TH1F("fHist_Cent_afterr_ZDCcut"," ",100,0,100);
601 
602 
603 
604 
605 
606  //-------- define and add the recenter histograms ----------------
607  if(fDataSet=="2010") {
608  //vxBin = 9;
609  //vyBin = 9;
610  //vzBin = 10;
611 
612  VxCut[0] = -0.030;
613  VxCut[1] = 0.015;
614  VyCut[0] = 0.150;
615  VyCut[1] = 0.204;
616  VzCut[0] = -10.0;
617  VzCut[1] = 9.4;
618  }
619 
620  if(fDataSet=="2015"){
621  //vxBin = 8;
622  //vyBin = 8;
623  //vzBin = 10;
624 
625  VxCut[0] = 0.060;
626  VxCut[1] = 0.086;
627  VyCut[0] = 0.321;
628  VyCut[1] = 0.345;
629  VzCut[0] = -10.0;
630  VzCut[1] = 10.0;
631  }
632 
633  if(fDataSet=="2011"){
634  AliDebug(2,"\n\n !!** WARNING ***!! \n cuts not defined for DATASET: %s\n ...EXIT...\n\n)");
635  exit(1);
636  }
637 
638  const int NbinVt = vyBin*vxBin;
639 
640  fHist_Vx_ArrayFinder = new TH1F("fHist_Vx_ArrayFinder","",vxBin,VxCut[0],VxCut[1]);
641  fHist_Vy_ArrayFinder = new TH1F("fHist_Vy_ArrayFinder","",vyBin,VyCut[0],VyCut[1]);
642  fHist_Vz_ArrayFinder = new TH1F("fHist_Vz_ArrayFinder","",vzBin,VzCut[0],VzCut[1]);
643 
644  fHist_Vxy_RunAveraged = new TH2F("fHist_Vxy_RunAveraged","Vy Vs Vx (RbR)",100,0.050,0.10,100,0.31,0.36);
646 
647 
648  fHist_ZDCC_AvgQx_VsRun = new TProfile2D(Form("fHist_ZDCC_AvgQx_VsCentRun"),"",60,0,60,90,0,90,""); //cent,run
650  fHist_ZDCC_AvgQy_VsRun = new TProfile2D(Form("fHist_ZDCC_AvgQy_VsCentRun"),"",60,0,60,90,0,90,""); //cent,run
652 
653  fHist_ZDCA_AvgQx_VsRun = new TProfile2D(Form("fHist_ZDCA_AvgQx_VsCentRun"),"",60,0,60,90,0,90,""); //cent,run
655  fHist_ZDCA_AvgQy_VsRun = new TProfile2D(Form("fHist_ZDCA_AvgQy_VsCentRun"),"",60,0,60,90,0,90,""); //cent,run
657 
658  fHist_ZDC_AvgXXminusYY_VsRun = new TProfile2D(Form("fHist_ZDCC_AvgXXminusYY_VsCentRun"),"",60,0,60,90,0,90,""); //cent,run
660  fHist_ZDC_AvgXYplusXY_VsRun = new TProfile2D(Form("fHist_ZDCC_AvgXYplusXY_VsCentRun"),"",60,0,60,90,0,90,""); //cent,run
662 
663  //Shift histograms: Fill Cos(nPsi) Sin(nPsi) vs Cent,Run
664  for(int i=0; i<4; i++){
665  fHist_ZDCC_AvgCos_VsRun[i] = new TProfile2D(Form("fHist_ZDC_AvgCos%dPsiC_VsCentRun",i+1),"",60,0,60,90,0,90,""); //cent,run
667  fHist_ZDCA_AvgCos_VsRun[i] = new TProfile2D(Form("fHist_ZDC_AvgCos%dPsiA_VsCentRun",i+1),"",60,0,60,90,0,90,"");
669 
670  fHist_ZDCC_AvgSin_VsRun[i] = new TProfile2D(Form("fHist_ZDC_AvgSin%dPsiC_VsCentRun",i+1),"",60,0,60,90,0,90,"");
672  fHist_ZDCA_AvgSin_VsRun[i] = new TProfile2D(Form("fHist_ZDC_AvgSin%dPsiA_VsCentRun",i+1),"",60,0,60,90,0,90,"");
674 
675  fHist_ZDC_AvgCosPsiSum_VsRun[i] = new TProfile2D(Form("fHist_ZDC_AvgCos%dPsi_AplusC_VsCentRun",i+1),"",60,0,60,90,0,90,"");
677  fHist_ZDC_AvgSinPsiSum_VsRun[i] = new TProfile2D(Form("fHist_ZDC_AvgSin%dPsi_AplusC_VsCentRun",i+1),"",60,0,60,90,0,90,"");
679  }
680 
681 
682 
683 
684  fHist_XXYY_vs_Cent_woCorr[0] = new TProfile(Form("fHist_XXminusYY_vs_Cent_woCorr"),"XX-YY",90,0,90,"");
686  fHist_XXYY_vs_Cent_woCorr[1] = new TProfile(Form("fHist_XYplusXY_vs_Cent_woCorr"), "XY+XY",90,0,90,"");
688  fHist_XXYY_vs_Cent_wiCorr[0] = new TProfile(Form("fHist_XXminusYY_vs_Cent_wiCorr"),"XX-YY",90,0,90,"");
690  fHist_XXYY_vs_Cent_wiCorr[1] = new TProfile(Form("fHist_XYplusXY_vs_Cent_wiCorr"), "XY+XY",90,0,90,"");
692 
693  fHist_Event_counter_vRun = new TH1F("fHist_Event_counter_vRun","",95,0,95);
695 
696 
697  char name[100];
698 
699 
700  if(fAnalysisSet=="FillGainEq") {
701 
702  fHist_Vx_vs_runnum = new TProfile("fHist_Vx_vs_runnum","<Vx>_vs_runnum",frunflag,0,frunflag,"s");
704  fHist_Vy_vs_runnum = new TProfile("fHist_Vy_vs_runnum","<Vy>_vs_runnum",frunflag,0,frunflag,"s");
706  fHist_Vz_vs_runnum = new TProfile("fHist_Vz_vs_runnum","<Vz>_vs_runnum",frunflag,0,frunflag,"s");
708 
709  for(int i=0;i<vzBin;i++) {
710  fHist_ZDCC_En_CommonCh[i] = new TProfile2D(Form("fHist_ZDCC_En_CommonCh_Vz%d",i+1),"",100,0,100,NbinVt,0,NbinVt,"");
711  fHist_ZDCA_En_CommonCh[i] = new TProfile2D(Form("fHist_ZDCA_En_CommonCh_Vz%d",i+1),"",100,0,100,NbinVt,0,NbinVt,"");
714  }
715  for(int i=0;i<frunflag;i++) {
716  //store: ZDC energy for gain calibration:
717  fHist_ZDCA_En_Run[i] = new TProfile2D(Form("fHist_ZDCA_En_Run%d",runNums[i]),"",100,0,100,5,0,5,"");
719  fHist_ZDCC_En_Run[i] = new TProfile2D(Form("fHist_ZDCC_En_Run%d",runNums[i]),"",100,0,100,5,0,5,"");
721  }
722  }
723 
724 
725  if(bFillZDCQAon){
726 
727  fHist_Task_config->Fill(0.5);
728 
729  if(fAnalysisSet=="FillGainEq"){
730  fHist_Psi1_ZDCC_wGainCorr = new TH1F("fHist_Psi1_ZDCC_woGainCorr","", 200, 0,2.*TMath::Pi());
731  fHist_Psi1_ZDCA_wGainCorr = new TH1F("fHist_Psi1_ZDCA_woGainCorr","", 200, 0,2.*TMath::Pi());
732  }
733  else{
734  fHist_Psi1_ZDCC_wGainCorr = new TH1F("fHist_Psi1_ZDCC_wiGainCorr","", 200, 0,2.*TMath::Pi());
735  fHist_Psi1_ZDCA_wGainCorr = new TH1F("fHist_Psi1_ZDCA_wiGainCorr","", 200, 0,2.*TMath::Pi());
736  }
737 
740 
741  fHist_Psi1_ZDCC_wRectCorr = new TH1F("fHist_Psi1_ZDCC_wiRectCorr","", 200, 0,2.*TMath::Pi());
743  fHist_Psi1_ZDCA_wRectCorr = new TH1F("fHist_Psi1_ZDCA_wiRectCorr","", 200, 0,2.*TMath::Pi());
745 
746  fHist_Psi1_ZDCC_RunByRun = new TH2F("fHist_Psi1_ZDCC_RunByRun","", 100, 0, 100, 200, 0,2.*TMath::Pi());
748  fHist_Psi1_ZDCA_RunByRun = new TH2F("fHist_Psi1_ZDCA_RunByRun","", 100, 0, 100, 200, 0,2.*TMath::Pi());
750 
751  fHist_Psi1_ZDCC_wCorrFull = new TH1F("fHist_Psi1_ZDCC_wCorrFull","", 200, 0,2.*TMath::Pi());
753  fHist_Psi1_ZDCA_wCorrFull = new TH1F("fHist_Psi1_ZDCA_wCorrFull","", 200, 0,2.*TMath::Pi());
755 
756 
757  fHist_PsiSumAC_woCorr = new TH1F("fHist_PsiSumAC_woCorr","", 200, 0,2.*TMath::Pi());
759  fHist_PsiSumAC_wiCorr = new TH1F("fHist_PsiSumAC_wiCorr","", 200, 0,2.*TMath::Pi());
761 
762 
763 
764  TString sNameQn[4] = {"Xa","Xc","Ya","Yc"};
765  TString sNameQn2[4] = {"XaXc","YaYc","XcYa","YcXa"};
766  TString sNameVs[5] = {"Cent","Mult","Vx","Vy","Vz"};
767  Int_t nBinNumVs[5] = {100, 100, 50, 50, 400}; // number of bins for "Cent", "Mult", "Vx","Vy","Vz"
768  Double_t lBinLowVs[5] = { 0, 0, VxCut[0], VyCut[0], -10}; // bin low value: "Cent", "Mult", "Vx", "Vy", "Vz"
769  Double_t lBinHighVs[5] = {100, 4000, VxCut[1], VyCut[1], 10}; // bin high value: "Cent", "Mult", "Vx", "Vy", "Vz"
770 
771 
772  for(int i=0;i<4;i++) {
773  sprintf(name,"fHist_%s_wiCorr_RunByRun",static_cast<const char*>(sNameQn[i]));
774  fHist_Qx_wiCorr_RunByRun[i] = new TProfile(name,"", 90, 0, 90,"");
776 
777  sprintf(name,"fHist_%s_TrigonoMetric_woCorr",static_cast<const char*>(sNameQn[i]));
778  fHist_Qx_Trig_woCorr[i] = new TProfile(name,"", 90, 0, 90,""); //centrality range
780  sprintf(name,"fHist_%s_TrigonoMetric_woCorr",static_cast<const char*>(sNameQn2[i]));
781  fHist_XX_Trig_woCorr[i] = new TProfile(name,"", 90, 0, 90,""); //centrality range
783 
784  sprintf(name,"fHist_%s_TrigonoMetric_wiCorr",static_cast<const char*>(sNameQn[i]));
785  fHist_Qx_Trig_wiCorr[i] = new TProfile(name,"", 90, 0, 90,""); //centrality range
787  sprintf(name,"fHist_%s_TrigonoMetric_wiCorr",static_cast<const char*>(sNameQn2[i]));
788  fHist_XX_Trig_wiCorr[i] = new TProfile(name,"", 90, 0, 90,""); //centrality range
790 
791  for(int j=0;j<5;j++) {//fHist_Qx_vs_Obs_woCorr
792  //store: X,Y position for recenter:
793  sprintf(name,"fHist_%s_vs_%s_woCorr",static_cast<const char*>(sNameQn[i]),static_cast<const char*>(sNameVs[j]));
794  fHist_Qx_vs_Obs_woCorr[i][j] = new TProfile(name,"", nBinNumVs[j], lBinLowVs[j], lBinHighVs[j],"");
796 
797  sprintf(name,"fHist_%s_vs_%s_woCorr",static_cast<const char*>(sNameQn2[i]),static_cast<const char*>(sNameVs[j]));
798  fHist_XX_vs_Obs_woCorr[i][j] = new TProfile(name,"", nBinNumVs[j], lBinLowVs[j], lBinHighVs[j],"");
800 
801  if(bFillCosSin && fAnalysisSet=="FillGainEq") {
802  sprintf(name,"fHist_%s_vs_%s_woCorrCosSin",static_cast<const char*>(sNameQn[i]),static_cast<const char*>(sNameVs[j]));
803  }
804  else{
805  sprintf(name,"fHist_%s_vs_%s_wiCorr",static_cast<const char*>(sNameQn[i]),static_cast<const char*>(sNameVs[j]));
806  }
807  fHist_Qx_vs_Obs_wiCorr[i][j] = new TProfile(name,"", nBinNumVs[j], lBinLowVs[j], lBinHighVs[j],"");
809 
810  if(bFillCosSin && fAnalysisSet=="FillGainEq") {
811  sprintf(name,"fHist_%s_vs_%s_woCorrCosSin",static_cast<const char*>(sNameQn2[i]),static_cast<const char*>(sNameVs[j]));
812  }
813  else{
814  sprintf(name,"fHist_%s_vs_%s_wiCorr",static_cast<const char*>(sNameQn2[i]),static_cast<const char*>(sNameVs[j]));
815  }
816 
817  fHist_XX_vs_Obs_wiCorr[i][j] = new TProfile(name,"", nBinNumVs[j], lBinLowVs[j], lBinHighVs[j],"");
819  }
820  }
821  }
822 
823 
824  if(vzBin>20){
825  printf("\n\n::UserCreateOutPutObject()\n Vz Binning more than 20 not allowed\n ==> Exit <== \n\n");
826  exit(1);
827  }
828 
829  const int VzBinIter = (const int) vzBin;
830 
831 
832  //filling the Q vectors for recenter:
833  if(fAnalysisSet=="DoGainEq") {
834  if(!bApplyRecent) {
835 
836  fListZDCQxy = new TList();
837  fListZDCQxy->SetOwner(kTRUE);
838 
839  if(!bRunAveragedQn) {
840  for(int i=0;i<frunflag;i++) {
841  for(int j=0;j<VzBinIter;j++) {
842  fHist_znCx_V0_VxVy[i][j] = new TProfile2D(Form("fHist_znCx_V0_Run%d_Vz%d",runNums[i],j+1),"",NbinVt,0,NbinVt,90,0,90);
843  fHist_znCy_V0_VxVy[i][j] = new TProfile2D(Form("fHist_znCy_V0_Run%d_Vz%d",runNums[i],j+1),"",NbinVt,0,NbinVt,90,0,90);
844  fHist_znAx_V0_VxVy[i][j] = new TProfile2D(Form("fHist_znAx_V0_Run%d_Vz%d",runNums[i],j+1),"",NbinVt,0,NbinVt,90,0,90);
845  fHist_znAy_V0_VxVy[i][j] = new TProfile2D(Form("fHist_znAy_V0_Run%d_Vz%d",runNums[i],j+1),"",NbinVt,0,NbinVt,90,0,90);
846 
847  fListZDCQxy->Add(fHist_znCx_V0_VxVy[i][j]);
848  fListZDCQxy->Add(fHist_znCy_V0_VxVy[i][j]);
849  fListZDCQxy->Add(fHist_znAx_V0_VxVy[i][j]);
850  fListZDCQxy->Add(fHist_znAy_V0_VxVy[i][j]);
851  }
852  }
853  }
854  else{
855  for(int j=0;j<VzBinIter;j++) {
856  fHist_znCx_V0_VxVy[0][j] = new TProfile2D(Form("fHist_znCx_V0_Run%d_Vz%d",0,j+1),"",NbinVt,0,NbinVt,90,0,90);
857  fHist_znCy_V0_VxVy[0][j] = new TProfile2D(Form("fHist_znCy_V0_Run%d_Vz%d",0,j+1),"",NbinVt,0,NbinVt,90,0,90);
858  fHist_znAx_V0_VxVy[0][j] = new TProfile2D(Form("fHist_znAx_V0_Run%d_Vz%d",0,j+1),"",NbinVt,0,NbinVt,90,0,90);
859  fHist_znAy_V0_VxVy[0][j] = new TProfile2D(Form("fHist_znAy_V0_Run%d_Vz%d",0,j+1),"",NbinVt,0,NbinVt,90,0,90);
860 
861  fListZDCQxy->Add(fHist_znCx_V0_VxVy[0][j]);
862  fListZDCQxy->Add(fHist_znCy_V0_VxVy[0][j]);
863  fListZDCQxy->Add(fHist_znAx_V0_VxVy[0][j]);
864  fListZDCQxy->Add(fHist_znAy_V0_VxVy[0][j]);
865  }
866  }
867  }
868  }
869 
870 
871 
872 
873 
874 
875  Double_t centRange[12] = {0,5,10,20,30,40,50,60,70,80,90,100};
876  //Double_t pTRange[21] = {0,0.2,0.4,0.6,0.8,1.0,1.2,1.4,1.6,1.8,2.0,2.2,2.4,2.6,2.8,3.0,3.3,3.6,4.0,4.5,5.0};
877  Double_t pTRange[28] = {0,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.,1.2,1.4,1.6,1.8,2.,2.33,2.66,3.,3.5,4.,5.,6.,8.,10.,14.,20.,30.,50.};
878  const int fPtDiffNBins = 27;
879 
880  TString sNameComp[4] = {"uxCx","uyCy","uxAx","uyAy"};
881 
882 
883  if(bApplyRecent) {
884  //v2 integrated:
885  fHist_v2xV1_ZDN_Norm_All = new TProfile("fHist_v2xV1_ZDN_Norm_All","v2 X V1^2 (ZDC) all terms",11,centRange,"");
886  fHist_v2xV1_ZDN_Norm_All->Sumw2();
888  fHist_v2xV1_ZDN_Cent_All = new TProfile("fHist_v2xV1_ZDN_Cent_All","v2 X V1^2 (ZDC) all terms",100, 0, 100,"");
889  fHist_v2xV1_ZDN_Cent_All->Sumw2();
891  fHist_v2xV1_ZDN_Refm_All = new TProfile("fHist_v2xV1_ZDN_Refm_All","v2 X V1^2 (ZDC) all terms", 40, 0, 4000,"");
892  fHist_v2xV1_ZDN_Refm_All->Sumw2();
894 
895  //v3 integrated:
896  fHist_v3xV1_ZDN_Norm_Comb1 = new TProfile("fHist_v3xV1_ZDN_Norm_Comb1","v3 X V1^2 (ZDC) all terms",11,centRange,"");
899  fHist_v3xV1_ZDN_Cent_Comb1 = new TProfile("fHist_v3xV1_ZDN_Cent_Comb1","v3 X V1^2 (ZDC) all terms",100, 0, 100,"");
902  fHist_v3xV1_ZDN_Norm_Comb2 = new TProfile("fHist_v3xV1_ZDN_Norm_Comb2","v3 X V1^2 (ZDC) all terms",11,centRange,"");
905  fHist_v3xV1_ZDN_Cent_Comb2 = new TProfile("fHist_v3xV1_ZDN_Cent_Comb2","v3 X V1^2 (ZDC) all terms",100, 0, 100,"");
908 
909  //v4 integrated:
910  fHist_v4xV1_ZDN_Norm_Comb1 = new TProfile("fHist_v4xV1_ZDN_Norm_Comb1","v4 X V1^2 (ZDC) all terms",11,centRange,"");
913  fHist_v4xV1_ZDN_Cent_Comb1 = new TProfile("fHist_v4xV1_ZDN_Cent_Comb1","v4 X V1^2 (ZDC) all terms",100, 0, 100,"");
916 
917  //Summed ZDC resolution:
918  fHist_ZDN_resol_Norm_All = new TProfile("fHist_ZDN_resol_Norm_All","Resol. V1^2(ZDC) All",11,centRange,"");
919  fHist_ZDN_resol_Norm_All->Sumw2();
921  fHist_ZDN_resol_Cent_All = new TProfile("fHist_ZDN_resol_Cent_All","Resol. V1^2(ZDC) All",100, 0, 100,"");
922  fHist_ZDN_resol_Cent_All->Sumw2();
924  fHist_ZDN_resol_Refm_All = new TProfile("fHist_ZDN_resol_Refm_All","Resol. V1^2(ZDC) All",40, 0, 4000,"");
925  fHist_ZDN_resol_Refm_All->Sumw2();
927 
928  //Individual ZDC resolutions vs cent:
929  fHist_ZDN_resol_Norm_XX = new TProfile("fHist_ZDN_resol_Norm_XX","Resol. V1^2(ZDC) XX",11,centRange,"");
930  fHist_ZDN_resol_Norm_XX->Sumw2();
932  fHist_ZDN_resol_Norm_YY = new TProfile("fHist_ZDN_resol_Norm_YY","Resol. V1^2(ZDC) YY",11,centRange,"");
933  fHist_ZDN_resol_Norm_YY->Sumw2();
935  fHist_ZDN_resol_Cent_XX = new TProfile("fHist_ZDN_resol_Cent_XX","Resol. V1^2(ZDC) XX",100, 0, 100,"");
936  fHist_ZDN_resol_Cent_XX->Sumw2();
938  fHist_ZDN_resol_Cent_YY = new TProfile("fHist_ZDN_resol_Cent_YY","Resol. V1^2(ZDC) YY",100, 0, 100,"");
939  fHist_ZDN_resol_Cent_YY->Sumw2();
941 
942 
943 
944  //v1 integrated, 4 terms, normal bin, fine Centr bin
945  for(int i=0; i<4; i++) {
946  sprintf(name,"fHist_v1_%s_ZDN_Norm",static_cast<const char*>(sNameComp[i]));
947  fHist_v2xV1_ZDN_Norm_Sep[i] = new TProfile(name,"v1 vs Cent",11,centRange,"");
948  fHist_v2xV1_ZDN_Norm_Sep[i]->Sumw2();
950 
951  sprintf(name,"fHist_v1_%s_ZDN_Cent",static_cast<const char*>(sNameComp[i]));
952  fHist_v2xV1_ZDN_Cent_Sep[i] = new TProfile(name,"v1 vs Cent",100,0,100,"");
953  fHist_v2xV1_ZDN_Cent_Sep[i]->Sumw2();
955  }
956  //v1 resulution, 2 terms, normal bin, fine Centr bin
957  fHist_ZDN_resol_Norm_Sep[0] = new TProfile("fHist_ZDN_resol_XaXc_Norm"," XaXc vs Cent",11,centRange,"");
958  fHist_ZDN_resol_Norm_Sep[0]->Sumw2();
960  fHist_ZDN_resol_Norm_Sep[1] = new TProfile("fHist_ZDN_resol_YaYc_Norm"," YaYc vs Cent",11,centRange,"");
961  fHist_ZDN_resol_Norm_Sep[1]->Sumw2();
963 
964  fHist_ZDN_resol_Cent_Sep[0] = new TProfile("fHist_ZDN_resol_XaXc_Cent"," XaXc vs Cent",100,0,100,"");
965  fHist_ZDN_resol_Cent_Sep[0]->Sumw2();
967  fHist_ZDN_resol_Cent_Sep[1] = new TProfile("fHist_ZDN_resol_YaYc_Cent"," YaYc vs Cent",100,0,100,"");
968  fHist_ZDN_resol_Cent_Sep[1]->Sumw2();
970 
971 
972 
973  //v2 differential pT:
974  for(int i=0; i<10; i++) {
975  sprintf(name,"fHist_v2xV1_ZDN_pTDiff_Cent%d",i);
976  fHist_v2xV1_ZDN_pTDiff_All[i] = new TProfile(name,"v2 X V1^2 pTdiff",fPtDiffNBins,pTRange);
977  fHist_v2xV1_ZDN_pTDiff_All[i]->Sumw2();
979  }
980 
981  //v3 differential Eta:
982  for(int i=0; i<10; i++) {
983  sprintf(name,"fHist_v3xV1_ZDN_EtaDiff_Comb1_Cent%d",i);
984  fHist_v3xV1_ZDN_EtaDiff_Comb1[i] = new TProfile(name,"v3 X V1^2 Etadiff",10,-0.8,0.8);
985  fHist_v3xV1_ZDN_EtaDiff_Comb1[i]->Sumw2();
987  sprintf(name,"fHist_v3xV1_ZDN_EtaDiff_Comb2_Cent%d",i);
988  fHist_v3xV1_ZDN_EtaDiff_Comb2[i] = new TProfile(name,"v3 X V1^2 Etadiff",10,-0.8,0.8);
989  fHist_v3xV1_ZDN_EtaDiff_Comb2[i]->Sumw2();
991  }
992 
993  //v4 differential pT:
994  for(int i=0; i<10; i++) {
995  sprintf(name,"fHist_v4xV1_ZDN_pTDiff_Cent%d",i);
996  fHist_v4xV1_ZDN_pTDiff_All[i] = new TProfile(name,"v4 X V1^2 pTdiff",fPtDiffNBins,pTRange);
997  fHist_v4xV1_ZDN_pTDiff_All[i]->Sumw2();
999  }
1000 
1001 
1002  //v1 differential Eta, pT: not needed now.
1003  for(int i=0; i<10; i++) {
1004  for(int j=0; j<4; j++) {
1005  sprintf(name,"fHist_%s_ZDN_EtaDiff_Cent%d",static_cast<const char*>(sNameComp[j]),i);
1006  fHist_v1xV1_ZDN_EtaDiff[j][i] = new TProfile(name,"v1 Eta-diff", 5, -0.8, 0.8);
1007  fHist_v1xV1_ZDN_EtaDiff[j][i]->Sumw2();
1009 
1010  sprintf(name,"fHist_%s_ZDN_pTDiff_Cent%d",static_cast<const char*>(sNameComp[j]),i);
1011  fHist_v1xV1_ZDN_pTDiff[j][i] = new TProfile(name,"v1 Eta-diff", fPtDiffNBins, pTRange);
1012  fHist_v1xV1_ZDN_pTDiff[j][i]->Sumw2();
1013  fListHistos->Add(fHist_v1xV1_ZDN_pTDiff[j][i]);
1014  }
1015  }
1016 
1017  //------------ calculate centrality weight: ------------
1018  TH1F *fCent_fromDATA;
1019 
1020  if(fListZDCQxy) {
1021  fCent_fromDATA = (TH1F *) fListZDCQxy->FindObject("fHist_Cent_afterr_ZDCcut");
1022 
1023  for(int i=0;i<4;i++){
1024  fHist_ZDCC_AvgCosNPsi[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDC_AvgCos%dPsiC_VsCR",i+1));
1025  fHist_ZDCA_AvgCosNPsi[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDC_AvgCos%dPsiA_VsCR",i+1));
1026  fHist_ZDCC_AvgSinNPsi[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDC_AvgSin%dPsiC_VsCR",i+1));
1027  fHist_ZDCA_AvgSinNPsi[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDC_AvgSin%dPsiA_VsCR",i+1));
1028 
1029  fHist_ZDC_AvgCosNPsiAC[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDC_AvgCos%dPsiAplusC_VsCR",i+1));
1030  fHist_ZDC_AvgSinNPsiAC[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDC_AvgSin%dPsiAplusC_VsCR",i+1));
1031  }
1032 
1033  fHist_ZDCC_AvgQx_VsCR = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDCC_AvgQx_VsCR"));
1034  fHist_ZDCC_AvgQy_VsCR = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDCC_AvgQy_VsCR"));
1035  fHist_ZDCA_AvgQx_VsCR = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDCA_AvgQx_VsCR"));
1036  fHist_ZDCA_AvgQy_VsCR = (TH2F *) fListZDCQxy->FindObject(Form("fHist_ZDCA_AvgQy_VsCR"));
1037  }
1038  else{
1039  printf("\n\n ******** Running without Centrality weight, No Shift Correction !!******** \n\n");
1040  fCent_fromDATA = new TH1F("fCent_DATA","Centrality distribution",100,0,100);
1041  for(int i=1;i<=fCent_fromDATA->GetNbinsX();i++){
1042  fCent_fromDATA->SetBinContent(i,100);
1043  }
1044  for(int i=0;i<4;i++){
1045  fHist_ZDCC_AvgCosNPsi[i] = new TH2F(Form("fHist_ZDC_AvgCos%dPsiC_VsCR_dummy",i+1),"",60,0,60,90,0,90); //cent,run
1046  fHist_ZDCA_AvgCosNPsi[i] = new TH2F(Form("fHist_ZDC_AvgCos%dPsiA_VsCR_dummy",i+1),"",60,0,60,90,0,90);
1047  fHist_ZDCC_AvgSinNPsi[i] = new TH2F(Form("fHist_ZDC_AvgSin%dPsiC_VsCR_dummy",i+1),"",60,0,60,90,0,90);
1048  fHist_ZDCA_AvgSinNPsi[i] = new TH2F(Form("fHist_ZDC_AvgSin%dPsiA_VsCR_dummy",i+1),"",60,0,60,90,0,90);
1049 
1050  fHist_ZDC_AvgCosNPsiAC[i] = new TH2F(Form("fHist_ZDC_AvgCos%dPsiAplusC_VsCR_dummy",i+1),"",60,0,60,90,0,90);
1051  fHist_ZDC_AvgSinNPsiAC[i] = new TH2F(Form("fHist_ZDC_AvgSin%dPsiAplusC_VsCR_dummy",i+1),"",60,0,60,90,0,90);
1052  }
1053  fHist_ZDCC_AvgQx_VsCR = new TH2F(Form("fHist_ZDCC_AvgQx_VsCR_dummy"),"",60,0,60,90,0,90); //cent,run
1054  fHist_ZDCC_AvgQy_VsCR = new TH2F(Form("fHist_ZDCC_AvgQy_VsCR_dummy"),"",60,0,60,90,0,90);
1055  fHist_ZDCA_AvgQx_VsCR = new TH2F(Form("fHist_ZDCA_AvgQx_VsCR_dummy"),"",60,0,60,90,0,90);
1056  fHist_ZDCA_AvgQy_VsCR = new TH2F(Form("fHist_ZDCA_AvgQy_VsCR_dummy"),"",60,0,60,90,0,90);
1057  }
1058 
1059  Double_t Content,error;
1060  Double_t maxCount = -1;
1061  Int_t maxCent = -1;
1062  Double_t weight = 0.;
1063 
1064  for(int i=1;i<=fCent_fromDATA->GetNbinsX();i++){
1065  Content = fCent_fromDATA->GetBinContent(i);
1066  if(maxCount < Content){
1067  maxCount = Content;
1068  maxCent = i;
1069  }
1070  }
1071 
1072  fWeight_Cent = new TH1F("fWeight_Cent","Weight for centrality",100,0,100);
1073 
1074  for(int i=1;i<=fWeight_Cent->GetNbinsX();i++)
1075  {
1076  Content = fCent_fromDATA->GetBinContent(i);
1077  error = fCent_fromDATA->GetBinError(i);
1078  if(Content){
1079  weight = maxCount/Content;
1080  }
1081  else{
1082  weight = 0;
1083  }
1084  fWeight_Cent->SetBinContent(i,weight);
1085  fWeight_Cent->SetBinError(i,0.0);
1086  //cout<<"cent "<<i-1<<"-"<<i<<" \t wgt = "<<fWeight_Cent->GetBinContent(i)<<" error = "<<fWeight_Cent->GetBinError(i)<<endl;
1087  }
1088 
1089  fListHistos->Add(fWeight_Cent);
1090  //delete fCent_fromDATA;
1091 
1092 
1093 
1094  //---------Filter bit efficiency----------
1095  if(fListHijing) {
1096  for(int i=0;i<10;i++) {
1097  fFB_Efficiency_Cent[i] = (TH1D *) fListHijing->FindObject(Form("eff_unbiased_%d",i));
1098  //cout<<"cent = "<<i<<" name = "<<fFB_Efficiency_Cent[i]->GetName()<<endl;
1099  }
1100  }
1101  else{ // if MC efficiency not found then use weight = 1. Code won't crash.
1102  printf("\n\n !!***** Warning *****!! \n TList for FilterBit efficiency not found !!\n\n");
1103  for(int i=0;i<10;i++){
1104  fFB_Efficiency_Cent[i] = new TH1D(Form("eff_unbiased_%d",i),"",100,0,20);
1105  for(int j=1;j<=fFB_Efficiency_Cent[i]->GetNbinsX();j++){
1106  fFB_Efficiency_Cent[i]->SetBinContent(j,1.000);
1107  }
1108  }
1109  }
1110 
1111  } //if(bApplyRecent)
1112 
1113 
1114 
1115 
1116 
1117 
1118 
1119 
1120 
1121  if(sCentEstimator=="V0"){
1122  fHist_Task_config->Fill(1.5);
1123  }
1124  if(sCentEstimator=="TPC"){
1125  fHist_Task_config->Fill(2.5);
1126  }
1127  if(sCentEstimator=="CL1"){
1128  fHist_Task_config->Fill(3.5);
1129  }
1130  if(fRejectPileUp){
1131  fHist_Task_config->Fill(4.5);
1132  }
1133  if(fRejectPileUpTight){
1134  fHist_Task_config->Fill(5.5);
1135  }
1136  if(fAnalysisSet=="FillGainEq"){
1137  fHist_Task_config->Fill(6.5);
1138  }
1139  if(fAnalysisSet=="DoGainEq"){
1140  fHist_Task_config->Fill(7.5);
1141  if(fListZDCWgt){
1142  fHist_Task_config->Fill(8.5);
1143  }
1144  }
1145  if(bFillCosSin){
1146  fHist_Task_config->Fill(9.5);
1147  }
1148  if(bApplyRecent){
1149  fHist_Task_config->Fill(10.5);
1150  if(fListZDCQxy){
1151  fHist_Task_config->Fill(11.5);
1152  }
1153  }
1154  if(!bRunAveragedQn){
1155  fHist_Task_config->Fill(12.5);
1156  }
1157  if(bCentCutShift){
1158  fHist_Task_config->Fill(13.5);
1159  }
1160  if(bApplyShiftCorr){
1161  fHist_Task_config->Fill(14.5);
1162  }
1163  if(bShiftCorrOnCent){
1164  fHist_Task_config->Fill(15.5);
1165  }
1166  if(bUseTrigonQn){
1167  fHist_Task_config->Fill(16.5);
1168  }
1169 
1170 
1171  fHist_CutParameters->SetBinContent(1,VzCut[0]);
1172  fHist_CutParameters->SetBinContent(2,VzCut[1]);
1173  fHist_CutParameters->SetBinContent(3,vzBin);
1174  fHist_CutParameters->SetBinContent(4,VxCut[0]);
1175  fHist_CutParameters->SetBinContent(5,VxCut[1]);
1176  fHist_CutParameters->SetBinContent(6,vxBin);
1177  fHist_CutParameters->SetBinContent(7,VyCut[0]);
1178  fHist_CutParameters->SetBinContent(8,VyCut[1]);
1179  fHist_CutParameters->SetBinContent(9,vyBin);
1180 
1181 
1182 
1183  PostData(1,fListHistos);
1184 
1185  if(!bApplyRecent && fAnalysisSet=="DoGainEq") {
1186  PostData(2,fListZDCQxy);
1187  }
1188  else{
1189  fListDummy1 = new TList();
1190  fListDummy1->SetOwner(kTRUE);
1192 
1193  PostData(2,fListDummy1);
1194  }
1195 
1196 
1197  fAnalysisUtil = new AliAnalysisUtils();
1198  fAnalysisUtil->SetUseMVPlpSelection(kTRUE);
1199  fAnalysisUtil->SetUseOutOfBunchPileUp(kTRUE);
1200 
1201 
1202  fcheckOnce = 0;
1203  fOldRunNum = 0;
1204  printf("\n\n::UserCreateOutPutObject()\n Runflag= %d, dataset: %s, VxyBin = %d, Analysis= %s\n\n",frunflag,fDataSet.Data(),NbinVt,fAnalysisSet.Data());
1205 
1206 }
1207 
1208 //________________________________________________________________________
1210 {
1211 
1212  float stepCount = 0.5;
1213 
1214  //printf("\n ... ::UserExec() is being called. 1 Step %d... \n",stepCount);
1215 
1216  fHist_Event_count->Fill(stepCount);
1217  stepCount++;
1218 
1219  AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
1220  fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(1));
1221 
1222  AliFlowEvent* anEvent = dynamic_cast<AliFlowEvent*>(GetInputData(2));
1223 
1224  AliFlowVector vQarray[2];
1225 
1226  if(anEvent) {
1227  // Get Q vectors for the subevents
1228  anEvent->GetZDC2Qsub(vQarray);
1229  }
1230 
1231 
1232 
1233 
1234  if(!aod){
1235  printf("\n ... ::UserExec = no aod found..... \n");
1236  return;
1237  }
1238 
1239  fHist_Event_count->Fill(stepCount);
1240  stepCount++;
1241 
1242 
1243  AliAODVertex *pVertex = aod->GetPrimaryVertex();
1244  Double_t Vxyz[3] = {0,0,0};
1245  Vxyz[0] = pVertex->GetX();
1246  Vxyz[1] = pVertex->GetY();
1247  Vxyz[2] = pVertex->GetZ();
1248 
1249  fHist_Vxy_RunAveraged->Fill(Vxyz[0], Vxyz[1]);
1250 
1251  //------- Apply Necessary event cuts ---------
1252  if(Vxyz[2] >= VzCut[1] || Vxyz[2] <= VzCut[0]) return;
1253 
1254  fHist_Event_count->Fill(stepCount);
1255  stepCount++;
1256 
1257  if(Vxyz[0] >= VxCut[1] || Vxyz[0] <= VxCut[0]) return;
1258 
1259  fHist_Event_count->Fill(stepCount);
1260  stepCount++;
1261 
1262  if(Vxyz[1] >= VyCut[1] || Vxyz[1] <= VyCut[0]) return;
1263 
1264  fHist_Event_count->Fill(stepCount);
1265  stepCount++;
1266 
1267 
1268  Double_t EvtCent = fEvent->GetCentrality();
1269 
1270 
1271  //---------- get runindex: --------------
1272  Int_t runNumber = aod->GetRunNumber();
1273  Int_t runindex = -111;
1274 
1275  for(int i=0;i<frunflag;i++){
1276  if(runNumber==runNums[i])
1277  {
1278  runindex = i;
1279  break;
1280  }
1281  }
1282  if(runindex<0) {
1283  printf("\n ... **WARNING** \n::UserExec() runnumber not listed.\n EXIT..\n");
1284  //exit(1);
1285  }
1286  //-----------------------------------------
1287 
1288 
1289 
1290 
1291 
1292 
1293 
1294 
1295 
1296 
1297 
1298  //--------- starting pileup rejection work: --------
1299  Double_t centrV0M=300;
1300  Double_t centrCL1=300;
1301  Double_t centrCL0=300;
1302  Double_t centrTRK=300;
1303 
1304  if(fDataSet=="2010"||fDataSet=="2011"){
1305  centrV0M = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("V0M");
1306  centrCL1 = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL1");
1307  centrCL0 = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("CL0");
1308  centrTRK = ((AliVAODHeader*)aod->GetHeader())->GetCentralityP()->GetCentralityPercentile("TRK");
1309  }
1310  else{
1311  fMultSelection = (AliMultSelection*) InputEvent()->FindListObject("MultSelection");
1312  if(!fMultSelection) {
1313  printf("\n\n **WARNING** ::UserExec() AliMultSelection object not found.\n\n");
1314  exit(1);
1315  }
1316  centrV0M = fMultSelection->GetMultiplicityPercentile("V0M");
1317  centrCL1 = fMultSelection->GetMultiplicityPercentile("CL1");
1318  centrCL0 = fMultSelection->GetMultiplicityPercentile("CL0");
1319  centrTRK = fMultSelection->GetMultiplicityPercentile("TRK");
1320  }// 2015
1321 
1322  Bool_t BisPileup=kFALSE;
1323 
1324  if(fRejectPileUp && InputEvent()) {
1325  //if(!fCutsEvent->IsSelected(InputEvent(),MCEvent())) return;
1326  if(fDataSet!="2015") {
1327  if(plpMV(aod)) {
1328  fPileUpCount->Fill(0.5);
1329  BisPileup=kTRUE;
1330  }
1331  Int_t isPileup = aod->IsPileupFromSPD(3);
1332  if(isPileup != 0) {
1333  fPileUpCount->Fill(1.5);
1334  //BisPileup=kTRUE; // ----- Rihan: pileup from SPD not used for 2010
1335  }
1336  if(((AliAODHeader*)aod->GetHeader())->GetRefMultiplicityComb08() < 0) {
1337  fPileUpCount->Fill(2.5);
1338  BisPileup=kTRUE;
1339  }
1340  if(aod->IsIncompleteDAQ()) {
1341  fPileUpCount->Fill(3.5);
1342  BisPileup=kTRUE;
1343  }
1344 
1345  //check vertex consistency
1346  const AliAODVertex* vtTrc = aod->GetPrimaryVertex();
1347  const AliAODVertex* vtSPD = aod->GetPrimaryVertexSPD();
1348 
1349  if(vtTrc->GetNContributors() < 2 || vtSPD->GetNContributors()<1) {
1350  fPileUpCount->Fill(5.5);
1351  BisPileup=kTRUE;
1352  }
1353 
1354  double covTrc[6], covSPD[6];
1355  vtTrc->GetCovarianceMatrix(covTrc);
1356  vtSPD->GetCovarianceMatrix(covSPD);
1357 
1358  double dz = vtTrc->GetZ() - vtSPD->GetZ();
1359 
1360  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
1361  double errTrc = TMath::Sqrt(covTrc[5]);
1362  double nsigTot = dz/errTot;
1363  double nsigTrc = dz/errTrc;
1364 
1365  if(TMath::Abs(dz)>0.2 || TMath::Abs(nsigTot)>10 || TMath::Abs(nsigTrc)>20) {
1366  fPileUpCount->Fill(6.5);
1367  BisPileup=kTRUE;
1368  }
1369  if(fAnalysisUtil->IsPileUpEvent(InputEvent())) {
1370  fPileUpCount->Fill(7.5);
1371  BisPileup=kTRUE;
1372  }
1373  }
1374 
1375  else {
1376  // pileup from AliMultSelection for 2015
1377  if(!fMultSelection->GetThisEventIsNotPileup())
1378  fPileUpMultSelCount->Fill(0.5);
1379  if(!fMultSelection->GetThisEventIsNotPileupMV())
1380  fPileUpMultSelCount->Fill(1.5);
1381  if(!fMultSelection->GetThisEventIsNotPileupInMultBins())
1382  fPileUpMultSelCount->Fill(2.5);
1383  if(!fMultSelection->GetThisEventHasNoInconsistentVertices())
1384  fPileUpMultSelCount->Fill(3.5);
1385  if(!fMultSelection->GetThisEventPassesTrackletVsCluster())
1386  fPileUpMultSelCount->Fill(4.5);
1387  if(!fMultSelection->GetThisEventIsNotAsymmetricInVZERO())
1388  fPileUpMultSelCount->Fill(5.5);
1389  if(!fMultSelection->GetThisEventIsNotIncompleteDAQ())
1390  fPileUpMultSelCount->Fill(6.5);
1391  if(!fMultSelection->GetThisEventHasGoodVertex2016())
1392  fPileUpMultSelCount->Fill(7.5);
1393 
1394  BisPileup=kFALSE;
1395 
1396  // pile-up a la Dobrin for LHC15o
1397  if(plpMV(aod)) {
1398  fPileUpCount->Fill(0.5);
1399  BisPileup=kTRUE;
1400  }
1401 
1402  Int_t isPileup = aod->IsPileupFromSPD(3);
1403  if(isPileup != 0) {
1404  fPileUpCount->Fill(1.5);
1405  BisPileup=kTRUE;
1406  }
1407 
1408  if(((AliAODHeader*)aod->GetHeader())->GetRefMultiplicityComb08() < 0) {
1409  fPileUpCount->Fill(2.5);
1410  BisPileup=kTRUE;
1411  }
1412 
1413  if(aod->IsIncompleteDAQ()) {
1414  fPileUpCount->Fill(3.5);
1415  BisPileup=kTRUE;
1416  }
1417 
1418  if(fabs(centrV0M-centrCL1)>7.5) {
1419  fPileUpCount->Fill(4.5);
1420  BisPileup=kTRUE;
1421  }
1422 
1423  // check vertex consistency
1424  const AliAODVertex* vtTrc = aod->GetPrimaryVertex();
1425  const AliAODVertex* vtSPD = aod->GetPrimaryVertexSPD();
1426 
1427  if (vtTrc->GetNContributors() < 2 || vtSPD->GetNContributors()<1) {
1428  fPileUpCount->Fill(5.5);
1429  BisPileup=kTRUE;
1430  }
1431 
1432  double covTrc[6], covSPD[6];
1433  vtTrc->GetCovarianceMatrix(covTrc);
1434  vtSPD->GetCovarianceMatrix(covSPD);
1435 
1436  double dz = vtTrc->GetZ() - vtSPD->GetZ();
1437 
1438  double errTot = TMath::Sqrt(covTrc[5]+covSPD[5]);
1439  double errTrc = TMath::Sqrt(covTrc[5]);
1440  double nsigTot = dz/errTot;
1441  double nsigTrc = dz/errTrc;
1442 
1443  if(TMath::Abs(dz)>0.2 || TMath::Abs(nsigTot)>10 || TMath::Abs(nsigTrc)>20) {
1444  fPileUpCount->Fill(6.5);
1445  BisPileup=kTRUE;
1446  }
1447 
1448  // cuts on tracks
1449  const Int_t nTracks = aod->GetNumberOfTracks();
1450  Int_t multEsd = ((AliAODHeader*)aod->GetHeader())->GetNumberOfESDTracks();
1451 
1452  Int_t multTrk = 0;
1453  Int_t multTrkBefC = 0;
1454  Int_t multTrkTOFBefC = 0;
1455  Int_t multTPC = 0;
1456 
1457  for(Int_t it = 0; it < nTracks; it++) {
1458  AliAODTrack* aodTrk = (AliAODTrack*)aod->GetTrack(it);
1459  if(!aodTrk) {
1460  delete aodTrk;
1461  continue;
1462  }
1463 // if(aodTrk->TestFilterBit(32)){
1464 // multTrkBefC++;
1465 // if(TMath::Abs(aodTrk->GetTOFsignalDz()) <= 10. && aodTrk->GetTOFsignal() >= 12000. && aodTrk->GetTOFsignal() <= 25000.)
1466 // multTrkTOFBefC++;
1467 // if((TMath::Abs(aodTrk->Eta()) < 0.8) && (aodTrk->GetTPCNcls() >= 70) && (aodTrk->Pt() >= 0.2) && (aodTrk->Pt() < 20.))
1468 // multTrk++;
1469 // }
1470  if(aodTrk->TestFilterBit(128))
1471  multTPC++;
1472  } // end of for (Int_t it = 0; it < nTracks; it++)
1473 
1474  Double_t multTPCn = multTPC;
1475  Double_t multEsdn = multEsd;
1476  Double_t multESDTPCDif = multEsdn - multTPCn*3.38;
1477 
1478  if(multESDTPCDif > (fRejectPileUpTight?700.:15000.)) {
1479  fPileUpCount->Fill(7.5);
1480  BisPileup=kTRUE;
1481  }
1482 
1483  if(fRejectPileUpTight) {
1484  if(BisPileup==kFALSE) {
1485  if(!fMultSelection->GetThisEventIsNotPileup()) BisPileup=kTRUE;
1486  if(!fMultSelection->GetThisEventIsNotPileupMV()) BisPileup=kTRUE;
1487  if(!fMultSelection->GetThisEventIsNotPileupInMultBins()) BisPileup=kTRUE;
1488  if(!fMultSelection->GetThisEventHasNoInconsistentVertices()) BisPileup=kTRUE;
1489  if(!fMultSelection->GetThisEventPassesTrackletVsCluster()) BisPileup=kTRUE;
1490  if(!fMultSelection->GetThisEventIsNotIncompleteDAQ()) BisPileup=kTRUE;
1491  if(!fMultSelection->GetThisEventHasGoodVertex2016()) BisPileup=kTRUE;
1492  if(BisPileup) fPileUpCount->Fill(8.5);
1493  }
1494  }
1495  }
1496  }
1497 
1498  //----------- pile up rejection done ---------
1499  if(BisPileup) {
1500  return;
1501  }
1502 
1503  fHist_Event_count->Fill(stepCount);
1504  stepCount++;
1505 
1506 
1507 
1508 
1509 
1510 
1511 
1512  if(runNumber!=fOldRunNum){ //if runNumber changed, re-read new list.
1513  fcheckOnce = 0;
1514  }
1515 
1516  if(!fcheckOnce && fAnalysisSet=="DoGainEq") {
1517  fHist_ChanWgt_ZDCC = (TH1F *) fListZDCWgt->FindObject(Form("fHist1F_ZDCC_ChannelWgt_Run%d",runNumber));
1518  fHist_ChanWgt_ZDCA = (TH1F *) fListZDCWgt->FindObject(Form("fHist1F_ZDCA_ChannelWgt_Run%d",runNumber));
1519 
1520  fcheckOnce++;
1521  fOldRunNum = runNumber;
1522  }
1523 
1524 
1525 
1526  /*
1527  if(!fcheckOnce && fAnalysisSet=="DoGainEq") {
1528  fHist_ChanWgt_ZDCC = (TH1F *) fListZDCWgt->FindObject(Form("fHist1F_ZDCC_ChannelWgt_Run%d",runNumber));
1529  fHist_ChanWgt_ZDCA = (TH1F *) fListZDCWgt->FindObject(Form("fHist1F_ZDCA_ChannelWgt_Run%d",runNumber));
1530 
1531  if(bApplyRecent) {
1532  if(!bRunAveragedQn) {
1533  if(fListZDCQxy) {
1534  for(int i=0; i<vzBin; i++) {
1535  fHist_Recenter_ZDCCx[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist2F_znCx_V0_Run%d_Vz%d",runNumber,i+1));
1536  fHist_Recenter_ZDCCy[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist2F_znCy_V0_Run%d_Vz%d",runNumber,i+1));
1537  fHist_Recenter_ZDCAx[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist2F_znAx_V0_Run%d_Vz%d",runNumber,i+1));
1538  fHist_Recenter_ZDCAy[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist2F_znAy_V0_Run%d_Vz%d",runNumber,i+1));
1539  }
1540  }
1541  }
1542  else {
1543  if(fListZDCQxy) {
1544  for(int i=0; i<vzBin; i++) {
1545  fHist_Recenter_ZDCCx[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist2F_znCx_V0_Run%d_Vz%d",0,i+1));
1546  fHist_Recenter_ZDCCy[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist2F_znCy_V0_Run%d_Vz%d",0,i+1));
1547  fHist_Recenter_ZDCAx[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist2F_znAx_V0_Run%d_Vz%d",0,i+1));
1548  fHist_Recenter_ZDCAy[i] = (TH2F *) fListZDCQxy->FindObject(Form("fHist2F_znAy_V0_Run%d_Vz%d",0,i+1));
1549  }
1550  }
1551  }
1552  }
1553 
1554  fcheckOnce++;
1555  fOldRunNum = runNumber;
1556  } */
1557 
1558 
1559 
1560 
1561  Double_t ChanWgtZDCC[5] = {1.,1.,1.,1.,1.};
1562  Double_t ChanWgtZDCA[5] = {1.,1.,1.,1.,1.};
1563 
1564  Int_t iCentBin = abs(EvtCent) + 1;
1565  Int_t iWgtBin = -1;
1566  Int_t iCommon = -1;
1567 
1568 
1569  if(fAnalysisSet=="DoGainEq") {
1571 
1572  for(int ich=1; ich<=5; ich++){
1573  iWgtBin = 5*(iCentBin-1) + ich;
1574  ChanWgtZDCC[ich-1] = fHist_ChanWgt_ZDCC->GetBinContent(iWgtBin);
1575  ChanWgtZDCA[ich-1] = fHist_ChanWgt_ZDCA->GetBinContent(iWgtBin);
1576  }
1577  }
1578  else{
1579  //printf("\n\n **WARNING**\n ZDC Channel Weights not found. Using weights = 1.0 \n\n");
1580  //exit(1);
1581  }
1582  }
1583 
1584 
1585 
1586  fHist_Cent_woZDCcut->Fill(EvtCent);
1587 
1588 
1589  //----------- Read ZDC information ----------
1590  AliAODZDC *aodZDC = aod->GetZDCData();
1591  Float_t fZDCGainAlpha = 0.500; // fZDCGainAlpha : Jacopo uses 0.35 ??
1592  Float_t energyZNC = (Float_t) (aodZDC->GetZNCEnergy());
1593  Float_t energyZPC = (Float_t) (aodZDC->GetZPCEnergy());
1594  Float_t energyZNA = (Float_t) (aodZDC->GetZNAEnergy());
1595  Float_t energyZPA = (Float_t) (aodZDC->GetZPAEnergy());
1596  Float_t energyZEM1 = (Float_t) (aodZDC->GetZEM1Energy());
1597  Float_t energyZEM2 = (Float_t) (aodZDC->GetZEM2Energy());
1598 
1599  const Double_t * towZNC = aodZDC->GetZNCTowerEnergy();
1600  const Double_t * towZPC = aodZDC->GetZPCTowerEnergy();
1601  const Double_t * towZNA = aodZDC->GetZNATowerEnergy();
1602  const Double_t * towZPA = aodZDC->GetZPATowerEnergy();
1603 
1604  const Double_t * towZNClg = aodZDC->GetZNCTowerEnergyLR(); // Low gain something, should not be used.
1605  const Double_t * towZNAlg = aodZDC->GetZNATowerEnergyLR();
1606 
1607  Double_t towZPClg[5] = {0.,};
1608  Double_t towZPAlg[5] = {0.,};
1609 
1610  for(Int_t it=0; it<5; it++) {
1611  towZPClg[it] = 8*towZPC[it];
1612  towZPAlg[it] = 8*towZNA[it];
1613  }
1614 
1615  Int_t BadChannel = 0;
1616 
1617  //sanity: remove if any of ZDC_C_A has negetive Energy:
1618  //This was a bad choice of cut. I need to see the Physics effect later..!!
1619  //if(towZNC[1]<0 || towZNC[2]<0 || towZNC[3]<0 || towZNC[4]<0) return;
1620 
1621  for(int i=0; i<4; i++) {
1622  if(towZNC[i] < 0) {
1623  BadChannel++;
1624  }
1625  }
1626 
1627  if(BadChannel>=2) return; // Remove Event if more than one channel has Energy < 0
1628 
1629  fHist_Event_count->Fill(stepCount);
1630  stepCount++;
1631 
1632  //if(towZNA[1]<0 || towZNA[2]<0 || towZNA[3]<0 || towZNA[4]<0) return;
1633  BadChannel = 0;
1634 
1635  for(int i=0; i<4; i++) {
1636  if(towZNA[i] < 0) {
1637  BadChannel++;
1638  }
1639  }
1640 
1641  if(BadChannel>=2) return;
1642 
1643  fHist_Event_count->Fill(stepCount);
1644  stepCount++;
1645 
1646 
1647 
1648 
1649 
1650 
1651 
1652 
1653 
1654 
1655 
1656 
1657 //********** Get centroid from ZDCs **************
1658 
1659  Double_t xyZNC[2]={0.,0.};
1660  Double_t xyZNA[2]={0.,0.};
1661 
1662  Float_t zncEnergy=0., znaEnergy=0.;
1663 
1664 
1665 
1666 /*-----------------------Not used---------------------------------
1667  Int_t CenBin = GetCenBin(centrperc);
1668  Double_t zvtxpos[3]={0.,0.,0.};
1669  fFlowEvent->GetVertexPosition(zvtxpos);
1670  Int_t RunNum=fFlowEvent->GetRun();
1671  if(fTowerEqList) {
1672  if(RunNum!=fCachedRunNum) {
1673  for(Int_t i=0; i<8; i++) {
1674  fTowerGainEq[i] = (TH1D*)(fTowerEqList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fhnTowerGainEqFactor[%d][%d]",RunNum,i)));
1675  }
1676  }
1677  }
1678  Bool_t fUseMCCen = kFALSE; //rihan:hardcoded
1679  if (fUseMCCen) {
1680  if(aod->GetRunNumber() < 209122)
1681  aodZDC->GetZNCentroidInPbPb(1380., xyZNC, xyZNA);
1682  else
1683  aodZDC->GetZNCentroidInPbPb(2510., xyZNC, xyZNA);
1684  }
1685  else {
1686  //set tower gain equalization, if available
1687  if(fTowerEqList) {
1688  for(Int_t i=0; i<8; i++)
1689  {
1690  if(fTowerGainEq[i])
1691  AvTowerGain[i] = fTowerGainEq[i]->GetBinContent(fTowerGainEq[i]->FindBin(centrperc));
1692  }
1693  }//--------------------------------------------------------------- */
1694 
1695 
1696 
1697  Double_t towCalibZNC[5] = {0,};
1698  Double_t towCalibZNA[5] = {0,};
1699 
1700  // towZNC[] is constant; so Need to make a copy
1701  for(int i=0;i<5;i++){
1702  towCalibZNC[i] = towZNC[i];
1703  towCalibZNA[i] = towZNA[i];
1704  }
1705 
1706  // If Ei < 0 , Ei = 0 (Maxim's idea)
1707  for(int i=1;i<5;i++){
1708  if(towCalibZNC[i] < 0) towCalibZNC[i] = 0;
1709  if(towCalibZNA[i] < 0) towCalibZNA[i] = 0;
1710  }
1711 
1712 
1713 
1714  Int_t indexVx = fHist_Vx_ArrayFinder->FindBin(Vxyz[0]);
1715  Int_t indexVy = fHist_Vy_ArrayFinder->FindBin(Vxyz[1]);
1716  Int_t indexVz = fHist_Vz_ArrayFinder->FindBin(Vxyz[2]);
1717 
1718 
1719  Double_t tVertexBin1 = 0;
1720  tVertexBin1 = (Double_t) (indexVy-1)*vxBin + (Double_t)indexVx - 0.5 ;
1721 
1722 
1723  if(fAnalysisSet=="FillGainEq") {
1724  fHist_Vx_vs_runnum->Fill(runindex,Vxyz[0]);
1725  fHist_Vy_vs_runnum->Fill(runindex,Vxyz[1]);
1726  fHist_Vz_vs_runnum->Fill(runindex,Vxyz[2]);
1727 
1728  fHist_ZDCC_En_CommonCh[indexVz-1]->Fill(EvtCent,tVertexBin1,towCalibZNC[0]);
1729  fHist_ZDCA_En_CommonCh[indexVz-1]->Fill(EvtCent,tVertexBin1,towCalibZNA[0]);
1730 
1731  for(int ich=0; ich<5; ich++) {
1732  fHist_ZDCC_En_Run[runindex]->Fill(EvtCent,ich,towCalibZNC[ich]);
1733  fHist_ZDCA_En_Run[runindex]->Fill(EvtCent,ich,towCalibZNA[ich]);
1734  }
1735  }
1736 
1737 
1738 
1739 
1740 
1741 
1742 
1743  // Now calibrate the energy of channel [0-4]:
1744  for(int i=0;i<5;i++){
1745  towCalibZNC[i] = ChanWgtZDCC[i]*towCalibZNC[i];
1746 
1747  if(ChanWgtZDCA[i] < 4.){
1748  towCalibZNA[i] = ChanWgtZDCA[i]*towCalibZNA[i];
1749  }
1750  }
1751 
1752  //manually get Energy in ZDC-A channel [2]:
1753  if(ChanWgtZDCA[2] >= 4.0){
1754  towCalibZNA[2] = towCalibZNA[0] - towCalibZNA[1] - towCalibZNA[3] - towCalibZNA[4];
1755  }
1756 
1757 
1758  for(Int_t i=0; i<5; i++){
1759  zncEnergy += towCalibZNC[i];
1760  znaEnergy += towCalibZNA[i];
1761  }
1762 
1763 
1764  Double_t AvTowerGain[8] = {1., 1., 1., 1., 1., 1., 1., 1.};
1765 
1766  const Float_t x[4] = {-1.75, 1.75,-1.75, 1.75};
1767  const Float_t y[4] = {-1.75, -1.75, 1.75, 1.75};
1768 
1769  Float_t numXZNC=0., numYZNC=0., denZNC=0., wZNC;
1770  Float_t numXZNA=0., numYZNA=0., denZNA=0., wZNA;
1771 
1772  for(Int_t i=0; i<4; i++) {
1773  if(towCalibZNC[i+1]>0.) {
1774  wZNC = TMath::Power(towCalibZNC[i+1], fZDCGainAlpha)*AvTowerGain[i];
1775  numXZNC += x[i]*wZNC;
1776  numYZNC += y[i]*wZNC;
1777  denZNC += wZNC;
1778  }
1779 
1780  if(towCalibZNA[i+1]>0.) {
1781  wZNA = TMath::Power(towCalibZNA[i+1], fZDCGainAlpha)*AvTowerGain[i+4];
1782  numXZNA += x[i]*wZNA;
1783  numYZNA += y[i]*wZNA;
1784  denZNA += wZNA;
1785  }
1786  }
1787 
1788  if(denZNC!=0) {
1789  xyZNC[0] = numXZNC/denZNC;
1790  xyZNC[1] = numYZNC/denZNC;
1791  }
1792  else{
1793  xyZNC[0] = 999.;
1794  xyZNC[1] = 999.;
1795  zncEnergy = 0.;
1796  }
1797  if(denZNA!=0) {
1798  xyZNA[0] = numXZNA/denZNA;
1799  xyZNA[1] = numYZNA/denZNA;
1800  }
1801  else{
1802  xyZNA[0] = 999.;
1803  xyZNA[1] = 999.;
1804  znaEnergy = 0.;
1805  }
1806 
1807 
1808 
1809  xyZNA[0] = -1.*xyZNA[0]; //----- Important: zdcA_X = -zdcA_X ---------
1810 
1811 
1812 
1813  if(sqrt(xyZNC[0]*xyZNC[0] + xyZNC[1]*xyZNC[1])>1.5) return;
1814 
1815  fHist_Event_count->Fill(stepCount);
1816  stepCount++;
1817 
1818  if(sqrt(xyZNA[0]*xyZNA[0] + xyZNA[1]*xyZNA[1])>1.5) return;
1819 
1820  fHist_Event_count->Fill(stepCount);
1821  stepCount++;
1822 
1823 
1824 
1825  Double_t psi1C = TMath::ATan2(xyZNC[1],xyZNC[0]);
1826  if(psi1C<0){
1827  psi1C += 2.*TMath::Pi();
1828  }
1829  Double_t psi1A = TMath::ATan2(xyZNA[1],xyZNA[0]);
1830  if(psi1A<0){
1831  psi1A += 2.*TMath::Pi();
1832  }
1833 
1834  /* if(EvtCent>=5 && EvtCent<=45) {
1835  fHist_Psi1_ZDCC_wGainCorr->Fill(psi1C);
1836  fHist_Psi1_ZDCA_wGainCorr->Fill(psi1A);
1837  }*/
1838 
1839  if(fAnalysisSet=="DoGainEq") {
1840 
1841  tVertexBin1 = (Double_t) (indexVy-1)*vxBin + (Double_t)indexVx - 0.5 ;
1842 
1843  if(!bApplyRecent) {
1844  if(bFillCosSin) {
1845  if(!bRunAveragedQn){
1846  fHist_znCx_V0_VxVy[runindex][indexVz-1]->Fill(tVertexBin1,EvtCent,TMath::Cos(psi1C));
1847  fHist_znCy_V0_VxVy[runindex][indexVz-1]->Fill(tVertexBin1,EvtCent,TMath::Sin(psi1C));
1848  fHist_znAx_V0_VxVy[runindex][indexVz-1]->Fill(tVertexBin1,EvtCent,TMath::Cos(psi1A));
1849  fHist_znAy_V0_VxVy[runindex][indexVz-1]->Fill(tVertexBin1,EvtCent,TMath::Sin(psi1A));
1850  }
1851  else{
1852  fHist_znCx_V0_VxVy[0][indexVz-1]->Fill(tVertexBin1,EvtCent,TMath::Cos(psi1C));
1853  fHist_znCy_V0_VxVy[0][indexVz-1]->Fill(tVertexBin1,EvtCent,TMath::Sin(psi1C));
1854  fHist_znAx_V0_VxVy[0][indexVz-1]->Fill(tVertexBin1,EvtCent,TMath::Cos(psi1A));
1855  fHist_znAy_V0_VxVy[0][indexVz-1]->Fill(tVertexBin1,EvtCent,TMath::Sin(psi1A));
1856  }
1857  }
1858  else{
1859  if(!bRunAveragedQn){
1860  fHist_znCx_V0_VxVy[runindex][indexVz-1]->Fill(tVertexBin1,EvtCent,xyZNC[0]);
1861  fHist_znCy_V0_VxVy[runindex][indexVz-1]->Fill(tVertexBin1,EvtCent,xyZNC[1]);
1862  fHist_znAx_V0_VxVy[runindex][indexVz-1]->Fill(tVertexBin1,EvtCent,xyZNA[0]);
1863  fHist_znAy_V0_VxVy[runindex][indexVz-1]->Fill(tVertexBin1,EvtCent,xyZNA[1]);
1864  }
1865  else{
1866  fHist_znCx_V0_VxVy[0][indexVz-1]->Fill(tVertexBin1,EvtCent,xyZNC[0]);
1867  fHist_znCy_V0_VxVy[0][indexVz-1]->Fill(tVertexBin1,EvtCent,xyZNC[1]);
1868  fHist_znAx_V0_VxVy[0][indexVz-1]->Fill(tVertexBin1,EvtCent,xyZNA[0]);
1869  fHist_znAy_V0_VxVy[0][indexVz-1]->Fill(tVertexBin1,EvtCent,xyZNA[1]);
1870  }
1871  }
1872  }
1873  }
1874 
1875 
1877 
1878  if(fAnalysisSet!="FillGainEq" && bFillCosSin) {
1879  xyZNC[0] = TMath::Cos(psi1C);
1880  xyZNC[1] = TMath::Sin(psi1C);
1881  xyZNA[0] = TMath::Cos(psi1A);
1882  xyZNA[1] = TMath::Sin(psi1A);
1883  }
1884 
1885 
1886 
1887  /* if(bFillZDCQAon){
1888 
1889  //Double_t FillVsWith[5] = {EvtCent,static_cast<Double_t>(nRefMult), Vxyz[0], Vxyz[1], Vxyz[2]};
1890  Double_t FillVsWith[5] = {EvtCent, fRefMult, Vxyz[0], Vxyz[1], Vxyz[2]};
1891  Double_t FillValueQx[4] = {xyZNA[0],xyZNC[0],xyZNA[1],xyZNC[1]};
1892  Double_t FillValueXX[4] = {xyZNA[0]*xyZNC[0],xyZNA[1]*xyZNC[1],xyZNC[0]*xyZNA[1],xyZNC[1]*xyZNA[0]}; //XaXc,YaYc,XcYa,YcXa
1893 
1894  for(int i=0;i<4;i++){
1895  for(int j=0;j<5;j++){
1896  if(j>0 && (EvtCent<5 || EvtCent>45)) continue;
1897  fHist_Qx_vs_Obs_woCorr[i][j]->Fill(FillVsWith[j],FillValueQx[i]);
1898  fHist_XX_vs_Obs_woCorr[i][j]->Fill(FillVsWith[j],FillValueXX[i]);
1899  }
1900  }
1901  } */
1902 
1903 
1904  if(fAnalysisSet=="FillGainEq" && bFillCosSin) {
1905  xyZNC[0] = TMath::Cos(psi1C);
1906  xyZNC[1] = TMath::Sin(psi1C);
1907  xyZNA[0] = TMath::Cos(psi1A);
1908  xyZNA[1] = TMath::Sin(psi1A);
1909  }
1910 
1911 
1912  Double_t meanCx = 0.;
1913  Double_t meanCy = 0.;
1914  Double_t meanAx = 0.;
1915  Double_t meanAy = 0.;
1916 
1917 
1918  //Apply the recentering:
1919  /*
1920  if(bApplyRecent) {
1921  Int_t tVertexBin2 = (indexVy-1)*vxBin + indexVx;
1922  if(fListZDCQxy) {
1923  meanCx = fHist_Recenter_ZDCCx[indexVz-1]->GetBinContent(tVertexBin2,iCentBin);
1924  meanCy = fHist_Recenter_ZDCCy[indexVz-1]->GetBinContent(tVertexBin2,iCentBin);
1925  meanAx = fHist_Recenter_ZDCAx[indexVz-1]->GetBinContent(tVertexBin2,iCentBin);
1926  meanAy = fHist_Recenter_ZDCAy[indexVz-1]->GetBinContent(tVertexBin2,iCentBin);
1927  }
1928  }
1929 
1930  xyZNC[0] = xyZNC[0] - meanCx;
1931  xyZNC[1] = xyZNC[1] - meanCy;
1932  xyZNA[0] = xyZNA[0] - meanAx;
1933  xyZNA[1] = xyZNA[1] - meanAy;
1934  */
1935 
1936  //use Jacopo's flowEvent ZDC Q-vectors:
1937 
1938  xyZNC[0] = vQarray[0].Px();
1939  xyZNC[1] = vQarray[0].Py();
1940  xyZNA[0] = vQarray[1].Px();
1941  xyZNA[1] = vQarray[1].Py();
1942 
1943  Double_t Qvect_ModC = TMath::Sqrt(xyZNC[0]*xyZNC[0] + xyZNC[1]*xyZNC[1]);
1944  Double_t Qvect_ModA = TMath::Sqrt(xyZNA[0]*xyZNA[0] + xyZNA[1]*xyZNA[1]);
1945 
1946  fHist_Event_count->Fill(stepCount);
1947  stepCount++;
1948 
1949  if(Qvect_ModC<1.e-6 || Qvect_ModA<1.e-6) return;
1950 
1951  fHist_Event_count->Fill(stepCount);
1952  stepCount++;
1953 
1954  Double_t Psi1C = TMath::ATan2(xyZNC[1],xyZNC[0]);
1955  if(Psi1C<0){
1956  Psi1C += 2.*TMath::Pi();
1957  }
1958  Double_t Psi1A = TMath::ATan2(xyZNA[1],xyZNA[0]);
1959  if(Psi1A<0){
1960  Psi1A += 2.*TMath::Pi();
1961  }
1962 
1963  Double_t PsiSumAC = Psi1C+Psi1A;
1964 
1965  if(PsiSumAC>2.*TMath::Pi()){
1966  PsiSumAC -= 2.*TMath::Pi();
1967  }
1968 
1969  /*
1970  if(TMath::Cos(Psi1C) < 1.e-5)
1971  fHist_ZeroQnXY_Conter->Fill(0.5);
1972  if(TMath::Sin(Psi1C) < 1.e-5)
1973  fHist_ZeroQnXY_Conter->Fill(2.5);
1974  if(TMath::Cos(Psi1A) < 1.e-5)
1975  fHist_ZeroQnXY_Conter->Fill(4.5);
1976  if(TMath::Sin(Psi1A) < 1.e-5)
1977  fHist_ZeroQnXY_Conter->Fill(6.5);
1978  if(TMath::Cos(Psi1C) < 1.e-5 && TMath::Sin(Psi1C) < 1.e-5)
1979  fHist_ZeroQnXY_Conter->Fill(8.5);
1980  if(TMath::Cos(Psi1A) < 1.e-5 && TMath::Sin(Psi1A) < 1.e-5)
1981  fHist_ZeroQnXY_Conter->Fill(10.5);
1982  if(TMath::Cos(Psi1C) < 1.e-5 && TMath::Sin(Psi1C) < 1.e-5 && TMath::Cos(Psi1A) < 1.e-5 && TMath::Sin(Psi1A) < 1.e-5)
1983  fHist_ZeroQnXY_Conter->Fill(12.5); */
1984 
1985 
1986  //Shift Histograms in Vxy binning:
1987  //if(!bCentCutShift){ }
1988  //else if(bCentCutShift && EvtCent>=0 && EvtCent< 60){
1989 
1990  if(bCentCutShift && EvtCent>=0 && EvtCent< 60){
1991  for(int i=0;i<4;i++){
1992  fHist_ZDCC_AvgCos_VsRun[i]->Fill(EvtCent,runindex,TMath::Cos((i+1)*Psi1C));
1993  fHist_ZDCA_AvgCos_VsRun[i]->Fill(EvtCent,runindex,TMath::Cos((i+1)*Psi1A));
1994  fHist_ZDCC_AvgSin_VsRun[i]->Fill(EvtCent,runindex,TMath::Sin((i+1)*Psi1C));
1995  fHist_ZDCA_AvgSin_VsRun[i]->Fill(EvtCent,runindex,TMath::Sin((i+1)*Psi1A));
1996 
1997  fHist_ZDC_AvgCosPsiSum_VsRun[i]->Fill(EvtCent,runindex,TMath::Cos((i+1)*(Psi1C+Psi1A)));
1998  fHist_ZDC_AvgSinPsiSum_VsRun[i]->Fill(EvtCent,runindex,TMath::Sin((i+1)*(Psi1C+Psi1A)));
1999  }
2000  }
2001 
2002 
2003  if(bFillZDCQAon){
2004 
2005  fHist_XXYY_vs_Cent_woCorr[0]->Fill(EvtCent, (xyZNA[0]*xyZNC[0] - xyZNA[1]*xyZNC[1]));
2006  fHist_XXYY_vs_Cent_woCorr[1]->Fill(EvtCent, (xyZNA[0]*xyZNC[1] + xyZNA[1]*xyZNC[0]));
2007 
2008  //Double_t FillVsWith[5] = {EvtCent,static_cast<Double_t>(nRefMult), Vxyz[0], Vxyz[1], Vxyz[2]};
2009  Double_t FillVsWith[5] = {EvtCent, fRefMult, Vxyz[0], Vxyz[1], Vxyz[2]};
2010  Double_t FillValueQx[4] = {xyZNA[0],xyZNC[0],xyZNA[1],xyZNC[1]};
2011  Double_t FillValueXX[4] = {xyZNA[0]*xyZNC[0],xyZNA[1]*xyZNC[1],xyZNC[0]*xyZNA[1],xyZNC[1]*xyZNA[0]}; //XaXc,YaYc,XcYa,YcXa
2012 
2013  Double_t FillValueQxTrig[4] = {TMath::Cos(Psi1A),TMath::Cos(Psi1C),TMath::Sin(Psi1A),TMath::Sin(Psi1C)};
2014  Double_t FillValueXXTrig[4] = {TMath::Cos(Psi1A)*TMath::Cos(Psi1C),TMath::Sin(Psi1A)*TMath::Sin(Psi1C),TMath::Cos(Psi1C)*TMath::Sin(Psi1A),TMath::Cos(Psi1A)*TMath::Sin(Psi1C)};
2015 
2016  for(int i=0;i<4;i++){
2017 
2018  fHist_Qx_Trig_woCorr[i]->Fill(EvtCent,FillValueQxTrig[i]);
2019  fHist_XX_Trig_woCorr[i]->Fill(EvtCent,FillValueXXTrig[i]);
2020 
2021  for(int j=0;j<5;j++){
2022  if(j>0 && (EvtCent<5 || EvtCent>45)) continue;
2023  fHist_Qx_vs_Obs_woCorr[i][j]->Fill(FillVsWith[j],FillValueQx[i]);
2024  fHist_XX_vs_Obs_woCorr[i][j]->Fill(FillVsWith[j],FillValueXX[i]);
2025  }
2026  }
2027  }
2028 
2029 
2030  if(!bCentCutShift){
2031  fHist_Psi1_ZDCC_wGainCorr->Fill(psi1C);
2032  fHist_Psi1_ZDCA_wGainCorr->Fill(psi1A);
2033  fHist_PsiSumAC_woCorr->Fill(PsiSumAC);
2034  }
2035  else if(bCentCutShift && EvtCent>=5 && EvtCent<=45){
2036  fHist_Psi1_ZDCC_wGainCorr->Fill(psi1C);
2037  fHist_Psi1_ZDCA_wGainCorr->Fill(psi1A);
2038  fHist_PsiSumAC_woCorr->Fill(PsiSumAC);
2039  }
2040 
2041  //----------- Apply Shift correction: ----------
2042  Double_t ShiftCosC[4] = {0.,};
2043  Double_t ShiftSinC[4] = {0.,};
2044 
2045  Double_t ShiftCosA[4] = {0.,};
2046  Double_t ShiftSinA[4] = {0.,};
2047 
2048  if(bApplyShiftCorr) {
2049  if(!bShiftCombinedEP) {
2050  //Run dependent Shift Correction:
2051  for(int i=0;i<4;i++) {
2052  ShiftCosC[i] = fHist_ZDCC_AvgCosNPsi[i]->GetBinContent(iCentBin,runindex+1);
2053  ShiftSinC[i] = fHist_ZDCC_AvgSinNPsi[i]->GetBinContent(iCentBin,runindex+1);
2054  ShiftCosA[i] = fHist_ZDCA_AvgCosNPsi[i]->GetBinContent(iCentBin,runindex+1);
2055  ShiftSinA[i] = fHist_ZDCA_AvgSinNPsi[i]->GetBinContent(iCentBin,runindex+1);
2056  }
2057  }
2058  else if(bShiftCombinedEP) {
2059  for(int i=0;i<4;i++) {
2060  ShiftCosC[i] = fHist_ZDC_AvgCosNPsiAC[i]->GetBinContent(iCentBin,runindex+1);
2061  ShiftSinC[i] = fHist_ZDC_AvgSinNPsiAC[i]->GetBinContent(iCentBin,runindex+1);
2062  }
2063  }
2064  }
2065 
2066  Double_t shiftPsiC = 0;
2067  Double_t shiftPsiA = 0;
2068 
2069  PsiSumAC = Psi1C+Psi1A;
2070 
2071  if(bApplyShiftCorr) {
2072  if(!bShiftCombinedEP) {
2073  for(int i=0;i<4;i++) {
2074  shiftPsiC += 2.0/(i+1)*(-1.0*ShiftSinC[i]*TMath::Cos((i+1)*Psi1C) + ShiftCosC[i]*TMath::Sin((i+1)*Psi1C));
2075  shiftPsiA += 2.0/(i+1)*(-1.0*ShiftSinA[i]*TMath::Cos((i+1)*Psi1A) + ShiftCosA[i]*TMath::Sin((i+1)*Psi1A));
2076  }
2077  Psi1C += shiftPsiC;
2078  Psi1A += shiftPsiA;
2079  }
2080  else if(bShiftCombinedEP) {
2081  shiftPsiC = 0;
2082  for(int i=0;i<4;i++) {
2083  shiftPsiC += 2.0/(i+1)*(-1.0*ShiftSinC[i]*TMath::Cos((i+1)*PsiSumAC) + ShiftCosC[i]*TMath::Sin((i+1)*PsiSumAC));
2084  }
2085  PsiSumAC += shiftPsiC;
2086  }
2087  }
2088 
2089 
2090 
2091 
2092  if(Psi1C<0){
2093  Psi1C += 2.*TMath::Pi();
2094  }
2095  if(Psi1A<0){
2096  Psi1A += 2.*TMath::Pi();
2097  }
2098  if(PsiSumAC<0){
2099  PsiSumAC += 2.*TMath::Pi();
2100  }
2101  else if(PsiSumAC>2.*TMath::Pi()){
2102  PsiSumAC -= 2.*TMath::Pi();
2103  }
2104 
2105 
2106  /*
2107  if(TMath::Cos(Psi1C) < 1.e-5)
2108  fHist_ZeroQnXY_Conter->Fill(1.5);
2109  if(TMath::Sin(Psi1C) < 1.e-5)
2110  fHist_ZeroQnXY_Conter->Fill(3.5);
2111  if(TMath::Cos(Psi1A) < 1.e-5)
2112  fHist_ZeroQnXY_Conter->Fill(5.5);
2113  if(TMath::Sin(Psi1A) < 1.e-5)
2114  fHist_ZeroQnXY_Conter->Fill(7.5);
2115  if(TMath::Cos(Psi1C) < 1.e-5 && TMath::Sin(Psi1C) < 1.e-5)
2116  fHist_ZeroQnXY_Conter->Fill(9.5);
2117  if(TMath::Cos(Psi1A) < 1.e-5 && TMath::Sin(Psi1A) < 1.e-5)
2118  fHist_ZeroQnXY_Conter->Fill(11.5);
2119  if(TMath::Cos(Psi1C) < 1.e-5 && TMath::Sin(Psi1C) < 1.e-5 && TMath::Cos(Psi1A) < 1.e-5 && TMath::Sin(Psi1A) < 1.e-5){
2120  fHist_ZeroQnXY_Conter->Fill(13.5);
2121  return;
2122  } */
2123 
2124  //if(TMath::Sin(Psi1A) < 1.e-5 && TMath::Sin(Psi1C) < 1.e-5) return;
2125 
2126 
2127 
2128 
2129  //reconstruct the new ZDC-Qvect (with original Modulas).
2130  if(!bUseTrigonQn){
2131  xyZNC[0] = Qvect_ModC*TMath::Cos(Psi1C);
2132  xyZNC[1] = Qvect_ModC*TMath::Sin(Psi1C);
2133  xyZNA[0] = Qvect_ModA*TMath::Cos(Psi1A);
2134  xyZNA[1] = Qvect_ModA*TMath::Sin(Psi1A);
2135  //fill Qn Recentering histograms:
2136  fHist_ZDCC_AvgQx_VsRun->Fill(EvtCent,runindex,xyZNC[0]);
2137  fHist_ZDCC_AvgQy_VsRun->Fill(EvtCent,runindex,xyZNC[1]);
2138  fHist_ZDCA_AvgQx_VsRun->Fill(EvtCent,runindex,xyZNA[0]);
2139  fHist_ZDCA_AvgQy_VsRun->Fill(EvtCent,runindex,xyZNA[1]);
2140  fHist_ZDC_AvgXXminusYY_VsRun->Fill(EvtCent,runindex,(xyZNC[0]*xyZNA[0] - xyZNC[1]*xyZNA[1]));
2141  fHist_ZDC_AvgXYplusXY_VsRun->Fill (EvtCent,runindex,(xyZNC[1]*xyZNA[0] + xyZNC[0]*xyZNA[1]));
2142  }
2143  else if(bUseTrigonQn){//reconstruct the new ZDC-Qvect with Qn:[-1,1]
2144  xyZNC[0] = TMath::Cos(Psi1C);
2145  xyZNC[1] = TMath::Sin(Psi1C);
2146  xyZNA[0] = TMath::Cos(Psi1A);
2147  xyZNA[1] = TMath::Sin(Psi1A);
2148 
2149  fHist_ZDCC_AvgQx_VsRun->Fill(EvtCent,runindex,xyZNC[0]);
2150  fHist_ZDCC_AvgQy_VsRun->Fill(EvtCent,runindex,xyZNC[1]);
2151  fHist_ZDCA_AvgQx_VsRun->Fill(EvtCent,runindex,xyZNA[0]);
2152  fHist_ZDCA_AvgQy_VsRun->Fill(EvtCent,runindex,xyZNA[1]);
2153  fHist_ZDC_AvgXXminusYY_VsRun->Fill(EvtCent,runindex,(xyZNC[0]*xyZNA[0] - xyZNC[1]*xyZNA[1]));
2154  fHist_ZDC_AvgXYplusXY_VsRun->Fill (EvtCent,runindex,(xyZNC[1]*xyZNA[0] + xyZNC[0]*xyZNA[1]));
2155  }
2156 
2157 
2158  //do recentering after shift:
2159 
2160  if(bApplyShiftCorr) {
2161  xyZNC[0] -= fHist_ZDCC_AvgQx_VsCR->GetBinContent(iCentBin,runindex+1);
2162  xyZNC[1] -= fHist_ZDCC_AvgQy_VsCR->GetBinContent(iCentBin,runindex+1);
2163  xyZNA[0] -= fHist_ZDCA_AvgQx_VsCR->GetBinContent(iCentBin,runindex+1);
2164  xyZNA[1] -= fHist_ZDCA_AvgQy_VsCR->GetBinContent(iCentBin,runindex+1);
2165  }
2166 
2167 
2168 
2169 
2170  if(bFillZDCQAon){
2171 
2172  fHist_XXYY_vs_Cent_wiCorr[0]->Fill(EvtCent, xyZNC[0]*xyZNA[0] - xyZNC[1]*xyZNA[1]);
2173  fHist_XXYY_vs_Cent_wiCorr[1]->Fill(EvtCent, xyZNC[1]*xyZNA[0] + xyZNC[0]*xyZNA[1]);
2174 
2175  Double_t FillVsWithNew[5] = {EvtCent, fRefMult, Vxyz[0], Vxyz[1], Vxyz[2]};
2176  Double_t FillValueQxNew[4] = {xyZNA[0],xyZNC[0],xyZNA[1],xyZNC[1]};
2177  Double_t FillValueXXNew[4] = {xyZNA[0]*xyZNC[0],xyZNA[1]*xyZNC[1],xyZNC[0]*xyZNA[1],xyZNC[1]*xyZNA[0]}; //XaXc,YaYc,XcYa,YcXa
2178 
2179  Double_t FillValueQxTrigNew[4] = {TMath::Cos(Psi1A),TMath::Cos(Psi1C),TMath::Sin(Psi1A),TMath::Sin(Psi1C)};
2180  Double_t FillValueXXTrigNew[4] = {TMath::Cos(Psi1A)*TMath::Cos(Psi1C),TMath::Sin(Psi1A)*TMath::Sin(Psi1C),TMath::Cos(Psi1C)*TMath::Sin(Psi1A),TMath::Cos(Psi1A)*TMath::Sin(Psi1C)};
2181 
2182  for(int i=0;i<4;i++){
2183  if(EvtCent>=5 && EvtCent<=45){
2184  fHist_Qx_wiCorr_RunByRun[i]->Fill(runindex,FillValueQxNew[i]);
2185  }
2186 
2187  fHist_Qx_Trig_wiCorr[i]->Fill(EvtCent,FillValueQxTrigNew[i]);
2188  fHist_XX_Trig_wiCorr[i]->Fill(EvtCent,FillValueXXTrigNew[i]);
2189 
2190  for(int j=0;j<5;j++){
2191  if(j>0 && (EvtCent<5 || EvtCent>45)) continue;
2192  fHist_Qx_vs_Obs_wiCorr[i][j]->Fill(FillVsWithNew[j],FillValueQxNew[i]);
2193  fHist_XX_vs_Obs_wiCorr[i][j]->Fill(FillVsWithNew[j],FillValueXXNew[i]);
2194  }
2195  }
2196  }
2197 
2198 
2199 
2200 
2201  Int_t iTracks = fEvent->NumberOfTracks();
2202  AliFlowTrackSimple* pTrack = NULL;
2203  Double_t Qnx_TPC[4] = {0,};
2204  Double_t Qny_TPC[4] = {0,};
2205  Double_t psi2,dPhi,dPt,dEta;
2206  Double_t pTwgt = 1.0;
2207  Double_t npoiMult = 0;
2208  Double_t dUx = 0;
2209  Double_t dUy = 0;
2210  Int_t ipTBin = 1;
2211  Int_t cIndex = -1;
2212  Double_t nRefMult = 0;
2213 
2214  if(EvtCent<5.0) { cIndex = 0; }
2215  else if(EvtCent>=5.0 && EvtCent<10){
2216  cIndex = 1;
2217  }
2218  else{
2219  cIndex = abs(EvtCent/10.0) + 1;
2220  }
2221 
2222  //Use Jacopo's notation:
2223  Double_t Qtot, QRe, QIm;
2224  Double_t ZARe = xyZNA[0];
2225  Double_t ZAIm = xyZNA[1];
2226  Double_t ZCRe = xyZNC[0];
2227  Double_t ZCIm = xyZNC[1];
2228 
2229 
2230  Double_t fullTerm = 0;
2231  Double_t fullReso = 0;
2232  Double_t CentWgt = 1.0;
2233 
2234  if(bApplyRecent && bApplyShiftCorr) {
2235  for(int i=0; i<iTracks; i++) {
2236  pTrack = fEvent->GetTrack(i);
2237  if(!pTrack) continue;
2238  dPhi = pTrack->Phi();
2239  dPt = pTrack-> Pt();
2240  dEta = pTrack->Eta();
2241  //dChrg = pTrack->Charge();
2242  if(fabs(dEta) > 0.8) continue;
2243  if(dPt<0.20 || dPt>50.0) continue;
2244  if(!pTrack->IsPOItype(1)) continue;
2245  nRefMult++;
2246 
2247  ipTBin = fFB_Efficiency_Cent[cIndex]->FindBin(dPt);
2248  pTwgt = 1.0/fFB_Efficiency_Cent[cIndex]->GetBinContent(ipTBin);
2249 
2250  dUx = cos(dPhi);
2251  dUy = sin(dPhi);
2252  Qnx_TPC[0] += dUx*pTwgt;
2253  Qny_TPC[0] += dUy*pTwgt;
2254 
2255 
2256  fHist_v1xV1_ZDN_EtaDiff[0][cIndex]->Fill(dEta, dUx*xyZNC[0], pTwgt); //uxCx
2257  fHist_v1xV1_ZDN_EtaDiff[1][cIndex]->Fill(dEta, dUy*xyZNC[1], pTwgt); //uyCy
2258  fHist_v1xV1_ZDN_EtaDiff[2][cIndex]->Fill(dEta, dUx*xyZNA[0], pTwgt); //uxAx
2259  fHist_v1xV1_ZDN_EtaDiff[3][cIndex]->Fill(dEta, dUy*xyZNA[1], pTwgt); //uyAy
2260  fHist_v1xV1_ZDN_pTDiff[0][cIndex]->Fill(dPt, dUx*xyZNC[0], pTwgt); //uxCx
2261  fHist_v1xV1_ZDN_pTDiff[1][cIndex]->Fill(dPt, dUy*xyZNC[1], pTwgt); //uyCy
2262  fHist_v1xV1_ZDN_pTDiff[2][cIndex]->Fill(dPt, dUx*xyZNA[0], pTwgt); //uxAx
2263  fHist_v1xV1_ZDN_pTDiff[3][cIndex]->Fill(dPt, dUy*xyZNA[1], pTwgt); //uyAy
2264 
2265 
2266  dUx = cos(2.*dPhi);
2267  dUy = sin(2.*dPhi);
2268  Qnx_TPC[1] += dUx*pTwgt;
2269  Qny_TPC[1] += dUy*pTwgt;
2270 
2271  if(cIndex<6){
2272  fullTerm = dUx*(xyZNA[0]*xyZNC[0] - xyZNA[1]*xyZNC[1]) + dUy*(xyZNA[0]*xyZNC[1] + xyZNA[1]*xyZNC[0]);
2273  fHist_v2xV1_ZDN_pTDiff_All[cIndex]->Fill(dPt,fullTerm,pTwgt);
2274  }
2275 
2276 
2277  QRe = cos(3.*dPhi);
2278  QIm = sin(3.*dPhi);
2279  Qnx_TPC[2] += QRe*pTwgt;
2280  Qny_TPC[2] += QIm*pTwgt;
2281 
2282  if(cIndex<6){
2283  Qtot = QRe*(ZARe*ZARe*ZCRe-2.*ZARe*ZAIm*ZCIm-ZCRe*ZAIm*ZAIm) + QIm*(-ZAIm*ZAIm*ZCIm+2.*ZAIm*ZARe*ZCRe+ZCIm*ZARe*ZARe);
2284  fHist_v3xV1_ZDN_EtaDiff_Comb1[cIndex]->Fill(dEta,Qtot,pTwgt);
2285  Qtot = QRe*(ZCRe*ZCRe*ZARe-2.*ZCRe*ZCIm*ZAIm-ZARe*ZCIm*ZCIm) + QIm*(-ZCIm*ZCIm*ZAIm+2.*ZCIm*ZCRe*ZARe+ZAIm*ZCRe*ZCRe);
2286  fHist_v3xV1_ZDN_EtaDiff_Comb2[cIndex]->Fill(dEta,Qtot,pTwgt);
2287  }
2288 
2289 
2290  QRe = cos(4.*dPhi);
2291  QIm = sin(4.*dPhi);
2292  Qnx_TPC[3] += QRe*pTwgt;
2293  Qny_TPC[3] += QIm*pTwgt;
2294 
2295  if(cIndex<6){
2296  Qtot = QRe*((ZARe*ZARe-ZAIm*ZAIm)*(ZCRe*ZCRe-ZCIm*ZCIm)-(ZAIm*ZARe+ZARe*ZAIm)*(ZCIm*ZCRe+ZCRe*ZCIm)) + QIm*((ZAIm*ZARe+ZARe*ZAIm)*(ZCRe*ZCRe-ZCIm*ZCIm)+(ZCIm*ZCRe+ZCRe*ZCIm)*(ZARe*ZARe-ZAIm*ZAIm));
2297  fHist_v4xV1_ZDN_pTDiff_All[cIndex]->Fill(dPt,Qtot,pTwgt);
2298  }
2299 
2300  //cout<<"i = "<<i<<" iCentBin = "<<cIndex<<" pTBin "<<ipTBin<<" pt = "<<dPt<<"\t wgt = "<<pTwgt<<endl;
2301  npoiMult += pTwgt;
2302  }
2303  }
2304 
2305 
2306 
2307  if(npoiMult>0){
2308  for(int i=0;i<4;i++){
2309  Qnx_TPC[i] = Qnx_TPC[i]/npoiMult;
2310  Qny_TPC[i] = Qny_TPC[i]/npoiMult;
2311  }
2312  }
2313  else{
2314  for(int i=0;i<4;i++){
2315  Qnx_TPC[i] = 0;
2316  Qny_TPC[i] = 0;
2317  }
2318  }
2319 
2320  fullTerm = 0;
2321  fullReso = 0;
2322 
2323  if(bApplyRecent && bApplyShiftCorr) {
2324 
2325  if(EvtCent>=5 && EvtCent<=45) {
2326  fHist_Psi1_ZDCC_wRectCorr->Fill(Psi1C);
2327  fHist_Psi1_ZDCA_wRectCorr->Fill(Psi1A);
2328 
2329  fHist_PsiSumAC_wiCorr->Fill(PsiSumAC);
2330  fHist_Psi1_ZDCC_RunByRun->Fill(runindex,Psi1C);
2331  fHist_Psi1_ZDCA_RunByRun->Fill(runindex,Psi1A);
2332  }
2333 
2334  fHist_Psi1_ZDCC_wCorrFull->Fill(Psi1C);
2335  fHist_Psi1_ZDCA_wCorrFull->Fill(Psi1A);
2336 
2337  CentWgt = fWeight_Cent->GetBinContent(iCentBin);
2338 
2339  fHist_ZDN_resol_Norm_Sep[0]->Fill(EvtCent, xyZNA[0]*xyZNC[0]);
2340  fHist_ZDN_resol_Cent_Sep[0]->Fill(EvtCent, xyZNA[0]*xyZNC[0]);
2341 
2342  fHist_ZDN_resol_Norm_Sep[1]->Fill(EvtCent, xyZNA[1]*xyZNC[1]);
2343  fHist_ZDN_resol_Cent_Sep[1]->Fill(EvtCent, xyZNA[1]*xyZNC[1]);
2344 
2345  Double_t v1FillTerms[4] = {Qnx_TPC[0]*xyZNC[0], Qny_TPC[0]*xyZNC[1], Qnx_TPC[0]*xyZNA[0], Qny_TPC[0]*xyZNA[1]};
2346 
2347 
2348  for(int i=0; i<4; i++){
2349  fHist_v2xV1_ZDN_Norm_Sep[i]->Fill(EvtCent, v1FillTerms[i]);
2350  fHist_v2xV1_ZDN_Cent_Sep[i]->Fill(EvtCent, v1FillTerms[i]);
2351  }
2352 
2353 
2354  fullTerm = Qnx_TPC[1]*(xyZNA[0]*xyZNC[0] - xyZNA[1]*xyZNC[1]) + Qny_TPC[1]*(xyZNA[0]*xyZNC[1] + xyZNA[1]*xyZNC[0]);
2355  fullReso = xyZNA[0]*xyZNC[0] + xyZNA[1]*xyZNC[1];
2356 
2357  fHist_v2xV1_ZDN_Norm_All->Fill( EvtCent, fullTerm, CentWgt);
2358  fHist_v2xV1_ZDN_Cent_All->Fill( EvtCent, fullTerm, CentWgt);
2359  fHist_v2xV1_ZDN_Refm_All->Fill(nRefMult, fullTerm, CentWgt);
2360 
2361  fHist_ZDN_resol_Norm_All->Fill( EvtCent, fullReso, CentWgt);
2362  fHist_ZDN_resol_Cent_All->Fill( EvtCent, fullReso, CentWgt);
2363  fHist_ZDN_resol_Refm_All->Fill(nRefMult, fullReso, CentWgt);
2364 
2365  fHist_ZDN_resol_Norm_XX->Fill( EvtCent, xyZNA[0]*xyZNC[0], CentWgt);
2366  fHist_ZDN_resol_Cent_XX->Fill( EvtCent, xyZNA[0]*xyZNC[0], CentWgt);
2367  fHist_ZDN_resol_Norm_YY->Fill( EvtCent, xyZNA[1]*xyZNC[1], CentWgt);
2368  fHist_ZDN_resol_Cent_YY->Fill( EvtCent, xyZNA[1]*xyZNC[1], CentWgt);
2369 
2370 
2371  QRe = Qnx_TPC[2];
2372  QIm = Qny_TPC[2];
2373  //integrated v3:
2374  Qtot = QRe*(ZARe*ZARe*ZCRe-2.*ZARe*ZAIm*ZCIm-ZCRe*ZAIm*ZAIm) + QIm*(-ZAIm*ZAIm*ZCIm+2.*ZAIm*ZARe*ZCRe+ZCIm*ZARe*ZARe);
2375  fHist_v3xV1_ZDN_Norm_Comb1->Fill( EvtCent, Qtot, CentWgt);
2376  fHist_v3xV1_ZDN_Cent_Comb1->Fill( EvtCent, Qtot, CentWgt);
2377 
2378  Qtot = QRe*(ZCRe*ZCRe*ZARe-2.*ZCRe*ZCIm*ZAIm-ZARe*ZCIm*ZCIm) + QIm*(-ZCIm*ZCIm*ZAIm+2.*ZCIm*ZCRe*ZARe+ZAIm*ZCRe*ZCRe);
2379  fHist_v3xV1_ZDN_Norm_Comb2->Fill( EvtCent, Qtot, CentWgt);
2380  fHist_v3xV1_ZDN_Cent_Comb2->Fill( EvtCent, Qtot, CentWgt);
2381 
2382 
2383  QRe = Qnx_TPC[3];
2384  QIm = Qny_TPC[3];
2385  //integrated v4:
2386  Qtot = QRe*((ZARe*ZARe-ZAIm*ZAIm)*(ZCRe*ZCRe-ZCIm*ZCIm)-(ZAIm*ZARe+ZARe*ZAIm)*(ZCIm*ZCRe+ZCRe*ZCIm))
2387  + QIm*((ZAIm*ZARe+ZARe*ZAIm)*(ZCRe*ZCRe-ZCIm*ZCIm)+(ZCIm*ZCRe+ZCRe*ZCIm)*(ZARe*ZARe-ZAIm*ZAIm));
2388  fHist_v4xV1_ZDN_Norm_Comb1->Fill( EvtCent, Qtot, CentWgt);
2389  fHist_v4xV1_ZDN_Cent_Comb1->Fill( EvtCent, Qtot, CentWgt);
2390 
2391  }
2392 
2393 
2394 
2395 
2396  fHist_Event_count->Fill(stepCount);
2397  stepCount++;
2398 
2399 
2400  fHist_Cent_wiZDCcut->Fill(EvtCent);
2401 
2402 
2403 
2404  //if(fievent%20==0) {
2405  //std::cout<<fievent<<" cTPC= "<<EvtCent<<"\t wZDA1 = "<<ChanWgtZDCA[1]<<"\t wZDA2 = "<<ChanWgtZDCA[2]<<"\tRefMult = "<<nRefMult<<std::endl;
2406  //std::cout<<"C0 = "<<ShiftCosC[0]<<"\t C3 = "<<ShiftCosC[3]<<"\t A0 = "<<ShiftCosA[0]<<"\t A3 = "<<ShiftCosA[3]<<std::endl;
2407  //}
2408 
2409 
2410  PostData(1,fListHistos);
2411 
2412  if(!bApplyRecent && fAnalysisSet=="DoGainEq") {
2413  PostData(2,fListZDCQxy);
2414  }
2415  else{
2416  PostData(2,fListDummy1); //default if no 'fAnalysisSet' found.
2417  }
2418 
2419 
2420  fievent++;
2421 
2422  //printf("\n ... ::UserExec() is being called. Step last %d... Event %d \n",stepCount,fievent);
2423 
2424 }// UserExec ends
2425 
2426 
2427 
2428 
2430 {
2431  AliDebug(2,"\n ... AliAnalysisTaskZDCGainEq::Terminate() is being called ... \n");
2432 }
2433 
2434 
2435 double AliAnalysisTaskZDCGainEq::GetWDist(const AliVVertex* v0, const AliVVertex* v1)
2436 {
2437  // calculate sqrt of weighted distance to other vertex
2438  if (!v0 || !v1) {
2439  AliDebug(2,"\n\n ::GetWDist => One of vertices is not valid\n\n");
2440  return 0;
2441  }
2442  static TMatrixDSym vVb(3);
2443  double dist = -1;
2444  double dx = v0->GetX()-v1->GetX();
2445  double dy = v0->GetY()-v1->GetY();
2446  double dz = v0->GetZ()-v1->GetZ();
2447  double cov0[6],cov1[6];
2448  v0->GetCovarianceMatrix(cov0);
2449  v1->GetCovarianceMatrix(cov1);
2450  vVb(0,0) = cov0[0]+cov1[0];
2451  vVb(1,1) = cov0[2]+cov1[2];
2452  vVb(2,2) = cov0[5]+cov1[5];
2453  vVb(1,0) = vVb(0,1) = cov0[1]+cov1[1];
2454  vVb(0,2) = vVb(1,2) = vVb(2,0) = vVb(2,1) = 0.;
2455  vVb.InvertFast();
2456  if (!vVb.IsValid()) {
2457  AliDebug(2,"Singular Matrix\n");
2458  return dist;
2459  }
2460  dist = vVb(0,0)*dx*dx + vVb(1,1)*dy*dy + vVb(2,2)*dz*dz
2461  + 2*vVb(0,1)*dx*dy + 2*vVb(0,2)*dx*dz + 2*vVb(1,2)*dy*dz;
2462  return dist>0 ? TMath::Sqrt(dist) : -1;
2463 }
2464 
2466  { // check for multi-vertexer pile-up
2467  const int kMinPlpContrib = 5;
2468  const double kMaxPlpChi2 = 5.0;
2469  const double kMinWDist = 15;
2470 
2471  const AliVVertex* vtPrm = 0;
2472  const AliVVertex* vtPlp = 0;
2473 
2474  int nPlp = 0;
2475 
2476  if(!(nPlp=aod->GetNumberOfPileupVerticesTracks()))
2477  return kFALSE;
2478 
2479  vtPrm = aod->GetPrimaryVertex();
2480  if(vtPrm == aod->GetPrimaryVertexSPD())
2481  return kTRUE; // there are pile-up vertices but no primary
2482 
2483  //int bcPrim = vtPrm->GetBC();
2484 
2485  for(int ipl=0;ipl<nPlp;ipl++) {
2486  vtPlp = (const AliVVertex*)aod->GetPileupVertexTracks(ipl);
2487  if (vtPlp->GetNContributors() < kMinPlpContrib) continue;
2488  if (vtPlp->GetChi2perNDF() > kMaxPlpChi2) continue;
2489  //int bcPlp = vtPlp->GetBC();
2490  //if (bcPlp!=AliVTrack::kTOFBCNA && TMath::Abs(bcPlp-bcPrim)>2)
2491  // return kTRUE; // pile-up from other BC
2492 
2493  double wDst = GetWDist(vtPrm,vtPlp);
2494  if (wDst<kMinWDist) continue;
2495 
2496  return kTRUE; // pile-up: well separated vertices
2497  }
2498 
2499  return kFALSE;
2500  }
2501 
2502 
2503 
2504 
virtual void UserExec(Option_t *option)
double Double_t
Definition: External.C:58
Definition: External.C:236
virtual void Terminate(Option_t *)
AliFlowTrackSimple * GetTrack(Int_t i)
AliMultSelection * fMultSelection
input event
double GetWDist(const AliVVertex *v0, const AliVVertex *v1)
TProfile * fHist_v1xV1_ZDN_pTDiff[4][10]
TProfile2D * fHist_znAy_V0_VxVy[90][10]
TProfile2D * fHist_ZDC_AvgCosPsiSum_VsRun[4]
Double_t Phi() const
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
TProfile2D * fHist_znAx_V0_VxVy[90][10]
Definition: External.C:212
Bool_t plpMV(const AliAODEvent *aod)
Double_t GetCentrality() const
TProfile2D * fHist_ZDC_AvgSinPsiSum_VsRun[4]
Int_t GetReferenceMultiplicity() const
virtual void GetZDC2Qsub(AliFlowVector *Qarray)
TList * fListZDCQxy
collection of output
TProfile * fHist_v1xV1_ZDN_EtaDiff[4][10]
Bool_t IsPOItype(Int_t poiType) const
const char Option_t
Definition: External.C:48
Double_t Eta() const
bool Bool_t
Definition: External.C:53
TProfile2D * fHist_znCy_V0_VxVy[90][10]
ClassImp(AliAnalysisTaskZDCGainEq) AliAnalysisTaskZDCGainEq
TProfile2D * fHist_znCx_V0_VxVy[90][10]
Int_t NumberOfTracks() const