AliPhysics  ed8caee (ed8caee)
AliAnalysisTaskJetCoreEmcal.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 #include <TClonesArray.h>
17 #include <TList.h>
18 #include "TChain.h"
19 #include "TTree.h"
20 #include "TMath.h"
21 #include "TH1F.h"
22 #include "TH2F.h"
23 #include "TH3F.h"
24 #include "THnSparse.h"
25 #include "TCanvas.h"
26 #include "TRandom3.h"
27 #include "AliLog.h"
28 
29 #include <AliAnalysisManager.h>
30 #include <AliVEventHandler.h>
31 #include <AliVEvent.h>
32 #include <AliVCluster.h>
33 #include <AliVParticle.h>
34 #include <AliLog.h>
35 #include <AliAnalysisDataSlot.h>
36 #include <AliAnalysisDataContainer.h>
37 
38 #include "AliTLorentzVector.h"
39 #include "AliEmcalJet.h"
40 #include "AliRhoParameter.h"
41 #include "AliJetContainer.h"
42 #include "AliParticleContainer.h"
43 #include "AliClusterContainer.h"
44 #include "AliEmcalPythiaInfo.h"
45 
47 
51 
57  fHistManager(),
58  fJetShapeType(AliAnalysisTaskJetCoreEmcal::kData),
59  fCentMin(0.),
60  fCentMax(100.),
61  fTTLowRef(8.),
62  fTTUpRef(9.),
63  fTTLowSig(20.),
64  fTTUpSig(50.),
65  fNRPBins(50),
66  fFrac(0.8),
67  fJetEtaMin(-.5),
68  fJetEtaMax(.5),
69  fJetHadronDeltaPhi(0.6),
70  fMinFractionSharedPt(0.5),
71  fJetContName(""),
72  fJetContTrueName(""),
73  fJetContPartName(""),
74  fFillTrackHistograms(kTRUE),
75  fFillJetHistograms(kTRUE),
76  fFillRecoilTHnSparse(kTRUE),
77  fFillInclusiveTree(kFALSE),
78  fFillRecoilTree(kFALSE),
79  fPtHardBin(0.),
80  fRejectionFactorInclusiveJets(1),
81  fRandom(0),
82  fHistEvtSelection(0x0),
83  fHJetSpec(0x0),
84  fh1TrigRef(0x0),
85  fh1TrigSig(0x0),
86  fh2Ntriggers(0x0),
87  fh2RPJetsC10(0x0),
88  fh2RPJetsC20(0x0),
89  fh2RPTC10(0x0),
90  fh2RPTC20(0x0),
91  fhDphiPtSig(0x0),
92  fhDphiPtRef(0x0),
93  fhPtDetPart(0x0),
94  fhPtHybrDet(0x0),
95  fhPtHybrPart(0x0),
96  fhPtHybrPartCor(0x0),
97  fhPhiHybrPartCor(0x0),
98  fhPtDet(0x0),
99  fhPtDetMatchedToPart(0x0),
100  fhResidual(0x0),
101  fhPtResidual(0x0),
102  fhPhiResidual(0x0),
103  fhPhiPhiResidual(0x0),
104  fhPtDetPartRecoil(0x0),
105  fhPtHybrDetRecoil(0x0),
106  fhPtHybrPartRecoil(0x0),
107  fhPtHybrPartCorRecoil(0x0),
108  fhPtDetRecoil(0x0),
109  fhPtDetMatchedToPartRecoil(0x0),
110  fhResidualRecoil(0x0),
111  fhPtResidualRecoil(0x0),
112  fhDphiResidualRecoil(0x0),
113  fhDphiphiResidualRecoil(0x0),
114  fhTTPtDetMatchedToPart(0x0),
115  fhTTPhiDetMatchedToPart(0x0),
116  fhDPhiHybrPartCorRecoil(0x0),
117  fTreeEmbInclusive(0x0),
118  fTreeEmbRecoil(0x0)
119 {
121 
122  DefineOutput(1, TList::Class());
123  //if(fJetShapeType == AliAnalysisTaskJetCoreEmcal::kDetEmbPart && fFillInclusiveTree)
124  DefineOutput(2, TTree::Class());
125 // if(fJetShapeType == AliAnalysisTaskJetCoreEmcal::kDetEmbPart && fFillRecoilTree)
126  DefineOutput(3, TTree::Class());
127 }
128 
135  AliAnalysisTaskEmcalJet(name, kTRUE),
136  fHistManager(name),
138  fCentMin(0.),
139  fCentMax(100.),
140  fTTLowRef(8),
141  fTTUpRef(9.),
142  fTTLowSig(20.),
143  fTTUpSig(50.),
144  fNRPBins(50),
145  fFrac(0.8),
146  fJetEtaMin(-.5),
147  fJetEtaMax(.5),
148  fJetHadronDeltaPhi(0.6),
150  fJetContName(""),
151  fJetContTrueName(""),
152  fJetContPartName(""),
153  fFillTrackHistograms(kTRUE),
154  fFillJetHistograms(kTRUE),
155  fFillRecoilTHnSparse(kTRUE),
156  fFillInclusiveTree(kFALSE),
157  fFillRecoilTree(kFALSE),
158  fPtHardBin(0.),
160  fRandom(0),
161  fHistEvtSelection(0x0),
162  fHJetSpec(0x0),
163  fh1TrigRef(0x0),
164  fh1TrigSig(0x0),
165  fh2Ntriggers(0x0),
166  fh2RPJetsC10(0x0),
167  fh2RPJetsC20(0x0),
168  fh2RPTC10(0x0),
169  fh2RPTC20(0x0),
170  fhDphiPtSig(0x0),
171  fhDphiPtRef(0x0),
172  fhPtDetPart(0x0),
173  fhPtHybrDet(0x0),
174  fhPtHybrPart(0x0),
175  fhPtHybrPartCor(0x0),
176  fhPhiHybrPartCor(0x0),
177  fhPtDet(0x0),
179  fhResidual(0x0),
180  fhPtResidual(0x0),
181  fhPhiResidual(0x0),
182  fhPhiPhiResidual(0x0),
183  fhPtDetPartRecoil(0x0),
184  fhPtHybrDetRecoil(0x0),
185  fhPtHybrPartRecoil(0x0),
187  fhPtDetRecoil(0x0),
189  fhResidualRecoil(0x0),
190  fhPtResidualRecoil(0x0),
196  fTreeEmbInclusive(0x0),
197  fTreeEmbRecoil(0x0)
198 {
200 
201  DefineOutput(1, TList::Class());
202  DefineOutput(2, TTree::Class());
203  DefineOutput(3, TTree::Class());
204 }
205 
210 {
211 }
212 
218 {
220 
223  //AllocateClusterHistograms();
224  //AllocateCellHistograms();
226 
227  TIter next(fHistManager.GetListOfHistograms());
228  TObject* obj = 0;
229  while ((obj = next())) {
230  fOutput->Add(obj);
231  }
232 
233  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
234  if(fJetShapeType == AliAnalysisTaskJetCoreEmcal::kDetEmbPart && fFillInclusiveTree) PostData(2, fTreeEmbInclusive); // Post data for ALL output slots > 0 here.
235  if(fJetShapeType == AliAnalysisTaskJetCoreEmcal::kDetEmbPart && fFillRecoilTree) PostData(3, fTreeEmbRecoil); // Post data for ALL output slots > 0 here.
236 }
237 
238 /*
239  * This function allocates the histograms for basic EMCal cluster QA.
240  * A set of histograms (energy, eta, phi, number of cluster) is allocated
241  * per each cluster container and per each centrality bin.
242  */
244 {
245  TString histname;
246  TString histtitle;
247  TString groupname;
248  AliClusterContainer* clusCont = 0;
249  TIter next(&fClusterCollArray);
250  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
251  groupname = clusCont->GetName();
252  // Protect against creating the histograms twice
253  if (fHistManager.FindObject(groupname)) {
254  AliWarning(TString::Format("%s: Found groupname %s in hist manager. The cluster containers will be filled into the same histograms.", GetName(), groupname.Data()));
255  continue;
256  }
257  fHistManager.CreateHistoGroup(groupname);
258  for (Int_t cent = 0; cent < fNcentBins; cent++) {
259  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), cent);
260  histtitle = TString::Format("%s;#it{E}_{cluster} (GeV);counts", histname.Data());
261  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
262 
263  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), cent);
264  histtitle = TString::Format("%s;#it{E}_{cluster}^{exotic} (GeV);counts", histname.Data());
265  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
266 
267  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), cent);
268  histtitle = TString::Format("%s;#it{E}_{cluster}^{non-lin.corr.} (GeV);counts", histname.Data());
269  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
270 
271  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), cent);
272  histtitle = TString::Format("%s;#it{E}_{cluster}^{had.corr.} (GeV);counts", histname.Data());
273  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
274 
275  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), cent);
276  histtitle = TString::Format("%s;#it{#phi}_{custer};counts", histname.Data());
277  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
278 
279  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), cent);
280  histtitle = TString::Format("%s;#it{#eta}_{custer};counts", histname.Data());
281  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
282 
283  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), cent);
284  histtitle = TString::Format("%s;number of clusters;events", histname.Data());
285  if (fForceBeamType != kpp) {
286  fHistManager.CreateTH1(histname, histtitle, 500, 0, 3000);
287  }
288  else {
289  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
290  }
291  }
292  }
293 
294  histname = "fHistSumNClusters";
295  histtitle = TString::Format("%s;Sum of n clusters;events", histname.Data());
296  if (fForceBeamType != kpp) {
297  fHistManager.CreateTH1(histname, histtitle, 500, 0, 3000);
298  }
299  else {
300  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
301  }
302 }
303 
304 /*
305  * This function allocates the histograms for basic EMCal QA.
306  * One 2D histogram with the cell energy spectra and the number of cells
307  * per event is allocated per each centrality bin.
308  */
310 {
311  TString histname;
312  TString histtitle;
313  TString groupname(fCaloCellsName);
314 
315  fHistManager.CreateHistoGroup(groupname);
316  for (Int_t cent = 0; cent < fNcentBins; cent++) {
317  histname = TString::Format("%s/histCellEnergy_%d", groupname.Data(), cent);
318  histtitle = TString::Format("%s;#it{E}_{cell} (GeV);counts", histname.Data());
319  fHistManager.CreateTH1(histname, histtitle, 300, 0, 150);
320 
321  histname = TString::Format("%s/histNCells_%d", groupname.Data(), cent);
322  histtitle = TString::Format("%s;number of cells;events", histname.Data());
323  if (fForceBeamType != kpp) {
324  fHistManager.CreateTH1(histname, histtitle, 500, 0, 6000);
325  }
326  else {
327  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
328  }
329  }
330 }
331 
332 /*
333  * This function allocates the histograms for basic tracking QA.
334  * A set of histograms (pT, eta, phi, difference between kinematic properties
335  * at the vertex and at the EMCal surface, number of tracks) is allocated
336  * per each particle container and per each centrality bin.
337  */
339 {
340  TString histname;
341  TString histtitle;
342  TString groupname;
343  AliParticleContainer* partCont = 0;
344  TIter next(&fParticleCollArray);
345  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
346  groupname = partCont->GetName();
347 
348  // Protect against creating the histograms twice
349  if (fHistManager.FindObject(groupname)) {
350  AliWarning(TString::Format("%s: Found groupname %s in hist manager. The track containers will be filled into the same histograms.", GetName(), groupname.Data()));
351  continue;
352  }
353  fHistManager.CreateHistoGroup(groupname);
354  for (Int_t cent = 0; cent < fNcentBins; cent++) {
355  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), cent);
356  histtitle = TString::Format("%s;#it{p}_{T,track} (GeV/#it{c});counts", histname.Data());
357  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
358 
359  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), cent);
360  histtitle = TString::Format("%s;#it{#phi}_{track};counts", histname.Data());
361  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
362 
363  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), cent);
364  histtitle = TString::Format("%s;#it{#eta}_{track};counts", histname.Data());
365  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
366 
367  if (TClass(partCont->GetClassName()).InheritsFrom("AliVTrack")) {
368  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), cent);
369  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#eta}_{track}^{vertex} - #it{#eta}_{track}^{EMCal};counts", histname.Data());
370  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 50, -0.5, 0.5);
371 
372  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), cent);
373  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#phi}_{track}^{vertex} - #it{#phi}_{track}^{EMCal};counts", histname.Data());
374  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 200, -2, 2);
375 
376  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), cent);
377  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{p}_{T,track}^{vertex} - #it{p}_{T,track}^{EMCal} (GeV/#it{c});counts", histname.Data());
378  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, -fMaxBinPt/2, fMaxBinPt/2);
379 
380  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), cent);
381  histtitle = TString::Format("%s;#it{P}_{track} (GeV/#it{c});#it{E}_{cluster} / #it{P}_{track} #it{c};counts", histname.Data());
382  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, 0, 4);
383  }
384 
385  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), cent);
386  histtitle = TString::Format("%s;number of tracks;events", histname.Data());
387  if (fForceBeamType != kpp) {
388  fHistManager.CreateTH1(histname, histtitle, 500, 0, 5000);
389  }
390  else {
391  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
392  }
393  }
394  }
395 
396  histname = "fHistSumNTracks";
397  histtitle = TString::Format("%s;Sum of n tracks;events", histname.Data());
398  if (fForceBeamType != kpp) {
399  fHistManager.CreateTH1(histname, histtitle, 500, 0, 5000);
400  }
401  else {
402  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
403  }
404 }
405 
406 /*
407  * This function allocates the histograms for basic jet QA.
408  * A set of histograms (pT, eta, phi, area, number of jets, corrected pT) is allocated
409  * per each jet container and per each centrality bin.
410  */
412 {
413  TString histname;
414  TString histtitle;
415  TString groupname;
416  AliJetContainer* jetCont = 0;
417  TIter next(&fJetCollArray);
418  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
419  groupname = jetCont->GetName();
420  // Protect against creating the histograms twice
421  if (fHistManager.FindObject(groupname)) {
422  AliWarning(TString::Format("%s: Found groupname %s in hist manager. The jet containers will be filled into the same histograms.", GetName(), groupname.Data()));
423  continue;
424  }
425  fHistManager.CreateHistoGroup(groupname);
426  for (Int_t cent = 0; cent < fNcentBins; cent++) {
427  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), cent);
428  histtitle = TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
429  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
430 
431  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), cent);
432  histtitle = TString::Format("%s;#it{A}_{jet};counts", histname.Data());
433  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, 3);
434 
435  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), cent);
436  histtitle = TString::Format("%s;#it{#phi}_{jet};counts", histname.Data());
437  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
438 
439  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), cent);
440  histtitle = TString::Format("%s;#it{#eta}_{jet};counts", histname.Data());
441  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
442 
443  histname = TString::Format("%s/histNJets_%d", groupname.Data(), cent);
444  histtitle = TString::Format("%s;number of jets;events", histname.Data());
445  if (fForceBeamType != kpp) {
446  fHistManager.CreateTH1(histname, histtitle, 500, 0, 500);
447  }
448  else {
449  fHistManager.CreateTH1(histname, histtitle, 100, 0, 100);
450  }
451 
452  if (!jetCont->GetRhoName().IsNull()) {
453  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), cent);
454  histtitle = TString::Format("%s;#it{p}_{T,jet}^{corr} (GeV/#it{c});counts", histname.Data());
455  fHistManager.CreateTH1(histname, histtitle, fNbins, -fMaxBinPt / 2, fMaxBinPt / 2);
456  }
457  }
458  }
459 }
460 
462 {
463 
464  Bool_t oldStatus = TH1::AddDirectoryStatus();
465  TH1::AddDirectory(kFALSE);
466 
467  // set seed
468  fRandom = new TRandom3(0);
469 
470  fHistEvtSelection = new TH1I("fHistEvtSelection", "event selection", 6, -0.5, 5.5);
471  fHistEvtSelection->GetXaxis()->SetBinLabel(1,"ACCEPTED");
472  fHistEvtSelection->GetXaxis()->SetBinLabel(2,"events IN");
473  fHistEvtSelection->GetXaxis()->SetBinLabel(3,"event selection (rejected)");
474  fHistEvtSelection->GetXaxis()->SetBinLabel(4,"vertex cut (rejected)");
475  fHistEvtSelection->GetXaxis()->SetBinLabel(5,"centrality (rejected)");
476  fHistEvtSelection->GetXaxis()->SetBinLabel(6,"multiplicity (rejected)");
477 
478  fh1TrigRef=new TH1D("Trig Ref","",10,0.,10);
479  fh1TrigSig=new TH1D("Trig Sig","",10,0.,10);
480  fh2Ntriggers=new TH2F("# of triggers","",100,0.,100.,50,0.,50.);
481  fh2RPJetsC10=new TH2F("RPJetC10","",35,0.,3.5,100,0.,100.);
482  fh2RPJetsC20=new TH2F("RPJetC20","",35,0.,3.5,100,0.,100.);
483  fh2RPTC10=new TH2F("RPTriggerC10","",35,0.,3.5,50,0.,50.);
484  fh2RPTC20=new TH2F("RPTriggerC20","",35,0.,3.5,50,0.,50.);
485 
487 
488  fOutput->Add(fh1TrigRef);
489  fOutput->Add(fh1TrigSig);
490  fOutput->Add(fh2Ntriggers);
491  fOutput->Add(fh2RPJetsC10);
492  fOutput->Add(fh2RPJetsC20);
493  fOutput->Add(fh2RPTC10);
494  fOutput->Add(fh2RPTC20);
495 
497  const Int_t dimSpec = 6;
498  const Int_t nBinsSpec[dimSpec] = {100,100, 280, 50,200, fNRPBins};
499  const Double_t lowBinSpec[dimSpec] = {0,0,-80, 0,-0.5*TMath::Pi(), 0};
500  const Double_t hiBinSpec[dimSpec] = {100,1, 200, 50,1.5*TMath::Pi(), static_cast<Double_t>(fNRPBins)};
501  fHJetSpec = new THnSparseF("fHJetSpec","Recoil jet spectrum",dimSpec,nBinsSpec,lowBinSpec,hiBinSpec);
502  }
503 
504  // comment out since I want finer binning in jet area, to make it easier
505  // to change selection on jet area (Leticia used 0.8*R^2*Pi whereas 0.6 is used
506  // for inclusive jets)
507  //change binning in jet area
508 // Double_t *xPt6 = new Double_t[7];
509 // xPt6[0] = 0.;
510 // xPt6[1]=0.07;
511 // xPt6[2]=0.2;
512 // xPt6[3]=0.4;
513 // xPt6[4]=0.6;
514 // xPt6[5]=0.8;
515 // xPt6[6]=1;
516 // fHJetSpec->SetBinEdges(1,xPt6);
517 // delete [] xPt6;
518 
519  fOutput->Add(fHJetSpec);
520 
521  // azimuthal correlation
522 
523  fhDphiPtSig = new TH2F("hDphiPtS","recoil #Delta #phi vs jet pT signal",100,-2,5,250,-50,200);
524  fhDphiPtSig->GetXaxis()->SetTitle("#Delta #phi");
525  fhDphiPtSig->GetYaxis()->SetTitle("p^{reco,ch}_{T,jet} (GeV/c)");
526  fhDphiPtRef = new TH2F("hDphiPtR","recoil #Delta #phi vs jet pT reference",100,-2,5,250,-50,200);
527  fhDphiPtRef->GetXaxis()->SetTitle("#Delta #phi");
528  fhDphiPtRef->GetYaxis()->SetTitle("p^{reco,ch}_{T,jet} (GeV/c)");
529 
530  fOutput->Add(fhDphiPtRef);
531  fOutput->Add(fhDphiPtSig);
532 
533 
534  fhPtHybrDet= new TH2F("hPtHybrDet","pT response Pb-Pb+PYTHIA vs PYTHIA",200,0,200,200,0,200);
535  fhPtHybrDet->GetXaxis()->SetTitle("p^{Pb-Pb+PYTHIA,ch}_{T} (GeV/c)");
536  fhPtHybrDet->GetYaxis()->SetTitle("p^{reco,PYTHIA,ch}_{T} (GeV/c)");
537  fhPtDetPart= new TH2F("hPtDetPart","pT response PYTHIA vs part",200,0,200,200,0,200);
538  fhPtDetPart->GetXaxis()->SetTitle("p^{reco,PYTHIA,ch}_{T} (GeV/c)");
539  fhPtDetPart->GetYaxis()->SetTitle("p^{true}_{T} (GeV/c)");
540  fhPtHybrPart = new TH2F("hPtHybrPart",Form("pT response Pb-Pb+PYTHIA vs part, min shared pT > %.0f",fMinFractionSharedPt*100),200,0,200,200,0,200);
541  fhPtHybrPart->GetXaxis()->SetTitle("p^{Pb-Pb+PYTHIA,ch}_{T} (GeV/c)");
542  fhPtHybrPart->GetYaxis()->SetTitle("p^{true}_{T} (GeV/c)");
543  fhPtHybrPartCor = new TH2F("hPtHybrPartCor",Form("pT response Pb-Pb+PYTHIA corrected vs part, min shared pT > %.0f",fMinFractionSharedPt*100),200,0,200,200,0,200);
544  fhPtHybrPartCor->GetXaxis()->SetTitle("p^{Pb-Pb+PYTHIA,ch}_{T} (GeV/c)");
545  fhPtHybrPartCor->GetYaxis()->SetTitle("p^{true}_{T} (GeV/c)");
546 
547  fhPhiHybrPartCor = new TH2F("hPhiHybrPartCor",Form("phi response Pb-Pb+PYTHIA corrected vs part, min shared pT > %.0f",fMinFractionSharedPt*100),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-0.5*TMath::Pi(),1.5*TMath::Pi());
548  fhPhiHybrPartCor->GetXaxis()->SetTitle("#phi^{Pb-Pb+PYTHIA,ch}");
549  fhPhiHybrPartCor->GetYaxis()->SetTitle("#phi^{true}");
550  fhResidual = new TH1F("hResidual","residual",50,-1,1);
551  fhResidual->GetXaxis()->SetTitle("p^{reco}_{T} - p^{true}_{T} / p^{true}_{T}");
552  fhPtResidual= new TH2F("hPtResidual","pT vs residual",200,0,200,50,-1,1);
553  fhPtResidual->GetXaxis()->SetTitle("p^{true}_{T} (GeV/c)");
554  fhPtResidual->GetYaxis()->SetTitle("p^{reco}_{T} - p^{true}_{T} / p^{true}_{T}");
555  fhPhiResidual = new TH1F("hPhiResidual","residual phi",50,-1,1);
556  fhPhiResidual->GetXaxis()->SetTitle("#phi^{reco} - #phi^{true} / #phi^{true}");
557  fhPhiPhiResidual= new TH2F("hPhiPhiResidual","pT vs residual",600,-3,3,200,-0.5*TMath::Pi(),1.5*TMath::Pi());
558  fhPhiPhiResidual->GetXaxis()->SetTitle("#phi^{true}");
559  fhPhiPhiResidual->GetYaxis()->SetTitle("#phi^{reco} - #phi^{true} / #phi^{true}");
560 
561  fhPtDet= new TH1F("hPtDet","pT detector level",200,0,200);
562  fhPtDet->GetXaxis()->SetTitle("p^{reco,PYTHIA,ch}_{T} (GeV/c)");
563  fhPtDetMatchedToPart = new TH1F("hPtDetMatchedToPart","pT detector level matched to particle level jet",200,0,200);
564  fhPtDetMatchedToPart->GetXaxis()->SetTitle("p^{reco,PYTHIA,ch}_{T} (GeV/c)");
565 
566  fhPtHybrDetRecoil= new TH2F("hPtHybrDetRecoil","pT response Pb-Pb+PYTHIA vs PYTHIA",200,0,200,200,0,200);
567  fhPtHybrDetRecoil->GetXaxis()->SetTitle("p^{Pb-Pb+PYTHIA,ch}_{T} (GeV/c)");
568  fhPtHybrDetRecoil->GetYaxis()->SetTitle("p^{reco,PYTHIA,ch}_{T} (GeV/c)");
569  fhPtDetPartRecoil= new TH2F("hPtDetPartRecoil","pT response PYTHIA vs part",200,0,200,200,0,200);
570  fhPtDetPartRecoil->GetXaxis()->SetTitle("p^{reco,PYTHIA,ch}_{T} (GeV/c)");
571  fhPtDetPartRecoil->GetYaxis()->SetTitle("p^{true}_{T} (GeV/c)");
572  fhPtHybrPartRecoil = new TH2F("hPtHybrPartRecoil",Form("pT response Pb-Pb+PYTHIA vs part, min shared pT > %.0f",fMinFractionSharedPt*100),200,0,200,200,0,200);
573  fhPtHybrPartRecoil->GetXaxis()->SetTitle("p^{Pb-Pb+PYTHIA,ch}_{T} (GeV/c)");
574  fhPtHybrPartRecoil->GetYaxis()->SetTitle("p^{true}_{T} (GeV/c)");
575  fhPtHybrPartCorRecoil = new TH2F("hPtHybrPartCorRecoil",Form("pT response Pb-Pb+PYTHIA corrected vs part, min shared pT > %.0f",fMinFractionSharedPt*100),200,0,200,200,0,200);
576  fhPtHybrPartCorRecoil->GetXaxis()->SetTitle("p^{Pb-Pb+PYTHIA,ch}_{T} (GeV/c)");
577  fhPtHybrPartCorRecoil->GetYaxis()->SetTitle("p^{true}_{T} (GeV/c)");
578 
579  fhDPhiHybrPartCorRecoil = new TH2F("hDPhiHybrPartCorRecoil",Form("#Delta#phi response Pb-Pb+PYTHIA corrected vs part, min shared pT > %.0f",fMinFractionSharedPt*100),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-0.5*TMath::Pi(),1.5*TMath::Pi());
580  fhDPhiHybrPartCorRecoil->GetXaxis()->SetTitle("#Delta#phi^{Pb-Pb+PYTHIA,ch}");
581  fhDPhiHybrPartCorRecoil->GetYaxis()->SetTitle("#Delta#phi^{true}");
582  fhResidualRecoil = new TH1F("hResidualRecoil","residual",50,-1,1);
583  fhResidualRecoil->GetXaxis()->SetTitle("p^{reco}_{T} - p^{true}_{T} / p^{true}_{T}");
584  fhPtResidualRecoil= new TH2F("hPtResidualRecoil","pT vs residual",200,0,200,50,-1,1);
585  fhPtResidualRecoil->GetXaxis()->SetTitle("p^{true}_{T} (GeV/c)");
586  fhPtResidualRecoil->GetYaxis()->SetTitle("p^{reco}_{T} - p^{true}_{T} / p^{true}_{T}");
587 
588  fhDphiResidualRecoil = new TH1F("hDphiResidualRecoil","residual",50,-1,1);
589  fhDphiResidualRecoil->GetXaxis()->SetTitle("#Delta#phi^{reco} - #Delta#phi^{true} / #Delta#phi^{true}");
590  fhDphiphiResidualRecoil= new TH2F("hDphiphiResidualRecoil","#Delta#phi vs residual in phi",400,-3,3,200,-0.5*TMath::Pi(),1.5*TMath::Pi());
591  fhDphiphiResidualRecoil->GetXaxis()->SetTitle("#Delta#phi^{true}");
592  fhDphiphiResidualRecoil->GetYaxis()->SetTitle("#Delta#phi^{reco} - #Delta#phi^{true} / #Delta#phi^{true}");
593  fhPtDetRecoil= new TH1F("hPtDetRecoil","pT detector level",200,0,200);
594  fhPtDetRecoil->GetXaxis()->SetTitle("p^{reco,PYTHIA,ch}_{T} (GeV/c)");
595  fhPtDetMatchedToPartRecoil = new TH1F("hPtDetMatchedToPartRecoil","pT detector level matched to particle level jet",200,0,200);
596  fhPtDetMatchedToPartRecoil->GetXaxis()->SetTitle("p^{reco,PYTHIA,ch}_{T} (GeV/c)");
597 
598  fhTTPtDetMatchedToPart = new TH2F("hTTPtDetMatchedToPart","trigger track pT response reco vs partice",140,0,70,140,0,70);
599  fhTTPtDetMatchedToPart->GetXaxis()->SetTitle("p^{TT,reco}_{T} (GeV/c)");
600  fhTTPtDetMatchedToPart->GetYaxis()->SetTitle("p^{TT,part}_{T} (GeV/c)");
601  fhTTPhiDetMatchedToPart = new TH2F("hTTPhiDetMatchedToPart","trigger track #phi response reco vs partice",200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-0.5*TMath::Pi(),1.5*TMath::Pi());
602  fhTTPhiDetMatchedToPart->GetXaxis()->SetTitle("p^{TT,reco}_{T} (GeV/c)");
603  fhTTPhiDetMatchedToPart->GetYaxis()->SetTitle("p^{TT,part}_{T} (GeV/c)");
604 
605  fOutput->Add(fhPtHybrDet);
606  fOutput->Add(fhPtDetPart);
607  fOutput->Add(fhPtHybrPart);
608  fOutput->Add(fhPtHybrPartCor);
610  fOutput->Add(fhPtDet);
612  fOutput->Add(fhResidual);
613  fOutput->Add(fhPtResidual);
614  fOutput->Add(fhPhiResidual);
616 
622  fOutput->Add(fhPtDetRecoil);
628 
631 
632  TString varNamesInclusive[8]={"centrality","ptRawRec","areaRec","ptCorrRec","phiRec","ptPart","phiPart","binPtHard"};
633  TString varNamesRecoil[11]={"centrality","ptTT","ptRawRec","areaRec","ptCorrRec","phiRec","DPhiRec","ptPart","phiPart","DPhiPart","binPtHard"};
635  const char* nameEmbInclusive = GetOutputSlot(2)->GetContainer()->GetName();
636  fTreeEmbInclusive = new TTree(nameEmbInclusive, nameEmbInclusive);
637  for(Int_t ivar=0; ivar < 8; ivar++){
638  fTreeEmbInclusive->Branch(varNamesInclusive[ivar].Data(), &fTreeVarsInclusive[ivar], Form("%s/F", varNamesInclusive[ivar].Data()));
639  }
640  }
641 
643  const char* nameEmbRecoil= GetOutputSlot(3)->GetContainer()->GetName();
644  fTreeEmbRecoil = new TTree(nameEmbRecoil, nameEmbRecoil);
645  for(Int_t ivar=0; ivar < 11; ivar++){
646  fTreeEmbRecoil->Branch(varNamesRecoil[ivar].Data(), &fTreeVarsRecoil[ivar], Form("%s/F", varNamesRecoil[ivar].Data()));
647  }
648  }
649 
650  // =========== Switch on Sumw2 for all histos ===========
651  for (Int_t i=0; i<fOutput->GetEntries(); ++i) {
652  TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i));
653  if (h1){
654  h1->Sumw2();
655  continue;
656  }
657  THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i));
658  if (hn){
659  hn->Sumw2();
660  }
661  }
662 
663  // add QA plots from fEventCuts
664  fEventCuts.AddQAplotsToList(fOutput);
665 
666  TH1::AddDirectory(oldStatus);
667 
668  PostData(1, fOutput);
671 }
672 
680 {
681 
682  fHistEvtSelection->Fill(1); // number of events before event selection
683  AliVEvent *ev = InputEvent();
684  if (!fEventCuts.AcceptEvent(ev)) {
685  fHistEvtSelection->Fill(2);
686  return kTRUE;
687  }
688 
691  //DoClusterLoop();
692  //DoCellLoop();
693  DoJetCoreLoop();
695 
696  return kTRUE;
697 }
698 
700 {
701  // Do jet core analysis and fill histograms.
702 
704  AliJetContainer *jetContPart = 0x0;
705  AliJetContainer *jetContTrue = 0x0;
707  jetContTrue = GetJetContainer(fJetContTrueName);
708  jetContPart = GetJetContainer(fJetContPartName);
709  }
710 
711  if(!jetCont ||
713  AliError(Form("jet container not found - check name %s",fJetContName.Data()));
714  TIter next(&fJetCollArray);
715  while ((jetCont = static_cast<AliJetContainer*>(next())))
716  AliError(Form("%s",jetCont->GetName()));
717  AliFatal("Exit...");
718  return;
719  }
720 
721  // centrality selection
722  if(fDebug) Printf("centrality: %f\n", fCent);
724  ((fCent>fCentMax) || (fCent<fCentMin))) {
725  fHistEvtSelection->Fill(4);
726  return;
727  }
728  fHistEvtSelection->Fill(0);
729 
730  // Background
731  Double_t rho = 0;
732  if (jetCont->GetRhoParameter()) rho = jetCont->GetRhoVal();
733  if(fDebug) Printf("rho = %f",rho);
734 
735  // get MC particle container in case running embedding, to match
736  // reconstructed and MC-level trigger tracks
737  AliParticleContainer *partCont = 0x0;
739 // AliParticleContainer *partCont = 0x0;
740 // TIter next(&fParticleCollArray);
741 // while ((partCont = static_cast<AliParticleContainer*>(next()))) {
742 // TString groupname = partCont->GetName();
743 // Printf("particle name = %s",groupname.Data());
744 // }
745 
746  // Choose trigger track
747  Int_t nT=0;
748  TList ParticleList;
749  Double_t minT=0;
750  Double_t maxT=0;
751  Int_t number=0;
752  Double_t dice=fRandom->Uniform(0,1);
753  Bool_t isSignal = kFALSE;
754  if(dice>fFrac){
755  minT=fTTLowRef;
756  maxT=fTTUpRef;
757  }
758  if(dice<=fFrac){
759  isSignal = kTRUE;
760  minT=fTTLowSig;
761  maxT=fTTUpSig;
762  }
763  nT=SelectTrigger(&ParticleList,minT,maxT,number);
764  if(fDebug) Printf("%s class ---> n triggers between %f and %f = %i, index of trigger chosen = %i",dice>fFrac?"ref.":"sig.",minT,maxT,number,nT);
765  if(nT<0) return;
766 
767  if(dice>fFrac) fh1TrigRef->Fill(number);
768  if(dice<=fFrac)fh1TrigSig->Fill(number);
769 
770 
771  // particle loop -
772  for(Int_t tt=0;tt<ParticleList.GetEntries();tt++){
773  // histogram
774  //if(fHardest==0||fHardest==1){if(tt!=nT) continue;}
775  if(tt!=nT) continue;
776  AliVParticle *partback = (AliVParticle*)ParticleList.At(tt);
777  if(!partback) continue;
778  if(fDebug) Printf("trigger particle pt = %f \teta = %f \t phi = %f",partback->Pt(),partback->Eta(),partback->Phi());
779  // if(partback->Pt()<8) continue;
780 
781  Int_t injet4=0;
782  Int_t injet=0;
783 
784  fh2Ntriggers->Fill(fCent,partback->Pt());
785  Double_t phiBinT = RelativePhi(partback->Phi(),fEPV0);
786  if(fCent<20.) fh2RPTC20->Fill(TMath::Abs(phiBinT),partback->Pt());
787  if(fCent<10.) fh2RPTC10->Fill(TMath::Abs(phiBinT),partback->Pt());
788 
789  Double_t etabig=0;
790  Double_t ptbig=0;
791  Double_t areabig=0;
792  Double_t phibig=0.;
793  // Double_t areasmall=0;
794 
795  TString histname;
796  TString groupname;
797  groupname = jetCont->GetName();
798  UInt_t count = 0;
799  for(auto jetbig : jetCont->accepted()) {
800  if (!jetbig) continue;
801  count++;
802  ptbig = jetbig->Pt();
803  etabig = jetbig->Eta();
804  phibig = jetbig->Phi();
805  if(ptbig==0) continue;
806  Double_t phiBin = RelativePhi(phibig,fEPV0); //relative phi between jet and ev. plane
807  areabig = jetbig->Area();
808  Double_t ptcorr=ptbig-rho*areabig;
809  //JJJ - perhaps should change eta selection if implemented in jet container
810  if((etabig<fJetEtaMin)||(etabig>fJetEtaMax)) continue;
811  if(areabig>=0.07) injet=injet+1;
812  if(areabig>=0.4) injet4=injet4+1;
813  Double_t dphi=RelativePhi(partback->Phi(),phibig);
814  if(fDebug) Printf("jet properties...\n\teta = %f \t phi = %f \t pt = %f \t relativephi = %f\t area = %f\t rho = %f",etabig,phibig,ptbig,dphi,areabig,rho);
815 
816  // do azimuthal correlation analysis
817  // dPhi between -0.5 < dPhi < 1.5
818  Double_t dPhiShift=phibig-partback->Phi();
819  if(dPhiShift>2*TMath::Pi()) dPhiShift -= 2*TMath::Pi();
820  if(dPhiShift<-2*TMath::Pi()) dPhiShift += 2*TMath::Pi();
821  if(dPhiShift<-0.5*TMath::Pi()) dPhiShift += 2*TMath::Pi();
822  if(dPhiShift>1.5*TMath::Pi()) dPhiShift -= 2*TMath::Pi();
823  if(isSignal) fhDphiPtSig->Fill(dPhiShift,ptcorr);
824  else fhDphiPtRef->Fill(dPhiShift,ptcorr);
825 
826  // selection on relative phi
827  if(fJetHadronDeltaPhi>0. &&
828  TMath::Abs(dphi)<TMath::Pi()-fJetHadronDeltaPhi) continue;
829 
830  if(fCent<10.) fh2RPJetsC10->Fill(TMath::Abs(phiBin), ptcorr);
831  if(fCent<20.) fh2RPJetsC20->Fill(TMath::Abs(phiBin), ptcorr);
832 
834  Float_t phitt=partback->Phi();
835  if(phitt<0)phitt+=TMath::Pi()*2.;
836  Int_t phiBintt = GetPhiBin(phitt-fEPV0);
837 
838  Double_t fillspec[] = {fCent,areabig,ptcorr,partback->Pt(),dPhiShift, static_cast<Double_t>(phiBintt)};
839  fHJetSpec->Fill(fillspec);
840  }
841 
843  //
844  // embedding for recoil jets
845  // get MC info
846  //
847  Double_t ptTTMC = 0;
848  Double_t phiTTMC = 0;
849  Int_t TTmatched = 0;
850  for(auto partMC : partCont->accepted()) {
851  Int_t labtr = partback->GetLabel();
852  Int_t labpa = partMC->GetLabel();
853  if(labtr==labpa) {
854  ptTTMC = partMC->Pt();
855  phiTTMC = partMC->Phi();
856  TTmatched++;
857  break;
858  }
859  }
860  if(TTmatched!=1) continue;
861  Double_t ptTTreco = partback->Pt();
862  Double_t phiTTreco = partback->Phi();
863  if(fDebug) Printf("found corresponding truth-level particle, pt reco = %f pt MC = %f, phi reco = %f phi MC = %f",ptTTreco,ptTTMC,phiTTreco,phiTTMC);
864  fhTTPtDetMatchedToPart->Fill(ptTTreco,ptTTMC);
865  fhTTPhiDetMatchedToPart->Fill(phiTTreco,phiTTMC);
866 
867  auto jet2 = jetbig->ClosestJet();
868  if(!jet2) {
869  //Printf("jet 2 cant be found");
870  continue;}
871  Double_t ptJet2 = jet2->Pt();
872  fhPtDetRecoil->Fill(ptJet2);
873  auto jet3 = jet2->ClosestJet();
874  if(!jet3) {
875  //Printf("jet3 can't be found");
876  continue;
877  }
878  fhPtDetMatchedToPartRecoil->Fill(ptJet2);
879  Double_t ptJet3 = jet3->Pt();
880  Double_t phiJet3 = jet3->Phi();
881 
882 
883  Double_t dPhiPart=phiJet3-phiTTMC;
884  if(dPhiPart>2*TMath::Pi()) dPhiPart -= 2*TMath::Pi();
885  if(dPhiPart<-2*TMath::Pi()) dPhiPart += 2*TMath::Pi();
886  if(dPhiPart<-0.5*TMath::Pi()) dPhiPart += 2*TMath::Pi();
887  if(dPhiPart>1.5*TMath::Pi()) dPhiPart -= 2*TMath::Pi();
888 
889  if(fDebug) Printf("--- recoil - jet pt = jet hybrid pt = %f\t jet matched det pt = %f\t jet matched particle level pt = %f\t\n\tjet reco phi = %f\t jet particle phi = %f",ptbig,ptJet2,ptJet3,phibig,phiJet3);
890 
891  fhPtDetPartRecoil->Fill(ptJet2,ptJet3);
892  Double_t fraction = jetCont->GetFractionSharedPt(jetbig);
893  if(fraction < fMinFractionSharedPt) continue;
894 
895  Double_t residual = (ptcorr - ptJet3) / ptJet3;
896  Double_t residualDphi = (dPhiShift - dPhiPart) / dPhiPart;
897 
898  fhPtHybrDetRecoil->Fill(ptbig,ptJet2);
899  fhPtHybrPartRecoil->Fill(ptbig,ptJet3);
900  fhPtHybrPartCorRecoil->Fill(ptcorr,ptJet3);
901  fhDPhiHybrPartCorRecoil->Fill(dPhiShift,dPhiPart);
902  fhResidualRecoil->Fill(residual);
903  fhPtResidualRecoil->Fill(ptJet3,residual);
904  fhDphiResidualRecoil->Fill(residualDphi);
905  fhDphiphiResidualRecoil->Fill(dPhiPart,residualDphi);
906 
907  if(fFillRecoilTree) {
908  fTreeVarsRecoil[0] = fCent;
909  fTreeVarsRecoil[1] = partback->Pt();
910  fTreeVarsRecoil[2] = ptbig;
911  fTreeVarsRecoil[3] = areabig;
912  fTreeVarsRecoil[4] = ptcorr;
913  fTreeVarsRecoil[5] = phibig;
914  fTreeVarsRecoil[6] = dPhiShift;
915  fTreeVarsRecoil[7] = ptJet3;
916  fTreeVarsRecoil[8] = phiJet3;
917  fTreeVarsRecoil[9] = dPhiPart;
919  fTreeEmbRecoil->Fill();
920  }
921  }
922  }
923  }
924 }
925 
927 
931  if(fDebug) Printf("particle container 0 entries = %i \t1 entries = %i\t 2 entries = %i",partCont0->GetNParticles(),partCont1->GetNParticles(),partCont2->GetNParticles());
935 
936  if(!jetCont || !jetContPart || !jetContTrue)
937  {
938  AliError(Form("jet container not found - check name %s",fJetContName.Data()));
939  TIter next(&fJetCollArray);
940  while ((jetCont = static_cast<AliJetContainer*>(next())))
941  AliError(Form("%s",jetCont->GetName()));
942  AliFatal("Exit...");
943  return;
944  }
945 
946  if(fDebug) {
947  Printf("n particle jets = %i",jetContPart->GetNJets());
948  Printf("n reco jets = %i",jetCont->GetNJets());
949  Printf("n PYTHIA jets = %i",jetContTrue->GetNJets());
950  }
951 
952  // Background
953  Double_t rho = 0;
954  if (jetCont->GetRhoParameter()) rho = jetCont->GetRhoVal();
955 
956  // PYTHIA event weight
957  // note - not used
958  // AliGenPythiaEventHeader *pyHeader = 0x0; //!<! Pythia header of the current external event
959  // AliAODEvent *ev = dynamic_cast<AliAODEvent*>(InputEvent());
960  // AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(ev->FindListObject(AliAODMCHeader::StdBranchName()));
961  // if (aodMCH) {
962  // for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
963  // pyHeader= dynamic_cast<AliGenPythiaEventHeader*>(aodMCH->GetCocktailHeader(i));
964  // if (pyHeader) break;
965  // }
966  // }
967  //
968  // Double_t pythiaCrossSection = 0;
969  // Double_t pythiaTrials = 0;
970  // Double_t pythiaWeight = 0;
971  // if (pyHeader)
972  // {
973  // if(fDebug) Printf("have pythia header - get weight");
974  // pythiaCrossSection = pyHeader->GetXsection();
975  // pythiaTrials = pyHeader->Trials();
976  // //fPythiaPtHard = fPythiaHeader->GetPtHard();
977  // pythiaWeight = pythiaCrossSection / pythiaTrials;
978  // }
979  // if(fDebug) Printf("pythia weight = %f",pythiaWeight);
980 
981  for(auto jet1 : jetCont->accepted()) { // loop over hybrid jets
982 
983  Double_t ptJet1 = jet1->Pt();
984  Double_t phiJet1 = jet1->Phi();
985  auto jet2 = jet1->ClosestJet();
986  if(!jet2) {
987  //Printf("jet 2 cant be found");
988  continue;}
989  Double_t ptJet2 = jet2->Pt();
990  fhPtDet->Fill(ptJet2);
991  auto jet3 = jet2->ClosestJet();
992  if(!jet3) {
993  //Printf("jet3 can't be found");
994  continue;
995  }
996  fhPtDetMatchedToPart->Fill(ptJet2);
997  Double_t ptJet3 = jet3->Pt();
998  Double_t phiJet3 = jet3->Phi();
999 
1000  if(phiJet3>2*TMath::Pi()) phiJet3 -= 2*TMath::Pi();
1001  if(phiJet3<-2*TMath::Pi()) phiJet3 += 2*TMath::Pi();
1002  if(phiJet3<-0.5*TMath::Pi()) phiJet3 += 2*TMath::Pi();
1003  if(phiJet3>1.5*TMath::Pi()) phiJet3 -= 2*TMath::Pi();
1004 
1005  if(phiJet1>2*TMath::Pi()) phiJet1 -= 2*TMath::Pi();
1006  if(phiJet1<-2*TMath::Pi()) phiJet1 += 2*TMath::Pi();
1007  if(phiJet1<-0.5*TMath::Pi()) phiJet1 += 2*TMath::Pi();
1008  if(phiJet1>1.5*TMath::Pi()) phiJet1 -= 2*TMath::Pi();
1009 
1010  if(fDebug) Printf("--- jet pt = jet hybrid pt = %f\t jet matched det pt = %f\t jet matched particle level pt = %f\t",ptJet1,ptJet2,ptJet3);
1011 
1012  fhPtDetPart->Fill(ptJet2,ptJet3);
1013  Double_t fraction = jetCont->GetFractionSharedPt(jet1);
1014  if(fraction < fMinFractionSharedPt) continue;
1015 
1016  Double_t area = jet1->Area();
1017  Double_t ptCorr = ptJet1-rho*area;
1018 
1019  Double_t residual = (ptCorr - ptJet3) / ptJet3;
1020  Double_t residualPhi = (phiJet1 - phiJet3) / phiJet3;
1021 
1022  fhPtHybrDet->Fill(ptJet1,ptJet2);
1023  fhPtHybrPart->Fill(ptJet1,ptJet3);
1024  fhPtHybrPartCor->Fill(ptCorr,ptJet3);
1025  fhPhiHybrPartCor->Fill(phiJet1,phiJet3);
1026 
1027  fhResidual->Fill(residual);
1028  fhPtResidual->Fill(ptJet3,residual);
1029  fhPhiResidual->Fill(residualPhi);
1030  fhPhiPhiResidual->Fill(phiJet3,residualPhi);
1031 
1034  fTreeVarsInclusive[1] = ptJet1;
1035  fTreeVarsInclusive[2] = area;
1036  fTreeVarsInclusive[3] = ptCorr;
1037  fTreeVarsInclusive[4] = phiJet1;
1038  fTreeVarsInclusive[5] = ptJet3;
1039  fTreeVarsInclusive[6] = phiJet3;
1041  fTreeEmbInclusive->Fill();
1042  }
1043  }
1044 // for(auto jettrue : jetContPart->accepted()) {
1045 // // jettrue
1046 // Double_t ptTrue = jettrue->Pt();
1047 // Double_t phiTrue = jettrue->Phi();
1048 // Double_t etaTrue= jettrue->Eta();
1049 // auto jetmatched = jettrue->ClosestJet();
1050 // if(!jetmatched) continue;
1051 // Double_t ptMatched = jetmatched->Pt();
1052 // Double_t phiMatched = jetmatched->Phi();
1053 // Double_t etaMatched = jetmatched->Eta();
1054 // Double_t residual = (ptMatched - ptTrue) / ptTrue;
1055 // fhPtHybrTrue->Fill(ptTrue,ptMatched);
1056 // fhResidual->Fill(residual);
1057 // fhPtResidual->Fill(ptTrue,residual);
1058 // }
1059 }
1060 
1061 
1062 
1068 {
1069  TString histname;
1070  TString groupname;
1071  AliJetContainer* jetCont = 0;
1072  TIter next(&fJetCollArray);
1073  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
1074  groupname = jetCont->GetName();
1075  UInt_t count = 0;
1076  for(auto jet : jetCont->accepted()) {
1077  if (!jet) continue;
1078  count++;
1079 
1080  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), fCentBin);
1081  fHistManager.FillTH1(histname, jet->Pt());
1082 
1083  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), fCentBin);
1084  fHistManager.FillTH1(histname, jet->Area());
1085 
1086  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), fCentBin);
1087  fHistManager.FillTH1(histname, jet->Phi());
1088 
1089  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), fCentBin);
1090  fHistManager.FillTH1(histname, jet->Eta());
1091 
1092  if (jetCont->GetRhoParameter()) {
1093  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), fCentBin);
1094  fHistManager.FillTH1(histname, jet->Pt() - jetCont->GetRhoVal() * jet->Area());
1095  }
1096  }
1097  histname = TString::Format("%s/histNJets_%d", groupname.Data(), fCentBin);
1098  fHistManager.FillTH1(histname, count);
1099  }
1100 }
1101 
1107 {
1109 
1110  TString histname;
1111  TString groupname;
1112  UInt_t sumAcceptedTracks = 0;
1113  AliParticleContainer* partCont = 0;
1114  TIter next(&fParticleCollArray);
1115  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
1116  groupname = partCont->GetName();
1117  UInt_t count = 0;
1118  for(auto part : partCont->accepted()) {
1119  if (!part) continue;
1120  count++;
1121 
1122  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), fCentBin);
1123  fHistManager.FillTH1(histname, part->Pt());
1124 
1125  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), fCentBin);
1126  fHistManager.FillTH1(histname, part->Phi());
1127 
1128  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), fCentBin);
1129  fHistManager.FillTH1(histname, part->Eta());
1130 
1131  if (partCont->GetLoadedClass()->InheritsFrom("AliVTrack")) {
1132  const AliVTrack* track = static_cast<const AliVTrack*>(part);
1133 
1134  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), fCentBin);
1135  fHistManager.FillTH1(histname, track->Pt(), track->Eta() - track->GetTrackEtaOnEMCal());
1136 
1137  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), fCentBin);
1138  fHistManager.FillTH1(histname, track->Pt(), track->Phi() - track->GetTrackPhiOnEMCal());
1139 
1140  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), fCentBin);
1141  fHistManager.FillTH1(histname, track->Pt(), track->Pt() - track->GetTrackPtOnEMCal());
1142 
1143  if (clusCont) {
1144  Int_t iCluster = track->GetEMCALcluster();
1145  if (iCluster >= 0) {
1146  AliVCluster* cluster = clusCont->GetAcceptCluster(iCluster);
1147  if (cluster) {
1148  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), fCentBin);
1149  fHistManager.FillTH2(histname, track->P(), cluster->GetNonLinCorrEnergy() / track->P());
1150  }
1151  }
1152  }
1153  }
1154  }
1155  sumAcceptedTracks += count;
1156 
1157  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), fCentBin);
1158  fHistManager.FillTH1(histname, count);
1159  }
1160 
1161  histname = "fHistSumNTracks";
1162  fHistManager.FillTH1(histname, sumAcceptedTracks);
1163 }
1164 
1170 {
1171  TString histname;
1172  TString groupname;
1173  UInt_t sumAcceptedClusters = 0;
1174  AliClusterContainer* clusCont = 0;
1175  TIter next(&fClusterCollArray);
1176  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
1177  groupname = clusCont->GetName();
1178 
1179  for(auto cluster : clusCont->all()) {
1180  if (!cluster) continue;
1181 
1182  if (cluster->GetIsExotic()) {
1183  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), fCentBin);
1184  fHistManager.FillTH1(histname, cluster->E());
1185  }
1186  }
1187 
1188  UInt_t count = 0;
1189  for(auto cluster : clusCont->accepted()) {
1190  if (!cluster) continue;
1191  count++;
1192 
1193  AliTLorentzVector nPart;
1194  cluster->GetMomentum(nPart, fVertex);
1195 
1196  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), fCentBin);
1197  fHistManager.FillTH1(histname, cluster->E());
1198 
1199  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), fCentBin);
1200  fHistManager.FillTH1(histname, cluster->GetNonLinCorrEnergy());
1201 
1202  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), fCentBin);
1203  fHistManager.FillTH1(histname, cluster->GetHadCorrEnergy());
1204 
1205  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), fCentBin);
1206  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
1207 
1208  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), fCentBin);
1209  fHistManager.FillTH1(histname, nPart.Eta());
1210  }
1211  sumAcceptedClusters += count;
1212 
1213  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), fCentBin);
1214  fHistManager.FillTH1(histname, count);
1215  }
1216 
1217  histname = "fHistSumNClusters";
1218  fHistManager.FillTH1(histname, sumAcceptedClusters);
1219 }
1220 
1226 {
1227  if (!fCaloCells) return;
1228 
1229  TString histname;
1230 
1231  const Short_t ncells = fCaloCells->GetNumberOfCells();
1232 
1233  histname = TString::Format("%s/histNCells_%d", fCaloCellsName.Data(), fCentBin);
1234  fHistManager.FillTH1(histname, ncells);
1235 
1236  histname = TString::Format("%s/histCellEnergy_%d", fCaloCellsName.Data(), fCentBin);
1237  for (Short_t pos = 0; pos < ncells; pos++) {
1238  Double_t amp = fCaloCells->GetAmplitude(pos);
1239 
1240  fHistManager.FillTH1(histname, amp);
1241  }
1242 }
1243 
1249 {
1251 }
1252 
1261 {
1262  return kTRUE;
1263 }
1264 
1269 {
1270 }
1271 
1273 
1274  Int_t index=-1;
1275  Int_t triggers[100];
1276 
1277  for(Int_t cr=0;cr<100;cr++) triggers[cr]=-1;
1278 
1279  Int_t im=0;
1280 
1281  TString groupname = "";
1282  AliParticleContainer* partCont = 0x0;
1284  else partCont = GetParticleContainer(0);
1285  groupname = partCont->GetName();
1286  UInt_t iCount = 0;
1287  for(auto part : partCont->accepted()) {
1288  if (!part) continue;
1289  list->Add(part);
1290  iCount++;
1291  if(part->Pt()>=minT && part->Pt()<maxT){
1292  triggers[im]=iCount-1;
1293  im=im+1;
1294  }
1295  }
1296  number=im;
1297  Int_t rd=0;
1298  if(im>0) rd=fRandom->Integer(im);
1299  index=triggers[rd];
1300  return index;
1301 }
1302 
1304 
1305  // get relative DeltaPhi from -pi < DeltaPhi < pi
1306 
1307  if (vphi < -1*TMath::Pi()) vphi += (2*TMath::Pi());
1308  else if (vphi > TMath::Pi()) vphi -= (2*TMath::Pi());
1309  if (mphi < -1*TMath::Pi()) mphi += (2*TMath::Pi());
1310  else if (mphi > TMath::Pi()) mphi -= (2*TMath::Pi());
1311  double dphi = mphi-vphi;
1312  if (dphi < -1*TMath::Pi()) dphi += (2*TMath::Pi());
1313  else if (dphi > TMath::Pi()) dphi -= (2*TMath::Pi());
1314  return dphi;//dphi in [-Pi, Pi]
1315 }
1316 
1318 {
1319  Int_t phibin=-1;
1320  if(!(TMath::Abs(phi)<=2*TMath::Pi())) return -1;
1321  Double_t phiwrtrp=TMath::ACos(TMath::Abs(TMath::Cos(phi)));
1322  phibin=Int_t(fNRPBins*phiwrtrp/(0.5*TMath::Pi()));
1323  //if(phibin<0||phibin>=fNRPBins){AliError("Phi Bin not defined");}
1324  return phibin;
1325 }
Float_t fJetHadronDeltaPhi
max angle from pi (set <0 for no selection)
THashList * CreateHistoGroup(const char *groupname)
Create a new group of histograms within a parent group.
TObjArray fClusterCollArray
cluster collection array
Float_t fTTLowRef
minimum reference trigger track pt
Double_t GetRhoVal() const
const TString & GetRhoName() const
double Double_t
Definition: External.C:58
Float_t fFrac
fraction of events that are used to fill signal recoil jet population
Bool_t fFillRecoilTHnSparse
switch to fill recoil THnSparse for main analysis
Definition: External.C:236
Int_t SelectTrigger(TList *list, Double_t minT, Double_t maxT, Int_t &number)
AliJetContainer * GetJetContainer(Int_t i=0) const
Float_t fTTUpRef
maximum reference trigger track pt
Int_t GetNParticles() const
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
Declaration of class AliTLorentzVector.
Bool_t fFillInclusiveTree
switch to fill embedding tree with inclusive jet info
Double_t fMinBinPt
min pt in histograms
Double_t fEPV0
!event plane V0
Int_t fCentBin
!event centrality bin
TString fJetContName
Base level jet container name.
Float_t fMinFractionSharedPt
min fraction of pt between hybrid / detector jets
Container for particles within the EMCAL framework.
TString fJetContTrueName
True pp (detector) level jet container name.
TString kData
Declare data MC or deltaAOD.
TObjArray fParticleCollArray
particle/track collection array
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Get particle container attached to this task.
const AliClusterIterableContainer all() const
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Create a new TH2 within the container.
TObject * FindObject(const char *name) const
Find an object inside the container.
int Int_t
Definition: External.C:63
Float_t fTTUpSig
maximum signal trigger track pt
Definition: External.C:204
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
float Float_t
Definition: External.C:68
Double_t Phi_0_2pi() const
Float_t fTTLowSig
minimum signal trigger track pt
Int_t GetNJets() const
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
BeamType fForceBeamType
forced beam type
Int_t fNcentBins
how many centrality bins
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
Definition: External.C:212
AliVCluster * GetAcceptCluster(Int_t i) const
TString fJetContPartName
Particle(MC) level jet container name.
const AliClusterIterableContainer accepted() const
Double_t fCent
!event centrality
Float_t fCentMax
maximum centrality
TString fCaloCellsName
name of calo cell collection
Bool_t fFillJetHistograms
switch to fill jet histograms
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
TObjArray fJetCollArray
jet collection array
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Double_t RelativePhi(Double_t mphi, Double_t vphi)
short Short_t
Definition: External.C:23
AliVCaloCells * fCaloCells
!cells
AliRhoParameter * GetRhoParameter()
AliEmcalList * fOutput
!output list
Double_t fMaxBinPt
max pt in histograms
Int_t fPtHardBin
pt hard bin if running embedding
THistManager fHistManager
Histogram manager.
Double_t fVertex[3]
!event vertex
void SetMakeGeneralHistograms(Bool_t g)
Base task in the EMCAL jet framework.
Double_t GetFractionSharedPt(const AliEmcalJet *jet, AliParticleContainer *cont2=0x0) const
Declaration of class AliEmcalPythiaInfo.
const AliParticleIterableContainer accepted() const
const char Option_t
Definition: External.C:48
void UserCreateOutputObjects()
Main initialization function on the worker.
const AliJetIterableContainer accepted() const
bool Bool_t
Definition: External.C:53
Bool_t fFillRecoilTree
switch to fill embedding tree with recoil jet info
Container structure for EMCAL clusters.
Float_t fCentMin
minimum centrality
Container for jet within the EMCAL jet framework.
Definition: External.C:196
Bool_t fFillTrackHistograms
switch to fill track histograms
Int_t fNbins
no. of pt bins
Int_t fRejectionFactorInclusiveJets
factor to reject inclusive jets, to reduce size of ttree