AliPhysics  a6017e1 (a6017e1)
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 fZDCGainAlpha(0.395),
80 fZDCCalibList(0x0),
81 fTowerEqList(0x0),
82 fCachedRunNum(0),
83 fAnalysisUtils(0x0),
84 fMultSelection(0x0),
85 fbFlagIsPosMagField(kFALSE),
86 fFlowEvent(NULL)
87 {
88  for(Int_t k=0; k<4; k++) {
89  fZDCQHist[k] = NULL;
90  fZDCVtxHist[k] = NULL;
91  fZDCEcomTotHist[k] = NULL;
92  for(Int_t c=0; c<10; c++) {
93  fZDCVtxCenHist[c][k] = NULL;
94  }
95  fZDCVtxFitHist[k] = NULL;
96  for(Int_t i=0; i<3; i++) {
97  fZDCVtxFitCenProjHist[k][i] = NULL;
98  }
99  }
100  for(Int_t c=0; c<10; c++) {
101  for(Int_t k=0; k<8; k++) {
102  fZDCVtxCenHistMagPol[c][k] = NULL;
103  }
104  }
105  for(Int_t i=0; i<10; i++) {
106  for(Int_t z=0; z<10; z++) {
107  for(Int_t k=0; k<4; k++) {
108  fZDCQVecVtxCenEZDC3D[i][z][k] = NULL;
109  }
110  }
111  }
112  for(Int_t c=0; c<2; c++) {
113  for(Int_t i=0; i<5; i++) {
114  fTowerGainEq[c][i] = NULL;
115  }
116  }
117  for (Int_t i=0; i<10; i++) {
118  fCRCZDCQVecDummyEZDCBins[i] = NULL;
119  }
120  for (Int_t i=0; i<2; i++) fZDCFlowVect[i] = NULL;
121 
122  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};
123  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};
124  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};
125  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};
126  for(Int_t r=0; r<fnRun; r++) {
127  fRunList[r] = dRun15o[r];
128  }
129  fAvVtxPosX=TArrayD(fnRun,dVtxPosX15o);
130  fAvVtxPosY=TArrayD(fnRun,dVtxPosY15o);
131  fAvVtxPosZ=TArrayD(fnRun,dVtxPosZ15o);
132 }
133 
134 //=====================================================================
135 
137 : AliAnalysisTaskSE(name),
138 fOutputList(0x0),
139 fHistList(0x0),
140 fZDCGainAlpha(0.395),
141 fZDCCalibList(0x0),
142 fTowerEqList(0x0),
143 fCachedRunNum(0),
144 fAnalysisUtils(0x0),
145 fMultSelection(0x0),
146 fbFlagIsPosMagField(kFALSE),
147 fFlowEvent(NULL)
148 {
149  for(Int_t k=0; k<4; k++) {
150  fZDCQHist[k] = NULL;
151  fZDCVtxHist[k] = NULL;
152  fZDCEcomTotHist[k] = NULL;
153  for(Int_t c=0; c<10; c++) {
154  fZDCVtxCenHist[c][k] = NULL;
155  }
156  fZDCVtxFitHist[k] = NULL;
157  for(Int_t i=0; i<3; i++) {
158  fZDCVtxFitCenProjHist[k][i] = NULL;
159  }
160  }
161  for(Int_t c=0; c<10; c++) {
162  for(Int_t k=0; k<8; k++) {
163  fZDCVtxCenHistMagPol[c][k] = NULL;
164  }
165  }
166  for(Int_t i=0; i<10; i++) {
167  for(Int_t z=0; z<10; z++) {
168  for(Int_t k=0; k<4; k++) {
169  fZDCQVecVtxCenEZDC3D[i][z][k] = NULL;
170  }
171  }
172  }
173  for(Int_t c=0; c<2; c++) {
174  for(Int_t i=0; i<5; i++) {
175  fTowerGainEq[c][i] = NULL;
176  }
177  }
178  for (Int_t i=0; i<10; i++) {
179  fCRCZDCQVecDummyEZDCBins[i] = NULL;
180  }
181  for (Int_t i=0; i<2; i++) fZDCFlowVect[i] = NULL;
182 
183  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};
184  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};
185  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};
186  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};
187  for(Int_t r=0; r<fnRun; r++) {
188  fRunList[r] = dRun15o[r];
189  }
190  fAvVtxPosX=TArrayD(fnRun,dVtxPosX15o);
191  fAvVtxPosY=TArrayD(fnRun,dVtxPosY15o);
192  fAvVtxPosZ=TArrayD(fnRun,dVtxPosZ15o);
193 
194  DefineInput(0,TChain::Class());
195  DefineOutput(1,AliFlowEventSimple::Class());
196 }
197 
198 //=====================================================================
199 
201 {
202  // Destructor
203  delete fOutputList;
204  delete fHistList;
205  delete fFlowEvent;
206  if(fAnalysisUtils) delete fAnalysisUtils;
207  if(fMultSelection) delete fMultSelection;
208 }
209 
210 //=====================================================================
211 
213 {
214  // create a new TList that OWNS its objects
215  fOutputList = new TList();
216  fOutputList->SetOwner(kTRUE);
217 
218  for(Int_t c=0;c<2;c++) {
219  fZDCFlowVect[c] = new AliFlowVector();
220  fOutputList->Add(fZDCFlowVect[c]);
221  }
222 
223  fHistList = new TList();
224  fHistList->SetOwner(kTRUE);
225 
226  for(Int_t k=0; k<4; k++) {
227  fZDCQHist[k] = new TProfile();
228  fHistList->Add(fZDCQHist[k]);
229  fZDCVtxHist[k] = new TProfile3D();
230  fHistList->Add(fZDCVtxHist[k]);
231  fZDCEcomTotHist[k] = new TProfile2D();
232  fHistList->Add(fZDCEcomTotHist[k]);
233  for(Int_t c=0; c<10; c++) {
234  fZDCVtxCenHist[c][k] = new TProfile3D();
235  fHistList->Add(fZDCVtxCenHist[c][k]);
236  }
237  fZDCVtxFitHist[k] = new TH3D();
238  fHistList->Add(fZDCVtxFitHist[k]);
239  for(Int_t i=0; i<3; i++) {
240  fZDCVtxFitCenProjHist[k][i] = new TH1D();
241  fHistList->Add(fZDCVtxFitCenProjHist[k][i]);
242  }
243  }
244  for(Int_t c=0; c<10; c++) {
245  for(Int_t k=0; k<8; k++) {
246  fZDCVtxCenHistMagPol[c][k] = new TProfile3D();
247  fHistList->Add(fZDCVtxCenHistMagPol[c][k]);
248  }
249  }
250  for(Int_t i=0; i<10; i++) {
251  for(Int_t z=0; z<10; z++) {
252  for(Int_t k=0; k<4; k++) {
253  fZDCQVecVtxCenEZDC3D[i][z][k] = new TH3D();
254  fHistList->Add(fZDCQVecVtxCenEZDC3D[i][z][k]);
255  }
256  }
257  }
258  for(Int_t c=0; c<2; c++) {
259  for(Int_t i=0; i<5; i++) {
260  fTowerGainEq[c][i] = new TH1D();
261  fHistList->Add(fTowerGainEq[c][i]);
262  }
263  }
264 
265  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}};
266  for (Int_t i=0; i<10; i++) {
267  fCRCZDCQVecDummyEZDCBins[i] = new TH1D(Form("fCRCZDCQVecDummyEZDCBins[%d]",i),Form("fCRCZDCQVecDummyEZDCBins[%d]",i),10,DummyEZDCBins[i]);
269  }
270 
271  fAnalysisUtils = new AliAnalysisUtils;
272  fAnalysisUtils->SetUseMVPlpSelection(kTRUE);
273  fAnalysisUtils->SetUseOutOfBunchPileUp(kTRUE);
274 
275  fFlowEvent = new AliFlowEvent(1);
276 }
277 
278 //=====================================================================
279 
281 {
282  // get an event from the analysis manager
283  AliAODEvent *aod = dynamic_cast<AliAODEvent*>(InputEvent());
284  if(!aod) return;
285  Float_t Centrality = 0.;
286  fMultSelection = (AliMultSelection*)aod->FindListObject("MultSelection");
287  if(!fMultSelection) {
288  AliWarning("WARNING: AliMultSelection object not found ! \n");
289  } else {
290  Centrality = fMultSelection->GetMultiplicityPercentile("V0M");
291  }
292  Int_t RunNum = aod->GetRunNumber();
293  Int_t RunBin=-1, bin=0;
294  for(Int_t c=0;c<fnRun;c++) {
295  if(fRunList[c]==RunNum) RunBin=bin;
296  else bin++;
297  }
298  if(RunBin==-1) return;
299  Int_t fCenBin = GetCenBin(Centrality);
300 
301  if(RunNum!=fCachedRunNum) {
302  fbFlagIsPosMagField = kFALSE;
303  Int_t dRun15hPos[] = {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};
304  for (Int_t i=0; i<40; i++) {
305  if(RunNum==dRun15hPos[i]) fbFlagIsPosMagField = kTRUE;
306  }
307  }
308 
309  // get primary vertex position
310  Double_t fVtxPos[3]={0.,0.,0.};
311  fVtxPos[0] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetX();
312  fVtxPos[1] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetY();
313  fVtxPos[2] = ((AliAODVertex*)aod->GetPrimaryVertex())->GetZ();
314  Double_t fVtxPosCor[3] = {fVtxPos[0]-fAvVtxPosX[RunBin],fVtxPos[1]-fAvVtxPosY[RunBin],fVtxPos[2]-fAvVtxPosZ[RunBin]};
315 
316  // zdc selection
317  AliAODZDC *aodZDC = aod->GetZDCData();
318 
319  const Double_t * towZNCraw = aodZDC->GetZNCTowerEnergy();
320  const Double_t * towZNAraw = aodZDC->GetZNATowerEnergy();
321 
322  // Get centroid from ZDCs *******************************************************
323 
324  Double_t Enucl = (RunNum < 209122 ? 1380. : 2511.);
325  Double_t xyZNC[2]={0.,0.}, xyZNA[2]={0.,0.};
326  Double_t towZNC[5]={0.}, towZNA[5]={0.};
327 
328  Double_t ZNCcalib=1., ZNAcalib=1.;
329 
330  // equalize gain of all towers
331  if(RunNum!=fCachedRunNum) {
332  for(Int_t i=0; i<5; i++) {
333  fTowerGainEq[0][i] = (TH1D*)(fTowerEqList->FindObject(Form("fZNCTower[%d][%d]",RunNum,i)));
334  fTowerGainEq[1][i] = (TH1D*)(fTowerEqList->FindObject(Form("fZNATower[%d][%d]",RunNum,i)));
335  }
336  }
337  for(Int_t i=0; i<5; i++) {
338  if(fTowerGainEq[0][i]) towZNC[i] = towZNCraw[i]*fTowerGainEq[0][i]->GetBinContent(fTowerGainEq[0][i]->FindBin(Centrality));
339  if(fTowerGainEq[1][i]) towZNA[i] = towZNAraw[i]*fTowerGainEq[1][i]->GetBinContent(fTowerGainEq[1][i]->FindBin(Centrality));
340  }
341 
342  if(RunNum>=245829) towZNA[2] = 0.;
343  Double_t zncEnergy=0., znaEnergy=0.;
344  for(Int_t i=0; i<5; i++){
345  zncEnergy += towZNC[i];
346  znaEnergy += towZNA[i];
347  }
348  if(RunNum>=245829) znaEnergy *= 8./7.;
349  Double_t fZNCen = towZNC[0]/Enucl;
350  Double_t fZNAen = towZNA[0]/Enucl;
351 
352  const Double_t x[4] = {-1.75, 1.75, -1.75, 1.75};
353  const Double_t y[4] = {-1.75, -1.75, 1.75, 1.75};
354  Double_t numXZNC=0., numYZNC=0., denZNC=0., cZNC, wZNC, EZNC, SumEZNC=0.;
355  Double_t numXZNA=0., numYZNA=0., denZNA=0., cZNA, wZNA, EZNA, SumEZNA=0., BadChOr;
356  Bool_t fAllChONZNC=kTRUE, fAllChONZNA=kTRUE;
357 
358  for(Int_t i=0; i<4; i++){
359  // get energy
360  EZNC = towZNC[i+1];
361  SumEZNC += EZNC;
362 
363  // build centroid
364  wZNC = TMath::Power(EZNC, fZDCGainAlpha);
365  numXZNC += x[i]*wZNC;
366  numYZNC += y[i]*wZNC;
367  denZNC += wZNC;
368 
369  // get energy
370  if(i==1) {
371  EZNA = towZNA[0]-towZNA[1]-towZNA[3]-towZNA[4];
372  } else {
373  EZNA = towZNA[i+1];
374  }
375  SumEZNA += EZNA;
376 
377  // build centroid
378  wZNA = TMath::Power(EZNA, fZDCGainAlpha);
379  numXZNA += x[i]*wZNA;
380  numYZNA += y[i]*wZNA;
381  denZNA += wZNA;
382  }
383  if(denZNC>0.){
384  Double_t nSpecnC = SumEZNC/Enucl;
385  cZNC = 1.89358-0.71262/(nSpecnC+0.71789);
386  xyZNC[0] = cZNC*numXZNC/denZNC;
387  xyZNC[1] = cZNC*numYZNC/denZNC;
388  denZNC *= cZNC;
389  }
390  else{
391  xyZNC[0] = xyZNC[1] = 0.;
392  }
393  if(denZNA>0.){
394  Double_t nSpecnA = SumEZNA/Enucl;
395  cZNA = 1.89358-0.71262/(nSpecnA+0.71789);
396  xyZNA[0] = cZNA*numXZNA/denZNA;
397  xyZNA[1] = cZNA*numYZNA/denZNA;
398  denZNA *= cZNA;
399  }
400  else{
401  xyZNA[0] = xyZNA[1] = 0.;
402  }
403 
404  fZDCFlowVect[0]->Set(xyZNC[0],xyZNC[1]);
405  fZDCFlowVect[1]->Set(xyZNA[0],xyZNA[1]);
406  fZDCFlowVect[0]->SetMult(denZNC);
407  fZDCFlowVect[1]->SetMult(denZNA);
408 
409  // RE-CENTER ZDC Q-VECTORS ***************************************************
410 
411  Int_t qb[4] = {0};
412  if(fbFlagIsPosMagField) { qb[0]=0; qb[1]=1; qb[2]=4; qb[3]=5; }
413  else { qb[0]=2; qb[1]=3; qb[2]=6; qb[3]=7; }
414 
415  // get re-centered QM*
416  // Double_t QMCrec = denZNC;
417  // Double_t QMArec = denZNA;
418  // if(fAvEZDCCRbRPro && fAvEZDCARbRPro) {
419  // Int_t runbin = fAvEZDCCRbRPro->GetXaxis()->FindBin(Form("%d",RunNum));
420  // Int_t cenbin = fAvEZDCCRbRPro->GetYaxis()->FindBin(Centrality);
421  // QMCrec -= fAvEZDCCRbRPro->GetBinContent(runbin,cenbin);
422  // QMArec -= fAvEZDCARbRPro->GetBinContent(runbin,cenbin);
423  // }
424 
425  Bool_t IsGoodEvent = kTRUE;
426 
427  if(fZDCCalibList) {
428  if(RunNum!=fCachedRunNum) {
429  // get histos of run
430  fZDCQHist[0] = (TProfile*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecC[%d][%d]",RunNum,0)));
431  fZDCQHist[1] = (TProfile*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecC[%d][%d]",RunNum,1)));
432  fZDCQHist[2] = (TProfile*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecA[%d][%d]",RunNum,0)));
433  fZDCQHist[3] = (TProfile*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecA[%d][%d]",RunNum,1)));
434 
435  for(Int_t k=0; k<4; k++) {
436  fZDCVtxHist[k] = (TProfile3D*)(fZDCCalibList->FindObject(Form("Run %d",RunNum))->FindObject(Form("fCRCZDCQVecVtxPos540[%d][%d]",RunNum,k)));
437 
438  fZDCEcomTotHist[k] = (TProfile2D*)(fZDCCalibList->FindObject(Form("fCRCZDCQVecEComTot[%d]",k)));
439  }
440 
441  for(Int_t c=0; c<10; c++) {
442  for(Int_t k=0; k<4; k++) {
443  fZDCVtxCenHist[c][k] = (TProfile3D*)(fZDCCalibList->FindObject(Form("fCRCZDCQVecVtxPosCen[%d][%d]",c,k)));
444  }
445  }
446 
447  for(Int_t k=0; k<4; k++) {
448  fZDCVtxFitHist[k] = (TH3D*)fZDCCalibList->FindObject(Form("TH3SlopeRunCenVtx[%d]",k));
449  if(fZDCVtxFitHist[k]) {
450  fZDCVtxFitHist[k]->Sumw2(kFALSE);
451  Int_t runbin = fZDCVtxFitHist[k]->GetXaxis()->FindBin(Form("%d",RunNum));
452  fZDCVtxFitHist[k]->GetXaxis()->SetRange(runbin,runbin);
453  for(Int_t i=0; i<3; i++) {
454  fZDCVtxFitHist[k]->GetZaxis()->SetRange(i+1,i+1);
455  fZDCVtxFitCenProjHist[k][i] = (TH1D*)fZDCVtxFitHist[k]->Project3D("y")->Clone(Form("proj[%d][%d]",k,i));
456  }
457  }
458  }
459 
460  for(Int_t c=0; c<10; c++) {
461  for(Int_t k=0; k<8; k++) {
462  fZDCVtxCenHistMagPol[c][k] = (TProfile3D*)(fZDCCalibList->FindObject(Form("fZDCVtxCenHistMagPol[%d][%d]",c,k)));
463  }
464  }
465 
466  // for(Int_t i=0; i<10; i++) {
467  // for(Int_t z=0; z<10; z++) {
468  // for(Int_t k=0; k<4; k++) {
469  // fZDCQVecVtxCenEZDC3D[i][z][k] = (TH3D*)(fZDCCalibList->FindObject(Form("ZDCQVecVtxCenEZDC3D[%d][%d][%d]",i,z,qb[k])));
470  // }
471  // }
472  // }
473 
474  }
475 
476  // ZDCN-C
477  Double_t QCRe = fZDCFlowVect[0]->X();
478  Double_t QCIm = fZDCFlowVect[0]->Y();
479  Double_t QMC = fZDCFlowVect[0]->GetMult();
480  // ZDCN-A
481  Double_t QARe = fZDCFlowVect[1]->X();
482  Double_t QAIm = fZDCFlowVect[1]->Y();
483  Double_t QMA = fZDCFlowVect[1]->GetMult();
484 
485  Double_t QCReR=QCRe, QCImR=QCIm, QAReR=QARe, QAImR=QAIm;
486 
487  // STEP #1: re-center vs centrality (1%) vs run number
488 
489  if (fZDCQHist[0]) {
490  Double_t AvQCRe = fZDCQHist[0]->GetBinContent(fZDCQHist[0]->FindBin(Centrality));
491  Double_t SDQCRe = fZDCQHist[0]->GetBinError(fZDCQHist[0]->FindBin(Centrality));
492  Double_t AvQCIm = fZDCQHist[1]->GetBinContent(fZDCQHist[1]->FindBin(Centrality));
493  Double_t SDQCIm = fZDCQHist[1]->GetBinError(fZDCQHist[1]->FindBin(Centrality));
494 
495  Double_t AvQARe = fZDCQHist[2]->GetBinContent(fZDCQHist[2]->FindBin(Centrality));
496  Double_t SDQARe = fZDCQHist[2]->GetBinError(fZDCQHist[2]->FindBin(Centrality));
497  Double_t AvQAIm = fZDCQHist[3]->GetBinContent(fZDCQHist[3]->FindBin(Centrality));
498  Double_t SDQAIm = fZDCQHist[3]->GetBinError(fZDCQHist[3]->FindBin(Centrality));
499 
500  if(AvQCRe && AvQCIm && QMC>0. && sqrt(QCRe*QCRe+QCIm*QCIm)>1.E-6) {
501  QCReR = QCRe-AvQCRe;
502  QCImR = QCIm-AvQCIm;
503  fZDCFlowVect[0]->Set(QCReR,QCImR);
504  }
505 
506  if(AvQARe && AvQAIm && QMA>0. && sqrt(QARe*QARe+QAIm*QAIm)>1.E-6) {
507  QAReR = QARe-AvQARe;
508  QAImR = QAIm-AvQAIm;
509  fZDCFlowVect[1]->Set(QAReR,QAImR);
510  }
511  }
512 
513  // STEP #2: re-center vs primary vtx vs centrality (10%)
514 
515  if (fZDCVtxCenHist[fCenBin][0]) {
516  Bool_t pass = kTRUE;
517  if(fVtxPosCor[0] < fZDCVtxCenHist[fCenBin][0]->GetXaxis()->GetXmin() || fVtxPosCor[0] > fZDCVtxCenHist[fCenBin][0]->GetXaxis()->GetXmax()) pass = kFALSE;
518  if(fVtxPosCor[1] < fZDCVtxCenHist[fCenBin][0]->GetYaxis()->GetXmin() || fVtxPosCor[1] > fZDCVtxCenHist[fCenBin][0]->GetYaxis()->GetXmax()) pass = kFALSE;
519  if(fVtxPosCor[2] < fZDCVtxCenHist[fCenBin][0]->GetZaxis()->GetXmin() || fVtxPosCor[2] > fZDCVtxCenHist[fCenBin][0]->GetZaxis()->GetXmax()) pass = kFALSE;
520  if(!pass) {
521  IsGoodEvent = kFALSE;
522  } else {
523  QCReR -= fZDCVtxCenHist[fCenBin][0]->GetBinContent(fZDCVtxCenHist[fCenBin][0]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
524  QCImR -= fZDCVtxCenHist[fCenBin][1]->GetBinContent(fZDCVtxCenHist[fCenBin][1]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
525  QAReR -= fZDCVtxCenHist[fCenBin][2]->GetBinContent(fZDCVtxCenHist[fCenBin][2]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
526  QAImR -= fZDCVtxCenHist[fCenBin][3]->GetBinContent(fZDCVtxCenHist[fCenBin][3]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
527  fZDCFlowVect[0]->Set(QCReR,QCImR);
528  fZDCFlowVect[1]->Set(QAReR,QAImR);
529  }
530  }
531 
532  // STEP #3: re-center vs primary vtx vs run number
533 
534  if (fZDCVtxHist[0]) {
535  QCReR -= fZDCVtxHist[0]->GetBinContent(fZDCVtxHist[0]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
536  QCImR -= fZDCVtxHist[1]->GetBinContent(fZDCVtxHist[1]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
537  fZDCFlowVect[0]->Set(QCReR,QCImR);
538  QAReR -= fZDCVtxHist[2]->GetBinContent(fZDCVtxHist[2]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
539  QAImR -= fZDCVtxHist[3]->GetBinContent(fZDCVtxHist[3]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
540  fZDCFlowVect[1]->Set(QAReR,QAImR);
541  }
542 
543  // STEP #4: re-center vs centrality vs energy in the common tower
544 
545  if(fZDCEcomTotHist[0]) {
546  QCReR -= fZDCEcomTotHist[0]->GetBinContent(fZDCEcomTotHist[0]->FindBin(Centrality,fZNCen));
547  QCImR -= fZDCEcomTotHist[1]->GetBinContent(fZDCEcomTotHist[1]->FindBin(Centrality,fZNCen));
548  fZDCFlowVect[0]->Set(QCReR,QCImR);
549  QAReR -= fZDCEcomTotHist[2]->GetBinContent(fZDCEcomTotHist[2]->FindBin(Centrality,fZNAen));
550  QAImR -= fZDCEcomTotHist[3]->GetBinContent(fZDCEcomTotHist[3]->FindBin(Centrality,fZNAen));
551  fZDCFlowVect[1]->Set(QAReR,QAImR);
552  }
553 
554  // STEP #5: re-center vs vtx vs cen vs run number (through fits)
555 
556  if(fZDCVtxFitHist[0]) {
557  for (Int_t i=0; i<3; i++) {
558  QCReR -= fVtxPosCor[i]*fZDCVtxFitCenProjHist[0][i]->Interpolate(Centrality);
559  QCImR -= fVtxPosCor[i]*fZDCVtxFitCenProjHist[1][i]->Interpolate(Centrality);
560  QAReR -= fVtxPosCor[i]*fZDCVtxFitCenProjHist[2][i]->Interpolate(Centrality);
561  QAImR -= fVtxPosCor[i]*fZDCVtxFitCenProjHist[3][i]->Interpolate(Centrality);
562  }
563  fZDCFlowVect[0]->Set(QCReR,QCImR);
564  fZDCFlowVect[1]->Set(QAReR,QAImR);
565  }
566 
567  // second iteration (2D)
568 
569  if (fZDCVtxCenHistMagPol[fCenBin][0]) {
570  if(fbFlagIsPosMagField) {
571  QCReR -= fZDCVtxCenHistMagPol[fCenBin][0]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][0]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
572  QCImR -= fZDCVtxCenHistMagPol[fCenBin][1]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][1]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
573  QAReR -= fZDCVtxCenHistMagPol[fCenBin][4]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][4]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
574  QAImR -= fZDCVtxCenHistMagPol[fCenBin][5]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][5]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
575  } else {
576  QCReR -= fZDCVtxCenHistMagPol[fCenBin][2]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][2]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
577  QCImR -= fZDCVtxCenHistMagPol[fCenBin][3]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][3]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
578  QAReR -= fZDCVtxCenHistMagPol[fCenBin][6]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][6]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
579  QAImR -= fZDCVtxCenHistMagPol[fCenBin][7]->GetBinContent(fZDCVtxCenHistMagPol[fCenBin][7]->FindBin(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]));
580  }
581  fZDCFlowVect[0]->Set(QCReR,QCImR);
582  fZDCFlowVect[1]->Set(QAReR,QAImR);
583  }
584 
585  // STEP #6: re-center vs centrality vs total energy vs vtx
586 
587  // Int_t EZDCCBin = fCRCZDCQVecDummyEZDCBins[fCenBin]->GetXaxis()->FindBin(QMCrec)-1;
588  // Int_t EZDCABin = fCRCZDCQVecDummyEZDCBins[fCenBin]->GetXaxis()->FindBin(QMArec)-1;
589  //
590  // if(fZDCQVecVtxCenEZDC3D[0][0][0]) {
591  // printf("doing step 6 \n");
592  // Bool_t pass2=kTRUE;
593  // // exclude events with vtx outside of range
594  // if(fVtxPosCor[0] < fZDCQVecVtxCenEZDC3D[0][0][0]->GetXaxis()->GetXmin() || fVtxPosCor[0] > fZDCQVecVtxCenEZDC3D[0][0][0]->GetXaxis()->GetXmax()) pass2 = kFALSE;
595  // if(fVtxPosCor[1] < fZDCQVecVtxCenEZDC3D[0][0][0]->GetYaxis()->GetXmin() || fVtxPosCor[1] > fZDCQVecVtxCenEZDC3D[0][0][0]->GetYaxis()->GetXmax()) pass2 = kFALSE;
596  // if(fVtxPosCor[2] < fZDCQVecVtxCenEZDC3D[0][0][0]->GetZaxis()->GetXmin() || fVtxPosCor[2] > fZDCQVecVtxCenEZDC3D[0][0][0]->GetZaxis()->GetXmax()) pass2 = kFALSE;
597  // // exclude events with very low or very high total energy
598  // if(fabs(QMCrec)>100. || fabs(QMArec)>100.) pass2 = kFALSE;
599  // // get EZDC bin
600  // Int_t EZDCCBin = fCRCZDCQVecDummyEZDCBins[fCenBin]->GetXaxis()->FindBin(QMCrec)-1;
601  // Int_t EZDCABin = fCRCZDCQVecDummyEZDCBins[fCenBin]->GetXaxis()->FindBin(QMArec)-1;
602  // if(EZDCCBin<0) EZDCCBin=0;
603  // if(EZDCCBin>9) EZDCCBin=9;
604  // if(EZDCABin<0) EZDCABin=0;
605  // if(EZDCABin>9) EZDCABin=9;
606  // if(pass2) {
607  // // check if possible to interpolate
608  // Bool_t bInterp = kTRUE;
609  // Int_t bx = fZDCQVecVtxCenEZDC3D[0][0][0]->GetXaxis()->FindBin(fVtxPosCor[0]);
610  // Int_t by = fZDCQVecVtxCenEZDC3D[0][0][0]->GetYaxis()->FindBin(fVtxPosCor[1]);
611  // Int_t bz = fZDCQVecVtxCenEZDC3D[0][0][0]->GetZaxis()->FindBin(fVtxPosCor[2]);
612  // if(bx==1 || bx==fZDCQVecVtxCenEZDC3D[0][0][0]->GetXaxis()->GetNbins()) bInterp = kFALSE;
613  // if(by==1 || by==fZDCQVecVtxCenEZDC3D[0][0][0]->GetYaxis()->GetNbins()) bInterp = kFALSE;
614  // if(bz==1 || bz==fZDCQVecVtxCenEZDC3D[0][0][0]->GetZaxis()->GetNbins()) bInterp = kFALSE;
615  // if(bInterp) {
616  // QCReR -= fZDCQVecVtxCenEZDC3D[fCenBin][EZDCCBin][0]->Interpolate(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]);
617  // QCImR -= fZDCQVecVtxCenEZDC3D[fCenBin][EZDCCBin][1]->Interpolate(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]);
618  // QAReR -= fZDCQVecVtxCenEZDC3D[fCenBin][EZDCABin][2]->Interpolate(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]);
619  // QAImR -= fZDCQVecVtxCenEZDC3D[fCenBin][EZDCABin][3]->Interpolate(fVtxPosCor[0],fVtxPosCor[1],fVtxPosCor[2]);
620  // } else {
621  // QCReR -= fZDCQVecVtxCenEZDC3D[fCenBin][EZDCCBin][0]->GetBinContent(bx,by,bz);
622  // QCImR -= fZDCQVecVtxCenEZDC3D[fCenBin][EZDCCBin][1]->GetBinContent(bx,by,bz);
623  // QAReR -= fZDCQVecVtxCenEZDC3D[fCenBin][EZDCABin][2]->GetBinContent(bx,by,bz);
624  // QAImR -= fZDCQVecVtxCenEZDC3D[fCenBin][EZDCABin][3]->GetBinContent(bx,by,bz);
625  // }
626  // } else {
627  // IsGoodEvent = kFALSE;
628  // }
629  // }
630 
631  } else {
632  printf("WARNING: no list provided for ZDC Q-vector re-centering ! \n");
633  }
634 
635  Double_t xyZNCfinal[2]={fZDCFlowVect[0]->X(),fZDCFlowVect[0]->Y()};
636  Double_t xyZNAfinal[2]={-fZDCFlowVect[1]->X(),fZDCFlowVect[1]->Y()}; // this is not a bug: QAReR --> -QAReR
637  if(!IsGoodEvent) {
638  xyZNCfinal[0]=0.; xyZNCfinal[1]=0.;
639  xyZNAfinal[0]=0.; xyZNAfinal[1]=0.;
640  }
641  fFlowEvent->SetZDC2Qsub(xyZNCfinal,denZNC,xyZNAfinal,denZNA);
642 
643  // save run number
644  fCachedRunNum = RunNum;
645 
646  PostData(1, fFlowEvent);
647 }
648 
649 //=====================================================================
650 
652 {
653  QAX = fZDCFlowVect[1]->X();
654  QAY = fZDCFlowVect[1]->Y();
655  QCX = fZDCFlowVect[0]->X();
656  QCY = fZDCFlowVect[0]->Y();
657 }
658 
659 //=====================================================================
660 
662 {
663  Int_t CenBin=-1;
664  if (Centrality>0. && Centrality<5.) CenBin=0;
665  if (Centrality>5. && Centrality<10.) CenBin=1;
666  if (Centrality>10. && Centrality<20.) CenBin=2;
667  if (Centrality>20. && Centrality<30.) CenBin=3;
668  if (Centrality>30. && Centrality<40.) CenBin=4;
669  if (Centrality>40. && Centrality<50.) CenBin=5;
670  if (Centrality>50. && Centrality<60.) CenBin=6;
671  if (Centrality>60. && Centrality<70.) CenBin=7;
672  if (Centrality>70. && Centrality<80.) CenBin=8;
673  if (Centrality>80. && Centrality<90.) CenBin=9;
674  if (Centrality>90. && Centrality<100.) CenBin=10;
675  return CenBin;
676 } // end of AliAnalysisTaskZDCEP::GetCenBin(Double_t Centrality)
677 
678 //=====================================================================
679 
681 {
682 }
683 
684 
void GetZDCQVectors(Double_t QAX, Double_t QAY, Double_t QCX, Double_t QCY)
double Double_t
Definition: External.C:58
Double_t fZDCGainAlpha
output list containing QA histograms
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
TH3D * fZDCQVecVtxCenEZDC3D[10][10][4]
TCanvas * c
Definition: TestFitELoss.C:172
AliFlowVector * fZDCFlowVect[2]
virtual void Terminate(Option_t *option)
TList * fHistList
output list containing ZDC q-vectors
int Int_t
Definition: External.C:63
virtual void UserCreateOutputObjects()
TH1D * fZDCVtxFitCenProjHist[4][3]
float Float_t
Definition: External.C:68
Definition: External.C:252
void SetMult(Double_t mult)
Definition: AliFlowVector.h:45
Definition: External.C:212
AliAnalysisUtils * fAnalysisUtils
TProfile3D * fZDCVtxCenHistMagPol[10][8]
TArrayD fAvVtxPosX
run-by-run list
virtual void UserExec(Option_t *option)
virtual Int_t GetCenBin(Double_t Centrality)
Int_t fCachedRunNum
ZDC q-vectors.
Definition: External.C:220
TProfile2D * fZDCEcomTotHist[4]
static const Int_t fnRun
TProfile3D * fZDCVtxHist[4]
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
AliMultSelection * fMultSelection
Definition: External.C:196
TProfile3D * fZDCVtxCenHist[10][4]