AliPhysics  d565ceb (d565ceb)
AliAnalysisTaskZDCEP.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 
16 /***********************************
17 * ZDC Event Plane *
18 * *
19 * author: Jacopo Margutti *
20 * email: jacopo.margutti@cern.ch *
21 ***********************************/
22 
23 #define AliAnalysisTaskZDCEP_cxx
24 
25 #include "Riostream.h"
26 #include "AliFlowCommonConstants.h"
27 #include "AliFlowCommonHist.h"
29 #include "TChain.h"
30 
31 #include "TFile.h"
32 #include "TList.h"
33 #include "TGraph.h"
34 #include "TParticle.h"
35 #include "TRandom3.h"
36 #include "TStyle.h"
37 #include "TProfile.h"
38 #include "TProfile2D.h"
39 #include "TMath.h"
40 #include "TArrow.h"
41 #include "TPaveLabel.h"
42 #include "TCanvas.h"
43 #include "TVector2.h"
44 #include "AliFlowEventSimple.h"
45 #include "AliFlowVector.h"
46 #include "AliFlowTrackSimple.h"
47 #include "AliFlowAnalysisCRC.h"
48 #include "TRandom.h"
49 #include "TF1.h"
50 #include "TNtuple.h"
51 #include "THnSparse.h"
52 #include "AliAnalysisTaskZDCEP.h"
53 #include "AliAODTrack.h"
54 #include "AliAODEvent.h"
55 #include "AliAODZDC.h"
56 #include "TProfile2D.h"
57 #include "TProfile3D.h"
58 #include "AliFlowEvent.h"
59 
60 class TH1;
61 class TH2;
62 class TGraph;
63 class TPave;
64 class TLatex;
65 class TMarker;
66 class TRandom3;
67 class TObjArray;
68 class TList;
69 class TCanvas;
70 class TSystem;
71 class TROOT;
72 class TVector2;
73 class AliFlowVector;
74 
77 fOutputList(0x0),
78 fHistList(0x0),
79 fQAList(0x0),
80 fZDCGainAlpha(0.395),
81 fZDCCalibList(0x0),
82 fTowerEqList(0x0),
83 fQAListMagPol(0x0),
84 fEventCounter(NULL),
85 fCentralityHisto(NULL),
86 fCachedRunNum(0),
87 fnRun(0),
88 fDataSet(k2015o_pass1_pass1pidfix),
89 fAnalysisUtils(0x0),
90 fMultSelection(0x0),
91 fbIsMagnetPolarityNegative(kFALSE),
92 fFlowEvent(NULL)
93 {
94  for(Int_t k=0; k<4; k++) {
95  fZDCQHist[k] = NULL;
96  fZDCVtxHist[k] = NULL;
97  fZDCEcomTotHist[k] = NULL;
98  for(Int_t c=0; c<10; c++) {
99  fZDCVtxCenHist[c][k] = NULL;
100  }
101  fZDCVtxFitHist[k] = NULL;
102  for(Int_t i=0; i<3; i++) {
103  fZDCVtxFitCenProjHist[k][i] = NULL;
104  }
105  }
106  fZDCCenVtxZ = NULL;
107  for(Int_t c=0; c<10; c++) {
108  for(Int_t k=0; k<8; k++) {
109  fZDCVtxCenHistMagPol[c][k] = NULL;
110  }
111  }
112  for(Int_t i=0; i<10; i++) {
113  for(Int_t z=0; z<10; z++) {
114  for(Int_t k=0; k<4; k++) {
115  fZDCQVecVtxCenEZDC3D[i][z][k] = NULL;
116  }
117  }
118  }
119  for(Int_t c=0; c<2; c++) {
120  for(Int_t i=0; i<5; i++) {
121  fTowerGainEq[c][i] = NULL;
122  }
123  }
124  for (Int_t i=0; i<10; i++) {
125  fCRCZDCQVecDummyEZDCBins[i] = NULL;
126  }
127  for (Int_t i=0; i<2; i++) fZDCFlowVect[i] = NULL;
128 
129  for(Int_t c=0; c<4; c++) {
130  for(Int_t i=0; i<2; i++) {
131  fQVecCen[c][i] = NULL;
132  fQVecVtx[c][i] = NULL;
133  fQVecCorCen[c][i] = NULL;
134  // fQVecDeltaC[c][i] = NULL;
135  // fQVecCorDeltaC[c][i] = NULL;
136  }
137  }
138  for(Int_t i=0; i<2; i++) {
139  fQvecC2Ddis[i] = NULL;
140  fQvecA2Ddis[i] = NULL;
141  }
142  for(Int_t k=0; k<2; k++) {
143  for(Int_t c=0; c<10; c++) {
144  fZDCQvec2Ddis[c][k] = NULL;
145  }
146  }
147 
148  fRunList = TArrayI();
149  fAvVtxPosX = TArrayD();
150  fAvVtxPosY = TArrayD();
151  fAvVtxPosZ = TArrayD();
152 
153  for(Int_t r=0; r<fnRunMax; r++) {
154  fQVecListRun[r] = NULL;
155  fQVecRbRCen[r] = NULL;
156  fQVecRbRVtxZ[r] = NULL;
157  for(Int_t k=0;k<fCRCnTow;k++) {
158  fZNCTower[r][k] = NULL;
159  fZNATower[r][k] = NULL;
160  }
161  }
162  for(Int_t k=0;k<fCRCnTow;k++) {
163  fZNCTowerSpec[k] = NULL;
164  fZNATowerSpec[k] = NULL;
165  }
166 }
167 
168 //=====================================================================
169 
171 : AliAnalysisTaskSE(name),
172 fOutputList(0x0),
173 fHistList(0x0),
174 fQAList(0x0),
175 fZDCGainAlpha(0.395),
176 fZDCCalibList(0x0),
177 fTowerEqList(0x0),
178 fQAListMagPol(0x0),
179 fEventCounter(NULL),
180 fCentralityHisto(NULL),
181 fCachedRunNum(0),
182 fnRun(0),
184 fAnalysisUtils(0x0),
185 fMultSelection(0x0),
187 fFlowEvent(NULL)
188 {
189  for(Int_t k=0; k<4; k++) {
190  fZDCQHist[k] = NULL;
191  fZDCVtxHist[k] = NULL;
192  fZDCEcomTotHist[k] = NULL;
193  for(Int_t c=0; c<10; c++) {
194  fZDCVtxCenHist[c][k] = NULL;
195  }
196  fZDCVtxFitHist[k] = NULL;
197  for(Int_t i=0; i<3; i++) {
198  fZDCVtxFitCenProjHist[k][i] = NULL;
199  }
200  }
201  fZDCCenVtxZ = NULL;
202  for(Int_t c=0; c<10; c++) {
203  for(Int_t k=0; k<8; k++) {
204  fZDCVtxCenHistMagPol[c][k] = NULL;
205  }
206  }
207  for(Int_t i=0; i<10; i++) {
208  for(Int_t z=0; z<10; z++) {
209  for(Int_t k=0; k<4; k++) {
210  fZDCQVecVtxCenEZDC3D[i][z][k] = NULL;
211  }
212  }
213  }
214  for(Int_t c=0; c<2; c++) {
215  for(Int_t i=0; i<5; i++) {
216  fTowerGainEq[c][i] = NULL;
217  }
218  }
219  for (Int_t i=0; i<10; i++) {
220  fCRCZDCQVecDummyEZDCBins[i] = NULL;
221  }
222  for (Int_t i=0; i<2; i++) fZDCFlowVect[i] = NULL;
223 
224  for(Int_t c=0; c<4; c++) {
225  for(Int_t i=0; i<2; i++) {
226  fQVecCen[c][i] = NULL;
227  fQVecVtx[c][i] = NULL;
228  fQVecCorCen[c][i] = NULL;
229  // fQVecDeltaC[c][i] = NULL;
230  // fQVecCorDeltaC[c][i] = NULL;
231  }
232  }
233  for(Int_t i=0; i<2; i++) {
234  fQvecC2Ddis[i] = NULL;
235  fQvecA2Ddis[i] = NULL;
236  }
237  for(Int_t k=0; k<2; k++) {
238  for(Int_t c=0; c<10; c++) {
239  fZDCQvec2Ddis[c][k] = NULL;
240  }
241  }
242 
243  fRunList = TArrayI();
244  fAvVtxPosX = TArrayD();
245  fAvVtxPosY = TArrayD();
246  fAvVtxPosZ = TArrayD();
247 
248  for(Int_t r=0; r<fnRunMax; r++) {
249  fQVecListRun[r] = NULL;
250  fQVecRbRCen[r] = NULL;
251  fQVecRbRVtxZ[r] = NULL;
252  for(Int_t k=0;k<fCRCnTow;k++) {
253  fZNCTower[r][k] = NULL;
254  fZNATower[r][k] = NULL;
255  }
256  }
257  for(Int_t k=0;k<fCRCnTow;k++) {
258  fZNCTowerSpec[k] = NULL;
259  fZNATowerSpec[k] = NULL;
260  }
261 
262  DefineInput(0,TChain::Class());
263  DefineOutput(1,AliFlowEventSimple::Class());
264  DefineOutput(2,TList::Class());
265 }
266 
267 //=====================================================================
268 
270 {
271  // Destructor
272  delete fOutputList;
273  delete fHistList;
274  delete fFlowEvent;
275  if(fAnalysisUtils) delete fAnalysisUtils;
276  if(fMultSelection) delete fMultSelection;
277  if(fQAList){
278  delete fQAList;
279  }
280 }
281 
282 //=====================================================================
283 
285 {
286  // create a new TList that OWNS its objects
287  fOutputList = new TList();
288  fOutputList->SetOwner(kTRUE);
289 
290  for(Int_t c=0;c<2;c++) {
291  fZDCFlowVect[c] = new AliFlowVector();
292  fOutputList->Add(fZDCFlowVect[c]);
293  }
294 
295  fHistList = new TList();
296  fHistList->SetOwner(kTRUE);
297 
298  for(Int_t k=0; k<4; k++) {
299  fZDCQHist[k] = new TProfile();
300  fHistList->Add(fZDCQHist[k]);
301  fZDCVtxHist[k] = new TProfile3D();
302  fHistList->Add(fZDCVtxHist[k]);
303  fZDCEcomTotHist[k] = new TProfile2D();
304  fHistList->Add(fZDCEcomTotHist[k]);
305  for(Int_t c=0; c<10; c++) {
306  fZDCVtxCenHist[c][k] = new TProfile3D();
307  fHistList->Add(fZDCVtxCenHist[c][k]);
308  }
309  fZDCVtxFitHist[k] = new TH3D();
310  fHistList->Add(fZDCVtxFitHist[k]);
311  for(Int_t i=0; i<3; i++) {
312  fZDCVtxFitCenProjHist[k][i] = new TH1D();
313  fHistList->Add(fZDCVtxFitCenProjHist[k][i]);
314  }
315  }
316  fZDCCenVtxZ = new TProfile3D();
317  fHistList->Add(fZDCCenVtxZ);
318  for(Int_t c=0; c<10; c++) {
319  for(Int_t k=0; k<8; k++) {
320  fZDCVtxCenHistMagPol[c][k] = new TProfile3D();
321  fHistList->Add(fZDCVtxCenHistMagPol[c][k]);
322  }
323  }
324  for(Int_t i=0; i<10; i++) {
325  for(Int_t z=0; z<10; z++) {
326  for(Int_t k=0; k<4; k++) {
327  fZDCQVecVtxCenEZDC3D[i][z][k] = new TH3D();
328  fHistList->Add(fZDCQVecVtxCenEZDC3D[i][z][k]);
329  }
330  }
331  }
332  for(Int_t c=0; c<2; c++) {
333  for(Int_t i=0; i<5; i++) {
334  fTowerGainEq[c][i] = new TH1D();
335  fHistList->Add(fTowerGainEq[c][i]);
336  }
337  }
338 
339  Double_t DummyEZDCBins[10][11] = {{-3.000000e+02, -4.008000e+01, -2.658000e+01, -1.686000e+01, -8.520000e+00, -7.200000e-01, 7.080000e+00, 1.542000e+01, 2.520000e+01, 3.888000e+01, 3.000000e+02},{-3.000000e+02, -3.690000e+01, -2.436000e+01, -1.530000e+01, -7.560000e+00, -3.000000e-01, 6.960000e+00, 1.476000e+01, 2.388000e+01, 3.666000e+01, 3.000000e+02},{-3.000000e+02, -3.522000e+01, -2.316000e+01, -1.446000e+01, -7.020000e+00, -6.000000e-02, 6.900000e+00, 1.434000e+01, 2.310000e+01, 3.534000e+01, 3.000000e+02},{-3.000000e+02, -3.528000e+01, -2.322000e+01, -1.452000e+01, -7.080000e+00, -1.200000e-01, 6.840000e+00, 1.434000e+01, 2.310000e+01, 3.528000e+01, 3.000000e+02},{-3.000000e+02, -3.666000e+01, -2.412000e+01, -1.506000e+01, -7.320000e+00, -6.000000e-02, 7.200000e+00, 1.500000e+01, 2.412000e+01, 3.684000e+01, 3.000000e+02},{-3.000000e+02, -3.936000e+01, -2.580000e+01, -1.602000e+01, -7.680000e+00, 1.200000e-01, 7.920000e+00, 1.632000e+01, 2.616000e+01, 3.990000e+01, 3.000000e+02},{-3.000000e+02, -4.416000e+01, -2.880000e+01, -1.776000e+01, -8.280000e+00, 5.400000e-01, 9.420000e+00, 1.890000e+01, 3.000000e+01, 4.554000e+01, 3.000000e+02},{-3.000000e+02, -5.262000e+01, -3.384000e+01, -2.028000e+01, -8.700000e+00, 2.100000e+00, 1.296000e+01, 2.454000e+01, 3.816000e+01, 5.712000e+01, 3.000000e+02},{-3.000000e+02, -6.588000e+01, -4.122000e+01, -2.340000e+01, -8.160000e+00, 6.060000e+00, 2.028000e+01, 3.552000e+01, 5.340000e+01, 7.830000e+01, 3.000000e+02},{-3.000000e+02, -8.844000e+01, -5.556000e+01, -3.186000e+01, -1.158000e+01, 7.380000e+00, 2.634000e+01, 4.662000e+01, 7.038000e+01, 1.034400e+02, 3.000000e+02}};
340  for (Int_t i=0; i<10; i++) {
341  fCRCZDCQVecDummyEZDCBins[i] = new TH1D(Form("fCRCZDCQVecDummyEZDCBins[%d]",i),Form("fCRCZDCQVecDummyEZDCBins[%d]",i),10,DummyEZDCBins[i]);
343  }
344 
345  fAnalysisUtils = new AliAnalysisUtils;
346  fAnalysisUtils->SetUseMVPlpSelection(kTRUE);
347  fAnalysisUtils->SetUseOutOfBunchPileUp(kTRUE);
348 
349  fFlowEvent = new AliFlowEvent(1);
350 
351  fQAList = new TList();
352  fQAList->SetOwner(kTRUE);
353 
354  TString WhichQ[] = {"QCx","QCy","QAx","QAy"};
355  TString WhichCor[] = {"QAxQCx","QAyQCy","QAxQCy","QCxQAy"};
356  TString WhichMP[] = {"--","++"};
357  Double_t xmin=0.,xmax=0.,ymin=0.,ymax=0.,zmin=0.,zmax=0.;
358  xmin = -8.5e-3;
359  xmax = 8.5e-3;
360  ymin = -7.8e-3;
361  ymax = 7.8e-3;
362  zmin = -10.;
363  zmax = 10.;
364 
365  fEventCounter = new TH1D("fEventCounter","fEventCounter",6,0.,6.);
366  fEventCounter->GetXaxis()->SetBinLabel(1,"total");
367  fEventCounter->GetXaxis()->SetBinLabel(2,"passed");
368  fEventCounter->GetXaxis()->SetBinLabel(3,"den<0");
369  fEventCounter->GetXaxis()->SetBinLabel(4,"vtx out-of-boundaries");
370  fEventCounter->GetXaxis()->SetBinLabel(5,"norm=0");
371  fEventCounter->GetXaxis()->SetBinLabel(6,"raw tower<0");
372  fQAList->Add(fEventCounter);
373  fCentralityHisto = new TH1D("fCentralityHisto","fCentralityHisto",100,0.,100.);
375 
376 
377  fQAListMagPol = new TList();
378  fQAListMagPol->SetName("QA list Magnet Polarity");
379  fQAListMagPol->SetOwner(kTRUE);
380  fQAList->Add(fQAListMagPol);
381 
382  for(Int_t i=0; i<2; i++) {
383  for(Int_t c=0; c<4; c++) {
384  fQVecCen[c][i] = new TProfile(Form("fQVecCen[%d][%d]",c,i),Form("ZDC <%s> mag.pol. %s;centrality;<%s>",WhichQ[c].Data(),WhichMP[i].Data(),WhichQ[c].Data()),20,0.,100.);
385  fQAListMagPol->Add(fQVecCen[c][i]);
386  }
387  for(Int_t c=0; c<4; c++) {
388  fQVecVtx[c][i] = new TProfile3D(Form("fQVecVtx[%d][%d]",c,i),Form("ZDC <%s> mag.pol. %s;x_{vtx} (cm);y_{vtx} (cm);z_{vtx} (cm)",WhichQ[c].Data(),WhichMP[i].Data()),10,xmin,xmax,10,ymin,ymax,10,zmin,zmax);
389  fQAListMagPol->Add(fQVecVtx[c][i]);
390  }
391  for(Int_t c=0; c<4; c++) {
392  fQVecCorCen[c][i] = new TProfile(Form("fQVecCorCen[%d][%d]",c,i),Form("ZDC <%s> mag.pol. %s;centrality;<%s>",WhichCor[c].Data(),WhichMP[i].Data(),WhichCor[c].Data()),20,0.,100.);
393  fQAListMagPol->Add(fQVecCorCen[c][i]);
394  }
395  // fQVecDeltaC[c][i] = new TProfile(Form("fQVecDeltaC[%d][%d]",c,i),Form("ZDC <%s> mag.pol. %s;#Delta centroids (cm);<%s>",WhichQ[c].Data(),WhichMP[i].Data(),WhichQ[c].Data()),100,0.,2.5);
396  // fQAListMagPol->Add(fQVecDeltaC[c][i]);
397  // fQVecCorDeltaC[c][i] = new TProfile(Form("fQVecCorDeltaC[%d][%d]",c,i),Form("ZDC <%s> mag.pol. %s;#Delta centroids (cm);<%s>",WhichCor[c].Data(),WhichMP[i].Data(),WhichCor[c].Data()),100,0.,2.5);
398  // fQAListMagPol->Add(fQVecCorDeltaC[c][i]);
399  fQvecC2Ddis[i] = new TH2D(Form("fQvecC2Ddis[%d]",i),Form("%s x-y distribution mag.pol. %s;x (cm);y (cm)","QC",WhichMP[i].Data()),100, -2., 2. , 100., -2., 2.);
400  fQAListMagPol->Add(fQvecC2Ddis[i]);
401  fQvecA2Ddis[i] = new TH2D(Form("fQvecA2Ddis[%d]",i),Form("%s x-y distribution mag.pol. %s;x (cm);y (cm)","QA",WhichMP[i].Data()),100, -2., 2. , 100., -2., 2.);
402  fQAListMagPol->Add(fQvecA2Ddis[i]);
403  }
404  for(Int_t k=0; k<2; k++) {
405  for(Int_t c=0; c<10; c++) {
406  fZDCQvec2Ddis[c][k] = new TH2D(Form("fZDCQvec2Ddis[%d][%d]",c,k),Form("%s x-y distribution (centrality bin %d);x (cm);y (cm)",(k==0?"QC":"QA"),c),100, -2., 2. , 100., -2., 2.);
407  fQAList->Add(fZDCQvec2Ddis[c][k]);
408  }
409  }
410 
411  Int_t dRun15o[] = {244917, 244918, 244975, 244980, 244982, 244983, 245064, 245066, 245068, 246390, 246391, 246392, 246994, 246991, 246989, 246984, 246982, 246980, 246948, 246945, 246928, 246851, 246847, 246846, 246845, 246844, 246810, 246809, 246808, 246807, 246805, 246804, 246766, 246765, 246763, 246760, 246759, 246758, 246757, 246751, 246750, 246495, 246493, 246488, 246487, 246434, 246431, 246428, 246424, 246276, 246275, 246272, 246271, 246225, 246222, 246217, 246185, 246182, 246181, 246180, 246178, 246153, 246152, 246151, 246115, 246113, 246089, 246087, 246053, 246052, 246049, 246048, 246042, 246037, 246036, 246012, 246003, 246001, 245954, 245952, 245949, 245923, 245833, 245831, 245829, 245705, 245702, 245700, 245692, 245683, 245145, 245146, 245151, 245152, 245231, 245232, 245259, 245343, 245345, 245346, 245347, 245349, 245353, 245396, 245397, 245401, 245407, 245409, 245441, 245446, 245450, 245454, 245496, 245497, 245501, 245504, 245505, 245507, 245535, 245540, 245542, 245543, 245544, 245545, 245554};
412  Double_t dVtxPosX15o[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,7.619407e-02, 7.612905e-02, 7.609009e-02, 7.610981e-02, 7.608885e-02, 7.609981e-02, 7.559263e-02, 7.563009e-02, 7.551201e-02, 7.570994e-02, 7.571927e-02, 7.575639e-02, 7.571133e-02, 7.570653e-02, 7.528412e-02, 7.535235e-02, 7.539954e-02, 7.535435e-02, 7.541641e-02, 7.543658e-02, 7.527343e-02, 7.526024e-02, 7.528295e-02, 7.533821e-02, 7.540461e-02, 7.538317e-02, 7.531677e-02, 7.539861e-02, 7.537667e-02, 7.659318e-02, 7.656796e-02, 7.662898e-02, 7.664257e-02, 7.597872e-02, 7.597437e-02, 7.599091e-02, 7.601310e-02, 7.000359e-02, 6.999659e-02, 6.992559e-02, 6.996793e-02, 7.028519e-02, 7.032696e-02, 7.033503e-02, 6.952509e-02, 6.956378e-02, 6.952446e-02, 6.959759e-02, 6.956048e-02, 6.933134e-02, 6.932882e-02, 6.939338e-02, 6.950613e-02, 6.943631e-02, 6.946196e-02, 6.950454e-02, 7.030973e-02, 7.030203e-02, 7.032272e-02, 7.030936e-02, 7.038967e-02, 7.035136e-02, 7.024752e-02, 6.942316e-02, 6.940115e-02, 6.936367e-02, 6.860689e-02, 6.881501e-02, 6.886743e-02, 6.932714e-02, 6.970325e-02, 6.966504e-02, 6.957355e-02, 6.932303e-02, 6.938184e-02, 6.944933e-02, 6.952461e-02, 6.964167e-02, 6.793435e-02, 6.802185e-02, 6.801235e-02, 6.804823e-02, 6.842972e-02, 6.839652e-02, 6.851932e-02, 6.976507e-02, 6.989692e-02, 6.994544e-02, 6.994261e-02, 6.997887e-02, 7.001687e-02, 6.934462e-02, 6.958349e-02, 6.907266e-02, 6.905944e-02, 6.895395e-02, 7.006562e-02, 7.008493e-02, 7.012736e-02, 6.964645e-02, 6.960466e-02, 6.962255e-02, 6.979086e-02, 6.985343e-02, 6.983755e-02, 6.957177e-02, 6.875991e-02, 6.871756e-02, 6.871021e-02, 6.871769e-02, 6.869493e-02, 6.874049e-02, 6.860300e-02};
413  Double_t dVtxPosY15o[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,3.361709e-01, 3.361818e-01, 3.362205e-01, 3.363199e-01, 3.363092e-01, 3.362369e-01, 3.374328e-01, 3.374148e-01, 3.375140e-01, 3.361514e-01, 3.361743e-01, 3.362329e-01, 3.361395e-01, 3.361633e-01, 3.367675e-01, 3.366963e-01, 3.366845e-01, 3.366490e-01, 3.366937e-01, 3.366825e-01, 3.373764e-01, 3.373762e-01, 3.373721e-01, 3.373705e-01, 3.373943e-01, 3.373675e-01, 3.374071e-01, 3.373368e-01, 3.373442e-01, 3.375773e-01, 3.375333e-01, 3.377335e-01, 3.378285e-01, 3.362674e-01, 3.362492e-01, 3.362604e-01, 3.363473e-01, 3.295003e-01, 3.295046e-01, 3.295761e-01, 3.296100e-01, 3.291527e-01, 3.292071e-01, 3.290824e-01, 3.299371e-01, 3.300008e-01, 3.300078e-01, 3.300391e-01, 3.300740e-01, 3.300345e-01, 3.300776e-01, 3.301195e-01, 3.289427e-01, 3.289736e-01, 3.296084e-01, 3.297025e-01, 3.297724e-01, 3.298166e-01, 3.298278e-01, 3.298682e-01, 3.297381e-01, 3.296875e-01, 3.297720e-01, 3.298361e-01, 3.298561e-01, 3.299325e-01, 3.300111e-01, 3.301161e-01, 3.302630e-01, 3.289954e-01, 3.292915e-01, 3.293319e-01, 3.294174e-01, 3.314355e-01, 3.314431e-01, 3.316189e-01, 3.318682e-01, 3.323906e-01, 3.315020e-01, 3.312268e-01, 3.310778e-01, 3.310524e-01, 3.314478e-01, 3.312986e-01, 3.311297e-01, 3.324064e-01, 3.322524e-01, 3.322019e-01, 3.321221e-01, 3.321050e-01, 3.319118e-01, 3.317922e-01, 3.314658e-01, 3.315735e-01, 3.316331e-01, 3.316525e-01, 3.308030e-01, 3.308038e-01, 3.306947e-01, 3.305741e-01, 3.316492e-01, 3.316117e-01, 3.314973e-01, 3.314110e-01, 3.313450e-01, 3.313649e-01, 3.325841e-01, 3.324226e-01, 3.323649e-01, 3.323381e-01, 3.322566e-01, 3.322077e-01, 3.320860e-01};
414  Double_t dVtxPosZ15o[] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,5.559279e-01, 3.535446e-01, 4.846955e-01, 4.525585e-01, 3.684501e-01, 2.485494e-01, 2.372653e-01, 1.707859e-01, 3.314213e-01, 1.709195e-01, 2.209753e-01, 3.125757e-01, 3.422085e-01, 3.868156e-01, 4.859695e-01, 4.780697e-01, 4.400149e-01, 4.014992e-01, 3.049883e-01, 3.708501e-01, 3.883566e-01, 3.940632e-01, 4.197670e-01, 3.938399e-01, 3.814413e-01, 3.335539e-01, 3.181929e-01, 2.300734e-01, 2.722395e-01, 5.241033e-01, 3.225908e-01, 1.925791e-01, 1.892765e-01, 3.384066e-01, 2.026459e-01, 2.495699e-01, 3.569992e-01, 3.891381e-01, 4.603724e-01, 3.696685e-01, 3.002207e-01, 2.929533e-01, 3.095468e-01, 3.517200e-01, 2.784445e-01, 3.866626e-01, 3.058719e-01, 3.336752e-01, 3.226473e-01, 3.222815e-01, 3.428469e-01, 3.728514e-01, 2.858642e-01, 2.832485e-01, 3.378933e-01, 3.547548e-01, 3.799414e-01, 4.043543e-01, 4.314049e-01, 4.141138e-01, 3.888746e-01, 4.103586e-01, 3.871045e-01, 4.614473e-01, 4.023404e-01, 4.203531e-01, 4.401272e-01, 6.450558e-01, 6.819582e-01, 2.588529e-01, 3.693471e-01, 3.990708e-01, 3.813842e-01, 3.471682e-01, 3.356156e-01, 2.550150e-01, 3.830723e-01, 4.293259e-01, 4.723797e-01, 4.684324e-01, 4.609304e-01, 4.554974e-01, 4.523016e-01, 3.769890e-01, 4.485548e-01, 5.024484e-01, 5.200088e-01, 5.261731e-01, 5.392851e-01, 5.399264e-01, 5.155504e-01, 4.267668e-01, 5.348764e-01, 4.526746e-01, 4.045626e-01, 4.261759e-01, 5.889205e-01, 6.364843e-01, 5.896163e-01, 3.768637e-01, 4.440771e-01, 4.687029e-01, 4.794467e-01, 4.313422e-01, 3.954777e-01, 3.983129e-01, 3.608064e-01, 2.627038e-01, 3.665826e-01, 4.275667e-01, 3.335445e-01, 3.250815e-01, 3.022907e-01};
415 
416  Int_t dRun15o_GoodMuonRuns[] = {246994, 246991, 246989, 246984, 246982, 246980, 246949, 246948, 246945, 246942, 246937, 246930, 246871, 246867, 246865, 246864, 246859, 246855, 246851, 246847, 246846, 246845, 246844, 246809, 246808, 246807, 246806, 246805, 246804, 246765, 246763, 246760, 246759, 246758, 246757, 246755, 246751, 246750, 246676, 246675, 246495, 246493, 246488, 246487, 246434, 246433, 246431, 246428, 246424, 246392, 246391, 246390, 246276, 246275, 246272, 246225, 246222, 246220, 246217, 246182, 246181, 246178, 246153, 246152, 246151, 246148, 246115, 246113, 246089, 246087, 246053, 246049, 246048, 246042, 246037, 246036, 246012, 246003, 246001, 245996, 245963, 245954, 245952, 245949, 245833, 245831, 245829, 245793, 245785, 245775, 245766, 245759, 245752, 245738, 245731, 245729, 245705, 245700, 245692, 245683, 245554, 245543, 245542, 245540, 245535, 245507, 245505, 245504, 245501, 245496, 245450, 245446, 245410, 245409, 245407, 245401, 245353, 245347, 245346, 245345, 245343, 245259, 245253, 245233, 245232, 245231, 245152, 245151, 245146, 245145, 245068, 245066, 245064, 244983, 244982, 244980, 244918};
417 
418  switch(fDataSet) {
420  fnRun=125;
421  fRunList=TArrayI(fnRun,dRun15o);
422  fAvVtxPosX=TArrayD(fnRun,dVtxPosX15o);
423  fAvVtxPosY=TArrayD(fnRun,dVtxPosY15o);
424  fAvVtxPosZ=TArrayD(fnRun,dVtxPosZ15o);
425  break;
427  fnRun=137;
428  fRunList=TArrayI(fnRun,dRun15o_GoodMuonRuns);
432  break;
433  }
434 
435 
436  for(Int_t k=0;k<fCRCnTow;k++) {
437  fZNCTowerSpec[k] = new TH2D(Form("fZNCTowerSpec[%d]",k),Form("fZNCTowerSpec[%d];centrality;ADC signal (a.u.);counts",k),100,0.,100.,500,0.,5.E4);
438  fQAList->Add(fZNCTowerSpec[k]);
439  fZNATowerSpec[k] = new TH2D(Form("fZNATowerSpec[%d]",k),Form("fZNATowerSpec[%d];centrality;ADC signal (a.u.);counts",k),100,0.,100.,500,0.,5.E4);
440  fQAList->Add(fZNATowerSpec[k]);
441  }
442 
443  for(Int_t r=0; r<fnRun; r++) {
444  fQVecListRun[r] = new TList();
445  fQVecListRun[r]->SetName(Form("run %d",fRunList[r]));
446  fQVecListRun[r]->SetOwner(kTRUE);
447  fQAList->Add(fQVecListRun[r]);
448 
449  fQVecRbRCen[r] = new TProfile2D(Form("QVecRbRCen[%d]",fRunList[r]),Form("ZDC <Q_{i}> run %d;centrality;Q_{i}",fRunList[r]),20,0.,100.,4,0.,4.);
450  fQVecListRun[r]->Add(fQVecRbRCen[r]);
451  fQVecRbRVtxZ[r] = new TProfile3D(Form("QVecRbRVtxZ[%d]",fRunList[r]),Form("ZDC <Q_{i}> run %d;centrality;vtx-z (cm);Q_{i}",fRunList[r]),18,0.,90.,20,-10.,10.,4,0.,4.);
452  fQVecListRun[r]->Add(fQVecRbRVtxZ[r]);
453 
454  if(!fTowerEqList) {
455  for(Int_t k=0; k<fCRCnTow; k++) {
456  fZNCTower[r][k] = new TProfile(Form("fZNCTower[%d][%d]",fRunList[r],k),Form("fZNCTower[%d][%d]",fRunList[r],k),100,0.,100.,"s");
457  fZNCTower[r][k]->Sumw2();
458  fQVecListRun[r]->Add(fZNCTower[r][k]);
459  fZNATower[r][k] = new TProfile(Form("fZNATower[%d][%d]",fRunList[r],k),Form("fZNATower[%d][%d]",fRunList[r],k),100,0.,100.,"s");
460  fZNATower[r][k]->Sumw2();
461  fQVecListRun[r]->Add(fZNATower[r][k]);
462  }
463  }
464  }
465 
466  PostData(2, fQAList);
467 }
468 
469 //=====================================================================
470 
472 {
473  // get an event from the analysis manager
474  AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
475  if(!aod) return;
476  Double_t Centrality = 0.;
477  fMultSelection = (AliMultSelection*)aod->FindListObject("MultSelection");
478  if(!fMultSelection) {
479  AliWarning("WARNING: AliMultSelection object not found ! \n");
480  } else {
481  Centrality = fMultSelection->GetMultiplicityPercentile("V0M");
482  }
483  Int_t RunNum = aod->GetRunNumber();
484  Int_t RunBin=-1, bin=0;
485  for(Int_t c=0;c<fnRun;c++) {
486  if(fRunList[c]==RunNum) RunBin=bin;
487  else bin++;
488  }
489  if(RunBin==-1) return;
490  Int_t fCenBin = GetCenBin(Centrality);
491 
492  if(RunNum!=fCachedRunNum) {
494  // LHC15o
495  // negative polarity: 246390 - 246994
496  // positive polarity: 244824 - 246276
497  if(RunNum>246276) fbIsMagnetPolarityNegative = kTRUE;
498  }
500 
501  Bool_t IsGoodEvent = kTRUE;
502  fEventCounter->Fill(0.5);
503  fCentralityHisto->Fill(Centrality);
504 
505  // get primary vertex position
506  Double_t fVtxPos[3]={0.,0.,0.};
507  fVtxPos[0] = ((AliVVertex*)aod->GetPrimaryVertexSPD())->GetX();
508  fVtxPos[1] = ((AliVVertex*)aod->GetPrimaryVertexSPD())->GetY();
509  fVtxPos[2] = ((AliVVertex*)aod->GetPrimaryVertexSPD())->GetZ();
510  Double_t fVtxPosCor[3] = {fVtxPos[0]-fAvVtxPosX[RunBin],fVtxPos[1]-fAvVtxPosY[RunBin],fVtxPos[2]-fAvVtxPosZ[RunBin]};
511 
512  // zdc selection
513  AliAODZDC *aodZDC = aod->GetZDCData();
514 
515  const Double_t * towZNCraw = aodZDC->GetZNCTowerEnergy();
516  const Double_t * towZNAraw = aodZDC->GetZNATowerEnergy();
517 
518  for(Int_t i=0; i<5; i++) {
519  if(towZNCraw[i]<0. || (i!=2 && towZNAraw[i]<0.)) IsGoodEvent = kFALSE;
520  }
521  if(!IsGoodEvent) fEventCounter->Fill(5.5);
522 
523  // Get centroid from ZDCs *******************************************************
524 
525  Double_t Enucl = (RunNum < 209122 ? 1380. : 2511.);
526  Double_t xyZNC[2]={0.,0.}, xyZNA[2]={0.,0.};
527  Double_t towZNC[5]={0.}, towZNA[5]={0.};
528 
529  Double_t ZNCcalib=1., ZNAcalib=1.;
530 
531  // equalize gain of all towers
532  if(fTowerEqList) {
533  if(RunNum!=fCachedRunNum) {
534  for(Int_t i=0; i<5; i++) {
535  fTowerGainEq[0][i] = (TH1D*)(fTowerEqList->FindObject(Form("fZNCTower[%d][%d]",RunNum,i)));
536  fTowerGainEq[1][i] = (TH1D*)(fTowerEqList->FindObject(Form("fZNATower[%d][%d]",RunNum,i)));
537  }
538  }
539  for(Int_t i=0; i<5; i++) {
540  if(fTowerGainEq[0][i]) towZNC[i] = towZNCraw[i]*fTowerGainEq[0][i]->GetBinContent(fTowerGainEq[0][i]->FindBin(Centrality));
541  if(fTowerGainEq[1][i]) towZNA[i] = towZNAraw[i]*fTowerGainEq[1][i]->GetBinContent(fTowerGainEq[1][i]->FindBin(Centrality));
542  }
543  } else {
544  for(Int_t i=0; i<5; i++) {
545  if(towZNCraw[i]<0. || towZNAraw[i]<0.) continue;
546  towZNC[i] = towZNCraw[i];
547  towZNA[i] = towZNAraw[i];
548  if(fZNCTower[RunBin][i]) fZNCTower[RunBin][i]->Fill(Centrality,towZNC[i]);
549  if(fZNATower[RunBin][i]) fZNATower[RunBin][i]->Fill(Centrality,towZNA[i]);
550  }
551  }
552 
553  for(Int_t i=0; i<5; i++) {
554  fZNCTowerSpec[i]->Fill(Centrality,towZNC[i]);
555  fZNATowerSpec[i]->Fill(Centrality,towZNA[i]);
556  }
557 
558  if(RunNum>=245829) towZNA[2] = 0.;
559  Double_t zncEnergy=0., znaEnergy=0.;
560  for(Int_t i=0; i<5; i++){
561  zncEnergy += towZNC[i];
562  znaEnergy += towZNA[i];
563  }
564  if(RunNum>=245829) znaEnergy *= 8./7.;
565  Double_t fZNCen = towZNC[0]/Enucl;
566  Double_t fZNAen = towZNA[0]/Enucl;
567 
568  const Double_t x[4] = {-1.75, 1.75, -1.75, 1.75};
569  const Double_t y[4] = {-1.75, -1.75, 1.75, 1.75};
570  Double_t numXZNC=0., numYZNC=0., denZNC=0., cZNC, wZNC, EZNC, SumEZNC=0.;
571  Double_t numXZNA=0., numYZNA=0., denZNA=0., cZNA, wZNA, EZNA, SumEZNA=0., BadChOr;
572 
573  for(Int_t i=0; i<4; i++){
574  // get energy
575  EZNC = towZNC[i+1];
576  SumEZNC += EZNC;
577 
578  // build centroid
579  wZNC = TMath::Power(EZNC, fZDCGainAlpha);
580  numXZNC += x[i]*wZNC;
581  numYZNC += y[i]*wZNC;
582  denZNC += wZNC;
583 
584  // get energy
585  if(i==1) {
586  EZNA = towZNA[0]-towZNA[1]-towZNA[3]-towZNA[4];
587  } else {
588  EZNA = towZNA[i+1];
589  }
590  SumEZNA += EZNA;
591 
592  // build centroid
593  wZNA = TMath::Power(EZNA, fZDCGainAlpha);
594  numXZNA += x[i]*wZNA;
595  numYZNA += y[i]*wZNA;
596  denZNA += wZNA;
597  }
598  if(denZNC>0.){
599  Double_t nSpecnC = SumEZNC/Enucl;
600  cZNC = 1.89358-0.71262/(nSpecnC+0.71789);
601  xyZNC[0] = cZNC*numXZNC/denZNC;
602  xyZNC[1] = cZNC*numYZNC/denZNC;
603  denZNC *= cZNC;
604  }
605  else{
606  xyZNC[0] = xyZNC[1] = 0.;
607  IsGoodEvent = kFALSE;
608  }
609  if(denZNA>0.){
610  Double_t nSpecnA = SumEZNA/Enucl;
611  cZNA = 1.89358-0.71262/(nSpecnA+0.71789);
612  xyZNA[0] = cZNA*numXZNA/denZNA;
613  xyZNA[1] = cZNA*numYZNA/denZNA;
614  denZNA *= cZNA;
615  }
616  else{
617  xyZNA[0] = xyZNA[1] = 0.;
618  IsGoodEvent = kFALSE;
619  }
620 
621  if(denZNC<=0. || denZNA<=0.) fEventCounter->Fill(2.5);
622 
623  fZDCFlowVect[0]->Set(xyZNC[0],xyZNC[1]);
624  fZDCFlowVect[1]->Set(xyZNA[0],xyZNA[1]);
625  fZDCFlowVect[0]->SetMult(denZNC);
626  fZDCFlowVect[1]->SetMult(denZNA);
627 
628  // ZDCN-C
629  Double_t QCRe = fZDCFlowVect[0]->X();
630  Double_t QCIm = fZDCFlowVect[0]->Y();
631  Double_t QMC = fZDCFlowVect[0]->GetMult();
632  // ZDCN-A
633  Double_t QARe = fZDCFlowVect[1]->X();
634  Double_t QAIm = fZDCFlowVect[1]->Y();
635  Double_t QMA = fZDCFlowVect[1]->GetMult();
636 
637  Double_t QCReR=QCRe, QCImR=QCIm, QAReR=QARe, QAImR=QAIm;
638 
639  // RE-CENTER ZDC Q-VECTORS ***************************************************
640 
641  if(fZDCCalibList) {
642 
643  if(RunNum!=fCachedRunNum) {
644  // get histos of run
645  fZDCQHist[0] = (TProfile*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecC[%d][%d]",RunNum,0)));
646  fZDCQHist[1] = (TProfile*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecC[%d][%d]",RunNum,1)));
647  fZDCQHist[2] = (TProfile*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecA[%d][%d]",RunNum,0)));
648  fZDCQHist[3] = (TProfile*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecA[%d][%d]",RunNum,1)));
649 
650  for(Int_t k=0; k<4; k++) {
651  fZDCVtxHist[k] = (TProfile3D*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecVtxPos540[%d][%d]",RunNum,k)));
652 
653  fZDCEcomTotHist[k] = (TProfile2D*)(fZDCCalibList->FindObject(Form("fCRCZDCQVecEComTot[%d]",k)));
654  }
655  fZDCCenVtxZ = (TProfile3D*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecCenVtxZ[%d]",RunNum)));
656 
657  for(Int_t c=0; c<10; c++) {
658  for(Int_t k=0; k<4; k++) {
659  fZDCVtxCenHist[c][k] = (TProfile3D*)(fZDCCalibList->FindObject(Form("fCRCZDCQVecVtxPosCen[%d][%d]",c,k)));
660  }
661  }
662 
663  for(Int_t k=0; k<4; k++) {
664  fZDCVtxFitHist[k] = (TH3D*)fZDCCalibList->FindObject(Form("TH3SlopeRunCenVtx[%d]",k));
665  if(fZDCVtxFitHist[k]) {
666  fZDCVtxFitHist[k]->Sumw2(kFALSE);
667  Int_t runbin = fZDCVtxFitHist[k]->GetXaxis()->FindBin(Form("%d",RunNum));
668  fZDCVtxFitHist[k]->GetXaxis()->SetRange(runbin,runbin);
669  for(Int_t i=0; i<3; i++) {
670  fZDCVtxFitHist[k]->GetZaxis()->SetRange(i+1,i+1);
671  fZDCVtxFitCenProjHist[k][i] = (TH1D*)fZDCVtxFitHist[k]->Project3D("y")->Clone(Form("proj[%d][%d]",k,i));
672  }
673  }
674  }
675 
676  for(Int_t c=0; c<10; c++) {
677  for(Int_t k=0; k<8; k++) {
678  fZDCVtxCenHistMagPol[c][k] = (TProfile3D*)(fZDCCalibList->FindObject(Form("fZDCVtxCenHistMagPol[%d][%d]",c,k)));
679  }
680  }
681 
682  // for(Int_t i=0; i<10; i++) {
683  // for(Int_t z=0; z<10; z++) {
684  // for(Int_t k=0; k<4; k++) {
685  // fZDCQVecVtxCenEZDC3D[i][z][k] = (TH3D*)(fZDCCalibList->FindObject(Form("ZDCQVecVtxCenEZDC3D[%d][%d][%d]",i,z,qb[k])));
686  // }
687  // }
688  // }
689 
690  }
691 
692  // STEP #1: re-center vs centrality (1%) vs run number
693 
694  if (fZDCQHist[0]) {
695  Double_t AvQCRe = fZDCQHist[0]->GetBinContent(fZDCQHist[0]->FindBin(Centrality));
696  Double_t SDQCRe = fZDCQHist[0]->GetBinError(fZDCQHist[0]->FindBin(Centrality));
697  Double_t AvQCIm = fZDCQHist[1]->GetBinContent(fZDCQHist[1]->FindBin(Centrality));
698  Double_t SDQCIm = fZDCQHist[1]->GetBinError(fZDCQHist[1]->FindBin(Centrality));
699 
700  Double_t AvQARe = fZDCQHist[2]->GetBinContent(fZDCQHist[2]->FindBin(Centrality));
701  Double_t SDQARe = fZDCQHist[2]->GetBinError(fZDCQHist[2]->FindBin(Centrality));
702  Double_t AvQAIm = fZDCQHist[3]->GetBinContent(fZDCQHist[3]->FindBin(Centrality));
703  Double_t SDQAIm = fZDCQHist[3]->GetBinError(fZDCQHist[3]->FindBin(Centrality));
704 
705  if(AvQCRe && AvQCIm && QMC>0. && sqrt(QCRe*QCRe+QCIm*QCIm)>1.E-6) {
706  QCReR = QCRe-AvQCRe;
707  QCImR = QCIm-AvQCIm;
708  fZDCFlowVect[0]->Set(QCReR,QCImR);
709  }
710 
711  if(AvQARe && AvQAIm && QMA>0. && sqrt(QARe*QARe+QAIm*QAIm)>1.E-6) {
712  QAReR = QARe-AvQARe;
713  QAImR = QAIm-AvQAIm;
714  fZDCFlowVect[1]->Set(QAReR,QAImR);
715  }
716  }
717 
718  // STEP #2: re-center vs primary vtx vs centrality (10%)
719 
720  if (fZDCVtxCenHist[fCenBin][0]) {
721  Bool_t pass = kTRUE;
722  if(fVtxPosCor[0] < fZDCVtxCenHist[fCenBin][0]->GetXaxis()->GetXmin() || fVtxPosCor[0] > fZDCVtxCenHist[fCenBin][0]->GetXaxis()->GetXmax()) pass = kFALSE;
723  if(fVtxPosCor[1] < fZDCVtxCenHist[fCenBin][0]->GetYaxis()->GetXmin() || fVtxPosCor[1] > fZDCVtxCenHist[fCenBin][0]->GetYaxis()->GetXmax()) pass = kFALSE;
724  if(fVtxPosCor[2] < fZDCVtxCenHist[fCenBin][0]->GetZaxis()->GetXmin() || fVtxPosCor[2] > fZDCVtxCenHist[fCenBin][0]->GetZaxis()->GetXmax()) pass = kFALSE;
725  if(!pass) {
726  IsGoodEvent = kFALSE;
727  fEventCounter->Fill(3.5);
728  } else {
729  QCReR -= fZDCVtxCenHist[fCenBin][0]->GetBinContent(fZDCVtxCenHist[fCenBin][0]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
730  QCImR -= fZDCVtxCenHist[fCenBin][1]->GetBinContent(fZDCVtxCenHist[fCenBin][1]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
731  QAReR -= fZDCVtxCenHist[fCenBin][2]->GetBinContent(fZDCVtxCenHist[fCenBin][2]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
732  QAImR -= fZDCVtxCenHist[fCenBin][3]->GetBinContent(fZDCVtxCenHist[fCenBin][3]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
733  fZDCFlowVect[0]->Set(QCReR,QCImR);
734  fZDCFlowVect[1]->Set(QAReR,QAImR);
735  }
736  }
737 
738  // STEP #3: re-center vs primary vtx vs run number
739 
740  if (fZDCVtxHist[0]) {
741  QCReR -= fZDCVtxHist[0]->GetBinContent(fZDCVtxHist[0]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
742  QCImR -= fZDCVtxHist[1]->GetBinContent(fZDCVtxHist[1]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
743  fZDCFlowVect[0]->Set(QCReR,QCImR);
744  QAReR -= fZDCVtxHist[2]->GetBinContent(fZDCVtxHist[2]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
745  QAImR -= fZDCVtxHist[3]->GetBinContent(fZDCVtxHist[3]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
746  fZDCFlowVect[1]->Set(QAReR,QAImR);
747  }
748 
749  // STEP #4: re-center vs centrality vs energy in the common tower
750 
751  if(fZDCEcomTotHist[0]) {
752  QCReR -= fZDCEcomTotHist[0]->GetBinContent(fZDCEcomTotHist[0]->FindBin(Centrality,fZNCen));
753  QCImR -= fZDCEcomTotHist[1]->GetBinContent(fZDCEcomTotHist[1]->FindBin(Centrality,fZNCen));
754  fZDCFlowVect[0]->Set(QCReR,QCImR);
755  QAReR -= fZDCEcomTotHist[2]->GetBinContent(fZDCEcomTotHist[2]->FindBin(Centrality,fZNAen));
756  QAImR -= fZDCEcomTotHist[3]->GetBinContent(fZDCEcomTotHist[3]->FindBin(Centrality,fZNAen));
757  fZDCFlowVect[1]->Set(QAReR,QAImR);
758  }
759 
760  // STEP #5: re-center vs vtx vs cen vs run number (through fits)
761 
762  if(fZDCVtxFitHist[0]) {
763  for (Int_t i=0; i<3; i++) {
764  QCReR -= fVtxPosCor[i]*fZDCVtxFitCenProjHist[0][i]->Interpolate(Centrality);
765  QCImR -= fVtxPosCor[i]*fZDCVtxFitCenProjHist[1][i]->Interpolate(Centrality);
766  QAReR -= fVtxPosCor[i]*fZDCVtxFitCenProjHist[2][i]->Interpolate(Centrality);
767  QAImR -= fVtxPosCor[i]*fZDCVtxFitCenProjHist[3][i]->Interpolate(Centrality);
768  }
769  fZDCFlowVect[0]->Set(QCReR,QCImR);
770  fZDCFlowVect[1]->Set(QAReR,QAImR);
771  }
772 
773  // second iteration (2D)
774 
775  if (fZDCVtxCenHistMagPol[fCenBin][0]) {
777  QCReR -= fZDCVtxCenHistMagPol[fCenBin][0]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][0]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
778  QCImR -= fZDCVtxCenHistMagPol[fCenBin][1]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][1]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
779  QAReR -= fZDCVtxCenHistMagPol[fCenBin][4]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][4]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
780  QAImR -= fZDCVtxCenHistMagPol[fCenBin][5]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][5]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
781  } else {
782  QCReR -= fZDCVtxCenHistMagPol[fCenBin][2]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][2]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
783  QCImR -= fZDCVtxCenHistMagPol[fCenBin][3]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][3]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
784  QAReR -= fZDCVtxCenHistMagPol[fCenBin][6]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][6]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
785  QAImR -= fZDCVtxCenHistMagPol[fCenBin][7]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][7]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
786  }
787  fZDCFlowVect[0]->Set(QCReR,QCImR);
788  fZDCFlowVect[1]->Set(QAReR,QAImR);
789  }
790 
791  // STEP #6 (only for muon_calo_pass1): re-center vs centrality vs vz
792 
793  if(fZDCCenVtxZ) {
794  QCReR -= fZDCCenVtxZ->GetBinContent(fZDCCenVtxZ->FindBin(Centrality,fVtxPosCor[2],0.5));
795  QCImR -= fZDCCenVtxZ->GetBinContent(fZDCCenVtxZ->FindBin(Centrality,fVtxPosCor[2],1.5));
796  fZDCFlowVect[0]->Set(QCReR,QCImR);
797  QAReR -= fZDCCenVtxZ->GetBinContent(fZDCCenVtxZ->FindBin(Centrality,fVtxPosCor[2],2.5));
798  QAImR -= fZDCCenVtxZ->GetBinContent(fZDCCenVtxZ->FindBin(Centrality,fVtxPosCor[2],3.5));
799  fZDCFlowVect[1]->Set(QAReR,QAImR);
800  }
801 
802  // after re-centering, cut on Q-vectors near zero *************************
803  if (sqrt(QCReR*QCReR+QCImR*QCImR)<1.E-6 || sqrt(QAReR*QAReR+QAImR*QAImR)<1.E-6) {
804  IsGoodEvent = kFALSE;
805  fEventCounter->Fill(4.5);
806  }
807 
808  }
809 
810  // fill QA plots *************************************************************
811 
812  if(IsGoodEvent) {
813 
814  fQVecCen[0][qb]->Fill(Centrality,QCReR);
815  fQVecCen[1][qb]->Fill(Centrality,QCImR);
816  fQVecCen[2][qb]->Fill(Centrality,QAReR);
817  fQVecCen[3][qb]->Fill(Centrality,QAImR);
818 
819  fQVecRbRCen[RunBin]->Fill(Centrality,0.5,QCReR);
820  fQVecRbRCen[RunBin]->Fill(Centrality,1.5,QCImR);
821  fQVecRbRCen[RunBin]->Fill(Centrality,2.5,QAReR);
822  fQVecRbRCen[RunBin]->Fill(Centrality,3.5,QAImR);
823 
824  fQVecVtx[0][qb]->Fill(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2],QCReR);
825  fQVecVtx[1][qb]->Fill(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2],QCImR);
826  fQVecVtx[2][qb]->Fill(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2],QAReR);
827  fQVecVtx[3][qb]->Fill(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2],QAImR);
828 
829  fQVecRbRVtxZ[RunBin]->Fill(Centrality,fVtxPos[2],0.5,QCReR);
830  fQVecRbRVtxZ[RunBin]->Fill(Centrality,fVtxPos[2],1.5,QCImR);
831  fQVecRbRVtxZ[RunBin]->Fill(Centrality,fVtxPos[2],2.5,QAReR);
832  fQVecRbRVtxZ[RunBin]->Fill(Centrality,fVtxPos[2],3.5,QAImR);
833 
834  fZDCQvec2Ddis[fCenBin][0]->Fill(QCReR,QCImR);
835  fZDCQvec2Ddis[fCenBin][1]->Fill(QAReR,QAImR);
836 
837  fQvecC2Ddis[qb]->Fill(QCReR,QCImR);
838  fQvecA2Ddis[qb]->Fill(QAReR,QAImR);
839 
840  // Double_t DeltaC = sqrt(pow(QCReR-QAReR,2.)+pow(QCImR-QAImR,2.));
841  // fQVecDeltaC[0][qb]->Fill(DeltaC,QCReR);
842  // fQVecDeltaC[1][qb]->Fill(DeltaC,QCImR);
843  // fQVecDeltaC[2][qb]->Fill(DeltaC,QAReR);
844  // fQVecDeltaC[3][qb]->Fill(DeltaC,QAImR);
845 
846  QAReR = -QAReR; // this is not a bug: QAReR --> -QAReR
847 
848  fQVecCorCen[0][qb]->Fill(Centrality,QCReR*QAReR);
849  fQVecCorCen[1][qb]->Fill(Centrality,QCImR*QAImR);
850  fQVecCorCen[2][qb]->Fill(Centrality,QAReR*QCImR);
851  fQVecCorCen[3][qb]->Fill(Centrality,QAImR*QCReR);
852 
853  // fQVecCorDeltaC[0][qb]->Fill(DeltaC,QCReR*QAReR);
854  // fQVecCorDeltaC[1][qb]->Fill(DeltaC,QCImR*QAImR);
855  // fQVecCorDeltaC[2][qb]->Fill(DeltaC,QAReR*QCImR);
856  // fQVecCorDeltaC[3][qb]->Fill(DeltaC,QAImR*QCReR);
857  }
858 
859  // pass ZDC Qvectors in output **********************************************
860 
861  Double_t xyZNCfinal[2]={fZDCFlowVect[0]->X(),fZDCFlowVect[0]->Y()};
862  Double_t xyZNAfinal[2]={-fZDCFlowVect[1]->X(),fZDCFlowVect[1]->Y()}; // this is not a bug: QAReR --> -QAReR
863  if(!IsGoodEvent) {
864  xyZNCfinal[0]=0.; xyZNCfinal[1]=0.;
865  xyZNAfinal[0]=0.; xyZNAfinal[1]=0.;
866  } else {
867  fEventCounter->Fill(1.5);
868  }
869  fFlowEvent->SetZDC2Qsub(xyZNCfinal,denZNC,xyZNAfinal,denZNA);
870 
871  // save run number
872  fCachedRunNum = RunNum;
873 
874  PostData(1, fFlowEvent);
875 }
876 
877 //=====================================================================
878 
880 {
881  QAX = fZDCFlowVect[1]->X();
882  QAY = fZDCFlowVect[1]->Y();
883  QCX = fZDCFlowVect[0]->X();
884  QCY = fZDCFlowVect[0]->Y();
885 }
886 
887 //=====================================================================
888 
890 {
891  Int_t CenBin=-1;
892  if (Centrality>0. && Centrality<5.) CenBin=0;
893  if (Centrality>5. && Centrality<10.) CenBin=1;
894  if (Centrality>10. && Centrality<20.) CenBin=2;
895  if (Centrality>20. && Centrality<30.) CenBin=3;
896  if (Centrality>30. && Centrality<40.) CenBin=4;
897  if (Centrality>40. && Centrality<50.) CenBin=5;
898  if (Centrality>50. && Centrality<60.) CenBin=6;
899  if (Centrality>60. && Centrality<70.) CenBin=7;
900  if (Centrality>70. && Centrality<80.) CenBin=8;
901  if (Centrality>80. && Centrality<90.) CenBin=9;
902  if (Centrality>90. && Centrality<100.) CenBin=10;
903  return CenBin;
904 } // end of AliAnalysisTaskZDCEP::GetCenBin(Double_t Centrality)
905 
906 //=====================================================================
907 
909 {
910 }
void GetZDCQVectors(Double_t QAX, Double_t QAY, Double_t QCX, Double_t QCY)
const Double_t ymax
Definition: AddTaskCFDStar.C:7
double Double_t
Definition: External.C:58
static const Int_t fnRunMax
Double_t fZDCGainAlpha
output list for QA histograms (slot 2)
virtual void SetZDC2Qsub(Double_t *QVC, Double_t MC, Double_t *QVA, Double_t MA)
void Centrality()
Double_t GetMult() const
Definition: AliFlowVector.h:46
TH2D * fZNATowerSpec[fCRCnTow]
ZNC tower spectra.
TH3D * fZDCQVecVtxCenEZDC3D[10][10][4]
TCanvas * c
Definition: TestFitELoss.C:172
AliFlowVector * fZDCFlowVect[2]
TProfile * fZNATower[fnRunMax][fCRCnTow]
ZNC tower spectra.
TH2D * fZNCTowerSpec[fCRCnTow]
ZNA tower spectra.
static const Int_t fCRCnTow
TArrayI fRunList
ZNA tower spectra.
virtual void Terminate(Option_t *option)
TList * fHistList
list containing ZDC q-vectors
TList * fQVecListRun[fnRunMax]
TProfile3D * fQVecRbRVtxZ[fnRunMax]
TList * fQAList
list for calibration histograms
int Int_t
Definition: External.C:63
virtual void UserCreateOutputObjects()
TProfile3D * fQVecVtx[4][2]
TH1D * fZDCVtxFitCenProjHist[4][3]
Definition: External.C:252
const Double_t zmin
void SetMult(Double_t mult)
Definition: AliFlowVector.h:45
Definition: External.C:228
Definition: External.C:212
AliAnalysisUtils * fAnalysisUtils
TProfile3D * fZDCVtxCenHistMagPol[10][8]
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
virtual void UserExec(Option_t *option)
TProfile2D * fQVecRbRCen[fnRunMax]
run-by-run list
TProfile * fQVecCorCen[4][2]
virtual Int_t GetCenBin(Double_t Centrality)
Int_t fCachedRunNum
ZDC q-vectors.
Definition: External.C:220
TProfile2D * fZDCEcomTotHist[4]
const Double_t ymin
Definition: AddTaskCFDStar.C:6
TProfile3D * fZDCVtxHist[4]
const char Option_t
Definition: External.C:48
const Double_t zmax
bool Bool_t
Definition: External.C:53
TProfile * fQVecCen[4][2]
QA list per magnet polarity.
TProfile * fZNCTower[fnRunMax][fCRCnTow]
AliMultSelection * fMultSelection
Definition: External.C:196
TProfile3D * fZDCVtxCenHist[10][4]