AliPhysics  db95e02 (db95e02)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskJetShapeBase.cxx
Go to the documentation of this file.
1 #include <TClonesArray.h>
2 #include <TH1F.h>
3 #include <TH2F.h>
4 #include <TH3F.h>
5 #include <THnSparse.h>
6 #include <TF1.h>
7 #include <TList.h>
8 #include <TLorentzVector.h>
9 #include <TProfile.h>
10 #include <TChain.h>
11 #include <TSystem.h>
12 #include <TFile.h>
13 #include <TKey.h>
14 #include <TTree.h>
15 #include <TGrid.h>
16 
17 #include "AliVCluster.h"
18 #include "AliVTrack.h"
19 #include "AliEmcalJet.h"
20 #include "AliRhoParameter.h"
21 #include "AliLog.h"
22 #include "AliEmcalParticle.h"
23 #include "AliMCEvent.h"
24 #include "AliAODEvent.h"
25 #include "AliGenPythiaEventHeader.h"
26 #include "AliAODMCHeader.h"
27 #include "AliAnalysisManager.h"
28 #include "AliJetContainer.h"
29 #include "AliParticleContainer.h"
30 
32 
34 
35 //________________________________________________________________________
38  fContainerBase(0),
39  fContainerSub(1),
40  fContainerNoEmb(2),
41  fContainerOverlap(3),
42  fMinFractionShared(0),
43  fSingleTrackEmb(kFALSE),
44  fCreateTree(kFALSE),
45  fJetMassVarType(kMass),
46  fResponseReference(kDet),
47  fUseSumw2(0),
48  fOverlap(0),
49  fRadius(0.4),
50  fTreeJetBkg(0),
51  fJet1Vec(),
52  fJet2Vec(),
53  fJetSubVec(),
54  fArea(0),
55  fAreaPhi(0),
56  fAreaEta(0),
57  fRho(0),
58  fRhoM(0),
59  fNConst(0),
60  fMatch(0),
61  fMinLabelEmb(-kMaxInt),
62  fMaxLabelEmb(kMaxInt),
63  fSmallSyst(0),
64  fh2MSubMatch(0x0),
65  fh2MSubPtRawAll(0x0),
66  fh3MSubPtRawDRMatch(0x0),
67  fh3MSubPtTrueLeadPt(0x0),
68  fh3MTruePtTrueLeadPt(0x0),
69  fh3PtTrueDeltaMLeadPt(0x0),
70  fh3PtTrueDeltaMRelLeadPt(0x0),
71  fhnMassResponse(0x0),
72  //fhnDeltaMass(0),
73  fhnDeltaMassAndBkgInfo(0x0),
74  fhnResolution(0x0),
75  fhRjetTrvspTj(0x0),
76  fhNJetsSelEv(0x0),
77  fhJetEtaPhiOvl(0x0),
78  fhpTTracksJet1(0x0),
79  fhpTTracksJetO(0x0),
80  fhpTTracksCont(0x0),
81  fhptjetSMinusSingleTrack(0x0),
82  fhJetSubMatchEtaPhiPt(0x0),
83  fTreeEmb(0),
84  fFromTree(0),
85  fPathTreeinputFile(""),
86  fTreeinputName("fTreeJet"),
87  fBranchJDetName("fJetDet"),
88  fBranchJParName("fJetPar"),
89  fThisEntry(0),
90  fMaxTreeEntries(0),
91  fVecD(0x0),
92  fVecP(0x0)
93 {
94  // Default constructor.
95 
96  fh2MSubMatch = new TH2F*[fNcentBins];
97  fh2MSubPtRawAll = new TH2F*[fNcentBins];
98  fh3MSubPtRawDRMatch = new TH3F*[fNcentBins];
99  fh3MSubPtTrueLeadPt = new TH3F*[fNcentBins];
100  fh3MTruePtTrueLeadPt = new TH3F*[fNcentBins];
101  fh3PtTrueDeltaMLeadPt = new TH3F*[fNcentBins];
102  fh3PtTrueDeltaMRelLeadPt = new TH3F*[fNcentBins];
103  fhnMassResponse = new THnSparse*[fNcentBins];
104  //fhnDeltaMass = new THnSparse*[fNcentBins];
105 
106  for (Int_t i = 0; i < fNcentBins; i++) {
107  fh2MSubMatch[i] = 0;
108  fh2MSubPtRawAll[i] = 0;
109  fh3MSubPtRawDRMatch[i] = 0;
110  fh3MSubPtTrueLeadPt[i] = 0;
111  fh3MTruePtTrueLeadPt[i] = 0;
112  fh3PtTrueDeltaMLeadPt[i] = 0;
113  fh3PtTrueDeltaMRelLeadPt[i] = 0;
114  fhnMassResponse[i] = 0;
115  //fhnDeltaMass[i] = 0;
116  }
117 
118  SetMakeGeneralHistograms(kTRUE);
119  DefineOutput(2, TTree::Class());
120 }
121 
122 //________________________________________________________________________
124  AliAnalysisTaskEmcalJet(name, kTRUE),
125  fContainerBase(0),
126  fContainerSub(1),
127  fContainerNoEmb(2),
128  fContainerOverlap(3),
129  fMinFractionShared(0),
130  fSingleTrackEmb(kFALSE),
131  fCreateTree(kFALSE),
132  fJetMassVarType(kMass),
133  fResponseReference(kDet),
134  fUseSumw2(0),
135  fOverlap(0),
136  fRadius(0.4),
137  fTreeJetBkg(0),
138  fJet1Vec(),
139  fJet2Vec(),
140  fJetSubVec(),
141  fArea(0),
142  fAreaPhi(0),
143  fAreaEta(0),
144  fRho(0),
145  fRhoM(0),
146  fNConst(0),
147  fMatch(0),
148  fMinLabelEmb(-kMaxInt),
149  fMaxLabelEmb(kMaxInt),
150  fSmallSyst(0),
151  fh2MSubMatch(0x0),
152  fh2MSubPtRawAll(0x0),
153  fh3MSubPtRawDRMatch(0x0),
154  fh3MSubPtTrueLeadPt(0x0),
155  fh3MTruePtTrueLeadPt(0x0),
156  fh3PtTrueDeltaMLeadPt(0x0),
157  fh3PtTrueDeltaMRelLeadPt(0x0),
158  fhnMassResponse(0x0),
159  //fhnDeltaMass(0),
160  fhnDeltaMassAndBkgInfo(0x0),
161  fhnResolution(0x0),
162  fhRjetTrvspTj(0x0),
163  fhNJetsSelEv(0x0),
164  fhJetEtaPhiOvl(0x0),
165  fhpTTracksJet1(0x0),
166  fhpTTracksJetO(0x0),
167  fhpTTracksCont(0x0),
168  fhptjetSMinusSingleTrack(0x0),
169  fhJetSubMatchEtaPhiPt(0x0),
170  fTreeEmb(0),
171  fFromTree(0),
172  fPathTreeinputFile(""),
173  fTreeinputName("fTreeJet"),
174  fBranchJDetName("fJetDet"),
175  fBranchJParName("fJetPar"),
176  fThisEntry(0),
177  fMaxTreeEntries(0),
178  fVecD(0x0),
179  fVecP(0x0)
180 {
181  // Standard constructor.
182 
183  fh2MSubMatch = new TH2F*[fNcentBins];
190  fhnMassResponse = new THnSparse*[fNcentBins];
191  //fhnDeltaMass = new THnSparse*[fNcentBins];
192 
193  for (Int_t i = 0; i < fNcentBins; i++) {
194  fh2MSubMatch[i] = 0;
195  fh2MSubPtRawAll[i] = 0;
196  fh3MSubPtRawDRMatch[i] = 0;
197  fh3MSubPtTrueLeadPt[i] = 0;
198  fh3MTruePtTrueLeadPt[i] = 0;
199  fh3PtTrueDeltaMLeadPt[i] = 0;
201  fhnMassResponse[i] = 0;
202  //fhnDeltaMass[i] = 0;
203  }
204 
206  DefineOutput(2, TTree::Class());
207 }
208 
209 //________________________________________________________________________
211 {
212  // Destructor.
213  delete fTreeEmb;
214  delete fVecD;
215  delete fVecP;
216 }
217 
218 //________________________________________________________________________
220 {
221  // Create user output.
222 
224 
225  // Create a tree.
226  // !! Note !! Don't move the creation of the tree, it has to stay just after having opened the output file! Otherwise need to open it again or cd into it
227 
228  fJet2Vec = new TLorentzVector();
229 
230  if(fCreateTree) {
231  fJet1Vec = new TLorentzVector();
232  fJetSubVec = new TLorentzVector();
233  Printf("Creating tree");
234  fTreeJetBkg = new TTree(Form("%sTree", GetName()), Form("%sTree", GetName()));
235  fTreeJetBkg->Branch("fJet1Vec.",fJet1Vec);
236  fTreeJetBkg->Branch("fJet2Vec.",fJet2Vec);
237  fTreeJetBkg->Branch("fJetSubVec.",fJetSubVec);
238  fTreeJetBkg->Branch("fArea",&fArea,"fArea/F");
239  fTreeJetBkg->Branch("fAreaPhi",&fAreaPhi,"fAreaPhi/F");
240  fTreeJetBkg->Branch("fAreaEta",&fAreaEta,"fAreaEta/F");
241  fTreeJetBkg->Branch("fRho",&fRho,"fRho/F");
242  fTreeJetBkg->Branch("fRhoM",&fRhoM,"fRhoM/F");
243  fTreeJetBkg->Branch("fMatch",&fMatch,"fMatch/I");
244  fTreeJetBkg->Branch("fNConst",&fNConst, "fNConst/I");
245  }
246  if(fCreateTree) PostData(2, fTreeJetBkg);
247 
248  //Bool_t oldStatus = TH1::AddDirectoryStatus();
249  //TH1::AddDirectory(kFALSE);
250 
251  if(!fPathTreeinputFile.IsNull()){
253  if(!fTreeEmb) AliFatal("Something went wrong in setting the tree");
254 
255  fTreeEmb->SetBranchAddress(fBranchJDetName, &fVecD);
256  fTreeEmb->SetBranchAddress(fBranchJParName, &fVecP);
257 
258  fMaxTreeEntries = fTreeEmb->GetEntries();
259 
260  fTreeEmb->GetEntry(0);
261  fTreeEmb->Show();
262 
263 
264  }
265 
266  const Int_t nBinsPt = 200;
267  const Double_t minPt = -50.;
268  const Double_t maxPt = 150.;
269 
270  Int_t nBinsM = 100;
271  Double_t minM = -20.;
272  Double_t maxM = 80.;
273  if(fSmallSyst) maxM = 40.;
274  if(fJetMassVarType==kRatMPt) {
275  nBinsM = 100;
276  minM = -0.2;
277  maxM = 0.8;
278  }
279 
280  Int_t nBinsDM = 100;
281  Double_t minDM = -25.;
282  Double_t maxDM = 25.;
283  if(fJetMassVarType==kRatMPt) {
284  nBinsDM = 100;
285  minDM = -0.5;
286  maxDM = 0.5;
287  }
288  Int_t nBinsDpT = 100;
289  Double_t minDpT = -50.;
290  Double_t maxDpT = 50.;
291 
292  Int_t nBinsRpT = 160;
293  Double_t minRpT = -8.;
294  Double_t maxRpT = 8.;
295 
296  Int_t nBinsRM = 160;
297  Double_t minRM = -8.;
298  Double_t maxRM = 8.;
299  if(fSmallSyst) {
300  nBinsRM = 100;
301  minRM = -5.;
302  maxRM = 5.;
303 
304  }
305  const Int_t nBinsDRToLJ = 20; //distance to leading jet in Pb-Pb only event
306  const Double_t minDRToLJ = 0.;
307  const Double_t maxDRToLJ = 1.;
308 
309  const Int_t nBinsPtLead = 20;
310  const Double_t minPtLead = 0.;
311  const Double_t maxPtLead = 20.;
312 
313  //These are good for pPb
314  Int_t nBinsRho = 50;
315  Double_t minRho = 0.;
316  Double_t maxRho = 20.;
317  Int_t nBinsRhom = 50;
318  Double_t minRhom = 0.;
319  Double_t maxRhom = 1.;
320 
321  //Binning for THnSparse
322  const Int_t nBinsSparse0 = 9;
323  //Mass sub;Mass true;#it{p}_{T,sub};#it{p}_{T,true};#it{p}_{T,lead trk}; #rho; #rho_{m}
324  const Int_t nBins0[nBinsSparse0] = {nBinsM,nBinsM,nBinsPt,nBinsPt,nBinsPtLead, nBinsRho, nBinsRhom, nBinsM, nBinsPt};
325  const Double_t xmin0[nBinsSparse0] = { minM, minM, minPt, minPt, minPtLead, minRho, minRhom, minM, minPt};
326  const Double_t xmax0[nBinsSparse0] = { maxM, maxM, maxPt, maxPt, maxPtLead, maxRho, maxRhom, maxM, maxPt};
327 
328  const Int_t nBinsSparse0b = 10;
329  //Mass sub;Mass true;#it{p}_{T,sub};#it{p}_{T,true};#it{p}_{T,lead trk}; #rho; #rho_{m}; Mass unsub; #it{p}_{T,unsub}
330  const Int_t nBins0b[nBinsSparse0b] = {nBinsM, nBinsM, nBinsPt, nBinsPt, nBinsM, nBinsPt, nBinsRho, nBinsRhom, nBinsM, nBinsPt};
331  const Double_t xmin0b[nBinsSparse0b] = { minM, minM, minPt, minPt, minM, minPt, minRho, minRhom, minM, minPt};
332  const Double_t xmax0b[nBinsSparse0b] = { maxM, maxM, maxPt, maxPt, maxM, maxPt, maxRho, maxRhom, maxM, maxPt};
333 
334  const Int_t nBinsSparse1 = 7;
335  // #it{M}_{det,Const} - #it{M}_{part}; #it{p}_{T,det,Const} - #it{p}_{T,part}; #it{M}_{det,Const}; #it{M}_{part}; #it{p}_{T,det,Const}; #it{p}_{T,part}; #it{p}_{T,det,A}
336  const Int_t nBins1[nBinsSparse1] = {nBinsDM,nBinsDpT,nBinsM,nBinsM,nBinsPt,nBinsPt,nBinsPt};
337  const Double_t xmin1[nBinsSparse1] = { minDM, minDpT, minM, minM, minPt, minPt, minPt};
338  const Double_t xmax1[nBinsSparse1] = { maxDM, maxDpT, maxM, maxM, maxPt, maxPt, maxPt};
339 
340  const Int_t nBinsSparse2 = 10;
341  //#it{M}_{det} - #it{M}_{part}; #it{p}_{T,det} - #it{p}_{T,part}; #it{M}_{unsub} - #it{M}_{part}; #it{p}_{T,unsub} - #it{p}_{T,part}; #it{M}_{det}; #it{M}_{unsub}; #it{p}_{T,det}; #it{p}_{T,unsub}; #rho ; #rho_{m}
342  const Int_t nBins2[nBinsSparse2] = {nBinsDM, nBinsDpT, nBinsDM, nBinsDpT, nBinsM, nBinsM, nBinsPt, nBinsPt, nBinsRho, nBinsRhom};
343  const Double_t xmin2[nBinsSparse2] = {minDM, minDpT, minDM, minDpT, minM, minM, minPt, minPt, minRho, minRhom};
344  const Double_t xmax2[nBinsSparse2] = {maxDM, maxDpT, maxDM, maxDpT, maxM, maxM, maxPt, maxPt, maxRho, maxRhom};
345 
346  const Int_t nBinsSparse3 = 6;
347  const Int_t nBins3[nBinsSparse3] = {nBinsRM, nBinsRpT, nBinsM, nBinsPt, nBinsRho, nBinsRhom};
348  const Double_t xmin3[nBinsSparse3] = {minRM, minRpT, minM, minPt, minRho, minRhom};
349  const Double_t xmax3[nBinsSparse3] = {maxRM, maxRpT, maxM, maxPt, maxRho, maxRhom};
350 
351 
352  TString histName = "";
353  TString histTitle = "";
354  TString varName = "#it{M}_{jet}";
355  if(fJetMassVarType==kRatMPt) varName = "#it{M}_{jet}/#it{p}_{T,jet}";
356 
357  for (Int_t i = 0; i < fNcentBins; i++) {
358  histName = Form("fh2MSubMatch_%d",i);
359  histTitle = Form("fh2MSubMatch_%d;%s;match",i,varName.Data());
360  fh2MSubMatch[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,2,-0.5,1.5);
361  fOutput->Add(fh2MSubMatch[i]);
362 
363  histName = Form("fh2MSubPtRawAll_%d",i);
364  histTitle = Form("fh2MSubPtRawAll_%d;%s;#it{p}_{T}",i,varName.Data());
365  fh2MSubPtRawAll[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsPt,minPt,maxPt);
366  fOutput->Add(fh2MSubPtRawAll[i]);
367 
368  histName = Form("fh3MSubPtRawDRMatch_%d",i);
369  histTitle = Form("fh3MSubPtRawDRMatch_%d;%s;#it{p}_{T}",i,varName.Data());
370  fh3MSubPtRawDRMatch[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsPt,minPt,maxPt,nBinsDRToLJ,minDRToLJ,maxDRToLJ);
371  fOutput->Add(fh3MSubPtRawDRMatch[i]);
372 
373  histName = Form("fh3MSubPtTrueLeadPt_%d",i);
374  histTitle = Form("fh3MSubPtTrueLeadPt_%d;%s;#it{p}_{T}",i,varName.Data());
375  fh3MSubPtTrueLeadPt[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsPt,minPt,maxPt,nBinsPtLead,minPtLead,maxPtLead);
376  fOutput->Add(fh3MSubPtTrueLeadPt[i]);
377 
378  histName = Form("fh3MTruePtTrueLeadPt_%d",i);
379  histTitle = Form("fh3MTruePtTrueLeadPt_%d;%s;#it{p}_{T}",i,varName.Data());
380  fh3MTruePtTrueLeadPt[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsPt,minPt,maxPt,nBinsPtLead,minPtLead,maxPtLead);
381  fOutput->Add(fh3MTruePtTrueLeadPt[i]);
382 
383  histName = Form("fh3PtTrueDeltaMLeadPt_%d",i);
384  histTitle = Form("fh3PtTrueDeltaMLeadPt_%d;#it{p}_{T,true};#Delta %s",i,varName.Data());
385  fh3PtTrueDeltaMLeadPt[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsDM,minDM,maxDM,nBinsPtLead,minPtLead,maxPtLead);
386  fOutput->Add(fh3PtTrueDeltaMLeadPt[i]);
387 
388  histName = Form("fh3PtTrueDeltaMRelLeadPt_%d",i);
389  histTitle = Form("fh3PtTrueDeltaMRelLeadPt_%d;#it{p}_{T,true};Rel #Delta %s",i,varName.Data());
390  fh3PtTrueDeltaMRelLeadPt[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,400,-1.,3.,nBinsPtLead,minPtLead,maxPtLead);
391  fOutput->Add(fh3PtTrueDeltaMRelLeadPt[i]);
392  if(!fCreateTree){
393  histName = Form("fhnMassResponse_%d",i);
394  if(fFromTree) {
395  histTitle = Form("fhnMassResponse_%d; %s sub; %s true;#it{p}_{T,sub};#it{p}_{T,true};%s (emb, det); #it{p}_{T,emb det}; #rho; #rho_{m}; %s unsub; #it{p}_{T,unsub}", i, varName.Data(),varName.Data(), varName.Data(),varName.Data());
396  fhnMassResponse[i] = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse0b, nBins0b, xmin0b, xmax0b);
397 
398  } else{
399  histTitle = Form("fhnMassResponse_%d;%s sub;%s true;#it{p}_{T,sub};#it{p}_{T,true};#it{p}_{T,lead trk}; #rho; #rho_{m}",i,varName.Data(),varName.Data());
400  fhnMassResponse[i] = new THnSparseF(histName.Data(),histTitle.Data(), nBinsSparse0, nBins0, xmin0, xmax0);
401  }
402  fOutput->Add(fhnMassResponse[i]);
403 
404  //histName = Form("fhnDeltaMass_%d", i);
405  //histTitle = Form("%s; #it{M}_{det,Const} - #it{M}_{part}; #it{p}_{T,det,Const} - #it{p}_{T,part}; #it{M}_{det,Const}; #it{M}_{part}; #it{p}_{T,det,Const}; #it{p}_{T,part}; #it{p}_{T,det,A}",histName.Data());
406  //Printf("Nuber of bins %d - write first %d, %f, %f , building %s", nBinsSparse1, nBins1[0], xmin1[0], xmax1[0], histName.Data());
407  //fhnDeltaMass[i] = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse1,nBins1,xmin1,xmax1);
408  //fOutput->Add(fhnDeltaMass[i]);
409  }
410  }
411 
412  //Chiara's histograms: rho and rhom correlation with pT and mass at reco level with no subtraction
413  if(!fCreateTree){
414  histName = "fhnDeltaMassAndBkgInfo";
415  histTitle = Form("%s; #it{M}_{det} - #it{M}_{part}; #it{p}_{T,det} - #it{p}_{T,part}; #it{M}_{unsub} - #it{M}_{part}; #it{p}_{T,unsub} - #it{p}_{T,part}; #it{M}_{det}; #it{M}_{unsub}; #it{p}_{T,det}; #it{p}_{T,unsub}; #rho ; #rho_{m}",histName.Data()); // #it{M}_{unsub} is also deltaM unsub when M_part is zero
416 
417  fhnDeltaMassAndBkgInfo = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse2,nBins2,xmin2,xmax2);
418  fOutput->Add(fhnDeltaMassAndBkgInfo);
419 
420  histName = "fhnResolution";
421  histTitle = Form("%s; (#it{M}_{det} - #it{M}_{part})/#it{M}_{part}; (#it{p}_{T,det} - #it{p}_{T,part})/#it{p}_{T,part}; #it{M}_{part}; #it{p}_{T,part}; #rho ; #rho_{m}",histName.Data()); // #it{M}_{unsub} is also deltaM unsub when M_part is zero
422 
423  fhnResolution = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse3,nBins3,xmin3,xmax3);
424  fOutput->Add(fhnResolution);
425 
426  }
427  if(fOverlap){
428  fhRjetTrvspTj = new TH2F("fhRjetTrvspTj", ";R(jet, track);p_{T,jet}", 100, 0., 10., nBinsPt, minPt, maxPt);
429  fOutput->Add(fhRjetTrvspTj);
430  fhNJetsSelEv = new TH1F("fhNJetsSelEv", "N of jets selected; #it{N}_{jets}/ev;Entries", 20., 0.,19);
431  fOutput->Add(fhNJetsSelEv);
432 
433  fhJetEtaPhiOvl = new TH2F("fhJetEtaPhiOvl", "#eta - #varphi distribution of selected jets; #eta; #varphi", 24., -0.6, 0.6, 50, (-1)*TMath::Pi(), TMath::Pi());
434  fOutput->Add(fhJetEtaPhiOvl);
435 
436  fhpTTracksJetO = new TH1F("hTrackpTO", "Track pT (signal jet); p_{T}", 500,0.,50.);
437  fOutput->Add(fhpTTracksJetO);
438 
439  }
440 
441  fhJetSubMatchEtaPhiPt = new TH3F("fhJetSubMatchEtaPhiPt", "Bkg-subtracted matched jet;#eta ; #phi; #it{p}_{T} (GeV/#it{c})", 24., -0.6, 0.6, 50, (-1)*TMath::Pi(), TMath::Pi(), nBinsPt, minPt, maxPt);
443 
444  fhpTTracksJet1 = new TH1F("hTrackpT1", "Track pT ; p_{T}", 500,0.,50.);
445  fOutput->Add(fhpTTracksJet1);
446  fhpTTracksCont = new TH1F(Form("fhpTTracksCont"), "Track pT (container) ; p_{T}", 500,0.,50.);
447  fOutput->Add(fhpTTracksCont);
448 
449 
450  if(fUseSumw2) {
451  // =========== Switch on Sumw2 for all histos ===========
452  for (Int_t i=0; i<fOutput->GetEntries(); ++i) {
453  TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i));
454  if (h1){
455  h1->Sumw2();
456  continue;
457  }
458  THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i));
459  if(hn)hn->Sumw2();
460  }
461  }
462 
463  //TH1::AddDirectory(oldStatus);
464 
465 
466  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
467 
468 }
469 
470 //________________________________________________________________________
472 {
473  // Run analysis code here, if needed. It will be executed before FillHistograms().
474 
475  return kTRUE;
476 }
477 
478 //________________________________________________________________________
480 
481  AliParticleContainer *partContEmb = GetParticleContainer(); //the first particle container given is the one with embedded track(s)
482 
483  AliVParticle *vpe = 0x0; //embedded particle
484  for(Int_t ip = partContEmb->GetNParticles()-1; ip>-1; ip--){
485  AliVParticle *vp = partContEmb->GetParticle(ip);
486  if(!vp){
487  AliDebug(2, Form("Particle %d not found", ip));
488  continue;
489  }
490  Int_t lab = TMath::Abs(vp->GetLabel());
491  if (lab < fMinLabelEmb || lab > fMaxLabelEmb + fMaxTreeEntries)
492  continue;
493  if(!vpe) vpe = vp;
494  else if(vp->Pt()>vpe->Pt()) vpe =vp;
495  fThisEntry = lab - fMinLabelEmb;
496  //Printf("Label of embedded track %d - %d = %d", lab, fMinLabelEmb, fThisEntry);
497  }
498 
499  Double_t deltaR = 99;
500  if(vpe && jet) deltaR = jet->DeltaR(vpe);
501  if(deltaR < 0.2) return vpe;
502  else return 0x0;
503 }
504 
505 //__________________________________________________________________________________________________
506 
508  if(!fTreeEmb) return 0;
509 
510  Int_t entry = fTreeEmb->GetEntry(fThisEntry);
511  return entry;
512 
513 }
514 
515 
516 //________________________________________________________________________
518  if(!tree){
519  AliError("Null tree");
520  return;
521  }
522  fFromTree = kTRUE;
523  fTreeEmb = (TTree*)tree->Clone(Form("%sCpShC", tree->GetName()));
524  AliInfo(Form("Input tree set %d (%p -> %p)", fTreeEmb->GetNbranches(), tree, fTreeEmb));
525  //fTreeEmb->SetDirectory(0x0);
526 
527  return;
528 }
529 
530 //________________________________________________________________________
531 
533 
534  if(filename.Contains("alien")) {
535  TGrid::Connect("alien://");
536  }
537  TFile *f = TFile::Open(filename);
538  if(!f->IsOpen()){
539  Printf("File %s not found, cannot SetTree", filename.Data());
540  return;
541  }
542 
543  TTree *tree = dynamic_cast<TTree*>(f->Get(treename));
544  if(!tree){
545  Printf("Tree %s not found!!!", treename.Data());
546  f->ls();
547  return;
548  }
549  SetTree(tree);
550 
551  //f->Close();
552  //delete f;
553 
554  return;
555 }
556 
557 
558 //________________________________________________________________________
560  //
561  // retrieve event objects
562  //
563 
565  return kFALSE;
566 
568  jetCont->LoadRhoMass(InputEvent());
569 
570  return kTRUE;
571 }
572 
573 //_______________________________________________________________________
575 {
576  // Called once at the end of the analysis.
577 }
578 
TString fBranchJDetName
name of the detector level jet branch in the TTree
TTree * fTreeEmb
! tree with the TLorentzVector of the jet detector and particle level
TH3F ** fh3PtTrueDeltaMLeadPt
! true jet pT vs (Msub - Mtrue) vs LeadPt for matched jets
const char * filename
Definition: TestFCM.C:1
double Double_t
Definition: External.C:58
Definition: External.C:260
Definition: External.C:236
AliJetContainer * GetJetContainer(Int_t i=0) const
Bool_t fSmallSyst
flag for the axes ranges in pPb
Bool_t fUseSumw2
activate sumw2 for output histograms
Int_t GetNParticles() const
THnSparse * fhnDeltaMassAndBkgInfo
! DeltaM, DeltapT bkg-unsubtracted M and pT, rho and rhom
Int_t fThisEntry
current entry in the embedded TTree
void LoadRhoMass(const AliVEvent *event)
TH3F * fhJetSubMatchEtaPhiPt
! eta, phi, pt distribution of jet subtracted and matched
Container for particles within the EMCAL framework.
TH3F ** fh3MSubPtTrueLeadPt
! subtracted jet mass vs true jet pT vs LeadPt for matched jets for matched jets
TH2F * fhJetEtaPhiOvl
! eta-phi distribution of the selected signal jets
AliParticleContainer * GetParticleContainer(Int_t i=0) const
TLorentzVector * fVecD
! vector with detector level jet
Int_t fMaxLabelEmb
max label of embedded particles
int Int_t
Definition: External.C:63
void SetTreeFromFile(TString filenameM, TString treename)
TLorentzVector * fJet1Vec
jet1(AA) vector
virtual AliVParticle * GetParticle(Int_t i=-1) const
Int_t fNcentBins
how many centrality bins
TString fBranchJParName
name of the detector level jet branch in the TTree
TH3F ** fh3MSubPtRawDRMatch
! subtracted jet mass vs subtracted jet pT vs distance to leading Pb-Pb jet
Double_t DeltaR(const AliVParticle *part) const
THnSparse ** fhnMassResponse
! Msub vs Mtrue vs PtCorr vs PtTrue vs DR
ClassImp(AliAnalysisTaskJetShapeBase) AliAnalysisTaskJetShapeBase
TH1F * fhNJetsSelEv
! number of selected signal jets per event
Bool_t fOverlap
activate the check on overlap between single particle embedded and jetO (jet with a pT of at least 5 ...
TH3F ** fh3MTruePtTrueLeadPt
! true jet mass vs true jet pT vs LeadPt for matched jets for matched jets
JetMassVarType fJetMassVarType
observable to use
TH2F ** fh2MSubMatch
! subtracted jet mass vs match index (0: no match; 1:match)
AliEmcalList * fOutput
!output list
THnSparse * fhnResolution
! Contains mass and pT resolution
Int_t fMatch
1: matched to MC jet; 0: no match
TTree * fTreeJetBkg
! tree with jet and bkg variables
TH2F ** fh2MSubPtRawAll
! subtracted jet mass vs subtracted jet pT
Int_t fMaxTreeEntries
number of entries in the TTree
Int_t fMinLabelEmb
min label of embedded particles
void SetMakeGeneralHistograms(Bool_t g)
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:44
AliVParticle * GetEmbeddedConstituent(AliEmcalJet *jet)
Int_t fNConst
N constituents in jet1.
TH2F * fhRjetTrvspTj
! distance in R between each jetO and embedded single track (those below fRadius are rejected) ...
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
TString fPathTreeinputFile
path to the file where the external input Tree is (can be from alien)
Bool_t fFromTree
Input embedding from tree.
TLorentzVector * fJetSubVec
subtracted AA jet vector
TLorentzVector * fJet2Vec
jet2(probe) vector
TLorentzVector * fVecP
! vector with particle level jet
Bool_t fCreateTree
create output tree
TString fTreeinputName
name of the external input Tree
Background fluctuation studies: dMdpT spectrum for PYTHIA and single track embedding.
Container for jet within the EMCAL jet framework.
Int_t fContainerBase
jets to be analyzed
Definition: External.C:196
TH3F ** fh3PtTrueDeltaMRelLeadPt
! true jet pT vs (Msub - Mtrue)/Mtrue vs LeadPt for matched jets