AliPhysics  aaf9c62 (aaf9c62)
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[kMixedEventMultiplicityBins+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  // Adjust for pp, since we are retrieving multiplicity instead
803  label = "Multiplicity";
804  xmax = 200.;
805  }
806  break;
807 
808  case 1:
809  label = "Jet p_{T}";
810  nbins = 20;
811  xmin = 0.;
812  xmax = 200.;
813  break;
814 
815  case 2:
816  if(fDoWiderTrackBin) {
817  label = "Track p_{T}";
818  nbins = 40;
819  xmin = 0.;
820  xmax = 10.;
821  } else {
822  label = "Track p_{T}";
823  nbins = 100;
824  xmin = 0.;
825  xmax = 10;
826  }
827  break;
828 
829  case 3:
830  label = "#Delta#eta";
831  nbins = 24;
832  xmin = -1.2;
833  xmax = 1.2;
834  break;
835 
836  case 4:
837  label = "#Delta#phi";
838  nbins = 72;
839  xmin = -0.5*pi;
840  xmax = 1.5*pi;
841  break;
842 
843  case 5:
844  label = "Leading Jet";
845  nbins = 3;
846  xmin = -0.5;
847  xmax = 2.5;
848  break;
849 
850  case 6:
851  label = "Trigger track";
852  nbins = 10;
853  xmin = 0;
854  xmax = 50;
855  break;
856 
857  case 7:
858  label = "deltaR";
859  nbins = 10;
860  xmin = 0.;
861  xmax = 5.0;
862  break;
863 
864  case 8:
865  label = "Leading track";
866  nbins = 20;
867  xmin = 0;
868  xmax = 50;
869  break;
870 
871  case 9:
872  label = "Event plane angle";
873  nbins = 3;
874  xmin = 0;
875  xmax = TMath::Pi()/2.;
876  break;
877  }
878 }
879 
887 TObjArray* AliAnalysisTaskEmcalJetHCorrelations::CloneAndReduceTrackList(std::vector<unsigned int> & rejectedTrackIndices, const bool useRejectedList)
888 {
889  // clones a track list by using AliBasicTrack which uses much less memory (used for event mixing)
890  TObjArray* tracksClone = new TObjArray;
891  tracksClone->SetOwner(kTRUE);
892 
893  // Loop over all tracks
894  AliVParticle * particle = 0;
895  AliBasicParticle * clone = 0;
896  AliTrackContainer * tracks = GetTrackContainer("tracksForCorrelations");
897 
898  auto particlesIter = tracks->accepted_momentum();
899  for (auto particleIter = particlesIter.begin(); particleIter != particlesIter.end(); particleIter++)
900  {
901  // Retrieve the particle
902  particle = particleIter->second;
903 
904  // Artificial inefficiency
905  bool rejectParticle = CheckArtificialTrackEfficiency(particleIter.current_index(), rejectedTrackIndices, useRejectedList);
906  if (rejectParticle) {
907  AliDebugStream(4) << "Track rejected in CloneAndReduceTrackList()\n";
908  continue;
909  }
910 
911  // Fill some QA information about the tracks
912  Int_t trackPtBin = GetTrackPtBin(particle->Pt());
913  if(trackPtBin > -1) fHistTrackEtaPhi[trackPtBin]->Fill(particle->Eta(),particle->Phi());
914 
915  // Create new particle
916  clone = new AliBasicParticle(particle->Eta(), particle->Phi(), particle->Pt(), particle->Charge());
917  // Set so that we can do comparisons using the IsEqual() function.
918  clone->SetUniqueID(particle->GetUniqueID());
919 
920  tracksClone->Add(clone);
921  }
922 
923  return tracksClone;
924 }
925 
937  return EffCorrection(trackETA, trackPT, fBeamType);
938 }
939 
956 {
957  // default (current) parameters
958  // x-variable = track pt, y-variable = track eta
959  Double_t x = trackPT;
960  Double_t y = trackETA;
961  double etaaxis = 0;
962  double ptaxis = 0;
963 
964  // Efficiency paramaters
965  double TRefficiency = -1;
966  int effSwitch = 1;
967 
969  if (beamType == AliAnalysisTaskEmcal::kAA) {
970  // Setup for Pb--Pb
971  int runQuality = -1;
972  // Semi-Good OROC C08 Runlists
973  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;
974 
975  // Good Runlists
976  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;
977 
978  // Determine which efficiency to use.
979  // This is just a way to map all possible values of the cent bin and runQuality to a unique flag.
980  // 4 is the number of cent bins, and we want to index the effSwitch starting at 2.
981  if (runQuality != -1) {
982  effSwitch = 2 + runQuality*4 + fCentBin;
983  }
984  }
985  else if (beamType == AliAnalysisTaskEmcal::kpA) {
986  // pA
987  AliErrorStream() << "Single track efficiency for pA is not available.\n";
988  return 0;
989  }
990  else if (beamType == AliAnalysisTaskEmcal::kpp) {
991  // Setup for pp
992  effSwitch = 10;
993  }
994  else {
995  AliErrorStream() << "Beam type " << fBeamType << " is not defined\n";
996  return 0;
997  }
998  }
1000  // Manually set to pp (for example, during embedding)
1001  effSwitch = 10;
1002  }
1004  // Use the default value, which is to have a constant efficiency of 1
1005  effSwitch = 1;
1006  }
1007  else {
1008  AliErrorStream() << "Single track efficiency correction type " << fSingleTrackEfficiencyCorrectionType << " is not recongized!\n";
1009  }
1010 
1011  AliDebugStream(5) << "Using efficiency switch value of " << effSwitch << "\n";
1012 
1013  switch(effSwitch) {
1014  case 1 :
1015  // first switch value - TRefficiency not used so = 1
1016  // In this case, the run number isn't in any run list, so efficiency = 1
1017  TRefficiency = 1.0;
1018  break;
1019 
1020  case 2 :
1021  // Parameter values for Semi-GOOD TPC (LHC11h) runs (0-10%):
1022  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);
1023  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])));
1024  TRefficiency = ptaxis*etaaxis;
1025  break;
1026 
1027  case 3 :
1028  // Parameter values for Semi-GOOD TPC (LHC11h) runs (10-30%):
1029  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);
1030  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])));
1031  TRefficiency = ptaxis*etaaxis;
1032  break;
1033 
1034  case 4 :
1035  // Parameter values for Semi-GOOD TPC (LHC11h) runs (30-50%):
1036  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);
1037  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])));
1038  TRefficiency = ptaxis*etaaxis;
1039  break;
1040 
1041  case 5 :
1042  // Parameter values for Semi-GOOD TPC (LHC11h) runs (50-90%):
1043  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);
1044  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])));
1045  TRefficiency = ptaxis*etaaxis;
1046  break;
1047 
1048  case 6 :
1049  // Parameter values for GOOD TPC (LHC11h) runs (0-10%):
1050  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);
1051  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])));
1052  TRefficiency = ptaxis*etaaxis;
1053  break;
1054 
1055  case 7 :
1056  // Parameter values for GOOD TPC (LHC11h) runs (10-30%):
1057  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);
1058  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])));
1059  TRefficiency = ptaxis*etaaxis;
1060  break;
1061 
1062  case 8 :
1063  // Parameter values for GOOD TPC (LHC11h) runs (30-50%):
1064  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);
1065  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])));
1066  TRefficiency = ptaxis*etaaxis;
1067  break;
1068 
1069  case 9 :
1070  // Parameter values for GOOD TPC (LHC11h) runs (50-90%):
1071  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);
1072  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])));
1073  TRefficiency = ptaxis*etaaxis;
1074  break;
1075 
1076  case 10 :
1077  {
1078  // Track efficiency for pp
1079  // Calculated using LHC12f1a. See analysis note for more details!
1080  // If the trackPt > 6 GeV, then all we need is this coefficient
1081  Double_t coefficient = 0.898052; // p6
1082  if (trackPT < 6) {
1083  coefficient = (1 + -0.442232 * trackPT // p0
1084  + 0.501831 * std::pow(trackPT, 2) // p1
1085  + -0.252024 * std::pow(trackPT, 3) // p2
1086  + 0.062964 * std::pow(trackPT, 4) // p3
1087  + -0.007681 * std::pow(trackPT, 5) // p4
1088  + 0.000365 * std::pow(trackPT, 6)); // p5
1089  }
1090 
1091  // Calculate track eff
1092  TRefficiency = coefficient * (1 + 0.402825 * std::abs(trackETA) // p7
1093  + -2.213152 * std::pow(trackETA, 2) // p8
1094  + 4.311098 * std::abs(std::pow(trackETA, 3)) // p9
1095  + -2.778200 * std::pow(trackETA, 4)); // p10
1096  break;
1097  }
1098 
1099  default :
1100  // no Efficiency Switch option selected.. therefore don't correct, and set eff = 1
1101  // ie. The efficiency correction is disabled.
1102  AliErrorStream() << "No single track efficiency setting selected! Please select one.\n";
1103  TRefficiency = 0.;
1104  }
1105 
1106  return TRefficiency;
1107 }
1108 
1118 void AliAnalysisTaskEmcalJetHCorrelations::FillHist(TH1 * hist, Double_t fillValue, Double_t weight, Bool_t noCorrection)
1119 {
1120  if (fJESCorrectionHist == 0 || noCorrection == kTRUE)
1121  {
1122  AliDebugStream(3) << GetName() << ":" << hist->GetName() << ": " << std::boolalpha << "Using normal weights: JESHist: " << (fJESCorrectionHist ? fJESCorrectionHist->GetName() : "Null") << ", noCorrection: " << noCorrection << std::endl;
1123  hist->Fill(fillValue, weight);
1124  }
1125  else
1126  {
1127  // Determine where to get the values in the correction hist
1128  Int_t xBin = fJESCorrectionHist->GetXaxis()->FindBin(fillValue);
1129 
1130  std::vector <Double_t> yBinsContent;
1131  AliDebug(3, TString::Format("%s: Attempt to access weights from JES correction hist %s with jet pt %f!", GetName(), hist->GetName(), fillValue));
1132  AccessSetOfYBinValues(fJESCorrectionHist, xBin, yBinsContent);
1133  AliDebug(3, TString::Format("weights size: %zd", yBinsContent.size()));
1134 
1135  // Loop over all possible bins to contribute.
1136  // If content is 0 then calling Fill won't make a difference
1137  for (Int_t index = 1; index <= fJESCorrectionHist->GetYaxis()->GetNbins(); index++)
1138  {
1139  // Don't bother trying to fill in the weight is 0
1140  if (yBinsContent.at(index-1) > 0) {
1141  // Determine the value to fill based on the center of the bins.
1142  // This in principle allows the binning between the correction and hist to be different
1143  Double_t fillLocation = fJESCorrectionHist->GetYaxis()->GetBinCenter(index);
1144  AliDebug(4, TString::Format("fillLocation: %f, weight: %f", fillLocation, yBinsContent.at(index-1)));
1145  // minus 1 since loop starts at 1
1146  hist->Fill(fillLocation, weight*yBinsContent.at(index-1));
1147  }
1148  }
1149 
1150  //TEMP
1151  //hist->Draw();
1152  //END TEMP
1153  }
1154 }
1155 
1166 void AliAnalysisTaskEmcalJetHCorrelations::FillHist(THnSparse * hist, Double_t *fillValue, Double_t weight, Bool_t noCorrection)
1167 {
1168  if (fJESCorrectionHist == 0 || noCorrection == kTRUE)
1169  {
1170  AliDebugStream(3) << GetName() << ":" << hist->GetName() << ": " << std::boolalpha << "Using normal weights: JESHist: " << (fJESCorrectionHist ? fJESCorrectionHist->GetName() : "Null") << ", noCorrection: " << noCorrection << std::endl;
1171  hist->Fill(fillValue, weight);
1172  }
1173  else
1174  {
1175  // Jet pt is always located in the second position
1176  Double_t jetPt = fillValue[1];
1177 
1178  // Determine where to get the values in the correction hist
1179  Int_t xBin = fJESCorrectionHist->GetXaxis()->FindBin(jetPt);
1180 
1181  std::vector <Double_t> yBinsContent;
1182  AliDebug(3, TString::Format("%s: Attempt to access weights from JES correction hist %s with jet pt %f!", GetName(), hist->GetName(), jetPt));
1183  AccessSetOfYBinValues(fJESCorrectionHist, xBin, yBinsContent);
1184  AliDebug(3, TString::Format("weights size: %zd", yBinsContent.size()));
1185 
1186  // Loop over all possible bins to contribute.
1187  // If content is 0 then calling Fill won't make a difference
1188  for (Int_t index = 1; index <= fJESCorrectionHist->GetYaxis()->GetNbins(); index++)
1189  {
1190  // Don't bother trying to fill in the weight is 0
1191  if (yBinsContent.at(index-1) > 0) {
1192  // Determine the value to fill based on the center of the bins.
1193  // This in principle allows the binning between the correction and hist to be different
1194  fillValue[1] = fJESCorrectionHist->GetYaxis()->GetBinCenter(index);
1195  AliDebug(4,TString::Format("fillValue[1]: %f, weight: %f", fillValue[1], yBinsContent.at(index-1)));
1196  // minus 1 since loop starts at 1
1197  hist->Fill(fillValue, weight*yBinsContent.at(index-1));
1198  }
1199  }
1200  }
1201 }
1202 
1212 void AliAnalysisTaskEmcalJetHCorrelations::AccessSetOfYBinValues(TH2D * hist, Int_t xBin, std::vector <Double_t> & yBinsContent, Double_t scaleFactor)
1213 {
1214  for (Int_t index = 1; index <= hist->GetYaxis()->GetNbins(); index++)
1215  {
1216  //yBinsContent[index-1] = hist->GetBinContent(hist->GetBin(xBin,index));
1217  yBinsContent.push_back(hist->GetBinContent(hist->GetBin(xBin,index)));
1218 
1219  if (scaleFactor >= 0)
1220  {
1221  // -1 since index starts at 1
1222  hist->SetBinContent(hist->GetBin(xBin,index), yBinsContent.at(index-1)/scaleFactor);
1223  }
1224  }
1225 }
1226 
1244 {
1245  // Initialize grid connection if necessary
1246  if (filename.Contains("alien://") && !gGrid) {
1247  TGrid::Connect("alien://");
1248  }
1249 
1250  // Setup hist name if a track or cluster bias was defined.
1251  // NOTE: This can always be disabled by setting kDisableBias.
1252  // We arbitrarily add 0.1 to test since the values are doubles and cannot be
1253  // tested directly for equality. If we are still less than disable bins, then
1254  // it has been set and we should format it.
1255  // NOTE: To ensure we can disable, we don't just take the member values!
1256  // NOTE: The histBaseName will be attempted if the formatted name cannot be found.
1257  TString histBaseName = histName;
1259  histName = TString::Format("%s_Track%.2f", histName.Data(), trackBias);
1260  }
1261  if (clusterBias + 0.1 < AliAnalysisTaskEmcalJetHCorrelations::kDisableBias) {
1262  histName = TString::Format("%s_Clus%.2f", histName.Data(), clusterBias);
1263  }
1264 
1265  // Open file containing the correction
1266  TFile * jesCorrectionFile = TFile::Open(filename);
1267  if (!jesCorrectionFile || jesCorrectionFile->IsZombie()) {
1268  AliError(TString::Format("%s: Could not open JES correction file %s", GetName(), filename.Data()));
1269  return kFALSE;
1270  }
1271 
1272  // Retrieve the histogram containing the correction and safely add it to the task.
1273  TH2D * JESCorrectionHist = dynamic_cast<TH2D*>(jesCorrectionFile->Get(histName.Data()));
1274  if (JESCorrectionHist) {
1275  AliInfo(TString::Format("%s: JES correction hist name \"%s\" loaded from file %s.", GetName(), histName.Data(), filename.Data()));
1276  }
1277  else {
1278  AliError(TString::Format("%s: JES correction hist name \"%s\" not found in file %s.", GetName(), histName.Data(), filename.Data()));
1279 
1280  // Attempt the base name instead of the formatted hist name
1281  JESCorrectionHist = dynamic_cast<TH2D*>(jesCorrectionFile->Get(histBaseName.Data()));
1282  if (JESCorrectionHist) {
1283  AliInfo(TString::Format("%s: JES correction hist name \"%s\" loaded from file %s.", GetName(), histBaseName.Data(), filename.Data()));
1284  histName = histBaseName;
1285  }
1286  else
1287  {
1288  AliError(TString::Format("%s: JES correction with base hist name %s not found in file %s.", GetName(), histBaseName.Data(), filename.Data()));
1289  return kFALSE;
1290  }
1291  }
1292 
1293  // Clone to ensure that the hist is available
1294  TH2D * tempHist = static_cast<TH2D *>(JESCorrectionHist->Clone());
1295  tempHist->SetDirectory(0);
1296  SetJESCorrectionHist(tempHist);
1297 
1298  // Close file
1299  jesCorrectionFile->Close();
1300 
1301  // Append to task name for clarity
1302  // Unfortunately, this doesn't change the name of the output list (it would need to be
1303  // changed in the AnalysisManager output container), so the suffix is still important
1304  // if this correction is manually configured!
1305  TString tempName = GetName();
1306  TString tag = "_JESCorr";
1307  // Append the tag if it isn't already included
1308  if (tempName.Index(tag) == -1) {
1309  // Insert before the suffix
1310  Ssiz_t suffixLocation = tempName.Last('_');
1311  tempName.Insert(suffixLocation, tag.Data());
1312 
1313  // Set the new name
1314  AliDebug(3, TString::Format("%s: Setting task name to %s", GetName(), tempName.Data()));
1315  SetName(tempName.Data());
1316  }
1317 
1318  // Successful
1319  return kTRUE;
1320 }
1321 
1327  const char *nTracks,
1328  const char *nCaloClusters,
1329  // Jet options
1330  const Double_t trackBias,
1331  const Double_t clusterBias,
1332  // Mixed event options
1333  const Int_t nTracksMixedEvent, // Additionally acts as a switch for enabling mixed events
1334  const Int_t minNTracksMixedEvent,
1335  const Int_t minNEventsMixedEvent,
1336  const UInt_t nCentBinsMixedEvent,
1337  // Triggers
1338  UInt_t trigEvent,
1339  UInt_t mixEvent,
1340  // Options
1341  const Bool_t lessSparseAxes,
1342  const Bool_t widerTrackBin,
1343  // Corrections
1345  const Bool_t JESCorrection,
1346  const char * JESCorrectionFilename,
1347  const char * JESCorrectionHistName,
1348  const char *suffix
1349  )
1350 {
1351  // Get the pointer to the existing analysis manager via the static access method.
1352  //==============================================================================
1353  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
1354  if (!mgr)
1355  {
1356  AliErrorClass("No analysis manager to connect to.");
1357  return nullptr;
1358  }
1359 
1360  //-------------------------------------------------------
1361  // Init the task and do settings
1362  //-------------------------------------------------------
1363 
1364  // Determine cluster and track names
1365  TString trackName(nTracks);
1366  TString clusName(nCaloClusters);
1367 
1368  if (trackName == "usedefault") {
1370  }
1371 
1372  if (clusName == "usedefault") {
1374  }
1375 
1376  TString name("AliAnalysisTaskJetH");
1377  if (!trackName.IsNull()) {
1378  name += TString::Format("_%s", trackName.Data());
1379  }
1380  if (!clusName.IsNull()) {
1381  name += TString::Format("_%s", clusName.Data());
1382  }
1383  if (strcmp(suffix, "") != 0) {
1384  name += TString::Format("_%s", suffix);
1385  }
1386 
1388  // Set jet bias
1389  correlationTask->SetTrackBias(trackBias);
1390  correlationTask->SetClusterBias(clusterBias);
1391  // Mixed events
1392  correlationTask->SetEventMixing(static_cast<Bool_t>(nTracksMixedEvent));
1393  correlationTask->SetNumberOfMixingTracks(nTracksMixedEvent);
1394  correlationTask->SetMinNTracksForMixedEvents(minNTracksMixedEvent);
1395  correlationTask->SetMinNEventsForMixedEvents(minNEventsMixedEvent);
1396  correlationTask->SetNCentBinsMixedEvent(nCentBinsMixedEvent);
1397  // Triggers
1398  correlationTask->SetTriggerType(trigEvent);
1399  correlationTask->SetMixedEventTriggerType(mixEvent);
1400  // Options
1401  correlationTask->SetNCentBins(5);
1402  correlationTask->SetVzRange(-10,10);
1403  correlationTask->SetDoLessSparseAxes(lessSparseAxes);
1404  correlationTask->SetDoWiderTrackBin(widerTrackBin);
1405  // Corrections
1406  correlationTask->SetSingleTrackEfficiencyType(singleTrackEfficiency);
1407  if (JESCorrection == kTRUE)
1408  {
1409  Bool_t result = correlationTask->RetrieveAndInitializeJESCorrectionHist(JESCorrectionFilename, JESCorrectionHistName, correlationTask->GetTrackBias(), correlationTask->GetClusterBias());
1410  if (!result) {
1411  AliErrorClass("Failed to successfully retrieve and initialize the JES correction! Task initialization continuing without JES correction (can be set manually later).");
1412  }
1413  }
1414 
1415  //-------------------------------------------------------
1416  // Final settings, pass to manager and set the containers
1417  //-------------------------------------------------------
1418 
1419  mgr->AddTask(correlationTask);
1420 
1421  // Create containers for input/output
1422  mgr->ConnectInput (correlationTask, 0, mgr->GetCommonInputContainer() );
1423  AliAnalysisDataContainer * cojeth = mgr->CreateContainer(correlationTask->GetName(),
1424  TList::Class(),
1425  AliAnalysisManager::kOutputContainer,
1426  Form("%s", AliAnalysisManager::GetCommonFileName()));
1427  mgr->ConnectOutput(correlationTask, 1, cojeth);
1428 
1429  return correlationTask;
1430 }
1431 
1438  std::string clusName,
1439  const double jetConstituentPtCut,
1440  const double trackEta,
1441  const double jetRadius)
1442 {
1443  bool returnValue = false;
1444  AliInfoStream() << "Configuring Jet-H Correlations task for a standard analysis.\n";
1445 
1446  // Add Containers
1447  // Clusters
1448  if (clusName == "usedefault") {
1450  }
1451  // For jet finding
1452  AliClusterContainer * clustersForJets = new AliClusterContainer(clusName.c_str());
1453  clustersForJets->SetName("clustersForJets");
1454  clustersForJets->SetMinE(jetConstituentPtCut);
1455 
1456  // Tracks
1457  // For jet finding
1458  if (trackName == "usedefault") {
1460  }
1461  AliParticleContainer * particlesForJets = CreateParticleOrTrackContainer(trackName.c_str());
1462  particlesForJets->SetName("particlesForJets");
1463  particlesForJets->SetMinPt(jetConstituentPtCut);
1464  particlesForJets->SetEtaLimits(-1.0*trackEta, trackEta);
1465  // Don't need to adopt the container - we'll just use it to find the right jet collection
1466  // For correlations
1467  AliParticleContainer * particlesForCorrelations = CreateParticleOrTrackContainer(trackName.c_str());
1468  if (particlesForCorrelations)
1469  {
1470  particlesForCorrelations->SetName("tracksForCorrelations");
1471  particlesForCorrelations->SetMinPt(0.15);
1472  particlesForCorrelations->SetEtaLimits(-1.0*trackEta, trackEta);
1473  // Adopt the container
1474  this->AdoptParticleContainer(particlesForCorrelations);
1475  }
1476  else {
1477  AliWarningStream() << "No particle container was successfully created!\n";
1478  }
1479 
1480  // Jets
1484  jetRadius,
1486  particlesForJets,
1487  clustersForJets);
1488  // 0.6 * jet area
1489  jetContainer->SetJetAreaCut(jetRadius * jetRadius * TMath::Pi() * 0.6);
1490  jetContainer->SetMaxTrackPt(100);
1491  jetContainer->SetJetPtCut(0.1);
1492 
1493  // Successfully configured
1494  returnValue = true;
1495 
1496  return returnValue;
1497 }
1498 
1505  std::string clusName,
1506  const double jetConstituentPtCut,
1507  const double trackEta,
1508  const double jetRadius,
1509  const std::string & jetTag,
1510  const std::string & correlationsTracksCutsPeriod)
1511 {
1512  bool returnValue = false;
1513  AliInfoStream() << "Configuring Jet-H Correlations task for an embedding analysis.\n";
1514 
1515  // Set the task to know it that is embedded
1516  this->SetIsEmbedded(true);
1517 
1518  // Add Containers
1519  // Clusters
1520  if (clusName == "usedefault") {
1522  }
1523  // For jet finding
1524  AliClusterContainer * clustersForJets = new AliClusterContainer(clusName.c_str());
1525  clustersForJets->SetName("clustersForJets");
1526  clustersForJets->SetMinE(jetConstituentPtCut);
1527  // We need the combined clusters, which should be available in the internal event.
1528  // However, we don't need to adopt the container - we'll just use it to find the right jet collection
1529  // For correlations
1530  /*AliClusterContainer * clustersforCorrelations = new AliClusterContainer("usedefault");
1531  clustersForCorrelations->SetName("clustersForCorrelations");
1532  clustersForCorrelations->SetMinE(0.30);
1533  clustersForCorrelations->SetIsEmbedding(true);
1534  this->AdoptClusterContainer(clustersForCorrelations);*/
1535 
1536  // Tracks
1537  // For jet finding
1538  if (trackName == "usedefault") {
1540  }
1541  AliParticleContainer * particlesForJets = CreateParticleOrTrackContainer(trackName.c_str());
1542  particlesForJets->SetName("particlesForJets");
1543  particlesForJets->SetMinPt(jetConstituentPtCut);
1544  particlesForJets->SetEtaLimits(-1.0*trackEta, trackEta);
1545  // Don't need to adopt the container - we'll just use it to find the right jet collection
1546  // For correlations
1547  AliParticleContainer * particlesForCorrelations = CreateParticleOrTrackContainer(trackName.c_str());
1548  // Ensure that we don't operate on a null pointer
1549  if (particlesForCorrelations)
1550  {
1551  particlesForCorrelations->SetName("tracksForCorrelations");
1552  particlesForCorrelations->SetMinPt(0.15);
1553  particlesForCorrelations->SetEtaLimits(-1.0*trackEta, trackEta);
1554  particlesForCorrelations->SetIsEmbedding(true);
1555  AliTrackContainer * trackCont = dynamic_cast<AliTrackContainer *>(particlesForCorrelations);
1556  if (trackCont) {
1557  // This option only exists for track containers
1558  trackCont->SetTrackCutsPeriod(correlationsTracksCutsPeriod.c_str());
1559  }
1560  // Adopt the container
1561  this->AdoptParticleContainer(particlesForCorrelations);
1562  }
1563  else {
1564  AliWarningStream() << "No particle container was successfully created!\n";
1565  }
1566 
1567  // Jets
1568  // The tag "hybridLevelJets" is defined in the jet finder
1572  jetRadius,
1574  particlesForJets,
1575  clustersForJets,
1576  jetTag);
1577  // 0.6 * jet area
1578  jetContainer->SetJetAreaCut(jetRadius * jetRadius * TMath::Pi() * 0.6);
1579  jetContainer->SetMaxTrackPt(100);
1580  jetContainer->SetJetPtCut(0.1);
1581 
1582  // Successfully configured
1583  returnValue = true;
1584 
1585  return returnValue;
1586 }
1587 
1596 {
1597  AliParticleContainer * partCont = 0;
1599  AliTrackContainer * trackCont = new AliTrackContainer(collectionName.c_str());
1600  partCont = trackCont;
1601  }
1602  else if (collectionName != "") {
1603  partCont = new AliParticleContainer(collectionName.c_str());
1604  }
1605 
1606  return partCont;
1607 }
1608 
1609 } /* namespace EMCALJetTasks */
1610 } /* 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()