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