AliPhysics  8bb951a (8bb951a)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskChargedJetsHadronCF.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // Jet+h correlation task
4 //
5 // Author: R. Haake
6 
7 #include <TClonesArray.h>
8 #include <TF1.h>
9 #include <TH1F.h>
10 #include <TH2F.h>
11 #include <TH3F.h>
12 #include <THn.h>
13 #include <TTree.h>
14 #include <TList.h>
15 #include <TLorentzVector.h>
16 
17 #include "AliVTrack.h"
18 #include "AliEmcalJet.h"
19 #include "AliRhoParameter.h"
20 #include "AliLog.h"
21 #include "AliJetContainer.h"
22 #include "AliTrackContainer.h"
23 #include "AliPicoTrack.h"
24 #include "AliVParticle.h"
25 #include "TRandom3.h"
27 
29 
33 
34 //________________________________________________________________________
36 {
37 // dummy destructor
38 }
39 
40 //________________________________________________________________________
42 {
43 // dummy destructor
44 }
45 
46 //________________________________________________________________________
48  AliAnalysisTaskEmcalJet("AliAnalysisTaskChargedJetsHadronCF", kTRUE),
49  fJetsCont(0),
50  fTracksCont(0),
51  fJetsTree(0),
52  fJetsTreeBuffer(0),
53  fExtractionPercentage(0),
54  fExtractionMinPt(0),
55  fNumberOfCentralityBins(10),
56  fJetsOutput(),
57  fTracksOutput(),
58  fJetsInput(),
59  fJetParticleArrayName("JetsDPhiBasicParticles"),
60  fTrackParticleArrayName(""),
61  fJetMatchingArrayName(""),
62  fRandom(0),
63  fRejectionFunction(0),
64  fJetOutputMode(0),
65  fMinFakeFactorPercentage(0),
66  fMaxFakeFactorPercentage(0),
67  fEventCriteriumMode(0),
68  fEventCriteriumMinBackground(0),
69  fEventCriteriumMaxBackground(0),
70  fEventCriteriumMinLeadingJetPt(0),
71  fEventCriteriumMinSubleadingJetPt(0),
72  fLeadingJet(),
73  fSubleadingJet(),
74  fAcceptedJets(0),
75  fAcceptedTracks(0)
76 {
77  // Default constructor.
79  fRandom = new TRandom3(0);
80 }
81 
82 
83 //________________________________________________________________________
85  AliAnalysisTaskEmcalJet(name, kTRUE),
86  fJetsCont(0),
87  fTracksCont(0),
88  fJetsTree(0),
89  fJetsTreeBuffer(0),
90  fExtractionPercentage(0),
91  fExtractionMinPt(0),
92  fNumberOfCentralityBins(10),
93  fJetsOutput(),
94  fTracksOutput(),
95  fJetsInput(),
96  fJetParticleArrayName("JetsDPhiBasicParticles"),
97  fTrackParticleArrayName(""),
98  fJetMatchingArrayName(""),
99  fRandom(0),
100  fRejectionFunction(0),
101  fJetOutputMode(0),
102  fMinFakeFactorPercentage(0),
103  fMaxFakeFactorPercentage(0),
104  fEventCriteriumMode(0),
105  fEventCriteriumMinBackground(0),
106  fEventCriteriumMaxBackground(0),
107  fEventCriteriumMinLeadingJetPt(0),
108  fEventCriteriumMinSubleadingJetPt(0),
109  fLeadingJet(),
110  fSubleadingJet(),
111  fAcceptedJets(0),
112  fAcceptedTracks(0)
113 {
114  // Constructor
116  fRandom = new TRandom3(0);
117 }
118 
119 //________________________________________________________________________
121 {
122  // Destructor.
123 }
124 
125 //________________________________________________________________________
127 {
129 
130  // ### Basic container settings
132  if(fJetsCont) { //get particles connected to jets
133  fJetsCont->PrintCuts();
135  } else { //no jets, just analysis tracks
137  }
138  if(fTracksCont) fTracksCont->SetClassName("AliVTrack");
139 
140  // ### Create all histograms
141 
142  // Change the event rejection histogram -> Add a custom value
143  fHistEventRejection->GetXaxis()->SetBinLabel(14,"JetCrit");
144 
145  // Track QA plots
146  AddHistogram2D<TH2D>("hTrackPt", "Tracks p_{T} distribution", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)", "Centrality", "dN^{Tracks}/dp_{T}");
147  AddHistogram2D<TH2D>("hTrackPhi", "Track angular distribution in #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Tracks}/(d#phi)");
148  AddHistogram2D<TH2D>("hTrackEta", "Track angular distribution in #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta", "Centrality", "dN^{Tracks}/(d#eta)");
149  AddHistogram2D<TH2D>("hTrackPhiEta", "Track angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Tracks}/d#phi d#eta");
150 
151  AddHistogram2D<TH2D>("hLeadingTrackPt", "Leading tracks p_{T} distribution", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)", "Centrality", "dN^{Tracks}/dp_{T}");
152  AddHistogram2D<TH2D>("hLeadingTrackPhi", "Leading tracks angular distribution in #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Tracks}/(d#phi)");
153  AddHistogram2D<TH2D>("hLeadingTrackEta", "Leading tracks angular distribution in #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta", "Centrality", "dN^{Tracks}/(d#eta)");
154  AddHistogram2D<TH2D>("hLeadingTrackPhiEta", "Track angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Tracks}/d#phi d#eta");
155 
156  AddHistogram2D<TH2D>("hTrackEtaPt", "Track angular distribution in #eta vs. p_{T}", "LEGO2", 100, -2.5, 2.5, 300, 0., 300., "#eta", "p_{T} (GeV/c)", "dN^{Tracks}/(d#eta dp_{T})");
157  AddHistogram2D<TH2D>("hTrackPhiPt", "Track angular distribution in #phi vs. p_{T}", "LEGO2", 180, 0, 2*TMath::Pi(), 300, 0., 300., "#phi", "p_{T} (GeV/c)", "dN^{Tracks}/(d#phi dp_{T})");
158 
159 
160  // Jet QA plots
161  AddHistogram2D<TH2D>("hJetPtRaw", "Jets p_{T} distribution (no bgrd. corr.)", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
162  AddHistogram2D<TH2D>("hJetPt", "Jets p_{T} distribution (background subtracted)", "", 400, -100., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
163  AddHistogram2D<TH2D>("hJetPhi", "Jet angular distribution #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Jets}/d#phi");
164  AddHistogram2D<TH2D>("hJetEta", "Jet angular distribution #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta","Centrality","dN^{Jets}/d#eta");
165  AddHistogram2D<TH2D>("hJetPhiPt", "Jet angular distribution #phi vs. p_{T}", "LEGO2", 180, 0., 2*TMath::Pi(), 400, -100., 300., "#phi", "p_{T, jet} (GeV/c)", "dN^{Jets}/d#phi dp_{T}");
166  AddHistogram2D<TH2D>("hJetEtaPt", "Jet angular distribution #eta vs. p_{T}", "LEGO2", 100, -2.5, 2.5, 400, -100., 300., "#eta","p_{T, jet} (GeV/c)","dN^{Jets}/d#eta dp_{T}");
167  AddHistogram2D<TH2D>("hJetPhiEta", "Jet angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Jets}/d#phi d#eta");
168  AddHistogram2D<TH2D>("hJetArea", "Jet area", "LEGO2", 200, 0., 2., fNumberOfCentralityBins, 0, 100, "Jet A", "Centrality", "dN^{Jets}/dA");
169  AddHistogram2D<TH2D>("hJetAreaPt", "Jet area vs. p_{T}", "LEGO2", 200, 0., 2., 400, -100., 300., "Jet A", "p_{T, jet} (GeV/c)", "dN^{Jets}/dA dp_{T}");
170  AddHistogram2D<TH2D>("hJetPtLeadingHadron", "Jet leading hadron p_{T} distribution vs. jet p_{T}", "", 300, 0., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T,lead had} (GeV/c)", "dN^{Jets}/dp_{T}dp_{T,had}");
171 
172  AddHistogram2D<TH2D>("hJetConstituentPt_Cent0_100", "Jet constituent p_{T} distribution vs. jet p_T (background subtracted)", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
173  AddHistogram2D<TH2D>("hJetConstituentPt_Cent0_10", "Jet constituent p_{T} distribution vs. jet p_T (background subtracted), 0-10 centrality", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
174 
175  AddHistogram2D<TH2D>("hJetConstituentCount_Cent0_100", "Jet constituent count vs. jet p_T (background subtracted)", "", 400, -100., 300., 200, 0., 200., "p_{T, jet} (GeV/c)", "Count", "dN^{Jets}/dNdp_{T}");
176  AddHistogram2D<TH2D>("hJetConstituentCount_Cent0_10", "Jet constituent count vs. jet p_T (background subtracted), 0-10 centrality", "", 400, -100., 300., 200, 0., 200., "p_{T, jet} (GeV/c)", "Count", "dN^{Jets}/dNdp_{T}");
177 
178  AddHistogram2D<TH2D>("hLeadingJetPtRaw", "Jets p_{T} distribution (no bgrd. corr.)", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
179  AddHistogram2D<TH2D>("hLeadingJetPt", "Jets p_{T} distribution (background subtracted)", "", 400, -100., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
180  AddHistogram2D<TH2D>("hLeadingJetPhi", "Jet angular distribution #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Jets}/d#phi");
181  AddHistogram2D<TH2D>("hLeadingJetEta", "Jet angular distribution #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta","Centrality","dN^{Jets}/d#eta");
182  AddHistogram2D<TH2D>("hLeadingJetPhiPt", "Jet angular distribution #phi vs. p_{T}", "LEGO2", 180, 0., 2*TMath::Pi(), 400, -100., 300., "#phi", "p_{T, jet} (GeV/c)", "dN^{Jets}/d#phi dp_{T}");
183  AddHistogram2D<TH2D>("hLeadingJetEtaPt", "Jet angular distribution #eta vs. p_{T}", "LEGO2", 100, -2.5, 2.5, 400, -100., 300., "#eta","p_{T, jet} (GeV/c)","dN^{Jets}/d#eta dp_{T}");
184  AddHistogram2D<TH2D>("hLeadingJetPhiEta", "Jet angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Jets}/d#phi d#eta");
185  AddHistogram2D<TH2D>("hLeadingJetArea", "Jet area", "LEGO2", 200, 0., 2., fNumberOfCentralityBins, 0, 100, "Jet A", "Centrality", "dN^{Jets}/dA");
186  AddHistogram2D<TH2D>("hLeadingJetAreaPt", "Jet area vs. p_{T}", "LEGO2", 200, 0., 2., 400, -100., 300., "Jet A", "p_{T, jet} (GeV/c)", "dN^{Jets}/dA dp_{T}");
187  AddHistogram2D<TH2D>("hLeadingJetPtLeadingHadron", "Jet leading hadron p_{T} distribution vs. jet p_{T}", "", 300, 0., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T,lead had} (GeV/c)", "dN^{Jets}/dp_{T}dp_{T,had}");
188 
189  AddHistogram2D<TH2D>("hSubleadingJetPtRaw", "Jets p_{T} distribution (no bgrd. corr.)", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
190  AddHistogram2D<TH2D>("hSubleadingJetPt", "Jets p_{T} distribution (background subtracted)", "", 400, -100., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
191  AddHistogram2D<TH2D>("hSubleadingJetPhi", "Jet angular distribution #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Jets}/d#phi");
192  AddHistogram2D<TH2D>("hSubleadingJetEta", "Jet angular distribution #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta","Centrality","dN^{Jets}/d#eta");
193  AddHistogram2D<TH2D>("hSubleadingJetPhiPt", "Jet angular distribution #phi vs. p_{T}", "LEGO2", 180, 0., 2*TMath::Pi(), 400, -100., 300., "#phi", "p_{T, jet} (GeV/c)", "dN^{Jets}/d#phi dp_{T}");
194  AddHistogram2D<TH2D>("hSubleadingJetEtaPt", "Jet angular distribution #eta vs. p_{T}", "LEGO2", 100, -2.5, 2.5, 400, -100., 300., "#eta","p_{T, jet} (GeV/c)","dN^{Jets}/d#eta dp_{T}");
195  AddHistogram2D<TH2D>("hSubleadingJetPhiEta", "Jet angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Jets}/d#phi d#eta");
196  AddHistogram2D<TH2D>("hSubleadingJetArea", "Jet area", "LEGO2", 200, 0., 2., fNumberOfCentralityBins, 0, 100, "Jet A", "Centrality", "dN^{Jets}/dA");
197  AddHistogram2D<TH2D>("hSubleadingJetAreaPt", "Jet area vs. p_{T}", "LEGO2", 200, 0., 2., 400, -100., 300., "Jet A", "p_{T, jet} (GeV/c)", "dN^{Jets}/dA dp_{T}");
198  AddHistogram2D<TH2D>("hSubleadingJetPtLeadingHadron", "Jet leading hadron p_{T} distribution vs. jet p_{T}", "", 300, 0., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T,lead had} (GeV/c)", "dN^{Jets}/dp_{T}dp_{T,had}");
199 
200  AddHistogram2D<TH2D>("hTrackCount", "Number of tracks in acceptance vs. centrality", "LEGO2", 500, 0., 5000., fNumberOfCentralityBins, 0, 100, "N tracks","Centrality", "dN^{Events}/dN^{Tracks}");
201  AddHistogram2D<TH2D>("hJetCount", "Number of jets in acceptance vs. centrality", "LEGO2", 100, 0., 100., fNumberOfCentralityBins, 0, 100, "N Jets","Centrality", "dN^{Events}/dN^{Jets}");
202  AddHistogram2D<TH2D>("hFakeFactor", "Fake factor distribution", "LEGO2", 1000, 0., 100., fNumberOfCentralityBins, 0, 100, "Fake factor","Centrality", "dN^{Jets}/df");
203  AddHistogram2D<TH2D>("hBackgroundPt", "Background p_{T} distribution", "", 1000, 0., 50., fNumberOfCentralityBins, 0, 100, "Background p_{T} (GeV/c)", "Centrality", "dN^{Events}/dp_{T}");
204 
205  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
206 }
207 
208 
209 //________________________________________________________________________
211 
213 
214  // ### Add the jets as basic correlation particles to the event
215  if (!(fInputEvent->FindListObject(Form("%s", fJetParticleArrayName.Data()))))
216  {
217  fJetsOutput = new TClonesArray("AliPicoTrack");
218  fJetsOutput->SetName(fJetParticleArrayName.Data());
219  fInputEvent->AddObject(fJetsOutput);
220  }
221  else
222  AliError(Form("%s: Object with name %s already in event!", GetName(), Form("%s", fJetParticleArrayName.Data())));
223 
224  // ### Add the tracks as basic correlation particles to the event (optional)
225  if(fTrackParticleArrayName != "")
226  {
227  if (!(fInputEvent->FindListObject(Form("%s", fTrackParticleArrayName.Data()))))
228  {
229  fTracksOutput = new TClonesArray("AliPicoTrack");
230  fTracksOutput->SetName(fTrackParticleArrayName.Data());
231  fInputEvent->AddObject(fTracksOutput);
232  }
233  else
234  AliError(Form("%s: Object with name %s already in event!", GetName(), Form("%s", fTrackParticleArrayName.Data())));
235  }
236 
237  // ### Import generated jets from toymodel for matching (optional)
238  if(fJetMatchingArrayName != "")
239  {
240  fJetsInput = static_cast<TClonesArray*>(InputEvent()->FindListObject(Form("%s", fJetMatchingArrayName.Data())));
241  if(!fJetsInput)
242  AliFatal(Form("Importing jets for matching failed! Array '%s' not found!", fJetMatchingArrayName.Data()));
243  }
244 
245  // ### Jets tree (optional)
247  {
248  fJetsTree = new TTree("ExtractedJets", "ExtractedJets");
249  fJetsTree->Branch("Jets", "AliBasicJet", &fJetsTreeBuffer, 1000);
250  fOutput->Add(fJetsTree);
251  }
252 
253 }
254 
255 //________________________________________________________________________
257 {
258 
259  // In case of special selection criteria, trigger on certain events
260  if(fEventCriteriumMode==0) // "minimum bias"
261  {
262  // do nothing
263  }
264  else if(fEventCriteriumMode==1) // background constraints
265  {
267  {
268  fHistEventRejection->Fill("JetCrit", 1);
269  return kFALSE;
270  }
271  }
272  else if(fEventCriteriumMode==2) // Minimum leading jet pT
273  {
274  if(fLeadingJet)
275  {
277  {
278  fHistEventRejection->Fill("JetCrit", 1);
279  return kFALSE;
280  }
281  }
282  }
283  else if(fEventCriteriumMode==3) // Simple dijet trigger
284  {
286  {
288  {
289  fHistEventRejection->Fill("JetCrit", 1);
290  return kFALSE;
291  }
292  }
293  }
294  return kTRUE;
295 }
296 
297 //________________________________________________________________________
299 {
300  if( (fJetOutputMode==1) || (fJetOutputMode==3) ) // output the leading jet
301  if(jet!=fLeadingJet)
302  return kFALSE;
303 
304  if( (fJetOutputMode==2) || (fJetOutputMode==3) ) // output the subleading jet
305  if(jet!=fSubleadingJet)
306  return kFALSE;
307 
308  // Fake jet rejection (0810.1219)
309 /*
310  if(fFakeFactorCutProfile)
311  {
312  Double_t fakeFactor = CalculateFakeFactor(jet);
313  FillHistogram("hFakeFactor", fakeFactor, fCent);
314  if( (fakeFactor >= fMinFakeFactorPercentage*fFakeFactorCutProfile->GetBinContent(fFakeFactorCutProfile->GetXaxis()->FindBin(fCent))) && (fakeFactor < fMaxFakeFactorPercentage*fFakeFactorCutProfile->GetBinContent(fFakeFactorCutProfile->GetXaxis()->FindBin(fCent))) )
315  return kFALSE;
316  }
317 */
318 
319  // Poor man's fake jet rejection (according to jet const.)
321  {
322  if( jet->GetNumberOfTracks() < fRejectionFunction->Eval(jet->Pt() - fJetsCont->GetRhoVal()*jet->Area()) )
323  return kFALSE;
324  }
325 
326  // Jet matching. Only done if SetJetMatchingArrayName() called
327  Bool_t matchedFound = kFALSE;
328  if(fJetsInput)
329  {
330  // Go through all jets and check if the matching condition is fulfiled by at least one jet
331  Double_t bestMatchDeltaR = 999.;
332  for(Int_t i=0; i<fJetsInput->GetEntries(); i++)
333  {
334  AliEmcalJet* matchJet = static_cast<AliEmcalJet*>(fJetsInput->At(i));
335  Double_t deltaPhi = TMath::Min(TMath::Abs(jet->Phi()-matchJet->Phi()),TMath::TwoPi() - TMath::Abs(jet->Phi()-matchJet->Phi()));
336  Double_t deltaEta = TMath::Abs(jet->Eta() - matchJet->Eta());
337  Double_t deltaR = TMath::Sqrt((deltaPhi*deltaPhi) + (deltaEta*deltaEta));
338 
339  if(deltaR < bestMatchDeltaR)
340  {
341  bestMatchDeltaR = deltaR;
342  }
343  }
344  // Check if a matching jet is found.
345  if(bestMatchDeltaR < 0.9*fJetsCont->GetJetRadius())
346  matchedFound = kTRUE;
347  }
348 
349  if(fJetOutputMode==4) // matching jets only
350  return matchedFound;
351  else if(fJetOutputMode==5) // non-matching jets only
352  return !matchedFound;
353 
354  return kTRUE;
355 }
356 
357 //________________________________________________________________________
359 {
360  // All jets
361  FillHistogram("hJetPtRaw", jet->Pt(), fCent);
362  FillHistogram("hJetPt", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fCent);
363  FillHistogram("hJetPhi", jet->Phi(), fCent);
364  FillHistogram("hJetEta", jet->Eta(), fCent);
365  FillHistogram("hJetEtaPt", jet->Eta(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
366  FillHistogram("hJetPhiPt", jet->Phi(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
367  FillHistogram("hJetPhiEta", jet->Phi(), jet->Eta());
368  FillHistogram("hJetArea", jet->Area(), fCent);
369  FillHistogram("hJetAreaPt", jet->Area(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
370  FillHistogram("hJetPtLeadingHadron", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fJetsCont->GetLeadingHadronPt(jet));
371 
372  // Leading jet plots
373  if(jet==fLeadingJet)
374  {
375  FillHistogram("hLeadingJetPtRaw", jet->Pt(), fCent);
376  FillHistogram("hLeadingJetPt", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fCent);
377  FillHistogram("hLeadingJetPhi", jet->Phi(), fCent);
378  FillHistogram("hLeadingJetEta", jet->Eta(), fCent);
379  FillHistogram("hLeadingJetEtaPt", jet->Eta(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
380  FillHistogram("hLeadingJetPhiPt", jet->Phi(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
381  FillHistogram("hLeadingJetPhiEta", jet->Phi(), jet->Eta());
382  FillHistogram("hLeadingJetArea", jet->Area(), fCent);
383  FillHistogram("hLeadingJetAreaPt", jet->Area(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
384  FillHistogram("hLeadingJetPtLeadingHadron", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fJetsCont->GetLeadingHadronPt(jet));
385  }
386 
387  // Subleading jet plot
388  else if(jet==fSubleadingJet)
389  {
390  FillHistogram("hSubleadingJetPtRaw", jet->Pt(), fCent);
391  FillHistogram("hSubleadingJetPt", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fCent);
392  FillHistogram("hSubleadingJetPhi", jet->Phi(), fCent);
393  FillHistogram("hSubleadingJetEta", jet->Eta(), fCent);
394  FillHistogram("hSubleadingJetEtaPt", jet->Eta(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
395  FillHistogram("hSubleadingJetPhiPt", jet->Phi(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
396  FillHistogram("hSubleadingJetPhiEta", jet->Phi(), jet->Eta());
397  FillHistogram("hSubleadingJetArea", jet->Area(), fCent);
398  FillHistogram("hSubleadingJetAreaPt", jet->Area(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
399  FillHistogram("hSubleadingJetPtLeadingHadron", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fJetsCont->GetLeadingHadronPt(jet));
400  }
401 }
402 
403 //________________________________________________________________________
405 {
406  FillHistogram("hTrackPt", track->Pt(), fCent);
407  FillHistogram("hTrackPhi", track->Phi(), fCent);
408  FillHistogram("hTrackEta", track->Eta(), fCent);
409  FillHistogram("hTrackEtaPt", track->Eta(), track->Pt());
410  FillHistogram("hTrackPhiPt", track->Phi(), track->Pt());
411  FillHistogram("hTrackPhiEta", track->Phi(), track->Eta());
412 }
413 
414 //________________________________________________________________________
416 {
417  // Loop over all jet constituents
418  for(Int_t i = 0; i < jet->GetNumberOfTracks(); i++)
419  {
420  AliVParticle* constituent = static_cast<AliVParticle*>(jet->TrackAt(i, fTracksCont->GetArray()));
421  if(!constituent)
422  continue;
423 
424  // Fill jet constituent plots
425  FillHistogram("hJetConstituentPt_Cent0_100", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
426  if( (fCent >= 0) && (fCent < 10) )
427  FillHistogram("hJetConstituentPt_Cent0_10", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
428  }
429 
430  FillHistogram("hJetConstituentCount_Cent0_100", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), jet->GetNumberOfTracks());
431  if( (fCent >= 0) && (fCent < 10) )
432  FillHistogram("hJetConstituentCount_Cent0_10", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), jet->GetNumberOfTracks());
433 
434 }
435 
436 //________________________________________________________________________
438 {
439  new ((*fJetsOutput)[fAcceptedJets]) AliPicoTrack(jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), jet->Eta(), jet->Phi(), jet->Charge(), 0, 0);
440  fAcceptedJets++;
441 }
442 
443 //________________________________________________________________________
445 {
446  if(fTrackParticleArrayName != "")
447  {
448  new ((*fTracksOutput)[fAcceptedTracks]) AliPicoTrack(track->Pt(), track->Eta(), track->Phi(), track->Charge(), 0, 0); // only Pt,Eta,Phi are interesting for correlations;
449  fAcceptedTracks++;
450  }
451 }
452 
453 //________________________________________________________________________
455 {
456  // Check pT threshold
457  if( (jet->Pt()-jet->Area()*fJetsCont->GetRhoVal()) < fExtractionMinPt )
458  return;
459 
460  // Discard jets statistically
461  if(fRandom->Rndm() >= fExtractionPercentage)
462  return;
463 
464  Long64_t eventID = InputEvent()->GetHeader()->GetEventIdAsLong();
465  AliBasicJet basicJet(jet->Eta(), jet->Phi(), jet->Pt(), jet->Charge(), fJetsCont->GetJetRadius(), jet->Area(), fJetsCont->GetRhoVal(), eventID, fCent);
466  // Add constituents
467  for(Int_t i = 0; i < jet->GetNumberOfTracks(); i++)
468  {
469  AliVParticle* particle = static_cast<AliVParticle*>(jet->TrackAt(i, fTracksCont->GetArray()));
470  if(!particle) continue;
471  basicJet.AddJetConstituent(particle->Eta(), particle->Phi(), particle->Pt(), particle->Charge());
472  }
473  fJetsTreeBuffer = &basicJet;
474  fJetsTree->Fill();
475 }
476 
477 //________________________________________________________________________
479 {
481 
482  if(!IsEventSelected())
483  return kFALSE;
484 
485  // ####### Jet loop
486  fAcceptedJets = 0;
488  while(AliEmcalJet *jet = fJetsCont->GetNextAcceptJet())
489  {
490  if(!IsJetSelected(jet))
491  continue;
492 
493  // Jet plots
494  FillHistogramsJets(jet);
496 
497  // Add jet to output array
499  AddJetToTree(jet);
500  AddJetToOutputArray(jet);
501  }
502 
503 
504  // ####### Particle loop
505  fAcceptedTracks = 0;
507  Int_t trackcount = 0;
508  while(AliVTrack *track = static_cast<AliVTrack*>(fTracksCont->GetNextAcceptParticle()))
509  {
510  // Track plots
511  FillHistogramsTracks(track);
512 
513  // Add track to output array
514  trackcount++;
515  AddTrackToOutputArray(track);
516  }
517 
518  // ####### Event properties
519  FillHistogram("hJetCount", fAcceptedJets, fCent);
520  FillHistogram("hTrackCount", trackcount, fCent);
521  // NOTE: It is possible to use fTracksCont->GetLeadingParticle() since we do not apply additional track cuts
522  AliVTrack* leadTrack = static_cast<AliVTrack*>(fTracksCont->GetLeadingParticle());
523  if(leadTrack)
524  {
525  FillHistogram("hLeadingTrackPt", leadTrack->Pt(), fCent);
526  FillHistogram("hLeadingTrackPhi", leadTrack->Phi(), fCent);
527  FillHistogram("hLeadingTrackEta", leadTrack->Eta(), fCent);
528  FillHistogram("hLeadingTrackPhiEta", leadTrack->Phi(), leadTrack->Eta());
529  }
530 
531  return kTRUE;
532 }
533 
534 //########################################################################
535 // HELPERS
536 //########################################################################
537 
538 //________________________________________________________________________
540 {
541  // Calculate leading + subleading jet
544 }
545 
546 //________________________________________________________________________
548 {
549  Double_t fakeFactor = 0;
550 
551  // Loop over all jet constituents
552  for(Int_t i = 0; i < jet->GetNumberOfTracks(); i++)
553  {
554  AliVParticle* constituent = static_cast<AliVParticle*>(jet->TrackAt(i, fTracksCont->GetArray()));
555 
556  Double_t deltaPhi = TMath::Min(TMath::Abs(jet->Phi()-constituent->Phi()),TMath::TwoPi() - TMath::Abs(jet->Phi()-constituent->Phi()));
557  Double_t deltaR = TMath::Sqrt( (jet->Eta() - constituent->Eta())*(jet->Eta() - constituent->Eta()) + deltaPhi*deltaPhi );
558  fakeFactor += constituent->Pt() * TMath::Sin(deltaR);
559  }
560 
561  return fakeFactor;
562 }
563 
564 //________________________________________________________________________
566 {
567  fEventCriteriumMode = type;
568 
569  if(fEventCriteriumMode==0)
570  AliWarning("Set event criterium to 'default' -- no further selection criterium.");
571  else if(fEventCriteriumMode==1)
572  AliWarning("Set event criterium to 'background' -- select events with certain backgrounds");
573  else if(fEventCriteriumMode==2)
574  AliWarning("Set event criterium to 'simple jet trigger' -- select events with certain minimum leading jet pT (bgrd corr.)");
575  else if(fEventCriteriumMode==3)
576  AliWarning("Set event criterium to 'simple dijet trigger' -- select events with certain minimum leading + subleading jet pT (bgrd corr.)");
577  else
578  {
579  AliFatal("Event criterium not valid.");
580  }
581 }
582 
583 
584 //________________________________________________________________________
586 {
587  // Customized from AliJetContainer::GetLeadingJet()
588  // Get the subleading jet; if opt contains "rho" the sorting is according to pt-A*rho
589 
590  TString option(opt);
591  option.ToLower();
592 
593  AliEmcalJet *jetLeading = fJetsCont->GetLeadingJet(opt);
594  AliEmcalJet *jetSubLeading = 0;
595 
598  Double_t tmpPt = 0;
599 
600  if (option.Contains("rho")) {
601  while ((jet = fJetsCont->GetNextAcceptJet())) {
602  if(jet == jetLeading)
603  continue;
604  else if ( (jet->Pt()-jet->Area()*fJetsCont->GetRhoVal()) > tmpPt )
605  {
606  jetSubLeading = jet;
607  tmpPt = jet->Pt()-jet->Area()*fJetsCont->GetRhoVal();
608  }
609 
610  }
611  }
612  else {
613  while ((jet = fJetsCont->GetNextAcceptJet())) {
614  if(jet == jetLeading)
615  continue;
616  else if ( jet->Pt() > tmpPt )
617  {
618  jetSubLeading = jet;
619  tmpPt = jet->Pt();
620  }
621  }
622  }
623 
624  return jetSubLeading;
625 }
626 
627 //________________________________________________________________________
628 void AliAnalysisTaskChargedJetsHadronCF::BinLogAxis(const THn *h, Int_t axisNumber)
629 {
630  // Method for the correct logarithmic binning of histograms
631  TAxis *axis = h->GetAxis(axisNumber);
632  int bins = axis->GetNbins();
633 
634  Double_t from = axis->GetXmin();
635  Double_t to = axis->GetXmax();
636  Double_t *newBins = new Double_t[bins + 1];
637 
638  newBins[0] = from;
639  Double_t factor = pow(to/from, 1./bins);
640 
641  for (int i = 1; i <= bins; i++) {
642  newBins[i] = factor * newBins[i-1];
643  }
644  axis->Set(bins, newBins);
645  delete [] newBins;
646 }
647 
648 //________________________________________________________________________
649 inline void AliAnalysisTaskChargedJetsHadronCF::FillHistogram(const char * key, Double_t x)
650 {
651  TH1* tmpHist = static_cast<TH1*>(fOutput->FindObject(key));
652  if(!tmpHist)
653  {
654  AliError(Form("Cannot find histogram <%s> ",key)) ;
655  return;
656  }
657 
658  tmpHist->Fill(x);
659 }
660 
661 //________________________________________________________________________
662 inline void AliAnalysisTaskChargedJetsHadronCF::FillHistogram(const char * key, Double_t x, Double_t y)
663 {
664  TH1* tmpHist = static_cast<TH1*>(fOutput->FindObject(key));
665  if(!tmpHist)
666  {
667  AliError(Form("Cannot find histogram <%s> ",key));
668  return;
669  }
670 
671  if (tmpHist->IsA()->GetBaseClass("TH1"))
672  static_cast<TH1*>(tmpHist)->Fill(x,y); // Fill x with y
673  else if (tmpHist->IsA()->GetBaseClass("TH2"))
674  static_cast<TH2*>(tmpHist)->Fill(x,y); // Fill x,y with 1
675 }
676 
677 //________________________________________________________________________
678 inline void AliAnalysisTaskChargedJetsHadronCF::FillHistogram(const char * key, Double_t x, Double_t y, Double_t add)
679 {
680  TH2* tmpHist = static_cast<TH2*>(fOutput->FindObject(key));
681  if(!tmpHist)
682  {
683  AliError(Form("Cannot find histogram <%s> ",key));
684  return;
685  }
686 
687  tmpHist->Fill(x,y,add);
688 }
689 
690 //________________________________________________________________________
691 inline void AliAnalysisTaskChargedJetsHadronCF::FillHistogram3D(const char * key, Double_t x, Double_t y, Double_t z, Double_t add)
692 {
693  TH3* tmpHist = static_cast<TH3*>(fOutput->FindObject(key));
694  if(!tmpHist)
695  {
696  AliError(Form("Cannot find histogram <%s> ",key));
697  return;
698  }
699 
700  if(add)
701  tmpHist->Fill(x,y,z,add);
702  else
703  tmpHist->Fill(x,y,z);
704 }
705 
706 
707 //________________________________________________________________________
708 template <class T> T* AliAnalysisTaskChargedJetsHadronCF::AddHistogram1D(const char* name, const char* title, const char* options, Int_t xBins, Double_t xMin, Double_t xMax, const char* xTitle, const char* yTitle)
709 {
710  T* tmpHist = new T(name, title, xBins, xMin, xMax);
711 
712  tmpHist->GetXaxis()->SetTitle(xTitle);
713  tmpHist->GetYaxis()->SetTitle(yTitle);
714  tmpHist->SetOption(options);
715  tmpHist->SetMarkerStyle(kFullCircle);
716  tmpHist->Sumw2();
717 
718  fOutput->Add(tmpHist);
719 
720  return tmpHist;
721 }
722 
723 //________________________________________________________________________
724 template <class T> T* AliAnalysisTaskChargedJetsHadronCF::AddHistogram2D(const char* name, const char* title, const char* options, Int_t xBins, Double_t xMin, Double_t xMax, Int_t yBins, Double_t yMin, Double_t yMax, const char* xTitle, const char* yTitle, const char* zTitle)
725 {
726  T* tmpHist = new T(name, title, xBins, xMin, xMax, yBins, yMin, yMax);
727  tmpHist->GetXaxis()->SetTitle(xTitle);
728  tmpHist->GetYaxis()->SetTitle(yTitle);
729  tmpHist->GetZaxis()->SetTitle(zTitle);
730  tmpHist->SetOption(options);
731  tmpHist->SetMarkerStyle(kFullCircle);
732  tmpHist->Sumw2();
733 
734  fOutput->Add(tmpHist);
735 
736  return tmpHist;
737 }
738 
739 //________________________________________________________________________
740 template <class T> T* AliAnalysisTaskChargedJetsHadronCF::AddHistogram3D(const char* name, const char* title, const char* options, Int_t xBins, Double_t xMin, Double_t xMax, Int_t yBins, Double_t yMin, Double_t yMax, Int_t zBins, Double_t zMin, Double_t zMax, const char* xTitle, const char* yTitle, const char* zTitle)
741 {
742  T* tmpHist = new T(name, title, xBins, xMin, xMax, yBins, yMin, yMax, zBins, zMin, zMax);
743  tmpHist->GetXaxis()->SetTitle(xTitle);
744  tmpHist->GetYaxis()->SetTitle(yTitle);
745  tmpHist->GetZaxis()->SetTitle(zTitle);
746  tmpHist->SetOption(options);
747  tmpHist->SetMarkerStyle(kFullCircle);
748  tmpHist->Sumw2();
749 
750  fOutput->Add(tmpHist);
751 
752  return tmpHist;
753 }
754 
755 //________________________________________________________________________
757 {
758  // Called once at the end of the analysis.
759 }
760 
Short_t Charge() const
Definition: AliEmcalJet.h:62
Double_t Area() const
Definition: AliEmcalJet.h:69
Double_t GetRhoVal() const
T * AddHistogram1D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis")
const char * title
Definition: MakeQAPdf.C:26
AliJetContainer * GetJetContainer(Int_t i=0) const
Double_t Eta() const
Definition: AliEmcalJet.h:60
Double_t Phi() const
Definition: AliEmcalJet.h:55
void * fJetsTreeBuffer
Jets that will be saved to a tree (optionally)
Container with name, TClonesArray and cuts for particles.
void BinLogAxis(const THn *h, Int_t axisNumber)
TList * fOutput
!output list
AliEmcalJet * fSubleadingJet
leading jet (calculated event-by-event)
void FillHistogram3D(const char *key, Double_t x, Double_t y, Double_t z, Double_t add=0)
Double_t GetJetRadius(Int_t i=0) const
UShort_t GetNumberOfTracks() const
Definition: AliEmcalJet.h:83
AliParticleContainer * GetParticleContainer(Int_t i=0) const
AliParticleContainer * GetParticleContainer() const
AliEmcalJet * GetLeadingJet(const char *opt="")
void FillHistogram(const char *key, Double_t x)
number accepted tracks (calculated event-by-event)
TString fJetParticleArrayName
Array of generated jets imported into task (toy model)
Double_t GetLeadingHadronPt(const AliEmcalJet *jet) const
T * AddHistogram3D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, Int_t yBins=100, Double_t yMin=0.0, Double_t yMax=20.0, Int_t zBins=100, Double_t zMin=0.0, Double_t zMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis", const char *zTitle="z axis")
virtual AliVParticle * GetLeadingParticle(const char *opt="")
Double_t fExtractionPercentage
buffer for one jet (that will be saved to the tree)
Double_t fCent
!event centrality
TClonesArray * GetArray() const
TClonesArray * fTracksOutput
Array of basic correlation particles attached to the event (jets)
void SetClassName(const char *clname)
AliEmcalJet * GetNextAcceptJet()
Double_t Pt() const
Definition: AliEmcalJet.h:47
void AddJetConstituent(Float_t eta, Float_t phi, Float_t pt, Short_t charge)
Float_t GetJetRadius() const
Short_t TrackAt(Int_t idx) const
Definition: AliEmcalJet.h:107
ClassImp(AliAnalysisTaskChargedJetsHadronCF) ClassImp(AliBasicJet) ClassImp(AliBasicJetConstituent) AliBasicJet
TClonesArray * fJetsInput
Array of basic correlation particles attached to the event (tracks)
TH1 * fHistEventRejection
!book keep reasons for rejecting event
void SetMakeGeneralHistograms(Bool_t g)
virtual AliVParticle * GetNextAcceptParticle()
Int_t fAcceptedJets
subleading jet (calculated event-by-event)
void ResetCurrentID(Int_t i=-1)
T * AddHistogram2D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, Int_t yBins=100, Double_t yMin=0.0, Double_t yMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis", const char *zTitle="z axis")
Int_t fAcceptedTracks
number accepted jets (calculated event-by-event)