AliPhysics  720d1f3 (720d1f3)
 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 <memory>
17 
18 #include <TClonesArray.h>
19 #include <AliEmcalList.h>
20 #include <TObject.h>
21 #include <TH1F.h>
22 #include <TProfile.h>
23 #include <TSystem.h>
24 #include <TFile.h>
25 #include <TChain.h>
26 #include <TKey.h>
27 
28 #include "AliAnalysisTaskEmcal.h"
29 #include "AliAnalysisUtils.h"
30 #include "AliAODEvent.h"
31 #include "AliAODMCHeader.h"
32 #include "AliAODTrack.h"
33 #include "AliAnalysisManager.h"
34 #include "AliCentrality.h"
36 #include "AliEMCALGeometry.h"
37 #include "AliEmcalPythiaInfo.h"
38 #include "AliEMCALTriggerPatchInfo.h"
39 #include "AliESDEvent.h"
40 #include "AliAODInputHandler.h"
41 #include "AliESDInputHandler.h"
42 #include "AliEventplane.h"
43 #include "AliGenPythiaEventHeader.h"
44 #include "AliGenHerwigEventHeader.h"
45 #include "AliInputEventHandler.h"
46 #include "AliLog.h"
47 #include "AliMCEvent.h"
48 #include "AliMCParticle.h"
49 #include "AliMultiInputEventHandler.h"
50 #include "AliMultSelection.h"
51 #include "AliStack.h"
52 #include "AliVCaloTrigger.h"
53 #include "AliVCluster.h"
54 #include "AliVEventHandler.h"
55 #include "AliVParticle.h"
56 
58 
62 
67  AliAnalysisTaskSE("AliAnalysisTaskEmcal"),
68  fPythiaInfoName(""),
69  fForceBeamType(kNA),
70  fGeneralHistograms(kFALSE),
71  fLocalInitialized(kFALSE),
72  fCreateHisto(kTRUE),
73  fCaloCellsName(),
74  fCaloTriggersName(),
75  fCaloTriggerPatchInfoName(),
76  fMinCent(-999),
77  fMaxCent(-999),
78  fMinVz(-999),
79  fMaxVz(999),
80  fTrackPtCut(0),
81  fMinNTrack(0),
82  fZvertexDiff(0.5),
83  fUseAliAnaUtils(kFALSE),
84  fRejectPileup(kFALSE),
85  fTklVsClusSPDCut(kFALSE),
86  fOffTrigger(AliVEvent::kAny),
87  fTrigClass(),
88  fMinBiasRefTrigger("CINT7-B-NOPF-ALLNOTRD"),
89  fTriggerTypeSel(kND),
90  fNbins(250),
91  fMinBinPt(0),
92  fMaxBinPt(250),
93  fMinPtTrackInEmcal(0),
94  fEventPlaneVsEmcal(-1),
95  fMinEventPlane(-1e6),
96  fMaxEventPlane(1e6),
97  fCentEst("V0M"),
98  fIsEmbedded(kFALSE),
99  fIsPythia(kFALSE),
100  fIsHerwig(kFALSE),
101  fSelectPtHardBin(-999),
102  fMinMCLabel(0),
103  fMCLabelShift(0),
104  fNcentBins(4),
105  fNeedEmcalGeom(kTRUE),
106  fParticleCollArray(),
107  fClusterCollArray(),
108  fTriggers(0),
109  fEMCalTriggerMode(kOverlapWithLowThreshold),
110  fUseNewCentralityEstimation(kFALSE),
111  fGeneratePythiaInfoObject(kFALSE),
112  fUsePtHardBinScaling(kFALSE),
113  fMCRejectFilter(kFALSE),
114  fCountDownscaleCorrectedEvents(kFALSE),
115  fPtHardAndJetPtFactor(0.),
116  fPtHardAndClusterPtFactor(0.),
117  fPtHardAndTrackPtFactor(0.),
118  fRunNumber(-1),
119  fAliAnalysisUtils(nullptr),
120  fIsEsd(kFALSE),
121  fGeom(nullptr),
122  fTracks(nullptr),
123  fCaloClusters(nullptr),
124  fCaloCells(nullptr),
125  fCaloTriggers(nullptr),
126  fTriggerPatchInfo(nullptr),
127  fCent(0),
128  fCentBin(-1),
129  fEPV0(-1.0),
130  fEPV0A(-1.0),
131  fEPV0C(-1.0),
132  fNVertCont(0),
133  fNVertSPDCont(0),
134  fBeamType(kNA),
135  fPythiaHeader(nullptr),
136  fHerwigHeader(nullptr),
137  fPtHard(0),
138  fPtHardBin(0),
139  fNTrials(0),
140  fXsection(0),
141  fPythiaInfo(nullptr),
142  fOutput(nullptr),
143  fHistEventCount(nullptr),
144  fHistTrialsAfterSel(nullptr),
145  fHistEventsAfterSel(nullptr),
146  fHistXsectionAfterSel(nullptr),
147  fHistTrials(nullptr),
148  fHistEvents(nullptr),
149  fHistXsection(nullptr),
150  fHistPtHard(nullptr),
151  fHistCentrality(nullptr),
152  fHistZVertex(nullptr),
153  fHistEventPlane(nullptr),
154  fHistEventRejection(nullptr),
155  fHistTriggerClasses(nullptr),
156  fHistTriggerClassesCorr(nullptr)
157 {
158  fVertex[0] = 0;
159  fVertex[1] = 0;
160  fVertex[2] = 0;
161  fVertexSPD[0] = 0;
162  fVertexSPD[1] = 0;
163  fVertexSPD[2] = 0;
164 
165  fParticleCollArray.SetOwner(kTRUE);
166  fClusterCollArray.SetOwner(kTRUE);
167 }
168 
180  AliAnalysisTaskSE(name),
181  fPythiaInfoName(""),
182  fForceBeamType(kNA),
183  fGeneralHistograms(kFALSE),
184  fLocalInitialized(kFALSE),
185  fCreateHisto(histo),
186  fCaloCellsName(),
187  fCaloTriggersName(),
188  fCaloTriggerPatchInfoName(),
189  fMinCent(-999),
190  fMaxCent(-999),
191  fMinVz(-999),
192  fMaxVz(999),
193  fTrackPtCut(0),
194  fMinNTrack(0),
195  fZvertexDiff(0.5),
196  fUseAliAnaUtils(kFALSE),
197  fRejectPileup(kFALSE),
198  fTklVsClusSPDCut(kFALSE),
199  fOffTrigger(AliVEvent::kAny),
200  fTrigClass(),
201  fMinBiasRefTrigger("CINT7-B-NOPF-ALLNOTRD"),
202  fTriggerTypeSel(kND),
203  fNbins(250),
204  fMinBinPt(0),
205  fMaxBinPt(250),
206  fMinPtTrackInEmcal(0),
207  fEventPlaneVsEmcal(-1),
208  fMinEventPlane(-1e6),
209  fMaxEventPlane(1e6),
210  fCentEst("V0M"),
211  fIsEmbedded(kFALSE),
212  fIsPythia(kFALSE),
213  fIsHerwig(kFALSE),
214  fSelectPtHardBin(-999),
215  fMinMCLabel(0),
216  fMCLabelShift(0),
217  fNcentBins(4),
218  fNeedEmcalGeom(kTRUE),
219  fParticleCollArray(),
220  fClusterCollArray(),
221  fTriggers(0),
222  fEMCalTriggerMode(kOverlapWithLowThreshold),
223  fUseNewCentralityEstimation(kFALSE),
224  fGeneratePythiaInfoObject(kFALSE),
225  fUsePtHardBinScaling(kFALSE),
226  fMCRejectFilter(kFALSE),
227  fCountDownscaleCorrectedEvents(kFALSE),
228  fPtHardAndJetPtFactor(0.),
229  fPtHardAndClusterPtFactor(0.),
230  fPtHardAndTrackPtFactor(0.),
231  fRunNumber(-1),
232  fAliAnalysisUtils(nullptr),
233  fIsEsd(kFALSE),
234  fGeom(nullptr),
235  fTracks(nullptr),
236  fCaloClusters(nullptr),
237  fCaloCells(nullptr),
238  fCaloTriggers(nullptr),
239  fTriggerPatchInfo(nullptr),
240  fCent(0),
241  fCentBin(-1),
242  fEPV0(-1.0),
243  fEPV0A(-1.0),
244  fEPV0C(-1.0),
245  fNVertCont(0),
246  fNVertSPDCont(0),
247  fBeamType(kNA),
248  fPythiaHeader(nullptr),
249  fHerwigHeader(nullptr),
250  fPtHard(0),
251  fPtHardBin(0),
252  fNTrials(0),
253  fXsection(0),
254  fPythiaInfo(0),
255  fOutput(nullptr),
256  fHistEventCount(nullptr),
257  fHistTrialsAfterSel(nullptr),
258  fHistEventsAfterSel(nullptr),
259  fHistXsectionAfterSel(nullptr),
260  fHistTrials(nullptr),
261  fHistEvents(nullptr),
262  fHistXsection(nullptr),
263  fHistPtHard(nullptr),
264  fHistCentrality(nullptr),
265  fHistZVertex(nullptr),
266  fHistEventPlane(nullptr),
267  fHistEventRejection(nullptr),
268  fHistTriggerClasses(nullptr),
269  fHistTriggerClassesCorr(nullptr)
270 {
271  fVertex[0] = 0;
272  fVertex[1] = 0;
273  fVertex[2] = 0;
274  fVertexSPD[0] = 0;
275  fVertexSPD[1] = 0;
276  fVertexSPD[2] = 0;
277  fParticleCollArray.SetOwner(kTRUE);
278  fClusterCollArray.SetOwner(kTRUE);
279 
280  if (fCreateHisto) {
281  DefineOutput(1, AliEmcalList::Class());
282  }
283 }
284 
289 {
290 }
291 
299 {
301  if (cont) cont->SetClusPtCut(cut);
302  else AliError(Form("%s in SetClusPtCut(...): container %d not found",GetName(),c));
303 }
304 
313 {
315  if (cont) cont->SetClusTimeCut(min,max);
316  else AliError(Form("%s in SetClusTimeCut(...): container %d not found",GetName(),c));
317 }
318 
326 {
328  if (cont) cont->SetParticlePtCut(cut);
329  else AliError(Form("%s in SetTrackPtCut(...): container %d not found",GetName(),c));
330 
331  fTrackPtCut = cut;
332 }
333 
342 {
344  if (cont) cont->SetParticleEtaLimits(min,max);
345  else AliError(Form("%s in SetTrackPtCut(...): container %d not found",GetName(),c));
346 }
347 
356 {
358  if (cont) cont->SetParticlePhiLimits(min,max);
359  else AliError(Form("%s in SetTrackPhiLimits(...): container %d not found",GetName(),c));
360 }
361 
382 {
383  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
384  if (mgr) {
385  AliVEventHandler *evhand = mgr->GetInputEventHandler();
386  if (evhand) {
387  if (evhand->InheritsFrom("AliESDInputHandler")) {
388  fIsEsd = kTRUE;
389  }
390  else {
391  fIsEsd = kFALSE;
392  }
393  }
394  else {
395  AliError("Event handler not found!");
396  }
397  }
398  else {
399  AliError("Analysis manager not found!");
400  }
401 
402  if (!fCreateHisto)
403  return;
404 
405  OpenFile(1);
406  fOutput = new AliEmcalList();
408  fOutput->SetOwner();
409 
410  if (fForceBeamType == kpp)
411  fNcentBins = 1;
412 
413  if (!fGeneralHistograms)
414  return;
415 
416  if (fIsPythia || fIsHerwig) {
417  fHistTrialsAfterSel = new TH1F("fHistTrialsAfterSel", "fHistTrialsAfterSel", 11, 0, 11);
418  fHistTrialsAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
419  fHistTrialsAfterSel->GetYaxis()->SetTitle("trials");
421 
422  fHistEventsAfterSel = new TH1F("fHistEventsAfterSel", "fHistEventsAfterSel", 11, 0, 11);
423  fHistEventsAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
424  fHistEventsAfterSel->GetYaxis()->SetTitle("total events");
426 
427  fHistXsectionAfterSel = new TProfile("fHistXsectionAfterSel", "fHistXsectionAfterSel", 11, 0, 11);
428  fHistXsectionAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
429  fHistXsectionAfterSel->GetYaxis()->SetTitle("xsection");
431 
432  fHistTrials = new TH1F("fHistTrials", "fHistTrials", 11, 0, 11);
433  fHistTrials->GetXaxis()->SetTitle("p_{T} hard bin");
434  fHistTrials->GetYaxis()->SetTitle("trials");
435  fOutput->Add(fHistTrials);
436 
437  fHistEvents = new TH1F("fHistEvents", "fHistEvents", 11, 0, 11);
438  fHistEvents->GetXaxis()->SetTitle("p_{T} hard bin");
439  fHistEvents->GetYaxis()->SetTitle("total events");
440  fOutput->Add(fHistEvents);
441 
442  fHistXsection = new TProfile("fHistXsection", "fHistXsection", 11, 0, 11);
443  fHistXsection->GetXaxis()->SetTitle("p_{T} hard bin");
444  fHistXsection->GetYaxis()->SetTitle("xsection");
445  fOutput->Add(fHistXsection);
446 
447  const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234};
448  const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000};
449 
450  for (Int_t i = 1; i < 12; i++) {
451  fHistTrialsAfterSel->GetXaxis()->SetBinLabel(i, Form("%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
452  fHistEventsAfterSel->GetXaxis()->SetBinLabel(i, Form("%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
453 
454  fHistTrials->GetXaxis()->SetBinLabel(i, Form("%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
455  fHistXsection->GetXaxis()->SetBinLabel(i, Form("%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
456  fHistEvents->GetXaxis()->SetBinLabel(i, Form("%d-%d",ptHardLo[i-1],ptHardHi[i-1]));
457  }
458 
459  fHistPtHard = new TH1F("fHistPtHard", "fHistPtHard", fNbins*2, fMinBinPt, fMaxBinPt*4);
460  fHistPtHard->GetXaxis()->SetTitle("p_{T,hard} (GeV/c)");
461  fHistPtHard->GetYaxis()->SetTitle("counts");
462  fOutput->Add(fHistPtHard);
463  }
464 
465  fHistZVertex = new TH1F("fHistZVertex","Z vertex position", 60, -30, 30);
466  fHistZVertex->GetXaxis()->SetTitle("z");
467  fHistZVertex->GetYaxis()->SetTitle("counts");
468  fOutput->Add(fHistZVertex);
469 
470  if (fForceBeamType != kpp) {
471  fHistCentrality = new TH1F("fHistCentrality","Event centrality distribution", 200, 0, 100);
472  fHistCentrality->GetXaxis()->SetTitle("Centrality (%)");
473  fHistCentrality->GetYaxis()->SetTitle("counts");
474  fOutput->Add(fHistCentrality);
475 
476  fHistEventPlane = new TH1F("fHistEventPlane","Event plane", 120, -TMath::Pi(), TMath::Pi());
477  fHistEventPlane->GetXaxis()->SetTitle("event plane");
478  fHistEventPlane->GetYaxis()->SetTitle("counts");
479  fOutput->Add(fHistEventPlane);
480  }
481 
482  fHistEventRejection = new TH1F("fHistEventRejection","Reasons to reject event",20,0,20);
483 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
484  fHistEventRejection->SetBit(TH1::kCanRebin);
485 #else
486  fHistEventRejection->SetCanExtend(TH1::kAllAxes);
487 #endif
488  fHistEventRejection->GetXaxis()->SetBinLabel(1,"PhysSel");
489  fHistEventRejection->GetXaxis()->SetBinLabel(2,"trigger");
490  fHistEventRejection->GetXaxis()->SetBinLabel(3,"trigTypeSel");
491  fHistEventRejection->GetXaxis()->SetBinLabel(4,"Cent");
492  fHistEventRejection->GetXaxis()->SetBinLabel(5,"vertex contr.");
493  fHistEventRejection->GetXaxis()->SetBinLabel(6,"Vz");
494  fHistEventRejection->GetXaxis()->SetBinLabel(7,"VzSPD");
495  fHistEventRejection->GetXaxis()->SetBinLabel(8,"trackInEmcal");
496  fHistEventRejection->GetXaxis()->SetBinLabel(9,"minNTrack");
497  fHistEventRejection->GetXaxis()->SetBinLabel(10,"VtxSel2013pA");
498  fHistEventRejection->GetXaxis()->SetBinLabel(11,"PileUp");
499  fHistEventRejection->GetXaxis()->SetBinLabel(12,"EvtPlane");
500  fHistEventRejection->GetXaxis()->SetBinLabel(13,"SelPtHardBin");
501  fHistEventRejection->GetXaxis()->SetBinLabel(14,"Bkg evt");
502  fHistEventRejection->GetYaxis()->SetTitle("counts");
504 
505  fHistTriggerClasses = new TH1F("fHistTriggerClasses","fHistTriggerClasses",3,0,3);
506 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
507  fHistTriggerClasses->SetBit(TH1::kCanRebin);
508 #else
509  fHistTriggerClasses->SetCanExtend(TH1::kAllAxes);
510 #endif
512 
514  fHistTriggerClassesCorr = new TH1F("fHistTriggerClassesCorr","fHistTriggerClassesCorr",3,0,3);
515 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
516  fHistTriggerClassesCorr->SetBit(TH1::kCanRebin);
517 #else
518  fHistTriggerClassesCorr->SetCanExtend(TH1::kAllAxes);
519 #endif
521  }
522 
523  fHistEventCount = new TH1F("fHistEventCount","fHistEventCount",2,0,2);
524  fHistEventCount->GetXaxis()->SetBinLabel(1,"Accepted");
525  fHistEventCount->GetXaxis()->SetBinLabel(2,"Rejected");
526  fHistEventCount->GetYaxis()->SetTitle("counts");
527  fOutput->Add(fHistEventCount);
528 
529  PostData(1, fOutput);
530 }
531 
546 {
547  if (fIsPythia || fIsHerwig) {
551  fHistPtHard->Fill(fPtHard);
552  }
553 
554 
555  fHistZVertex->Fill(fVertex[2]);
556 
557  if (fForceBeamType != kpp) {
558  fHistCentrality->Fill(fCent);
559  fHistEventPlane->Fill(fEPV0);
560  }
561 
562  std::unique_ptr<TObjArray> triggerClasses(InputEvent()->GetFiredTriggerClasses().Tokenize(" "));
563  TObjString* triggerClass(nullptr);
564  for(auto trg : *triggerClasses){
565  triggerClass = static_cast<TObjString*>(trg);
566  fHistTriggerClasses->Fill(triggerClass->GetString(), 1);
567  }
568 
570  // downscale-corrected number of events are calculated based on the min. bias reference
571  // Formula: N_corr = N_MB * d_Trg/d_{Min_Bias}
572  if(InputEvent()->GetFiredTriggerClasses().Contains(fMinBiasRefTrigger)){
574  Double_t downscaleref = downscalefactors->GetDownscaleFactorForTriggerClass(fMinBiasRefTrigger);
575  for(auto t : downscalefactors->GetTriggerClasses()){
576  Double_t downscaletrg = downscalefactors->GetDownscaleFactorForTriggerClass(t);
577  fHistTriggerClassesCorr->Fill(t, downscaletrg/downscaleref);
578  }
579  }
580  }
581 
582  return kTRUE;
583 }
584 
605 {
606  if (!fLocalInitialized){
607  ExecOnce();
608  UserExecOnce();
609  }
610 
611  if (!fLocalInitialized)
612  return;
613 
614  if (!RetrieveEventObjects())
615  return;
616 
617  if(InputEvent()->GetRunNumber() != fRunNumber){
618  fRunNumber = InputEvent()->GetRunNumber();
621  }
622 
623  if (IsEventSelected()) {
624  if (fGeneralHistograms) fHistEventCount->Fill("Accepted",1);
625  }
626  else {
627  if (fGeneralHistograms) fHistEventCount->Fill("Rejected",1);
628  return;
629  }
630 
632  if (!FillGeneralHistograms())
633  return;
634  }
635 
636  if (!Run())
637  return;
638 
639  if (fCreateHisto) {
640  if (!FillHistograms())
641  return;
642  }
643 
644  if (fCreateHisto && fOutput) {
645  // information for this iteration of the UserExec in the container
646  PostData(1, fOutput);
647  }
648 }
649 
659 {
660  AliWarning("AliAnalysisTaskEmcal::AcceptCluster method is deprecated. Please use GetCusterContainer(c)->AcceptCluster(clus).");
661 
662  if (!clus) return kFALSE;
663 
665  if (!cont) {
666  AliError(Form("%s:Container %d not found",GetName(),c));
667  return 0;
668  }
669  UInt_t rejectionReason = 0;
670  return cont->AcceptCluster(clus, rejectionReason);
671 }
672 
681 Bool_t AliAnalysisTaskEmcal::AcceptTrack(AliVParticle *track, Int_t c) const
682 {
683  AliWarning("AliAnalysisTaskEmcal::AcceptTrack method is deprecated. Please use GetParticleContainer(c)->AcceptParticle(clus).");
684 
685  if (!track) return kFALSE;
686 
688  if (!cont) {
689  AliError(Form("%s:Container %d not found",GetName(),c));
690  return 0;
691  }
692 
693  UInt_t rejectionReason = 0;
694  return cont->AcceptParticle(track, rejectionReason);
695 }
696 
708 Bool_t AliAnalysisTaskEmcal::PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
709 {
710 
711  TString file(currFile);
712  fXsec = 0;
713  fTrials = 1;
714 
715  if (file.Contains(".zip#")) {
716  Ssiz_t pos1 = file.Index("root_archive",12,0,TString::kExact);
717  Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
718  Ssiz_t pos2 = file.Index(".root",5,TString::kExact);
719  file.Replace(pos+1,pos2-pos1,"");
720  } else {
721  // not an archive take the basename....
722  file.ReplaceAll(gSystem->BaseName(file.Data()),"");
723  }
724  AliDebug(1,Form("File name: %s",file.Data()));
725 
726  // Get the pt hard bin
727  TString strPthard(file);
728 
729  strPthard.Remove(strPthard.Last('/'));
730  strPthard.Remove(strPthard.Last('/'));
731  if (strPthard.Contains("AOD")) strPthard.Remove(strPthard.Last('/'));
732  strPthard.Remove(0,strPthard.Last('/')+1);
733  if (strPthard.IsDec()) pthard = strPthard.Atoi();
734  else
735  AliWarning(Form("Could not extract file number from path %s", strPthard.Data()));
736 
737  // 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
738  std::unique_ptr<TFile> fxsec(TFile::Open(Form("%s%s",file.Data(),"pyxsec.root")));
739 
740  if (!fxsec) {
741  // next trial fetch the histgram file
742  fxsec = std::unique_ptr<TFile>(TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root")));
743  if (!fxsec) return kFALSE; // not a severe condition but inciate that we have no information
744  else {
745  // find the tlist we want to be independtent of the name so use the Tkey
746  TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
747  if (!key) return kFALSE;
748  TList *list = dynamic_cast<TList*>(key->ReadObj());
749  if (!list) return kFALSE;
750  fXsec = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1);
751  fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
752  }
753  } else { // no tree pyxsec.root
754  TTree *xtree = (TTree*)fxsec->Get("Xsection");
755  if (!xtree) return kFALSE;
756  UInt_t ntrials = 0;
757  Double_t xsection = 0;
758  xtree->SetBranchAddress("xsection",&xsection);
759  xtree->SetBranchAddress("ntrials",&ntrials);
760  xtree->GetEntry(0);
761  fTrials = ntrials;
762  fXsec = xsection;
763  }
764  return kTRUE;
765 }
766 
781 {
783  return kTRUE;
784 
785  TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
786  if (!tree) {
787  AliError(Form("%s - UserNotify: No current tree!",GetName()));
788  return kFALSE;
789  }
790 
791  Float_t xsection = 0;
792  Float_t trials = 0;
793  Int_t pthardbin = 0;
794 
795  TFile *curfile = tree->GetCurrentFile();
796  if (!curfile) {
797  AliError(Form("%s - UserNotify: No current file!",GetName()));
798  return kFALSE;
799  }
800 
801  TChain *chain = dynamic_cast<TChain*>(tree);
802  if (chain) tree = chain->GetTree();
803 
804  Int_t nevents = tree->GetEntriesFast();
805 
806  PythiaInfoFromFile(curfile->GetName(), xsection, trials, pthardbin);
807 
808  // TODO: Workaround
809  if ((pthardbin < 0) || (pthardbin > 10)) pthardbin = 0;
810 
811  fHistTrials->Fill(pthardbin, trials);
812  fHistXsection->Fill(pthardbin, xsection);
813  fHistEvents->Fill(pthardbin, nevents);
814 
815  return kTRUE;
816 }
817 
823 {
824  if (!fPythiaInfoName.IsNull() && !fPythiaInfo) {
825  fPythiaInfo = dynamic_cast<AliEmcalPythiaInfo*>(event->FindListObject(fPythiaInfoName));
826  if (!fPythiaInfo) {
827  AliError(Form("%s: Could not retrieve parton infos! %s!", GetName(), fPythiaInfoName.Data()));
828  return;
829  }
830  }
831 }
832 
844 {
845  if (!InputEvent()) {
846  AliError(Form("%s: Could not retrieve event! Returning!", GetName()));
847  return;
848  }
849 
850  LoadPythiaInfo(InputEvent());
851 
852  if (fNeedEmcalGeom) {
853  fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
854  if (!fGeom) {
855  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()));
856  return;
857  }
858  }
859 
860  if (fEventPlaneVsEmcal >= 0) {
861  if (fGeom) {
862  Double_t ep = (fGeom->GetArm1PhiMax() + fGeom->GetArm1PhiMin()) / 2 * TMath::DegToRad() + fEventPlaneVsEmcal - TMath::Pi();
863  fMinEventPlane = ep - TMath::Pi() / 4;
864  fMaxEventPlane = ep + TMath::Pi() / 4;
865  }
866  else {
867  AliWarning("Could not set event plane limits because EMCal geometry was not loaded!");
868  }
869  }
870 
871  //Load all requested track branches - each container knows name already
872  for (Int_t i =0; i<fParticleCollArray.GetEntriesFast(); i++) {
873  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
874  cont->SetArray(InputEvent());
875  }
876 
877  if (fParticleCollArray.GetEntriesFast()>0) {
879  if (!fTracks) {
880  AliError(Form("%s: Could not retrieve first track branch!", GetName()));
881  return;
882  }
883  }
884 
885  //Load all requested cluster branches - each container knows name already
886  for (Int_t i =0; i<fClusterCollArray.GetEntriesFast(); i++) {
887  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
888  cont->SetArray(InputEvent());
889  }
890 
891  if (fClusterCollArray.GetEntriesFast()>0) {
893  if (!fCaloClusters) {
894  AliError(Form("%s: Could not retrieve first cluster branch!", GetName()));
895  return;
896  }
897  }
898 
899  if (!fCaloCellsName.IsNull() && !fCaloCells) {
900  fCaloCells = dynamic_cast<AliVCaloCells*>(InputEvent()->FindListObject(fCaloCellsName));
901  if (!fCaloCells) {
902  AliError(Form("%s: Could not retrieve cells %s!", GetName(), fCaloCellsName.Data()));
903  return;
904  }
905  }
906 
907  if (!fCaloTriggersName.IsNull() && !fCaloTriggers) {
908  fCaloTriggers = dynamic_cast<AliVCaloTrigger*>(InputEvent()->FindListObject(fCaloTriggersName));
909  if (!fCaloTriggers) {
910  AliError(Form("%s: Could not retrieve calo triggers %s!", GetName(), fCaloTriggersName.Data()));
911  return;
912  }
913  }
914 
915  if (!fCaloTriggerPatchInfoName.IsNull() && !fTriggerPatchInfo) {
916  fTriggerPatchInfo = GetArrayFromEvent(fCaloTriggerPatchInfoName.Data(),"AliEMCALTriggerPatchInfo");
917  if (!fTriggerPatchInfo) {
918  AliError(Form("%s: Could not retrieve calo trigger patch info %s!", GetName(), fCaloTriggerPatchInfoName.Data()));
919  return;
920  }
921 
922  }
923 
924  fLocalInitialized = kTRUE;
925 }
926 
933 {
934  if (fForceBeamType != kNA)
935  return fForceBeamType;
936 
937  AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
938  if (esd) {
939  const AliESDRun *run = esd->GetESDRun();
940  TString beamType = run->GetBeamType();
941  if (beamType == "p-p")
942  return kpp;
943  else if (beamType == "A-A")
944  return kAA;
945  else if (beamType == "p-A")
946  return kpA;
947  else
948  return kNA;
949  } else {
950  Int_t runNumber = InputEvent()->GetRunNumber();
951  // All run number ranges taken from the RCT
952  if ((runNumber >= 136833 && runNumber <= 139517) || // LHC10h
953  (runNumber >= 167693 && runNumber <= 170593) || // LHC11h
954  (runNumber >= 244824 && runNumber <= 246994)) { // LHC15o
955  return kAA;
956  } else if ((runNumber >= 188356 && runNumber <= 188366) || // LHC12g
957  (runNumber >= 195164 && runNumber <= 197388) || // LHC13b-f
958  (runNumber >= 265015 && runNumber <= 267166)) { // LHC16q-t
959  return kpA;
960  } else {
961  return kpp;
962  }
963  }
964 }
965 
973 {
974  if (!fTriggerPatchInfo)
975  return 0;
976 
977  //number of patches in event
978  Int_t nPatch = fTriggerPatchInfo->GetEntries();
979 
980  //loop over patches to define trigger type of event
981  Int_t nG1 = 0;
982  Int_t nG2 = 0;
983  Int_t nJ1 = 0;
984  Int_t nJ2 = 0;
985  Int_t nL0 = 0;
986  AliEMCALTriggerPatchInfo *patch;
987  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
988  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
989  if (patch->IsGammaHigh()) nG1++;
990  if (patch->IsGammaLow()) nG2++;
991  if (patch->IsJetHigh()) nJ1++;
992  if (patch->IsJetLow()) nJ2++;
993  if (patch->IsLevel0()) nL0++;
994  }
995 
996  AliDebug(2, "Patch summary: ");
997  AliDebug(2, Form("Number of patches: %d", nPatch));
998  AliDebug(2, Form("Jet: low[%d], high[%d]" ,nJ2, nJ1));
999  AliDebug(2, Form("Gamma: low[%d], high[%d]" ,nG2, nG1));
1000 
1001  ULong_t triggers(0);
1002  if (nL0>0) SETBIT(triggers, kL0);
1003  if (nG1>0) SETBIT(triggers, kG1);
1004  if (nG2>0) SETBIT(triggers, kG2);
1005  if (nJ1>0) SETBIT(triggers, kJ1);
1006  if (nJ2>0) SETBIT(triggers, kJ2);
1007  return triggers;
1008 }
1009 
1017 {
1018  //
1019  if(trigger==kND) {
1020  AliWarning(Form("%s: Requesting undefined trigger type!", GetName()));
1021  return kFALSE;
1022  }
1023  //MV: removing this logic which as far as I can see doesn't make any sense
1024  // if(trigger & kND){
1025  // return fTriggers == 0;
1026  // }
1027  return TESTBIT(fTriggers, trigger);
1028 }
1029 
1052 {
1053  if (fOffTrigger != AliVEvent::kAny) {
1054  UInt_t res = 0;
1055  const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(InputEvent());
1056  if (eev) {
1057  res = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1058  } else {
1059  const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
1060  if (aev) {
1061  res = ((AliVAODHeader*)aev->GetHeader())->GetOfflineTrigger();
1062  }
1063  }
1064  if ((res & fOffTrigger) == 0) {
1065  if (fGeneralHistograms) fHistEventRejection->Fill("PhysSel",1);
1066  return kFALSE;
1067  }
1068  }
1069 
1070  if (!fTrigClass.IsNull()) {
1071  TString fired;
1072  const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(InputEvent());
1073  if (eev) {
1074  fired = eev->GetFiredTriggerClasses();
1075  } else {
1076  const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
1077  if (aev) {
1078  fired = aev->GetFiredTriggerClasses();
1079  }
1080  }
1081  if (!fired.Contains("-B-")) {
1082  if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
1083  return kFALSE;
1084  }
1085 
1086  std::unique_ptr<TObjArray> arr(fTrigClass.Tokenize("|"));
1087  if (!arr) {
1088  if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
1089  return kFALSE;
1090  }
1091  Bool_t match = 0;
1092  for (Int_t i=0;i<arr->GetEntriesFast();++i) {
1093  TObject *obj = arr->At(i);
1094  if (!obj)
1095  continue;
1096 
1097  //Check if requested trigger was fired
1098  TString objStr = obj->GetName();
1100  (objStr.Contains("J1") || objStr.Contains("J2") || objStr.Contains("G1") || objStr.Contains("G2"))) {
1101  // This is relevant for EMCal triggers with 2 thresholds
1102  // If the kOverlapWithLowThreshold was requested than the overlap between the two triggers goes with the lower threshold trigger
1103  TString trigType1 = "J1";
1104  TString trigType2 = "J2";
1105  if(objStr.Contains("G")) {
1106  trigType1 = "G1";
1107  trigType2 = "G2";
1108  }
1109  if(objStr.Contains(trigType2) && fired.Contains(trigType2.Data())) { //requesting low threshold + overlap
1110  match = 1;
1111  break;
1112  }
1113  else if(objStr.Contains(trigType1) && fired.Contains(trigType1.Data()) && !fired.Contains(trigType2.Data())) { //high threshold only
1114  match = 1;
1115  break;
1116  }
1117  }
1118  else {
1119  // If this is not an EMCal trigger, or no particular treatment of EMCal triggers was requested,
1120  // simply check that the trigger was fired
1121  if (fired.Contains(obj->GetName())) {
1122  match = 1;
1123  break;
1124  }
1125  }
1126  }
1127  if (!match) {
1128  if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
1129  return kFALSE;
1130  }
1131  }
1132 
1133  if (fTriggerTypeSel != kND) {
1135  if (fGeneralHistograms) fHistEventRejection->Fill("trigTypeSel",1);
1136  return kFALSE;
1137  }
1138  }
1139 
1140  if ((fMinCent != -999) && (fMaxCent != -999)) {
1141  if (fCent<fMinCent || fCent>fMaxCent) {
1142  if (fGeneralHistograms) fHistEventRejection->Fill("Cent",1);
1143  return kFALSE;
1144  }
1145  }
1146 
1147  if (fUseAliAnaUtils) {
1148  if (!fAliAnalysisUtils)
1149  fAliAnalysisUtils = new AliAnalysisUtils();
1150  fAliAnalysisUtils->SetMinVtxContr(2);
1151  fAliAnalysisUtils->SetMaxVtxZ(999);
1152  if(fMinVz<-998.) fMinVz = -10.;
1153  if(fMaxVz>998.) fMaxVz = 10.;
1154 
1155  if (!fAliAnalysisUtils->IsVertexSelected2013pA(InputEvent())) {
1156  if (fGeneralHistograms) fHistEventRejection->Fill("VtxSel2013pA",1);
1157  return kFALSE;
1158  }
1159 
1160  if (fRejectPileup && fAliAnalysisUtils->IsPileUpEvent(InputEvent())) {
1161  if (fGeneralHistograms) fHistEventRejection->Fill("PileUp",1);
1162  return kFALSE;
1163  }
1164 
1165  if(fTklVsClusSPDCut && fAliAnalysisUtils->IsSPDClusterVsTrackletBG(InputEvent())) {
1166  if (fGeneralHistograms) fHistEventRejection->Fill("Bkg evt",1);
1167  return kFALSE;
1168  }
1169  }
1170 
1171  if ((fMinVz > -998.) && (fMaxVz < 998.)) {
1172  if (fNVertCont == 0 ) {
1173  if (fGeneralHistograms) fHistEventRejection->Fill("vertex contr.",1);
1174  return kFALSE;
1175  }
1176  Double_t vz = fVertex[2];
1177  if (vz < fMinVz || vz > fMaxVz) {
1178  if (fGeneralHistograms) fHistEventRejection->Fill("Vz",1);
1179  return kFALSE;
1180  }
1181 
1182  if (fNVertSPDCont > 0 && fZvertexDiff < 999) {
1183  Double_t vzSPD = fVertexSPD[2];
1184  Double_t dvertex = TMath::Abs(vz-vzSPD);
1185  //if difference larger than fZvertexDiff
1186  if (dvertex > fZvertexDiff) {
1187  if (fGeneralHistograms) fHistEventRejection->Fill("VzSPD",1);
1188  return kFALSE;
1189  }
1190  }
1191  }
1192 
1193  if (fMinPtTrackInEmcal > 0 && fGeom) {
1194  Bool_t trackInEmcalOk = kFALSE;
1195  Int_t ntracks = GetNParticles(0);
1196  for (Int_t i = 0; i < ntracks; i++) {
1197  AliVParticle *track = GetAcceptParticleFromArray(i,0);
1198  if (!track)
1199  continue;
1200 
1201  Double_t phiMin = fGeom->GetArm1PhiMin() * TMath::DegToRad();
1202  Double_t phiMax = fGeom->GetArm1PhiMax() * TMath::DegToRad();
1203  Int_t runNumber = InputEvent()->GetRunNumber();
1204  if (runNumber>=177295 && runNumber<=197470) { //small SM masked in 2012 and 2013
1205  phiMin = 1.4;
1206  phiMax = TMath::Pi();
1207  }
1208 
1209  if (track->Eta() < fGeom->GetArm1EtaMin() || track->Eta() > fGeom->GetArm1EtaMax() || track->Phi() < phiMin || track->Phi() > phiMax)
1210  continue;
1211  if (track->Pt() > fMinPtTrackInEmcal) {
1212  trackInEmcalOk = kTRUE;
1213  break;
1214  }
1215  }
1216  if (!trackInEmcalOk) {
1217  if (fGeneralHistograms) fHistEventRejection->Fill("trackInEmcal",1);
1218  return kFALSE;
1219  }
1220  }
1221 
1222  if (fMinNTrack > 0) {
1223  Int_t nTracksAcc = 0;
1224  Int_t ntracks = GetNParticles(0);
1225  for (Int_t i = 0; i < ntracks; i++) {
1226  AliVParticle *track = GetAcceptParticleFromArray(i,0);
1227  if (!track)
1228  continue;
1229  if (track->Pt() > fTrackPtCut) {
1230  nTracksAcc++;
1231  if (nTracksAcc>=fMinNTrack)
1232  break;
1233  }
1234  }
1235  if (nTracksAcc<fMinNTrack) {
1236  if (fGeneralHistograms) fHistEventRejection->Fill("minNTrack",1);
1237  return kFALSE;
1238  }
1239  }
1240 
1241  if (!(fEPV0 > fMinEventPlane && fEPV0 <= fMaxEventPlane) &&
1242  !(fEPV0 + TMath::Pi() > fMinEventPlane && fEPV0 + TMath::Pi() <= fMaxEventPlane) &&
1243  !(fEPV0 - TMath::Pi() > fMinEventPlane && fEPV0 - TMath::Pi() <= fMaxEventPlane))
1244  {
1245  if (fGeneralHistograms) fHistEventRejection->Fill("EvtPlane",1);
1246  return kFALSE;
1247  }
1248 
1249  if (fSelectPtHardBin != -999 && fSelectPtHardBin != fPtHardBin) {
1250  if (fGeneralHistograms) fHistEventRejection->Fill("SelPtHardBin",1);
1251  return kFALSE;
1252  }
1253 
1254  // Reject filter for MC data
1255  if (!CheckMCOutliers()) return kFALSE;
1256 
1257  return kTRUE;
1258 }
1259 
1266 {
1267  if (!fPythiaHeader || !fMCRejectFilter) return kTRUE;
1268 
1269  // Condition 1: Pythia jet / pT-hard > factor
1270  if (fPtHardAndJetPtFactor > 0.) {
1271  AliTLorentzVector jet;
1272 
1273  Int_t nTriggerJets = fPythiaHeader->NTriggerJets();
1274 
1275  AliDebug(1,Form("Njets: %d, pT Hard %f",nTriggerJets, fPtHard));
1276 
1277  Float_t tmpjet[]={0,0,0,0};
1278  for (Int_t ijet = 0; ijet< nTriggerJets; ijet++) {
1279  fPythiaHeader->TriggerJet(ijet, tmpjet);
1280 
1281  jet.SetPxPyPzE(tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3]);
1282 
1283  AliDebug(1,Form("jet %d; pycell jet pT %f",ijet, jet.Pt()));
1284 
1285  //Compare jet pT and pt Hard
1286  if (jet.Pt() > fPtHardAndJetPtFactor * fPtHard) {
1287  AliInfo(Form("Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n", fPtHard, jet.Pt(), fPtHardAndJetPtFactor));
1288  return kFALSE;
1289  }
1290  }
1291  }
1292  // end condition 1
1293 
1294  // Condition 2 : Reconstructed EMCal cluster pT / pT-hard > factor
1295  if (fPtHardAndClusterPtFactor > 0.) {
1296  AliClusterContainer* mccluscont = GetClusterContainer(0);
1297  if ((Bool_t)mccluscont) {
1298  for (auto cluster : mccluscont->all()) {// Not cuts applied ; use accept for cuts
1299  Float_t ecluster = cluster->E();
1300 
1301  if (ecluster > (fPtHardAndClusterPtFactor * fPtHard)) {
1302  AliInfo(Form("Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f",ecluster,cluster->GetType(),fPtHardAndClusterPtFactor,fPtHard));
1303  return kFALSE;
1304  }
1305  }
1306  }
1307  }
1308  // end condition 2
1309 
1310  // condition 3 : Reconstructed track pT / pT-hard >factor
1311  if (fPtHardAndTrackPtFactor > 0.) {
1312  AliMCParticleContainer* mcpartcont = dynamic_cast<AliMCParticleContainer*>(GetParticleContainer(0));
1313  if ((Bool_t)mcpartcont) {
1314  for (auto mctrack : mcpartcont->all()) {// Not cuts applied ; use accept for cuts
1315  Float_t trackpt = mctrack->Pt();
1316  if (trackpt > (fPtHardAndTrackPtFactor * fPtHard) ) {
1317  AliInfo(Form("Reject : track %2.2f, factor %2.2f, ptHard %f", trackpt, fPtHardAndTrackPtFactor, fPtHard));
1318  return kFALSE;
1319  }
1320  }
1321  }
1322  }
1323  // end condition 3
1324 
1325  return kTRUE;
1326 }
1327 
1336 TClonesArray *AliAnalysisTaskEmcal::GetArrayFromEvent(const char *name, const char *clname)
1337 {
1338  TClonesArray *arr = 0;
1339  TString sname(name);
1340  if (!sname.IsNull()) {
1341  arr = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(sname));
1342  if (!arr) {
1343  AliWarning(Form("%s: Could not retrieve array with name %s!", GetName(), name));
1344  return 0;
1345  }
1346  } else {
1347  return 0;
1348  }
1349 
1350  if (!clname)
1351  return arr;
1352 
1353  TString objname(arr->GetClass()->GetName());
1354  TClass cls(objname);
1355  if (!cls.InheritsFrom(clname)) {
1356  AliWarning(Form("%s: Objects of type %s in %s are not inherited from %s!",
1357  GetName(), cls.GetName(), name, clname));
1358  return 0;
1359  }
1360  return arr;
1361 }
1362 
1368 {
1369  fVertex[0] = 0;
1370  fVertex[1] = 0;
1371  fVertex[2] = 0;
1372  fNVertCont = 0;
1373 
1374  fVertexSPD[0] = 0;
1375  fVertexSPD[1] = 0;
1376  fVertexSPD[2] = 0;
1377  fNVertSPDCont = 0;
1378 
1379  if (fGeneratePythiaInfoObject && MCEvent()) {
1380  GeneratePythiaInfoObject(MCEvent());
1381  }
1382 
1383  const AliVVertex *vert = InputEvent()->GetPrimaryVertex();
1384  if (vert) {
1385  vert->GetXYZ(fVertex);
1386  fNVertCont = vert->GetNContributors();
1387  }
1388 
1389  const AliVVertex *vertSPD = InputEvent()->GetPrimaryVertexSPD();
1390  if (vertSPD) {
1391  vertSPD->GetXYZ(fVertexSPD);
1392  fNVertSPDCont = vertSPD->GetNContributors();
1393  }
1394 
1395  fBeamType = GetBeamType();
1396 
1397  if (fBeamType == kAA || fBeamType == kpA ) {
1399  AliMultSelection *MultSelection = static_cast<AliMultSelection*>(InputEvent()->FindListObject("MultSelection"));
1400  if (MultSelection) {
1401  fCent = MultSelection->GetMultiplicityPercentile(fCentEst.Data());
1402  }
1403  else {
1404  AliWarning(Form("%s: Could not retrieve centrality information! Assuming 99", GetName()));
1405  }
1406  }
1407  else { // old centrality estimation < 2015
1408  AliCentrality *aliCent = InputEvent()->GetCentrality();
1409  if (aliCent) {
1410  fCent = aliCent->GetCentralityPercentile(fCentEst.Data());
1411  }
1412  else {
1413  AliWarning(Form("%s: Could not retrieve centrality information! Assuming 99", GetName()));
1414  }
1415  }
1416 
1417  if (fNcentBins==4) {
1418  if (fCent >= 0 && fCent < 10) fCentBin = 0;
1419  else if (fCent >= 10 && fCent < 30) fCentBin = 1;
1420  else if (fCent >= 30 && fCent < 50) fCentBin = 2;
1421  else if (fCent >= 50 && fCent <= 100) fCentBin = 3;
1422  else {
1423  AliWarning(Form("%s: Negative centrality: %f. Assuming 99", GetName(), fCent));
1424  fCentBin = fNcentBins-1;
1425  }
1426  }
1427  else if (fNcentBins==5) { // for PbPb 2015
1428  if (fCent >= 0 && fCent < 10) fCentBin = 0;
1429  else if (fCent >= 10 && fCent < 30) fCentBin = 1;
1430  else if (fCent >= 30 && fCent < 50) fCentBin = 2;
1431  else if (fCent >= 50 && fCent <= 90) fCentBin = 3;
1432  else if (fCent > 90) {
1433  fCent = 99;
1434  fCentBin = 4;
1435  }
1436  else {
1437  AliWarning(Form("%s: Negative centrality: %f. Assuming 99", GetName(), fCent));
1438  fCentBin = fNcentBins-1;
1439  }
1440  }
1441  else {
1442  Double_t centWidth = (fMaxCent-fMinCent)/(Double_t)fNcentBins;
1443  if(centWidth>0.) {
1444  fCentBin = TMath::FloorNint(fCent/centWidth);
1445  }
1446  else {
1447  fCentBin = 0;
1448  }
1449  if (fCentBin>=fNcentBins) {
1450  AliWarning(Form("%s: fCentBin too large: cent = %f fCentBin = %d. Assuming 99", GetName(),fCent,fCentBin));
1451  fCentBin = fNcentBins-1;
1452  }
1453  }
1454 
1455  AliEventplane *aliEP = InputEvent()->GetEventplane();
1456  if (aliEP) {
1457  fEPV0 = aliEP->GetEventplane("V0" ,InputEvent());
1458  fEPV0A = aliEP->GetEventplane("V0A",InputEvent());
1459  fEPV0C = aliEP->GetEventplane("V0C",InputEvent());
1460  } else {
1461  AliWarning(Form("%s: Could not retrieve event plane information!", GetName()));
1462  }
1463  }
1464  else {
1465  fCent = 99;
1466  fCentBin = 0;
1467  }
1468 
1469  if (fIsPythia) {
1470  if (MCEvent()) {
1471  fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent()->GenEventHeader());
1472  if (!fPythiaHeader) {
1473  // Check if AOD
1474  AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1475 
1476  if (aodMCH) {
1477  for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1478  fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(aodMCH->GetCocktailHeader(i));
1479  if (fPythiaHeader) break;
1480  }
1481  }
1482  }
1483  }
1484  }
1485 
1486  if (fPythiaHeader) {
1487  fPtHard = fPythiaHeader->GetPtHard();
1488 
1489  const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234};
1490  const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000};
1491  for (fPtHardBin = 0; fPtHardBin < 11; fPtHardBin++) {
1492  if (fPtHard >= ptHardLo[fPtHardBin] && fPtHard < ptHardHi[fPtHardBin])
1493  break;
1494  }
1495 
1496  fXsection = fPythiaHeader->GetXsection();
1497  fNTrials = fPythiaHeader->Trials();
1498  }
1499 
1500 
1501 
1502  if (fIsHerwig) {
1503 
1504  if (MCEvent()) {
1505  fHerwigHeader = dynamic_cast<AliGenHerwigEventHeader*>(MCEvent()->GenEventHeader());
1506 
1507 
1508  if (!fHerwigHeader) {
1509  // Check if AOD
1510 
1511  AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1512 
1513  if (aodMCH) {
1514  for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1515  fHerwigHeader = dynamic_cast<AliGenHerwigEventHeader*>(aodMCH->GetCocktailHeader(i));
1516  if (fHerwigHeader) break;
1517  }
1518  }
1519  }
1520  }
1521  }
1522 
1523  if (fHerwigHeader) {
1524  fPtHard = fHerwigHeader->GetPtHard();
1525 
1526  const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234};
1527  const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000};
1528  for (fPtHardBin = 0; fPtHardBin < 11; fPtHardBin++) {
1529  if (fPtHard >= ptHardLo[fPtHardBin] && fPtHard < ptHardHi[fPtHardBin])
1530  break;
1531  }
1532  fXsection = fHerwigHeader->Weight();
1533  fNTrials = fHerwigHeader->Trials();
1534  }
1535 
1536 
1538 
1539  AliEmcalContainer* cont = 0;
1540 
1541  TIter nextPartColl(&fParticleCollArray);
1542  while ((cont = static_cast<AliEmcalContainer*>(nextPartColl()))) cont->NextEvent();
1543 
1544  TIter nextClusColl(&fClusterCollArray);
1545  while ((cont = static_cast<AliParticleContainer*>(nextClusColl()))) cont->NextEvent();
1546 
1547  return kTRUE;
1548 }
1549 
1558 {
1559  if (TString(n).IsNull()) return 0;
1560 
1562 
1563  fParticleCollArray.Add(cont);
1564 
1565  return cont;
1566 }
1567 
1576 {
1577  if (TString(n).IsNull()) return 0;
1578 
1579  AliTrackContainer* cont = new AliTrackContainer(n);
1580 
1581  fParticleCollArray.Add(cont);
1582 
1583  return cont;
1584 }
1585 
1594 {
1595  if (TString(n).IsNull()) return 0;
1596 
1598 
1599  fParticleCollArray.Add(cont);
1600 
1601  return cont;
1602 }
1603 
1612 {
1613  if (TString(n).IsNull()) return 0;
1614 
1616 
1617  fClusterCollArray.Add(cont);
1618 
1619  return cont;
1620 }
1621 
1628 {
1629  if (i<0 || i>fParticleCollArray.GetEntriesFast()) return 0;
1630  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
1631  return cont;
1632 }
1633 
1640 {
1641  if (i<0 || i>fClusterCollArray.GetEntriesFast()) return 0;
1642  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
1643  return cont;
1644 }
1645 
1652 {
1653  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.FindObject(name));
1654  return cont;
1655 }
1656 
1663 {
1664  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.FindObject(name));
1665  return cont;
1666 }
1667 
1674 {
1676  if (!cont) {
1677  AliError(Form("%s: Particle container %d not found",GetName(),i));
1678  return 0;
1679  }
1680  TString contName = cont->GetArrayName();
1681  return cont->GetArray();
1682 }
1683 
1690 {
1692  if (!cont) {
1693  AliError(Form("%s:Cluster container %d not found",GetName(),i));
1694  return 0;
1695  }
1696  return cont->GetArray();
1697 }
1698 
1707 {
1708 
1710  if (!cont) {
1711  AliError(Form("%s: Particle container %d not found",GetName(),c));
1712  return 0;
1713  }
1714  AliVParticle *vp = cont->GetAcceptParticle(p);
1715 
1716  return vp;
1717 }
1718 
1727 {
1729  if (!cont) {
1730  AliError(Form("%s: Cluster container %d not found",GetName(),c));
1731  return 0;
1732  }
1733  AliVCluster *vc = cont->GetAcceptCluster(cl);
1734 
1735  return vc;
1736 }
1737 
1744 {
1746  if (!cont) {
1747  AliError(Form("%s: Particle container %d not found",GetName(),i));
1748  return 0;
1749  }
1750  return cont->GetNEntries();
1751 }
1752 
1760 {
1762  if (!cont) {
1763  AliError(Form("%s: Cluster container %d not found",GetName(),i));
1764  return 0;
1765  }
1766  return cont->GetNEntries();
1767 }
1768 
1780 AliEMCALTriggerPatchInfo* AliAnalysisTaskEmcal::GetMainTriggerPatch(TriggerCategory trigger, Bool_t doSimpleOffline)
1781 {
1782 
1783  if (!fTriggerPatchInfo) {
1784  AliError(Form("%s: fTriggerPatchInfo not available",GetName()));
1785  return 0;
1786  }
1787 
1788  //number of patches in event
1789  Int_t nPatch = fTriggerPatchInfo->GetEntries();
1790 
1791  //extract main trigger patch(es)
1792  AliEMCALTriggerPatchInfo *patch(NULL), *selected(NULL);
1793  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1794 
1795  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
1796  if (patch->IsMainTrigger()) {
1797  if(doSimpleOffline){
1798  if(patch->IsOfflineSimple()){
1799  switch(trigger){
1800  case kTriggerLevel0:
1801  // option not yet implemented in the trigger maker
1802  if(patch->IsLevel0()) selected = patch;
1803  break;
1804  case kTriggerLevel1Jet:
1805  if(patch->IsJetHighSimple() || patch->IsJetLowSimple()){
1806  if(!selected) selected = patch;
1807  else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1808  }
1809  break;
1810  case kTriggerLevel1Gamma:
1811  if(patch->IsGammaHighSimple() || patch->IsGammaLowSimple()){
1812  if(!selected) selected = patch;
1813  else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1814  }
1815  break;
1816  default: // Silence compiler warnings
1817  AliError("Untreated case: Main Patch is recalculated; should be in 'else' branch");
1818  };
1819  }
1820  } else { // Not OfflineSimple
1821  switch(trigger){
1822  case kTriggerLevel0:
1823  if(patch->IsLevel0()) selected = patch;
1824  break;
1825  case kTriggerLevel1Jet:
1826  if(patch->IsJetHigh() || patch->IsJetLow()){
1827  if(!selected) selected = patch;
1828  else if (patch->GetADCAmp() > selected->GetADCAmp())
1829  selected = patch;
1830  }
1831  break;
1832  case kTriggerLevel1Gamma:
1833  if(patch->IsGammaHigh() || patch->IsGammaLow()){
1834  if(!selected) selected = patch;
1835  else if (patch->GetADCAmp() > selected->GetADCAmp())
1836  selected = patch;
1837  }
1838  break;
1839  default:
1840  AliError("Untreated case: Main Patch is recalculated; should be in 'else' branch");
1841  };
1842  }
1843  }
1844  else if ((trigger == kTriggerRecalcJet && patch->IsRecalcJet()) ||
1845  (trigger == kTriggerRecalcGamma && patch->IsRecalcGamma())) { // recalculated patches
1846  if (doSimpleOffline && patch->IsOfflineSimple()) {
1847  if(!selected) selected = patch;
1848  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
1849  selected = patch;
1850  }
1851  else if (!doSimpleOffline && !patch->IsOfflineSimple()) {
1852  if(!selected) selected = patch;
1853  else if (patch->GetADCAmp() > selected->GetADCAmp())
1854  selected = patch;
1855  }
1856  }
1857  }
1858  return selected;
1859 }
1860 
1867 {
1868  if (!(InputEvent()->FindListObject(obj->GetName()))) {
1869  InputEvent()->AddObject(obj);
1870  }
1871  else {
1872  if (!attempt) {
1873  AliFatal(Form("%s: Container with name %s already present. Aborting", GetName(), obj->GetName()));
1874  }
1875  }
1876 }
1877 
1886 {
1887 
1888  if (!fGeom) {
1889  AliWarning(Form("%s - AliAnalysisTaskEmcal::IsTrackInEmcalAcceptance - Geometry is not available!", GetName()));
1890  return kFALSE;
1891  }
1892 
1893  Double_t minPhi = fGeom->GetArm1PhiMin() - edges;
1894  Double_t maxPhi = fGeom->GetArm1PhiMax() + edges;
1895 
1896  if (part->Phi() > minPhi && part->Phi() < maxPhi) {
1897  return kTRUE;
1898  }
1899  else {
1900  return kFALSE;
1901  }
1902 }
1903 
1905 {
1906  axis->SetBinLabel(1, "NullObject");
1907  axis->SetBinLabel(2, "Pt");
1908  axis->SetBinLabel(3, "Acceptance");
1909  axis->SetBinLabel(4, "MCLabel");
1910  axis->SetBinLabel(5, "BitMap");
1911  axis->SetBinLabel(6, "HF cut");
1912  axis->SetBinLabel(7, "Bit6");
1913  axis->SetBinLabel(8, "NotHybridTrack");
1914  axis->SetBinLabel(9, "MCFlag");
1915  axis->SetBinLabel(10, "MCGenerator");
1916  axis->SetBinLabel(11, "ChargeCut");
1917  axis->SetBinLabel(12, "MinDistanceTPCSectorEdge");
1918  axis->SetBinLabel(13, "Bit12");
1919  axis->SetBinLabel(14, "IsEMCal");
1920  axis->SetBinLabel(15, "Time");
1921  axis->SetBinLabel(16, "Energy");
1922  axis->SetBinLabel(17, "ExoticCut");
1923  axis->SetBinLabel(18, "Bit17");
1924  axis->SetBinLabel(19, "Area");
1925  axis->SetBinLabel(20, "AreaEmc");
1926  axis->SetBinLabel(21, "ZLeadingCh");
1927  axis->SetBinLabel(22, "ZLeadingEmc");
1928  axis->SetBinLabel(23, "NEF");
1929  axis->SetBinLabel(24, "MinLeadPt");
1930  axis->SetBinLabel(25, "MaxTrackPt");
1931  axis->SetBinLabel(26, "MaxClusterPt");
1932  axis->SetBinLabel(27, "Flavour");
1933  axis->SetBinLabel(28, "TagStatus");
1934  axis->SetBinLabel(29, "MinNConstituents");
1935  axis->SetBinLabel(30, "Bit29");
1936  axis->SetBinLabel(31, "Bit30");
1937  axis->SetBinLabel(32, "Bit31");
1938 }
1939 
1946 Double_t AliAnalysisTaskEmcal::GetParallelFraction(AliVParticle* part1, AliVParticle* part2)
1947 {
1948  TVector3 vect1(part1->Px(), part1->Py(), part1->Pz());
1949  TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1950  Double_t z = (vect1 * vect2) / (vect2 * vect2);
1951  return z;
1952 }
1953 
1960 Double_t AliAnalysisTaskEmcal::GetParallelFraction(const TVector3& vect1, AliVParticle* part2)
1961 {
1962  TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1963  Double_t z = (vect1 * vect2) / (vect2 * vect2);
1964  return z;
1965 }
1966 
1975 void AliAnalysisTaskEmcal::GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
1976 {
1977  phidiff = 999;
1978  etadiff = 999;
1979 
1980  if (!t||!v) return;
1981 
1982  Double_t veta = t->GetTrackEtaOnEMCal();
1983  Double_t vphi = t->GetTrackPhiOnEMCal();
1984 
1985  Float_t pos[3] = {0};
1986  v->GetPosition(pos);
1987  TVector3 cpos(pos);
1988  Double_t ceta = cpos.Eta();
1989  Double_t cphi = cpos.Phi();
1990  etadiff=veta-ceta;
1991  phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
1992 }
1993 
1999 Byte_t AliAnalysisTaskEmcal::GetTrackType(const AliVTrack *t)
2000 {
2001  Byte_t ret = 0;
2002  if (t->TestBit(BIT(22)) && !t->TestBit(BIT(23)))
2003  ret = 1;
2004  else if (!t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
2005  ret = 2;
2006  else if (t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
2007  ret = 3;
2008  return ret;
2009 }
2010 
2020 Byte_t AliAnalysisTaskEmcal::GetTrackType(const AliAODTrack *aodTrack, UInt_t filterBit1, UInt_t filterBit2)
2021 {
2022 
2023  Int_t res = 0;
2024 
2025  if (aodTrack->TestFilterBit(filterBit1)) {
2026  res = 0;
2027  }
2028  else if (aodTrack->TestFilterBit(filterBit2)) {
2029  if ((aodTrack->GetStatus()&AliVTrack::kITSrefit)!=0) {
2030  res = 1;
2031  }
2032  else {
2033  res = 2;
2034  }
2035  }
2036  else {
2037  res = 3;
2038  }
2039 
2040  return res;
2041 }
2042 
2048 {
2049  if (!fPythiaInfo) {
2051  }
2052 
2053  AliStack* stack = mcEvent->Stack();
2054 
2055  const Int_t nprim = stack->GetNprimary();
2056  // reject if partons are missing from stack for some reason
2057  if (nprim < 8) return;
2058 
2059  TParticle *part6 = stack->Particle(6);
2060  TParticle *part7 = stack->Particle(7);
2061 
2062  fPythiaInfo->SetPartonFlag6(TMath::Abs(part6->GetPdgCode()));
2063  fPythiaInfo->SetParton6(part6->Pt(), part6->Eta(), part6->Phi(), part6->GetMass());
2064 
2065  fPythiaInfo->SetPartonFlag7(TMath::Abs(part7->GetPdgCode()));
2066  fPythiaInfo->SetParton7(part7->Pt(), part7->Eta(), part7->Phi(), part7->GetMass());
2067 
2068  AliGenPythiaEventHeader *pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(mcEvent->GenEventHeader());
2069  if(pythiaGenHeader){
2070  Float_t ptWeight=pythiaGenHeader->EventWeight();
2071  fPythiaInfo->SetPythiaEventWeight(ptWeight);}
2072 }
2073 
2079 {
2080  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
2081  if (!mgr) {
2082  ::Error("AddAODHandler", "No analysis manager to connect to.");
2083  return NULL;
2084  }
2085 
2086  AliAODInputHandler* aodHandler = new AliAODInputHandler();
2087 
2088  AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
2089  if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
2090  AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
2091  multiInputHandler->AddInputEventHandler(aodHandler);
2092  }
2093  else {
2094  if (!inputHandler) {
2095  mgr->SetInputEventHandler(aodHandler);
2096  }
2097  else {
2098  ::Error("AddAODHandler", "inputHandler is NOT null. AOD handler was NOT added !!!");
2099  return NULL;
2100  }
2101  }
2102 
2103  return aodHandler;
2104 }
2105 
2111 {
2112  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
2113  if (!mgr) {
2114  ::Error("AddESDHandler", "No analysis manager to connect to.");
2115  return NULL;
2116  }
2117 
2118  AliESDInputHandler *esdHandler = new AliESDInputHandler();
2119 
2120  AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
2121  if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
2122  AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
2123  multiInputHandler->AddInputEventHandler(esdHandler);
2124  }
2125  else {
2126  if (!inputHandler) {
2127  mgr->SetInputEventHandler(esdHandler);
2128  }
2129  else {
2130  ::Error("AddESDHandler", "inputHandler is NOT null. ESD handler was NOT added !!!");
2131  return NULL;
2132  }
2133  }
2134 
2135  return esdHandler;
2136 }
2137 
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 pt hard bin scaling in merging.
void SetPartonFlag7(Int_t flag7)
Container with name, TClonesArray and cuts for particles.
TSystem * gSystem
Double_t fPtHard
!event pt 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
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 pt 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.
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