]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/EMCALJetTasks/AliAnalysisTaskSAJF.cxx
Big fix + possibility to set the centrality bin
[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() :
1f03e093 32 AliAnalysisTaskEmcalJet("AliAnalysisTaskSAJF", kTRUE),
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) :
1f03e093 86 AliAnalysisTaskEmcalJet(name, kTRUE),
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
1f03e093 444 DoJetLoop();
445
6fd5039f 446 GetLeadingJets(maxJetIndex, max2JetIndex);
55264f20 447
98750b70 448 if (maxJetIndex < 0) {
6fd5039f 449 fHistRejectedEvents->Fill("No jets", 1);
450 return kFALSE;
fb9ac42f 451 }
c554a987 452
df43b607 453 AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fJets->At(maxJetIndex));
98750b70 454 if (!jet) {
6fd5039f 455 fHistRejectedEvents->Fill("Max Jet not found", 1);
456 return kFALSE;
fb9ac42f 457 }
c554a987 458
98750b70 459 Float_t maxJetCorrPt = jet->Pt() - fRho * jet->Area();
11d4d636 460
6fd5039f 461 if (fSkipEventsWithNoJets && maxJetCorrPt <= 0) {
462 fHistRejectedEvents->Fill("Max Jet <= 0", 1);
463 return kFALSE;
464 }
b12a85c3 465
6fd5039f 466 fHistCentrality->Fill(fCent);
467 fHistRho[fCentBin]->Fill(fRho);
468
469 if (jet) {
470 fHistLeadingJetPt[fCentBin]->Fill(jet->Pt());
471 fHistRhoVSleadJetPt->Fill(fRho * jet->Area(), jet->Pt());
472 fHistCorrLeadingJetPt[fCentBin]->Fill(maxJetCorrPt);
473 }
55264f20 474
475 AliEmcalJet* jet2 = 0;
476 if (max2JetIndex >= 0)
df43b607 477 jet2 = dynamic_cast<AliEmcalJet*>(fJets->At(max2JetIndex));
55264f20 478
6fd5039f 479 if (jet2)
b5ee47fb 480 fHist2LeadingJetPt[fCentBin]->Fill(jet2->Pt());
b5ee47fb 481
b12a85c3 482 // ************
483 // Random cones
484 // _________________________________
a55e4f1d 485
d41a0b1c 486 const Float_t rcArea = fJetRadius * fJetRadius * TMath::Pi();
487
b12a85c3 488 // Simple random cones
489 Float_t RCpt = 0;
490 Float_t RCeta = 0;
491 Float_t RCphi = 0;
492 GetRigidCone(RCpt, RCeta, RCphi, kFALSE, 0);
493 if (RCpt > 0) {
d41a0b1c 494 fHistRCPt[fCentBin]->Fill(RCpt / rcArea);
495 fHistDeltaPtRC[fCentBin]->Fill(RCpt - rcArea * fRho);
b12a85c3 496 }
497
498 // Random cones far from leading jet
499 Float_t RCptExLJ = 0;
500 Float_t RCetaExLJ = 0;
501 Float_t RCphiExLJ = 0;
502 GetRigidCone(RCptExLJ, RCetaExLJ, RCphiExLJ, kFALSE, jet);
503 if (RCptExLJ > 0) {
504 fHistRCPhiEta->Fill(RCetaExLJ, RCphiExLJ);
d41a0b1c 505 fHistRhoVSRCPt->Fill(fRho, RCptExLJ / rcArea);
b5ee47fb 506
507 Float_t dphi = RCphiExLJ - jet->Phi();
508 if (dphi > 4.8) dphi -= TMath::Pi() * 2;
509 if (dphi < -1.6) dphi += TMath::Pi() * 2;
510 fHistRCPtExLJVSDPhiLJ->Fill(RCptExLJ, dphi);
b12a85c3 511
d41a0b1c 512 fHistRCPtExLJ[fCentBin]->Fill(RCptExLJ / rcArea);
513 fHistDeltaPtRCExLJ[fCentBin]->Fill(RCptExLJ - rcArea * fRho);
b12a85c3 514 }
515
516 // Random cones with randomized particles
517 Float_t RCptRand = 0;
518 Float_t RCetaRand = 0;
519 Float_t RCphiRand = 0;
520 GetRigidCone(RCptRand, RCetaRand, RCphiRand, kTRUE, 0, fRandTracks, fRandCaloClusters);
521 if (RCptRand > 0) {
d41a0b1c 522 fHistRCPtRand[fCentBin]->Fill(RCptRand / rcArea);
523 fHistDeltaPtRCRand[fCentBin]->Fill(RCptRand - rcArea * fRho);
a55e4f1d 524 }
2bee31e9 525
b12a85c3 526 // ************
527 // Embedding
528 // _________________________________
529
df43b607 530 if (!fEmbJets)
6fd5039f 531 return kTRUE;
df43b607 532
b12a85c3 533 AliEmcalJet *embJet = 0;
b5ee47fb 534 TObject *maxPart = 0;
2bee31e9 535
b12a85c3 536 DoEmbJetLoop(embJet, maxPart);
2bee31e9 537
fb9ac42f 538 if (embJet) {
539
540 fHistEmbJets[fCentBin]->Fill(embJet->Pt());
541 fHistEmbPart[fCentBin]->Fill(embJet->MCPt());
542 fHistEmbJetPhiEta->Fill(embJet->Eta(), embJet->Phi());
543 fHistDeltaPtEmb[fCentBin]->Fill(embJet->Pt() - embJet->Area() * fRho - embJet->MCPt());
544 fHistRhoVSEmbBkg->Fill(embJet->Area() * fRho, embJet->Pt() - embJet->MCPt());
b12a85c3 545
546 AliVCluster *cluster = dynamic_cast<AliVCluster*>(maxPart);
b5ee47fb 547 if (cluster) {
b5ee47fb 548 Float_t pos[3];
549 cluster->GetPosition(pos);
550 TVector3 clusVec(pos);
551
fb9ac42f 552 fHistEmbPartPhiEta->Fill(clusVec.Eta(), clusVec.Phi());
b5ee47fb 553 }
b5ee47fb 554 else {
6fd5039f 555 AliVTrack *track = dynamic_cast<AliVTrack*>(maxPart);
b12a85c3 556 if (track) {
fb9ac42f 557 fHistEmbPartPhiEta->Fill(track->Eta(), track->Phi());
b12a85c3 558 }
559 else {
6fd5039f 560 AliWarning(Form("%s - Embedded particle type not found or not recognized (neither AliVCluster nor AliVTrack)!", GetName()));
561 return kTRUE;
b12a85c3 562 }
b5ee47fb 563 }
b12a85c3 564
2bee31e9 565 }
566 else {
fb9ac42f 567 AliWarning(Form("%s - Embedded jet not found in the event!", GetName()));
2bee31e9 568 }
6fd5039f 569
570 return kTRUE;
55264f20 571}
572
573//________________________________________________________________________
6fd5039f 574void AliAnalysisTaskSAJF::GetLeadingJets(Int_t &maxJetIndex, Int_t &max2JetIndex)
55264f20 575{
16d143bd 576 // Get the leading jets.
577
df43b607 578 if (!fJets)
579 return;
580
16d143bd 581 const Int_t njets = fJets->GetEntriesFast();
55264f20 582
1f03e093 583 Float_t maxJetPt = -999;
584 Float_t max2JetPt = -999;
25283b37 585 for (Int_t ij = 0; ij < njets; ij++) {
f0a0fd33 586
df43b607 587 AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fJets->At(ij));
f0a0fd33 588
25283b37 589 if (!jet) {
a55e4f1d 590 AliError(Form("Could not receive jet %d", ij));
25283b37 591 continue;
592 }
f0a0fd33 593
98750b70 594 if (!AcceptJet(jet, fSkipEventsWithNoJets))
91f4b7c5 595 continue;
596
226f511d 597 Float_t corrPt = jet->Pt() - fRho * jet->Area();
598
6fd5039f 599 if (maxJetIndex == -1 || maxJetPt < corrPt) {
600 max2JetPt = maxJetPt;
601 max2JetIndex = maxJetIndex;
602 maxJetPt = corrPt;
603 maxJetIndex = ij;
b12a85c3 604 }
6fd5039f 605 else if (max2JetIndex == -1 || max2JetPt < corrPt) {
606 max2JetPt = corrPt;
607 max2JetIndex = ij;
b12a85c3 608 }
16d143bd 609 }
6fd5039f 610}
611
6fd5039f 612//________________________________________________________________________
613void AliAnalysisTaskSAJF::DoJetLoop()
614{
16d143bd 615 // Do the jet loop.
616
6fd5039f 617 if (!fJets)
618 return;
619
16d143bd 620 const Int_t njets = fJets->GetEntriesFast();
6fd5039f 621
622 for (Int_t ij = 0; ij < njets; ij++) {
623
624 AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fJets->At(ij));
625
626 if (!jet) {
627 AliError(Form("Could not receive jet %d", ij));
628 continue;
629 }
630
1f03e093 631 if (!AcceptJet(jet, kFALSE))
6fd5039f 632 continue;
633
634 Float_t corrPt = jet->Pt() - fRho * jet->Area();
2bddb6ae 635
636 fHistJetsPtNonBias[fCentBin]->Fill(jet->Pt());
637 fHistJetsPtAreaNonBias[fCentBin]->Fill(jet->Pt(), jet->Area());
638 fHistCorrJetsPtNonBias[fCentBin]->Fill(corrPt);
639 fHistCorrJetsPtAreaNonBias[fCentBin]->Fill(corrPt, jet->Area());
640
641 if (!AcceptBiasJet(jet))
642 continue;
226f511d 643
11d4d636 644 fHistJetsPt[fCentBin]->Fill(jet->Pt());
2bddb6ae 645 fHistJetsPtArea[fCentBin]->Fill(jet->Pt(), jet->Area());
11d4d636 646 fHistCorrJetsPt[fCentBin]->Fill(corrPt);
2bddb6ae 647 fHistCorrJetsPtArea[fCentBin]->Fill(corrPt, jet->Area());
f0a0fd33 648
df43b607 649 fHistJetPhiEta[fCentBin]->Fill(jet->Eta(), jet->Phi());
b12a85c3 650
651 if (fAnaType == kEMCAL)
652 fHistJetsNEFvsPt[fCentBin]->Fill(jet->NEF(), jet->Pt());
226f511d 653
6e8d91c9 654 if (fTracks) {
655 for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
656 AliVParticle *track = jet->TrackAt(it, fTracks);
657 if (track)
658 fHistJetsZvsPt[fCentBin]->Fill(track->Pt() / jet->Pt(), jet->Pt());
659 }
35789a2d 660 }
a55e4f1d 661
6e8d91c9 662 if (fCaloClusters) {
663 for (Int_t ic = 0; ic < jet->GetNumberOfClusters(); ic++) {
664 AliVCluster *cluster = jet->ClusterAt(ic, fCaloClusters);
665
666 if (cluster) {
667 TLorentzVector nPart;
668 cluster->GetMomentum(nPart, fVertex);
2bddb6ae 669 fHistJetsZvsPt[fCentBin]->Fill(nPart.Et() / jet->Pt(), jet->Pt());
6e8d91c9 670 }
55264f20 671 }
f0a0fd33 672 }
25283b37 673 } //jet loop
55264f20 674}
e82e282c 675
55264f20 676//________________________________________________________________________
b12a85c3 677void AliAnalysisTaskSAJF::DoEmbJetLoop(AliEmcalJet* &embJet, TObject* &maxPart)
55264f20 678{
16d143bd 679 // Do the embedded jet loop.
680
df43b607 681 if (!fEmbJets)
682 return;
683
fb9ac42f 684 TLorentzVector maxClusVect;
2bee31e9 685
df43b607 686 Int_t nembjets = fEmbJets->GetEntriesFast();
2bee31e9 687
2bee31e9 688 for (Int_t ij = 0; ij < nembjets; ij++) {
689
df43b607 690 AliEmcalJet* jet = dynamic_cast<AliEmcalJet*>(fEmbJets->At(ij));
2bee31e9 691
692 if (!jet) {
693 AliError(Form("Could not receive jet %d", ij));
694 continue;
695 }
696
df43b607 697 if (!AcceptJet(jet))
698 continue;
2bee31e9 699
fb9ac42f 700 if (!jet->IsMC())
701 continue;
702
df43b607 703 AliVParticle *maxTrack = 0;
2bee31e9 704
b12a85c3 705 for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
df43b607 706 AliVParticle *track = jet->TrackAt(it, fTracks);
b12a85c3 707
fb9ac42f 708 if (!track)
709 continue;
710
1f6fff78 711 if (track->GetLabel() != 100)
fb9ac42f 712 continue;
b12a85c3 713
714 if (!maxTrack || track->Pt() > maxTrack->Pt())
715 maxTrack = track;
2bee31e9 716 }
2bee31e9 717
b12a85c3 718 AliVCluster *maxClus = 0;
2bee31e9 719
b12a85c3 720 for (Int_t ic = 0; ic < jet->GetNumberOfClusters(); ic++) {
721 AliVCluster *cluster = jet->ClusterAt(ic, fCaloClusters);
722
fb9ac42f 723 if (!cluster)
724 continue;
725
726 if (cluster->Chi2() != 100)
727 continue;
b12a85c3 728
729 TLorentzVector nPart;
730 cluster->GetMomentum(nPart, fVertex);
731
fb9ac42f 732 if (!maxClus || nPart.Et() > maxClusVect.Et()) {
733 new (&maxClusVect) TLorentzVector(nPart);
b12a85c3 734 maxClus = cluster;
735 }
736 }
2bee31e9 737
fb9ac42f 738 if ((maxClus && maxTrack && maxClusVect.Et() > maxTrack->Pt()) || (maxClus && !maxTrack)) {
739 maxPart = maxClus;
740 embJet = jet;
b12a85c3 741 }
742 else if (maxTrack) {
fb9ac42f 743 maxPart = maxTrack;
744 embJet = jet;
b12a85c3 745 }
b12a85c3 746
fb9ac42f 747 return; // MC jets found, exit
748 }
2bee31e9 749}
750
a55e4f1d 751//________________________________________________________________________
b12a85c3 752void AliAnalysisTaskSAJF::GetRigidCone(Float_t &pt, Float_t &eta, Float_t &phi, Bool_t acceptMC,
753 AliEmcalJet *jet, TClonesArray* tracks, TClonesArray* clusters) const
a55e4f1d 754{
16d143bd 755 // Get rigid cone.
756
b12a85c3 757 if (!tracks)
758 tracks = fTracks;
a55e4f1d 759
b12a85c3 760 if (!clusters)
761 clusters = fCaloClusters;
a55e4f1d 762
df43b607 763 if (!tracks && !clusters)
764 return;
765
b5ee47fb 766 eta = 0;
767 phi = 0;
b12a85c3 768 pt = 0;
a55e4f1d 769
770 Float_t LJeta = 999;
771 Float_t LJphi = 999;
772
773 if (jet) {
774 LJeta = jet->Eta();
775 LJphi = jet->Phi();
776 }
777
1f6fff78 778 Float_t maxEta = fMaxEta;
779 Float_t minEta = fMinEta;
780 Float_t maxPhi = fMaxPhi;
781 Float_t minPhi = fMinPhi;
b5ee47fb 782
783 if (maxPhi > TMath::Pi() * 2) maxPhi = TMath::Pi() * 2;
784 if (minPhi < 0) minPhi = 0;
785
a55e4f1d 786 Float_t dLJ = 0;
b12a85c3 787 Int_t repeats = 0;
a55e4f1d 788 do {
b12a85c3 789 eta = gRandom->Rndm() * (maxEta - minEta) + minEta;
790 phi = gRandom->Rndm() * (maxPhi - minPhi) + minPhi;
a55e4f1d 791 dLJ = TMath::Sqrt((LJeta - eta) * (LJeta - eta) + (LJphi - phi) * (LJphi - phi));
b12a85c3 792 repeats++;
793 } while (dLJ < fMinRC2LJ && repeats < 999);
794
795 if (repeats == 999)
796 return;
b5ee47fb 797
df43b607 798 if (fAnaType == kEMCAL && clusters) {
b12a85c3 799 Int_t nclusters = clusters->GetEntriesFast();
b5ee47fb 800 for (Int_t iClusters = 0; iClusters < nclusters; iClusters++) {
b12a85c3 801 AliVCluster* cluster = dynamic_cast<AliVCluster*>(clusters->At(iClusters));
b5ee47fb 802 if (!cluster) {
803 AliError(Form("Could not receive cluster %d", iClusters));
804 continue;
805 }
806
807 if (!(cluster->IsEMCAL())) continue;
808
b12a85c3 809 if (!AcceptCluster(cluster, acceptMC)) continue;
b5ee47fb 810
811 TLorentzVector nPart;
b12a85c3 812 cluster->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
b5ee47fb 813
814 Float_t pos[3];
815 cluster->GetPosition(pos);
816 TVector3 clusVec(pos);
817
818 Float_t d = TMath::Sqrt((clusVec.Eta() - eta) * (clusVec.Eta() - eta) + (clusVec.Phi() - phi) * (clusVec.Phi() - phi));
819
820 if (d <= fJetRadius)
821 pt += nPart.Pt();
822 }
a55e4f1d 823 }
824
df43b607 825 if (tracks) {
826 Int_t ntracks = tracks->GetEntriesFast();
827 for(Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
6fd5039f 828 AliVTrack* track = dynamic_cast<AliVTrack*>(tracks->At(iTracks));
df43b607 829 if(!track) {
830 AliError(Form("Could not retrieve track %d",iTracks));
831 continue;
832 }
833
834 if (!AcceptTrack(track, acceptMC)) continue;
835
836 Float_t tracketa = track->Eta();
837 Float_t trackphi = track->Phi();
838
839 if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi + 2 * TMath::Pi()))
840 trackphi += 2 * TMath::Pi();
841 if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi - 2 * TMath::Pi()))
842 trackphi -= 2 * TMath::Pi();
843
844 Float_t d = TMath::Sqrt((tracketa - eta) * (tracketa - eta) + (trackphi - phi) * (trackphi - phi));
a55e4f1d 845
df43b607 846 if (d <= fJetRadius)
847 pt += track->Pt();
848 }
25283b37 849 }
f0a0fd33 850}
a55e4f1d 851//________________________________________________________________________
df43b607 852void AliAnalysisTaskSAJF::Init()
25283b37 853{
16d143bd 854 // Initialize the analysis.
855
6fd5039f 856 AliAnalysisTaskEmcalJet::Init();
25283b37 857
16d143bd 858 const Float_t semiDiag = TMath::Sqrt((fMaxPhi - fMinPhi) * (fMaxPhi - fMinPhi) +
859 (fMaxEta - fMinEta) * (fMaxEta - fMinEta)) / 2;
df43b607 860 if (fMinRC2LJ > semiDiag * 0.5) {
16d143bd 861 AliWarning(Form("The parameter fMinRC2LJ = %f is too large for the considered acceptance. "
862 "Will use fMinRC2LJ = %f", fMinRC2LJ, semiDiag * 0.5));
df43b607 863 fMinRC2LJ = semiDiag * 0.5;
b12a85c3 864 }
25283b37 865}
866
867//________________________________________________________________________
00514d01 868void AliAnalysisTaskSAJF::Terminate(Option_t *)
25283b37 869{
870 // Called once at the end of the analysis.
871}