AliPhysics  a3b326c (a3b326c)
AliAnalysisTaskEmcalJetHMEC.cxx
Go to the documentation of this file.
1 //Measure Jet-hadron correlations
3 //Does event Mixing using AliEventPoolManager
5 
7 
8 #include <bitset>
9 
10 #include <TH1F.h>
11 #include <TH2F.h>
12 #include <TH3F.h>
13 #include <THnSparse.h>
14 #include <TVector3.h>
15 #include <TFile.h>
16 #include <TGrid.h>
17 #include <TRandom3.h>
18 
19 #include <AliAnalysisManager.h>
20 #include <AliInputEventHandler.h>
21 #include <AliEventPoolManager.h>
22 #include <AliLog.h>
23 #include <AliVAODHeader.h>
24 #include <AliVTrack.h>
25 
26 #include "AliEmcalJet.h"
27 #include "AliTLorentzVector.h"
28 #include "AliBasicParticle.h"
29 #include "AliEmcalContainerUtils.h"
30 #include "AliClusterContainer.h"
31 #include "AliTrackContainer.h"
32 #include "AliJetContainer.h"
35 
37 
38 namespace PWGJE {
39 namespace EMCALJetTasks {
40 
41 // 0-10% centrality: Semi-Good Runs
42 Double_t AliAnalysisTaskEmcalJetHCorrelations::p0_10SG[17] = {0.906767, 0.0754127, 1.11638, -0.0233078, 0.795454, 0.00935385, -0.000327857, 1.08903, 0.0107272, 0.443252, -0.143411, 0.965822, 0.359156, -0.581221, 1.0739, 0.00632828, 0.706356};
43 // 10-30% centrality: Semi-Good Runs
44 Double_t AliAnalysisTaskEmcalJetHCorrelations::p10_30SG[17] = {0.908011, 0.0769254, 1.11912, -0.0249449, 0.741488, 0.0361252, -0.00367954, 1.10424, 0.011472, 0.452059, -0.133282, 0.980633, 0.358222, -0.620256, 1.06871, 0.00564449, 0.753168};
45 // 30-50% centrality: Semi-Good Runs
46 Double_t AliAnalysisTaskEmcalJetHCorrelations::p30_50SG[17] = {0.958708, 0.0799197, 1.10817, -0.0357678, 0.75051, 0.0607808, -0.00929713, 0.998801, 0.00692244, 0.615452, -0.0480328, 0.968431, 0.321634, -0.619066, 1.03412, 0.00656201, 0.798666};
47 // 50-90% centrality: Semi-Good Runs
48 Double_t AliAnalysisTaskEmcalJetHCorrelations::p50_90SG[17] = {0.944565, 0.0807258, 1.12709, -0.0324746, 0.666452, 0.0842476, -0.00963837, 1.02829, 0.00666852, 0.549625, -0.0603107, 0.981374, 0.309374, -0.619181, 1.05367, 0.005925, 0.744887};
49 
50 // 0-10% centrality: Good Runs
51 Double_t AliAnalysisTaskEmcalJetHCorrelations::p0_10G[17] = {0.971679, 0.0767571, 1.13355, -0.0274484, 0.856652, 0.00536795, 3.90795e-05, 1.06889, 0.011007, 0.447046, -0.146626, 0.919777, 0.192601, -0.268515, 1.00243, 0.00620849, 0.709477};
52 // 10-30% centrality: Good Runs
53 Double_t AliAnalysisTaskEmcalJetHCorrelations::p10_30G[17] = {0.97929, 0.0776039, 1.12213, -0.0300645, 0.844722, 0.0134788, -0.0012333, 1.07955, 0.0116835, 0.456608, -0.132743, 0.930964, 0.174175, -0.267154, 0.993118, 0.00574892, 0.765256};
54 // 30-50% centrality: Good Runs
55 Double_t AliAnalysisTaskEmcalJetHCorrelations::p30_50G[17] = {0.997696, 0.0816769, 1.14341, -0.0353734, 0.752151, 0.0744259, -0.0102926, 1.01561, 0.00713274, 0.57203, -0.0640248, 0.947747, 0.102007, -0.194698, 0.999164, 0.00568476, 0.7237};
56 // 50-90% centrality: Good Runs
57 Double_t AliAnalysisTaskEmcalJetHCorrelations::p50_90G[17] = {0.97041, 0.0813559, 1.12151, -0.0368797, 0.709327, 0.0701501, -0.00784043, 1.06276, 0.00676173, 0.53607, -0.0703117, 0.982534, 0.0947881, -0.18073, 1.03229, 0.00580109, 0.737801};
58 
63  AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetHCorrelations", kFALSE),
64  fTrackBias(5),
65  fClusterBias(5),
66  fDoEventMixing(kFALSE),
67  fNMixingTracks(50000), fMinNTracksMixedEvents(5000), fMinNEventsMixedEvents(5), fNCentBinsMixedEvent(10),
68  fPoolMgr(nullptr),
69  fTriggerType(AliVEvent::kEMCEJE), fMixingEventType(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral),
70  fDisableFastPartition(kFALSE),
71  fSingleTrackEfficiencyCorrectionType(AliAnalysisTaskEmcalJetHCorrelations::kEffDisable),
72  fArtificialTrackInefficiency(1.0),
73  fNoMixedEventJESCorrection(kFALSE),
74  fJESCorrectionHist(nullptr),
75  fDoLessSparseAxes(kFALSE), fDoWiderTrackBin(kFALSE),
76  fRequireMatchedJetWhenEmbedding(kTRUE),
77  fMinSharedMomentumFraction(0.),
78  fRequireMatchedPartLevelJet(false),
79  fMaxMatchedJetDistance(-1),
80  fHistManager(),
81  fHistTrackPt(nullptr),
82  fHistJetEtaPhi(nullptr),
83  fHistJetHEtaPhi(nullptr),
84  fhnMixedEvents(nullptr),
85  fhnJH(nullptr),
86  fhnTrigger(nullptr)
87 {
88  // Default Constructor
90 }
91 
96  AliAnalysisTaskEmcalJet(name, kTRUE),
97  fTrackBias(5),
98  fClusterBias(5),
99  fDoEventMixing(kFALSE),
101  fPoolMgr(nullptr),
102  fTriggerType(AliVEvent::kEMCEJE), fMixingEventType(AliVEvent::kMB | AliVEvent::kCentral | AliVEvent::kSemiCentral),
103  fDisableFastPartition(kFALSE),
108  fDoLessSparseAxes(kFALSE), fDoWiderTrackBin(kFALSE),
113  fHistManager(name),
118  fhnJH(nullptr),
120 {
121  // Constructor
123  // Ensure that additional general histograms are created
125 }
126 
131 {
132  for(Int_t trackPtBin = 0; trackPtBin < kMaxTrackPtBins; trackPtBin++){
133  fHistTrackEtaPhi[trackPtBin] = nullptr;
134  }
135  for(Int_t centralityBin = 0; centralityBin < kMaxCentralityBins; ++centralityBin){
136  fHistJetPt[centralityBin] = nullptr;
137  fHistJetPtBias[centralityBin] = nullptr;
138  }
139 }
140 
145  // Called once
147 
148  // Create histograms
149  fHistTrackPt = new TH1F("fHistTrackPt", "P_{T} distribution", 1000, 0.0, 100.0);
150  fHistJetEtaPhi = new TH2F("fHistJetEtaPhi","Jet eta-phi",900,-1.8,1.8,720,-3.2,3.2);
151  fHistJetHEtaPhi = new TH2F("fHistJetHEtaPhi","Jet-Hadron deta-dphi",900,-1.8,1.8,720,-1.6,4.8);
152 
153  fOutput->Add(fHistTrackPt);
154  fOutput->Add(fHistJetEtaPhi);
155  fOutput->Add(fHistJetHEtaPhi);
156 
157  TString name;
158  for(Int_t trackPtBin = 0; trackPtBin < kMaxTrackPtBins; ++trackPtBin){
159  name = Form("fHistTrackEtaPhi_%i", trackPtBin);
160  fHistTrackEtaPhi[trackPtBin] = new TH2F(name,name,400,-1,1,720,0.0,2.0*TMath::Pi());
161  fOutput->Add(fHistTrackEtaPhi[trackPtBin]);
162  }
163 
164  for(Int_t centralityBin = 0; centralityBin < kMaxCentralityBins; ++centralityBin){
165  name = Form("fHistJetPt_%i",centralityBin);
166  fHistJetPt[centralityBin] = new TH1F(name,name,200,0,200);
167  fOutput->Add(fHistJetPt[centralityBin]);
168 
169  name = Form("fHistJetPtBias_%i",centralityBin);
170  fHistJetPtBias[centralityBin] = new TH1F(name,name,200,0,200);
171  fOutput->Add(fHistJetPtBias[centralityBin]);
172  }
173 
174  // Jet matching cuts
175  std::vector<std::string> binLabels = {"noMatch", "matchedJet", "sharedMomentumFraction", "partLevelMatchedJet", "jetDistance", "passedAllCuts"};
176  for (auto histName : std::vector<std::string>({"SameEvent", "MixedEvent"})) {
177  name = std::string("fHistJetMatching") + histName.c_str() + "Cuts";
178  std::string title = std::string("Jets which passed matching jet cuts for ") + histName;
179  auto histMatchedJetCuts = fHistManager.CreateTH1(name, title.c_str(), binLabels.size(), 0, binLabels.size());
180  // Set label names
181  for (unsigned int i = 1; i <= binLabels.size(); i++) {
182  histMatchedJetCuts->GetXaxis()->SetBinLabel(i, binLabels.at(i-1).c_str());
183  }
184  histMatchedJetCuts->GetYaxis()->SetTitle("Number of jets");
185  }
186 
187  UInt_t cifras = 0; // bit coded, see GetDimParams() below
188  if(fDoLessSparseAxes) {
189  cifras = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<9;
190  } else {
191  cifras = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<7 | 1<<9;
192  }
193  fhnJH = NewTHnSparseF("fhnJH", cifras);
194  fhnJH->Sumw2();
195  fOutput->Add(fhnJH);
196 
197  if(fDoEventMixing){
198  // The event plane angle does not need to be included because the semi-central determined that the EP angle didn't change
199  // significantly for any of the EP orientations. However, it will be included so this can be demonstrated for the central
200  // analysis if so desired.
201  if(fDoLessSparseAxes) {
202  cifras = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<9;
203  } else {
204  cifras = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<7 | 1<<9;
205  }
206  fhnMixedEvents = NewTHnSparseF("fhnMixedEvents", cifras);
207  fhnMixedEvents->Sumw2();
208  fOutput->Add(fhnMixedEvents);
209  }
210 
211  // Trigger THnSparse
212  cifras = 1<<0 | 1<<1 | 1<<9;
213  fhnTrigger = NewTHnSparseF("fhnTrigger", cifras);
214  fhnTrigger->Sumw2();
215  fOutput->Add(fhnTrigger);
216 
217  // Store hist manager output in the output list
218  TIter next(fHistManager.GetListOfHistograms());
219  TObject* obj = 0;
220  while ((obj = next())) {
221  fOutput->Add(obj);
222  }
223 
224  PostData(1, fOutput);
225 
226  // Event Mixing
227  Int_t poolSize = -1; // Maximum number of events. Set to -1 to avoid limits on number of events
228  // ZVertex
229  Int_t nZVertexBins = 10;
230  Double_t* zVertexBins = GenerateFixedBinArray(nZVertexBins, -10, 10);
231  // Event activity (centrality of multiplicity)
232  Int_t nEventActivityBins = 8;
233  Double_t* eventActivityBins = 0;
234  // +1 to accomodate the fact that we define bins rather than array entries.
235  Double_t multiplicityBins[kMixedEventMulitplictyBins+1] = {0., 4., 9., 15., 25., 35., 55., 100., 500.};
236 
237  // Cannot use GetBeamType() since it is not available until UserExec()
238  if (fForceBeamType != AliAnalysisTaskEmcal::kpp ) { //all besides pp
239  // Event Activity is centrality in AA, pA
240  nEventActivityBins = fNCentBinsMixedEvent;
241  eventActivityBins = GenerateFixedBinArray(nEventActivityBins, 0, 100);
242  }
243  else if (fForceBeamType == AliAnalysisTaskEmcal::kpp) { //for pp only
244  // Event Activity is multiplicity in pp
245  eventActivityBins = multiplicityBins;
246  }
247 
248  fPoolMgr = new AliEventPoolManager(poolSize, fNMixingTracks, nEventActivityBins, eventActivityBins, nZVertexBins, zVertexBins);
249 }
250 
252 {
253  if (fArtificialTrackInefficiency < 1.) {
254  if (gRandom) delete gRandom;
255  gRandom = new TRandom3(0);
256  }
257 
258  // Call the base class
260 }
261 
269 {
270  Int_t ptBin = -1;
271  if (pt < 0.5) ptBin = 0;
272  else if (pt < 1 ) ptBin = 1;
273  else if (pt < 2 ) ptBin = 2;
274  else if (pt < 3 ) ptBin = 3;
275  else if (pt < 5 ) ptBin = 4;
276  else if (pt < 8 ) ptBin = 5;
277  else if (pt < 20 ) ptBin = 6;
278 
279  return ptBin;
280 }
281 
288 {
289  UInt_t eventTrigger = 0;
290  if (fIsEmbedded) {
291  auto embeddingHelper = AliAnalysisTaskEmcalEmbeddingHelper::GetInstance();
292  if (embeddingHelper) {
293  auto aodHeader = dynamic_cast<AliVAODHeader *>(embeddingHelper->GetEventHeader());
294  if (aodHeader) {
295  AliDebugStream(5) << "Retrieving trigger mask from embedded event\n";
296  eventTrigger = aodHeader->GetOfflineTrigger();
297  }
298  else {
299  AliErrorStream() << "Failed to retrieve requested AOD header from embedding helper\n";
300  }
301  }
302  else {
303  AliErrorStream() << "Failed to retrieve requested embedding helper\n";
304  }
305  }
306  else {
307  AliDebugStream(5) << "Retrieving trigger mask from internal event\n";
308  eventTrigger = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
309  }
310 
311  return eventTrigger;
312 }
313 
318 {
319  // NOTE: Clusters are never used directly in the task, so the container is neither created not retrieved
320  // Retrieve tracks
321  AliTrackContainer * tracks = static_cast<AliTrackContainer * >(GetParticleContainer("tracksForCorrelations"));
322  if (!tracks) {
323  AliError(Form("%s: Unable to retrieve tracks!", GetName()));
324  return kFALSE;
325  }
326 
327  // Retrieve jets
328  AliJetContainer * jets = GetJetContainer(0);
329  if (!jets) {
330  AliError(Form("%s: Unable to retrieve jets!", GetName()));
331  return kFALSE;
332  }
333 
334  // Keep track of the tracks which are rejected with an aritificial track inefficiency
335  std::vector<unsigned int> rejectedTrackIndices;
336  bool useListOfRejectedIndices = false;
337 
338  // Get z vertex
339  Double_t zVertex=fVertex[2];
340  // Flags
341  Bool_t biasedJet = kFALSE;
342  Bool_t leadJet = kFALSE;
343  // Relative angles and distances
344  Double_t deltaPhi = 0;
345  Double_t deltaEta = 0;
346  Double_t deltaR = 0;
347  Double_t epAngle = 0;
348  // Event activity (centrality or multipilicity)
349  Double_t eventActivity = 0;
350  // Efficiency correction
351  Double_t efficiency = -999;
352  // For comparison to the current jet
353  AliEmcalJet * leadingJet = jets->GetLeadingJet();
354  // For getting the proper properties of tracks
355  AliTLorentzVector track;
356 
357  // Determine the trigger for the current event
358  UInt_t eventTrigger = RetrieveTriggerMask();
359 
360  AliDebugStream(5) << "Beginning main processing. Number of jets: " << jets->GetNJets() << ", accepted jets: " << jets->GetNAcceptedJets() << "\n";
361 
362  // Handle fast partition if selected
363  if ((eventTrigger & AliVEvent::kFastOnly) && fDisableFastPartition) {
364  AliDebugStream(4) << GetName() << ": Fast partition disabled\n";
365  if (fGeneralHistograms) {
366  fHistEventRejection->Fill("Fast Partition", 1);
367  }
368  return kFALSE;
369  }
370 
371  for (auto jet : jets->accepted()) {
372  // Selects only events that we are interested in (ie triggered)
373  if (!(eventTrigger & fTriggerType)) {
374  // The two bitwise and to zero yet are still equal when both are 0, so we allow for that possibility
375  if (eventTrigger == fTriggerType && eventTrigger == 0) {
376  AliDebugStream(5) << "Event accepted because the physics selection is \"0\".\n";
377  }
378  else {
379  AliDebugStream(5) << "Rejected jets due to physics selection. Phys sel: " << std::bitset<32>(eventTrigger) << ", requested triggers: " << std::bitset<32>(fTriggerType) << " \n";
380  // We can break here - the physics selection is not going to change within an event.
381  break;
382  }
383  }
384 
385  AliDebugStream(5) << "Jet passed event selection!\nJet: " << jet->toString().Data() << "\n";
386 
387  // Require the found jet to be matched
388  // This match should be between detector and particle level MC
390  bool foundMatchedJet = CheckForMatchedJet(jets, jet, "fHistJetMatchingSameEventCuts");
391  if (foundMatchedJet == false) {
392  continue;
393  }
394  }
395 
396  // Determine event activity
397  if (fBeamType == kAA || fBeamType == kpA) {
398  eventActivity = fCent;
399  }
400  else if (fBeamType == kpp) {
401  eventActivity = static_cast<Double_t>(tracks->GetNTracks());
402  }
403 
404  // Jet properties
405  // Determine if we have the lead jet
406  leadJet = kFALSE;
407  if (jet == leadingJet) leadJet = kTRUE;
408  biasedJet = BiasedJet(jet);
410 
411  // Fill jet properties
412  fHistJetEtaPhi->Fill(jet->Eta(), jet->Phi());
413  FillHist(fHistJetPt[fCentBin], jet->Pt());
414  if (biasedJet == kTRUE) {
415  FillHist(fHistJetPtBias[fCentBin], jet->Pt());
416 
417  const double triggerInfo[] = {eventActivity, jet->Pt(), epAngle};
418  fhnTrigger->Fill(triggerInfo);
419  }
420 
421  // Cut on jet pt of 15 to reduce the size of the sparses
422  if (jet->Pt() > 15) {
423 
424  AliDebugStream(4) << "Passed min jet pt cut of 15. Jet: " << jet->toString().Data() << "\n";
425  AliDebugStream(4) << "N accepted tracks: " << tracks->GetNAcceptedTracks() << "\n";
426  auto tracksIter = tracks->accepted_momentum();
427  for (auto trackIter = tracksIter.begin(); trackIter != tracksIter.end(); trackIter++ ) {
428  // Get proper track properties
429  track.Clear();
430  track = trackIter->first;
431 
432  // Artificial inefficiency
433  // Note that we already randomly rejected tracks so that the same tracks will be rejected for the mixed events
434  bool rejectParticle = CheckArtificialTrackEfficiency(trackIter.current_index(), rejectedTrackIndices, useListOfRejectedIndices);
435  if (rejectParticle) {
436  AliDebugStream(4) << "Track rejected in signal correlation loop.\n";
437  continue;
438  }
439 
440  // Determine relative angles and distances and set the respective variables
441  GetDeltaEtaDeltaPhiDeltaR(track, jet, deltaEta, deltaPhi, deltaR);
442 
443  // Fill track properties
444  fHistTrackPt->Fill(track.Pt());
445  fHistJetHEtaPhi->Fill(deltaEta, deltaPhi);
446 
447  // Calculate single particle tracking efficiency for correlations
448  efficiency = EffCorrection(track.Eta(), track.Pt());
449  AliDebugStream(6) << "track eta: " << track.Eta() << ", track pt: " << track.Pt() << ", efficiency: " << efficiency << "\n";
450 
451  if (biasedJet == kTRUE) {
452  if(fDoLessSparseAxes) { // check if we want all dimensions
453  double triggerEntries[] = {eventActivity, jet->Pt(), track.Pt(), deltaEta, deltaPhi, static_cast<Double_t>(leadJet), epAngle};
454  FillHist(fhnJH, triggerEntries, 1.0/efficiency);
455  } else {
456  double triggerEntries[] = {eventActivity, jet->Pt(), track.Pt(), deltaEta, deltaPhi, static_cast<Double_t>(leadJet), deltaR, epAngle};
457  FillHist(fhnJH, triggerEntries, 1.0/efficiency);
458  }
459  }
460 
461  } //track loop
462 
463  // After one jet (and looping over whatever tracks are available in this event), we want to use the list of rejected indices,
464  // both for the next possible signal jet in the event and for the mixed events
465  AliDebugStream(4) << "Switching to list of rejected track indices. Number of indices: " << rejectedTrackIndices.size() << "\n";
466  useListOfRejectedIndices = true;
467 
468  }//jet pt cut
469  }//jet loop
470 
471  //Prepare to do event mixing
472 
473  // create a list of reduced objects. This speeds up processing and reduces memory consumption for the event pool
474  TObjArray* tracksClone = 0;
475 
476  if(fDoEventMixing == kTRUE){
477 
478  // event mixing
479 
480  // 1. First get an event pool corresponding in mult (cent) and
481  // zvertex to the current event. Once initialized, the pool
482  // should contain nMix (reduced) events. This routine does not
483  // pre-scan the chain. The first several events of every chain
484  // will be skipped until the needed pools are filled to the
485  // specified depth. If the pool categories are not too rare, this
486  // should not be a problem. If they are rare, you could lose
487  // statistics.
488 
489  // 2. Collect the whole pool's content of tracks into one TObjArray
490  // (bgTracks), which is effectively a single background super-event.
491 
492  // 3. The reduced and bgTracks arrays must both be passed into
493  // FillCorrelations(). Also nMix should be passed in, so a weight
494  // of 1./nMix can be applied.
495 
496  AliEventPool *pool = 0;
497  if (fBeamType == kAA || fBeamType == kpA) {//everything but pp
498  pool = fPoolMgr->GetEventPool(fCent, zVertex);
499  }
500  else if (fBeamType == kpp) {//pp only
501  pool = fPoolMgr->GetEventPool(static_cast<Double_t>(tracks->GetNTracks()), zVertex);
502  }
503 
504  if (!pool){
505  if (fBeamType == kAA || fBeamType == kpA) AliFatal(Form("No pool found for centrality = %f, zVertex = %f", fCent, zVertex));
506  else if (fBeamType == kpp) AliFatal(Form("No pool found for ntracks_pp = %d, zVertex = %f", tracks->GetNTracks(), zVertex));
507  return kTRUE;
508  }
509 
510  // The number of events in the pool
511  Int_t nMix = pool->GetCurrentNEvents();
512 
513  // The two bitwise and to zero yet are still equal when both are 0, so we allow for that possibility
514  if((eventTrigger & fTriggerType) || eventTrigger == fTriggerType) {
515  // check for a trigger jet
516  if (pool->IsReady() || pool->NTracksInPool() >= fMinNTracksMixedEvents || nMix >= fMinNEventsMixedEvents) {
517 
518  for (auto jet : jets->accepted()) {
519  // Require the found jet to be matched
520  // This match should be between detector and particle level MC
522  bool foundMatchedJet = CheckForMatchedJet(jets, jet, "fHistJetMatchingMixedEventCuts");
523  if (foundMatchedJet == false) {
524  continue;
525  }
526  }
527 
528  if (fBeamType == kAA || fBeamType == kpA) { //pA and AA
529  eventActivity = fCent;
530  }
531  else if (fBeamType == kpp) {
532  eventActivity = static_cast<Double_t>(tracks->GetNTracks());
533  }
534 
535  // Jet properties
536  // Determine if we have the lead jet
537  leadJet = kFALSE;
538  if (jet == leadingJet) { leadJet = kTRUE; }
539  biasedJet = BiasedJet(jet);
541 
542  // Make sure event contains a biased jet above our threshold (reduce stats of sparse)
543  if (jet->Pt() < 15 || biasedJet == kFALSE) continue;
544 
545  // Fill mixed-event histos here
546  for (Int_t jMix=0; jMix < nMix; jMix++) {
547  TObjArray* bgTracks = pool->GetEvent(jMix);
548 
549  for (Int_t ibg=0; ibg < bgTracks->GetEntries(); ibg++){
550  AliBasicParticle *bgTrack = static_cast<AliBasicParticle*>(bgTracks->At(ibg));
551  if(!bgTrack) {
552  AliError(Form("%s:Failed to retrieve tracks from mixed events", GetName()));
553  }
554 
555  // NOTE: We don't need to apply the artificial track inefficiency here because we already applied
556  // it when will filling into the event pool (in CloneAndReduceTrackList()).
557 
558  // Fill into TLorentzVector for use with functions below
559  track.Clear();
560  track.SetPtEtaPhiE(bgTrack->Pt(), bgTrack->Eta(), bgTrack->Phi(), 0);
561 
562  // Calculate single particle tracking efficiency of mixed events for correlations
563  efficiency = EffCorrection(track.Eta(), track.Pt());
564 
565  // Phi is [-0.5*TMath::Pi(), 3*TMath::Pi()/2.]
566  GetDeltaEtaDeltaPhiDeltaR(track, jet, deltaEta, deltaPhi, deltaR);
567 
568  if (fDoLessSparseAxes) { // check if we want all the axis filled
569  double triggerEntries[] = {eventActivity, jet->Pt(), track.Pt(), deltaEta, deltaPhi, static_cast<Double_t>(leadJet), epAngle};
570  FillHist(fhnMixedEvents, triggerEntries, 1./(nMix*efficiency), fNoMixedEventJESCorrection);
571  } else {
572  double triggerEntries[] = {eventActivity, jet->Pt(), track.Pt(), deltaEta, deltaPhi, static_cast<Double_t>(leadJet), deltaR, epAngle};
573  FillHist(fhnMixedEvents, triggerEntries, 1./(nMix*efficiency), fNoMixedEventJESCorrection);
574  }
575  }
576  }
577  }
578  }
579  }
580 
581  // The two bitwise and to zero yet are still equal when both are 0, so we allow for that possibility
582  if ((eventTrigger & fMixingEventType) || eventTrigger == fMixingEventType) {
583  tracksClone = CloneAndReduceTrackList(rejectedTrackIndices, useListOfRejectedIndices);
584 
585  //update pool if jet in event or not
586  pool->UpdatePool(tracksClone);
587  }
588 
589  } // end of event mixing
590 
591  return kTRUE;
592 }
593 
601 {
602  if ((jet->MaxTrackPt() > fTrackBias) || (jet->MaxClusterPt() > fClusterBias))
603  {
604  return kTRUE;
605  }
606  return kFALSE;
607 }
608 
618 void AliAnalysisTaskEmcalJetHCorrelations::GetDeltaEtaDeltaPhiDeltaR(AliTLorentzVector & particleOne, AliVParticle * particleTwo, Double_t & deltaEta, Double_t & deltaPhi, Double_t & deltaR)
619 {
620  // Define dPhi = jet.Phi() - particle.Phi() and similarly for dEta
621  // Returns deltaPhi in symmetric range so that we can calculate DeltaR.
622  deltaPhi = DeltaPhi(particleOne.Phi(), particleTwo->Phi(), -1.0*TMath::Pi(), TMath::Pi());
623  deltaEta = particleTwo->Eta() - particleOne.Eta();
624  deltaR = TMath::Sqrt(deltaPhi*deltaPhi + deltaEta*deltaEta);
625 
626  // Adjust to the normal range after the DeltaR caluclation
627  deltaPhi = DeltaPhi(particleTwo->Phi(), particleOne.Phi(), -0.5*TMath::Pi(), 3*TMath::Pi()/2.);
628 }
629 
638 bool AliAnalysisTaskEmcalJetHCorrelations::CheckArtificialTrackEfficiency(unsigned int trackIndex, std::vector<unsigned int> & rejectedTrackIndices, bool useRejectedList)
639 {
640  bool returnValue = false;
641  if (fArtificialTrackInefficiency < 1.) {
642  if (useRejectedList) {
643  if (std::find(rejectedTrackIndices.begin(), rejectedTrackIndices.end(), trackIndex) != rejectedTrackIndices.end()) {
644  AliDebugStream(4) << "Track " << trackIndex << " rejected due to artificial tracking inefficiency (from list)\n";
645  returnValue = true;
646  }
647  }
648  else {
649  // Rejet randomly
650  Double_t rnd = gRandom->Rndm();
651  if (fArtificialTrackInefficiency < rnd) {
652  // Store index so we can reject it again if it is also filled for mixed events
653  rejectedTrackIndices.push_back(trackIndex);
654  AliDebugStream(4) << "Track " << trackIndex << " rejected due to artificial tracking inefficiency (from random)\n";
655  returnValue = true;
656  }
657  }
658  }
659 
660  return returnValue;
661 }
662 
681 bool AliAnalysisTaskEmcalJetHCorrelations::CheckForMatchedJet(AliJetContainer * jets, AliEmcalJet * jet, const std::string & histName)
682 {
683  bool returnValue = false;
684  if (jet->ClosestJet()) {
685  fHistManager.FillTH1(histName.c_str(), "matchedJet");
686  returnValue = true;
687  // TODO: Can it be merged with the function in JetHPerformance?
688  AliDebugStream(4) << "Jet is matched!\nJet: " << jet->toString() << "\n";
689  // Check shared momentum fraction
690  // We explicitly want to use indices instead of geometric matching
691  double sharedFraction = jets->GetFractionSharedPt(jet, nullptr);
692  if (sharedFraction < fMinSharedMomentumFraction) {
693  AliDebugStream(4) << "Jet rejected due to shared momentum fraction of " << sharedFraction << ", which is smaller than the min momentum fraction of " << fMinSharedMomentumFraction << "\n";
694  returnValue = false;
695  }
696  else {
697  AliDebugStream(4) << "Passed shared momentum fraction with value of " << sharedFraction << "\n";
698  fHistManager.FillTH1(histName.c_str(), "sharedMomentumFraction");
699  }
700 
702  AliEmcalJet * detLevelJet = jet->ClosestJet();
703  AliEmcalJet * partLevelJet = detLevelJet->ClosestJet();
704  if (!partLevelJet) {
705  AliDebugStream(4) << "Jet rejected due to no matching part level jet.\n";
706  returnValue = false;
707  }
708  else {
709  AliDebugStream(4) << "Det level jet has a required match to a part level jet.\n" << "Part level jet: " << partLevelJet->toString() << "\n";
710  fHistManager.FillTH1(histName.c_str(), "partLevelMatchedJet");
711  }
712  }
713 
714  // Only check matched jet distance if a value has been set
715  if (fMaxMatchedJetDistance > 0) {
716  double matchedJetDistance = jet->ClosestJetDistance();
717  if (matchedJetDistance > fMaxMatchedJetDistance) {
718  AliDebugStream(4) << "Jet rejected due to matching distance of " << matchedJetDistance << ", which is larger than the max distance of " << fMaxMatchedJetDistance << "\n";
719  returnValue = false;
720  }
721  else {
722  AliDebugStream(4) << "Jet passed distance cut with distance of " << matchedJetDistance << "\n";
723  fHistManager.FillTH1(histName.c_str(), "jetDistance");
724  }
725  }
726 
727  // Record all cuts passed
728  if (returnValue == true) {
729  fHistManager.FillTH1(histName.c_str(), "passedAllCuts");
730  }
731  }
732  else {
733  AliDebugStream(5) << "Rejected jet because it was not matched to a external event jet.\n";
734  fHistManager.FillTH1(histName.c_str(), "noMatch");
735  returnValue = false;
736  }
737 
738  return returnValue;
739 }
740 
748 THnSparse* AliAnalysisTaskEmcalJetHCorrelations::NewTHnSparseF(const char* name, UInt_t entries)
749 {
750  Int_t count = 0;
751  UInt_t tmp = entries;
752  while(tmp!=0){
753  count++;
754  tmp = tmp &~ -tmp; // clear lowest bit
755  }
756 
757  TString hnTitle(name);
758  const Int_t dim = count;
759  Int_t nbins[dim];
760  Double_t xmin[dim];
761  Double_t xmax[dim];
762 
763  Int_t i=0;
764  Int_t c=0;
765  while(c<dim && i<32){
766  if(entries&(1<<i)){
767 
768  TString label("");
769  GetDimParams(i, label, nbins[c], xmin[c], xmax[c]);
770  hnTitle += Form(";%s",label.Data());
771  c++;
772  }
773 
774  i++;
775  }
776  hnTitle += ";";
777 
778  return new THnSparseF(name, hnTitle.Data(), dim, nbins, xmin, xmax);
779 }
780 
791 {
792  const Double_t pi = TMath::Pi();
793 
794  switch(iEntry){
795 
796  case 0:
797  label = "V0 centrality (%)";
798  nbins = 10;
799  xmin = 0.;
800  xmax = 100.;
801  break;
802 
803  case 1:
804  label = "Jet p_{T}";
805  nbins = 20;
806  xmin = 0.;
807  xmax = 200.;
808  break;
809 
810  case 2:
811  if(fDoWiderTrackBin) {
812  label = "Track p_{T}";
813  nbins = 40;
814  xmin = 0.;
815  xmax = 10.;
816  } else {
817  label = "Track p_{T}";
818  nbins = 100;
819  xmin = 0.;
820  xmax = 10;
821  }
822  break;
823 
824  case 3:
825  label = "#delta#eta";
826  nbins = 24;
827  xmin = -1.2;
828  xmax = 1.2;
829  break;
830 
831  case 4:
832  label = "#delta#phi";
833  nbins = 72;
834  xmin = -0.5*pi;
835  xmax = 1.5*pi;
836  break;
837 
838  case 5:
839  label = "Leading Jet";
840  nbins = 3;
841  xmin = -0.5;
842  xmax = 2.5;
843  break;
844 
845  case 6:
846  label = "Trigger track";
847  nbins = 10;
848  xmin = 0;
849  xmax = 50;
850  break;
851 
852  case 7:
853  label = "deltaR";
854  nbins = 10;
855  xmin = 0.;
856  xmax = 5.0;
857  break;
858 
859  case 8:
860  label = "Leading track";
861  nbins = 20;
862  xmin = 0;
863  xmax = 50;
864  break;
865 
866  case 9:
867  label = "Event plane angle";
868  nbins = 3;
869  xmin = 0;
870  xmax = TMath::Pi()/2.;
871  break;
872  }
873 }
874 
882 TObjArray* AliAnalysisTaskEmcalJetHCorrelations::CloneAndReduceTrackList(std::vector<unsigned int> & rejectedTrackIndices, const bool useRejectedList)
883 {
884  // clones a track list by using AliBasicTrack which uses much less memory (used for event mixing)
885  TObjArray* tracksClone = new TObjArray;
886  tracksClone->SetOwner(kTRUE);
887 
888  // Loop over all tracks
889  AliVParticle * particle = 0;
890  AliBasicParticle * clone = 0;
891  AliTrackContainer * tracks = GetTrackContainer("tracksForCorrelations");
892 
893  auto particlesIter = tracks->accepted_momentum();
894  for (auto particleIter = particlesIter.begin(); particleIter != particlesIter.end(); particleIter++)
895  {
896  // Retrieve the particle
897  particle = particleIter->second;
898 
899  // Artificial inefficiency
900  bool rejectParticle = CheckArtificialTrackEfficiency(particleIter.current_index(), rejectedTrackIndices, useRejectedList);
901  if (rejectParticle) {
902  AliDebugStream(4) << "Track rejected in CloneAndReduceTrackList()\n";
903  continue;
904  }
905 
906  // Fill some QA information about the tracks
907  Int_t trackPtBin = GetTrackPtBin(particle->Pt());
908  if(trackPtBin > -1) fHistTrackEtaPhi[trackPtBin]->Fill(particle->Eta(),particle->Phi());
909 
910  // Create new particle
911  clone = new AliBasicParticle(particle->Eta(), particle->Phi(), particle->Pt(), particle->Charge());
912  // Set so that we can do comparisons using the IsEqual() function.
913  clone->SetUniqueID(particle->GetUniqueID());
914 
915  tracksClone->Add(clone);
916  }
917 
918  return tracksClone;
919 }
920 
932  return EffCorrection(trackETA, trackPT, fBeamType);
933 }
934 
951 {
952  // default (current) parameters
953  // x-variable = track pt, y-variable = track eta
954  Double_t x = trackPT;
955  Double_t y = trackETA;
956  double etaaxis = 0;
957  double ptaxis = 0;
958 
959  // Efficiency paramaters
960  double TRefficiency = -1;
961  int effSwitch = 1;
962 
964  if (beamType == AliAnalysisTaskEmcal::kAA) {
965  // Setup for Pb--Pb
966  int runQuality = -1;
967  // Semi-Good OROC C08 Runlists
968  if (fCurrentRunNumber == 169975 || fCurrentRunNumber == 169981 || fCurrentRunNumber == 170038 || fCurrentRunNumber == 170040 || fCurrentRunNumber == 170083 || fCurrentRunNumber == 170084 || fCurrentRunNumber == 170085 || fCurrentRunNumber == 170088 || fCurrentRunNumber == 170089 || fCurrentRunNumber == 170091 || fCurrentRunNumber == 170152 || fCurrentRunNumber == 170155 || fCurrentRunNumber == 170159 || fCurrentRunNumber == 170163 || fCurrentRunNumber == 170193 || fCurrentRunNumber == 170195 || fCurrentRunNumber == 170203 || fCurrentRunNumber == 170204 || fCurrentRunNumber == 170228 || fCurrentRunNumber == 170230 || fCurrentRunNumber == 170268 || fCurrentRunNumber == 170269 || fCurrentRunNumber == 170270 || fCurrentRunNumber == 170306 || fCurrentRunNumber == 170308 || fCurrentRunNumber == 170309) runQuality = 0;
969 
970  // Good Runlists
971  if (fCurrentRunNumber == 167902 || fCurrentRunNumber == 167903 || fCurrentRunNumber == 167915 || fCurrentRunNumber == 167920 || fCurrentRunNumber == 167987 || fCurrentRunNumber == 167988 || fCurrentRunNumber == 168066 || fCurrentRunNumber == 168068 || fCurrentRunNumber == 168069 || fCurrentRunNumber == 168076 || fCurrentRunNumber == 168104 || fCurrentRunNumber == 168107 || fCurrentRunNumber == 168108 || fCurrentRunNumber == 168115 || fCurrentRunNumber == 168212 || fCurrentRunNumber == 168310 || fCurrentRunNumber == 168311 || fCurrentRunNumber == 168322 || fCurrentRunNumber == 168325 || fCurrentRunNumber == 168341 || fCurrentRunNumber == 168342 || fCurrentRunNumber == 168361 || fCurrentRunNumber == 168362 || fCurrentRunNumber == 168458 || fCurrentRunNumber == 168460 || fCurrentRunNumber == 168461 || fCurrentRunNumber == 168464 || fCurrentRunNumber == 168467 || fCurrentRunNumber == 168511 || fCurrentRunNumber == 168512 || fCurrentRunNumber == 168777 || fCurrentRunNumber == 168826 || fCurrentRunNumber == 168984 || fCurrentRunNumber == 168988 || fCurrentRunNumber == 168992 || fCurrentRunNumber == 169035 || fCurrentRunNumber == 169091 || fCurrentRunNumber == 169094 || fCurrentRunNumber == 169138 || fCurrentRunNumber == 169143 || fCurrentRunNumber == 169144 || fCurrentRunNumber == 169145 || fCurrentRunNumber == 169148 || fCurrentRunNumber == 169156 || fCurrentRunNumber == 169160 || fCurrentRunNumber == 169167 || fCurrentRunNumber == 169238 || fCurrentRunNumber == 169411 || fCurrentRunNumber == 169415 || fCurrentRunNumber == 169417 || fCurrentRunNumber == 169835 || fCurrentRunNumber == 169837 || fCurrentRunNumber == 169838 || fCurrentRunNumber == 169846 || fCurrentRunNumber == 169855 || fCurrentRunNumber == 169858 || fCurrentRunNumber == 169859 || fCurrentRunNumber == 169923 || fCurrentRunNumber == 169956 || fCurrentRunNumber == 170027 || fCurrentRunNumber == 170036 || fCurrentRunNumber == 170081) runQuality = 1;
972 
973  // Determine which efficiency to use.
974  // This is just a way to map all possible values of the cent bin and runQuality to a unique flag.
975  // 4 is the number of cent bins, and we want to index the effSwitch starting at 2.
976  if (runQuality != -1) {
977  effSwitch = 2 + runQuality*4 + fCentBin;
978  }
979  }
980  else if (beamType == AliAnalysisTaskEmcal::kpA) {
981  // pA
982  AliErrorStream() << "Single track efficiency for pA is not available.\n";
983  return 0;
984  }
985  else if (beamType == AliAnalysisTaskEmcal::kpp) {
986  // Setup for pp
987  effSwitch = 10;
988  }
989  else {
990  AliErrorStream() << "Beam type " << fBeamType << " is not defined\n";
991  return 0;
992  }
993  }
995  // Manually set to pp (for example, during embedding)
996  effSwitch = 10;
997  }
999  // Use the default value, which is to have a constant efficiency of 1
1000  effSwitch = 1;
1001  }
1002  else {
1003  AliErrorStream() << "Single track efficiency correction type " << fSingleTrackEfficiencyCorrectionType << " is not recongized!\n";
1004  }
1005 
1006  AliDebugStream(5) << "Using efficiency switch value of " << effSwitch << "\n";
1007 
1008  switch(effSwitch) {
1009  case 1 :
1010  // first switch value - TRefficiency not used so = 1
1011  // In this case, the run number isn't in any run list, so efficiency = 1
1012  TRefficiency = 1.0;
1013  break;
1014 
1015  case 2 :
1016  // Parameter values for Semi-GOOD TPC (LHC11h) runs (0-10%):
1017  ptaxis = (x<2.9)*(p0_10SG[0]*exp(-pow(p0_10SG[1]/x,p0_10SG[2])) + p0_10SG[3]*x) + (x>=2.9)*(p0_10SG[4] + p0_10SG[5]*x + p0_10SG[6]*x*x);
1018  etaaxis = (y<-0.07)*(p0_10SG[7]*exp(-pow(p0_10SG[8]/TMath::Abs(y+0.91),p0_10SG[9])) + p0_10SG[10]*y) + (y>=-0.07 && y<=0.4)*(p0_10SG[11] + p0_10SG[12]*y + p0_10SG[13]*y*y) + (y>0.4)*(p0_10SG[14]*exp(-pow(p0_10SG[15]/TMath::Abs(-y+0.91),p0_10SG[16])));
1019  TRefficiency = ptaxis*etaaxis;
1020  break;
1021 
1022  case 3 :
1023  // Parameter values for Semi-GOOD TPC (LHC11h) runs (10-30%):
1024  ptaxis = (x<2.9)*(p10_30SG[0]*exp(-pow(p10_30SG[1]/x,p10_30SG[2])) + p10_30SG[3]*x) + (x>=2.9)*(p10_30SG[4] + p10_30SG[5]*x + p10_30SG[6]*x*x);
1025  etaaxis = (y<-0.07)*(p10_30SG[7]*exp(-pow(p10_30SG[8]/TMath::Abs(y+0.91),p10_30SG[9])) + p10_30SG[10]*y) + (y>=-0.07 && y<=0.4)*(p10_30SG[11] + p10_30SG[12]*y + p10_30SG[13]*y*y) + (y>0.4)*(p10_30SG[14]*exp(-pow(p10_30SG[15]/TMath::Abs(-y+0.91),p10_30SG[16])));
1026  TRefficiency = ptaxis*etaaxis;
1027  break;
1028 
1029  case 4 :
1030  // Parameter values for Semi-GOOD TPC (LHC11h) runs (30-50%):
1031  ptaxis = (x<2.9)*(p30_50SG[0]*exp(-pow(p30_50SG[1]/x,p30_50SG[2])) + p30_50SG[3]*x) + (x>=2.9)*(p30_50SG[4] + p30_50SG[5]*x + p30_50SG[6]*x*x);
1032  etaaxis = (y<-0.07)*(p30_50SG[7]*exp(-pow(p30_50SG[8]/TMath::Abs(y+0.91),p30_50SG[9])) + p30_50SG[10]*y) + (y>=-0.07 && y<=0.4)*(p30_50SG[11] + p30_50SG[12]*y + p30_50SG[13]*y*y) + (y>0.4)*(p30_50SG[14]*exp(-pow(p30_50SG[15]/TMath::Abs(-y+0.91),p30_50SG[16])));
1033  TRefficiency = ptaxis*etaaxis;
1034  break;
1035 
1036  case 5 :
1037  // Parameter values for Semi-GOOD TPC (LHC11h) runs (50-90%):
1038  ptaxis = (x<2.9)*(p50_90SG[0]*exp(-pow(p50_90SG[1]/x,p50_90SG[2])) + p50_90SG[3]*x) + (x>=2.9)*(p50_90SG[4] + p50_90SG[5]*x + p50_90SG[6]*x*x);
1039  etaaxis = (y<-0.07)*(p50_90SG[7]*exp(-pow(p50_90SG[8]/TMath::Abs(y+0.91),p50_90SG[9])) + p50_90SG[10]*y) + (y>=-0.07 && y<=0.4)*(p50_90SG[11] + p50_90SG[12]*y + p50_90SG[13]*y*y) + (y>0.4)*(p50_90SG[14]*exp(-pow(p50_90SG[15]/TMath::Abs(-y+0.91),p50_90SG[16])));
1040  TRefficiency = ptaxis*etaaxis;
1041  break;
1042 
1043  case 6 :
1044  // Parameter values for GOOD TPC (LHC11h) runs (0-10%):
1045  ptaxis = (x<2.9)*(p0_10G[0]*exp(-pow(p0_10G[1]/x,p0_10G[2])) + p0_10G[3]*x) + (x>=2.9)*(p0_10G[4] + p0_10G[5]*x + p0_10G[6]*x*x);
1046  etaaxis = (y<0.0)*(p0_10G[7]*exp(-pow(p0_10G[8]/TMath::Abs(y+0.91),p0_10G[9])) + p0_10G[10]*y) + (y>=0.0 && y<=0.4)*(p0_10G[11] + p0_10G[12]*y + p0_10G[13]*y*y) + (y>0.4)*(p0_10G[14]*exp(-pow(p0_10G[15]/TMath::Abs(-y+0.91),p0_10G[16])));
1047  TRefficiency = ptaxis*etaaxis;
1048  break;
1049 
1050  case 7 :
1051  // Parameter values for GOOD TPC (LHC11h) runs (10-30%):
1052  ptaxis = (x<2.9)*(p10_30G[0]*exp(-pow(p10_30G[1]/x,p10_30G[2])) + p10_30G[3]*x) + (x>=2.9)*(p10_30G[4] + p10_30G[5]*x + p10_30G[6]*x*x);
1053  etaaxis = (y<0.0)*(p10_30G[7]*exp(-pow(p10_30G[8]/TMath::Abs(y+0.91),p10_30G[9])) + p10_30G[10]*y) + (y>=0.0 && y<=0.4)*(p10_30G[11] + p10_30G[12]*y + p10_30G[13]*y*y) + (y>0.4)*(p10_30G[14]*exp(-pow(p10_30G[15]/TMath::Abs(-y+0.91),p10_30G[16])));
1054  TRefficiency = ptaxis*etaaxis;
1055  break;
1056 
1057  case 8 :
1058  // Parameter values for GOOD TPC (LHC11h) runs (30-50%):
1059  ptaxis = (x<2.9)*(p30_50G[0]*exp(-pow(p30_50G[1]/x,p30_50G[2])) + p30_50G[3]*x) + (x>=2.9)*(p30_50G[4] + p30_50G[5]*x + p30_50G[6]*x*x);
1060  etaaxis = (y<0.0)*(p30_50G[7]*exp(-pow(p30_50G[8]/TMath::Abs(y+0.91),p30_50G[9])) + p30_50G[10]*y) + (y>=0.0 && y<=0.4)*(p30_50G[11] + p30_50G[12]*y + p30_50G[13]*y*y) + (y>0.4)*(p30_50G[14]*exp(-pow(p30_50G[15]/TMath::Abs(-y+0.91),p30_50G[16])));
1061  TRefficiency = ptaxis*etaaxis;
1062  break;
1063 
1064  case 9 :
1065  // Parameter values for GOOD TPC (LHC11h) runs (50-90%):
1066  ptaxis = (x<2.9)*(p50_90G[0]*exp(-pow(p50_90G[1]/x,p50_90G[2])) + p50_90G[3]*x) + (x>=2.9)*(p50_90G[4] + p50_90G[5]*x + p50_90G[6]*x*x);
1067  etaaxis = (y<0.0)*(p50_90G[7]*exp(-pow(p50_90G[8]/TMath::Abs(y+0.91),p50_90G[9])) + p50_90G[10]*y) + (y>=0.0 && y<=0.4)*(p50_90G[11] + p50_90G[12]*y + p50_90G[13]*y*y) + (y>0.4)*(p50_90G[14]*exp(-pow(p50_90G[15]/TMath::Abs(-y+0.91),p50_90G[16])));
1068  TRefficiency = ptaxis*etaaxis;
1069  break;
1070 
1071  case 10 :
1072  {
1073  // Track efficiency for pp
1074  // Calculated using LHC12f1a. See analysis note for more details!
1075  // If the trackPt > 6 GeV, then all we need is this coefficient
1076  Double_t coefficient = 0.898052; // p6
1077  if (trackPT < 6) {
1078  coefficient = (1 + -0.442232 * trackPT // p0
1079  + 0.501831 * std::pow(trackPT, 2) // p1
1080  + -0.252024 * std::pow(trackPT, 3) // p2
1081  + 0.062964 * std::pow(trackPT, 4) // p3
1082  + -0.007681 * std::pow(trackPT, 5) // p4
1083  + 0.000365 * std::pow(trackPT, 6)); // p5
1084  }
1085 
1086  // Calculate track eff
1087  TRefficiency = coefficient * (1 + 0.402825 * std::abs(trackETA) // p7
1088  + -2.213152 * std::pow(trackETA, 2) // p8
1089  + 4.311098 * std::abs(std::pow(trackETA, 3)) // p9
1090  + -2.778200 * std::pow(trackETA, 4)); // p10
1091  break;
1092  }
1093 
1094  default :
1095  // no Efficiency Switch option selected.. therefore don't correct, and set eff = 1
1096  // ie. The efficiency correction is disabled.
1097  AliErrorStream() << "No single track efficiency setting selected! Please select one.\n";
1098  TRefficiency = 0.;
1099  }
1100 
1101  return TRefficiency;
1102 }
1103 
1113 void AliAnalysisTaskEmcalJetHCorrelations::FillHist(TH1 * hist, Double_t fillValue, Double_t weight, Bool_t noCorrection)
1114 {
1115  if (fJESCorrectionHist == 0 || noCorrection == kTRUE)
1116  {
1117  AliDebugStream(3) << GetName() << ":" << hist->GetName() << ": " << std::boolalpha << "Using normal weights: JESHist: " << (fJESCorrectionHist ? fJESCorrectionHist->GetName() : "Null") << ", noCorrection: " << noCorrection << std::endl;
1118  hist->Fill(fillValue, weight);
1119  }
1120  else
1121  {
1122  // Determine where to get the values in the correction hist
1123  Int_t xBin = fJESCorrectionHist->GetXaxis()->FindBin(fillValue);
1124 
1125  std::vector <Double_t> yBinsContent;
1126  AliDebug(3, TString::Format("%s: Attempt to access weights from JES correction hist %s with jet pt %f!", GetName(), hist->GetName(), fillValue));
1127  AccessSetOfYBinValues(fJESCorrectionHist, xBin, yBinsContent);
1128  AliDebug(3, TString::Format("weights size: %zd", yBinsContent.size()));
1129 
1130  // Loop over all possible bins to contribute.
1131  // If content is 0 then calling Fill won't make a difference
1132  for (Int_t index = 1; index <= fJESCorrectionHist->GetYaxis()->GetNbins(); index++)
1133  {
1134  // Don't bother trying to fill in the weight is 0
1135  if (yBinsContent.at(index-1) > 0) {
1136  // Determine the value to fill based on the center of the bins.
1137  // This in principle allows the binning between the correction and hist to be different
1138  Double_t fillLocation = fJESCorrectionHist->GetYaxis()->GetBinCenter(index);
1139  AliDebug(4, TString::Format("fillLocation: %f, weight: %f", fillLocation, yBinsContent.at(index-1)));
1140  // minus 1 since loop starts at 1
1141  hist->Fill(fillLocation, weight*yBinsContent.at(index-1));
1142  }
1143  }
1144 
1145  //TEMP
1146  //hist->Draw();
1147  //END TEMP
1148  }
1149 }
1150 
1161 void AliAnalysisTaskEmcalJetHCorrelations::FillHist(THnSparse * hist, Double_t *fillValue, Double_t weight, Bool_t noCorrection)
1162 {
1163  if (fJESCorrectionHist == 0 || noCorrection == kTRUE)
1164  {
1165  AliDebugStream(3) << GetName() << ":" << hist->GetName() << ": " << std::boolalpha << "Using normal weights: JESHist: " << (fJESCorrectionHist ? fJESCorrectionHist->GetName() : "Null") << ", noCorrection: " << noCorrection << std::endl;
1166  hist->Fill(fillValue, weight);
1167  }
1168  else
1169  {
1170  // Jet pt is always located in the second position
1171  Double_t jetPt = fillValue[1];
1172 
1173  // Determine where to get the values in the correction hist
1174  Int_t xBin = fJESCorrectionHist->GetXaxis()->FindBin(jetPt);
1175 
1176  std::vector <Double_t> yBinsContent;
1177  AliDebug(3, TString::Format("%s: Attempt to access weights from JES correction hist %s with jet pt %f!", GetName(), hist->GetName(), jetPt));
1178  AccessSetOfYBinValues(fJESCorrectionHist, xBin, yBinsContent);
1179  AliDebug(3, TString::Format("weights size: %zd", yBinsContent.size()));
1180 
1181  // Loop over all possible bins to contribute.
1182  // If content is 0 then calling Fill won't make a difference
1183  for (Int_t index = 1; index <= fJESCorrectionHist->GetYaxis()->GetNbins(); index++)
1184  {
1185  // Don't bother trying to fill in the weight is 0
1186  if (yBinsContent.at(index-1) > 0) {
1187  // Determine the value to fill based on the center of the bins.
1188  // This in principle allows the binning between the correction and hist to be different
1189  fillValue[1] = fJESCorrectionHist->GetYaxis()->GetBinCenter(index);
1190  AliDebug(4,TString::Format("fillValue[1]: %f, weight: %f", fillValue[1], yBinsContent.at(index-1)));
1191  // minus 1 since loop starts at 1
1192  hist->Fill(fillValue, weight*yBinsContent.at(index-1));
1193  }
1194  }
1195  }
1196 }
1197 
1207 void AliAnalysisTaskEmcalJetHCorrelations::AccessSetOfYBinValues(TH2D * hist, Int_t xBin, std::vector <Double_t> & yBinsContent, Double_t scaleFactor)
1208 {
1209  for (Int_t index = 1; index <= hist->GetYaxis()->GetNbins(); index++)
1210  {
1211  //yBinsContent[index-1] = hist->GetBinContent(hist->GetBin(xBin,index));
1212  yBinsContent.push_back(hist->GetBinContent(hist->GetBin(xBin,index)));
1213 
1214  if (scaleFactor >= 0)
1215  {
1216  // -1 since index starts at 1
1217  hist->SetBinContent(hist->GetBin(xBin,index), yBinsContent.at(index-1)/scaleFactor);
1218  }
1219  }
1220 }
1221 
1239 {
1240  // Initialize grid connection if necessary
1241  if (filename.Contains("alien://") && !gGrid) {
1242  TGrid::Connect("alien://");
1243  }
1244 
1245  // Setup hist name if a track or cluster bias was defined.
1246  // NOTE: This can always be disabled by setting kDisableBias.
1247  // We arbitrarily add 0.1 to test since the values are doubles and cannot be
1248  // tested directly for equality. If we are still less than disable bins, then
1249  // it has been set and we should format it.
1250  // NOTE: To ensure we can disable, we don't just take the member values!
1251  // NOTE: The histBaseName will be attempted if the formatted name cannot be found.
1252  TString histBaseName = histName;
1254  histName = TString::Format("%s_Track%.2f", histName.Data(), trackBias);
1255  }
1256  if (clusterBias + 0.1 < AliAnalysisTaskEmcalJetHCorrelations::kDisableBias) {
1257  histName = TString::Format("%s_Clus%.2f", histName.Data(), clusterBias);
1258  }
1259 
1260  // Open file containing the correction
1261  TFile * jesCorrectionFile = TFile::Open(filename);
1262  if (!jesCorrectionFile || jesCorrectionFile->IsZombie()) {
1263  AliError(TString::Format("%s: Could not open JES correction file %s", GetName(), filename.Data()));
1264  return kFALSE;
1265  }
1266 
1267  // Retrieve the histogram containing the correction and safely add it to the task.
1268  TH2D * JESCorrectionHist = dynamic_cast<TH2D*>(jesCorrectionFile->Get(histName.Data()));
1269  if (JESCorrectionHist) {
1270  AliInfo(TString::Format("%s: JES correction hist name \"%s\" loaded from file %s.", GetName(), histName.Data(), filename.Data()));
1271  }
1272  else {
1273  AliError(TString::Format("%s: JES correction hist name \"%s\" not found in file %s.", GetName(), histName.Data(), filename.Data()));
1274 
1275  // Attempt the base name instead of the formatted hist name
1276  JESCorrectionHist = dynamic_cast<TH2D*>(jesCorrectionFile->Get(histBaseName.Data()));
1277  if (JESCorrectionHist) {
1278  AliInfo(TString::Format("%s: JES correction hist name \"%s\" loaded from file %s.", GetName(), histBaseName.Data(), filename.Data()));
1279  histName = histBaseName;
1280  }
1281  else
1282  {
1283  AliError(TString::Format("%s: JES correction with base hist name %s not found in file %s.", GetName(), histBaseName.Data(), filename.Data()));
1284  return kFALSE;
1285  }
1286  }
1287 
1288  // Clone to ensure that the hist is available
1289  TH2D * tempHist = static_cast<TH2D *>(JESCorrectionHist->Clone());
1290  tempHist->SetDirectory(0);
1291  SetJESCorrectionHist(tempHist);
1292 
1293  // Close file
1294  jesCorrectionFile->Close();
1295 
1296  // Append to task name for clarity
1297  // Unfortunately, this doesn't change the name of the output list (it would need to be
1298  // changed in the AnalysisManager output container), so the suffix is still important
1299  // if this correction is manually configured!
1300  TString tempName = GetName();
1301  TString tag = "_JESCorr";
1302  // Append the tag if it isn't already included
1303  if (tempName.Index(tag) == -1) {
1304  // Insert before the suffix
1305  Ssiz_t suffixLocation = tempName.Last('_');
1306  tempName.Insert(suffixLocation, tag.Data());
1307 
1308  // Set the new name
1309  AliDebug(3, TString::Format("%s: Setting task name to %s", GetName(), tempName.Data()));
1310  SetName(tempName.Data());
1311  }
1312 
1313  // Successful
1314  return kTRUE;
1315 }
1316 
1322  const char *nTracks,
1323  const char *nCaloClusters,
1324  // Jet options
1325  const Double_t trackBias,
1326  const Double_t clusterBias,
1327  // Mixed event options
1328  const Int_t nTracksMixedEvent, // Additionally acts as a switch for enabling mixed events
1329  const Int_t minNTracksMixedEvent,
1330  const Int_t minNEventsMixedEvent,
1331  const UInt_t nCentBinsMixedEvent,
1332  // Triggers
1333  UInt_t trigEvent,
1334  UInt_t mixEvent,
1335  // Options
1336  const Bool_t lessSparseAxes,
1337  const Bool_t widerTrackBin,
1338  // Corrections
1340  const Bool_t JESCorrection,
1341  const char * JESCorrectionFilename,
1342  const char * JESCorrectionHistName,
1343  const char *suffix
1344  )
1345 {
1346  // Get the pointer to the existing analysis manager via the static access method.
1347  //==============================================================================
1348  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
1349  if (!mgr)
1350  {
1351  AliErrorClass("No analysis manager to connect to.");
1352  return nullptr;
1353  }
1354 
1355  //-------------------------------------------------------
1356  // Init the task and do settings
1357  //-------------------------------------------------------
1358 
1359  // Determine cluster and track names
1360  TString trackName(nTracks);
1361  TString clusName(nCaloClusters);
1362 
1363  if (trackName == "usedefault") {
1365  }
1366 
1367  if (clusName == "usedefault") {
1369  }
1370 
1371  TString name("AliAnalysisTaskJetH");
1372  if (!trackName.IsNull()) {
1373  name += TString::Format("_%s", trackName.Data());
1374  }
1375  if (!clusName.IsNull()) {
1376  name += TString::Format("_%s", clusName.Data());
1377  }
1378  if (strcmp(suffix, "") != 0) {
1379  name += TString::Format("_%s", suffix);
1380  }
1381 
1383  // Set jet bias
1384  correlationTask->SetTrackBias(trackBias);
1385  correlationTask->SetClusterBias(clusterBias);
1386  // Mixed events
1387  correlationTask->SetEventMixing(static_cast<Bool_t>(nTracksMixedEvent));
1388  correlationTask->SetNumberOfMixingTracks(nTracksMixedEvent);
1389  correlationTask->SetMinNTracksForMixedEvents(minNTracksMixedEvent);
1390  correlationTask->SetMinNEventsForMixedEvents(minNEventsMixedEvent);
1391  correlationTask->SetNCentBinsMixedEvent(nCentBinsMixedEvent);
1392  // Triggers
1393  correlationTask->SetTriggerType(trigEvent);
1394  correlationTask->SetMixedEventTriggerType(mixEvent);
1395  // Options
1396  correlationTask->SetNCentBins(5);
1397  correlationTask->SetVzRange(-10,10);
1398  correlationTask->SetDoLessSparseAxes(lessSparseAxes);
1399  correlationTask->SetDoWiderTrackBin(widerTrackBin);
1400  // Corrections
1401  correlationTask->SetSingleTrackEfficiencyType(singleTrackEfficiency);
1402  if (JESCorrection == kTRUE)
1403  {
1404  Bool_t result = correlationTask->RetrieveAndInitializeJESCorrectionHist(JESCorrectionFilename, JESCorrectionHistName, correlationTask->GetTrackBias(), correlationTask->GetClusterBias());
1405  if (!result) {
1406  AliErrorClass("Failed to successfully retrieve and initialize the JES correction! Task initialization continuing without JES correction (can be set manually later).");
1407  }
1408  }
1409 
1410  //-------------------------------------------------------
1411  // Final settings, pass to manager and set the containers
1412  //-------------------------------------------------------
1413 
1414  mgr->AddTask(correlationTask);
1415 
1416  // Create containers for input/output
1417  mgr->ConnectInput (correlationTask, 0, mgr->GetCommonInputContainer() );
1418  AliAnalysisDataContainer * cojeth = mgr->CreateContainer(correlationTask->GetName(),
1419  TList::Class(),
1420  AliAnalysisManager::kOutputContainer,
1421  Form("%s", AliAnalysisManager::GetCommonFileName()));
1422  mgr->ConnectOutput(correlationTask, 1, cojeth);
1423 
1424  return correlationTask;
1425 }
1426 
1433  std::string clusName,
1434  const double jetConstituentPtCut,
1435  const double trackEta,
1436  const double jetRadius)
1437 {
1438  bool returnValue = false;
1439  AliInfoStream() << "Configuring Jet-H Correlations task for a standard analysis.\n";
1440 
1441  // Add Containers
1442  // Clusters
1443  if (clusName == "usedefault") {
1445  }
1446  // For jet finding
1447  AliClusterContainer * clustersForJets = new AliClusterContainer(clusName.c_str());
1448  clustersForJets->SetName("clustersForJets");
1449  clustersForJets->SetMinE(jetConstituentPtCut);
1450 
1451  // Tracks
1452  // For jet finding
1453  if (trackName == "usedefault") {
1455  }
1456  AliParticleContainer * particlesForJets = CreateParticleOrTrackContainer(trackName.c_str());
1457  particlesForJets->SetName("particlesForJets");
1458  particlesForJets->SetMinPt(jetConstituentPtCut);
1459  particlesForJets->SetEtaLimits(-1.0*trackEta, trackEta);
1460  // Don't need to adopt the container - we'll just use it to find the right jet collection
1461  // For correlations
1462  AliParticleContainer * particlesForCorrelations = CreateParticleOrTrackContainer(trackName.c_str());
1463  if (particlesForCorrelations)
1464  {
1465  particlesForCorrelations->SetName("tracksForCorrelations");
1466  particlesForCorrelations->SetMinPt(0.15);
1467  particlesForCorrelations->SetEtaLimits(-1.0*trackEta, trackEta);
1468  // Adopt the container
1469  this->AdoptParticleContainer(particlesForCorrelations);
1470  }
1471  else {
1472  AliWarningStream() << "No particle container was successfully created!\n";
1473  }
1474 
1475  // Jets
1479  jetRadius,
1481  particlesForJets,
1482  clustersForJets);
1483  // 0.6 * jet area
1484  jetContainer->SetJetAreaCut(jetRadius * jetRadius * TMath::Pi() * 0.6);
1485  jetContainer->SetMaxTrackPt(100);
1486  jetContainer->SetJetPtCut(0.1);
1487 
1488  // Successfully configured
1489  returnValue = true;
1490 
1491  return returnValue;
1492 }
1493 
1500  std::string clusName,
1501  const double jetConstituentPtCut,
1502  const double trackEta,
1503  const double jetRadius,
1504  const std::string & jetTag,
1505  const std::string & correlationsTracksCutsPeriod)
1506 {
1507  bool returnValue = false;
1508  AliInfoStream() << "Configuring Jet-H Correlations task for an embedding analysis.\n";
1509 
1510  // Set the task to know it that is embedded
1511  this->SetIsEmbedded(true);
1512 
1513  // Add Containers
1514  // Clusters
1515  if (clusName == "usedefault") {
1517  }
1518  // For jet finding
1519  AliClusterContainer * clustersForJets = new AliClusterContainer(clusName.c_str());
1520  clustersForJets->SetName("clustersForJets");
1521  clustersForJets->SetMinE(jetConstituentPtCut);
1522  // We need the combined clusters, which should be available in the internal event.
1523  // However, we don't need to adopt the container - we'll just use it to find the right jet collection
1524  // For correlations
1525  /*AliClusterContainer * clustersforCorrelations = new AliClusterContainer("usedefault");
1526  clustersForCorrelations->SetName("clustersForCorrelations");
1527  clustersForCorrelations->SetMinE(0.30);
1528  clustersForCorrelations->SetIsEmbedding(true);
1529  this->AdoptClusterContainer(clustersForCorrelations);*/
1530 
1531  // Tracks
1532  // For jet finding
1533  if (trackName == "usedefault") {
1535  }
1536  AliParticleContainer * particlesForJets = CreateParticleOrTrackContainer(trackName.c_str());
1537  particlesForJets->SetName("particlesForJets");
1538  particlesForJets->SetMinPt(jetConstituentPtCut);
1539  particlesForJets->SetEtaLimits(-1.0*trackEta, trackEta);
1540  // Don't need to adopt the container - we'll just use it to find the right jet collection
1541  // For correlations
1542  AliParticleContainer * particlesForCorrelations = CreateParticleOrTrackContainer(trackName.c_str());
1543  // Ensure that we don't operate on a null pointer
1544  if (particlesForCorrelations)
1545  {
1546  particlesForCorrelations->SetName("tracksForCorrelations");
1547  particlesForCorrelations->SetMinPt(0.15);
1548  particlesForCorrelations->SetEtaLimits(-1.0*trackEta, trackEta);
1549  particlesForCorrelations->SetIsEmbedding(true);
1550  AliTrackContainer * trackCont = dynamic_cast<AliTrackContainer *>(particlesForCorrelations);
1551  if (trackCont) {
1552  // This option only exists for track containers
1553  trackCont->SetTrackCutsPeriod(correlationsTracksCutsPeriod.c_str());
1554  }
1555  // Adopt the container
1556  this->AdoptParticleContainer(particlesForCorrelations);
1557  }
1558  else {
1559  AliWarningStream() << "No particle container was successfully created!\n";
1560  }
1561 
1562  // Jets
1563  // The tag "hybridLevelJets" is defined in the jet finder
1567  jetRadius,
1569  particlesForJets,
1570  clustersForJets,
1571  jetTag);
1572  // 0.6 * jet area
1573  jetContainer->SetJetAreaCut(jetRadius * jetRadius * TMath::Pi() * 0.6);
1574  jetContainer->SetMaxTrackPt(100);
1575  jetContainer->SetJetPtCut(0.1);
1576 
1577  // Successfully configured
1578  returnValue = true;
1579 
1580  return returnValue;
1581 }
1582 
1591 {
1592  AliParticleContainer * partCont = 0;
1594  AliTrackContainer * trackCont = new AliTrackContainer(collectionName.c_str());
1595  partCont = trackCont;
1596  }
1597  else if (collectionName != "") {
1598  partCont = new AliParticleContainer(collectionName.c_str());
1599  }
1600 
1601  return partCont;
1602 }
1603 
1604 } /* namespace EMCALJetTasks */
1605 } /* namespace PWGJE */
bool CheckArtificialTrackEfficiency(unsigned int trackIndex, std::vector< unsigned int > &rejectedTrackIndices, bool useRejectedList)
Bool_t fNoMixedEventJESCorrection
True if the jet energy scale correction should be applied to mixed event histograms.
void AccessSetOfYBinValues(TH2D *hist, Int_t xBin, std::vector< Double_t > &yBinsContent, Double_t scaleFactor=-1.0)
bool ConfigureForEmbeddingAnalysis(std::string trackName="usedefault", std::string clusName="caloClustersCombined", const double jetConstituentPtCut=3, const double trackEta=0.8, const double jetRadius=0.2, const std::string &jetTag="hybridLevelJets", const std::string &correlationsTracksCutsPeriod="lhc11a")
const char * filename
Definition: TestFCM.C:1
void SetTrackCutsPeriod(const char *period)
double Double_t
Definition: External.C:58
static Double_t DeltaPhi(Double_t phia, Double_t phib, Double_t rMin=-TMath::Pi()/2, Double_t rMax=3 *TMath::Pi()/2)
Definition: External.C:236
Int_t GetNTracks() const
const char * title
Definition: MakeQAPdf.C:27
bool CheckForMatchedJet(AliJetContainer *jets, AliEmcalJet *jet, const std::string &histName)
AliEmcalJet * ClosestJet() const
Definition: AliEmcalJet.h:327
AliJetContainer * GetJetContainer(Int_t i=0) const
Double_t ClosestJetDistance() const
Definition: AliEmcalJet.h:328
void AdoptParticleContainer(AliParticleContainer *cont)
TH2D * fJESCorrectionHist
Histogram containing the jet energy scale correction.
Container with name, TClonesArray and cuts for particles.
Declaration of class AliTLorentzVector.
TH1 * fHistJetPtBias[6]
! Jet pt spectrum of jets which meet the constituent bias criteria (the array corresponds to centrali...
Double_t fEPV0
!event plane V0
Bool_t fGeneralHistograms
whether or not it should fill some general histograms
Declaration of class AliAnalysisTaskEmcalEmbeddingHelper.
TCanvas * c
Definition: TestFitELoss.C:172
Bool_t fDoLessSparseAxes
True if there should be fewer THnSparse axes.
AliJetContainer * AddJetContainer(const char *n, TString defaultCutType, Float_t jetRadius=0.4)
Int_t fCentBin
!event centrality bin
Double_t fMaxMatchedJetDistance
Maximum distance between two matched jets.
Bool_t fDoWiderTrackBin
True if the track pt bins in the THnSparse should be wider.
virtual Double_t Pt() const
UInt_t fTriggerType
Event selection for jets (ie triggered events).
TRandom * gRandom
bool ConfigureForStandardAnalysis(std::string trackName="usedefault", std::string clusName="usedefault", const double jetConstituentPtCut=3, const double trackEta=0.8, const double jetRadius=0.2)
virtual Double_t Eta() const
Container for particles within the EMCAL framework.
TObjArray * CloneAndReduceTrackList(std::vector< unsigned int > &rejectedTrackIndices, const bool useRejectedList)
Bool_t fIsEmbedded
trigger, embedded signal
AliParticleContainer * CreateParticleOrTrackContainer(const std::string &collectionName) const
BeamType
Switch for the beam type.
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Get particle container attached to this task.
AliEmcalJet * GetLeadingJet(const char *opt="")
virtual THnSparse * NewTHnSparseF(const char *name, UInt_t entries)
int Int_t
Definition: External.C:63
void SetJetPtCut(Float_t cut)
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
static AliAnalysisTaskEmcalJetHCorrelations * AddTaskEmcalJetHCorrelations(const char *nTracks="usedefault", const char *nCaloClusters="usedefault", const Double_t trackBias=5, const Double_t clusterBias=5, const Int_t nTracksMixedEvent=0, const Int_t minNTracksMixedEvent=5000, const Int_t minNEventsMixedEvent=5, const UInt_t nCentBinsMixedEvent=10, UInt_t trigEvent=AliVEvent::kAny, UInt_t mixEvent=AliVEvent::kAny, const Bool_t lessSparseAxes=kFALSE, const Bool_t widerTrackBin=kFALSE, const AliAnalysisTaskEmcalJetHCorrelations::ESingleTrackEfficiency_t singleTrackEfficiency=AliAnalysisTaskEmcalJetHCorrelations::kEffDisable, const Bool_t JESCorrection=kFALSE, const char *JESCorrectionFilename="alien:///alice/cern.ch/user/r/rehlersi/JESCorrection.root", const char *JESCorrectionHistName="JESCorrection", const char *suffix="biased")
Int_t GetNJets() const
TString toString() const
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
BeamType fForceBeamType
forced beam type
Definition: External.C:228
Double_t MaxTrackPt() const
Definition: AliEmcalJet.h:155
void FillHist(TH1 *hist, Double_t fillValue, Double_t weight=1.0, Bool_t noCorrection=kFALSE)
BeamType fBeamType
!event beam type
Double_t fCent
!event centrality
Bool_t RetrieveAndInitializeJESCorrectionHist(TString filename, TString histName, Double_t trackBias=AliAnalysisTaskEmcalJetHCorrelations::kDisableBias, Double_t clusterBias=AliAnalysisTaskEmcalJetHCorrelations::kDisableBias)
Double_t EffCorrection(Double_t trkETA, Double_t trkPT, AliAnalysisTaskEmcal::BeamType beamType) const
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
static double RelativeEPAngle(double jetAngle, double epAngle)
Double_t fMinSharedMomentumFraction
Minimum shared momentum with matched jet.
Bool_t fRequireMatchedJetWhenEmbedding
True if jets are required to be matched (ie. jet->MatchedJet() != nullptr)
static Double_t * GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
AliEmcalList * fOutput
!output list
TH2 * fHistTrackEtaPhi[7]
! Track eta-phi distribution (the array corresponds to track pt)
TH1 * fHistJetPt[6]
! Jet pt spectrum (the array corresponds to centrality bins)
Double_t fVertex[3]
!event vertex
Bool_t fDisableFastPartition
True if task should be disabled for the fast partition, where the EMCal is not included.
AliTrackContainer * GetTrackContainer(Int_t i=0) const
TH1 * fHistEventRejection
!book keep reasons for rejecting event
void SetMakeGeneralHistograms(Bool_t g)
Base task in the EMCAL jet framework.
Double_t MaxClusterPt() const
Definition: AliEmcalJet.h:154
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
void ExecOnce()
Perform steps needed to initialize the analysis.
static std::string DetermineUseDefaultName(InputObject_t objType)
Double_t GetFractionSharedPt(const AliEmcalJet *jet, AliParticleContainer *cont2=0x0) const
const AliTrackIterableMomentumContainer accepted_momentum() const
TH2 * fHistJetHEtaPhi
! Eta-phi distribution of jets which are in jet-hadron correlations
void GetDeltaEtaDeltaPhiDeltaR(AliTLorentzVector &particleOne, AliVParticle *particleTwo, Double_t &deltaEta, Double_t &deltaPhi, Double_t &deltaR)
! Auto configure the single track efficiency based on the beam type, centrality, and run quality (num...
void UserCreateOutputObjects()
Main initialization function on the worker.
ESingleTrackEfficiency_t fSingleTrackEfficiencyCorrectionType
Control the efficiency correction. See EffCorrection() for meaning of values.
const Double_t pi
const Int_t nbins
const AliJetIterableContainer accepted() const
bool Bool_t
Definition: External.C:53
Jet-hadron correlations analysis task for central Pb-Pb and pp.
void SetMaxTrackPt(Float_t b)
virtual Double_t Phi() const
Container structure for EMCAL clusters.
EMCal fiducial acceptance (each eta, phi edge narrowed by jet R)
Definition: AliEmcalJet.h:70
! Arbitrarily large value which can be used to disable the constituent bias. Can be used for either t...
virtual void GetDimParams(Int_t iEntry, TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax)
Container for jet within the EMCAL jet framework.
bool fRequireMatchedPartLevelJet
True if matched jets are required to be matched to a particle level jet.
Definition: External.C:196
Double_t fArtificialTrackInefficiency
Artificial track inefficiency. Enabled if < 1.0.
void SetJetAreaCut(Float_t cut)
static const AliAnalysisTaskEmcalEmbeddingHelper * GetInstance()