AliPhysics  32b88a8 (32b88a8)
 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  fhRjetTrvspTj(0x0),
74  fhNJetsSelEv(0x0),
75  fhJetEtaPhiOvl(0x0),
76  fhpTTracksJet1(0x0),
77  fhpTTracksJetO(0x0),
78  fhpTTracksCont(0x0),
79  fhptjetSMinusSingleTrack(0x0),
80  fhJetSubMatchEtaPhiPt(0x0),
81  fTreeEmb(0),
82  fFromTree(0),
83  fPathTreeinputFile(""),
84  fTreeinputName("fTreeJet"),
85  fBranchJDetName("fJetDet"),
86  fBranchJParName("fJetPar"),
87  fThisEntry(0),
88  fMaxTreeEntries(0),
89  fVecD(0x0),
90  fVecP(0x0)
91 {
92  // Default constructor.
93 
94  fh2MSubMatch = new TH2F*[fNcentBins];
95  fh2MSubPtRawAll = new TH2F*[fNcentBins];
96  fh3MSubPtRawDRMatch = new TH3F*[fNcentBins];
97  fh3MSubPtTrueLeadPt = new TH3F*[fNcentBins];
98  fh3MTruePtTrueLeadPt = new TH3F*[fNcentBins];
99  fh3PtTrueDeltaMLeadPt = new TH3F*[fNcentBins];
100  fh3PtTrueDeltaMRelLeadPt = new TH3F*[fNcentBins];
101  fhnMassResponse = new THnSparse*[fNcentBins];
102  //fhnDeltaMass = new THnSparse*[fNcentBins];
103 
104  for (Int_t i = 0; i < fNcentBins; i++) {
105  fh2MSubMatch[i] = 0;
106  fh2MSubPtRawAll[i] = 0;
107  fh3MSubPtRawDRMatch[i] = 0;
108  fh3MSubPtTrueLeadPt[i] = 0;
109  fh3MTruePtTrueLeadPt[i] = 0;
110  fh3PtTrueDeltaMLeadPt[i] = 0;
111  fh3PtTrueDeltaMRelLeadPt[i] = 0;
112  fhnMassResponse[i] = 0;
113  //fhnDeltaMass[i] = 0;
114  }
115 
116  SetMakeGeneralHistograms(kTRUE);
117  DefineOutput(2, TTree::Class());
118 }
119 
120 //________________________________________________________________________
122  AliAnalysisTaskEmcalJet(name, kTRUE),
123  fContainerBase(0),
124  fContainerSub(1),
125  fContainerNoEmb(2),
126  fContainerOverlap(3),
127  fMinFractionShared(0),
128  fSingleTrackEmb(kFALSE),
129  fCreateTree(kFALSE),
130  fJetMassVarType(kMass),
131  fResponseReference(kDet),
132  fUseSumw2(0),
133  fOverlap(0),
134  fRadius(0.4),
135  fTreeJetBkg(0),
136  fJet1Vec(),
137  fJet2Vec(),
138  fJetSubVec(),
139  fArea(0),
140  fAreaPhi(0),
141  fAreaEta(0),
142  fRho(0),
143  fRhoM(0),
144  fNConst(0),
145  fMatch(0),
146  fMinLabelEmb(-kMaxInt),
147  fMaxLabelEmb(kMaxInt),
148  fSmallSyst(0),
149  fh2MSubMatch(0x0),
150  fh2MSubPtRawAll(0x0),
151  fh3MSubPtRawDRMatch(0x0),
152  fh3MSubPtTrueLeadPt(0x0),
153  fh3MTruePtTrueLeadPt(0x0),
154  fh3PtTrueDeltaMLeadPt(0x0),
155  fh3PtTrueDeltaMRelLeadPt(0x0),
156  fhnMassResponse(0x0),
157  //fhnDeltaMass(0),
158  fhRjetTrvspTj(0x0),
159  fhNJetsSelEv(0x0),
160  fhJetEtaPhiOvl(0x0),
161  fhpTTracksJet1(0x0),
162  fhpTTracksJetO(0x0),
163  fhpTTracksCont(0x0),
164  fhptjetSMinusSingleTrack(0x0),
165  fhJetSubMatchEtaPhiPt(0x0),
166  fTreeEmb(0),
167  fFromTree(0),
168  fPathTreeinputFile(""),
169  fTreeinputName("fTreeJet"),
170  fBranchJDetName("fJetDet"),
171  fBranchJParName("fJetPar"),
172  fThisEntry(0),
173  fMaxTreeEntries(0),
174  fVecD(0x0),
175  fVecP(0x0)
176 {
177  // Standard constructor.
178 
179  fh2MSubMatch = new TH2F*[fNcentBins];
186  fhnMassResponse = new THnSparse*[fNcentBins];
187  //fhnDeltaMass = new THnSparse*[fNcentBins];
188 
189  for (Int_t i = 0; i < fNcentBins; i++) {
190  fh2MSubMatch[i] = 0;
191  fh2MSubPtRawAll[i] = 0;
192  fh3MSubPtRawDRMatch[i] = 0;
193  fh3MSubPtTrueLeadPt[i] = 0;
194  fh3MTruePtTrueLeadPt[i] = 0;
195  fh3PtTrueDeltaMLeadPt[i] = 0;
197  fhnMassResponse[i] = 0;
198  //fhnDeltaMass[i] = 0;
199  }
200 
202  DefineOutput(2, TTree::Class());
203 }
204 
205 //________________________________________________________________________
207 {
208  // Destructor.
209  delete fTreeEmb;
210  delete fVecD;
211  delete fVecP;
212 }
213 
214 //________________________________________________________________________
216 {
217  // Create user output.
218 
220 
221  // Create a tree.
222  // !! 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
223 
224  fJet2Vec = new TLorentzVector();
225 
226  if(fCreateTree) {
227  fJet1Vec = new TLorentzVector();
228  fJetSubVec = new TLorentzVector();
229  Printf("Creating tree");
230  fTreeJetBkg = new TTree(Form("%sTree", GetName()), Form("%sTree", GetName()));
231  fTreeJetBkg->Branch("fJet1Vec.",fJet1Vec);
232  fTreeJetBkg->Branch("fJet2Vec.",fJet2Vec);
233  fTreeJetBkg->Branch("fJetSubVec.",fJetSubVec);
234  fTreeJetBkg->Branch("fArea",&fArea,"fArea/F");
235  fTreeJetBkg->Branch("fAreaPhi",&fAreaPhi,"fAreaPhi/F");
236  fTreeJetBkg->Branch("fAreaEta",&fAreaEta,"fAreaEta/F");
237  fTreeJetBkg->Branch("fRho",&fRho,"fRho/F");
238  fTreeJetBkg->Branch("fRhoM",&fRhoM,"fRhoM/F");
239  fTreeJetBkg->Branch("fMatch",&fMatch,"fMatch/I");
240  fTreeJetBkg->Branch("fNConst",&fNConst, "fNConst/I");
241  }
242  if(fCreateTree) PostData(2, fTreeJetBkg);
243 
244  //Bool_t oldStatus = TH1::AddDirectoryStatus();
245  //TH1::AddDirectory(kFALSE);
246 
247  if(!fPathTreeinputFile.IsNull()){
249  if(!fTreeEmb) AliFatal("Something went wrong in setting the tree");
250 
251  fTreeEmb->SetBranchAddress(fBranchJDetName, &fVecD);
252  fTreeEmb->SetBranchAddress(fBranchJParName, &fVecP);
253 
254  fMaxTreeEntries = fTreeEmb->GetEntries();
255 
256  fTreeEmb->GetEntry(0);
257  fTreeEmb->Show();
258 
259 
260  }
261 
262  const Int_t nBinsPt = 200;
263  const Double_t minPt = -50.;
264  const Double_t maxPt = 150.;
265 
266  Int_t nBinsM = 100;
267  Double_t minM = -20.;
268  Double_t maxM = 80.;
269  if(fSmallSyst) maxM = 40.;
270  if(fJetMassVarType==kRatMPt) {
271  nBinsM = 100;
272  minM = -0.2;
273  maxM = 0.8;
274  }
275 
276  Int_t nBinsDM = 100;
277  Double_t minDM = -25.;
278  Double_t maxDM = 25.;
279  if(fJetMassVarType==kRatMPt) {
280  nBinsDM = 100;
281  minDM = -0.5;
282  maxDM = 0.5;
283  }
284  Int_t nBinsDpT = 100;
285  Double_t minDpT = -50.;
286  Double_t maxDpT = 50.;
287 
288  const Int_t nBinsDRToLJ = 20; //distance to leading jet in Pb-Pb only event
289  const Double_t minDRToLJ = 0.;
290  const Double_t maxDRToLJ = 1.;
291 
292  const Int_t nBinsPtLead = 20;
293  const Double_t minPtLead = 0.;
294  const Double_t maxPtLead = 20.;
295 
296  //These are good for pPb
297  Int_t nBinsRho = 50;
298  Double_t minRho = 0.;
299  Double_t maxRho = 20.;
300  Int_t nBinsRhom = 50;
301  Double_t minRhom = 0.;
302  Double_t maxRhom = 1.;
303 
304  //Binning for THnSparse
305  const Int_t nBinsSparse0 = 9;
306  //Mass sub;Mass true;#it{p}_{T,sub};#it{p}_{T,true};#it{p}_{T,lead trk}; #rho; #rho_{m}
307  const Int_t nBins0[nBinsSparse0] = {nBinsM,nBinsM,nBinsPt,nBinsPt,nBinsPtLead, nBinsRho, nBinsRhom, nBinsM, nBinsPt};
308  const Double_t xmin0[nBinsSparse0] = { minM, minM, minPt, minPt, minPtLead, minRho, minRhom, minM, minPt};
309  const Double_t xmax0[nBinsSparse0] = { maxM, maxM, maxPt, maxPt, maxPtLead, maxRho, maxRhom, maxM, maxPt};
310 
311  const Int_t nBinsSparse0b = 10;
312  //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}
313  const Int_t nBins0b[nBinsSparse0b] = {nBinsM, nBinsM, nBinsPt, nBinsPt, nBinsM, nBinsPt, nBinsRho, nBinsRhom, nBinsM, nBinsPt};
314  const Double_t xmin0b[nBinsSparse0b] = { minM, minM, minPt, minPt, minM, minPt, minRho, minRhom, minM, minPt};
315  const Double_t xmax0b[nBinsSparse0b] = { maxM, maxM, maxPt, maxPt, maxM, maxPt, maxRho, maxRhom, maxM, maxPt};
316 
317  const Int_t nBinsSparse1 = 7;
318  // #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}
319  const Int_t nBins1[nBinsSparse1] = {nBinsDM,nBinsDpT,nBinsM,nBinsM,nBinsPt,nBinsPt,nBinsPt};
320  const Double_t xmin1[nBinsSparse1] = { minDM, minDpT, minM, minM, minPt, minPt, minPt};
321  const Double_t xmax1[nBinsSparse1] = { maxDM, maxDpT, maxM, maxM, maxPt, maxPt, maxPt};
322 
323  const Int_t nBinsSparse2 = 10;
324  //#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}
325  const Int_t nBins2[nBinsSparse2] = {nBinsDM, nBinsDpT, nBinsDM, nBinsDpT, nBinsM, nBinsM, nBinsPt, nBinsPt, nBinsRho, nBinsRhom};
326  const Double_t xmin2[nBinsSparse2] = {minDM, minDpT, minDM, minDpT, minM, minM, minPt, minPt, minRho, minRhom};
327  const Double_t xmax2[nBinsSparse2] = {maxDM, maxDpT, maxDM, maxDpT, maxM, maxM, maxPt, maxPt, maxRho, maxRhom};
328 
329  TString histName = "";
330  TString histTitle = "";
331  TString varName = "#it{M}_{jet}";
332  if(fJetMassVarType==kRatMPt) varName = "#it{M}_{jet}/#it{p}_{T,jet}";
333 
334  for (Int_t i = 0; i < fNcentBins; i++) {
335  histName = Form("fh2MSubMatch_%d",i);
336  histTitle = Form("fh2MSubMatch_%d;%s;match",i,varName.Data());
337  fh2MSubMatch[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,2,-0.5,1.5);
338  fOutput->Add(fh2MSubMatch[i]);
339 
340  histName = Form("fh2MSubPtRawAll_%d",i);
341  histTitle = Form("fh2MSubPtRawAll_%d;%s;#it{p}_{T}",i,varName.Data());
342  fh2MSubPtRawAll[i] = new TH2F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsPt,minPt,maxPt);
343  fOutput->Add(fh2MSubPtRawAll[i]);
344 
345  histName = Form("fh3MSubPtRawDRMatch_%d",i);
346  histTitle = Form("fh3MSubPtRawDRMatch_%d;%s;#it{p}_{T}",i,varName.Data());
347  fh3MSubPtRawDRMatch[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsPt,minPt,maxPt,nBinsDRToLJ,minDRToLJ,maxDRToLJ);
348  fOutput->Add(fh3MSubPtRawDRMatch[i]);
349 
350  histName = Form("fh3MSubPtTrueLeadPt_%d",i);
351  histTitle = Form("fh3MSubPtTrueLeadPt_%d;%s;#it{p}_{T}",i,varName.Data());
352  fh3MSubPtTrueLeadPt[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsPt,minPt,maxPt,nBinsPtLead,minPtLead,maxPtLead);
353  fOutput->Add(fh3MSubPtTrueLeadPt[i]);
354 
355  histName = Form("fh3MTruePtTrueLeadPt_%d",i);
356  histTitle = Form("fh3MTruePtTrueLeadPt_%d;%s;#it{p}_{T}",i,varName.Data());
357  fh3MTruePtTrueLeadPt[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsM,minM,maxM,nBinsPt,minPt,maxPt,nBinsPtLead,minPtLead,maxPtLead);
358  fOutput->Add(fh3MTruePtTrueLeadPt[i]);
359 
360  histName = Form("fh3PtTrueDeltaMLeadPt_%d",i);
361  histTitle = Form("fh3PtTrueDeltaMLeadPt_%d;#it{p}_{T,true};#Delta %s",i,varName.Data());
362  fh3PtTrueDeltaMLeadPt[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,nBinsDM,minDM,maxDM,nBinsPtLead,minPtLead,maxPtLead);
363  fOutput->Add(fh3PtTrueDeltaMLeadPt[i]);
364 
365  histName = Form("fh3PtTrueDeltaMRelLeadPt_%d",i);
366  histTitle = Form("fh3PtTrueDeltaMRelLeadPt_%d;#it{p}_{T,true};Rel #Delta %s",i,varName.Data());
367  fh3PtTrueDeltaMRelLeadPt[i] = new TH3F(histName.Data(),histTitle.Data(),nBinsPt,minPt,maxPt,400,-1.,3.,nBinsPtLead,minPtLead,maxPtLead);
368  fOutput->Add(fh3PtTrueDeltaMRelLeadPt[i]);
369  if(!fCreateTree){
370  histName = Form("fhnMassResponse_%d",i);
371  if(fFromTree) {
372  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());
373  fhnMassResponse[i] = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse0b, nBins0b, xmin0b, xmax0b);
374 
375  } else{
376  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());
377  fhnMassResponse[i] = new THnSparseF(histName.Data(),histTitle.Data(), nBinsSparse0, nBins0, xmin0, xmax0);
378  }
379  fOutput->Add(fhnMassResponse[i]);
380 
381  //histName = Form("fhnDeltaMass_%d", i);
382  //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());
383  //Printf("Nuber of bins %d - write first %d, %f, %f , building %s", nBinsSparse1, nBins1[0], xmin1[0], xmax1[0], histName.Data());
384  //fhnDeltaMass[i] = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse1,nBins1,xmin1,xmax1);
385  //fOutput->Add(fhnDeltaMass[i]);
386  }
387  }
388 
389  //Chiara's histograms: rho and rhom correlation with pT and mass at reco level with no subtraction
390  if(!fCreateTree){
391  histName = "fhnDeltaMassAndBkgInfo";
392  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
393 
394  fhnDeltaMassAndBkgInfo = new THnSparseF(histName.Data(),histTitle.Data(),nBinsSparse2,nBins2,xmin2,xmax2);
395  fOutput->Add(fhnDeltaMassAndBkgInfo);
396  }
397  if(fOverlap){
398  fhRjetTrvspTj = new TH2F("fhRjetTrvspTj", ";R(jet, track);p_{T,jet}", 100, 0., 10., nBinsPt, minPt, maxPt);
399  fOutput->Add(fhRjetTrvspTj);
400  fhNJetsSelEv = new TH1F("fhNJetsSelEv", "N of jets selected; #it{N}_{jets}/ev;Entries", 20., 0.,19);
401  fOutput->Add(fhNJetsSelEv);
402 
403  fhJetEtaPhiOvl = new TH2F("fhJetEtaPhiOvl", "#eta - #varphi distribution of selected jets; #eta; #varphi", 24., -0.6, 0.6, 50, (-1)*TMath::Pi(), TMath::Pi());
404  fOutput->Add(fhJetEtaPhiOvl);
405 
406  fhpTTracksJetO = new TH1F("hTrackpTO", "Track pT (signal jet); p_{T}", 500,0.,50.);
407  fOutput->Add(fhpTTracksJetO);
408 
409  }
410 
411  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);
413 
414  fhpTTracksJet1 = new TH1F("hTrackpT1", "Track pT ; p_{T}", 500,0.,50.);
415  fOutput->Add(fhpTTracksJet1);
416  fhpTTracksCont = new TH1F(Form("fhpTTracksCont"), "Track pT (container) ; p_{T}", 500,0.,50.);
417  fOutput->Add(fhpTTracksCont);
418 
419 
420  if(fUseSumw2) {
421  // =========== Switch on Sumw2 for all histos ===========
422  for (Int_t i=0; i<fOutput->GetEntries(); ++i) {
423  TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i));
424  if (h1){
425  h1->Sumw2();
426  continue;
427  }
428  THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i));
429  if(hn)hn->Sumw2();
430  }
431  }
432 
433  //TH1::AddDirectory(oldStatus);
434 
435 
436  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
437 
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  AliParticleContainer *partContEmb = GetParticleContainer(); //the first particle container given is the one with embedded track(s)
452 
453  AliVParticle *vpe = 0x0; //embedded particle
454  for(Int_t ip = partContEmb->GetNParticles()-1; ip>-1; ip--){
455  AliVParticle *vp = partContEmb->GetParticle(ip);
456  if(!vp){
457  AliDebug(2, Form("Particle %d not found", ip));
458  continue;
459  }
460  Int_t lab = TMath::Abs(vp->GetLabel());
461  if (lab < fMinLabelEmb || lab > fMaxLabelEmb + fMaxTreeEntries)
462  continue;
463  if(!vpe) vpe = vp;
464  else if(vp->Pt()>vpe->Pt()) vpe =vp;
465  fThisEntry = lab - fMinLabelEmb;
466  //Printf("Label of embedded track %d - %d = %d", lab, fMinLabelEmb, fThisEntry);
467  }
468 
469  Double_t deltaR = 99;
470  if(vpe && jet) deltaR = jet->DeltaR(vpe);
471  if(deltaR < 0.2) return vpe;
472  else return 0x0;
473 }
474 
475 //__________________________________________________________________________________________________
476 
478  if(!fTreeEmb) return 0;
479 
480  Int_t entry = fTreeEmb->GetEntry(fThisEntry);
481  return entry;
482 
483 }
484 
485 
486 //________________________________________________________________________
488  if(!tree){
489  AliError("Null tree");
490  return;
491  }
492  fFromTree = kTRUE;
493  fTreeEmb = (TTree*)tree->Clone(Form("%sCpShC", tree->GetName()));
494  AliInfo(Form("Input tree set %d (%p -> %p)", fTreeEmb->GetNbranches(), tree, fTreeEmb));
495  //fTreeEmb->SetDirectory(0x0);
496 
497  return;
498 }
499 
500 //________________________________________________________________________
501 
503 
504  if(filename.Contains("alien")) {
505  TGrid::Connect("alien://");
506  }
507  TFile *f = TFile::Open(filename);
508  if(!f->IsOpen()){
509  Printf("File %s not found, cannot SetTree", filename.Data());
510  return;
511  }
512 
513  TTree *tree = dynamic_cast<TTree*>(f->Get(treename));
514  if(!tree){
515  Printf("Tree %s not found!!!", treename.Data());
516  f->ls();
517  return;
518  }
519  SetTree(tree);
520 
521  //f->Close();
522  //delete f;
523 
524  return;
525 }
526 
527 
528 //________________________________________________________________________
530  //
531  // retrieve event objects
532  //
533 
535  return kFALSE;
536 
538  jetCont->LoadRhoMass(InputEvent());
539 
540  return kTRUE;
541 }
542 
543 //_______________________________________________________________________
545 {
546  // Called once at the end of the analysis.
547 }
548 
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
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