AliPhysics  09a22ae (09a22ae)
AliAnalysisTaskEmcalJetCorrection.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2019, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: R. Haake. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 #include <iostream>
17 #include <cstdlib>
18 #include <algorithm>
19 #include <vector>
20 #include <TClonesArray.h>
21 #include <TH1F.h>
22 #include <TH2F.h>
23 #include <TH3F.h>
24 #include <TGrid.h>
25 #include <TFile.h>
26 #include <TSystem.h>
27 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
28  #include <TPython.h>
29 #endif
30 
31 #include "AliAnalysisManager.h"
32 #include "AliRhoParameter.h"
35 
36 
40 
41 
42 //________________________________________________________________________
45  #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
46  fPythonCLI(),
47  #endif
48  fJetsCont(),
49  fTracksCont(),
50  fJetOutputArray(),
51  fCustomPackages(),
52  fBackgroundModelFileName(""),
53  fBackgroundModelInputParameters(""),
54  fCorrectAlsoMass(kFALSE),
55  fModelName("Model")
56 {
57  // nothing to do
58 }
59 
60 //________________________________________________________________________
62  AliAnalysisTaskEmcalJet(name, kTRUE),
63  #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
64  fPythonCLI(),
65  #endif
66  fJetsCont(),
67  fTracksCont(),
68  fJetOutputArray(),
69  fCustomPackages("sklearn,numpy"),
70  fBackgroundModelFileName(""),
71  fBackgroundModelInputParameters(""),
72  fCorrectAlsoMass(kFALSE),
73  fModelName("Model")
74  {
75  // nothing to do
76 }
77 
78 //________________________________________________________________________
80 {
81  // Destructor.
82 }
83 
84 //________________________________________________________________________
86 {
88 
90  if(!fJetsCont)
91  AliFatal("Jet input container not found!");
93  if(!fTracksCont)
94  AliFatal("Particle input container not found attached to jets!");
95 
96  AddHistogram2D<TH2D>("hJetPtCorrelation", "Jet p_{T} (model vs. area-based)", "COLZ", 400, -100., 300., 400, -100., 300., "p_{T, ML} (GeV/c)", "p_{T} (GeV/c)", "dN2^{Jets}/d2p_{T}");
97  AddHistogram2D<TH2D>("hJetMassCorrelation", "Jet mass (model vs. corrected)", "COLZ", 400, -100., 300., 400, -100., 300., "m_{ML} (GeV/c2)", "m (GeV/c2)", "dN2^{Jets}/d2m");
98 
99  PostData(1, fOutput);
100 
101 }
102 
103 
104 //________________________________________________________________________
106 {
108 
109  // ### Need to explicitly tell jet container to load rho mass object
110  fJetsCont->LoadRhoMass(InputEvent());
111 
112  #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
113  fPythonCLI = new TPython();
114  // ### Install custom packages locally on worker node
115  if(!fCustomPackages.IsNull())
116  {
117  std::ofstream outFile;
118  outFile.open("./myScript.sh");
119  outFile << "#!/bin/bash" << std::endl;
120  outFile << "export PYTHONUSERBASE=./my-local-python" << std::endl;
121  outFile << "export PATH=\"$PYTHONUSERBASE/bin:$PATH\"" << std::endl;
122  TObjArray* packages = fCustomPackages.Tokenize(",");
123  for(Int_t iPackage = 0; iPackage < packages->GetEntries(); iPackage++)
124  {
125  TString package = ((TObjString *)(packages->At(iPackage)))->String();
126  outFile << "pip install --user " << package.Data() << std::endl;
127  }
128  outFile.close();
129  gSystem->Exec("bash ./myScript.sh");
130 
131  packages->SetOwner();
132  delete packages;
133  }
134 
135  // ### Get background model from alien and load it
136  TGrid::Connect("alien://");
137  if (gSystem->AccessPathName(fBackgroundModelFileName.Data()))
138  AliFatal(Form("Background model %s does not exist!", fBackgroundModelFileName.Data()));
139  TFile::Cp(fBackgroundModelFileName.Data(), "./Model.pkl");
140 
141  fPythonCLI->Exec("import sys");
142  fPythonCLI->Exec("sys.path.insert(0, './my-local-python/lib/python2.7/site-packages/')");
143  fPythonCLI->Exec("import sklearn, numpy");
144  fPythonCLI->Exec("estimator = sklearn.externals.joblib.load(\"./Model.pkl\")");
145  #endif
146 
147  // ### Prepare jet output array
148  if (!(InputEvent()->FindListObject(Form("%s_RhoMVA_%s", fJetsCont->GetArrayName().Data(), fModelName.Data())))) {
149  fJetOutputArray = new TClonesArray("AliEmcalJet");
150  fJetOutputArray->SetName(Form("%s_RhoMVA_%s", fJetsCont->GetArrayName().Data(), fModelName.Data()));
151  InputEvent()->AddObject(fJetOutputArray);
152  }
153  else {
154  AliFatal(Form("Jet output array with name %s_RhoMVA_%s already in event!", fJetsCont->GetArrayName().Data(), fModelName.Data()));
155  }
156 
157 }
158 
159 //________________________________________________________________________
161 {
162  AliRhoParameter* rhoMass = static_cast<AliRhoParameter*>(InputEvent()->FindListObject(fJetsCont->GetRhoMassName().Data()));
163 
164  // ################################### MAIN JET LOOP
165  fJetsCont->ResetCurrentID();
166  Int_t jetCount = 0;
167  while(AliEmcalJet *jet = fJetsCont->GetNextAcceptJet())
168  {
169  Float_t pt_ML = 0;
170  Float_t mass_ML = 0;
171  GetPtAndMassFromModel(jet, pt_ML, mass_ML);
172  AliEmcalJet *outJet = new ((*fJetOutputArray)[jetCount]) AliEmcalJet(*jet);
173  outJet->SetPtEtaPhi(pt_ML, jet->Eta(), jet->Phi());
174  if(fCorrectAlsoMass)
175  outJet->SetMass(mass_ML);
176  FillHistogram("hJetPtCorrelation", pt_ML, jet->Pt()-jet->Area()*fJetsCont->GetRhoVal());
177  FillHistogram("hJetMassCorrelation", mass_ML, (rhoMass) ? jet->GetShapeProperties()->GetSecondOrderSubtracted() : jet->M());
178  jetCount++;
179  }
180 
181  return kTRUE;
182 }
183 
184 //________________________________________________________________________
186 {
187  #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
188  TString arrayStr = GetBackgroundModelArrayString(jet);
189  // ####### Run Python script that does inference on jet
190  fPythonCLI->Exec(Form("data_inference = numpy.array([[%s]])", arrayStr.Data()));
191  fPythonCLI->Exec("result = estimator.predict(data_inference)");
192  if(fCorrectAlsoMass)
193  {
194  pt_ML = fPythonCLI->Eval("result[0][0]");
195  mass_ML = fPythonCLI->Eval("result[0][1]");
196  }
197  else
198  {
199  pt_ML = fPythonCLI->Eval("result[0]");
200  mass_ML = 0.0;
201  }
202  #endif
203 }
204 
205 //________________________________________________________________________
207 {
208  // ####### Calculate inference input parameters
209  std::vector<Int_t> index_sorted_list = jet->GetPtSortedTrackConstituentIndexes(fJetsCont->GetParticleContainer()->GetArray());
210  Int_t numConst = index_sorted_list.size();
211  Double_t* constPts = new Double_t[TMath::Max(Int_t(index_sorted_list.size()), 100)];
212  for(Int_t i = 0; i < TMath::Max(Int_t(index_sorted_list.size()), 100); i++)
213  constPts[i] = 0;
214  for(Int_t i = 0; i < numConst; i++)
215  {
216  AliVParticle* particle = static_cast<AliVParticle*>(jet->TrackAt(index_sorted_list.at(i), fJetsCont->GetParticleContainer()->GetArray()));
217  constPts[i] = particle->Pt();
218  }
219 
220  // Calculate jet shapes that could be demanded
221  Double_t leSub_noCorr = 0;
222  Double_t radialMoment = 0;
223  Double_t momentumDispersion = 0;
224  Double_t constPtMean = 0;
225  Double_t constPtMedian = 0;
226  CalculateJetShapes(jet, leSub_noCorr, radialMoment, momentumDispersion, constPtMean, constPtMedian);
227 
228  TString resultStr = "";
229  TObjArray* data_tokens = fBackgroundModelInputParameters.Tokenize(",");
230  for(Int_t iToken = 0; iToken < data_tokens->GetEntries(); iToken++)
231  {
232  TString token = ((TObjString *)(data_tokens->At(iToken)))->String();
233  if(token == "Jet_Pt")
234  resultStr += Form("%E", jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
235  else if(token == "Jet_NumConstituents")
236  resultStr += Form("%E", (Double_t)numConst);
237  else if(token == "Jet_Shape_Mass_NoCorr")
238  resultStr += Form("%E", jet->M());
239  else if(token == "Jet_Shape_Mass_DerivCorr_1")
240  resultStr += Form("%E", jet->GetShapeProperties()->GetFirstOrderSubtracted());
241  else if(token == "Jet_Shape_Mass_DerivCorr_2")
242  resultStr += Form("%E", jet->GetShapeProperties()->GetSecondOrderSubtracted());
243  else if(token == "Jet_Shape_pTD_DerivCorr_1")
244  resultStr += Form("%E", jet->GetShapeProperties()->GetFirstOrderSubtractedpTD());
245  else if(token == "Jet_Shape_pTD_DerivCorr_2")
246  resultStr += Form("%E", jet->GetShapeProperties()->GetSecondOrderSubtractedpTD());
247  else if(token == "Jet_Shape_LeSub_NoCorr")
248  resultStr += Form("%E", leSub_noCorr);
249  else if(token == "Jet_Shape_LeSub_DerivCorr")
250  resultStr += Form("%E", jet->GetShapeProperties()->GetSecondOrderSubtractedLeSub());
251  else if(token == "Jet_Shape_Sigma2_DerivCorr_1")
252  resultStr += Form("%E", jet->GetShapeProperties()->GetFirstOrderSubtractedSigma2());
253  else if(token == "Jet_Shape_Sigma2_DerivCorr_2")
254  resultStr += Form("%E", jet->GetShapeProperties()->GetSecondOrderSubtractedSigma2());
255  else if(token == "Jet_Shape_Angularity_DerivCorr_1")
256  resultStr += Form("%E", jet->GetShapeProperties()->GetFirstOrderSubtractedAngularity());
257  else if(token == "Jet_Shape_Angularity_DerivCorr_2")
258  resultStr += Form("%E", jet->GetShapeProperties()->GetSecondOrderSubtractedAngularity());
259  else if(token == "Jet_Shape_Circularity_DerivCorr_1")
260  resultStr += Form("%E", jet->GetShapeProperties()->GetFirstOrderSubtractedCircularity());
261  else if(token == "Jet_Shape_Circularity_DerivCorr_2")
262  resultStr += Form("%E", jet->GetShapeProperties()->GetSecondOrderSubtractedCircularity());
263  else if(token == "Jet_Shape_NumConst_DerivCorr")
264  resultStr += Form("%E", jet->GetShapeProperties()->GetSecondOrderSubtractedConstituent());
265  else if(token == "Jet_Shape_RadialMoment")
266  resultStr += Form("%E", radialMoment);
267  else if(token == "Jet_Shape_RadialMoment_Shrinked")
268  {
269  if (radialMoment < 0)
270  resultStr += Form("%E", 0.0);
271  else if (radialMoment > 1)
272  resultStr += Form("%E", 1.0);
273  else
274  resultStr += Form("%E", radialMoment);
275  }
276  else if(token == "Jet_Shape_MomentumDispersion")
277  resultStr += Form("%E", momentumDispersion);
278  else if(token == "Jet_Shape_ConstPtMean")
279  resultStr += Form("%E", constPtMean);
280  else if(token == "Jet_Shape_ConstPtMedian")
281  resultStr += Form("%E", constPtMedian);
282  else if(token == "Event_BackgroundDensity")
283  resultStr += Form("%E", fJetsCont->GetRhoVal());
284  else if(token == "Event_BackgroundDensityMass")
285  resultStr += Form("%E", fJetsCont->GetRhoMassVal());
286  else if(token == "Jet_Area")
287  resultStr += Form("%E", jet->Area());
288  else if(token.BeginsWith("Jet_Shape_ConstPt"))
289  {
290  TString num = token(17,(token.Length()-17));
291  resultStr += Form("%E", constPts[num.Atoi()]);
292  }
293 
294  // Add comma after numbers
295  if((iToken < data_tokens->GetEntries()-1))
296  resultStr += ", ";
297  }
298 
299  data_tokens->SetOwner();
300  delete data_tokens;
301  delete[] constPts;
302  return resultStr;
303 }
304 
305 //________________________________________________________________________
306 void AliAnalysisTaskEmcalJetCorrection::CalculateJetShapes(AliEmcalJet* jet, Double_t& leSub_noCorr, Double_t& radialMoment, Double_t& momentumDispersion, Double_t& constPtMean, Double_t& constPtMedian)
307 {
308  // #### Calculate mean, median of constituents, radial moment, momentum dispersion, leSub (no correction)
309  Double_t jetCorrectedPt = jet->Pt() - jet->Area() * fJetsCont->GetRhoVal();
310  Double_t jetLeadingHadronPt = -999.;
311  Double_t jetSubleadingHadronPt = -999.;
312  Double_t jetSum = 0;
313  Double_t jetSum2 = 0;
314  constPtMean = 0;
315  constPtMedian = 0;
316  radialMoment = 0;
317  momentumDispersion = 0;
318  std::vector<Int_t> index_sorted_list = jet->GetPtSortedTrackConstituentIndexes(fJetsCont->GetParticleContainer()->GetArray());
319  Int_t numConst = index_sorted_list.size();
320  Double_t* constPts = new Double_t[TMath::Max(Int_t(index_sorted_list.size()), 10)];
321  for(Int_t i = 0; i < TMath::Max(Int_t(index_sorted_list.size()), 10); i++)
322  constPts[i] = 0;
323 
324  // Loop over all constituents and do jet shape calculations
325  for (Int_t i=0;i<numConst;i++)
326  {
327  AliVParticle* particle = static_cast<AliVParticle*>(jet->TrackAt(index_sorted_list.at(i), fJetsCont->GetParticleContainer()->GetArray()));
328  constPtMean += particle->Pt();
329  constPts[i] = particle->Pt();
330  if(particle->Pt() > jetLeadingHadronPt)
331  {
332  jetSubleadingHadronPt = jetLeadingHadronPt;
333  jetLeadingHadronPt = particle->Pt();
334  }
335  else if(particle->Pt() > jetSubleadingHadronPt)
336  jetSubleadingHadronPt = particle->Pt();
337 
338  Double_t deltaPhi = TMath::Min(TMath::Abs(jet->Phi()-particle->Phi()),TMath::TwoPi() - TMath::Abs(jet->Phi()-particle->Phi()));
339  Double_t deltaR = TMath::Sqrt( (jet->Eta() - particle->Eta())*(jet->Eta() - particle->Eta()) + deltaPhi*deltaPhi );
340 
341  jetSum += particle->Pt();
342  jetSum2 += particle->Pt()*particle->Pt();
343  radialMoment += particle->Pt() * deltaR;
344  }
345 
346  if(jetCorrectedPt)
347  radialMoment /= jetCorrectedPt;
348  if(numConst)
349  {
350  constPtMean /= numConst;
351  constPtMedian = TMath::Median(numConst, constPts);
352  }
353 
354  if(numConst > 1)
355  leSub_noCorr = jetLeadingHadronPt - jetSubleadingHadronPt;
356  else
357  leSub_noCorr = jetLeadingHadronPt;
358 
359  if(jetSum)
360  momentumDispersion = TMath::Sqrt(jetSum2)/jetSum;
361 }
362 
363 //########################################################################
364 // HELPERS
365 //########################################################################
366 
367 //________________________________________________________________________
369 {
370  TH1* tmpHist = static_cast<TH1*>(fOutput->FindObject(key));
371  if(!tmpHist)
372  {
373  AliError(Form("Cannot find histogram <%s> ",key)) ;
374  return;
375  }
376 
377  tmpHist->Fill(x);
378 }
379 
380 //________________________________________________________________________
382 {
383  TH1* tmpHist = static_cast<TH1*>(fOutput->FindObject(key));
384  if(!tmpHist)
385  {
386  AliError(Form("Cannot find histogram <%s> ",key));
387  return;
388  }
389 
390  if (tmpHist->IsA()->GetBaseClass("TH1"))
391  static_cast<TH1*>(tmpHist)->Fill(x,y); // Fill x with y
392  else if (tmpHist->IsA()->GetBaseClass("TH2"))
393  static_cast<TH2*>(tmpHist)->Fill(x,y); // Fill x,y with 1
394 }
395 
396 //________________________________________________________________________
398 {
399  TH2* tmpHist = static_cast<TH2*>(fOutput->FindObject(key));
400  if(!tmpHist)
401  {
402  AliError(Form("Cannot find histogram <%s> ",key));
403  return;
404  }
405 
406  tmpHist->Fill(x,y,add);
407 }
408 
409 //________________________________________________________________________
411 {
412  TH3* tmpHist = static_cast<TH3*>(fOutput->FindObject(key));
413  if(!tmpHist)
414  {
415  AliError(Form("Cannot find histogram <%s> ",key));
416  return;
417  }
418 
419  if(add)
420  tmpHist->Fill(x,y,z,add);
421  else
422  tmpHist->Fill(x,y,z);
423 }
424 
425 
426 //________________________________________________________________________
427 template <class T> T* AliAnalysisTaskEmcalJetCorrection::AddHistogram1D(const char* name, const char* title, const char* options, Int_t xBins, Double_t xMin, Double_t xMax, const char* xTitle, const char* yTitle)
428 {
429  T* tmpHist = new T(name, title, xBins, xMin, xMax);
430 
431  tmpHist->GetXaxis()->SetTitle(xTitle);
432  tmpHist->GetYaxis()->SetTitle(yTitle);
433  tmpHist->SetOption(options);
434  tmpHist->SetMarkerStyle(kFullCircle);
435  tmpHist->Sumw2();
436 
437  fOutput->Add(tmpHist);
438 
439  return tmpHist;
440 }
441 
442 //________________________________________________________________________
443 template <class T> T* AliAnalysisTaskEmcalJetCorrection::AddHistogram2D(const char* name, const char* title, const char* options, Int_t xBins, Double_t xMin, Double_t xMax, Int_t yBins, Double_t yMin, Double_t yMax, const char* xTitle, const char* yTitle, const char* zTitle)
444 {
445  T* tmpHist = new T(name, title, xBins, xMin, xMax, yBins, yMin, yMax);
446  tmpHist->GetXaxis()->SetTitle(xTitle);
447  tmpHist->GetYaxis()->SetTitle(yTitle);
448  tmpHist->GetZaxis()->SetTitle(zTitle);
449  tmpHist->SetOption(options);
450  tmpHist->SetMarkerStyle(kFullCircle);
451  tmpHist->Sumw2();
452 
453  fOutput->Add(tmpHist);
454 
455  return tmpHist;
456 }
457 
458 //________________________________________________________________________
459 template <class T> T* AliAnalysisTaskEmcalJetCorrection::AddHistogram3D(const char* name, const char* title, const char* options, Int_t xBins, Double_t xMin, Double_t xMax, Int_t yBins, Double_t yMin, Double_t yMax, Int_t zBins, Double_t zMin, Double_t zMax, const char* xTitle, const char* yTitle, const char* zTitle)
460 {
461  T* tmpHist = new T(name, title, xBins, xMin, xMax, yBins, yMin, yMax, zBins, zMin, zMax);
462  tmpHist->GetXaxis()->SetTitle(xTitle);
463  tmpHist->GetYaxis()->SetTitle(yTitle);
464  tmpHist->GetZaxis()->SetTitle(zTitle);
465  tmpHist->SetOption(options);
466  tmpHist->SetMarkerStyle(kFullCircle);
467  tmpHist->Sumw2();
468 
469  fOutput->Add(tmpHist);
470 
471  return tmpHist;
472 }
473 
474 //________________________________________________________________________
476 {
477  // Called once at the end of the analysis.
478 }
479 
480 // ### ADDTASK MACRO
481 //________________________________________________________________________
482 AliAnalysisTaskEmcalJetCorrection* AliAnalysisTaskEmcalJetCorrection::AddTaskEmcalJetCorrection(TString modelName, TString trackArray, TString jetArray, TString rhoObject, Double_t jetRadius, const char* taskNameSuffix)
483 {
484  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
485  Double_t minJetEta = 0.5;
486  Double_t minJetPt = 0.15;
487  Double_t minTrackPt = 0.15;
488  Double_t minJetAreaPerc = 0.557;
489  TString suffix = "";
490  if(taskNameSuffix != 0)
491  suffix = taskNameSuffix;
492 
493  // ###### Task name
494  TString name("AliAnalysisTaskEmcalJetCorrection");
495  if (jetArray != "") {
496  name += "_";
497  name += jetArray;
498  }
499  if (rhoObject != "") {
500  name += "_";
501  name += rhoObject;
502  }
503  if(modelName != "") {
504  name += "_";
505  name += modelName;
506  }
507  if (suffix != "") {
508  name += "_";
509  name += suffix;
510  }
511 
512  // ###### Setup task with default settings
513  AliAnalysisTaskEmcalJetCorrection* myTask = new AliAnalysisTaskEmcalJetCorrection(name);
514  myTask->SetVzRange(-10.,10.);
515  myTask->SetModelName(modelName);
516 
517  // Particle container and track pt cut
518  AliParticleContainer* trackCont = 0;
519  if(trackArray == "mcparticles")
520  trackCont = myTask->AddMCParticleContainer(trackArray);
521  else if(trackArray =="mctracks")
522  trackCont = myTask->AddParticleContainer(trackArray);
523  else
524  trackCont = myTask->AddTrackContainer(trackArray);
525  trackCont->SetParticlePtCut(minTrackPt);
526 
527  // Jet container
528  AliJetContainer *jetCont = myTask->AddJetContainer(jetArray,6,jetRadius);
529  if (jetCont) {
530  jetCont->SetRhoName(rhoObject);
531  jetCont->SetPercAreaCut(minJetAreaPerc);
532  jetCont->SetJetPtCut(minJetPt);
533  jetCont->SetLeadingHadronType(0);
534  jetCont->SetPtBiasJetTrack(minTrackPt);
535  jetCont->SetJetEtaLimits(-minJetEta, +minJetEta);
536  jetCont->ConnectParticleContainer(trackCont);
537  jetCont->SetMaxTrackPt(1000);
538  }
539 
540  mgr->AddTask(myTask);
541 
542  // ###### Connect inputs/outputs
543  mgr->ConnectInput (myTask, 0, mgr->GetCommonInputContainer() );
544  mgr->ConnectOutput (myTask, 1, mgr->CreateContainer(Form("%s", name.Data()), AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, Form("%s", mgr->GetCommonFileName())) );
545 
546  return myTask;
547 }
Double_t GetFirstOrderSubtractedAngularity() const
Double_t Area() const
Definition: AliEmcalJet.h:130
void SetParticlePtCut(Double_t cut)
Double_t GetRhoVal() const
double Double_t
Definition: External.C:58
Double_t GetSecondOrderSubtractedSigma2() const
const char * title
Definition: MakeQAPdf.C:27
AliJetContainer * GetJetContainer(Int_t i=0) const
Definition: External.C:244
T * AddHistogram3D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, Int_t yBins=100, Double_t yMin=0.0, Double_t yMax=20.0, Int_t zBins=100, Double_t zMin=0.0, Double_t zMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis", const char *zTitle="z axis")
Double_t GetSecondOrderSubtractedConstituent() const
Double_t Eta() const
Definition: AliEmcalJet.h:121
T * AddHistogram2D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, Int_t yBins=100, Double_t yMin=0.0, Double_t yMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis", const char *zTitle="z axis")
void SetLeadingHadronType(Int_t t)
Double_t Phi() const
Definition: AliEmcalJet.h:117
void SetPtBiasJetTrack(Float_t b)
TSystem * gSystem
TString fBackgroundModelInputParameters
MVA model input parameters (comma-separated)
AliJetContainer * AddJetContainer(const char *n, TString defaultCutType, Float_t jetRadius=0.4)
void LoadRhoMass(const AliVEvent *event)
void SetPercAreaCut(Float_t p)
TClonesArray * fJetOutputArray
! Array of corr. jets, attached to event
void SetVzRange(Double_t min, Double_t max)
Set pre-configured event cut object.
void ExecOnce()
Perform steps needed to initialize the analysis.
Container for particles within the EMCAL framework.
Int_t TrackAt(Int_t idx) const
Definition: AliEmcalJet.h:160
UShort_t T(UShort_t m, UShort_t t)
Definition: RingBits.C:60
void SetMass(Double_t mass)
Set jet mass.
Definition: AliEmcalJet.h:290
const TString & GetRhoMassName() const
void SetRhoName(const char *n)
AliParticleContainer * GetParticleContainer() const
T * AddHistogram1D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis")
int Int_t
Definition: External.C:63
void SetJetPtCut(Float_t cut)
float Float_t
Definition: External.C:68
TString fCustomPackages
Custom pip packages to be installed.
void CalculateJetShapes(AliEmcalJet *jet, Double_t &leSub_noCorr, Double_t &radialMoment, Double_t &momentumDispersion, Double_t &constPtMean, Double_t &constPtMedian)
AliParticleContainer * AddParticleContainer(const char *n)
Create new particle container and attach it to the task.
Double_t GetSecondOrderSubtractedAngularity() const
Double_t GetRhoMassVal() const
AliMCParticleContainer * AddMCParticleContainer(const char *n)
Create new container for MC particles and attach it to the task.
AliEmcalJet * GetNextAcceptJet()
TString fBackgroundModelFileName
MVA model file name.
void ConnectParticleContainer(AliParticleContainer *c)
Double_t Pt() const
Definition: AliEmcalJet.h:109
Double_t GetFirstOrderSubtractedCircularity() const
AliEmcalList * fOutput
!output list
static AliAnalysisTaskEmcalJetCorrection * AddTaskEmcalJetCorrection(TString modelName, TString trackArray, TString jetArray, TString rhoObject, Double_t jetRadius, const char *taskNameSuffix)
Definition: External.C:220
AliTrackContainer * AddTrackContainer(const char *n)
Create new track container and attach it to the task.
Double_t GetSecondOrderSubtractedCircularity() const
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
TString fModelName
Name of model (used for jet collection suffix)
void FillHistogram3D(const char *key, Double_t x, Double_t y, Double_t z, Double_t add=0)
void UserCreateOutputObjects()
Main initialization function on the worker.
Double_t GetFirstOrderSubtractedSigma2() const
bool Bool_t
Definition: External.C:53
AliEmcalJetShapeProperties * GetShapeProperties() const
Definition: AliEmcalJet.h:375
Double_t yMin
void GetPtAndMassFromModel(AliEmcalJet *jet, Float_t &pt_ML, Float_t &mass_ML)
void SetMaxTrackPt(Float_t b)
void SetJetEtaLimits(Float_t min, Float_t max)
Double_t M() const
Definition: AliEmcalJet.h:120
Container for jet within the EMCAL jet framework.
Definition: External.C:196
Bool_t fCorrectAlsoMass
mass is also approximated by model or not
std::vector< int > GetPtSortedTrackConstituentIndexes(TClonesArray *tracks) const
Double_t yMax
void SetPtEtaPhi(Double_t pT, Double_t eta, Double_t phi)
Set pT, eta, phi of jet.
Definition: AliEmcalJet.h:284
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.
Analysis task that corrects jet pT/mass with Python code.