AliPhysics  34df632 (34df632)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalHJetMass.cxx
Go to the documentation of this file.
1 //
2 // Jet mass analysis task for jets recoiling from high pT hadron
3 //
4 // Author: M.Verweij
5 
6 #include <TClonesArray.h>
7 #include <TH1F.h>
8 #include <TH2F.h>
9 #include <TH3F.h>
10 #include <THnSparse.h>
11 #include <TList.h>
12 #include <TLorentzVector.h>
13 #include <TProfile.h>
14 #include <TChain.h>
15 #include <TSystem.h>
16 #include <TFile.h>
17 #include <TKey.h>
18 #include <TArrayI.h>
19 #include <TArrayF.h>
20 #include <TRandom3.h>
21 
22 #include "AliVCluster.h"
23 #include "AliVTrack.h"
24 #include "AliEmcalJet.h"
25 #include "AliRhoParameter.h"
26 #include "AliLog.h"
27 #include "AliEmcalParticle.h"
28 #include "AliAnalysisManager.h"
29 #include "AliJetContainer.h"
30 #include "AliParticleContainer.h"
31 
32 #include "AliAODEvent.h"
33 
35 
37 
38 namespace EmcalHJetMassAnalysis {
39 
40  //________________________________________________________________________
41  AliAnalysisTaskEmcalHJetMass::AliAnalysisTaskEmcalHJetMass() :
42  AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalHJetMass", kTRUE),
43  fDoHJetAna(kTRUE),
44  fDoNSHJetAna(kFALSE),
45  fContainerBase(0),
46  fContainerUnsub(1),
47  fMinFractionShared(0),
48  fUseUnsubJet(0),
49  fJetMassType(kRaw),
50  fDPhiHJetMax(0.6),
51  fTriggerTrackType(kInclusive),
52  fPtTTMin(0),
53  fPtTTMax(0),
54  fRandom(0),
55  fEmbConstSel(0),
56  fMarkMCLabel(-1),
57  fGapPhiMin(-1),
58  fGapPhiMax(-1),
59  fh1PtHadron(0),
60  fh1PtHadronMatch(0),
61  fh1PhiHadron(0),
62  fh3PtHPtJDPhi(0),
63  fh3PtJet1VsMassVsHPtAllSel(0),
64  fh3PtJet1VsMassVsHPtAllSelMatch(0),
65  fh3PtJet1VsMassVsHPtTagged(0),
66  fh3PtJet1VsMassVsHPtTaggedMatch(0),
67  fh3PtJet1VsRatVsHPtAllSel(0),
68  fh3PtJet1VsRatVsHPtAllSelMatch(0),
69  fh3PtJet1VsRatVsHPtTagged(0),
70  fh3PtJet1VsRatVsHPtTaggedMatch(0),
71  fhnAllSel(0),
72  fhnAllSelMatch(0),
73  fhnTagged(0),
74  fhnTaggedMatch(0)
75  {
76  // Default constructor.
77 
78  fh1PtHadron = new TH1F*[fNcentBins];
79  fh1PtHadronMatch = new TH1F*[fNcentBins];
80  fh1PhiHadron = new TH1F*[fNcentBins];
81  fh3PtHPtJDPhi = new TH3F*[fNcentBins];
82  fh3PtJet1VsMassVsHPtAllSel = new TH3F*[fNcentBins];
83  fh3PtJet1VsMassVsHPtAllSelMatch = new TH3F*[fNcentBins];
84  fh3PtJet1VsMassVsHPtTagged = new TH3F*[fNcentBins];
85  fh3PtJet1VsMassVsHPtTaggedMatch = new TH3F*[fNcentBins];
86  fh3PtJet1VsRatVsHPtAllSel = new TH3F*[fNcentBins];
87  fh3PtJet1VsRatVsHPtAllSelMatch = new TH3F*[fNcentBins];
88  fh3PtJet1VsRatVsHPtTagged = new TH3F*[fNcentBins];
89  fh3PtJet1VsRatVsHPtTaggedMatch = new TH3F*[fNcentBins];
90  fhnAllSel = new THnSparse*[fNcentBins];
91  fhnAllSelMatch = new THnSparse*[fNcentBins];
92  fhnTagged = new THnSparse*[fNcentBins];
93  fhnTaggedMatch = new THnSparse*[fNcentBins];
94 
95  for (Int_t i = 0; i < fNcentBins; i++) {
96  fh1PtHadron[i] = 0;
97  fh1PtHadronMatch[i] = 0;
98  fh1PhiHadron[i] = 0;
99  fh3PtHPtJDPhi[i] = 0;
100  fh3PtJet1VsMassVsHPtAllSel[i] = 0;
101  fh3PtJet1VsMassVsHPtAllSelMatch[i] = 0;
102  fh3PtJet1VsMassVsHPtTagged[i] = 0;
103  fh3PtJet1VsMassVsHPtTaggedMatch[i] = 0;
104  fh3PtJet1VsRatVsHPtAllSel[i] = 0;
105  fh3PtJet1VsRatVsHPtAllSelMatch[i] = 0;
106  fh3PtJet1VsRatVsHPtTagged[i] = 0;
107  fh3PtJet1VsRatVsHPtTaggedMatch[i] = 0;
108  fhnAllSel[i] = 0;
109  fhnAllSelMatch[i] = 0;
110  fhnTagged[i] = 0;
111  fhnTaggedMatch[i] = 0;
112  }
113 
114  fPtTTMin = new TArrayF();
115  fPtTTMax = new TArrayF();
116 
117  SetMakeGeneralHistograms(kTRUE);
118  }
119 
120  //________________________________________________________________________
121  AliAnalysisTaskEmcalHJetMass::AliAnalysisTaskEmcalHJetMass(const char *name) :
122  AliAnalysisTaskEmcalJet(name, kTRUE),
123  fDoHJetAna(kTRUE),
124  fDoNSHJetAna(kFALSE),
125  fContainerBase(0),
126  fContainerUnsub(1),
127  fMinFractionShared(0),
128  fUseUnsubJet(0),
129  fJetMassType(kRaw),
130  fDPhiHJetMax(0.6),
131  fTriggerTrackType(kInclusive),
132  fPtTTMin(0),
133  fPtTTMax(0),
134  fRandom(0),
135  fEmbConstSel(0),
136  fMarkMCLabel(-1),
137  fGapPhiMin(-1),
138  fGapPhiMax(-1),
139  fh1PtHadron(0),
140  fh1PtHadronMatch(0),
141  fh1PhiHadron(0),
142  fh3PtHPtJDPhi(0),
143  fh3PtJet1VsMassVsHPtAllSel(0),
144  fh3PtJet1VsMassVsHPtAllSelMatch(0),
145  fh3PtJet1VsMassVsHPtTagged(0),
146  fh3PtJet1VsMassVsHPtTaggedMatch(0),
147  fh3PtJet1VsRatVsHPtAllSel(0),
148  fh3PtJet1VsRatVsHPtAllSelMatch(0),
149  fh3PtJet1VsRatVsHPtTagged(0),
150  fh3PtJet1VsRatVsHPtTaggedMatch(0),
151  fhnAllSel(0),
152  fhnAllSelMatch(0),
153  fhnTagged(0),
154  fhnTaggedMatch(0)
155  {
156  // Standard constructor.
157 
158  fh1PtHadron = new TH1F*[fNcentBins];
159  fh1PtHadronMatch = new TH1F*[fNcentBins];
160  fh1PhiHadron = new TH1F*[fNcentBins];
161  fh3PtHPtJDPhi = new TH3F*[fNcentBins];
162  fh3PtJet1VsMassVsHPtAllSel = new TH3F*[fNcentBins];
163  fh3PtJet1VsMassVsHPtAllSelMatch = new TH3F*[fNcentBins];
164  fh3PtJet1VsMassVsHPtTagged = new TH3F*[fNcentBins];
165  fh3PtJet1VsMassVsHPtTaggedMatch = new TH3F*[fNcentBins];
166  fh3PtJet1VsRatVsHPtAllSel = new TH3F*[fNcentBins];
167  fh3PtJet1VsRatVsHPtAllSelMatch = new TH3F*[fNcentBins];
168  fh3PtJet1VsRatVsHPtTagged = new TH3F*[fNcentBins];
169  fh3PtJet1VsRatVsHPtTaggedMatch = new TH3F*[fNcentBins];
170  fhnAllSel = new THnSparse*[fNcentBins];
171  fhnAllSelMatch = new THnSparse*[fNcentBins];
172  fhnTagged = new THnSparse*[fNcentBins];
173  fhnTaggedMatch = new THnSparse*[fNcentBins];
174 
175  for (Int_t i = 0; i < fNcentBins; i++) {
176  fh1PtHadron[i] = 0;
177  fh1PtHadronMatch[i] = 0;
178  fh1PhiHadron[i] = 0;
179  fh3PtHPtJDPhi[i] = 0;
180  fh3PtJet1VsMassVsHPtAllSel[i] = 0;
181  fh3PtJet1VsMassVsHPtAllSelMatch[i] = 0;
182  fh3PtJet1VsMassVsHPtTagged[i] = 0;
183  fh3PtJet1VsMassVsHPtTaggedMatch[i] = 0;
184  fh3PtJet1VsRatVsHPtAllSel[i] = 0;
185  fh3PtJet1VsRatVsHPtAllSelMatch[i] = 0;
186  fh3PtJet1VsRatVsHPtTagged[i] = 0;
187  fh3PtJet1VsRatVsHPtTaggedMatch[i] = 0;
188  fhnAllSel[i] = 0;
189  fhnAllSelMatch[i] = 0;
190  fhnTagged[i] = 0;
191  fhnTaggedMatch[i] = 0;
192  }
193 
194  fPtTTMin = new TArrayF();
195  fPtTTMax = new TArrayF();
196 
197  SetMakeGeneralHistograms(kTRUE);
198  }
199 
200  //________________________________________________________________________
201  AliAnalysisTaskEmcalHJetMass::~AliAnalysisTaskEmcalHJetMass()
202  {
203  // Destructor.
204 
205  if(fRandom) delete fRandom;
206  if(fPtTTMin) delete fPtTTMin;
207  if(fPtTTMax) delete fPtTTMax;
208  }
209 
210  //________________________________________________________________________
211  void AliAnalysisTaskEmcalHJetMass::UserCreateOutputObjects()
212  {
213  // Create user output.
214 
216 
217  Bool_t oldStatus = TH1::AddDirectoryStatus();
218  TH1::AddDirectory(kFALSE);
219 
220  const Int_t nBinsPt = 200;
221  const Double_t minPt = -50.;
222  const Double_t maxPt = 150.;
223 
224  const Int_t nBinsM = 90;
225  const Double_t minM = -10.;
226  const Double_t maxM = 80.;
227 
228  const Int_t nBinsR = 100;
229  const Double_t minR = -0.2;
230  const Double_t maxR = 0.8;
231 
232  const Int_t nBinsPtH = 100;
233  const Double_t minPtH = 0.;
234  const Double_t maxPtH = 100.;
235 
236  const Int_t nBinsPhi = 18*4;
237  const Double_t minPhi = -0.5*TMath::Pi();
238  const Double_t maxPhi = 1.5*TMath::Pi();
239 
240  const Int_t nBinsSparse0 = 4; //PtJetAS,MJetAS,PtHNS,MJetNS
241  const Int_t nBins0[nBinsSparse0] = {nBinsPt,nBinsM,nBinsPtH,nBinsM};
242  const Double_t xmin0[nBinsSparse0] = { minPt, minM, minPtH, minM};
243  const Double_t xmax0[nBinsSparse0] = { maxPt, maxM, maxPtH, maxM};
244 
245  TString histName = "";
246  TString histTitle = "";
247  for (Int_t i = 0; i < fNcentBins; i++) {
248  histName = TString::Format("fh1PtHadron_%d",i);
249  histTitle = TString::Format("%s;#it{p}_{T,h}",histName.Data());
250  fh1PtHadron[i] = new TH1F(histName.Data(),histTitle.Data(),200.,0.,200.);
251  fOutput->Add(fh1PtHadron[i]);
252 
253  histName = TString::Format("fh1PtHadronMatch_%d",i);
254  histTitle = TString::Format("%s;#it{p}_{T,h}",histName.Data());
255  fh1PtHadronMatch[i] = new TH1F(histName.Data(),histTitle.Data(),200.,0.,200.);
256  fOutput->Add(fh1PtHadronMatch[i]);
257 
258  histName = TString::Format("fh1PhiHadron_%d",i);
259  histTitle = TString::Format("%s;#varphi",histName.Data());
260  fh1PhiHadron[i] = new TH1F(histName.Data(),histTitle.Data(),nBinsPhi,0.,TMath::TwoPi());
261  fOutput->Add(fh1PhiHadron[i]);
262 
263  histName = TString::Format("fh3PtHPtJDPhi_%d",i);
264  histTitle = TString::Format("%s;#it{p}_{T,h};#it{p}_{T,jet};#Delta#varphi_{h,jet}",histName.Data());
265  fh3PtHPtJDPhi[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPtH,minPtH,maxPtH,nBinsPt,minPt,maxPt,nBinsPhi,minPhi,maxPhi);
266  fOutput->Add(fh3PtHPtJDPhi[i]);
267 
268  if(fDoHJetAna) {
269  histName = TString::Format("fh3PtJet1VsMassVsHPtAllSel_%d",i);
270  histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
271  fh3PtJet1VsMassVsHPtAllSel[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
272  fOutput->Add(fh3PtJet1VsMassVsHPtAllSel[i]);
273 
274  histName = TString::Format("fh3PtJet1VsMassVsHPtAllSelMatch_%d",i);
275  histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
276  fh3PtJet1VsMassVsHPtAllSelMatch[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
277  fOutput->Add(fh3PtJet1VsMassVsHPtAllSelMatch[i]);
278 
279  histName = TString::Format("fh3PtJet1VsMassVsHPtTagged_%d",i);
280  histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
281  fh3PtJet1VsMassVsHPtTagged[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
282  fOutput->Add(fh3PtJet1VsMassVsHPtTagged[i]);
283 
284  histName = TString::Format("fh3PtJet1VsMassVsHPtTaggedMatch_%d",i);
285  histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1};#it{p}_{T,h}",histName.Data());
286  fh3PtJet1VsMassVsHPtTaggedMatch[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM,nBinsPtH,minPtH,maxPtH);
287  fOutput->Add(fh3PtJet1VsMassVsHPtTaggedMatch[i]);
288 
289  //
290  histName = TString::Format("fh3PtJet1VsRatVsHPtAllSel_%d",i);
291  histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
292  fh3PtJet1VsRatVsHPtAllSel[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
293  fOutput->Add(fh3PtJet1VsRatVsHPtAllSel[i]);
294 
295  histName = TString::Format("fh3PtJet1VsRatVsHPtAllSelMatch_%d",i);
296  histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
297  fh3PtJet1VsRatVsHPtAllSelMatch[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
298  fOutput->Add(fh3PtJet1VsRatVsHPtAllSelMatch[i]);
299 
300  histName = TString::Format("fh3PtJet1VsRatVsHPtTagged_%d",i);
301  histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
302  fh3PtJet1VsRatVsHPtTagged[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
303  fOutput->Add(fh3PtJet1VsRatVsHPtTagged[i]);
304 
305  histName = TString::Format("fh3PtJet1VsRatVsHPtTaggedMatch_%d",i);
306  histTitle = TString::Format("%s;#it{p}_{T,jet1};#it{M}_{jet1}/#it{p}_{T,jet1};#it{p}_{T,h}",histName.Data());
307  fh3PtJet1VsRatVsHPtTaggedMatch[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsR,minR,maxR,nBinsPtH,minPtH,maxPtH);
308  fOutput->Add(fh3PtJet1VsRatVsHPtTaggedMatch[i]);
309  }
310 
311  if(fDoNSHJetAna) {
312  histName = TString::Format("fhnAllSel_%d",i);
313  histTitle = Form("%s;#it{p}_{T,jet}^{AS};#it{M}_{jet}^{AS};#it{p}_{T,h}^{NS};#it{M}_{jet}^{NS}",histName.Data());
314  fhnAllSel[i] = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse0,nBins0,xmin0,xmax0);
315  fOutput->Add(fhnAllSel[i]);
316 
317  histName = TString::Format("fhnAllSelMatch_%d",i);
318  histTitle = Form("%s;#it{p}_{T,jet}^{AS};#it{M}_{jet}^{AS};#it{p}_{T,h}^{NS};#it{M}_{jet}^{NS}",histName.Data());
319  fhnAllSelMatch[i] = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse0,nBins0,xmin0,xmax0);
320  fOutput->Add(fhnAllSelMatch[i]);
321 
322  histName = TString::Format("fhnTagged_%d",i);
323  histTitle = Form("%s;#it{p}_{T,jet}^{AS};#it{M}_{jet}^{AS};#it{p}_{T,h}^{NS};#it{M}_{jet}^{NS}",histName.Data());
324  fhnTagged[i] = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse0,nBins0,xmin0,xmax0);
325  fOutput->Add(fhnTagged[i]);
326 
327  histName = TString::Format("fhnTaggedMatch_%d",i);
328  histTitle = Form("%s;#it{p}_{T,jet}^{AS};#it{M}_{jet}^{AS};#it{p}_{T,h}^{NS};#it{M}_{jet}^{NS}",histName.Data());
329  fhnTaggedMatch[i] = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse0,nBins0,xmin0,xmax0);
330  fOutput->Add(fhnTaggedMatch[i]);
331  }
332  }
333 
334  TH1::AddDirectory(oldStatus);
335 
336  fRandom = new TRandom3(0);
337 
338  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
339  }
340 
341  //________________________________________________________________________
342  Bool_t AliAnalysisTaskEmcalHJetMass::Run()
343  {
344  // Run analysis code here, if needed. It will be executed before FillHistograms().
345 
346  AliParticleContainer *pCont = GetParticleContainer(0);
347  AliJetContainer *jCont = GetJetContainer(fContainerBase);
348  if(!pCont || !jCont) return kFALSE;
349 
350  AliVParticle *vp = NULL;
351 
352  if(fTriggerTrackType==kInclusive) {
353  pCont->ResetCurrentID();
354  while((vp = pCont->GetNextAcceptParticle())) {
355  fh1PtHadron[fCentBin]->Fill(vp->Pt()); //all hadrons
356  fh1PhiHadron[fCentBin]->Fill(vp->Phi()); //all hadrons
357  if(fMarkMCLabel>0 && TMath::Abs(vp->GetLabel()) >= fMarkMCLabel )
358  fh1PtHadronMatch[fCentBin]->Fill(vp->Pt()); //hadrons matched to MC: now done in paticle container
359  AliEmcalJet* jet = NULL;
360  if(jCont) {
361  jCont->ResetCurrentID();
362  while((jet = jCont->GetNextAcceptJet())) {
363  Double_t dphi = GetDeltaPhi(vp,jet);
364  fh3PtHPtJDPhi[fCentBin]->Fill(vp->Pt(),jet->Pt() - GetRhoVal(fContainerBase)*jet->Area(),dphi);
365  if(TMath::Abs(dphi-TMath::Pi())>fDPhiHJetMax) continue;
366  FillHJetHistograms(vp,jet);
367  }
368  }
369  }
370  }
371  else if(fTriggerTrackType==kSingleInclusive) {
372  for(Int_t it = 0; it<fPtTTMin->GetSize(); it++) {
373  vp = GetSingleInclusiveTT(pCont,fPtTTMin->At(it),fPtTTMax->At(it));
374  if(!vp) continue;
375  fh1PtHadron[fCentBin]->Fill(vp->Pt()); //all trigger tracks
376  fh1PhiHadron[fCentBin]->Fill(vp->Phi()); //all hadrons
377  if(fMarkMCLabel>0 && TMath::Abs(vp->GetLabel()) >= fMarkMCLabel )
378  fh1PtHadronMatch[fCentBin]->Fill(vp->Pt()); //hadrons matched to MC: now done in paticle container
379  AliEmcalJet* jet = NULL;
380  jCont->ResetCurrentID();
381  while((jet = jCont->GetNextAcceptJet())) {
382  Double_t dphi = GetDeltaPhi(vp,jet);
383  fh3PtHPtJDPhi[fCentBin]->Fill(vp->Pt(),jet->Pt() - GetRhoVal(fContainerBase)*jet->Area(),dphi);
384  if(TMath::Abs(dphi-TMath::Pi())>fDPhiHJetMax) continue;
385  FillHJetHistograms(vp,jet);
386  }
387  }//trigger track types
388  }
389  return kTRUE;
390  }
391 
392  //________________________________________________________________________
393  AliVParticle* AliAnalysisTaskEmcalHJetMass::GetSingleInclusiveTT(AliParticleContainer *pCont, Double_t ptmin, Double_t ptmax) const {
394  AliVParticle *vp;
395  TArrayI arr; arr.Set(pCont->GetNParticles());
396  arr.Reset();
397  Int_t counter = -1;
398  pCont->ResetCurrentID();
399  while((vp = pCont->GetNextAcceptParticle())) {
400  if(vp->Pt()>=ptmin && vp->Pt()<ptmax ) {
401  counter++;
402  arr.SetAt(pCont->GetCurrentID(),counter);
403  }
404  }
405  if(counter<0) return NULL;
406  //select trigger track randomly
407  fRandom->SetSeed(arr.At(0)); //random selection reproducible
408  Double_t rnd = fRandom->Uniform() * counter;
409  Int_t trigID = arr.At(TMath::FloorNint(rnd));
410  vp = pCont->GetParticle(trigID);
411  if(fGapPhiMin>-1.) {
412  //check if trigger track opposite side of TPC hole dphi<fDPhiHJetMax
413  Double_t phiOp = vp->Phi()+TMath::Pi();
414  if(phiOp>TMath::TwoPi()) phiOp-=TMath::TwoPi();
415  Double_t phiOpMin = phiOp - fDPhiHJetMax;
416  if(phiOpMin<0.) phiOpMin+=TMath::TwoPi();
417  Double_t phiOpMax = phiOp + fDPhiHJetMax;
418  if(phiOpMax>TMath::TwoPi()) phiOpMax-=TMath::TwoPi();
419  if(phiOpMin > fGapPhiMin && phiOpMin < fGapPhiMax) return NULL;
420  if(phiOpMax > fGapPhiMin && phiOpMax < fGapPhiMax) return NULL;
421  }
422  return vp;
423  }
424 
425  //________________________________________________________________________
426  Bool_t AliAnalysisTaskEmcalHJetMass::FillHJetHistograms(const AliVParticle *vp, const AliEmcalJet *jet)
427  {
428  // Fill hadron-jet histograms.
429  Double_t pt = vp->Pt();
430  Double_t ptJet = jet->Pt() - GetRhoVal(fContainerBase)*jet->Area();
431  Double_t mJet = GetJetMass(jet);
432  Double_t rat = -1.;
433  if(ptJet<0. || ptJet>0.) rat = mJet/ptJet;
434 
435  Double_t var[4] = {ptJet,mJet,pt,-99.};
436  if(fDoNSHJetAna) {
437  AliEmcalJet *jetNS = FindNearSideJet(vp);
438  if(jetNS) var[3] = GetJetMass(jetNS);
439  }
440 
441  if(fDoHJetAna) {
442  fh3PtJet1VsMassVsHPtAllSel[fCentBin]->Fill(ptJet,mJet,pt);
443  fh3PtJet1VsRatVsHPtAllSel[fCentBin]->Fill(ptJet,rat,pt);
444  }
445 
446  if(fDoNSHJetAna)
447  fhnAllSel[fCentBin]->Fill(var);
448 
449  Double_t fraction = 1.;
450  if(fUseUnsubJet) {
451  AliEmcalJet *jetUS = NULL;
452  AliJetContainer *jetContUS = GetJetContainer(fContainerUnsub);
453  Int_t ifound = 0;
454  Int_t ilab = -1;
455  for(Int_t i = 0; i<jetContUS->GetNJets(); i++) {
456  jetUS = jetContUS->GetJet(i);
457  if(jetUS->GetLabel()==jet->GetLabel()) {
458  ifound++;
459  if(ifound==1) ilab = i;
460  }
461  }
462  if(ifound>1) AliDebug(2,Form("Found %d partners",ifound));
463  if(ifound==0) jetUS = 0x0;
464  else jetUS = jetContUS->GetJet(ilab);
465  fraction = jetContUS->GetFractionSharedPt(jetUS);
466  } else {
467  AliJetContainer *jetCont = GetJetContainer(fContainerBase);
468  fraction = jetCont->GetFractionSharedPt(jet);
469  }
470 
471  Bool_t mcMatch = kFALSE;
472  if(fMarkMCLabel>0 && TMath::Abs(vp->GetLabel()) >= fMarkMCLabel ) mcMatch = kTRUE;
473  if(fMinFractionShared>0. && fraction>fMinFractionShared) mcMatch = kTRUE;
474  else mcMatch = kFALSE;
475 
476  if(mcMatch) {
477  if(fDoHJetAna) {
478  fh3PtJet1VsMassVsHPtAllSelMatch[fCentBin]->Fill(ptJet,mJet,pt);
479  fh3PtJet1VsRatVsHPtAllSelMatch[fCentBin]->Fill(ptJet,rat,pt);
480  }
481  if(fDoNSHJetAna)
482  fhnAllSelMatch[fCentBin]->Fill(var);
483  }
484 
485  if(jet->GetTagStatus()<1 || !jet->GetTaggedJet())
486  return kFALSE;
487 
488  if(fDoHJetAna) {
489  fh3PtJet1VsMassVsHPtTagged[fCentBin]->Fill(ptJet,mJet,pt);
490  fh3PtJet1VsRatVsHPtTagged[fCentBin]->Fill(ptJet,rat,pt);
491  }
492  if(fDoNSHJetAna)
493  fhnTagged[fCentBin]->Fill(var);
494 
495  if(mcMatch) {
496  if(fDoHJetAna) {
497  fh3PtJet1VsMassVsHPtTaggedMatch[fCentBin]->Fill(ptJet,mJet,pt);
498  fh3PtJet1VsRatVsHPtTaggedMatch[fCentBin]->Fill(ptJet,rat,pt);
499  }
500  if(fDoNSHJetAna)
501  fhnTaggedMatch[fCentBin]->Fill(var);
502  }
503  return kTRUE;
504  }
505 
506  //________________________________________________________________________
507  AliEmcalJet* AliAnalysisTaskEmcalHJetMass::FindNearSideJet(const AliVParticle *vp) {
508  AliJetContainer *jCont = GetJetContainer(fContainerBase);
509  AliEmcalJet* jet = NULL;
510  if(jCont) {
511  jCont->ResetCurrentID();
512  while((jet = jCont->GetNextAcceptJet())) {
513  Int_t n = (Int_t)jet->GetNumberOfTracks();
514  if (n < 1) continue;
515  for (Int_t i = 0; i < n; i++) {
516  AliVParticle *vp2 = static_cast<AliVParticle*>(jet->TrackAt(i, jCont->GetParticleContainer()->GetArray()));
517  if(!vp2) continue;
518  if(vp->Phi()==vp2->Phi()) return jet;
519  }
520  }
521  }
522  return jet;
523  }
524 
525  //________________________________________________________________________
526  Double_t AliAnalysisTaskEmcalHJetMass::GetJetMass(const AliEmcalJet *jet) const {
527  //calc subtracted jet mass
528  if(fJetMassType==kRaw)
529  return jet->M();
530  else if(fJetMassType==kDeriv)
532 
533  return 0;
534  }
535 
536  //________________________________________________________________________
537  Double_t AliAnalysisTaskEmcalHJetMass::GetDeltaPhi(const AliVParticle *vp, const AliEmcalJet* jet) const {
538  // Calculate azimuthal angle between particle and jet. range:[-0.5\pi,1.5\pi]
539  return GetDeltaPhi(vp->Phi(),jet->Phi());
540  }
541 
542  //________________________________________________________________________
543  Double_t AliAnalysisTaskEmcalHJetMass::GetDeltaPhi(Double_t phi1, Double_t phi2) const {
544  // Calculate azimuthal angle between phi1 and phi2. range:[-0.5\pi,1.5\pi]
545  Double_t dPhi = phi1-phi2;
546  if(dPhi <-0.5*TMath::Pi()) dPhi += TMath::TwoPi();
547  if(dPhi > 1.5*TMath::Pi()) dPhi -= TMath::TwoPi();
548  return dPhi;
549  }
550 
551  //________________________________________________________________________
552  Bool_t AliAnalysisTaskEmcalHJetMass::RetrieveEventObjects() {
553  //
554  // retrieve event objects
555  //
557  return kFALSE;
558 
559  return kTRUE;
560  }
561 
562  //________________________________________________________________________
563  void AliAnalysisTaskEmcalHJetMass::AddTriggerTrackPtCuts(Float_t min, Float_t max) {
564  if(!fPtTTMin) fPtTTMin = new TArrayF();
565  if(!fPtTTMax) fPtTTMax = new TArrayF();
566  Int_t newSize = fPtTTMin->GetSize()+1;
567  fPtTTMin->Set(newSize);
568  fPtTTMax->Set(newSize);
569  fPtTTMin->AddAt(min,newSize-1);
570  fPtTTMax->AddAt(max,newSize-1);
571  }
572 
573  //_______________________________________________________________________
574  void AliAnalysisTaskEmcalHJetMass::Terminate(Option_t *)
575  {
576  // Called once at the end of the analysis.
577  }
578 }
579 
Double_t Area() const
Definition: AliEmcalJet.h:117
virtual AliVParticle * GetNextAcceptParticle()
double Double_t
Definition: External.C:58
AliEmcalJet * GetTaggedJet() const
Definition: AliEmcalJet.h:223
Definition: External.C:260
Int_t GetTagStatus() const
Definition: AliEmcalJet.h:224
Double_t Phi() const
Definition: AliEmcalJet.h:104
Int_t GetNParticles() const
Int_t GetLabel() const
Definition: AliEmcalJet.h:111
Container for particles within the EMCAL framework.
UShort_t GetNumberOfTracks() const
Definition: AliEmcalJet.h:126
AliParticleContainer * GetParticleContainer() const
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
const Double_t ptmax
virtual AliVParticle * GetParticle(Int_t i=-1) const
Int_t GetNJets() const
const Double_t ptmin
AliEmcalJet * GetNextAcceptJet()
Double_t Pt() const
Definition: AliEmcalJet.h:96
Short_t TrackAt(Int_t idx) const
Definition: AliEmcalJet.h:147
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:44
Double_t GetFractionSharedPt(const AliEmcalJet *jet, AliParticleContainer *cont2=0x0) const
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
AliEmcalJetShapeProperties * GetShapeProperties() const
Definition: AliEmcalJet.h:247
Double_t M() const
Definition: AliEmcalJet.h:107
Container for jet within the EMCAL jet framework.
ClassImp(EmcalHJetMassAnalysis::AliAnalysisTaskEmcalHJetMass) namespace EmcalHJetMassAnalysis
AliEmcalJet * GetJet(Int_t i) const