making task compatible with AOD analysis and cosmetics
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliAnalysisTaskEMCALPi0V2ShSh.cxx
CommitLineData
fc0f5568 1// $Id: AliAnalysisTaskEMCALPi0V2ShSh.cxx$
2
3#include "AliAnalysisTaskEMCALPi0V2ShSh.h"
4
5//Root include files
6//#include <Riostream.h>
7#include <TParticle.h>
8#include <TRefArray.h>
9#include <TCanvas.h>
10#include <TChain.h>
11#include <TFile.h>
12#include <TH1F.h>
13#include <TH1D.h>
14#include <TH2F.h>
15#include <THnSparse.h>
16#include <TList.h>
17#include <TMath.h>
18#include <TVirtualFFT.h>
19
20//AliRoot include files
21#include "AliAnalysisTaskSE.h"
22#include "AliRunLoader.h"
23#include "AliAnalysisManager.h"
24#include "AliAnalysisTask.h"
25#include "AliStack.h"
c4a4ee27 26#include "AliEMCALGeometry.h"
fc0f5568 27#include "AliESDEvent.h"
28#include "AliESDVertex.h"
c4a4ee27 29#include "AliESDCaloCells.h"
fc0f5568 30#include "AliESDCaloCluster.h"
31#include "AliESDEvent.h"
32#include "AliESDHeader.h"
33#include "AliESDInputHandler.h"
34#include "AliESDtrack.h"
35#include "AliKFParticle.h"
c4a4ee27 36#include "AliAODEvent.h"
fc0f5568 37#include "AliVCluster.h"
38#include "AliCentrality.h"
39#include "AliEventplane.h"
c4a4ee27 40#include "AliOADBContainer.h"
fc0f5568 41
42
43
44ClassImp(AliAnalysisTaskEMCALPi0V2ShSh)
45
46//________________________________________________________________________
47AliAnalysisTaskEMCALPi0V2ShSh::AliAnalysisTaskEMCALPi0V2ShSh() :
48 AliAnalysisTaskSE(),
c4a4ee27 49 fEventPlane(0),
50 fCentralityV0M(99.),
51 fESDClusters(0),
52 fAODClusters(0),
53 fCaloClusters(0),
54 fESDCells(0),
55 fAODCells(0),
56 fGeom(0),
57 fGeoName("EMCAL_COMPLETEV1"),
58 fOADBContainer(0),
59 fESD(0),
60 fAOD(0),
61 fOutputList(0),
62 fEPTPC(-999.),
63 fEPTPCResolution(0.),
64 fEPV0(-999.),
65 fEPV0A(-999.),
66 fEPV0C(-999.),
67 fEPV0Ar(-999.),
68 fEPV0Cr(-999.),
69 fEPV0r(-999.),
70 fEPV0A4r(-999.),
71 fEPV0A5r(-999.),
72 fEPV0A6r(-999.),
73 fEPV0A7r(-999.),
74 fEPV0C0r(-999.),
75 fEPV0C1r(-999.),
76 fEPV0C2r(-999.),
77 fEPV0C3r(-999.),
78 fHistAllcentV0(0),
79 fHistAllcentV0r(0),
80 fHistAllcentV0A(0),
81 fHistAllcentV0C(0),
82 fHistAllcentTPC(0),
83 fHistEPTPC(0),
84 fHistEPTPCResolution(0),
85 fHistEPV0(0),
86 fHistEPV0A(0),
87 fHistEPV0C(0),
88 fHistEPV0Ar(0),
89 fHistEPV0Cr(0),
90 fHistEPV0r(0),
91 fHistEPV0A4r(0),
92 fHistEPV0A7r(0),
93 fHistEPV0C0r(0),
94 fHistEPV0C3r(0),
95 fHistdifV0A_V0C0r(0),
96 fHistdifV0A_V0C3r(0),
97 fHistdifV0C0r_V0C3r(0),
98 fHistdifV0C_V0A4r(0),
99 fHistdifV0C_V0A7r(0),
100 fHistdifV0A4r_V0A7r(0),
101 fHistdifV0Ar_V0Cr(0),
102 fHistClusterEta(0),
103 fHistClusterPhi(0),
104 fHistClusterE(0),
105 fHistClusterEt(0),
106 fHistClusterN(0),
107 fHistClusterM02(0),
108 fHistClusterEN(0),
109 fHistClusterEM02(0),
110 fHistClusterPhiEta(0),
111 fHistClusterEtN(0),
112 fHistClusterEtM02(0),
113 fHistClusterdphiV0(0),
114 fHistTrackPt(0),
115 fHistTrackEta(0),
116 fHistTrackPhi(0),
117 fHistTrackPhiEta(0),
118 fClusterPbV0(0),
119 fClusterPbV0A(0),
120 fClusterPbV0C(0),
121 fClusterPbTPC(0)
fc0f5568 122{
123 // Default constructor.
c4a4ee27 124 for(Int_t i = 0; i < 12; i++) fGeomMatrix[i] = 0;
fc0f5568 125}
126
127//________________________________________________________________________
128AliAnalysisTaskEMCALPi0V2ShSh::AliAnalysisTaskEMCALPi0V2ShSh(const char *name) :
129 AliAnalysisTaskSE(name),
c4a4ee27 130 fEventPlane(0),
131 fCentralityV0M(99.),
132 fESDClusters(0),
133 fAODClusters(0),
134 fCaloClusters(0),
135 fESDCells(0),
136 fAODCells(0),
137 fGeom(0),
138 fGeoName("EMCAL_COMPLETEV1"),
139 fOADBContainer(0),
140 fESD(0),
141 fAOD(0),
142 fOutputList(0),
143 fEPTPC(-999.),
144 fEPTPCResolution(0.),
145 fEPV0(-999.),
146 fEPV0A(-999.),
147 fEPV0C(-999.),
148 fEPV0Ar(-999.),
149 fEPV0Cr(-999.),
150 fEPV0r(-999.),
151 fEPV0A4r(-999.),
152 fEPV0A5r(-999.),
153 fEPV0A6r(-999.),
154 fEPV0A7r(-999.),
155 fEPV0C0r(-999.),
156 fEPV0C1r(-999.),
157 fEPV0C2r(-999.),
158 fEPV0C3r(-999.),
159 fHistAllcentV0(0),
160 fHistAllcentV0r(0),
161 fHistAllcentV0A(0),
162 fHistAllcentV0C(0),
163 fHistAllcentTPC(0),
164 fHistEPTPC(0),
165 fHistEPTPCResolution(0),
166 fHistEPV0(0),
167 fHistEPV0A(0),
168 fHistEPV0C(0),
169 fHistEPV0Ar(0),
170 fHistEPV0Cr(0),
171 fHistEPV0r(0),
172 fHistEPV0A4r(0),
173 fHistEPV0A7r(0),
174 fHistEPV0C0r(0),
175 fHistEPV0C3r(0),
176 fHistdifV0A_V0C0r(0),
177 fHistdifV0A_V0C3r(0),
178 fHistdifV0C0r_V0C3r(0),
179 fHistdifV0C_V0A4r(0),
180 fHistdifV0C_V0A7r(0),
181 fHistdifV0A4r_V0A7r(0),
182 fHistdifV0Ar_V0Cr(0),
183 fHistClusterEta(0),
184 fHistClusterPhi(0),
185 fHistClusterE(0),
186 fHistClusterEt(0),
187 fHistClusterN(0),
188 fHistClusterM02(0),
189 fHistClusterEN(0),
190 fHistClusterEM02(0),
191 fHistClusterPhiEta(0),
192 fHistClusterEtN(0),
193 fHistClusterEtM02(0),
194 fHistClusterdphiV0(0),
195 fHistTrackPt(0),
196 fHistTrackEta(0),
197 fHistTrackPhi(0),
198 fHistTrackPhiEta(0),
199 fClusterPbV0(0),
200 fClusterPbV0A(0),
201 fClusterPbV0C(0),
202 fClusterPbTPC(0)
fc0f5568 203{
204 // Constructor
205 // Define input and output slots here
206 // Input slot #0 works with a TChain
207 DefineInput(0, TChain::Class());
208 // Output slot #0 id reserved by the base class for AOD
209 // Output slot #1 writes into a TH1 container
210 DefineOutput(1, TList::Class());
211}
212
213//________________________________________________________________________
214void AliAnalysisTaskEMCALPi0V2ShSh::UserCreateOutputObjects()
215{
216 // Create histograms, called once.
217
c4a4ee27 218 fESDClusters = new TObjArray();
219 fAODClusters = new TObjArray();
fc0f5568 220 fCaloClusters = new TRefArray();
c4a4ee27 221 fGeom = AliEMCALGeometry::GetInstance(fGeoName.Data());
222 fOADBContainer = new AliOADBContainer("AliEMCALgeo");
223 fOADBContainer->InitFromFile(Form("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root"),"AliEMCALgeo");
fc0f5568 224
225 fOutputList = new TList();
226 fOutputList->SetOwner();// Container cleans up all histos (avoids leaks in merging)
227
228 fHistTrackPt = new TH1F("fHistTrackPt","Track Transverse Momentum Distribution of Pb+Pb",100,0.0,30.0);
229 fHistTrackPt->GetYaxis()->SetTitle("Entries"); fHistTrackPt->GetXaxis()->SetTitle("P_{t} [GeV/c]");
230 fOutputList->Add(fHistTrackPt);
231
232 fHistTrackEta = new TH1F("fHistTrackEta","Track Pseudorapidity Distribution of Pb+Pb",100,-1.0,1.0);
233 fHistTrackEta->GetYaxis()->SetTitle("Entries"); fHistTrackEta->GetXaxis()->SetTitle("#eta");
234 fOutputList->Add(fHistTrackEta);
235
236 fHistTrackPhi = new TH1F("fHistTrackPhi","Track #phi Distribution of Pb+Pb",100,0.0,6.29);
237 fHistTrackPhi->GetYaxis()->SetTitle("Entries"); fHistTrackPhi->GetXaxis()->SetTitle("#phi [rad]");
238 fOutputList->Add(fHistTrackPhi);
239
240 fHistTrackPhiEta = new TH2F("fHistTrackPhiEta","Track Pseudorapidity vs #phi of Pb+Pb",100,-1.0,1.0,100,0.0,6.29);
241 fHistTrackPhiEta->GetXaxis()->SetTitle("#eta"); fHistTrackPhiEta->GetYaxis()->SetTitle("#phi [rad]");
242 fOutputList->Add(fHistTrackPhiEta);
243
244 fHistClusterEta = new TH1F("fHistClusterEta","Cluster Pseudorapidity Distribution of Pb+Pb",100,-1.0,1.0);
245 fHistClusterEta->GetYaxis()->SetTitle("Entries"); fHistClusterEta->GetXaxis()->SetTitle("#eta");
246 fOutputList->Add(fHistClusterEta);
247
248 fHistClusterPhi = new TH1F("fHistClusterPhi","Cluster #phi Distribution of Pb+Pb",100,0.0,6.29);
249 fHistClusterPhi->GetYaxis()->SetTitle("Entries"); fHistClusterPhi->GetXaxis()->SetTitle("#phi [rad]");
250 fOutputList->Add(fHistClusterPhi);
251
252 fHistClusterPhiEta = new TH2F("fHistClusterPhiEta","Cluster Pseudorapidity vs #phi of Pb+Pb",100,-1.0,1.0,100,0.0,6.29);
253 fHistClusterPhiEta->GetXaxis()->SetTitle("#eta"); fHistClusterPhiEta->GetYaxis()->SetTitle("#phi [rad]");
254 fOutputList->Add(fHistClusterPhiEta);
255
256 fHistClusterM02 = new TH1F("fHistClusterM02","Cluster M02 Distribution of Pb+Pb",100,0.0,3.0);
257 fHistClusterM02->GetYaxis()->SetTitle("Entries"); fHistClusterM02->GetXaxis()->SetTitle("M02");
258 fOutputList->Add(fHistClusterM02);
259
260 fHistClusterE = new TH1F("fHistClusterE","Cluster Energy Distribution of Pb+Pb",100,0.0,20.0);
261 fHistClusterE->GetYaxis()->SetTitle("Entries"); fHistClusterE->GetXaxis()->SetTitle("Energy [GeV]");
262 fOutputList->Add(fHistClusterE);
263
264 fHistClusterEt = new TH1F("fHistClusterEt","Cluster Transverse Energy Distribution of Pb+Pb",100,0.0,20.0);
265 fHistClusterEt->GetYaxis()->SetTitle("Entries"); fHistClusterEt->GetXaxis()->SetTitle("Transverse Energy [GeV]");
266 fOutputList->Add(fHistClusterEt);
267
268 fHistClusterEM02 = new TH2F("fHistClusterEM02","Cluster Energy vs M02 of Pb+Pb",100,0.0,20.0,100,0.0,3.0);
269 fHistClusterEM02->GetYaxis()->SetTitle("M02"); fHistClusterEM02->GetXaxis()->SetTitle("Energy [GeV]");
270 fOutputList->Add(fHistClusterEM02);
271
272 fHistClusterEtM02 = new TH2F("fHistClusterEtM02","Cluster Transverse Energy vs M02 of Pb+Pb",100,0.0,20.0,100,0.0,3.0);
273 fHistClusterEtM02->GetYaxis()->SetTitle("M02"); fHistClusterEtM02->GetXaxis()->SetTitle("Transverse Energy [GeV]");
274 fOutputList->Add(fHistClusterEtM02);
275
276 fHistClusterN = new TH1F("fHistClusterN","Cluster N Distribution of Pb+Pb",30,0.0,30.0);
277 fHistClusterN->GetYaxis()->SetTitle("Entries"); fHistClusterN->GetXaxis()->SetTitle("N");
278 fOutputList->Add(fHistClusterN);
279
280 fHistClusterEN = new TH2F("fHistClusterEN","N vs Cluster Energy of Pb+Pb",100,0.0,20.0,30,0.0,30.0);
281 fHistClusterEN->GetYaxis()->SetTitle("N"); fHistClusterEN->GetXaxis()->SetTitle("Energy [GeV]");
282 fOutputList->Add(fHistClusterEN);
283
284 fHistClusterEtN = new TH2F("fHistClusterEtN","N vs Cluster Transverse Energy of Pb+Pb",100,0.0,20.0,30,0.0,30.0);
285 fHistClusterEtN->GetYaxis()->SetTitle("N"); fHistClusterEtN->GetXaxis()->SetTitle("Transverse Energy [GeV]");
286 fOutputList->Add(fHistClusterEtN);
287
288 fHistClusterdphiV0 = new TH1D("fHistClusterdphiV0","Cluster dphiV0 Distribution of Pb+Pb",100,0.0,TMath::Pi());
289 fHistClusterdphiV0->GetYaxis()->SetTitle("Entries"); fHistClusterdphiV0->GetXaxis()->SetTitle("dphiV0 [rad]");
290 fOutputList->Add(fHistClusterdphiV0);
291
292 fHistEPV0 = new TH2F("fHistEPV0","V0 Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
293 fHistEPV0->GetYaxis()->SetTitle("V0 Event Plane Angle [rad]"); fHistEPV0->GetXaxis()->SetTitle("V0M Centrality");
294 fOutputList->Add(fHistEPV0);
295
296 fHistEPV0A = new TH2F("fHistEPV0A","V0A Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
297 fHistEPV0A->GetYaxis()->SetTitle("V0A Event Plane Angle [rad]"); fHistEPV0A->GetXaxis()->SetTitle("V0M Centrality");
298 fOutputList->Add(fHistEPV0A);
299
300 fHistEPV0C = new TH2F("fHistEPV0","V0C Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
301 fHistEPV0C->GetYaxis()->SetTitle("V0C Event Plane Angle [rad]"); fHistEPV0C->GetXaxis()->SetTitle("V0M Centrality");
302 fOutputList->Add(fHistEPV0C);
303
304 fHistEPV0r = new TH2F("fHistEPV0r","V0r Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
305 fHistEPV0r->GetYaxis()->SetTitle("V0r Event Plane Angle [rad]"); fHistEPV0r->GetXaxis()->SetTitle("V0M Centrality");
306 fOutputList->Add(fHistEPV0r);
307
308 fHistEPV0Ar = new TH2F("fHistEPV0","V0Ar Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
309 fHistEPV0Ar->GetYaxis()->SetTitle("V0Ar Event Plane Angle [rad]"); fHistEPV0Ar->GetXaxis()->SetTitle("V0M Centrality");
310 fOutputList->Add(fHistEPV0Ar);
311
312 fHistEPV0Cr = new TH2F("fHistEPV0Cr","V0Cr Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
313 fHistEPV0Cr->GetYaxis()->SetTitle("V0Cr Event Plane Angle [rad]"); fHistEPV0Cr->GetXaxis()->SetTitle("V0M Centrality");
314 fOutputList->Add(fHistEPV0Cr);
315
316 fHistEPV0A4r = new TH2F("fHistEPV0Cr","V0A4r Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
317 fHistEPV0A4r->GetYaxis()->SetTitle("V0A4r Event Plane Angle [rad]"); fHistEPV0A4r->GetXaxis()->SetTitle("V0M Centrality");
318 fOutputList->Add(fHistEPV0A4r);
319
320 fHistEPV0A7r = new TH2F("fHistEPV0Cr","V0A7r Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
321 fHistEPV0A7r->GetYaxis()->SetTitle("V0A7r Event Plane Angle [rad]"); fHistEPV0A7r->GetXaxis()->SetTitle("V0M Centrality");
322 fOutputList->Add(fHistEPV0A7r);
323
324 fHistEPV0C0r = new TH2F("fHistEPV0Cr","V0C0r Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
325 fHistEPV0C0r->GetYaxis()->SetTitle("V0C0r Event Plane Angle [rad]"); fHistEPV0C0r->GetXaxis()->SetTitle("V0M Centrality");
326 fOutputList->Add(fHistEPV0C0r);
327
328 fHistEPV0C3r = new TH2F("fHistEPV0Cr","V0C3r Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
329 fHistEPV0C3r->GetYaxis()->SetTitle("V0C3r Event Plane Angle [rad]"); fHistEPV0C3r->GetXaxis()->SetTitle("V0M Centrality");
330 fOutputList->Add(fHistEPV0C3r);
331
332 fHistdifV0A_V0C0r = new TH2F("fHistdifV0A_V0C0r","(V0A - V0C0r) vs Centrality of Pb+Pb",100,0,100,100,-1.0,1.0);
333 fHistdifV0A_V0C0r->GetYaxis()->SetTitle("Cos[2*(V0A - V0C0r)]"); fHistdifV0A_V0C0r->GetXaxis()->SetTitle("V0M Centrality");
334 fOutputList->Add(fHistdifV0A_V0C0r);
335
336 fHistdifV0A_V0C3r = new TH2F("fHistdifV0A_V0C3r","(V0A - V0C3r) vs Centrality of Pb+Pb",100,0,100,100,-1.0,1.0);
337 fHistdifV0A_V0C3r->GetYaxis()->SetTitle("Cos[2*(V0A - V0C3r)]"); fHistdifV0A_V0C3r->GetXaxis()->SetTitle("V0M Centrality");
338 fOutputList->Add(fHistdifV0A_V0C3r);
339
340 fHistdifV0C0r_V0C3r = new TH2F("fHistdifV0C0r_V0C3r","(V0C0r - V0C3r) vs Centrality of Pb+Pb",100,0,100,100,-1.0,1.0);
341 fHistdifV0C0r_V0C3r->GetYaxis()->SetTitle("Cos[2*(V0C0r - V0C3r)]"); fHistdifV0C0r_V0C3r->GetXaxis()->SetTitle("V0M Centrality");
342 fOutputList->Add(fHistdifV0C0r_V0C3r);
343
344 fHistdifV0C_V0A4r = new TH2F("fHistdifV0C_V0A4r","(V0C - V0A4r) vs Centrality of Pb+Pb",100,0,100,100,-1.0,1.0);
345 fHistdifV0C_V0A4r->GetYaxis()->SetTitle("Cos[2*(V0C - V0C4r)]"); fHistdifV0C_V0A4r->GetXaxis()->SetTitle("V0M Centrality");
346 fOutputList->Add(fHistdifV0C_V0A4r);
347
348 fHistdifV0C_V0A7r = new TH2F("fHistdifV0C_V0A3r","(V0C - V0A7r) vs Centrality of Pb+Pb",100,0,100,100,-1.0,1.0);
349 fHistdifV0C_V0A7r->GetYaxis()->SetTitle("Cos[2*(V0C - V0A7r)]"); fHistdifV0C_V0A7r->GetXaxis()->SetTitle("V0M Centrality");
350 fOutputList->Add(fHistdifV0C_V0A7r);
351
352 fHistdifV0A4r_V0A7r = new TH2F("fHistdifV0A4r_V0A7r","(V0A4r - V0A7r) vs Centrality of Pb+Pb",100,0,100,100,-1.0,1.0);
353 fHistdifV0A4r_V0A7r->GetYaxis()->SetTitle("Cos[2*(V0A4r - V0A7r)]"); fHistdifV0A4r_V0A7r->GetXaxis()->SetTitle("V0M Centrality");
354 fOutputList->Add(fHistdifV0A4r_V0A7r);
355
356 fHistdifV0Ar_V0Cr = new TH2F("fHistdifV0Ar_V0Cr","(V0Ar - V0Cr) vs Centrality of Pb+Pb",100,0,100,100,-1.0,1.0);
357 fHistdifV0Ar_V0Cr->GetYaxis()->SetTitle("Cos[2*(V0Ar - V0Cr)]"); fHistdifV0Ar_V0Cr->GetXaxis()->SetTitle("V0M Centrality");
358 fOutputList->Add(fHistdifV0Ar_V0Cr);
359
360 fHistAllcentV0 = new TH1F("fHistAllcentV0","V0 Event Plane Angle of Pb+Pb",100,0.0,TMath::Pi());
361 fHistAllcentV0->GetXaxis()->SetTitle("V0 Event Plane Angle [rad]"); fHistAllcentV0->GetYaxis()->SetTitle("");
362 fOutputList->Add(fHistAllcentV0);
363
364 fHistAllcentV0r = new TH1F("fHistAllcentV0r","V0r Event Plane Angle of Pb+Pb",100,0.0,TMath::Pi());
365 fHistAllcentV0r->GetXaxis()->SetTitle("V0r Event Plane Angle [rad]"); fHistAllcentV0r->GetYaxis()->SetTitle("");
366 fOutputList->Add(fHistAllcentV0r);
367
368 fHistAllcentV0A = new TH1F("fHistAllcentV0A","V0A Event Plane Angle of Pb+Pb",100,0.0,TMath::Pi());
369 fHistAllcentV0A->GetXaxis()->SetTitle("V0A Event Plane Angle [rad]"); fHistAllcentV0A->GetYaxis()->SetTitle("");
370 fOutputList->Add(fHistAllcentV0A);
371
372 fHistAllcentV0C = new TH1F("fHistAllcentV0C","V0C Event Plane Angle of Pb+Pb",100,0.0,TMath::Pi());
373 fHistAllcentV0C->GetXaxis()->SetTitle("V0C Event Plane Angle [rad]"); fHistAllcentV0C->GetYaxis()->SetTitle("");
374 fOutputList->Add(fHistAllcentV0C);
375
376 fHistAllcentTPC = new TH1F("fHistAllcentTPC","TPC Event Plane Angle of Pb+Pb",100,0.0,TMath::Pi());
377 fHistAllcentTPC->GetXaxis()->SetTitle("TPC Event Plane Angle [rad]"); fHistAllcentTPC->GetYaxis()->SetTitle("");
378 fOutputList->Add(fHistAllcentTPC);
379
380 fHistEPTPC = new TH2F("fHistEPTPC","TPC Event Plane Angle vs Centrality of Pb+Pb",100,0,100,100,0.0,TMath::Pi());
381 fHistEPTPC->GetYaxis()->SetTitle("Event Plane Angle [rad]"); fHistEPTPC->GetXaxis()->SetTitle("V0M Centrality");
382 fOutputList->Add(fHistEPTPC);
383
384 fHistEPTPCResolution = new TH2F("fHistEPTPCResolution","TPC Resolution vs Centrality of Pb+Pb",100,0,100,100,0.0,1.0);
385 fHistEPTPCResolution->GetYaxis()->SetTitle("TPC Resolution"); fHistEPTPCResolution->GetXaxis()->SetTitle("V0M Centrality");
386 fOutputList->Add(fHistEPTPCResolution);
387
388
389 // Et M02 V0Mcent DeltaPhi Cos[2*DeltaPhi]
390 Int_t bins[5] = { 500, 250, 100, 100, 100 }; // binning
391 Double_t min[5] = { 0.0, 0.0, 0, 0.0, -1.0}; // min x
392 Double_t max[5] = { 50.0, 2.5, 100, TMath::Pi(), 1.0}; // max x
393
394 fClusterPbV0 = new THnSparseF("fClusterPbV0","",5,bins,min,max);
395 fClusterPbV0->GetAxis(0)->SetTitle("Transverse Energy [GeV]"); fClusterPbV0->GetAxis(1)->SetTitle("M02"); fClusterPbV0->GetAxis(2)->SetTitle("V0M Centrality");
396 fClusterPbV0->GetAxis(3)->SetTitle("Delta(#phi) [rad]"); fClusterPbV0->GetAxis(4)->SetTitle("Cos[2*Delta(#phi)]");
397 fOutputList->Add(fClusterPbV0);
398
399 fClusterPbV0A = new THnSparseF("fClusterPbV0A","",5,bins,min,max);
400 fClusterPbV0A->GetAxis(0)->SetTitle("Transverse Energy [GeV]"); fClusterPbV0A->GetAxis(1)->SetTitle("M02"); fClusterPbV0A->GetAxis(2)->SetTitle("V0M Centrality");
401 fClusterPbV0A->GetAxis(3)->SetTitle("Delta(#phi) [rad]"); fClusterPbV0A->GetAxis(4)->SetTitle("Cos[2*Delta(#phi)]");
402 fOutputList->Add(fClusterPbV0A);
403
404 fClusterPbV0C = new THnSparseF("fClusterPbV0C","",5,bins,min,max);
405 fClusterPbV0C->GetAxis(0)->SetTitle("Transverse Energy [GeV]"); fClusterPbV0C->GetAxis(1)->SetTitle("M02"); fClusterPbV0C->GetAxis(2)->SetTitle("V0M Centrality");
406 fClusterPbV0C->GetAxis(3)->SetTitle("Delta(#phi) [rad]"); fClusterPbV0C->GetAxis(4)->SetTitle("Cos[2*Delta(#phi)]");
407 fOutputList->Add(fClusterPbV0C);
408
409 fClusterPbTPC = new THnSparseF("fClusterPbTPC","",5,bins,min,max);
410 fClusterPbTPC->GetAxis(0)->SetTitle("Transverse Energy [GeV]"); fClusterPbTPC->GetAxis(1)->SetTitle("M02"); fClusterPbTPC->GetAxis(2)->SetTitle("V0M Centrality");
411 fClusterPbTPC->GetAxis(3)->SetTitle("Delta(#phi) [rad]"); fClusterPbTPC->GetAxis(4)->SetTitle("Cos[2*Delta(#phi)]");
412 fOutputList->Add(fClusterPbTPC);
413
414
415 PostData(1, fOutputList);
416}
417
418//________________________________________________________________________
419void AliAnalysisTaskEMCALPi0V2ShSh::UserExec(Option_t *)
420{
421 // Main loop, called for each event.
c4a4ee27 422 fESDClusters = 0;
423 fESDCells = 0;
424 fAODClusters = 0;
425 fAODCells = 0;
fc0f5568 426
427 // Create pointer to reconstructed event
428 AliVEvent *event = InputEvent();
429 if (!event) { Printf("ERROR: Could not retrieve event\n"); return; }
430
431 fESD = dynamic_cast<AliESDEvent*>(event);
432 if (!fESD) {
c4a4ee27 433 fAOD = dynamic_cast<AliAODEvent*>(event);
434 if(!fAOD){
435 printf("ERROR: Could not retrieve the event\n");
436 return;
437 }
fc0f5568 438 }
439
440 //Bool_t isSelected =0;
441 //isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & (AliVEvent::kSemiCentral));
442 //if(!isSelected) { return; }
443
c4a4ee27 444 if(event->GetCentrality()){
445 fCentralityV0M = event->GetCentrality()->GetCentralityPercentile("V0M");
fc0f5568 446 } else {
447 printf("ERROR: Could not retrieve the Centrality\n");
448 return;
449 }
c4a4ee27 450
451 fEventPlane = event->GetEventplane();
fc0f5568 452 if (fEventPlane) {
453 VZEROEventPlane();
454 } else {
455 printf("ERROR: Could not retrieve the Centrality\n");
456 return;
457 }
c4a4ee27 458 Int_t runnumber = InputEvent()->GetRunNumber() ;
459
460 TObjArray *matEMCAL=(TObjArray*)fOADBContainer->GetObject(runnumber,"EmcalMatrices");
461 for(Int_t mod=0; mod < (fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
462 if(fGeoName=="EMCAL_FIRSTYEARV1" && mod>3)
463 break;
464 /*if(fESD)
465 fGeom->SetMisalMatrix(fESD->GetEMCALMatrix(mod), mod);
466 else*/
467 // if(fVEvent->GetEMCALMatrix(mod))
468 fGeomMatrix[mod] = (TGeoHMatrix*) matEMCAL->At(mod);
469 fGeom->SetMisalMatrix(fGeomMatrix[mod] , mod);
fc0f5568 470 }
471
c4a4ee27 472 if(fESD){
473 TList *l = fESD->GetList();
474 if(1){//fDebug){
475 for(int nk=0;nk<l->GetEntries();nk++){
476 TObject *obj = (TObject*)l->At(nk);
477 TString oname = obj->GetName();
478 //if(oname.Contains("lus"))
479 printf("Object %d has a clus array named %s +++++++++\n",nk,oname.Data());
480 }
481 }
482 fESDClusters = dynamic_cast<TClonesArray*>(l->FindObject("CaloClusters"));
483 fESDCells = fESD->GetEMCALCells();
484 if(fDebug)
485 printf("ESD cluster mult= %d\n",fESDClusters->GetEntriesFast());
486 if(fESDClusters->GetEntriesFast()<1){
487 printf("ERROR: There are no EMCAL clusters in this event\n");
488 return;
489 }
490 }
491 else if(fAOD){
492 fAODClusters = dynamic_cast<TClonesArray*>(fAOD->GetCaloClusters());
493 fAODCells = fAOD->GetEMCALCells();
494 if(fDebug)
495 printf("AOD cluster mult= %d\n",fAODClusters->GetEntriesFast());
496 if(fAODClusters->GetEntriesFast()<1){
497 printf("ERROR: There are no EMCAL clusters in this event\n");
498 return;
499 }
500 }
501
502 if(fESD)
503 FillTrackHists();
fc0f5568 504
505 fCaloClusters->Clear();
506 PostData(1, fOutputList);
507}
508
509//________________________________________________________________________
510void AliAnalysisTaskEMCALPi0V2ShSh::VZEROEventPlane()
511{// Calculate the V0 Event Plane
512
513 if (fEventPlane->GetQVector()) {
514 fEPTPC = TVector2::Phi_0_2pi(fEventPlane->GetQVector()->Phi())/2.0; //if(fEPTPC>TMath::Pi()) {fEPTPC-=TMath::Pi();}
515 } else { fEPTPC = -999.; }
516
517 if (fEventPlane->GetQsub1()&&fEventPlane->GetQsub2()) {
518 fEPTPCResolution = TMath::Cos(2.0*(fEventPlane->GetQsub1()->Phi()/2.0-fEventPlane->GetQsub2()->Phi()/2.0)); }
519 else { fEPTPCResolution = -1; }
520
521 fEPV0 = TVector2::Phi_0_2pi(fEventPlane->GetEventplane("V0", fESD)); if(fEPV0>TMath::Pi()) {fEPV0-=TMath::Pi();}
522 fEPV0A = TVector2::Phi_0_2pi(fEventPlane->GetEventplane("V0A", fESD)); if(fEPV0A>TMath::Pi()) {fEPV0A-=TMath::Pi();}
523 fEPV0C = TVector2::Phi_0_2pi(fEventPlane->GetEventplane("V0C", fESD)); if(fEPV0C>TMath::Pi()) {fEPV0C-=TMath::Pi();}
524
525 Double_t qx=0, qy=0, qxr=0, qyr=0;
526 fEPV0Ar = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 4, 5, 2, qxr, qyr)); if(fEPV0Ar>TMath::Pi()) {fEPV0Ar-=TMath::Pi();}
527 fEPV0Cr = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 2, 3, 2, qx, qy)); if(fEPV0Cr>TMath::Pi()) {fEPV0Cr-=TMath::Pi();}
528 qxr += qx; qyr += qy;
529 fEPV0r = TVector2::Phi_0_2pi(TMath::ATan2(qyr,qxr))/2.0;
530
531 fEPV0A4r = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 4, 2, qx, qy)); if(fEPV0A4r>TMath::Pi()) {fEPV0A4r-=TMath::Pi();}
532 fEPV0A5r = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 5, 2, qx, qy)); if(fEPV0A5r>TMath::Pi()) {fEPV0A5r-=TMath::Pi();}
533 fEPV0A6r = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 6, 2, qx, qy)); if(fEPV0A6r>TMath::Pi()) {fEPV0A6r-=TMath::Pi();}
534 fEPV0A7r = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 7, 2, qx, qy)); if(fEPV0A7r>TMath::Pi()) {fEPV0A7r-=TMath::Pi();}
535 fEPV0C0r = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 0, 2, qx, qy)); if(fEPV0C0r>TMath::Pi()) {fEPV0C0r-=TMath::Pi();}
536 fEPV0C1r = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 1, 2, qx, qy)); if(fEPV0C1r>TMath::Pi()) {fEPV0C1r-=TMath::Pi();}
537 fEPV0C2r = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 2, 2, qx, qy)); if(fEPV0C2r>TMath::Pi()) {fEPV0C2r-=TMath::Pi();}
538 fEPV0C3r = TVector2::Phi_0_2pi(fEventPlane->CalculateVZEROEventPlane(fESD, 3, 2, qx, qy)); if(fEPV0C3r>TMath::Pi()) {fEPV0C3r-=TMath::Pi();}
539
540 fHistEPTPC->Fill(fCentralityV0M, fEPTPC);
541 if(fEPTPCResolution!=-1) { fHistEPTPCResolution->Fill(fCentralityV0M, fEPTPCResolution); }
542 fHistEPV0->Fill(fCentralityV0M, fEPV0);
543 fHistEPV0A->Fill(fCentralityV0M, fEPV0A);
544 fHistEPV0C->Fill(fCentralityV0M, fEPV0C);
545 fHistEPV0Ar->Fill(fCentralityV0M, fEPV0Ar);
546 fHistEPV0Cr->Fill(fCentralityV0M, fEPV0Cr);
547 fHistEPV0r->Fill(fCentralityV0M, fEPV0r);
548 fHistEPV0A4r->Fill(fCentralityV0M, fEPV0A4r);
549 fHistEPV0A7r->Fill(fCentralityV0M, fEPV0A7r);
550 fHistEPV0C0r->Fill(fCentralityV0M, fEPV0C0r);
551 fHistEPV0C3r->Fill(fCentralityV0M, fEPV0C3r);
552
553 fHistAllcentV0->Fill(fEPV0);
554 fHistAllcentV0r->Fill(fEPV0r);
555 fHistAllcentV0A->Fill(fEPV0A);
556 fHistAllcentV0C->Fill(fEPV0C);
557 fHistAllcentTPC->Fill(fEPTPC);
558
559 fHistdifV0A_V0C0r->Fill(fCentralityV0M, TMath::Cos(2.0*(fEPV0A - fEPV0C0r)));
560 fHistdifV0A_V0C3r->Fill(fCentralityV0M, TMath::Cos(2.0*(fEPV0A - fEPV0C3r)));
561 fHistdifV0C0r_V0C3r->Fill(fCentralityV0M, TMath::Cos(2.0*(fEPV0C0r - fEPV0C3r)));
562 fHistdifV0C_V0A4r->Fill(fCentralityV0M, TMath::Cos(2.0*(fEPV0C - fEPV0A4r)));
563 fHistdifV0C_V0A7r->Fill(fCentralityV0M, TMath::Cos(2.0*(fEPV0C - fEPV0A7r)));
564 fHistdifV0A4r_V0A7r->Fill(fCentralityV0M, TMath::Cos(2.0*(fEPV0A4r - fEPV0A7r)));
565 fHistdifV0Ar_V0Cr->Fill(fCentralityV0M, TMath::Cos(2.0*(fEPV0Ar - fEPV0Cr)));
566
567}
568
569//________________________________________________________________________
570void AliAnalysisTaskEMCALPi0V2ShSh::FillClusterHists()
571{// Fill cluster histograms.
572
573 Float_t pos[3] ;
574
c4a4ee27 575 TObjArray *clusters = fESDClusters;
576 if (!clusters)
577 clusters = fAODClusters;
578 if (!clusters)
fc0f5568 579 return;
580
c4a4ee27 581 const Int_t nclus = clusters->GetEntries();
fc0f5568 582
583 if(nclus==0)
584 return;
585
586 for(Int_t iclus=0;iclus<nclus;iclus++){
c4a4ee27 587 AliVCluster *clus = (AliVCluster *) clusters->At(iclus); // retrieve cluster from esd
fc0f5568 588 if(!clus)
589 continue;
590 if(!clus->IsEMCAL()){
591 printf("ERROR: Current Cluster is not an EMCAL Cluster\n");
592 continue;
593 }
594 clus->GetPosition(pos);
595 TVector3 vpos(pos[0],pos[1],pos[2]);
596 Double_t Transverse_Energy = ((clus->E())/ (TMath::CosH(vpos.Eta())));
597 Double_t dphiV0 = TVector2::Phi_0_2pi(vpos.Phi()-fEPV0r); if(dphiV0>TMath::Pi()) {dphiV0-=TMath::Pi();}
598 Double_t dphiV0A = TVector2::Phi_0_2pi(vpos.Phi()-fEPV0A); if(dphiV0A>TMath::Pi()) {dphiV0A-=TMath::Pi();}
599 Double_t dphiV0C = TVector2::Phi_0_2pi(vpos.Phi()-fEPV0C); if(dphiV0C>TMath::Pi()) {dphiV0C-=TMath::Pi();}
600 Double_t dphiTPC = TVector2::Phi_0_2pi(vpos.Phi()-fEPTPC); if(dphiTPC>TMath::Pi()) {dphiTPC-=TMath::Pi();}
601
602 Double_t DataV0[5];
603 DataV0[0] = Transverse_Energy;
604 DataV0[1] = clus->GetM02();
605 DataV0[2] = fCentralityV0M;
606 DataV0[3] = dphiV0;
607 DataV0[4] = TMath::Cos(2.0*(dphiV0));
608 fClusterPbV0->Fill(DataV0);
609
610 Double_t DataV0A[5];
611 DataV0A[0] = Transverse_Energy;
612 DataV0A[1] = clus->GetM02();
613 DataV0A[2] = fCentralityV0M;
614 DataV0A[3] = dphiV0A;
615 DataV0A[4] = TMath::Cos(2.0*(dphiV0A));
616 fClusterPbV0A->Fill(DataV0A);
617
618 Double_t DataV0C[5];
619 DataV0C[0] = Transverse_Energy;
620 DataV0C[1] = clus->GetM02();
621 DataV0C[2] = fCentralityV0M;
622 DataV0C[3] = dphiV0C;
623 DataV0C[4] = TMath::Cos(2.0*(dphiV0C));
624 fClusterPbV0C->Fill(DataV0C);
625
626 Double_t DataTPC[5];
627 DataTPC[0] = Transverse_Energy;
628 DataTPC[1] = clus->GetM02();
629 DataTPC[2] = fCentralityV0M;
630 DataTPC[3] = dphiTPC;
631 DataTPC[4] = TMath::Cos(2.0*(dphiTPC));
632 fClusterPbTPC->Fill(DataTPC);
633
634 fHistClusterE->Fill(clus->E());
635 fHistClusterEt->Fill(Transverse_Energy);
636 fHistClusterM02->Fill(clus->GetM02());
637 fHistClusterN->Fill(clus->GetNCells());
638 fHistClusterPhi->Fill(vpos.Phi());
639 fHistClusterEta->Fill(vpos.Eta());
640 fHistClusterPhiEta->Fill(vpos.Eta(),vpos.Phi());
641 fHistClusterEN->Fill(clus->E(),clus->GetNCells());
642 fHistClusterEM02->Fill(clus->E(),clus->GetM02());
643 fHistClusterEtN->Fill(Transverse_Energy,clus->GetNCells());
644 fHistClusterEtM02->Fill(Transverse_Energy,clus->GetM02());
645 fHistClusterdphiV0->Fill(dphiV0);
646
647 }
648}
649
650//________________________________________________________________________
651void AliAnalysisTaskEMCALPi0V2ShSh::FillTrackHists()
652{// Fill track histograms.
c4a4ee27 653 if(!fESD)
654 return;
fc0f5568 655 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
656 AliESDtrack* track = (AliESDtrack*)fESD->GetTrack(iTracks);
657 if (!track){
658 printf("ERROR: Could not retreive esdtrack\n");
659 continue;
660 }
661 fHistTrackPt->Fill(track->Pt());
662 fHistTrackEta->Fill(track->Eta());
663 fHistTrackPhi->Fill(track->Phi());
664 fHistTrackPhiEta->Fill(track->Eta(),track->Phi());
665
666 }
667}
668
669//________________________________________________________________________
670void AliAnalysisTaskEMCALPi0V2ShSh::Terminate(Option_t *)
671{
672 // Draw result to screen, or perform fitting, normalizations
673 // Called once at the end of the query
674
675 /* fOutputList = dynamic_cast<TList*> (GetOutputData(1));
676 if(!fOutputList) { Printf("ERROR: could not retrieve TList fOutputList"); return; }
677
678 fHistTrackPt = dynamic_cast<TH1F*> (fOutputList->FindObject("fHistTrackPt"));
679 if (!fHistTrackPt) { Printf("ERROR: could not retrieve fHistTrackPt"); return;}
680 fHistTrackEta = dynamic_cast<TH1F*> (fOutputList->FindObject("fHistTrackEta"));
681 if (!fHistTrackEta) { Printf("ERROR: could not retrieve fHistTrackEta"); return;}
682 fHistTrackPhi = dynamic_cast<TH1F*> (fOutputList->FindObject("fHistTrackPhi"));
683 if (!fHistTrackPhi) { Printf("ERROR: could not retrieve fHistTrackPhi"); return;}
684 fHistClusterEta = dynamic_cast<TH1F*> (fOutputList->FindObject("fHistClusterEta"));
685 if (!fHistClusterEta) { Printf("ERROR: could not retrieve fHistClusterEta"); return;}
686 fHistClusterPhi = dynamic_cast<TH1F*> (fOutputList->FindObject("fHistClusterPhi"));
687 if (!fHistClusterPhi) { Printf("ERROR: could not retrieve fHistClusterPhi"); return;}
688 fHistClusterE = dynamic_cast<TH1F*> (fOutputList->FindObject("fHistClusterE"));
689 if (!fHistClusterE) { Printf("ERROR: could not retrieve fHistClusterE"); return;}
690 fHistClusterN = dynamic_cast<TH1F*> (fOutputList->FindObject("fHistClusterN"));
691 if (!fHistClusterN) { Printf("ERROR: could not retrieve fHistClusterN"); return;}
692 fHistClusterM02 = dynamic_cast<TH1F*> (fOutputList->FindObject("fHistClusterM02"));
693 if (!fHistClusterM02) { Printf("ERROR: could not retrieve fHistClusterM02"); return;}
694
695 // Get the physics selection histograms with the selection statistics
696 //AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
697 //AliESDInputHandler *inputH = dynamic_cast<AliESDInputHandler*>(mgr->GetInputEventHandler());
698 //TH2F *histStat = (TH2F*)inputH->GetStatistics();
699
700
701 TCanvas *canvas1 = new TCanvas("canvas1","Track P_{T} & #eta & #phi",10,10,1020,510);
702 canvas1->Divide(3,1);
703 canvas1->cd(1)->SetLogy();
704 fHistTrackPt->DrawCopy("");
705 canvas1->cd(2);
706 fHistTrackEta->DrawCopy("");
707 canvas1->cd(3);
708 fHistTrackPhi->DrawCopy("");
709
710 TCanvas *canvas2 = new TCanvas("canvas2","Cluster #eta & #phi",10,10,1020,510);
711 canvas2->Divide(2,1);
712 canvas2->cd(1);
713 fHistClusterEta->DrawCopy("");
714 canvas2->cd(2);
715 fHistClusterPhi->DrawCopy("");
716
717 TCanvas *canvas3 = new TCanvas("canvas3","Cluster E & N & M02",10,10,1020,510);
718 canvas3->Divide(3,1);
719 canvas3->cd(1)->SetLogy();
720 fHistClusterE->DrawCopy("");
721 canvas3->cd(2)->SetLogy();
722 fHistClusterN->DrawCopy("");
723 canvas3->cd(3)->SetLogy();
724 fHistClusterM02->DrawCopy("");
725
726 TCanvas *canvas4 = new TCanvas("canvas4","Track #phi vs #eta & Cluster #phi vs #eta",10,10,1020,510);
727 canvas4->Divide(2,1);
728 canvas4->cd(1)->SetLogz();
729 fHistTrackPhiEta->DrawCopy("colorz");
730 canvas4->cd(2)->SetLogz();
731 fHistClusterPhiEta->DrawCopy("colorz");
732
733 TCanvas *canvas5 = new TCanvas("canvas5","Cluster E vs N & E vs M02",10,10,1020,510);
734 canvas5->Divide(2,1);
735 canvas5->cd(1)->SetLogz();
736 fHistClusterEN->DrawCopy("colorz");
737 canvas5->cd(2)->SetLogz();
738 fHistClusterEM02->DrawCopy("colorz");
739
740 TCanvas *canvas6 = new TCanvas("canvas6","Cluster Et & Et vs N & Et vs M02",10,10,1020,510);
741 canvas6->cd(1)->SetLogy();
742 fHistClusterEt->DrawCopy("");
743 canvas6->cd(2)->SetLogz();
744 fHistClusterEtN->DrawCopy("colorz");
745 canvas6->cd(3)->SetLogz();
746 fHistClusterEtM02->DrawCopy("colorz");
747
748 canvas1->SaveAs("lhc11h_2_Track_PT_Eta_Phi.jpg");
749 canvas2->SaveAs("lhc11h_2_Cluster_Eta_Phi.jpg");
750 canvas3->SaveAs("lhc11h_2_Cluster_E_N_M02.jpg");
751 canvas4->SaveAs("lhc11h_2_Track_PhivsEta_Cluster_PhivsEta.jpg");
752 canvas5->SaveAs("lhc11h_2_Cluster_EvsN_EvsM02.jpg");
753 canvas6->SaveAs("lhc11h_2_Cluster_Et_EtvsN_EtvsM02.jpg"); */
754}