]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/EMCALJetTasks/AliAnalysisTaskSAJF.cxx
increase classdef
[u/mrichter/AliRoot.git] / PWGGA / EMCALJetTasks / AliAnalysisTaskSAJF.cxx
CommitLineData
00514d01 1// $Id$
91f4b7c5 2//
297edd60 3// Jet analysis task.
91f4b7c5 4//
297edd60 5// Author: S.Aiola
25283b37 6
b5ee47fb 7#include <TObject.h>
25283b37 8#include <TChain.h>
9#include <TClonesArray.h>
10#include <TH1F.h>
11#include <TH2F.h>
12#include <TList.h>
13#include <TLorentzVector.h>
a55e4f1d 14#include <TRandom3.h>
226f511d 15#include <TParameter.h>
25283b37 16
17#include "AliAnalysisManager.h"
18#include "AliCentrality.h"
f0a0fd33 19#include "AliVCluster.h"
df43b607 20#include "AliVParticle.h"
6fd5039f 21#include "AliVTrack.h"
25283b37 22#include "AliEmcalJet.h"
23#include "AliVEventHandler.h"
55264f20 24#include "AliLog.h"
25283b37 25
00514d01 26#include "AliAnalysisTaskSAJF.h"
25283b37 27
00514d01 28ClassImp(AliAnalysisTaskSAJF)
25283b37 29
30//________________________________________________________________________
00514d01 31AliAnalysisTaskSAJF::AliAnalysisTaskSAJF() :
6fd5039f 32 AliAnalysisTaskEmcalJet("AliAnalysisTaskSAJF"),
b12a85c3 33 fMinRC2LJ(1.0),
2bee31e9 34 fEmbJetsName("EmbJets"),
b12a85c3 35 fRandTracksName("TracksRandomized"),
36 fRandCaloName("CaloClustersRandomized"),
226f511d 37 fRhoName("Rho"),
6fd5039f 38 fSkipEventsWithNoJets(kTRUE),
2bee31e9 39 fEmbJets(0),
b12a85c3 40 fRandTracks(0),
41 fRandCaloClusters(0),
b12a85c3 42 fRho(0),
f0a0fd33 43 fHistCentrality(0),
fb9ac42f 44 fHistRejectedEvents(0),
b12a85c3 45 fHistRhoVSleadJetPt(0),
46 fHistRCPhiEta(0),
47 fHistRCPtExLJVSDPhiLJ(0),
48 fHistRhoVSRCPt(0),
b5ee47fb 49 fHistEmbJetPhiEta(0),
50 fHistEmbPartPhiEta(0),
b12a85c3 51 fHistRhoVSEmbBkg(0)
226f511d 52
25283b37 53{
54 // Default constructor.
f0a0fd33 55
56 for (Int_t i = 0; i < 4; i++) {
df43b607 57 fHistJetPhiEta[i] = 0;
55264f20 58 fHistJetsPt[i] = 0;
df43b607 59 fHistJetsPtArea[i] = 0;
2bddb6ae 60 fHistJetsPtNonBias[i] = 0;
61 fHistJetsPtAreaNonBias[i] = 0;
55264f20 62 fHistLeadingJetPt[i] = 0;
63 fHist2LeadingJetPt[i] = 0;
b12a85c3 64 fHistJetsNEFvsPt[i] = 0;
65 fHistJetsZvsPt[i] = 0;
b12a85c3 66 fHistRho[i] = 0;
67 fHistCorrJetsPt[i] = 0;
2bddb6ae 68 fHistCorrJetsPtArea[i] = 0;
69 fHistCorrJetsPtNonBias[i] = 0;
70 fHistCorrJetsPtAreaNonBias[i] = 0;
b12a85c3 71 fHistCorrLeadingJetPt[i] = 0;
a55e4f1d 72 fHistRCPt[i] = 0;
73 fHistRCPtExLJ[i] = 0;
b12a85c3 74 fHistRCPtRand[i] = 0;
75 fHistDeltaPtRC[i] = 0;
76 fHistDeltaPtRCExLJ[i] = 0;
77 fHistDeltaPtRCRand[i] = 0;
2bee31e9 78 fHistEmbJets[i] = 0;
79 fHistEmbPart[i] = 0;
b12a85c3 80 fHistDeltaPtEmb[i] = 0;
f0a0fd33 81 }
25283b37 82}
83
84//________________________________________________________________________
00514d01 85AliAnalysisTaskSAJF::AliAnalysisTaskSAJF(const char *name) :
6fd5039f 86 AliAnalysisTaskEmcalJet(name),
b12a85c3 87 fMinRC2LJ(1.0),
2bee31e9 88 fEmbJetsName("EmbJets"),
b12a85c3 89 fRandTracksName("TracksRandomized"),
90 fRandCaloName("CaloClustersRandomized"),
226f511d 91 fRhoName("Rho"),
6fd5039f 92 fSkipEventsWithNoJets(kTRUE),
2bee31e9 93 fEmbJets(0),
b12a85c3 94 fRandTracks(0),
95 fRandCaloClusters(0),
b12a85c3 96 fRho(0),
f0a0fd33 97 fHistCentrality(0),
fb9ac42f 98 fHistRejectedEvents(0),
b12a85c3 99 fHistRhoVSleadJetPt(0),
100 fHistRCPhiEta(0),
101 fHistRCPtExLJVSDPhiLJ(0),
102 fHistRhoVSRCPt(0),
b5ee47fb 103 fHistEmbJetPhiEta(0),
104 fHistEmbPartPhiEta(0),
b12a85c3 105 fHistRhoVSEmbBkg(0)
25283b37 106{
107 // Standard constructor.
108
f0a0fd33 109 for (Int_t i = 0; i < 4; i++) {
df43b607 110 fHistJetPhiEta[i] = 0;
55264f20 111 fHistJetsPt[i] = 0;
df43b607 112 fHistJetsPtArea[i] = 0;
2bddb6ae 113 fHistJetsPtNonBias[i] = 0;
114 fHistJetsPtAreaNonBias[i] = 0;
55264f20 115 fHistLeadingJetPt[i] = 0;
116 fHist2LeadingJetPt[i] = 0;
b12a85c3 117 fHistJetsNEFvsPt[i] = 0;
118 fHistJetsZvsPt[i] = 0;
b12a85c3 119 fHistRho[i] = 0;
120 fHistCorrJetsPt[i] = 0;
2bddb6ae 121 fHistCorrJetsPtArea[i] = 0;
122 fHistCorrJetsPtNonBias[i] = 0;
123 fHistCorrJetsPtAreaNonBias[i] = 0;
b12a85c3 124 fHistCorrLeadingJetPt[i] = 0;
a55e4f1d 125 fHistRCPt[i] = 0;
126 fHistRCPtExLJ[i] = 0;
b12a85c3 127 fHistRCPtRand[i] = 0;
128 fHistDeltaPtRC[i] = 0;
129 fHistDeltaPtRCExLJ[i] = 0;
130 fHistDeltaPtRCRand[i] = 0;
2bee31e9 131 fHistEmbJets[i] = 0;
132 fHistEmbPart[i] = 0;
b12a85c3 133 fHistDeltaPtEmb[i] = 0;
f0a0fd33 134 }
25283b37 135}
136
137//________________________________________________________________________
00514d01 138AliAnalysisTaskSAJF::~AliAnalysisTaskSAJF()
25283b37 139{
16d143bd 140 // Destructor.
25283b37 141}
142
143//________________________________________________________________________
00514d01 144void AliAnalysisTaskSAJF::UserCreateOutputObjects()
25283b37 145{
16d143bd 146 // Create user output.
df43b607 147
16d143bd 148 AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
11d4d636 149
6fd5039f 150 const Float_t binWidth = (fMaxBinPt - fMinBinPt) / fNbins;
25283b37 151
226f511d 152 OpenFile(1);
25283b37 153 fOutput = new TList();
226f511d 154 fOutput->SetOwner();
25283b37 155
fb9ac42f 156 fHistCentrality = new TH1F("fHistCentrality","fHistCentrality", fNbins, 0, 100);
f0a0fd33 157 fHistCentrality->GetXaxis()->SetTitle("Centrality (%)");
158 fHistCentrality->GetYaxis()->SetTitle("counts");
159 fOutput->Add(fHistCentrality);
25283b37 160
6fd5039f 161 fHistRejectedEvents = new TH1F("fHistRejectedEvents","fHistRejectedEvents", 6, 0, 6);
fb9ac42f 162 fHistRejectedEvents->GetXaxis()->SetTitle("Reason");
163 fHistRejectedEvents->GetYaxis()->SetTitle("counts");
164 fHistRejectedEvents->GetXaxis()->SetBinLabel(1, "Rho <= 0");
165 fHistRejectedEvents->GetXaxis()->SetBinLabel(2, "Max Jet <= 0");
166 fHistRejectedEvents->GetXaxis()->SetBinLabel(3, "Max Jet not found");
6fd5039f 167 fHistRejectedEvents->GetXaxis()->SetBinLabel(4, "No jets");
fb9ac42f 168 fOutput->Add(fHistRejectedEvents);
169
6fd5039f 170 fHistRhoVSleadJetPt = new TH2F("fHistRhoVSleadJetPt","fHistRhoVSleadJetPt", fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 171 fHistRhoVSleadJetPt->GetXaxis()->SetTitle("#rho * area [GeV/c]");
172 fHistRhoVSleadJetPt->GetYaxis()->SetTitle("Leading jet p_{T} [GeV/c]");
173 fOutput->Add(fHistRhoVSleadJetPt);
b5ee47fb 174
6fd5039f 175 fHistRCPhiEta = new TH2F("fHistRCPhiEta","Phi-Eta distribution of rigid cones", 40, -2, 2, 64, 0, 6.4);
b12a85c3 176 fHistRCPhiEta->GetXaxis()->SetTitle("#eta");
177 fHistRCPhiEta->GetYaxis()->SetTitle("#phi");
178 fOutput->Add(fHistRCPhiEta);
b5ee47fb 179
6fd5039f 180 fHistRCPtExLJVSDPhiLJ = new TH2F("fHistRCPtExLJVSDPhiLJ","fHistRCPtExLJVSDPhiLJ", fNbins, fMinBinPt, fMaxBinPt, 128, -1.6, 4.8);
b12a85c3 181 fHistRCPtExLJVSDPhiLJ->GetXaxis()->SetTitle("rigid cone p_{T} [GeV/c]");
b5ee47fb 182 fHistRCPtExLJVSDPhiLJ->GetYaxis()->SetTitle("#Delta#phi");
183 fOutput->Add(fHistRCPtExLJVSDPhiLJ);
184
6fd5039f 185 fHistRhoVSRCPt = new TH2F("fHistRhoVSRCPt","fHistRhoVSRCPt", fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 186 fHistRhoVSRCPt->GetXaxis()->SetTitle("#rho * area [GeV/c]");
187 fHistRhoVSRCPt->GetYaxis()->SetTitle("rigid cone p_{T} [GeV/c]");
188 fOutput->Add(fHistRhoVSRCPt);
189
6fd5039f 190 fHistEmbJetPhiEta = new TH2F("fHistEmbJetPhiEta","Phi-Eta distribution of embedded jets", 40, -2, 2, 64, 0, 6.4);
b12a85c3 191 fHistEmbJetPhiEta->GetXaxis()->SetTitle("#eta");
192 fHistEmbJetPhiEta->GetYaxis()->SetTitle("#phi");
193 fOutput->Add(fHistEmbJetPhiEta);
194
6fd5039f 195 fHistEmbPartPhiEta = new TH2F("fHistEmbPartPhiEta","Phi-Eta distribution of embedded particles", 40, -2, 2, 64, 0, 6.4);
b12a85c3 196 fHistEmbPartPhiEta->GetXaxis()->SetTitle("#eta");
197 fHistEmbPartPhiEta->GetYaxis()->SetTitle("#phi");
198 fOutput->Add(fHistEmbPartPhiEta);
199
6fd5039f 200 fHistRhoVSEmbBkg = new TH2F("fHistRhoVSEmbBkg","fHistRhoVSEmbBkg", fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 201 fHistRhoVSEmbBkg->GetXaxis()->SetTitle("rho * area [GeV/c]");
202 fHistRhoVSEmbBkg->GetYaxis()->SetTitle("background of embedded track [GeV/c]");
203 fOutput->Add(fHistRhoVSEmbBkg);
b5ee47fb 204
f0a0fd33 205 TString histname;
206
207 for (Int_t i = 0; i < 4; i++) {
df43b607 208 histname = "fHistJetPhiEta_";
209 histname += i;
6fd5039f 210 fHistJetPhiEta[i] = new TH2F(histname.Data(), histname.Data(), 40, -2, 2, 64, 0, 6.4);
df43b607 211 fHistJetPhiEta[i]->GetXaxis()->SetTitle("#eta");
212 fHistJetPhiEta[i]->GetYaxis()->SetTitle("#phi");
213 fOutput->Add(fHistJetPhiEta[i]);
214
55264f20 215 histname = "fHistJetsPt_";
f0a0fd33 216 histname += i;
6fd5039f 217 fHistJetsPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 218 fHistJetsPt[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
55264f20 219 fHistJetsPt[i]->GetYaxis()->SetTitle("counts");
220 fOutput->Add(fHistJetsPt[i]);
226f511d 221
df43b607 222 histname = "fHistJetsPtArea_";
223 histname += i;
6fd5039f 224 fHistJetsPtArea[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, 20, 0, fJetRadius * fJetRadius * TMath::Pi() * 1.5);
df43b607 225 fHistJetsPtArea[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
226 fHistJetsPtArea[i]->GetYaxis()->SetTitle("area");
227 fOutput->Add(fHistJetsPtArea[i]);
228
2bddb6ae 229 histname = "fHistJetsPtNonBias_";
230 histname += i;
231 fHistJetsPtNonBias[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
232 fHistJetsPtNonBias[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
233 fHistJetsPtNonBias[i]->GetYaxis()->SetTitle("counts");
234 fOutput->Add(fHistJetsPtNonBias[i]);
235
236 histname = "fHistJetsPtAreaNonBias_";
237 histname += i;
238 fHistJetsPtAreaNonBias[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, 20, 0, fJetRadius * fJetRadius * TMath::Pi() * 1.5);
239 fHistJetsPtAreaNonBias[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
240 fHistJetsPtAreaNonBias[i]->GetYaxis()->SetTitle("area");
241 fOutput->Add(fHistJetsPtAreaNonBias[i]);
242
55264f20 243 histname = "fHistLeadingJetPt_";
f0a0fd33 244 histname += i;
6fd5039f 245 fHistLeadingJetPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 246 fHistLeadingJetPt[i]->GetXaxis()->SetTitle("p_{T} [GeV]");
55264f20 247 fHistLeadingJetPt[i]->GetYaxis()->SetTitle("counts");
248 fOutput->Add(fHistLeadingJetPt[i]);
b5ee47fb 249
250 histname = "fHist2LeadingJetPt_";
251 histname += i;
6fd5039f 252 fHist2LeadingJetPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 253 fHist2LeadingJetPt[i]->GetXaxis()->SetTitle("p_{T} [GeV]");
b5ee47fb 254 fHist2LeadingJetPt[i]->GetYaxis()->SetTitle("counts");
255 fOutput->Add(fHist2LeadingJetPt[i]);
256
b12a85c3 257 histname = "fHistJetsZvsPt_";
b5ee47fb 258 histname += i;
6fd5039f 259 fHistJetsZvsPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 260 fHistJetsZvsPt[i]->GetXaxis()->SetTitle("Z");
261 fHistJetsZvsPt[i]->GetYaxis()->SetTitle("p_{T} [GeV/c]");
262 fOutput->Add(fHistJetsZvsPt[i]);
263
264 if (fAnaType == kEMCAL) {
265 histname = "fHistJetsNEFvsPt_";
266 histname += i;
6fd5039f 267 fHistJetsNEFvsPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 268 fHistJetsNEFvsPt[i]->GetXaxis()->SetTitle("NEF");
269 fHistJetsNEFvsPt[i]->GetYaxis()->SetTitle("p_{T} [GeV/c]");
270 fOutput->Add(fHistJetsNEFvsPt[i]);
b12a85c3 271 }
272
b12a85c3 273 histname = "fHistRho_";
274 histname += i;
6fd5039f 275 fHistRho[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
b12a85c3 276 fHistRho[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
277 fHistRho[i]->GetYaxis()->SetTitle("counts");
278 fOutput->Add(fHistRho[i]);
279
280 histname = "fHistCorrJetsPt_";
281 histname += i;
6fd5039f 282 fHistCorrJetsPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
b12a85c3 283 fHistCorrJetsPt[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
284 fHistCorrJetsPt[i]->GetYaxis()->SetTitle("counts");
285 fOutput->Add(fHistCorrJetsPt[i]);
286
2bddb6ae 287 histname = "fHistCorrJetsPtArea_";
288 histname += i;
289 fHistCorrJetsPtArea[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, 20, 0, fJetRadius * fJetRadius * TMath::Pi() * 1.5);
290 fHistCorrJetsPtArea[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
291 fHistCorrJetsPtArea[i]->GetYaxis()->SetTitle("area");
292 fOutput->Add(fHistCorrJetsPtArea[i]);
293
294 histname = "fHistCorrJetsPtNonBias_";
295 histname += i;
296 fHistCorrJetsPtNonBias[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
297 fHistCorrJetsPtNonBias[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
298 fHistCorrJetsPtNonBias[i]->GetYaxis()->SetTitle("counts");
299 fOutput->Add(fHistCorrJetsPtNonBias[i]);
300
301 histname = "fHistCorrJetsPtAreaNonBias_";
302 histname += i;
303 fHistCorrJetsPtAreaNonBias[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, 20, 0, fJetRadius * fJetRadius * TMath::Pi() * 1.5);
304 fHistCorrJetsPtAreaNonBias[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
305 fHistCorrJetsPtAreaNonBias[i]->GetYaxis()->SetTitle("area");
306 fOutput->Add(fHistCorrJetsPtAreaNonBias[i]);
307
b12a85c3 308 histname = "fHistCorrLeadingJetPt_";
309 histname += i;
6fd5039f 310 fHistCorrLeadingJetPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
b12a85c3 311 fHistCorrLeadingJetPt[i]->GetXaxis()->SetTitle("p_{T} [GeV/c]");
312 fHistCorrLeadingJetPt[i]->GetYaxis()->SetTitle("counts");
313 fOutput->Add(fHistCorrLeadingJetPt[i]);
314
315 histname = "fHistRCPt_";
c554a987 316 histname += i;
6fd5039f 317 fHistRCPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
b12a85c3 318 fHistRCPt[i]->GetXaxis()->SetTitle("rigid cone p_{T} [GeV/c]");
319 fHistRCPt[i]->GetYaxis()->SetTitle("counts");
320 fOutput->Add(fHistRCPt[i]);
c554a987 321
b12a85c3 322 histname = "fHistRCPtExLJ_";
c554a987 323 histname += i;
6fd5039f 324 fHistRCPtExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
b12a85c3 325 fHistRCPtExLJ[i]->GetXaxis()->SetTitle("rigid cone p_{T} [GeV/c]");
326 fHistRCPtExLJ[i]->GetYaxis()->SetTitle("counts");
327 fOutput->Add(fHistRCPtExLJ[i]);
c554a987 328
b12a85c3 329 histname = "fHistRCPtRand_";
c554a987 330 histname += i;
6fd5039f 331 fHistRCPtRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
b12a85c3 332 fHistRCPtRand[i]->GetXaxis()->SetTitle("rigid cone p_{T} [GeV/c]");
333 fHistRCPtRand[i]->GetYaxis()->SetTitle("counts");
334 fOutput->Add(fHistRCPtRand[i]);
a55e4f1d 335
336 histname = "fHistDeltaPtRC_";
337 histname += i;
6fd5039f 338 fHistDeltaPtRC[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt - fMaxBinPt / 2 + binWidth / 2, fMinBinPt + fMaxBinPt / 2 + binWidth / 2);
b12a85c3 339 fHistDeltaPtRC[i]->GetXaxis()->SetTitle("#deltap_{T} [GeV/c]");
a55e4f1d 340 fHistDeltaPtRC[i]->GetYaxis()->SetTitle("counts");
341 fOutput->Add(fHistDeltaPtRC[i]);
342
343 histname = "fHistDeltaPtRCExLJ_";
344 histname += i;
6fd5039f 345 fHistDeltaPtRCExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt - fMaxBinPt / 2 + binWidth / 2, fMinBinPt + fMaxBinPt / 2 + binWidth / 2);
b12a85c3 346 fHistDeltaPtRCExLJ[i]->GetXaxis()->SetTitle("#deltap_{T} [GeV/c]");
a55e4f1d 347 fHistDeltaPtRCExLJ[i]->GetYaxis()->SetTitle("counts");
348 fOutput->Add(fHistDeltaPtRCExLJ[i]);
349
b12a85c3 350 histname = "fHistDeltaPtRCRand_";
a55e4f1d 351 histname += i;
6fd5039f 352 fHistDeltaPtRCRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt - fMaxBinPt / 2 + binWidth / 2, fMinBinPt + fMaxBinPt / 2 + binWidth / 2);
b12a85c3 353 fHistDeltaPtRCRand[i]->GetXaxis()->SetTitle("#deltap_{T} [GeV/c]");
354 fHistDeltaPtRCRand[i]->GetYaxis()->SetTitle("counts");
355 fOutput->Add(fHistDeltaPtRCRand[i]);
2bee31e9 356
357 histname = "fHistEmbJets_";
358 histname += i;
6fd5039f 359 fHistEmbJets[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 360 fHistEmbJets[i]->GetXaxis()->SetTitle("embedded jet p_{T} [GeV/c]");
2bee31e9 361 fHistEmbJets[i]->GetYaxis()->SetTitle("counts");
362 fOutput->Add(fHistEmbJets[i]);
363
364 histname = "fHistEmbPart_";
365 histname += i;
6fd5039f 366 fHistEmbPart[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
b12a85c3 367 fHistEmbPart[i]->GetXaxis()->SetTitle("embedded particle p_{T} [GeV/c]");
2bee31e9 368 fHistEmbPart[i]->GetYaxis()->SetTitle("counts");
369 fOutput->Add(fHistEmbPart[i]);
370
b12a85c3 371 histname = "fHistDeltaPtEmb_";
2bee31e9 372 histname += i;
6fd5039f 373 fHistDeltaPtEmb[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt - fMaxBinPt / 2 + binWidth / 2, fMinBinPt + fMaxBinPt / 2 + binWidth / 2);
b12a85c3 374 fHistDeltaPtEmb[i]->GetXaxis()->SetTitle("#deltap_{T} [GeV/c]");
375 fHistDeltaPtEmb[i]->GetYaxis()->SetTitle("counts");
376 fOutput->Add(fHistDeltaPtEmb[i]);
e82e282c 377 }
378
25283b37 379 PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
380}
381
55264f20 382//________________________________________________________________________
6fd5039f 383Bool_t AliAnalysisTaskSAJF::RetrieveEventObjects()
25283b37 384{
16d143bd 385 // Retrieve event objects.
386
387 if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects())
6fd5039f 388 return kFALSE;
389
390 fRho = -1;
391
392 if (strcmp(fRhoName,"")) {
393 TParameter<Double_t> *rho = dynamic_cast<TParameter<Double_t>*>(InputEvent()->FindListObject(fRhoName));
394
395 if (rho) {
396 fRho = rho->GetVal();
397 }
398 else {
399 AliWarning(Form("Could not retrieve rho %s!", fRhoName.Data()));
400 }
401 }
df43b607 402
2bee31e9 403 if (strcmp(fEmbJetsName,"")) {
404 fEmbJets = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fEmbJetsName));
405 if (!fEmbJets) {
b12a85c3 406 AliWarning(Form("Could not retrieve emb jets %s!", fEmbJetsName.Data()));
407 }
408 }
409
410 if (strcmp(fRandCaloName,"") && fAnaType == kEMCAL) {
411 fRandCaloClusters = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fRandCaloName));
412 if (!fRandCaloClusters) {
413 AliWarning(Form("Could not retrieve randomized clusters %s!", fRandCaloName.Data()));
414 }
415 }
416
417 if (strcmp(fRandTracksName,"")) {
418 fRandTracks = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fRandTracksName));
419 if (!fRandTracks) {
420 AliWarning(Form("Could not retrieve randomized tracks %s!", fRandTracksName.Data()));
2bee31e9 421 }
422 }
f0a0fd33 423
6fd5039f 424 return kTRUE;
2bee31e9 425}
426
55264f20 427//________________________________________________________________________
6fd5039f 428Bool_t AliAnalysisTaskSAJF::FillHistograms()
25283b37 429{
16d143bd 430 // Fill histograms.
431
df43b607 432 if (fRho < 0) {
6fd5039f 433 fHistRejectedEvents->Fill("Rho <= 0", 1);
434 return kFALSE;
df43b607 435 }
436
55264f20 437 Int_t maxJetIndex = -1;
438 Int_t max2JetIndex = -1;
25283b37 439
b12a85c3 440 // ************
441 // General histograms
442 // _________________________________
443
6fd5039f 444 GetLeadingJets(maxJetIndex, max2JetIndex);
55264f20 445
6fd5039f 446 if (fSkipEventsWithNoJets && maxJetIndex < 0) {
447 fHistRejectedEvents->Fill("No jets", 1);
448 return kFALSE;
fb9ac42f 449 }
c554a987 450
df43b607 451 AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fJets->At(maxJetIndex));
6fd5039f 452 if (fSkipEventsWithNoJets && !jet) {
453 fHistRejectedEvents->Fill("Max Jet not found", 1);
454 return kFALSE;
fb9ac42f 455 }
c554a987 456
6fd5039f 457 Float_t maxJetCorrPt = 0;
458
459 if (jet)
460 maxJetCorrPt = jet->Pt() - fRho * jet->Area();
11d4d636 461
6fd5039f 462 if (fSkipEventsWithNoJets && maxJetCorrPt <= 0) {
463 fHistRejectedEvents->Fill("Max Jet <= 0", 1);
464 return kFALSE;
465 }
b12a85c3 466
6fd5039f 467 fHistCentrality->Fill(fCent);
468 fHistRho[fCentBin]->Fill(fRho);
469
470 if (jet) {
471 fHistLeadingJetPt[fCentBin]->Fill(jet->Pt());
472 fHistRhoVSleadJetPt->Fill(fRho * jet->Area(), jet->Pt());
473 fHistCorrLeadingJetPt[fCentBin]->Fill(maxJetCorrPt);
474 }
55264f20 475
476 AliEmcalJet* jet2 = 0;
477 if (max2JetIndex >= 0)
df43b607 478 jet2 = dynamic_cast<AliEmcalJet*>(fJets->At(max2JetIndex));
55264f20 479
6fd5039f 480 if (jet2)
b5ee47fb 481 fHist2LeadingJetPt[fCentBin]->Fill(jet2->Pt());
b5ee47fb 482
6fd5039f 483 DoJetLoop();
55264f20 484
b12a85c3 485 // ************
486 // Random cones
487 // _________________________________
a55e4f1d 488
d41a0b1c 489 const Float_t rcArea = fJetRadius * fJetRadius * TMath::Pi();
490
b12a85c3 491 // Simple random cones
492 Float_t RCpt = 0;
493 Float_t RCeta = 0;
494 Float_t RCphi = 0;
495 GetRigidCone(RCpt, RCeta, RCphi, kFALSE, 0);
496 if (RCpt > 0) {
d41a0b1c 497 fHistRCPt[fCentBin]->Fill(RCpt / rcArea);
498 fHistDeltaPtRC[fCentBin]->Fill(RCpt - rcArea * fRho);
b12a85c3 499 }
500
501 // Random cones far from leading jet
502 Float_t RCptExLJ = 0;
503 Float_t RCetaExLJ = 0;
504 Float_t RCphiExLJ = 0;
505 GetRigidCone(RCptExLJ, RCetaExLJ, RCphiExLJ, kFALSE, jet);
506 if (RCptExLJ > 0) {
507 fHistRCPhiEta->Fill(RCetaExLJ, RCphiExLJ);
d41a0b1c 508 fHistRhoVSRCPt->Fill(fRho, RCptExLJ / rcArea);
b5ee47fb 509
510 Float_t dphi = RCphiExLJ - jet->Phi();
511 if (dphi > 4.8) dphi -= TMath::Pi() * 2;
512 if (dphi < -1.6) dphi += TMath::Pi() * 2;
513 fHistRCPtExLJVSDPhiLJ->Fill(RCptExLJ, dphi);
b12a85c3 514
d41a0b1c 515 fHistRCPtExLJ[fCentBin]->Fill(RCptExLJ / rcArea);
516 fHistDeltaPtRCExLJ[fCentBin]->Fill(RCptExLJ - rcArea * fRho);
b12a85c3 517 }
518
519 // Random cones with randomized particles
520 Float_t RCptRand = 0;
521 Float_t RCetaRand = 0;
522 Float_t RCphiRand = 0;
523 GetRigidCone(RCptRand, RCetaRand, RCphiRand, kTRUE, 0, fRandTracks, fRandCaloClusters);
524 if (RCptRand > 0) {
d41a0b1c 525 fHistRCPtRand[fCentBin]->Fill(RCptRand / rcArea);
526 fHistDeltaPtRCRand[fCentBin]->Fill(RCptRand - rcArea * fRho);
a55e4f1d 527 }
2bee31e9 528
b12a85c3 529 // ************
530 // Embedding
531 // _________________________________
532
df43b607 533 if (!fEmbJets)
6fd5039f 534 return kTRUE;
df43b607 535
b12a85c3 536 AliEmcalJet *embJet = 0;
b5ee47fb 537 TObject *maxPart = 0;
2bee31e9 538
b12a85c3 539 DoEmbJetLoop(embJet, maxPart);
2bee31e9 540
fb9ac42f 541 if (embJet) {
542
543 fHistEmbJets[fCentBin]->Fill(embJet->Pt());
544 fHistEmbPart[fCentBin]->Fill(embJet->MCPt());
545 fHistEmbJetPhiEta->Fill(embJet->Eta(), embJet->Phi());
546 fHistDeltaPtEmb[fCentBin]->Fill(embJet->Pt() - embJet->Area() * fRho - embJet->MCPt());
547 fHistRhoVSEmbBkg->Fill(embJet->Area() * fRho, embJet->Pt() - embJet->MCPt());
b12a85c3 548
549 AliVCluster *cluster = dynamic_cast<AliVCluster*>(maxPart);
b5ee47fb 550 if (cluster) {
b5ee47fb 551 Float_t pos[3];
552 cluster->GetPosition(pos);
553 TVector3 clusVec(pos);
554
fb9ac42f 555 fHistEmbPartPhiEta->Fill(clusVec.Eta(), clusVec.Phi());
b5ee47fb 556 }
b5ee47fb 557 else {
6fd5039f 558 AliVTrack *track = dynamic_cast<AliVTrack*>(maxPart);
b12a85c3 559 if (track) {
fb9ac42f 560 fHistEmbPartPhiEta->Fill(track->Eta(), track->Phi());
b12a85c3 561 }
562 else {
6fd5039f 563 AliWarning(Form("%s - Embedded particle type not found or not recognized (neither AliVCluster nor AliVTrack)!", GetName()));
564 return kTRUE;
b12a85c3 565 }
b5ee47fb 566 }
b12a85c3 567
2bee31e9 568 }
569 else {
fb9ac42f 570 AliWarning(Form("%s - Embedded jet not found in the event!", GetName()));
2bee31e9 571 }
6fd5039f 572
573 return kTRUE;
55264f20 574}
575
576//________________________________________________________________________
6fd5039f 577void AliAnalysisTaskSAJF::GetLeadingJets(Int_t &maxJetIndex, Int_t &max2JetIndex)
55264f20 578{
16d143bd 579 // Get the leading jets.
580
df43b607 581 if (!fJets)
582 return;
583
16d143bd 584 const Int_t njets = fJets->GetEntriesFast();
55264f20 585
586 Float_t maxJetPt = 0;
587 Float_t max2JetPt = 0;
25283b37 588 for (Int_t ij = 0; ij < njets; ij++) {
f0a0fd33 589
df43b607 590 AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fJets->At(ij));
f0a0fd33 591
25283b37 592 if (!jet) {
a55e4f1d 593 AliError(Form("Could not receive jet %d", ij));
25283b37 594 continue;
595 }
f0a0fd33 596
91f4b7c5 597 if (!AcceptJet(jet))
598 continue;
599
226f511d 600 Float_t corrPt = jet->Pt() - fRho * jet->Area();
601
6fd5039f 602 if (maxJetIndex == -1 || maxJetPt < corrPt) {
603 max2JetPt = maxJetPt;
604 max2JetIndex = maxJetIndex;
605 maxJetPt = corrPt;
606 maxJetIndex = ij;
b12a85c3 607 }
6fd5039f 608 else if (max2JetIndex == -1 || max2JetPt < corrPt) {
609 max2JetPt = corrPt;
610 max2JetIndex = ij;
b12a85c3 611 }
16d143bd 612 }
6fd5039f 613}
614
6fd5039f 615//________________________________________________________________________
616void AliAnalysisTaskSAJF::DoJetLoop()
617{
16d143bd 618 // Do the jet loop.
619
6fd5039f 620 if (!fJets)
621 return;
622
16d143bd 623 const Int_t njets = fJets->GetEntriesFast();
6fd5039f 624
625 for (Int_t ij = 0; ij < njets; ij++) {
626
627 AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fJets->At(ij));
628
629 if (!jet) {
630 AliError(Form("Could not receive jet %d", ij));
631 continue;
632 }
633
2bddb6ae 634 if (!AcceptJet(jet, kFALSE))
6fd5039f 635 continue;
636
637 Float_t corrPt = jet->Pt() - fRho * jet->Area();
2bddb6ae 638
639 fHistJetsPtNonBias[fCentBin]->Fill(jet->Pt());
640 fHistJetsPtAreaNonBias[fCentBin]->Fill(jet->Pt(), jet->Area());
641 fHistCorrJetsPtNonBias[fCentBin]->Fill(corrPt);
642 fHistCorrJetsPtAreaNonBias[fCentBin]->Fill(corrPt, jet->Area());
643
644 if (!AcceptBiasJet(jet))
645 continue;
226f511d 646
11d4d636 647 fHistJetsPt[fCentBin]->Fill(jet->Pt());
2bddb6ae 648 fHistJetsPtArea[fCentBin]->Fill(jet->Pt(), jet->Area());
11d4d636 649 fHistCorrJetsPt[fCentBin]->Fill(corrPt);
2bddb6ae 650 fHistCorrJetsPtArea[fCentBin]->Fill(corrPt, jet->Area());
f0a0fd33 651
df43b607 652 fHistJetPhiEta[fCentBin]->Fill(jet->Eta(), jet->Phi());
b12a85c3 653
654 if (fAnaType == kEMCAL)
655 fHistJetsNEFvsPt[fCentBin]->Fill(jet->NEF(), jet->Pt());
226f511d 656
6e8d91c9 657 if (fTracks) {
658 for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
659 AliVParticle *track = jet->TrackAt(it, fTracks);
660 if (track)
661 fHistJetsZvsPt[fCentBin]->Fill(track->Pt() / jet->Pt(), jet->Pt());
662 }
35789a2d 663 }
a55e4f1d 664
6e8d91c9 665 if (fCaloClusters) {
666 for (Int_t ic = 0; ic < jet->GetNumberOfClusters(); ic++) {
667 AliVCluster *cluster = jet->ClusterAt(ic, fCaloClusters);
668
669 if (cluster) {
670 TLorentzVector nPart;
671 cluster->GetMomentum(nPart, fVertex);
2bddb6ae 672 fHistJetsZvsPt[fCentBin]->Fill(nPart.Et() / jet->Pt(), jet->Pt());
6e8d91c9 673 }
55264f20 674 }
f0a0fd33 675 }
25283b37 676 } //jet loop
55264f20 677}
e82e282c 678
55264f20 679//________________________________________________________________________
b12a85c3 680void AliAnalysisTaskSAJF::DoEmbJetLoop(AliEmcalJet* &embJet, TObject* &maxPart)
55264f20 681{
16d143bd 682 // Do the embedded jet loop.
683
df43b607 684 if (!fEmbJets)
685 return;
686
fb9ac42f 687 TLorentzVector maxClusVect;
2bee31e9 688
df43b607 689 Int_t nembjets = fEmbJets->GetEntriesFast();
2bee31e9 690
2bee31e9 691 for (Int_t ij = 0; ij < nembjets; ij++) {
692
df43b607 693 AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fEmbJets->At(ij));
2bee31e9 694
695 if (!jet) {
696 AliError(Form("Could not receive jet %d", ij));
697 continue;
698 }
699
df43b607 700 if (!AcceptJet(jet))
701 continue;
2bee31e9 702
fb9ac42f 703 if (!jet->IsMC())
704 continue;
705
df43b607 706 AliVParticle *maxTrack = 0;
2bee31e9 707
b12a85c3 708 for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
df43b607 709 AliVParticle *track = jet->TrackAt(it, fTracks);
b12a85c3 710
fb9ac42f 711 if (!track)
712 continue;
713
1f6fff78 714 if (track->GetLabel() != 100)
fb9ac42f 715 continue;
b12a85c3 716
717 if (!maxTrack || track->Pt() > maxTrack->Pt())
718 maxTrack = track;
2bee31e9 719 }
2bee31e9 720
b12a85c3 721 AliVCluster *maxClus = 0;
2bee31e9 722
b12a85c3 723 for (Int_t ic = 0; ic < jet->GetNumberOfClusters(); ic++) {
724 AliVCluster *cluster = jet->ClusterAt(ic, fCaloClusters);
725
fb9ac42f 726 if (!cluster)
727 continue;
728
729 if (cluster->Chi2() != 100)
730 continue;
b12a85c3 731
732 TLorentzVector nPart;
733 cluster->GetMomentum(nPart, fVertex);
734
fb9ac42f 735 if (!maxClus || nPart.Et() > maxClusVect.Et()) {
736 new (&maxClusVect) TLorentzVector(nPart);
b12a85c3 737 maxClus = cluster;
738 }
739 }
2bee31e9 740
fb9ac42f 741 if ((maxClus && maxTrack && maxClusVect.Et() > maxTrack->Pt()) || (maxClus && !maxTrack)) {
742 maxPart = maxClus;
743 embJet = jet;
b12a85c3 744 }
745 else if (maxTrack) {
fb9ac42f 746 maxPart = maxTrack;
747 embJet = jet;
b12a85c3 748 }
b12a85c3 749
fb9ac42f 750 return; // MC jets found, exit
751 }
2bee31e9 752}
753
a55e4f1d 754//________________________________________________________________________
b12a85c3 755void AliAnalysisTaskSAJF::GetRigidCone(Float_t &pt, Float_t &eta, Float_t &phi, Bool_t acceptMC,
756 AliEmcalJet *jet, TClonesArray* tracks, TClonesArray* clusters) const
a55e4f1d 757{
16d143bd 758 // Get rigid cone.
759
b12a85c3 760 if (!tracks)
761 tracks = fTracks;
a55e4f1d 762
b12a85c3 763 if (!clusters)
764 clusters = fCaloClusters;
a55e4f1d 765
df43b607 766 if (!tracks && !clusters)
767 return;
768
b5ee47fb 769 eta = 0;
770 phi = 0;
b12a85c3 771 pt = 0;
a55e4f1d 772
773 Float_t LJeta = 999;
774 Float_t LJphi = 999;
775
776 if (jet) {
777 LJeta = jet->Eta();
778 LJphi = jet->Phi();
779 }
780
1f6fff78 781 Float_t maxEta = fMaxEta;
782 Float_t minEta = fMinEta;
783 Float_t maxPhi = fMaxPhi;
784 Float_t minPhi = fMinPhi;
b5ee47fb 785
786 if (maxPhi > TMath::Pi() * 2) maxPhi = TMath::Pi() * 2;
787 if (minPhi < 0) minPhi = 0;
788
a55e4f1d 789 Float_t dLJ = 0;
b12a85c3 790 Int_t repeats = 0;
a55e4f1d 791 do {
b12a85c3 792 eta = gRandom->Rndm() * (maxEta - minEta) + minEta;
793 phi = gRandom->Rndm() * (maxPhi - minPhi) + minPhi;
a55e4f1d 794 dLJ = TMath::Sqrt((LJeta - eta) * (LJeta - eta) + (LJphi - phi) * (LJphi - phi));
b12a85c3 795 repeats++;
796 } while (dLJ < fMinRC2LJ && repeats < 999);
797
798 if (repeats == 999)
799 return;
b5ee47fb 800
df43b607 801 if (fAnaType == kEMCAL && clusters) {
b12a85c3 802 Int_t nclusters = clusters->GetEntriesFast();
b5ee47fb 803 for (Int_t iClusters = 0; iClusters < nclusters; iClusters++) {
b12a85c3 804 AliVCluster* cluster = dynamic_cast<AliVCluster*>(clusters->At(iClusters));
b5ee47fb 805 if (!cluster) {
806 AliError(Form("Could not receive cluster %d", iClusters));
807 continue;
808 }
809
810 if (!(cluster->IsEMCAL())) continue;
811
b12a85c3 812 if (!AcceptCluster(cluster, acceptMC)) continue;
b5ee47fb 813
814 TLorentzVector nPart;
b12a85c3 815 cluster->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
b5ee47fb 816
817 Float_t pos[3];
818 cluster->GetPosition(pos);
819 TVector3 clusVec(pos);
820
821 Float_t d = TMath::Sqrt((clusVec.Eta() - eta) * (clusVec.Eta() - eta) + (clusVec.Phi() - phi) * (clusVec.Phi() - phi));
822
823 if (d <= fJetRadius)
824 pt += nPart.Pt();
825 }
a55e4f1d 826 }
827
df43b607 828 if (tracks) {
829 Int_t ntracks = tracks->GetEntriesFast();
830 for(Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
6fd5039f 831 AliVTrack* track = dynamic_cast<AliVTrack*>(tracks->At(iTracks));
df43b607 832 if(!track) {
833 AliError(Form("Could not retrieve track %d",iTracks));
834 continue;
835 }
836
837 if (!AcceptTrack(track, acceptMC)) continue;
838
839 Float_t tracketa = track->Eta();
840 Float_t trackphi = track->Phi();
841
842 if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi + 2 * TMath::Pi()))
843 trackphi += 2 * TMath::Pi();
844 if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi - 2 * TMath::Pi()))
845 trackphi -= 2 * TMath::Pi();
846
847 Float_t d = TMath::Sqrt((tracketa - eta) * (tracketa - eta) + (trackphi - phi) * (trackphi - phi));
a55e4f1d 848
df43b607 849 if (d <= fJetRadius)
850 pt += track->Pt();
851 }
25283b37 852 }
f0a0fd33 853}
a55e4f1d 854//________________________________________________________________________
df43b607 855void AliAnalysisTaskSAJF::Init()
25283b37 856{
16d143bd 857 // Initialize the analysis.
858
6fd5039f 859 AliAnalysisTaskEmcalJet::Init();
25283b37 860
16d143bd 861 const Float_t semiDiag = TMath::Sqrt((fMaxPhi - fMinPhi) * (fMaxPhi - fMinPhi) +
862 (fMaxEta - fMinEta) * (fMaxEta - fMinEta)) / 2;
df43b607 863 if (fMinRC2LJ > semiDiag * 0.5) {
16d143bd 864 AliWarning(Form("The parameter fMinRC2LJ = %f is too large for the considered acceptance. "
865 "Will use fMinRC2LJ = %f", fMinRC2LJ, semiDiag * 0.5));
df43b607 866 fMinRC2LJ = semiDiag * 0.5;
b12a85c3 867 }
25283b37 868}
869
870//________________________________________________________________________
00514d01 871void AliAnalysisTaskSAJF::Terminate(Option_t *)
25283b37 872{
873 // Called once at the end of the analysis.
874}