AliPhysics  7f2a7c4 (7f2a7c4)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcal.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 #include <RVersion.h>
16 #include <iostream>
17 #include <memory>
18 
19 #include <TClonesArray.h>
20 #include <AliEmcalList.h>
21 #include <TObject.h>
22 #include <TH1F.h>
23 #include <TProfile.h>
24 #include <TSystem.h>
25 #include <TFile.h>
26 #include <TChain.h>
27 #include <TKey.h>
28 
29 #include "AliAnalysisTaskEmcal.h"
30 #include "AliAnalysisUtils.h"
31 #include "AliAODEvent.h"
32 #include "AliAODMCHeader.h"
33 #include "AliAODTrack.h"
34 #include "AliAnalysisManager.h"
35 #include "AliCentrality.h"
37 #include "AliEMCALGeometry.h"
38 #include "AliEmcalPythiaInfo.h"
39 #include "AliEMCALTriggerPatchInfo.h"
40 #include "AliESDEvent.h"
41 #include "AliAODInputHandler.h"
42 #include "AliESDInputHandler.h"
43 #include "AliEventplane.h"
44 #include "AliGenPythiaEventHeader.h"
45 #include "AliGenHerwigEventHeader.h"
46 #include "AliInputEventHandler.h"
47 #include "AliLog.h"
48 #include "AliMCEvent.h"
49 #include "AliMCParticle.h"
50 #include "AliMultiInputEventHandler.h"
51 #include "AliMultSelection.h"
52 #include "AliStack.h"
53 #include "AliVCaloTrigger.h"
54 #include "AliVCluster.h"
55 #include "AliVEventHandler.h"
56 #include "AliVParticle.h"
57 
59 
63 
68  AliAnalysisTaskSE("AliAnalysisTaskEmcal"),
69  fPythiaInfoName(""),
70  fForceBeamType(kNA),
71  fGeneralHistograms(kFALSE),
72  fLocalInitialized(kFALSE),
73  fCreateHisto(kTRUE),
74  fCaloCellsName(),
75  fCaloTriggersName(),
76  fCaloTriggerPatchInfoName(),
77  fMinCent(-999),
78  fMaxCent(-999),
79  fMinVz(-999),
80  fMaxVz(999),
81  fTrackPtCut(0),
82  fMinNTrack(0),
83  fZvertexDiff(0.5),
84  fUseAliAnaUtils(kFALSE),
85  fRejectPileup(kFALSE),
86  fTklVsClusSPDCut(kFALSE),
87  fOffTrigger(AliVEvent::kAny),
88  fTrigClass(),
89  fMinBiasRefTrigger("CINT7-B-NOPF-ALLNOTRD"),
90  fTriggerTypeSel(kND),
91  fNbins(250),
92  fMinBinPt(0),
93  fMaxBinPt(250),
94  fMinPtTrackInEmcal(0),
95  fEventPlaneVsEmcal(-1),
96  fMinEventPlane(-1e6),
97  fMaxEventPlane(1e6),
98  fCentEst("V0M"),
99  fIsEmbedded(kFALSE),
100  fIsPythia(kFALSE),
101  fIsHerwig(kFALSE),
102  fSelectPtHardBin(-999),
103  fMinMCLabel(0),
104  fMCLabelShift(0),
105  fNcentBins(4),
106  fNeedEmcalGeom(kTRUE),
107  fParticleCollArray(),
108  fClusterCollArray(),
109  fTriggers(0),
110  fEMCalTriggerMode(kOverlapWithLowThreshold),
111  fUseNewCentralityEstimation(kFALSE),
112  fGeneratePythiaInfoObject(kFALSE),
113  fUsePtHardBinScaling(kFALSE),
114  fUseXsecFromHeader(kFALSE),
115  fMCRejectFilter(kFALSE),
116  fCountDownscaleCorrectedEvents(kFALSE),
117  fPtHardAndJetPtFactor(0.),
118  fPtHardAndClusterPtFactor(0.),
119  fPtHardAndTrackPtFactor(0.),
120  fRunNumber(-1),
121  fAliAnalysisUtils(nullptr),
122  fIsEsd(kFALSE),
123  fGeom(nullptr),
124  fTracks(nullptr),
125  fCaloClusters(nullptr),
126  fCaloCells(nullptr),
127  fCaloTriggers(nullptr),
128  fTriggerPatchInfo(nullptr),
129  fCent(0),
130  fCentBin(-1),
131  fEPV0(-1.0),
132  fEPV0A(-1.0),
133  fEPV0C(-1.0),
134  fNVertCont(0),
135  fNVertSPDCont(0),
136  fBeamType(kNA),
137  fPythiaHeader(nullptr),
138  fHerwigHeader(nullptr),
139  fPtHard(0),
140  fPtHardBin(0),
141  fNPtHardBins(11),
142  fPtHardBinning(),
143  fNTrials(0),
144  fXsection(0),
145  fPythiaInfo(nullptr),
146  fOutput(nullptr),
147  fHistEventCount(nullptr),
148  fHistTrialsAfterSel(nullptr),
149  fHistEventsAfterSel(nullptr),
150  fHistXsectionAfterSel(nullptr),
151  fHistTrials(nullptr),
152  fHistEvents(nullptr),
153  fHistXsection(nullptr),
154  fHistPtHard(nullptr),
155  fHistCentrality(nullptr),
156  fHistZVertex(nullptr),
157  fHistEventPlane(nullptr),
158  fHistEventRejection(nullptr),
159  fHistTriggerClasses(nullptr),
160  fHistTriggerClassesCorr(nullptr)
161 {
162  fVertex[0] = 0;
163  fVertex[1] = 0;
164  fVertex[2] = 0;
165  fVertexSPD[0] = 0;
166  fVertexSPD[1] = 0;
167  fVertexSPD[2] = 0;
168 
169  fParticleCollArray.SetOwner(kTRUE);
170  fClusterCollArray.SetOwner(kTRUE);
171 }
172 
184  AliAnalysisTaskSE(name),
185  fPythiaInfoName(""),
186  fForceBeamType(kNA),
187  fGeneralHistograms(kFALSE),
188  fLocalInitialized(kFALSE),
189  fCreateHisto(histo),
190  fCaloCellsName(),
191  fCaloTriggersName(),
192  fCaloTriggerPatchInfoName(),
193  fMinCent(-999),
194  fMaxCent(-999),
195  fMinVz(-999),
196  fMaxVz(999),
197  fTrackPtCut(0),
198  fMinNTrack(0),
199  fZvertexDiff(0.5),
200  fUseAliAnaUtils(kFALSE),
201  fRejectPileup(kFALSE),
202  fTklVsClusSPDCut(kFALSE),
203  fOffTrigger(AliVEvent::kAny),
204  fTrigClass(),
205  fMinBiasRefTrigger("CINT7-B-NOPF-ALLNOTRD"),
206  fTriggerTypeSel(kND),
207  fNbins(250),
208  fMinBinPt(0),
209  fMaxBinPt(250),
210  fMinPtTrackInEmcal(0),
211  fEventPlaneVsEmcal(-1),
212  fMinEventPlane(-1e6),
213  fMaxEventPlane(1e6),
214  fCentEst("V0M"),
215  fIsEmbedded(kFALSE),
216  fIsPythia(kFALSE),
217  fIsHerwig(kFALSE),
218  fSelectPtHardBin(-999),
219  fMinMCLabel(0),
220  fMCLabelShift(0),
221  fNcentBins(4),
222  fNeedEmcalGeom(kTRUE),
223  fParticleCollArray(),
224  fClusterCollArray(),
225  fTriggers(0),
226  fEMCalTriggerMode(kOverlapWithLowThreshold),
227  fUseNewCentralityEstimation(kFALSE),
228  fGeneratePythiaInfoObject(kFALSE),
229  fUsePtHardBinScaling(kFALSE),
230  fUseXsecFromHeader(kFALSE),
231  fMCRejectFilter(kFALSE),
232  fCountDownscaleCorrectedEvents(kFALSE),
233  fPtHardAndJetPtFactor(0.),
234  fPtHardAndClusterPtFactor(0.),
235  fPtHardAndTrackPtFactor(0.),
236  fRunNumber(-1),
237  fAliAnalysisUtils(nullptr),
238  fIsEsd(kFALSE),
239  fGeom(nullptr),
240  fTracks(nullptr),
241  fCaloClusters(nullptr),
242  fCaloCells(nullptr),
243  fCaloTriggers(nullptr),
244  fTriggerPatchInfo(nullptr),
245  fCent(0),
246  fCentBin(-1),
247  fEPV0(-1.0),
248  fEPV0A(-1.0),
249  fEPV0C(-1.0),
250  fNVertCont(0),
251  fNVertSPDCont(0),
252  fBeamType(kNA),
253  fPythiaHeader(nullptr),
254  fHerwigHeader(nullptr),
255  fPtHard(0),
256  fPtHardBin(0),
257  fNPtHardBins(11),
258  fPtHardBinning(),
259  fNTrials(0),
260  fXsection(0),
261  fPythiaInfo(0),
262  fOutput(nullptr),
263  fHistEventCount(nullptr),
264  fHistTrialsAfterSel(nullptr),
265  fHistEventsAfterSel(nullptr),
266  fHistXsectionAfterSel(nullptr),
267  fHistTrials(nullptr),
268  fHistEvents(nullptr),
269  fHistXsection(nullptr),
270  fHistPtHard(nullptr),
271  fHistCentrality(nullptr),
272  fHistZVertex(nullptr),
273  fHistEventPlane(nullptr),
274  fHistEventRejection(nullptr),
275  fHistTriggerClasses(nullptr),
276  fHistTriggerClassesCorr(nullptr)
277 {
278  fVertex[0] = 0;
279  fVertex[1] = 0;
280  fVertex[2] = 0;
281  fVertexSPD[0] = 0;
282  fVertexSPD[1] = 0;
283  fVertexSPD[2] = 0;
284  fParticleCollArray.SetOwner(kTRUE);
285  fClusterCollArray.SetOwner(kTRUE);
286 
287  if (fCreateHisto) {
288  DefineOutput(1, AliEmcalList::Class());
289  }
290 }
291 
296 {
297 }
298 
306 {
308  if (cont) cont->SetClusPtCut(cut);
309  else AliError(Form("%s in SetClusPtCut(...): container %d not found",GetName(),c));
310 }
311 
320 {
322  if (cont) cont->SetClusTimeCut(min,max);
323  else AliError(Form("%s in SetClusTimeCut(...): container %d not found",GetName(),c));
324 }
325 
333 {
335  if (cont) cont->SetParticlePtCut(cut);
336  else AliError(Form("%s in SetTrackPtCut(...): container %d not found",GetName(),c));
337 
338  fTrackPtCut = cut;
339 }
340 
349 {
351  if (cont) cont->SetParticleEtaLimits(min,max);
352  else AliError(Form("%s in SetTrackPtCut(...): container %d not found",GetName(),c));
353 }
354 
363 {
365  if (cont) cont->SetParticlePhiLimits(min,max);
366  else AliError(Form("%s in SetTrackPhiLimits(...): container %d not found",GetName(),c));
367 }
368 
389 {
390  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
391  if (mgr) {
392  AliVEventHandler *evhand = mgr->GetInputEventHandler();
393  if (evhand) {
394  if (evhand->InheritsFrom("AliESDInputHandler")) {
395  fIsEsd = kTRUE;
396  }
397  else {
398  fIsEsd = kFALSE;
399  }
400  }
401  else {
402  AliError("Event handler not found!");
403  }
404  }
405  else {
406  AliError("Analysis manager not found!");
407  }
408 
409  if (!fCreateHisto)
410  return;
411 
412  OpenFile(1);
413  fOutput = new AliEmcalList();
415  fOutput->SetOwner();
416 
417  if (fForceBeamType == kpp)
418  fNcentBins = 1;
419 
420  if (!fGeneralHistograms)
421  return;
422 
423  if (fIsPythia || fIsHerwig) {
424  fHistTrialsAfterSel = new TH1F("fHistTrialsAfterSel", "fHistTrialsAfterSel", fNPtHardBins, 0, fNPtHardBins);
425  fHistTrialsAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
426  fHistTrialsAfterSel->GetYaxis()->SetTitle("trials");
428 
429  fHistEventsAfterSel = new TH1F("fHistEventsAfterSel", "fHistEventsAfterSel", fNPtHardBins, 0, fNPtHardBins);
430  fHistEventsAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
431  fHistEventsAfterSel->GetYaxis()->SetTitle("total events");
433 
434  fHistXsectionAfterSel = new TProfile("fHistXsectionAfterSel", "fHistXsectionAfterSel", fNPtHardBins, 0, fNPtHardBins);
435  fHistXsectionAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
436  fHistXsectionAfterSel->GetYaxis()->SetTitle("xsection");
438 
439  fHistTrials = new TH1F("fHistTrials", "fHistTrials", fNPtHardBins, 0, fNPtHardBins);
440  fHistTrials->GetXaxis()->SetTitle("p_{T} hard bin");
441  fHistTrials->GetYaxis()->SetTitle("trials");
442  fOutput->Add(fHistTrials);
443 
444  fHistEvents = new TH1F("fHistEvents", "fHistEvents", fNPtHardBins, 0, fNPtHardBins);
445  fHistEvents->GetXaxis()->SetTitle("p_{T} hard bin");
446  fHistEvents->GetYaxis()->SetTitle("total events");
447  fOutput->Add(fHistEvents);
448 
449  fHistXsection = new TProfile("fHistXsection", "fHistXsection", fNPtHardBins, 0, fNPtHardBins);
450  fHistXsection->GetXaxis()->SetTitle("p_{T} hard bin");
451  fHistXsection->GetYaxis()->SetTitle("xsection");
452  fOutput->Add(fHistXsection);
453 
454  // Set the bin labels
455  Bool_t binningAvailable = false;
456  if(fPtHardBinning.GetSize() > 0) {
457  AliInfoStream() << "Using custom pt-hard binning" << std::endl;
458  if(fPtHardBinning.GetSize() == fNPtHardBins + 1) binningAvailable = true;
459  else AliErrorStream() << "Pt-hard binning (" << fPtHardBinning.GetSize() -1 << ") does not match the amount of bins (" << fNPtHardBins << ")" << std::endl;
460  } else {
461  // Check if we fall back to the default binning
462  if(fNPtHardBins == 11) {
463  AliInfoStream() << "11 pt-hard bins - fall back to default binning for bin labels" << std::endl;
464  const Int_t kDefaultPtHardBinning[12] = {0,5,11,21,36,57, 84,117,152,191,234,1000000};
465  fPtHardBinning.Set(12);
466  for(Int_t ib = 0; ib < 12; ib++) fPtHardBinning[ib] = kDefaultPtHardBinning[ib];
467  binningAvailable = true;
468  } else {
469  AliErrorStream() << "No default binning available for " << fNPtHardBins << " pt-hard bins - bin labels will not be set." << std::endl;
470  }
471  }
472 
473  if(binningAvailable){
474  for (Int_t i = 0; i < fNPtHardBins; i++) {
475  fHistTrialsAfterSel->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
476  fHistEventsAfterSel->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
477  fHistXsectionAfterSel->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
478 
479  fHistTrials->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
480  fHistXsection->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
481  fHistEvents->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
482  }
483  } else {
484  AliErrorStream() << "No suitable binning available - skipping bin labels" << std::endl;
485  }
486 
487 
488  fHistPtHard = new TH1F("fHistPtHard", "fHistPtHard", fNbins*2, fMinBinPt, fMaxBinPt*4);
489  fHistPtHard->GetXaxis()->SetTitle("p_{T,hard} (GeV/c)");
490  fHistPtHard->GetYaxis()->SetTitle("counts");
491  fOutput->Add(fHistPtHard);
492  }
493 
494  fHistZVertex = new TH1F("fHistZVertex","Z vertex position", 60, -30, 30);
495  fHistZVertex->GetXaxis()->SetTitle("z");
496  fHistZVertex->GetYaxis()->SetTitle("counts");
497  fOutput->Add(fHistZVertex);
498 
499  if (fForceBeamType != kpp) {
500  fHistCentrality = new TH1F("fHistCentrality","Event centrality distribution", 200, 0, 100);
501  fHistCentrality->GetXaxis()->SetTitle("Centrality (%)");
502  fHistCentrality->GetYaxis()->SetTitle("counts");
503  fOutput->Add(fHistCentrality);
504 
505  fHistEventPlane = new TH1F("fHistEventPlane","Event plane", 120, -TMath::Pi(), TMath::Pi());
506  fHistEventPlane->GetXaxis()->SetTitle("event plane");
507  fHistEventPlane->GetYaxis()->SetTitle("counts");
508  fOutput->Add(fHistEventPlane);
509  }
510 
511  fHistEventRejection = new TH1F("fHistEventRejection","Reasons to reject event",20,0,20);
512 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
513  fHistEventRejection->SetBit(TH1::kCanRebin);
514 #else
515  fHistEventRejection->SetCanExtend(TH1::kAllAxes);
516 #endif
517  fHistEventRejection->GetXaxis()->SetBinLabel(1,"PhysSel");
518  fHistEventRejection->GetXaxis()->SetBinLabel(2,"trigger");
519  fHistEventRejection->GetXaxis()->SetBinLabel(3,"trigTypeSel");
520  fHistEventRejection->GetXaxis()->SetBinLabel(4,"Cent");
521  fHistEventRejection->GetXaxis()->SetBinLabel(5,"vertex contr.");
522  fHistEventRejection->GetXaxis()->SetBinLabel(6,"Vz");
523  fHistEventRejection->GetXaxis()->SetBinLabel(7,"VzSPD");
524  fHistEventRejection->GetXaxis()->SetBinLabel(8,"trackInEmcal");
525  fHistEventRejection->GetXaxis()->SetBinLabel(9,"minNTrack");
526  fHistEventRejection->GetXaxis()->SetBinLabel(10,"VtxSel2013pA");
527  fHistEventRejection->GetXaxis()->SetBinLabel(11,"PileUp");
528  fHistEventRejection->GetXaxis()->SetBinLabel(12,"EvtPlane");
529  fHistEventRejection->GetXaxis()->SetBinLabel(13,"SelPtHardBin");
530  fHistEventRejection->GetXaxis()->SetBinLabel(14,"Bkg evt");
531  fHistEventRejection->GetYaxis()->SetTitle("counts");
533 
534  fHistTriggerClasses = new TH1F("fHistTriggerClasses","fHistTriggerClasses",3,0,3);
535 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
536  fHistTriggerClasses->SetBit(TH1::kCanRebin);
537 #else
538  fHistTriggerClasses->SetCanExtend(TH1::kAllAxes);
539 #endif
541 
543  fHistTriggerClassesCorr = new TH1F("fHistTriggerClassesCorr","fHistTriggerClassesCorr",3,0,3);
544 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
545  fHistTriggerClassesCorr->SetBit(TH1::kCanRebin);
546 #else
547  fHistTriggerClassesCorr->SetCanExtend(TH1::kAllAxes);
548 #endif
550  }
551 
552  fHistEventCount = new TH1F("fHistEventCount","fHistEventCount",2,0,2);
553  fHistEventCount->GetXaxis()->SetBinLabel(1,"Accepted");
554  fHistEventCount->GetXaxis()->SetBinLabel(2,"Rejected");
555  fHistEventCount->GetYaxis()->SetTitle("counts");
556  fOutput->Add(fHistEventCount);
557 
558  PostData(1, fOutput);
559 }
560 
575 {
576  if (fIsPythia || fIsHerwig) {
580  fHistPtHard->Fill(fPtHard);
581  }
582 
583 
584  fHistZVertex->Fill(fVertex[2]);
585 
586  if (fForceBeamType != kpp) {
587  fHistCentrality->Fill(fCent);
588  fHistEventPlane->Fill(fEPV0);
589  }
590 
591  std::unique_ptr<TObjArray> triggerClasses(InputEvent()->GetFiredTriggerClasses().Tokenize(" "));
592  TObjString* triggerClass(nullptr);
593  for(auto trg : *triggerClasses){
594  triggerClass = static_cast<TObjString*>(trg);
595  fHistTriggerClasses->Fill(triggerClass->GetString(), 1);
596  }
597 
599  // downscale-corrected number of events are calculated based on the min. bias reference
600  // Formula: N_corr = N_MB * d_Trg/d_{Min_Bias}
601  if(InputEvent()->GetFiredTriggerClasses().Contains(fMinBiasRefTrigger)){
603  Double_t downscaleref = downscalefactors->GetDownscaleFactorForTriggerClass(fMinBiasRefTrigger);
604  for(auto t : downscalefactors->GetTriggerClasses()){
605  Double_t downscaletrg = downscalefactors->GetDownscaleFactorForTriggerClass(t);
606  fHistTriggerClassesCorr->Fill(t, downscaletrg/downscaleref);
607  }
608  }
609  }
610 
611  return kTRUE;
612 }
613 
634 {
635  if (!fLocalInitialized){
636  ExecOnce();
637  UserExecOnce();
638  }
639 
640  if (!fLocalInitialized)
641  return;
642 
643  if (!RetrieveEventObjects())
644  return;
645 
646  if(InputEvent()->GetRunNumber() != fRunNumber){
647  fRunNumber = InputEvent()->GetRunNumber();
650  }
651 
652  // Apply fallback for pythia cross section if needed
654  AliDebugStream(1) << "Fallback to cross section from pythia header required" << std::endl;
655  // Get the pthard bin
656  Float_t pthard = fPythiaHeader->GetPtHard();
657  int pthardbin = 0;
658  if(fPtHardBinning.GetSize()){
659  for(int ib = 0; ib < fNPtHardBins; ib++){
660  if(pthard >= fPtHardBinning[ib] && pthard < fPtHardBinning[ib+1]) {
661  pthardbin = ib;
662  break;
663  }
664  }
665  }
666  fHistXsection->Fill(pthardbin, fPythiaHeader->GetXsection());
667  }
668 
669  if (IsEventSelected()) {
670  if (fGeneralHistograms) fHistEventCount->Fill("Accepted",1);
671  }
672  else {
673  if (fGeneralHistograms) fHistEventCount->Fill("Rejected",1);
674  return;
675  }
676 
678  if (!FillGeneralHistograms())
679  return;
680  }
681 
682  if (!Run())
683  return;
684 
685  if (fCreateHisto) {
686  if (!FillHistograms())
687  return;
688  }
689 
690  if (fCreateHisto && fOutput) {
691  // information for this iteration of the UserExec in the container
692  PostData(1, fOutput);
693  }
694 }
695 
705 {
706  AliWarning("AliAnalysisTaskEmcal::AcceptCluster method is deprecated. Please use GetCusterContainer(c)->AcceptCluster(clus).");
707 
708  if (!clus) return kFALSE;
709 
711  if (!cont) {
712  AliError(Form("%s:Container %d not found",GetName(),c));
713  return 0;
714  }
715  UInt_t rejectionReason = 0;
716  return cont->AcceptCluster(clus, rejectionReason);
717 }
718 
727 Bool_t AliAnalysisTaskEmcal::AcceptTrack(AliVParticle *track, Int_t c) const
728 {
729  AliWarning("AliAnalysisTaskEmcal::AcceptTrack method is deprecated. Please use GetParticleContainer(c)->AcceptParticle(clus).");
730 
731  if (!track) return kFALSE;
732 
734  if (!cont) {
735  AliError(Form("%s:Container %d not found",GetName(),c));
736  return 0;
737  }
738 
739  UInt_t rejectionReason = 0;
740  return cont->AcceptParticle(track, rejectionReason);
741 }
742 
754 Bool_t AliAnalysisTaskEmcal::PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
755 {
756 
757  TString file(currFile);
758  fXsec = 0;
759  fTrials = 1;
760 
761  if (file.Contains(".zip#")) {
762  Ssiz_t pos1 = file.Index("root_archive",12,0,TString::kExact);
763  Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
764  Ssiz_t pos2 = file.Index(".root",5,TString::kExact);
765  file.Replace(pos+1,pos2-pos1,"");
766  } else {
767  // not an archive take the basename....
768  file.ReplaceAll(gSystem->BaseName(file.Data()),"");
769  }
770  AliDebug(1,Form("File name: %s",file.Data()));
771 
772  // Get the pt hard bin
773  TString strPthard(file);
774 
775  strPthard.Remove(strPthard.Last('/'));
776  strPthard.Remove(strPthard.Last('/'));
777  if (strPthard.Contains("AOD")) strPthard.Remove(strPthard.Last('/'));
778  strPthard.Remove(0,strPthard.Last('/')+1);
779  if (strPthard.IsDec()) pthard = strPthard.Atoi();
780  else
781  AliWarning(Form("Could not extract file number from path %s", strPthard.Data()));
782 
783  // problem that we cannot really test the existance of a file in a archive so we have to live with open error message from root
784  std::unique_ptr<TFile> fxsec(TFile::Open(Form("%s%s",file.Data(),"pyxsec.root")));
785 
786  if (!fxsec) {
787  // next trial fetch the histgram file
788  fxsec = std::unique_ptr<TFile>(TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root")));
789  if (!fxsec){
790  fUseXsecFromHeader = true;
791  return kFALSE; // not a severe condition but inciate that we have no information
792  }
793  else {
794  // find the tlist we want to be independtent of the name so use the Tkey
795  TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
796  if (!key) return kFALSE;
797  TList *list = dynamic_cast<TList*>(key->ReadObj());
798  if (!list) return kFALSE;
799  TProfile *xSecHist = static_cast<TProfile*>(list->FindObject("h1Xsec"));
800  // check for failure
801  if(!xSecHist->GetEntries()) {
802  // No cross seciton information available - fall back to raw
803  AliErrorStream() << "No cross section information available in file " << fxsec->GetName() <<" - fall back to cross section in PYTHIA header" << std::endl;
804  fUseXsecFromHeader = true;
805  } else {
806  // Cross section histogram filled - take it from there
807  fXsec = xSecHist->GetBinContent(1);
808  fUseXsecFromHeader = false;
809  }
810  fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
811  }
812  } else { // no tree pyxsec.root
813  TTree *xtree = (TTree*)fxsec->Get("Xsection");
814  if (!xtree) return kFALSE;
815  UInt_t ntrials = 0;
816  Double_t xsection = 0;
817  xtree->SetBranchAddress("xsection",&xsection);
818  xtree->SetBranchAddress("ntrials",&ntrials);
819  xtree->GetEntry(0);
820  fTrials = ntrials;
821  fXsec = xsection;
822  }
823  return kTRUE;
824 }
825 
840 {
842  return kTRUE;
843 
844  TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
845  if (!tree) {
846  AliError(Form("%s - UserNotify: No current tree!",GetName()));
847  return kFALSE;
848  }
849 
850  Float_t xsection = 0;
851  Float_t trials = 0;
852  Int_t pthardbin = 0;
853 
854  TFile *curfile = tree->GetCurrentFile();
855  if (!curfile) {
856  AliError(Form("%s - UserNotify: No current file!",GetName()));
857  return kFALSE;
858  }
859 
860  TChain *chain = dynamic_cast<TChain*>(tree);
861  if (chain) tree = chain->GetTree();
862 
863  Int_t nevents = tree->GetEntriesFast();
864 
865  PythiaInfoFromFile(curfile->GetName(), xsection, trials, pthardbin);
866 
867  if ((pthardbin < 0) || (pthardbin > fNPtHardBins-1)) pthardbin = 0;
868  fHistTrials->Fill(pthardbin, trials);
870  AliDebugStream(1) << "Using cross section from file pyxsec.root" << std::endl;
871  fHistXsection->Fill(pthardbin, xsection);
872  }
873  fHistEvents->Fill(pthardbin, nevents);
874 
875  return kTRUE;
876 }
877 
883 {
884  if (!fPythiaInfoName.IsNull() && !fPythiaInfo) {
885  fPythiaInfo = dynamic_cast<AliEmcalPythiaInfo*>(event->FindListObject(fPythiaInfoName));
886  if (!fPythiaInfo) {
887  AliError(Form("%s: Could not retrieve parton infos! %s!", GetName(), fPythiaInfoName.Data()));
888  return;
889  }
890  }
891 }
892 
904 {
905  if (!InputEvent()) {
906  AliError(Form("%s: Could not retrieve event! Returning!", GetName()));
907  return;
908  }
909 
910  LoadPythiaInfo(InputEvent());
911 
912  if (fNeedEmcalGeom) {
913  fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
914  if (!fGeom) {
915  AliFatal(Form("%s: Can not get EMCal geometry instance. If you do not need the EMCal geometry, disable it by setting task->SetNeedEmcalGeometry(kFALSE).", GetName()));
916  return;
917  }
918  }
919 
920  if (fEventPlaneVsEmcal >= 0) {
921  if (fGeom) {
922  Double_t ep = (fGeom->GetArm1PhiMax() + fGeom->GetArm1PhiMin()) / 2 * TMath::DegToRad() + fEventPlaneVsEmcal - TMath::Pi();
923  fMinEventPlane = ep - TMath::Pi() / 4;
924  fMaxEventPlane = ep + TMath::Pi() / 4;
925  }
926  else {
927  AliWarning("Could not set event plane limits because EMCal geometry was not loaded!");
928  }
929  }
930 
931  //Load all requested track branches - each container knows name already
932  for (Int_t i =0; i<fParticleCollArray.GetEntriesFast(); i++) {
933  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
934  cont->SetArray(InputEvent());
935  }
936 
937  if (fParticleCollArray.GetEntriesFast()>0) {
939  if (!fTracks) {
940  AliError(Form("%s: Could not retrieve first track branch!", GetName()));
941  return;
942  }
943  }
944 
945  //Load all requested cluster branches - each container knows name already
946  for (Int_t i =0; i<fClusterCollArray.GetEntriesFast(); i++) {
947  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
948  cont->SetArray(InputEvent());
949  }
950 
951  if (fClusterCollArray.GetEntriesFast()>0) {
953  if (!fCaloClusters) {
954  AliError(Form("%s: Could not retrieve first cluster branch!", GetName()));
955  return;
956  }
957  }
958 
959  if (!fCaloCellsName.IsNull() && !fCaloCells) {
960  fCaloCells = dynamic_cast<AliVCaloCells*>(InputEvent()->FindListObject(fCaloCellsName));
961  if (!fCaloCells) {
962  AliError(Form("%s: Could not retrieve cells %s!", GetName(), fCaloCellsName.Data()));
963  return;
964  }
965  }
966 
967  if (!fCaloTriggersName.IsNull() && !fCaloTriggers) {
968  fCaloTriggers = dynamic_cast<AliVCaloTrigger*>(InputEvent()->FindListObject(fCaloTriggersName));
969  if (!fCaloTriggers) {
970  AliError(Form("%s: Could not retrieve calo triggers %s!", GetName(), fCaloTriggersName.Data()));
971  return;
972  }
973  }
974 
975  if (!fCaloTriggerPatchInfoName.IsNull() && !fTriggerPatchInfo) {
976  fTriggerPatchInfo = GetArrayFromEvent(fCaloTriggerPatchInfoName.Data(),"AliEMCALTriggerPatchInfo");
977  if (!fTriggerPatchInfo) {
978  AliError(Form("%s: Could not retrieve calo trigger patch info %s!", GetName(), fCaloTriggerPatchInfoName.Data()));
979  return;
980  }
981 
982  }
983 
984  fLocalInitialized = kTRUE;
985 }
986 
993 {
994  if (fForceBeamType != kNA)
995  return fForceBeamType;
996 
997  AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
998  if (esd) {
999  const AliESDRun *run = esd->GetESDRun();
1000  TString beamType = run->GetBeamType();
1001  if (beamType == "p-p")
1002  return kpp;
1003  else if (beamType == "A-A")
1004  return kAA;
1005  else if (beamType == "p-A")
1006  return kpA;
1007  else
1008  return kNA;
1009  } else {
1010  Int_t runNumber = InputEvent()->GetRunNumber();
1011  // All run number ranges taken from the RCT
1012  if ((runNumber >= 136833 && runNumber <= 139517) || // LHC10h
1013  (runNumber >= 167693 && runNumber <= 170593) || // LHC11h
1014  (runNumber >= 244824 && runNumber <= 246994)) { // LHC15o
1015  return kAA;
1016  } else if ((runNumber >= 188356 && runNumber <= 188366) || // LHC12g
1017  (runNumber >= 195164 && runNumber <= 197388) || // LHC13b-f
1018  (runNumber >= 265015 && runNumber <= 267166)) { // LHC16q-t
1019  return kpA;
1020  } else {
1021  return kpp;
1022  }
1023  }
1024 }
1025 
1033 {
1034  if (!fTriggerPatchInfo)
1035  return 0;
1036 
1037  //number of patches in event
1038  Int_t nPatch = fTriggerPatchInfo->GetEntries();
1039 
1040  //loop over patches to define trigger type of event
1041  Int_t nG1 = 0;
1042  Int_t nG2 = 0;
1043  Int_t nJ1 = 0;
1044  Int_t nJ2 = 0;
1045  Int_t nL0 = 0;
1046  AliEMCALTriggerPatchInfo *patch;
1047  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1048  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
1049  if (patch->IsGammaHigh()) nG1++;
1050  if (patch->IsGammaLow()) nG2++;
1051  if (patch->IsJetHigh()) nJ1++;
1052  if (patch->IsJetLow()) nJ2++;
1053  if (patch->IsLevel0()) nL0++;
1054  }
1055 
1056  AliDebug(2, "Patch summary: ");
1057  AliDebug(2, Form("Number of patches: %d", nPatch));
1058  AliDebug(2, Form("Jet: low[%d], high[%d]" ,nJ2, nJ1));
1059  AliDebug(2, Form("Gamma: low[%d], high[%d]" ,nG2, nG1));
1060 
1061  ULong_t triggers(0);
1062  if (nL0>0) SETBIT(triggers, kL0);
1063  if (nG1>0) SETBIT(triggers, kG1);
1064  if (nG2>0) SETBIT(triggers, kG2);
1065  if (nJ1>0) SETBIT(triggers, kJ1);
1066  if (nJ2>0) SETBIT(triggers, kJ2);
1067  return triggers;
1068 }
1069 
1077 {
1078  //
1079  if(trigger==kND) {
1080  AliWarning(Form("%s: Requesting undefined trigger type!", GetName()));
1081  return kFALSE;
1082  }
1083  //MV: removing this logic which as far as I can see doesn't make any sense
1084  // if(trigger & kND){
1085  // return fTriggers == 0;
1086  // }
1087  return TESTBIT(fTriggers, trigger);
1088 }
1089 
1112 {
1113  if (fOffTrigger != AliVEvent::kAny) {
1114  UInt_t res = 0;
1115  const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(InputEvent());
1116  if (eev) {
1117  res = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1118  } else {
1119  const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
1120  if (aev) {
1121  res = ((AliVAODHeader*)aev->GetHeader())->GetOfflineTrigger();
1122  }
1123  }
1124  if ((res & fOffTrigger) == 0) {
1125  if (fGeneralHistograms) fHistEventRejection->Fill("PhysSel",1);
1126  return kFALSE;
1127  }
1128  }
1129 
1130  if (!fTrigClass.IsNull()) {
1131  TString fired;
1132  const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(InputEvent());
1133  if (eev) {
1134  fired = eev->GetFiredTriggerClasses();
1135  } else {
1136  const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
1137  if (aev) {
1138  fired = aev->GetFiredTriggerClasses();
1139  }
1140  }
1141  if (!fired.Contains("-B-")) {
1142  if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
1143  return kFALSE;
1144  }
1145 
1146  std::unique_ptr<TObjArray> arr(fTrigClass.Tokenize("|"));
1147  if (!arr) {
1148  if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
1149  return kFALSE;
1150  }
1151  Bool_t match = 0;
1152  for (Int_t i=0;i<arr->GetEntriesFast();++i) {
1153  TObject *obj = arr->At(i);
1154  if (!obj)
1155  continue;
1156 
1157  //Check if requested trigger was fired
1158  TString objStr = obj->GetName();
1160  (objStr.Contains("J1") || objStr.Contains("J2") || objStr.Contains("G1") || objStr.Contains("G2"))) {
1161  // This is relevant for EMCal triggers with 2 thresholds
1162  // If the kOverlapWithLowThreshold was requested than the overlap between the two triggers goes with the lower threshold trigger
1163  TString trigType1 = "J1";
1164  TString trigType2 = "J2";
1165  if(objStr.Contains("G")) {
1166  trigType1 = "G1";
1167  trigType2 = "G2";
1168  }
1169  if(objStr.Contains(trigType2) && fired.Contains(trigType2.Data())) { //requesting low threshold + overlap
1170  match = 1;
1171  break;
1172  }
1173  else if(objStr.Contains(trigType1) && fired.Contains(trigType1.Data()) && !fired.Contains(trigType2.Data())) { //high threshold only
1174  match = 1;
1175  break;
1176  }
1177  }
1178  else {
1179  // If this is not an EMCal trigger, or no particular treatment of EMCal triggers was requested,
1180  // simply check that the trigger was fired
1181  if (fired.Contains(obj->GetName())) {
1182  match = 1;
1183  break;
1184  }
1185  }
1186  }
1187  if (!match) {
1188  if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
1189  return kFALSE;
1190  }
1191  }
1192 
1193  if (fTriggerTypeSel != kND) {
1195  if (fGeneralHistograms) fHistEventRejection->Fill("trigTypeSel",1);
1196  return kFALSE;
1197  }
1198  }
1199 
1200  if ((fMinCent != -999) && (fMaxCent != -999)) {
1201  if (fCent<fMinCent || fCent>fMaxCent) {
1202  if (fGeneralHistograms) fHistEventRejection->Fill("Cent",1);
1203  return kFALSE;
1204  }
1205  }
1206 
1207  if (fUseAliAnaUtils) {
1208  if (!fAliAnalysisUtils)
1209  fAliAnalysisUtils = new AliAnalysisUtils();
1210  fAliAnalysisUtils->SetMinVtxContr(2);
1211  fAliAnalysisUtils->SetMaxVtxZ(999);
1212  if(fMinVz<-998.) fMinVz = -10.;
1213  if(fMaxVz>998.) fMaxVz = 10.;
1214 
1215  if (!fAliAnalysisUtils->IsVertexSelected2013pA(InputEvent())) {
1216  if (fGeneralHistograms) fHistEventRejection->Fill("VtxSel2013pA",1);
1217  return kFALSE;
1218  }
1219 
1220  if (fRejectPileup && fAliAnalysisUtils->IsPileUpEvent(InputEvent())) {
1221  if (fGeneralHistograms) fHistEventRejection->Fill("PileUp",1);
1222  return kFALSE;
1223  }
1224 
1225  if(fTklVsClusSPDCut && fAliAnalysisUtils->IsSPDClusterVsTrackletBG(InputEvent())) {
1226  if (fGeneralHistograms) fHistEventRejection->Fill("Bkg evt",1);
1227  return kFALSE;
1228  }
1229  }
1230 
1231  if ((fMinVz > -998.) && (fMaxVz < 998.)) {
1232  if (fNVertCont == 0 ) {
1233  if (fGeneralHistograms) fHistEventRejection->Fill("vertex contr.",1);
1234  return kFALSE;
1235  }
1236  Double_t vz = fVertex[2];
1237  if (vz < fMinVz || vz > fMaxVz) {
1238  if (fGeneralHistograms) fHistEventRejection->Fill("Vz",1);
1239  return kFALSE;
1240  }
1241 
1242  if (fNVertSPDCont > 0 && fZvertexDiff < 999) {
1243  Double_t vzSPD = fVertexSPD[2];
1244  Double_t dvertex = TMath::Abs(vz-vzSPD);
1245  //if difference larger than fZvertexDiff
1246  if (dvertex > fZvertexDiff) {
1247  if (fGeneralHistograms) fHistEventRejection->Fill("VzSPD",1);
1248  return kFALSE;
1249  }
1250  }
1251  }
1252 
1253  if (fMinPtTrackInEmcal > 0 && fGeom) {
1254  Bool_t trackInEmcalOk = kFALSE;
1255  Int_t ntracks = GetNParticles(0);
1256  for (Int_t i = 0; i < ntracks; i++) {
1257  AliVParticle *track = GetAcceptParticleFromArray(i,0);
1258  if (!track)
1259  continue;
1260 
1261  Double_t phiMin = fGeom->GetArm1PhiMin() * TMath::DegToRad();
1262  Double_t phiMax = fGeom->GetArm1PhiMax() * TMath::DegToRad();
1263  Int_t runNumber = InputEvent()->GetRunNumber();
1264  if (runNumber>=177295 && runNumber<=197470) { //small SM masked in 2012 and 2013
1265  phiMin = 1.4;
1266  phiMax = TMath::Pi();
1267  }
1268 
1269  if (track->Eta() < fGeom->GetArm1EtaMin() || track->Eta() > fGeom->GetArm1EtaMax() || track->Phi() < phiMin || track->Phi() > phiMax)
1270  continue;
1271  if (track->Pt() > fMinPtTrackInEmcal) {
1272  trackInEmcalOk = kTRUE;
1273  break;
1274  }
1275  }
1276  if (!trackInEmcalOk) {
1277  if (fGeneralHistograms) fHistEventRejection->Fill("trackInEmcal",1);
1278  return kFALSE;
1279  }
1280  }
1281 
1282  if (fMinNTrack > 0) {
1283  Int_t nTracksAcc = 0;
1284  Int_t ntracks = GetNParticles(0);
1285  for (Int_t i = 0; i < ntracks; i++) {
1286  AliVParticle *track = GetAcceptParticleFromArray(i,0);
1287  if (!track)
1288  continue;
1289  if (track->Pt() > fTrackPtCut) {
1290  nTracksAcc++;
1291  if (nTracksAcc>=fMinNTrack)
1292  break;
1293  }
1294  }
1295  if (nTracksAcc<fMinNTrack) {
1296  if (fGeneralHistograms) fHistEventRejection->Fill("minNTrack",1);
1297  return kFALSE;
1298  }
1299  }
1300 
1301  if (!(fEPV0 > fMinEventPlane && fEPV0 <= fMaxEventPlane) &&
1302  !(fEPV0 + TMath::Pi() > fMinEventPlane && fEPV0 + TMath::Pi() <= fMaxEventPlane) &&
1303  !(fEPV0 - TMath::Pi() > fMinEventPlane && fEPV0 - TMath::Pi() <= fMaxEventPlane))
1304  {
1305  if (fGeneralHistograms) fHistEventRejection->Fill("EvtPlane",1);
1306  return kFALSE;
1307  }
1308 
1309  if (fSelectPtHardBin != -999 && fSelectPtHardBin != fPtHardBin) {
1310  if (fGeneralHistograms) fHistEventRejection->Fill("SelPtHardBin",1);
1311  return kFALSE;
1312  }
1313 
1314  // Reject filter for MC data
1315  if (!CheckMCOutliers()) return kFALSE;
1316 
1317  return kTRUE;
1318 }
1319 
1326 {
1327  if (!fPythiaHeader || !fMCRejectFilter) return kTRUE;
1328 
1329  // Condition 1: Pythia jet / pT-hard > factor
1330  if (fPtHardAndJetPtFactor > 0.) {
1331  AliTLorentzVector jet;
1332 
1333  Int_t nTriggerJets = fPythiaHeader->NTriggerJets();
1334 
1335  AliDebug(1,Form("Njets: %d, pT Hard %f",nTriggerJets, fPtHard));
1336 
1337  Float_t tmpjet[]={0,0,0,0};
1338  for (Int_t ijet = 0; ijet< nTriggerJets; ijet++) {
1339  fPythiaHeader->TriggerJet(ijet, tmpjet);
1340 
1341  jet.SetPxPyPzE(tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3]);
1342 
1343  AliDebug(1,Form("jet %d; pycell jet pT %f",ijet, jet.Pt()));
1344 
1345  //Compare jet pT and pt Hard
1346  if (jet.Pt() > fPtHardAndJetPtFactor * fPtHard) {
1347  AliInfo(Form("Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n", fPtHard, jet.Pt(), fPtHardAndJetPtFactor));
1348  return kFALSE;
1349  }
1350  }
1351  }
1352  // end condition 1
1353 
1354  // Condition 2 : Reconstructed EMCal cluster pT / pT-hard > factor
1355  if (fPtHardAndClusterPtFactor > 0.) {
1356  AliClusterContainer* mccluscont = GetClusterContainer(0);
1357  if ((Bool_t)mccluscont) {
1358  for (auto cluster : mccluscont->all()) {// Not cuts applied ; use accept for cuts
1359  Float_t ecluster = cluster->E();
1360 
1361  if (ecluster > (fPtHardAndClusterPtFactor * fPtHard)) {
1362  AliInfo(Form("Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f",ecluster,cluster->GetType(),fPtHardAndClusterPtFactor,fPtHard));
1363  return kFALSE;
1364  }
1365  }
1366  }
1367  }
1368  // end condition 2
1369 
1370  // condition 3 : Reconstructed track pT / pT-hard >factor
1371  if (fPtHardAndTrackPtFactor > 0.) {
1372  AliMCParticleContainer* mcpartcont = dynamic_cast<AliMCParticleContainer*>(GetParticleContainer(0));
1373  if ((Bool_t)mcpartcont) {
1374  for (auto mctrack : mcpartcont->all()) {// Not cuts applied ; use accept for cuts
1375  Float_t trackpt = mctrack->Pt();
1376  if (trackpt > (fPtHardAndTrackPtFactor * fPtHard) ) {
1377  AliInfo(Form("Reject : track %2.2f, factor %2.2f, ptHard %f", trackpt, fPtHardAndTrackPtFactor, fPtHard));
1378  return kFALSE;
1379  }
1380  }
1381  }
1382  }
1383  // end condition 3
1384 
1385  return kTRUE;
1386 }
1387 
1396 TClonesArray *AliAnalysisTaskEmcal::GetArrayFromEvent(const char *name, const char *clname)
1397 {
1398  TClonesArray *arr = 0;
1399  TString sname(name);
1400  if (!sname.IsNull()) {
1401  arr = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(sname));
1402  if (!arr) {
1403  AliWarning(Form("%s: Could not retrieve array with name %s!", GetName(), name));
1404  return 0;
1405  }
1406  } else {
1407  return 0;
1408  }
1409 
1410  if (!clname)
1411  return arr;
1412 
1413  TString objname(arr->GetClass()->GetName());
1414  TClass cls(objname);
1415  if (!cls.InheritsFrom(clname)) {
1416  AliWarning(Form("%s: Objects of type %s in %s are not inherited from %s!",
1417  GetName(), cls.GetName(), name, clname));
1418  return 0;
1419  }
1420  return arr;
1421 }
1422 
1428 {
1429  fVertex[0] = 0;
1430  fVertex[1] = 0;
1431  fVertex[2] = 0;
1432  fNVertCont = 0;
1433 
1434  fVertexSPD[0] = 0;
1435  fVertexSPD[1] = 0;
1436  fVertexSPD[2] = 0;
1437  fNVertSPDCont = 0;
1438 
1439  if (fGeneratePythiaInfoObject && MCEvent()) {
1440  GeneratePythiaInfoObject(MCEvent());
1441  }
1442 
1443  const AliVVertex *vert = InputEvent()->GetPrimaryVertex();
1444  if (vert) {
1445  vert->GetXYZ(fVertex);
1446  fNVertCont = vert->GetNContributors();
1447  }
1448 
1449  const AliVVertex *vertSPD = InputEvent()->GetPrimaryVertexSPD();
1450  if (vertSPD) {
1451  vertSPD->GetXYZ(fVertexSPD);
1452  fNVertSPDCont = vertSPD->GetNContributors();
1453  }
1454 
1455  fBeamType = GetBeamType();
1456 
1457  if (fBeamType == kAA || fBeamType == kpA ) {
1459  AliMultSelection *MultSelection = static_cast<AliMultSelection*>(InputEvent()->FindListObject("MultSelection"));
1460  if (MultSelection) {
1461  fCent = MultSelection->GetMultiplicityPercentile(fCentEst.Data());
1462  }
1463  else {
1464  AliWarning(Form("%s: Could not retrieve centrality information! Assuming 99", GetName()));
1465  }
1466  }
1467  else { // old centrality estimation < 2015
1468  AliCentrality *aliCent = InputEvent()->GetCentrality();
1469  if (aliCent) {
1470  fCent = aliCent->GetCentralityPercentile(fCentEst.Data());
1471  }
1472  else {
1473  AliWarning(Form("%s: Could not retrieve centrality information! Assuming 99", GetName()));
1474  }
1475  }
1476 
1477  if (fNcentBins==4) {
1478  if (fCent >= 0 && fCent < 10) fCentBin = 0;
1479  else if (fCent >= 10 && fCent < 30) fCentBin = 1;
1480  else if (fCent >= 30 && fCent < 50) fCentBin = 2;
1481  else if (fCent >= 50 && fCent <= 100) fCentBin = 3;
1482  else {
1483  AliWarning(Form("%s: Negative centrality: %f. Assuming 99", GetName(), fCent));
1484  fCentBin = fNcentBins-1;
1485  }
1486  }
1487  else if (fNcentBins==5) { // for PbPb 2015
1488  if (fCent >= 0 && fCent < 10) fCentBin = 0;
1489  else if (fCent >= 10 && fCent < 30) fCentBin = 1;
1490  else if (fCent >= 30 && fCent < 50) fCentBin = 2;
1491  else if (fCent >= 50 && fCent <= 90) fCentBin = 3;
1492  else if (fCent > 90) {
1493  fCent = 99;
1494  fCentBin = 4;
1495  }
1496  else {
1497  AliWarning(Form("%s: Negative centrality: %f. Assuming 99", GetName(), fCent));
1498  fCentBin = fNcentBins-1;
1499  }
1500  }
1501  else {
1502  Double_t centWidth = (fMaxCent-fMinCent)/(Double_t)fNcentBins;
1503  if(centWidth>0.) {
1504  fCentBin = TMath::FloorNint(fCent/centWidth);
1505  }
1506  else {
1507  fCentBin = 0;
1508  }
1509  if (fCentBin>=fNcentBins) {
1510  AliWarning(Form("%s: fCentBin too large: cent = %f fCentBin = %d. Assuming 99", GetName(),fCent,fCentBin));
1511  fCentBin = fNcentBins-1;
1512  }
1513  }
1514 
1515  AliEventplane *aliEP = InputEvent()->GetEventplane();
1516  if (aliEP) {
1517  fEPV0 = aliEP->GetEventplane("V0" ,InputEvent());
1518  fEPV0A = aliEP->GetEventplane("V0A",InputEvent());
1519  fEPV0C = aliEP->GetEventplane("V0C",InputEvent());
1520  } else {
1521  AliWarning(Form("%s: Could not retrieve event plane information!", GetName()));
1522  }
1523  }
1524  else {
1525  fCent = 99;
1526  fCentBin = 0;
1527  }
1528 
1529  if (fIsPythia) {
1530  if (MCEvent()) {
1531  fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent()->GenEventHeader());
1532  if (!fPythiaHeader) {
1533  // Check if AOD
1534  AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1535 
1536  if (aodMCH) {
1537  for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1538  fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(aodMCH->GetCocktailHeader(i));
1539  if (fPythiaHeader) break;
1540  }
1541  }
1542  }
1543  }
1544  }
1545 
1546  if (fPythiaHeader) {
1547  fPtHard = fPythiaHeader->GetPtHard();
1548 
1549  if(fPtHardBinning.GetSize()){
1550  // pt-hard binning defined for the corresponding dataset - automatically determine the bin
1551  for (fPtHardBin = 0; fPtHardBin < fNPtHardBins; fPtHardBin++) {
1553  break;
1554  }
1555  } else {
1556  // No pt-hard binning defined for the dataset - leaving the bin to 0
1557  fPtHardBin = 0;
1558  }
1559 
1560  fXsection = fPythiaHeader->GetXsection();
1561  fNTrials = fPythiaHeader->Trials();
1562  }
1563 
1564  if (fIsHerwig) {
1565  if (MCEvent()) {
1566  fHerwigHeader = dynamic_cast<AliGenHerwigEventHeader*>(MCEvent()->GenEventHeader());
1567 
1568  if (!fHerwigHeader) {
1569  // Check if AOD
1570  AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1571 
1572  if (aodMCH) {
1573  for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1574  fHerwigHeader = dynamic_cast<AliGenHerwigEventHeader*>(aodMCH->GetCocktailHeader(i));
1575  if (fHerwigHeader) break;
1576  }
1577  }
1578  }
1579  }
1580  }
1581 
1582  if (fHerwigHeader) {
1583  fPtHard = fHerwigHeader->GetPtHard();
1584 
1585  if(fPtHardBinning.GetSize()){
1586  // pt-hard binning defined for the corresponding dataset - automatically determine the bin
1587  for (fPtHardBin = 0; fPtHardBin < fNPtHardBins; fPtHardBin++) {
1589  break;
1590  }
1591  } else {
1592  // No pt-hard binning defined for the dataset - leaving the bin to 0
1593  fPtHardBin = 0;
1594  }
1595  fXsection = fHerwigHeader->Weight();
1596  fNTrials = fHerwigHeader->Trials();
1597  }
1598 
1599 
1601 
1602  AliEmcalContainer* cont = 0;
1603 
1604  TIter nextPartColl(&fParticleCollArray);
1605  while ((cont = static_cast<AliEmcalContainer*>(nextPartColl()))) cont->NextEvent();
1606 
1607  TIter nextClusColl(&fClusterCollArray);
1608  while ((cont = static_cast<AliParticleContainer*>(nextClusColl()))) cont->NextEvent();
1609 
1610  return kTRUE;
1611 }
1612 
1621 {
1622  if (TString(n).IsNull()) return 0;
1623 
1625 
1626  fParticleCollArray.Add(cont);
1627 
1628  return cont;
1629 }
1630 
1639 {
1640  if (TString(n).IsNull()) return 0;
1641 
1642  AliTrackContainer* cont = new AliTrackContainer(n);
1643 
1644  fParticleCollArray.Add(cont);
1645 
1646  return cont;
1647 }
1648 
1657 {
1658  if (TString(n).IsNull()) return 0;
1659 
1661 
1662  fParticleCollArray.Add(cont);
1663 
1664  return cont;
1665 }
1666 
1675 {
1676  if (TString(n).IsNull()) return 0;
1677 
1679 
1680  fClusterCollArray.Add(cont);
1681 
1682  return cont;
1683 }
1684 
1691 {
1692  if (i<0 || i>fParticleCollArray.GetEntriesFast()) return 0;
1693  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
1694  return cont;
1695 }
1696 
1703 {
1704  if (i<0 || i>fClusterCollArray.GetEntriesFast()) return 0;
1705  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
1706  return cont;
1707 }
1708 
1715 {
1716  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.FindObject(name));
1717  return cont;
1718 }
1719 
1726 {
1727  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.FindObject(name));
1728  return cont;
1729 }
1730 
1737 {
1739  if (!cont) {
1740  AliError(Form("%s: Particle container %d not found",GetName(),i));
1741  return 0;
1742  }
1743  TString contName = cont->GetArrayName();
1744  return cont->GetArray();
1745 }
1746 
1753 {
1755  if (!cont) {
1756  AliError(Form("%s:Cluster container %d not found",GetName(),i));
1757  return 0;
1758  }
1759  return cont->GetArray();
1760 }
1761 
1770 {
1771 
1773  if (!cont) {
1774  AliError(Form("%s: Particle container %d not found",GetName(),c));
1775  return 0;
1776  }
1777  AliVParticle *vp = cont->GetAcceptParticle(p);
1778 
1779  return vp;
1780 }
1781 
1790 {
1792  if (!cont) {
1793  AliError(Form("%s: Cluster container %d not found",GetName(),c));
1794  return 0;
1795  }
1796  AliVCluster *vc = cont->GetAcceptCluster(cl);
1797 
1798  return vc;
1799 }
1800 
1807 {
1809  if (!cont) {
1810  AliError(Form("%s: Particle container %d not found",GetName(),i));
1811  return 0;
1812  }
1813  return cont->GetNEntries();
1814 }
1815 
1823 {
1825  if (!cont) {
1826  AliError(Form("%s: Cluster container %d not found",GetName(),i));
1827  return 0;
1828  }
1829  return cont->GetNEntries();
1830 }
1831 
1843 AliEMCALTriggerPatchInfo* AliAnalysisTaskEmcal::GetMainTriggerPatch(TriggerCategory trigger, Bool_t doSimpleOffline)
1844 {
1845 
1846  if (!fTriggerPatchInfo) {
1847  AliError(Form("%s: fTriggerPatchInfo not available",GetName()));
1848  return 0;
1849  }
1850 
1851  //number of patches in event
1852  Int_t nPatch = fTriggerPatchInfo->GetEntries();
1853 
1854  //extract main trigger patch(es)
1855  AliEMCALTriggerPatchInfo *patch(NULL), *selected(NULL);
1856  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1857 
1858  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
1859  if (patch->IsMainTrigger()) {
1860  if(doSimpleOffline){
1861  if(patch->IsOfflineSimple()){
1862  switch(trigger){
1863  case kTriggerLevel0:
1864  // option not yet implemented in the trigger maker
1865  if(patch->IsLevel0()) selected = patch;
1866  break;
1867  case kTriggerLevel1Jet:
1868  if(patch->IsJetHighSimple() || patch->IsJetLowSimple()){
1869  if(!selected) selected = patch;
1870  else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1871  }
1872  break;
1873  case kTriggerLevel1Gamma:
1874  if(patch->IsGammaHighSimple() || patch->IsGammaLowSimple()){
1875  if(!selected) selected = patch;
1876  else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1877  }
1878  break;
1879  default: // Silence compiler warnings
1880  AliError("Untreated case: Main Patch is recalculated; should be in 'else' branch");
1881  };
1882  }
1883  } else { // Not OfflineSimple
1884  switch(trigger){
1885  case kTriggerLevel0:
1886  if(patch->IsLevel0()) selected = patch;
1887  break;
1888  case kTriggerLevel1Jet:
1889  if(patch->IsJetHigh() || patch->IsJetLow()){
1890  if(!selected) selected = patch;
1891  else if (patch->GetADCAmp() > selected->GetADCAmp())
1892  selected = patch;
1893  }
1894  break;
1895  case kTriggerLevel1Gamma:
1896  if(patch->IsGammaHigh() || patch->IsGammaLow()){
1897  if(!selected) selected = patch;
1898  else if (patch->GetADCAmp() > selected->GetADCAmp())
1899  selected = patch;
1900  }
1901  break;
1902  default:
1903  AliError("Untreated case: Main Patch is recalculated; should be in 'else' branch");
1904  };
1905  }
1906  }
1907  else if ((trigger == kTriggerRecalcJet && patch->IsRecalcJet()) ||
1908  (trigger == kTriggerRecalcGamma && patch->IsRecalcGamma())) { // recalculated patches
1909  if (doSimpleOffline && patch->IsOfflineSimple()) {
1910  if(!selected) selected = patch;
1911  else if (patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) // this in fact should not be needed, but we have it in teh other branches as well, so keeping it for compleness
1912  selected = patch;
1913  }
1914  else if (!doSimpleOffline && !patch->IsOfflineSimple()) {
1915  if(!selected) selected = patch;
1916  else if (patch->GetADCAmp() > selected->GetADCAmp())
1917  selected = patch;
1918  }
1919  }
1920  }
1921  return selected;
1922 }
1923 
1930 {
1931  if (!(InputEvent()->FindListObject(obj->GetName()))) {
1932  InputEvent()->AddObject(obj);
1933  }
1934  else {
1935  if (!attempt) {
1936  AliFatal(Form("%s: Container with name %s already present. Aborting", GetName(), obj->GetName()));
1937  }
1938  }
1939 }
1940 
1949 {
1950 
1951  if (!fGeom) {
1952  AliWarning(Form("%s - AliAnalysisTaskEmcal::IsTrackInEmcalAcceptance - Geometry is not available!", GetName()));
1953  return kFALSE;
1954  }
1955 
1956  Double_t minPhi = fGeom->GetArm1PhiMin() - edges;
1957  Double_t maxPhi = fGeom->GetArm1PhiMax() + edges;
1958 
1959  if (part->Phi() > minPhi && part->Phi() < maxPhi) {
1960  return kTRUE;
1961  }
1962  else {
1963  return kFALSE;
1964  }
1965 }
1966 
1968 {
1969  axis->SetBinLabel(1, "NullObject");
1970  axis->SetBinLabel(2, "Pt");
1971  axis->SetBinLabel(3, "Acceptance");
1972  axis->SetBinLabel(4, "MCLabel");
1973  axis->SetBinLabel(5, "BitMap");
1974  axis->SetBinLabel(6, "HF cut");
1975  axis->SetBinLabel(7, "Bit6");
1976  axis->SetBinLabel(8, "NotHybridTrack");
1977  axis->SetBinLabel(9, "MCFlag");
1978  axis->SetBinLabel(10, "MCGenerator");
1979  axis->SetBinLabel(11, "ChargeCut");
1980  axis->SetBinLabel(12, "MinDistanceTPCSectorEdge");
1981  axis->SetBinLabel(13, "Bit12");
1982  axis->SetBinLabel(14, "IsEMCal");
1983  axis->SetBinLabel(15, "Time");
1984  axis->SetBinLabel(16, "Energy");
1985  axis->SetBinLabel(17, "ExoticCut");
1986  axis->SetBinLabel(18, "Bit17");
1987  axis->SetBinLabel(19, "Area");
1988  axis->SetBinLabel(20, "AreaEmc");
1989  axis->SetBinLabel(21, "ZLeadingCh");
1990  axis->SetBinLabel(22, "ZLeadingEmc");
1991  axis->SetBinLabel(23, "NEF");
1992  axis->SetBinLabel(24, "MinLeadPt");
1993  axis->SetBinLabel(25, "MaxTrackPt");
1994  axis->SetBinLabel(26, "MaxClusterPt");
1995  axis->SetBinLabel(27, "Flavour");
1996  axis->SetBinLabel(28, "TagStatus");
1997  axis->SetBinLabel(29, "MinNConstituents");
1998  axis->SetBinLabel(30, "Bit29");
1999  axis->SetBinLabel(31, "Bit30");
2000  axis->SetBinLabel(32, "Bit31");
2001 }
2002 
2009 Double_t AliAnalysisTaskEmcal::GetParallelFraction(AliVParticle* part1, AliVParticle* part2)
2010 {
2011  TVector3 vect1(part1->Px(), part1->Py(), part1->Pz());
2012  TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
2013  Double_t z = (vect1 * vect2) / (vect2 * vect2);
2014  return z;
2015 }
2016 
2023 Double_t AliAnalysisTaskEmcal::GetParallelFraction(const TVector3& vect1, AliVParticle* part2)
2024 {
2025  TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
2026  Double_t z = (vect1 * vect2) / (vect2 * vect2);
2027  return z;
2028 }
2029 
2038 void AliAnalysisTaskEmcal::GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
2039 {
2040  phidiff = 999;
2041  etadiff = 999;
2042 
2043  if (!t||!v) return;
2044 
2045  Double_t veta = t->GetTrackEtaOnEMCal();
2046  Double_t vphi = t->GetTrackPhiOnEMCal();
2047 
2048  Float_t pos[3] = {0};
2049  v->GetPosition(pos);
2050  TVector3 cpos(pos);
2051  Double_t ceta = cpos.Eta();
2052  Double_t cphi = cpos.Phi();
2053  etadiff=veta-ceta;
2054  phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
2055 }
2056 
2062 Byte_t AliAnalysisTaskEmcal::GetTrackType(const AliVTrack *t)
2063 {
2064  Byte_t ret = 0;
2065  if (t->TestBit(BIT(22)) && !t->TestBit(BIT(23)))
2066  ret = 1;
2067  else if (!t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
2068  ret = 2;
2069  else if (t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
2070  ret = 3;
2071  return ret;
2072 }
2073 
2083 Byte_t AliAnalysisTaskEmcal::GetTrackType(const AliAODTrack *aodTrack, UInt_t filterBit1, UInt_t filterBit2)
2084 {
2085 
2086  Int_t res = 0;
2087 
2088  if (aodTrack->TestFilterBit(filterBit1)) {
2089  res = 0;
2090  }
2091  else if (aodTrack->TestFilterBit(filterBit2)) {
2092  if ((aodTrack->GetStatus()&AliVTrack::kITSrefit)!=0) {
2093  res = 1;
2094  }
2095  else {
2096  res = 2;
2097  }
2098  }
2099  else {
2100  res = 3;
2101  }
2102 
2103  return res;
2104 }
2105 
2111 {
2112  if (!fPythiaInfo) {
2114  }
2115 
2116  AliStack* stack = mcEvent->Stack();
2117 
2118  const Int_t nprim = stack->GetNprimary();
2119  // reject if partons are missing from stack for some reason
2120  if (nprim < 8) return;
2121 
2122  TParticle *part6 = stack->Particle(6);
2123  TParticle *part7 = stack->Particle(7);
2124 
2125  fPythiaInfo->SetPartonFlag6(TMath::Abs(part6->GetPdgCode()));
2126  fPythiaInfo->SetParton6(part6->Pt(), part6->Eta(), part6->Phi(), part6->GetMass());
2127 
2128  fPythiaInfo->SetPartonFlag7(TMath::Abs(part7->GetPdgCode()));
2129  fPythiaInfo->SetParton7(part7->Pt(), part7->Eta(), part7->Phi(), part7->GetMass());
2130 
2131  AliGenPythiaEventHeader *pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(mcEvent->GenEventHeader());
2132  if(pythiaGenHeader){
2133  Float_t ptWeight=pythiaGenHeader->EventWeight();
2134  fPythiaInfo->SetPythiaEventWeight(ptWeight);}
2135 }
2136 
2142 {
2143  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
2144  if (!mgr) {
2145  ::Error("AddAODHandler", "No analysis manager to connect to.");
2146  return NULL;
2147  }
2148 
2149  AliAODInputHandler* aodHandler = new AliAODInputHandler();
2150 
2151  AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
2152  if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
2153  AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
2154  multiInputHandler->AddInputEventHandler(aodHandler);
2155  }
2156  else {
2157  if (!inputHandler) {
2158  mgr->SetInputEventHandler(aodHandler);
2159  }
2160  else {
2161  ::Error("AddAODHandler", "inputHandler is NOT null. AOD handler was NOT added !!!");
2162  return NULL;
2163  }
2164  }
2165 
2166  return aodHandler;
2167 }
2168 
2174 {
2175  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
2176  if (!mgr) {
2177  ::Error("AddESDHandler", "No analysis manager to connect to.");
2178  return NULL;
2179  }
2180 
2181  AliESDInputHandler *esdHandler = new AliESDInputHandler();
2182 
2183  AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
2184  if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
2185  AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
2186  multiInputHandler->AddInputEventHandler(esdHandler);
2187  }
2188  else {
2189  if (!inputHandler) {
2190  mgr->SetInputEventHandler(esdHandler);
2191  }
2192  else {
2193  ::Error("AddESDHandler", "inputHandler is NOT null. ESD handler was NOT added !!!");
2194  return NULL;
2195  }
2196  }
2197 
2198  return esdHandler;
2199 }
2200 
Bool_t fGeneratePythiaInfoObject
Generate Pythia info object.
TObjArray fClusterCollArray
cluster collection array
Int_t fNVertSPDCont
!event SPD vertex number of contributors
void SetParticlePtCut(Double_t cut)
Bool_t fIsPythia
trigger, if it is a PYTHIA production
double Double_t
Definition: External.C:58
void SetParton7(Float_t pt, Float_t eta, Float_t phi, Float_t mass=0)
TH1 * fHistTrials
!trials from pyxsec.root
EMCAL Level1 gamma trigger, low threshold.
AliEmcalPythiaInfo * fPythiaInfo
!event parton info
Bool_t AcceptTrack(AliVParticle *track, Int_t c=0) const
EMCAL Level1 jet trigger, low threshold.
Bool_t HasTriggerType(TriggerType triggersel)
Int_t fNTrials
!event trials
UInt_t fOffTrigger
offline trigger for event selection
Double_t fVertexSPD[3]
!event Svertex
Double_t fMinCent
min centrality for event selection
static AliEmcalDownscaleFactorsOCDB * Instance()
Double_t fTrackPtCut
cut on track pt in event selection
Recalculated jet trigger patch; does not need to be above trigger threshold.
Base task in the EMCAL framework.
Bool_t fLocalInitialized
whether or not the task has been already initialized
Bool_t fUsePtHardBinScaling
Use -hard bin scaling in merging.
void SetPartonFlag7(Int_t flag7)
Container with name, TClonesArray and cuts for particles.
Bool_t fUseXsecFromHeader
! Use cross section from header instead of pyxsec.root (purely transient)
TSystem * gSystem
Double_t fPtHard
!event -hard
void SetTrackPtCut(Double_t cut, Int_t c=0)
static void GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
Double_t fMinBinPt
min pt in histograms
Double_t fEPV0
!event plane V0
TList * list
Int_t fNPtHardBins
Number of -hard bins in the dataset.
Bool_t fGeneralHistograms
whether or not it should fill some general histograms
Bool_t AcceptCluster(AliVCluster *clus, Int_t c=0) const
TCanvas * c
Definition: TestFitELoss.C:172
Int_t fCentBin
!event centrality bin
TH1 * fHistEventsAfterSel
!total number of events per pt hard bin after selection
const AliMCParticleIterableContainer all() const
Float_t fPtHardAndClusterPtFactor
Factor between ptHard and cluster pT to reject/accept event.
Double_t fMinPtTrackInEmcal
min pt track in emcal
Double_t GetDownscaleFactorForTriggerClass(const TString &trigger) const
TH1 * fHistEventPlane
!event plane distribution
TH1 * fHistEvents
!total number of events per pt hard bin
void SetClusPtCut(Double_t cut, Int_t c=0)
AliClusterContainer * AddClusterContainer(const char *n)
Double_t fEPV0C
!event plane V0C
void SetParton6(Float_t pt, Float_t eta, Float_t phi, Float_t mass=0)
TH1 * fHistCentrality
!event centrality distribution
Container for particles within the EMCAL framework.
TObjArray fParticleCollArray
particle/track collection array
BeamType
Switch for the beam type.
void SetTrackEtaLimits(Double_t min, Double_t max, Int_t c=0)
AliParticleContainer * GetParticleContainer(Int_t i=0) const
TProfile * fHistXsectionAfterSel
!x section from pythia header
TriggerType
Switch for EMCAL trigger types.
EMCalTriggerMode_t fEMCalTriggerMode
EMCal trigger selection mode.
virtual Bool_t FillHistograms()
Int_t GetNParticles(Int_t i=0) const
TClonesArray * fCaloClusters
!clusters
Bool_t fUseNewCentralityEstimation
Use new centrality estimation (for 2015 data)
Bool_t IsTrackInEmcalAcceptance(AliVParticle *part, Double_t edges=0.9) const
int Int_t
Definition: External.C:63
TH1 * fHistTriggerClasses
!number of events in each trigger class
Bool_t fCountDownscaleCorrectedEvents
Count event number corrected for downscaling.
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
Double_t fMaxVz
max vertex for event selection
void GeneratePythiaInfoObject(AliMCEvent *mcEvent)
AliEMCALGeometry * fGeom
!emcal geometry
The overlap between low and high threshold trigger is assigned to the lower threshold only...
kRecalculated gamma trigger patch; does not need to be above trigger threshold
TString fCaloTriggerPatchInfoName
trigger patch info array name
TString fCaloTriggersName
name of calo triggers collection
TH1 * fHistTriggerClassesCorr
!corrected number of events in each trigger class
Bool_t fIsHerwig
trigger, if it is a HERWIG production
AliGenPythiaEventHeader * fPythiaHeader
!event Pythia header
void SetTrackPhiLimits(Double_t min, Double_t max, Int_t c=0)
AliParticleContainer * AddParticleContainer(const char *n)
AliAnalysisUtils * fAliAnalysisUtils
!vertex selection (optional)
BeamType fForceBeamType
forced beam type
void SetUseScaling(Bool_t val)
Definition: AliEmcalList.h:31
Int_t fNcentBins
how many centrality bins
AliClusterContainer * GetClusterContainer(Int_t i=0) const
TriggerType fTriggerTypeSel
trigger type to select based on trigger patches
virtual Bool_t AcceptCluster(Int_t i, UInt_t &rejectionReason) const
virtual Bool_t FillGeneralHistograms()
TString fTrigClass
trigger class name for event selection
Float_t fPtHardAndJetPtFactor
Factor between ptHard and jet pT to reject/accept event.
AliVCluster * GetAcceptCluster(Int_t i) const
TClonesArray * GetParticleArray(Int_t i=0) const
BeamType GetBeamType() const
Double_t fMinVz
min vertex for event selection
virtual AliVParticle * GetAcceptParticle(Int_t i=-1) const
BeamType fBeamType
!event beam type
std::vector< TString > GetTriggerClasses() const
Float_t fPtHardAndTrackPtFactor
Factor between ptHard and track pT to reject/accept event.
Double_t fCent
!event centrality
Double_t fMinEventPlane
minimum event plane value
TString fCaloCellsName
name of calo cell collection
Int_t GetNClusters(Int_t i=0) const
Int_t fNVertCont
!event vertex number of contributors
Bool_t fMCRejectFilter
enable the filtering of events by tail rejection
unsigned long ULong_t
Definition: External.C:38
Double_t fZvertexDiff
upper limit for distance between primary and SPD vertex
virtual Bool_t AcceptParticle(const AliVParticle *vp, UInt_t &rejectionReason) const
EMCAL Level0 trigger.
EMCAL Level1 jet trigger, high threshold.
Int_t fSelectPtHardBin
select one pt hard bin for analysis
AliMCParticleContainer * AddMCParticleContainer(const char *n)
static Double_t GetParallelFraction(AliVParticle *part1, AliVParticle *part2)
virtual Bool_t RetrieveEventObjects()
Bool_t fRejectPileup
Reject pilup using function AliAnalysisUtils::IsPileUpEvent()
TProfile * fHistXsection
!x section from pyxsec.root
Bool_t PythiaInfoFromFile(const char *currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
void UserExec(Option_t *option)
void SetPartonFlag6(Int_t flag6)
AliVCaloCells * fCaloCells
!cells
TClonesArray * GetArrayFromEvent(const char *name, const char *clname=0)
Enhanced TList-derived class that implements correct merging for pt_hard binned production.
Definition: AliEmcalList.h:25
Double_t fEventPlaneVsEmcal
select events which have a certain event plane wrt the emcal
virtual Bool_t IsEventSelected()
TH1 * fHistPtHard
!pt hard distribution
void SetParticleEtaLimits(Double_t min, Double_t max)
AliEmcalList * fOutput
!output list
Double_t fMaxBinPt
max pt in histograms
Int_t fPtHardBin
!event -hard bin
virtual void RunChanged(Int_t)
TClonesArray * fTracks
!tracks
TH1 * fHistTrialsAfterSel
!total number of trials per pt hard bin after selection
AliGenHerwigEventHeader * fHerwigHeader
!event Herwig header
void LoadPythiaInfo(AliVEvent *event)
Bool_t fIsEsd
!whether it's an ESD analysis
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
static AliAODInputHandler * AddAODHandler()
Double_t fVertex[3]
!event vertex
AliTrackContainer * AddTrackContainer(const char *n)
Handler for downscale factors for various triggers obtained from the OCDB.
Bool_t fCreateHisto
whether or not create histograms
Store some informaion about a Pythia eventThis class is used to store some information about a Pythia...
TFile * file
TH1 * fHistEventRejection
!book keep reasons for rejecting event
Int_t nevents[nsamples]
TClonesArray * fTriggerPatchInfo
!trigger patch info array
TClonesArray * GetClusterArray(Int_t i=0) const
Double_t fEPV0A
!event plane V0A
TString fCentEst
name of V0 centrality estimator
TString fPythiaInfoName
name of pythia info object
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235
Declaration of class AliEmcalPythiaInfo.
const char Option_t
Definition: External.C:48
void SetClusPtCut(Double_t cut)
Int_t fRunNumber
!run number (triggering RunChanged()
EMCAL Level1 gamma trigger, high threshold.
void AddObjectToEvent(TObject *obj, Bool_t attempt=kFALSE)
AliVCaloTrigger * fCaloTriggers
!calo triggers
void SetRejectionReasonLabels(TAxis *axis)
TH1 * fHistZVertex
!z vertex position
Int_t fMinNTrack
minimum nr of tracks in event with pT>fTrackPtCut
static Byte_t GetTrackType(const AliVTrack *t)
Bool_t fUseAliAnaUtils
used for LHC13* data: z-vtx, Ncontributors, z-vtx resolution cuts
void SetClusTimeCut(Double_t min, Double_t max, Int_t c=0)
bool Bool_t
Definition: External.C:53
ULong_t fTriggers
list of fired triggers
static AliESDInputHandler * AddESDHandler()
Double_t fMaxEventPlane
maximum event plane value
void SetPythiaEventWeight(Float_t ptWeight)
Float_t fXsection
!x-section from pythia header
TH1 * fHistEventCount
!incoming and selected events
Double_t fMaxCent
max centrality for event selection
void SetClusTimeCut(Double_t min, Double_t max)
TriggerCategory
Online trigger categories.
void SetParticlePhiLimits(Double_t min, Double_t max)
AliVParticle * GetAcceptParticleFromArray(Int_t p, Int_t c=0) const
Container structure for EMCAL clusters.
TString fMinBiasRefTrigger
Name of the minmum bias reference trigger, used in the calculation of downscale-corrected event numbe...
Container for MC-true particles within the EMCAL framework.
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
AliVCluster * GetAcceptClusterFromArray(Int_t cl, Int_t c=0) const
Int_t fNbins
no. of pt bins
Bool_t fTklVsClusSPDCut
Apply tracklet-vs-cluster SPD cut to reject background events in pp.
TArrayI fPtHardBinning
-hard binning
TList * OpenFile(const char *fname)
Definition: DrawAnaELoss.C:65
AliEMCALTriggerPatchInfo * GetMainTriggerPatch(TriggerCategory triggersel=kTriggerLevel1Jet, Bool_t doOfflinSimple=kFALSE)
static Double_t fgkEMCalDCalPhiDivide
phi value used to distinguish between DCal and EMCal