AliPhysics  a8fcd8c (a8fcd8c)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalJetMassBkg.cxx
Go to the documentation of this file.
1 //
2 // Jet mass background analysis task.
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 <TRandom3.h>
19 
20 #include "AliVCluster.h"
21 #include "AliVTrack.h"
22 #include "AliEmcalJet.h"
23 #include "AliRhoParameter.h"
24 #include "AliLog.h"
25 #include "AliEmcalParticle.h"
26 #include "AliMCEvent.h"
27 #include "AliGenPythiaEventHeader.h"
28 #include "AliAODMCHeader.h"
29 #include "AliMCEvent.h"
30 #include "AliAnalysisManager.h"
31 #include "AliJetContainer.h"
32 #include "AliClusterContainer.h"
33 #include "AliParticleContainer.h"
34 
36 
38 
39 //________________________________________________________________________
42  fContainerBase(0),
43  fMinRC2LJ(-1),
44  fRCperEvent(10),
45  fConeRadius(0.2),
46  fConeMinEta(-0.9),
47  fConeMaxEta(0.9),
48  fConeMinPhi(0),
49  fConeMaxPhi(TMath::Pi()*2),
50  fJetsCont(0),
51  fTracksCont(0),
52  fCaloClustersCont(0),
53  fh2PtVsMassRC(0),
54  fh2PtVsMassRCExLJDPhi(0),
55  fh2PtVsMassPerpConeLJ(0),
56  fh2PtVsMassPerpConeTJ(0),
57  fh2PtVsERC(0),
58  fh2PtVsERCExLJDPhi(0),
59  fh2PtVsEPerpConeLJ(0),
60  fh2PtVsEPerpConeTJ(0),
61  fpPtVsMassRC(0),
62  fpPtVsMassRCExLJ(0),
63  fpPtVsMassPerpConeLJ(0),
64  fpPtVsMassPerpConeTJ(0),
65  fh2EtaVsMassRC(0),
66  fh2EtaVsMassRCExLJ(0),
67  fh2EtaVsMassPerpConeLJ(0),
68  fh2EtaVsMassPerpConeTJ(0),
69  fh2CentVsMassRC(0),
70  fh2CentVsMassRCExLJ(0),
71  fh2CentVsMassPerpConeLJ(0),
72  fh2CentVsMassPerpConeTJ(0),
73  fh2MultVsMassRC(0),
74  fh2MultVsMassRCExLJ(0),
75  fh2MultVsMassPerpConeLJ(0),
76  fh2MultVsMassPerpConeTJ(0),
77  fh2CentVsMedianMassRC(0),
78  fh2CentVsMedianMassRCExLJ(0),
79  fh2MultVsMedianMassRC(0),
80  fh2MultVsMedianMassRCExLJ(0),
81  fh2CentVsMeanMassRC(0),
82  fh2CentVsMeanMassRCExLJ(0),
83  fh2MultVsMeanMassRC(0),
84  fh2MultVsMeanMassRCExLJ(0),
85  fh2CentVsMedianMassPerAreaRC(0),
86  fh2CentVsMedianMassPerAreaRCExLJ(0),
87  fh2MultVsMedianMassPerAreaRC(0),
88  fh2MultVsMedianMassPerAreaRCExLJ(0)
89 {
90  // Default constructor.
91 
92  fh2PtVsMassRC = new TH2F*[fNcentBins];
93  fh2PtVsMassRCExLJDPhi = new TH3F*[fNcentBins];
94  fh2PtVsMassPerpConeLJ = new TH2F*[fNcentBins];
95  fh2PtVsMassPerpConeTJ = new TH2F*[fNcentBins];
96 
97  fh2PtVsERC = new TH2F*[fNcentBins];
98  fh2PtVsERCExLJDPhi = new TH3F*[fNcentBins];
99  fh2PtVsEPerpConeLJ = new TH2F*[fNcentBins];
100  fh2PtVsEPerpConeTJ = new TH2F*[fNcentBins];
101 
102  fpPtVsMassRC = new TProfile*[fNcentBins];
103  fpPtVsMassRCExLJ = new TProfile*[fNcentBins];
104  fpPtVsMassPerpConeLJ = new TProfile*[fNcentBins];
105  fpPtVsMassPerpConeTJ = new TProfile*[fNcentBins];
106 
107  fh2EtaVsMassRC = new TH2F*[fNcentBins];
108  fh2EtaVsMassRCExLJ = new TH2F*[fNcentBins];
109  fh2EtaVsMassPerpConeLJ = new TH2F*[fNcentBins];
110  fh2EtaVsMassPerpConeTJ = new TH2F*[fNcentBins];
111 
112  for (Int_t i = 0; i < fNcentBins; i++) {
113  fh2PtVsMassRC[i] = 0;
114  fh2PtVsMassRCExLJDPhi[i] = 0;
115  fh2PtVsMassPerpConeLJ[i] = 0;
116  fh2PtVsMassPerpConeTJ[i] = 0;
117 
118  fh2PtVsERC[i] = 0;
119  fh2PtVsERCExLJDPhi[i] = 0;
120  fh2PtVsEPerpConeLJ[i] = 0;
121  fh2PtVsEPerpConeTJ[i] = 0;
122 
123  fpPtVsMassRC[i] = 0;
124  fpPtVsMassRCExLJ[i] = 0;
125  fpPtVsMassPerpConeLJ[i] = 0;
126  fpPtVsMassPerpConeTJ[i] = 0;
127 
128  fh2EtaVsMassRC[i] = 0;
129  fh2EtaVsMassRCExLJ[i] = 0;
130  fh2EtaVsMassPerpConeLJ[i] = 0;
131  fh2EtaVsMassPerpConeTJ[i] = 0;
132  }
133 
134  SetMakeGeneralHistograms(kTRUE);
135 
136 }
137 
138 //________________________________________________________________________
140  AliAnalysisTaskEmcalJet(name, kTRUE),
141  fContainerBase(0),
142  fMinRC2LJ(-1),
143  fRCperEvent(10),
144  fConeRadius(0.2),
145  fConeMinEta(-0.9),
146  fConeMaxEta(0.9),
147  fConeMinPhi(0),
148  fConeMaxPhi(TMath::Pi()*2),
149  fJetsCont(0),
150  fTracksCont(0),
151  fCaloClustersCont(0),
152  fh2PtVsMassRC(0),
153  fh2PtVsMassRCExLJDPhi(0),
154  fh2PtVsMassPerpConeLJ(0),
155  fh2PtVsMassPerpConeTJ(0),
156  fh2PtVsERC(0),
157  fh2PtVsERCExLJDPhi(0),
158  fh2PtVsEPerpConeLJ(0),
159  fh2PtVsEPerpConeTJ(0),
160  fpPtVsMassRC(0),
161  fpPtVsMassRCExLJ(0),
162  fpPtVsMassPerpConeLJ(0),
163  fpPtVsMassPerpConeTJ(0),
164  fh2EtaVsMassRC(0),
165  fh2EtaVsMassRCExLJ(0),
166  fh2EtaVsMassPerpConeLJ(0),
167  fh2EtaVsMassPerpConeTJ(0),
168  fh2CentVsMassRC(0),
169  fh2CentVsMassRCExLJ(0),
170  fh2CentVsMassPerpConeLJ(0),
171  fh2CentVsMassPerpConeTJ(0),
172  fh2MultVsMassRC(0),
173  fh2MultVsMassRCExLJ(0),
174  fh2MultVsMassPerpConeLJ(0),
175  fh2MultVsMassPerpConeTJ(0),
176  fh2CentVsMedianMassRC(0),
177  fh2CentVsMedianMassRCExLJ(0),
178  fh2MultVsMedianMassRC(0),
179  fh2MultVsMedianMassRCExLJ(0),
180  fh2CentVsMeanMassRC(0),
181  fh2CentVsMeanMassRCExLJ(0),
182  fh2MultVsMeanMassRC(0),
183  fh2MultVsMeanMassRCExLJ(0),
184  fh2CentVsMedianMassPerAreaRC(0),
185  fh2CentVsMedianMassPerAreaRCExLJ(0),
186  fh2MultVsMedianMassPerAreaRC(0),
187  fh2MultVsMedianMassPerAreaRCExLJ(0)
188 {
189  // Standard constructor.
190 
191  fh2PtVsMassRC = new TH2F*[fNcentBins];
195 
196  fh2PtVsERC = new TH2F*[fNcentBins];
200 
201  fpPtVsMassRC = new TProfile*[fNcentBins];
202  fpPtVsMassRCExLJ = new TProfile*[fNcentBins];
203  fpPtVsMassPerpConeLJ = new TProfile*[fNcentBins];
204  fpPtVsMassPerpConeTJ = new TProfile*[fNcentBins];
205 
210 
211  for (Int_t i = 0; i < fNcentBins; i++) {
212  fh2PtVsMassRC[i] = 0;
213  fh2PtVsMassRCExLJDPhi[i] = 0;
214  fh2PtVsMassPerpConeLJ[i] = 0;
215  fh2PtVsMassPerpConeTJ[i] = 0;
216 
217  fh2PtVsERC[i] = 0;
218  fh2PtVsERCExLJDPhi[i] = 0;
219  fh2PtVsEPerpConeLJ[i] = 0;
220  fh2PtVsEPerpConeTJ[i] = 0;
221 
222  fpPtVsMassRC[i] = 0;
223  fpPtVsMassRCExLJ[i] = 0;
224  fpPtVsMassPerpConeLJ[i] = 0;
225  fpPtVsMassPerpConeTJ[i] = 0;
226 
227  fh2EtaVsMassRC[i] = 0;
228  fh2EtaVsMassRCExLJ[i] = 0;
229  fh2EtaVsMassPerpConeLJ[i] = 0;
230  fh2EtaVsMassPerpConeTJ[i] = 0;
231  }
232 
234 }
235 
236 //________________________________________________________________________
238 {
239  // Destructor.
240 }
241 
242 //________________________________________________________________________
244 {
245  // Create user output.
246 
248 
252 
253  Bool_t oldStatus = TH1::AddDirectoryStatus();
254  TH1::AddDirectory(kFALSE);
255 
256  const Int_t nBinsPt = 250;
257  const Double_t minPt = -50.;
258  const Double_t maxPt = 200.;
259 
260  const Int_t nBinsE = 250;
261  const Double_t minE = -50.;
262  const Double_t maxE = 200.;
263 
264  const Int_t nBinsM = 150;
265  const Double_t minM = -50.;
266  const Double_t maxM = 100.;
267 
268  const Int_t nBinsEta = 100;
269  const Double_t minEta = -1.;
270  const Double_t maxEta = 1.;
271 
272  const Int_t nBinsCent = 100;
273  const Double_t minCent = 0.;
274  const Double_t maxCent = 100.;
275 
276  const Int_t nBinsMult = 400;
277  const Double_t minMult = 0.;
278  const Double_t maxMult = 4000.;
279 
280  fh2CentVsMassRC = new TH2F("fh2CentVsMassRC","fh2CentVsMassRC;cent;#it{M}_{RC}",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
281  fOutput->Add(fh2CentVsMassRC);
282 
283  fh2CentVsMassRCExLJ = new TH2F("fh2CentVsMassRCExLJ","fh2CentVsMassRCExLJ;cent;#it{M}_{RC}",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
285 
286  fh2CentVsMassPerpConeLJ = new TH2F("fh2CentVsMassPerpConeLJ","fh2CentVsMassPerpConeLJ;cent;#it{M}_{RC}",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
288 
289  fh2CentVsMassPerpConeTJ = new TH2F("fh2CentVsMassPerpConeTJ","fh2CentVsMassPerpConeTJ;cent;#it{M}_{RC}",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
291 
292  fh2MultVsMassRC = new TH2F("fh2MultVsMassRC","fh2MultVsMassRC;#it{N}_{track};#it{M}_{RC}",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
293  fOutput->Add(fh2MultVsMassRC);
294 
295  fh2MultVsMassRCExLJ = new TH2F("fh2MultVsMassRCExLJ","fh2MultVsMassRCExLJ;#it{N}_{track};#it{M}_{RC}",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
297 
298  fh2MultVsMassPerpConeLJ = new TH2F("fh2MultVsMassPerpConeLJ","fh2MultVsMassPerpConeLJ;#it{N}_{track};#it{M}_{RC}",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
300 
301  fh2MultVsMassPerpConeTJ = new TH2F("fh2MultVsMassPerpConeTJ","fh2MultVsMassPerpConeTJ;#it{N}_{track};#it{M}_{RC}",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
303 
304  fh2CentVsMedianMassRC = new TH2F("fh2CentVsMedianMassRC","fh2CentVsMedianMassRC;cent;#it{M}_{RC}",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
306 
307  fh2CentVsMedianMassRCExLJ = new TH2F("fh2CentVsMedianMassRCExLJ","fh2CentVsMedianMassRCExLJ;cent;#it{M}_{RC}",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
309 
310  fh2MultVsMedianMassRC = new TH2F("fh2MultVsMedianMassRC","fh2MultVsMedianMassRC;#it{N}_{track};#it{M}_{RC}",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
312 
313  fh2MultVsMedianMassRCExLJ = new TH2F("fh2MultVsMedianMassRCExLJ","fh2MultVsMedianMassRCExLJ;#it{N}_{track};#it{M}_{RC}",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
315 
316  fh2CentVsMeanMassRC = new TH2F("fh2CentVsMeanMassRC","fh2CentVsMeanMassRC;cent;#it{M}_{RC}",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
318 
319  fh2CentVsMeanMassRCExLJ = new TH2F("fh2CentVsMeanMassRCExLJ","fh2CentVsMeanMassRCExLJ;cent;#it{M}_{RC}",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
321 
322  fh2MultVsMeanMassRC = new TH2F("fh2MultVsMeanMassRC","fh2MultVsMeanMassRC;#it{N}_{track};#it{M}_{RC}",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
324 
325  fh2MultVsMeanMassRCExLJ = new TH2F("fh2MultVsMeanMassRCExLJ","fh2MultVsMeanMassRCExLJ;#it{N}_{track};#it{M}_{RC}",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
327 
328  fh2CentVsMedianMassPerAreaRC = new TH2F("fh2CentVsMedianMassPerAreaRC","fh2CentVsMedianMassPerAreaRC;cent;#it{M}_{RC}/A",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
330 
331  fh2CentVsMedianMassPerAreaRCExLJ = new TH2F("fh2CentVsMedianMassPerAreaRCExLJ","fh2CentVsMedianMassPerAreaRCExLJ;cent;#it{M}_{RC}/A",nBinsCent,minCent,maxCent,nBinsM,minM,maxM);
333 
334  fh2MultVsMedianMassPerAreaRC = new TH2F("fh2MultVsMedianMassPerAreaRC","fh2MultVsMedianMassPerAreaRC;#it{N}_{track};#it{M}_{RC}/A",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
336 
337  fh2MultVsMedianMassPerAreaRCExLJ = new TH2F("fh2MultVsMedianMassPerAreaRCExLJ","fh2MultVsMedianMassPerAreaRCExLJ;#it{N}_{track};#it{M}_{RC}/A",nBinsMult,minMult,maxMult,nBinsM,minM,maxM);
339 
340  TString histName = "";
341  TString histTitle = "";
342  for (Int_t i = 0; i < fNcentBins; i++) {
343  histName = TString::Format("fh2PtVsMassRC_%d",i);
344  histTitle = TString::Format("%s;#it{p}_{T,RC};#it{M}_{RC}",histName.Data());
345  fh2PtVsMassRC[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM);
346  fOutput->Add(fh2PtVsMassRC[i]);
347 
348  histName = TString::Format("fh2PtVsMassRCExLJDPhi_%d",i);
349  histTitle = TString::Format("%s;#it{p}_{T,RC};#it{M}_{RC}",histName.Data());
350  fh2PtVsMassRCExLJDPhi[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsPt,minPt,maxPt,72,-0.5*TMath::Pi(),1.5*TMath::Pi());
351  fOutput->Add(fh2PtVsMassRCExLJDPhi[i]);
352 
353  histName = TString::Format("fh2PtVsMassPerpConeLJ_%d",i);
354  histTitle = TString::Format("%s;#it{p}_{T,PerpConeLJ};#it{M}_{PerpConeLJ}",histName.Data());
355  fh2PtVsMassPerpConeLJ[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM);
356  fOutput->Add(fh2PtVsMassPerpConeLJ[i]);
357 
358  histName = TString::Format("fh2PtVsMassPerpConeTJ_%d",i);
359  histTitle = TString::Format("%s;#it{p}_{T,PerpConeTJ};#it{M}_{PerpConeTJ}",histName.Data());
360  fh2PtVsMassPerpConeTJ[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsM,minM,maxM);
361  fOutput->Add(fh2PtVsMassPerpConeTJ[i]);
362  //
363  histName = TString::Format("fh2PtVsERC_%d",i);
364  histTitle = TString::Format("%s;#it{p}_{T,RC};#it{M}_{RC}",histName.Data());
365  fh2PtVsERC[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsE,minE,maxE);
366  fOutput->Add(fh2PtVsERC[i]);
367 
368  histName = TString::Format("fh2PtVsERCExLJDPhi_%d",i);
369  histTitle = TString::Format("%s;#it{p}_{T,RC};#it{M}_{RC}",histName.Data());
370  fh2PtVsERCExLJDPhi[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsPt,minPt,maxPt,72,-0.5*TMath::Pi(),1.5*TMath::Pi());
371  fOutput->Add(fh2PtVsERCExLJDPhi[i]);
372 
373  histName = TString::Format("fh2PtVsEPerpConeLJ_%d",i);
374  histTitle = TString::Format("%s;#it{p}_{T,PerpConeLJ};#it{M}_{PerpConeLJ}",histName.Data());
375  fh2PtVsEPerpConeLJ[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsE,minE,maxE);
376  fOutput->Add(fh2PtVsEPerpConeLJ[i]);
377 
378  histName = TString::Format("fh2PtVsEPerpConeTJ_%d",i);
379  histTitle = TString::Format("%s;#it{p}_{T,PerpConeTJ};#it{M}_{PerpConeTJ}",histName.Data());
380  fh2PtVsEPerpConeTJ[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsE,minE,maxE);
381  fOutput->Add(fh2PtVsEPerpConeTJ[i]);
382  //
383  histName = TString::Format("fh2EtaVsMassRC_%d",i);
384  histTitle = TString::Format("%s;#eta_{RC};#it{M}_{RC}",histName.Data());
385  fh2EtaVsMassRC[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsEta,minEta,maxEta,nBinsM,minM,maxM);
386  fOutput->Add(fh2EtaVsMassRC[i]);
387 
388  histName = TString::Format("fh2EtaVsMassRCExLJ_%d",i);
389  histTitle = TString::Format("%s;#eta_{RC};#it{M}_{RC}",histName.Data());
390  fh2EtaVsMassRCExLJ[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsEta,minEta,maxEta,nBinsM,minM,maxM);
391  fOutput->Add(fh2EtaVsMassRCExLJ[i]);
392 
393  histName = TString::Format("fh2EtaVsMassPerpConeLJ_%d",i);
394  histTitle = TString::Format("%s;#eta_{PerpConeLJ};#it{M}_{PerpConeLJ}",histName.Data());
395  fh2EtaVsMassPerpConeLJ[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsEta,minEta,maxEta,nBinsM,minM,maxM);
396  fOutput->Add(fh2EtaVsMassPerpConeLJ[i]);
397 
398  histName = TString::Format("fh2EtaVsMassPerpConeTJ_%d",i);
399  histTitle = TString::Format("%s;#eta_{PerpConeTJ};#it{M}_{PerpConeTJ}",histName.Data());
400  fh2EtaVsMassPerpConeTJ[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsEta,minEta,maxEta,nBinsM,minM,maxM);
401  fOutput->Add(fh2EtaVsMassPerpConeTJ[i]);
402 
403  histName = TString::Format("fpPtVsMassRC_%d",i);
404  histTitle = TString::Format("%s;#it{p}_{T,RC};Avg #it{M}_{RC}",histName.Data());
405  fpPtVsMassRC[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
406  fOutput->Add(fpPtVsMassRC[i]);
407 
408  histName = TString::Format("fpPtVsMassRCExLJ_%d",i);
409  histTitle = TString::Format("%s;#it{p}_{T,RC};Avg #it{M}_{RC}",histName.Data());
410  fpPtVsMassRCExLJ[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
411  fOutput->Add(fpPtVsMassRCExLJ[i]);
412 
413  histName = TString::Format("fpPtVsMassPerpConeLJ_%d",i);
414  histTitle = TString::Format("%s;#it{p}_{T,RC};Avg #it{M}_{RC}",histName.Data());
415  fpPtVsMassPerpConeLJ[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
416  fOutput->Add(fpPtVsMassPerpConeLJ[i]);
417 
418  histName = TString::Format("fpPtVsMassPerpConeTJ_%d",i);
419  histTitle = TString::Format("%s;#it{p}_{T,RC};Avg #it{M}_{RC}",histName.Data());
420  fpPtVsMassPerpConeTJ[i] = new TProfile(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt);
421  fOutput->Add(fpPtVsMassPerpConeTJ[i]);
422  }
423 
424  // =========== Switch on Sumw2 for all histos ===========
425  for (Int_t i=0; i<fOutput->GetEntries(); ++i) {
426  TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i));
427  if (h1){
428  h1->Sumw2();
429  continue;
430  }
431  THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i));
432  if(hn)hn->Sumw2();
433  }
434 
435  TH1::AddDirectory(oldStatus);
436 
437  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
438 }
439 
440 //________________________________________________________________________
442 {
443  // Run analysis code here, if needed. It will be executed before FillHistograms().
444 
445  return kTRUE;
446 }
447 
448 //________________________________________________________________________
450 {
451  // Fill histograms.
452 
453  const Float_t rcArea = fConeRadius * fConeRadius * TMath::Pi();
454 
455  //Event properties
457  Int_t trackMult = fTracksCont->GetNAcceptedParticles();
458 
459  //Leading jet
460  AliEmcalJet* jet = NULL;
461  if (fJetsCont)
462  jet = fJetsCont->GetLeadingJet("rho");
463 
464  TLorentzVector lvRC(0.,0.,0.,0.);
465  TLorentzVector lvRCS(0.,0.,0.,0.);
466  Float_t RCpt = 0;
467  Float_t RCeta = 0;
468  Float_t RCphi = 0;
469 
470  static Double_t massvecRC[999];
471  static Double_t massPerAreavecRC[999];
472 
473  static Double_t massvecRCExLJ[999];
474  static Double_t massPerAreavecRCExLJ[999];
475 
476  Int_t nRCAcc = 0;
477  Int_t nRCExLJAcc = 0;
478 
479  for (Int_t i = 0; i < fRCperEvent; i++) {
480  // Simple random cones
481  lvRC.SetPxPyPzE(0.,0.,0.,0.);
482  RCpt = 0;
483  RCeta = 0;
484  RCphi = 0;
485  GetRandomCone(lvRC,RCpt, RCeta, RCphi, fTracksCont, fCaloClustersCont, 0);
486  if (RCpt > 0) {
487  lvRCS = GetSubtractedVector(lvRC.Pt(),lvRC.Eta(),lvRC.Phi(),lvRC.E());
488  fh2PtVsMassRC[fCentBin]->Fill(RCpt-rho*rcArea,lvRCS.M());
489  fh2PtVsERC[fCentBin]->Fill(RCpt-rho*rcArea,lvRCS.E());
490  fpPtVsMassRC[fCentBin]->Fill(RCpt-rho*rcArea,lvRCS.M());
491  fh2EtaVsMassRC[fCentBin]->Fill(lvRCS.Eta(),lvRCS.M());
492  fh2CentVsMassRC->Fill(fCent,lvRCS.M());
493  fh2MultVsMassRC->Fill(trackMult,lvRCS.M());
494 
495  massvecRC[nRCAcc] = lvRCS.M();
496  massPerAreavecRC[nRCAcc] = massvecRC[nRCAcc]/rcArea;
497  ++nRCAcc;
498  }
499 
500  if (fJetsCont && jet) {
501  // Random cones far away from leading jet(s)
502  lvRC.SetPxPyPzE(0.,0.,0.,0.);
503  RCpt = 0;
504  RCeta = 0;
505  RCphi = 0;
506  GetRandomCone(lvRC,RCpt, RCeta, RCphi, fTracksCont, fCaloClustersCont, jet);
507  if (RCpt > 0 && jet) {
508  lvRCS = GetSubtractedVector(lvRC.Pt(),lvRC.Eta(),lvRC.Phi(),lvRC.E());
509  Float_t dphi = RCphi - jet->Phi();
510  if (dphi > 1.5*TMath::Pi()) dphi -= TMath::Pi() * 2;
511  if (dphi < -0.5*TMath::Pi()) dphi += TMath::Pi() * 2;
512  fh2PtVsMassRCExLJDPhi[fCentBin]->Fill(RCpt-rho*rcArea,lvRCS.M(),dphi);
513  fh2PtVsERCExLJDPhi[fCentBin]->Fill(RCpt-rho*rcArea,lvRCS.E(),dphi);
514  fpPtVsMassRCExLJ[fCentBin]->Fill(RCpt-rho*rcArea,lvRCS.M());
515  fh2EtaVsMassRCExLJ[fCentBin]->Fill(lvRCS.Eta(),lvRCS.M());
516  fh2CentVsMassRCExLJ->Fill(fCent,lvRCS.M());
517  fh2MultVsMassRCExLJ->Fill(trackMult,lvRCS.M());
518 
519  massvecRCExLJ[nRCExLJAcc] = lvRCS.M();
520  massPerAreavecRCExLJ[nRCExLJAcc] = lvRCS.M()/rcArea;
521  ++nRCExLJAcc;
522  }
523  }
524  }//RC loop
525 
526  Double_t medianRC, medianRCExLJ = 0.;
527  medianRC = TMath::Median(nRCAcc,massvecRC);
528  medianRCExLJ = TMath::Median(nRCExLJAcc,massvecRCExLJ);
529 
530  fh2CentVsMedianMassRC->Fill(fCent,medianRC);
531  fh2CentVsMedianMassRCExLJ->Fill(fCent,medianRCExLJ);
532 
533  fh2MultVsMedianMassRC->Fill(trackMult,medianRC);
534  fh2MultVsMedianMassRCExLJ->Fill(trackMult,medianRCExLJ);
535 
536  Double_t meanRC = 0.; Double_t meanRCExLJ = 0.;
537  if(nRCAcc>0) meanRC = TMath::Mean(nRCAcc,massvecRC);
538  if(nRCExLJAcc) meanRCExLJ = TMath::Mean(nRCExLJAcc,massvecRCExLJ);
539 
540  fh2CentVsMeanMassRC->Fill(fCent,meanRC);
541  fh2CentVsMeanMassRCExLJ->Fill(fCent,meanRCExLJ);
542 
543  fh2MultVsMeanMassRC->Fill(trackMult,meanRC);
544  fh2MultVsMeanMassRCExLJ->Fill(trackMult,meanRCExLJ);
545 
546  Double_t medianPerAreaRC, medianPerAreaRCExLJ = 0.;
547  medianPerAreaRC = TMath::Median(nRCAcc,massPerAreavecRC);
548  medianPerAreaRCExLJ = TMath::Median(nRCExLJAcc,massPerAreavecRCExLJ);
549 
550  fh2CentVsMedianMassPerAreaRC->Fill(fCent,medianPerAreaRC);
551  fh2CentVsMedianMassPerAreaRCExLJ->Fill(fCent,medianPerAreaRCExLJ);
552 
553  fh2MultVsMedianMassPerAreaRC->Fill(trackMult,medianPerAreaRC);
554  fh2MultVsMedianMassPerAreaRCExLJ->Fill(trackMult,medianPerAreaRCExLJ);
555 
556 
557  if(fJetsCont && jet) {
558  //cone perpendicular to leading jet
559  TLorentzVector lvPC(0.,0.,0.,0.);
560  TLorentzVector lvPCS(0.,0.,0.,0.);
561  Float_t PCpt = 0;
562  Float_t PCeta = 0;
563  Float_t PCphi = 0;
564  if(jet) {
565  GetPerpCone(lvPC,PCpt, PCeta, PCphi, fTracksCont, fCaloClustersCont, jet);
566  if(PCpt>0.) {
567  lvPCS = GetSubtractedVector(lvPC.Pt(),lvPC.Eta(),lvPC.Phi(),lvPC.E());
568  fh2PtVsMassPerpConeLJ[fCentBin]->Fill(PCpt-rho*rcArea,lvPCS.M());
569  fh2PtVsEPerpConeLJ[fCentBin]->Fill(PCpt-rho*rcArea,lvPCS.E());
570  fpPtVsMassPerpConeLJ[fCentBin]->Fill(PCpt-rho*rcArea,lvPCS.M());
571  fh2EtaVsMassPerpConeLJ[fCentBin]->Fill(lvPCS.Eta(),lvPCS.M());
572  fh2CentVsMassPerpConeLJ->Fill(fCent,lvPCS.M());
573  fh2MultVsMassPerpConeLJ->Fill(trackMult,lvPCS.M());
574  }
575  }
576  //cone perpendicular to all tagged jets
577  for(int i = 0; i < fJetsCont->GetNJets();++i) {
578  jet = static_cast<AliEmcalJet*>(fJetsCont->GetAcceptJet(i));
579  if(!jet) continue;
580 
581  if(jet->GetTagStatus()<1)
582  continue;
583 
584  lvPC.SetPxPyPzE(0.,0.,0.,0.);
585  PCpt = 0;
586  PCeta = 0;
587  PCphi = 0;
588  GetPerpCone(lvPC,PCpt, PCeta, PCphi, fTracksCont, fCaloClustersCont, jet);
589  if(PCpt>0.) {
590  lvPCS = GetSubtractedVector(lvPC.Pt(),lvPC.Eta(),lvPC.Phi(),lvPC.E());
591  fh2PtVsMassPerpConeTJ[fCentBin]->Fill(PCpt-rho*rcArea,lvPCS.M());
592  fh2PtVsEPerpConeTJ[fCentBin]->Fill(PCpt-rho*rcArea,lvPCS.E());
593  fpPtVsMassPerpConeTJ[fCentBin]->Fill(PCpt-rho*rcArea,lvPCS.M());
594  fh2EtaVsMassPerpConeTJ[fCentBin]->Fill(lvPCS.Eta(),lvPCS.M());
595  fh2CentVsMassPerpConeTJ->Fill(fCent,lvPCS.M());
596  fh2MultVsMassPerpConeTJ->Fill(trackMult,lvPCS.M());
597  }
598  }//jet loop
599  }
600 
601  return kTRUE;
602 
603 }
604 
605 //________________________________________________________________________
606 void AliAnalysisTaskEmcalJetMassBkg::GetRandomCone(TLorentzVector& lvRC,Float_t &pt, Float_t &eta, Float_t &phi,
607  AliParticleContainer* tracks, AliClusterContainer* clusters,
608  AliEmcalJet *jet) const
609 {
610  // Get rigid cone.
611  lvRC.SetPxPyPzE(0.,0.,0.,0.);
612 
613  eta = -999;
614  phi = -999;
615  pt = 0;
616 
617  if (!tracks && !clusters)
618  return;
619 
620  Float_t LJeta = 999;
621  Float_t LJphi = 999;
622 
623  if (jet) {
624  LJeta = jet->Eta();
625  LJphi = jet->Phi();
626  }
627 
628  Float_t maxEta = fConeMaxEta;
629  Float_t minEta = fConeMinEta;
630  Float_t maxPhi = fConeMaxPhi;
631  Float_t minPhi = fConeMinPhi;
632 
633  if (maxPhi > TMath::Pi() * 2) maxPhi = TMath::Pi() * 2;
634  if (minPhi < 0) minPhi = 0;
635 
636  Float_t dLJ = 0;
637  Int_t repeats = 0;
638  Bool_t reject = kTRUE;
639  do {
640  eta = gRandom->Rndm() * (maxEta - minEta) + minEta;
641  phi = gRandom->Rndm() * (maxPhi - minPhi) + minPhi;
642  dLJ = TMath::Sqrt((LJeta - eta) * (LJeta - eta) + (LJphi - phi) * (LJphi - phi));
643 
644  repeats++;
645  } while (dLJ < fMinRC2LJ && repeats < 999 && reject);
646 
647  if (repeats == 999) {
648  AliWarning(Form("%s: Could not get random cone!", GetName()));
649  return;
650  }
651 
652  GetCone(lvRC,pt,eta,phi,tracks,clusters);
653 
654 
655 }
656 
657 //________________________________________________________________________
658 void AliAnalysisTaskEmcalJetMassBkg::GetCone(TLorentzVector& lvRC,Float_t &pt, Float_t eta, Float_t phi, AliParticleContainer* tracks, AliClusterContainer* clusters) const
659 {
660 
661  pt = 0.;
662  lvRC.SetPxPyPzE(0.,0.,0.,0.);
663 
664  if (clusters) {
665  clusters->ResetCurrentID();
666  AliVCluster* cluster = clusters->GetNextAcceptCluster();
667  while (cluster) {
668  TLorentzVector nPart;
669  cluster->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
670 
671  Float_t cluseta = nPart.Eta();
672  Float_t clusphi = nPart.Phi();
673 
674  if (TMath::Abs(clusphi - phi) > TMath::Abs(clusphi - phi + 2 * TMath::Pi()))
675  clusphi += 2 * TMath::Pi();
676  if (TMath::Abs(clusphi - phi) > TMath::Abs(clusphi - phi - 2 * TMath::Pi()))
677  clusphi -= 2 * TMath::Pi();
678 
679  Float_t d = TMath::Sqrt((cluseta - eta) * (cluseta - eta) + (clusphi - phi) * (clusphi - phi));
680  if (d <= fConeRadius) {
681  pt += nPart.Pt();
682  TLorentzVector lvcl(nPart.Px(),nPart.Py(),nPart.Pz(),nPart.E());
683  lvRC += lvcl;
684  }
685 
686  cluster = clusters->GetNextAcceptCluster();
687  }
688  }
689 
690  if (tracks) {
691  tracks->ResetCurrentID();
692  AliVParticle* track = tracks->GetNextAcceptParticle();
693  while(track) {
694  Float_t tracketa = track->Eta();
695  Float_t trackphi = track->Phi();
696 
697  if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi + 2 * TMath::Pi()))
698  trackphi += 2 * TMath::Pi();
699  if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi - 2 * TMath::Pi()))
700  trackphi -= 2 * TMath::Pi();
701 
702  Float_t d = TMath::Sqrt((tracketa - eta) * (tracketa - eta) + (trackphi - phi) * (trackphi - phi));
703  if (d <= fConeRadius) {
704  pt += track->Pt();
705  TLorentzVector lvtr(track->Px(),track->Py(),track->Pz(),track->E());
706  lvRC += lvtr;
707  }
708 
709  track = tracks->GetNextAcceptParticle();
710  }
711  }
712 
713 }
714 
715 //________________________________________________________________________
716 void AliAnalysisTaskEmcalJetMassBkg::GetPerpCone(TLorentzVector& lvRC,Float_t &pt, Float_t &eta, Float_t &phi, AliParticleContainer* tracks, AliClusterContainer* clusters, AliEmcalJet *jet) const
717 {
718  // Get rigid cone.
719  lvRC.SetPxPyPzE(0.,0.,0.,0.);
720 
721  eta = -999;
722  phi = -999;
723  pt = 0;
724 
725  if (!tracks && !clusters)
726  return;
727 
728  if(!jet)
729  return;
730 
731  Float_t LJeta = jet->Eta();
732  Float_t LJphi = jet->Phi();
733 
734  eta = LJeta;
735  phi = LJphi + 0.5*TMath::Pi();
736  if(phi>TMath::TwoPi()) phi-=TMath::TwoPi();
737 
738  GetCone(lvRC,pt,eta,phi,tracks,clusters);
739 }
740 
741 //________________________________________________________________________
743 {
744  // Set default cuts for full cones
745 
748 }
749 
750 //________________________________________________________________________
752 {
753  // Set default cuts for charged cones
754 
756  SetConePhiLimits(-10, 10);
757 }
758 
759 //________________________________________________________________________
761 
763 
764  if (fTracksCont && fTracksCont->GetArray() == 0) fTracksCont = 0;
765  if (fCaloClustersCont && fCaloClustersCont->GetArray() == 0) fCaloClustersCont = 0;
766 
767  if (fRCperEvent < 0) {
769  Double_t rcArea = TMath::Pi() * fConeRadius * fConeRadius;
770  fRCperEvent = TMath::FloorNint(area / rcArea - 0.5);
771  if (fRCperEvent == 0)
772  fRCperEvent = 1;
773  }
774 
775  if (fMinRC2LJ < 0)
776  fMinRC2LJ = fConeRadius * 1.5;
777 
778  const Float_t maxDist = TMath::Max(fConeMaxPhi - fConeMinPhi, fConeMaxEta - fConeMinEta) / 2;
779  if (fMinRC2LJ > maxDist) {
780  AliWarning(Form("The parameter fMinRC2LJ = %f is too large for the considered acceptance. "
781  "Will use fMinRC2LJ = %f", fMinRC2LJ, maxDist));
782  fMinRC2LJ = maxDist;
783  }
784 
785 }
786 
787  //________________________________________________________________________
789  //get background vector
790 
791  Double_t rho = cont->GetRhoVal();
792  Double_t rhom = cont->GetRhoMassVal();
793  TLorentzVector vpB(0.,0.,0.,0.);
794  Double_t aRC = TMath::Pi()*fConeRadius*fConeRadius;
795  vpB.SetPxPyPzE(rho*TMath::Cos(phi)*aRC,rho*TMath::Sin(phi)*aRC,(rho+rhom)*TMath::SinH(eta)*aRC,(rho+rhom)*TMath::CosH(eta)*aRC);
796  return vpB;
797 }
798 
799 //________________________________________________________________________
801  //get subtracted vector
802  TLorentzVector vpS;
804  TLorentzVector vpBkg = GetBkgVector(eta,phi,jetCont);
805  vpS.SetPxPyPzE(pt*TMath::Cos(phi)-vpBkg.Px(),pt*TMath::Sin(phi)-vpBkg.Py(),pt*TMath::SinH(eta)-vpBkg.Pz(),e-vpBkg.E());
806  return vpS;
807 }
808 
809 //________________________________________________________________________
811  //
812  // retrieve event objects
813  //
814 
816  return kFALSE;
817 
818  return kTRUE;
819 
820 }
821 
822 //_______________________________________________________________________
824 {
825  // Called once at the end of the analysis.
826 }
827 
TH2F ** fh2PtVsMassPerpConeLJ
pT vs mass of RC excluding area around leading jet
TH2F * fh2MultVsMassRCExLJ
track multiplicity vs mass of RC
TH2F * fh2CentVsMedianMassPerAreaRCExLJ
cent vs median mass of all RC in event
TH2F * fh2CentVsMassRC
eta vs mass of cone perpendicular to all tagged jets
virtual AliVParticle * GetNextAcceptParticle()
Double_t GetRhoVal() const
double Double_t
Definition: External.C:58
Definition: External.C:260
TH2F * fh2CentVsMassPerpConeLJ
cent vs mass of RC excluding area around leading jet
Definition: External.C:236
AliJetContainer * GetJetContainer(Int_t i=0) const
Int_t GetTagStatus() const
Definition: AliEmcalJet.h:338
Double_t Eta() const
Definition: AliEmcalJet.h:121
TLorentzVector GetSubtractedVector(Double_t pt, Double_t eta, Double_t phi, Double_t e)
void ExecOnce()
Perform steps needed to initialize the analysis.
Double_t Phi() const
Definition: AliEmcalJet.h:117
AliClusterContainer * fCaloClustersCont
Tracks.
TProfile ** fpPtVsMassRC
E vs mass of cone perpendicular to all tagged jets.
void GetRandomCone(TLorentzVector &lvRC, Float_t &pt, Float_t &eta, Float_t &phi, AliParticleContainer *tracks, AliClusterContainer *clusters, AliEmcalJet *jet=0) const
TH2F * fh2CentVsMedianMassRCExLJ
cent vs median mass of all RC in event
TH2F ** fh2EtaVsMassRC
pT vs Avg mass of cone perpendicular to all tagged jets
TProfile ** fpPtVsMassPerpConeTJ
pT vs Avg mass of cone perpendicular to leading jet
TH2F ** fh2PtVsEPerpConeLJ
E vs mass of RC excluding area around leading jet.
AliClusterContainer * GetClusterContainer() const
TH2F * fh2MultVsMassPerpConeTJ
track multiplicity vs mass of RC perpendicular to leading jet
void SetConePhiLimits(Float_t min, Float_t max)
TH2F * fh2MultVsMassPerpConeLJ
track multiplicity vs mass of RC excluding area around leading jet
Int_t fCentBin
!event centrality bin
void SetConeEtaLimits(Float_t min, Float_t max)
TH2F * fh2MultVsMedianMassPerAreaRCExLJ
cent vs median mass of all RC in event
TH2F * fh2MultVsMedianMassPerAreaRC
cent vs meidan mass mass of all RC in event excluding area around leading jet
TRandom * gRandom
void GetPerpCone(TLorentzVector &lvRC, Float_t &pt, Float_t &eta, Float_t &phi, AliParticleContainer *tracks, AliClusterContainer *clusters, AliEmcalJet *jet=0) const
Container for particles within the EMCAL framework.
TH2F * fh2CentVsMedianMassPerAreaRC
cent vs meidan mass mass of all RC in event excluding area around leading jet
TH2F ** fh2PtVsERC
pT vs mass of cone perpendicular to all tagged jets
AliParticleContainer * GetParticleContainer() const
AliEmcalJet * GetLeadingJet(const char *opt="")
int Int_t
Definition: External.C:63
TH2F ** fh2PtVsMassPerpConeTJ
pT vs mass of cone perpendicular to leading jet
float Float_t
Definition: External.C:68
Int_t GetNJets() const
Int_t fNcentBins
how many centrality bins
TH2F * fh2CentVsMedianMassRC
track multiplicity vs mass of RC perpendicular to tagged jets
Double_t fCent
!event centrality
TLorentzVector GetBkgVector(Double_t eta, Double_t phi, AliJetContainer *cont)
Double_t GetRhoMassVal() const
TH2F ** fh2EtaVsMassPerpConeTJ
eta vs mass of cone perpendicular to leading jet
TH2F * fh2CentVsMeanMassRC
cent vs meidan mass mass of all RC in event excluding area around leading jet
TH2F * fh2MultVsMedianMassRCExLJ
cent vs median mass of all RC in event
TH2F * fh2MultVsMeanMassRC
cent vs meidan mass mass of all RC in event excluding area around leading jet
void GetCone(TLorentzVector &lvRC, Float_t &pt, Float_t eta, Float_t phi, AliParticleContainer *tracks, AliClusterContainer *clusters) const
TH2F * fh2CentVsMeanMassRCExLJ
cent vs median mass of all RC in event
Double_t GetRhoVal(Int_t i=0) const
Bool_t Run()
Run function. This is the core function of the analysis and contains the user code. Therefore users have to implement this function.
AliEmcalList * fOutput
!output list
TH2F * fh2CentVsMassPerpConeTJ
cent vs mass of RC perpendicular to leading jet
TH2F * fh2MultVsMassRC
cent vs mass of RC perpendicular to tagged jets
Double_t fVertex[3]
!event vertex
TH2F * fh2MultVsMedianMassRC
cent vs meidan mass mass of all RC in event excluding area around leading jet
void SetMakeGeneralHistograms(Bool_t g)
AliEmcalJet * GetAcceptJet(Int_t i) const
TProfile ** fpPtVsMassPerpConeLJ
pT vs Avg mass of RC excluding area around leading jet
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
const char Option_t
Definition: External.C:48
void UserCreateOutputObjects()
Main initialization function on the worker.
bool Bool_t
Definition: External.C:53
TH2F ** fh2EtaVsMassPerpConeLJ
eta vs mass of RC excluding area around leading jet
TH2F * fh2MultVsMeanMassRCExLJ
cent vs median mass of all RC in event
Int_t GetNAcceptedParticles() const
Container structure for EMCAL clusters.
Bool_t RetrieveEventObjects()
Retrieve common objects from event.
AliVCluster * GetNextAcceptCluster()
TProfile ** fpPtVsMassRCExLJ
pT vs Avg mass of RC
AliParticleContainer * fTracksCont
Jets.
Bool_t FillHistograms()
Function filling histograms.
Container for jet within the EMCAL jet framework.
Definition: External.C:196
Double_t maxMult
TH2F ** fh2PtVsEPerpConeTJ
E vs mass of cone perpendicular to leading jet.
Bool_t reject