AliPhysics  008a5da (008a5da)
 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  fMCRejectFilter(kFALSE),
115  fCountDownscaleCorrectedEvents(kFALSE),
116  fPtHardAndJetPtFactor(0.),
117  fPtHardAndClusterPtFactor(0.),
118  fPtHardAndTrackPtFactor(0.),
119  fRunNumber(-1),
120  fAliAnalysisUtils(nullptr),
121  fIsEsd(kFALSE),
122  fGeom(nullptr),
123  fTracks(nullptr),
124  fCaloClusters(nullptr),
125  fCaloCells(nullptr),
126  fCaloTriggers(nullptr),
127  fTriggerPatchInfo(nullptr),
128  fCent(0),
129  fCentBin(-1),
130  fEPV0(-1.0),
131  fEPV0A(-1.0),
132  fEPV0C(-1.0),
133  fNVertCont(0),
134  fNVertSPDCont(0),
135  fBeamType(kNA),
136  fPythiaHeader(nullptr),
137  fHerwigHeader(nullptr),
138  fPtHard(0),
139  fPtHardBin(0),
140  fNPtHardBins(11),
141  fPtHardBinning(),
142  fNTrials(0),
143  fXsection(0),
144  fPythiaInfo(nullptr),
145  fOutput(nullptr),
146  fHistEventCount(nullptr),
147  fHistTrialsAfterSel(nullptr),
148  fHistEventsAfterSel(nullptr),
149  fHistXsectionAfterSel(nullptr),
150  fHistTrials(nullptr),
151  fHistEvents(nullptr),
152  fHistXsection(nullptr),
153  fHistPtHard(nullptr),
154  fHistCentrality(nullptr),
155  fHistZVertex(nullptr),
156  fHistEventPlane(nullptr),
157  fHistEventRejection(nullptr),
158  fHistTriggerClasses(nullptr),
159  fHistTriggerClassesCorr(nullptr)
160 {
161  fVertex[0] = 0;
162  fVertex[1] = 0;
163  fVertex[2] = 0;
164  fVertexSPD[0] = 0;
165  fVertexSPD[1] = 0;
166  fVertexSPD[2] = 0;
167 
168  fParticleCollArray.SetOwner(kTRUE);
169  fClusterCollArray.SetOwner(kTRUE);
170 }
171 
183  AliAnalysisTaskSE(name),
184  fPythiaInfoName(""),
185  fForceBeamType(kNA),
186  fGeneralHistograms(kFALSE),
187  fLocalInitialized(kFALSE),
188  fCreateHisto(histo),
189  fCaloCellsName(),
190  fCaloTriggersName(),
191  fCaloTriggerPatchInfoName(),
192  fMinCent(-999),
193  fMaxCent(-999),
194  fMinVz(-999),
195  fMaxVz(999),
196  fTrackPtCut(0),
197  fMinNTrack(0),
198  fZvertexDiff(0.5),
199  fUseAliAnaUtils(kFALSE),
200  fRejectPileup(kFALSE),
201  fTklVsClusSPDCut(kFALSE),
202  fOffTrigger(AliVEvent::kAny),
203  fTrigClass(),
204  fMinBiasRefTrigger("CINT7-B-NOPF-ALLNOTRD"),
205  fTriggerTypeSel(kND),
206  fNbins(250),
207  fMinBinPt(0),
208  fMaxBinPt(250),
209  fMinPtTrackInEmcal(0),
210  fEventPlaneVsEmcal(-1),
211  fMinEventPlane(-1e6),
212  fMaxEventPlane(1e6),
213  fCentEst("V0M"),
214  fIsEmbedded(kFALSE),
215  fIsPythia(kFALSE),
216  fIsHerwig(kFALSE),
217  fSelectPtHardBin(-999),
218  fMinMCLabel(0),
219  fMCLabelShift(0),
220  fNcentBins(4),
221  fNeedEmcalGeom(kTRUE),
222  fParticleCollArray(),
223  fClusterCollArray(),
224  fTriggers(0),
225  fEMCalTriggerMode(kOverlapWithLowThreshold),
226  fUseNewCentralityEstimation(kFALSE),
227  fGeneratePythiaInfoObject(kFALSE),
228  fUsePtHardBinScaling(kFALSE),
229  fMCRejectFilter(kFALSE),
230  fCountDownscaleCorrectedEvents(kFALSE),
231  fPtHardAndJetPtFactor(0.),
232  fPtHardAndClusterPtFactor(0.),
233  fPtHardAndTrackPtFactor(0.),
234  fRunNumber(-1),
235  fAliAnalysisUtils(nullptr),
236  fIsEsd(kFALSE),
237  fGeom(nullptr),
238  fTracks(nullptr),
239  fCaloClusters(nullptr),
240  fCaloCells(nullptr),
241  fCaloTriggers(nullptr),
242  fTriggerPatchInfo(nullptr),
243  fCent(0),
244  fCentBin(-1),
245  fEPV0(-1.0),
246  fEPV0A(-1.0),
247  fEPV0C(-1.0),
248  fNVertCont(0),
249  fNVertSPDCont(0),
250  fBeamType(kNA),
251  fPythiaHeader(nullptr),
252  fHerwigHeader(nullptr),
253  fPtHard(0),
254  fPtHardBin(0),
255  fNPtHardBins(11),
256  fPtHardBinning(),
257  fNTrials(0),
258  fXsection(0),
259  fPythiaInfo(0),
260  fOutput(nullptr),
261  fHistEventCount(nullptr),
262  fHistTrialsAfterSel(nullptr),
263  fHistEventsAfterSel(nullptr),
264  fHistXsectionAfterSel(nullptr),
265  fHistTrials(nullptr),
266  fHistEvents(nullptr),
267  fHistXsection(nullptr),
268  fHistPtHard(nullptr),
269  fHistCentrality(nullptr),
270  fHistZVertex(nullptr),
271  fHistEventPlane(nullptr),
272  fHistEventRejection(nullptr),
273  fHistTriggerClasses(nullptr),
274  fHistTriggerClassesCorr(nullptr)
275 {
276  fVertex[0] = 0;
277  fVertex[1] = 0;
278  fVertex[2] = 0;
279  fVertexSPD[0] = 0;
280  fVertexSPD[1] = 0;
281  fVertexSPD[2] = 0;
282  fParticleCollArray.SetOwner(kTRUE);
283  fClusterCollArray.SetOwner(kTRUE);
284 
285  if (fCreateHisto) {
286  DefineOutput(1, AliEmcalList::Class());
287  }
288 }
289 
294 {
295 }
296 
304 {
306  if (cont) cont->SetClusPtCut(cut);
307  else AliError(Form("%s in SetClusPtCut(...): container %d not found",GetName(),c));
308 }
309 
318 {
320  if (cont) cont->SetClusTimeCut(min,max);
321  else AliError(Form("%s in SetClusTimeCut(...): container %d not found",GetName(),c));
322 }
323 
331 {
333  if (cont) cont->SetParticlePtCut(cut);
334  else AliError(Form("%s in SetTrackPtCut(...): container %d not found",GetName(),c));
335 
336  fTrackPtCut = cut;
337 }
338 
347 {
349  if (cont) cont->SetParticleEtaLimits(min,max);
350  else AliError(Form("%s in SetTrackPtCut(...): container %d not found",GetName(),c));
351 }
352 
361 {
363  if (cont) cont->SetParticlePhiLimits(min,max);
364  else AliError(Form("%s in SetTrackPhiLimits(...): container %d not found",GetName(),c));
365 }
366 
387 {
388  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
389  if (mgr) {
390  AliVEventHandler *evhand = mgr->GetInputEventHandler();
391  if (evhand) {
392  if (evhand->InheritsFrom("AliESDInputHandler")) {
393  fIsEsd = kTRUE;
394  }
395  else {
396  fIsEsd = kFALSE;
397  }
398  }
399  else {
400  AliError("Event handler not found!");
401  }
402  }
403  else {
404  AliError("Analysis manager not found!");
405  }
406 
407  if (!fCreateHisto)
408  return;
409 
410  OpenFile(1);
411  fOutput = new AliEmcalList();
413  fOutput->SetOwner();
414 
415  if (fForceBeamType == kpp)
416  fNcentBins = 1;
417 
418  if (!fGeneralHistograms)
419  return;
420 
421  if (fIsPythia || fIsHerwig) {
422  fHistTrialsAfterSel = new TH1F("fHistTrialsAfterSel", "fHistTrialsAfterSel", fNPtHardBins, 0, fNPtHardBins);
423  fHistTrialsAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
424  fHistTrialsAfterSel->GetYaxis()->SetTitle("trials");
426 
427  fHistEventsAfterSel = new TH1F("fHistEventsAfterSel", "fHistEventsAfterSel", fNPtHardBins, 0, fNPtHardBins);
428  fHistEventsAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
429  fHistEventsAfterSel->GetYaxis()->SetTitle("total events");
431 
432  fHistXsectionAfterSel = new TProfile("fHistXsectionAfterSel", "fHistXsectionAfterSel", fNPtHardBins, 0, fNPtHardBins);
433  fHistXsectionAfterSel->GetXaxis()->SetTitle("p_{T} hard bin");
434  fHistXsectionAfterSel->GetYaxis()->SetTitle("xsection");
436 
437  fHistTrials = new TH1F("fHistTrials", "fHistTrials", fNPtHardBins, 0, fNPtHardBins);
438  fHistTrials->GetXaxis()->SetTitle("p_{T} hard bin");
439  fHistTrials->GetYaxis()->SetTitle("trials");
440  fOutput->Add(fHistTrials);
441 
442  fHistEvents = new TH1F("fHistEvents", "fHistEvents", fNPtHardBins, 0, fNPtHardBins);
443  fHistEvents->GetXaxis()->SetTitle("p_{T} hard bin");
444  fHistEvents->GetYaxis()->SetTitle("total events");
445  fOutput->Add(fHistEvents);
446 
447  fHistXsection = new TProfile("fHistXsection", "fHistXsection", fNPtHardBins, 0, fNPtHardBins);
448  fHistXsection->GetXaxis()->SetTitle("p_{T} hard bin");
449  fHistXsection->GetYaxis()->SetTitle("xsection");
450  fOutput->Add(fHistXsection);
451 
452  // Set the bin labels
453  Bool_t binningAvailable = false;
454  if(fPtHardBinning.GetSize() > 0) {
455  AliInfoStream() << "Using custom pt-hard binning" << std::endl;
456  if(fPtHardBinning.GetSize() == fNPtHardBins + 1) binningAvailable = true;
457  else AliErrorStream() << "Pt-hard binning (" << fPtHardBinning.GetSize() -1 << ") does not match the amount of bins (" << fNPtHardBins << ")" << std::endl;
458  } else {
459  // Check if we fall back to the default binning
460  if(fNPtHardBins == 11) {
461  AliInfoStream() << "11 pt-hard bins - fall back to default binning for bin labels" << std::endl;
462  const Int_t kDefaultPtHardBinning[12] = {0,5,11,21,36,57, 84,117,152,191,234,1000000};
463  fPtHardBinning.Set(12);
464  for(Int_t ib = 0; ib < 12; ib++) fPtHardBinning[ib] = kDefaultPtHardBinning[ib];
465  binningAvailable = true;
466  } else {
467  AliErrorStream() << "No default binning available for " << fNPtHardBins << " pt-hard bins - bin labels will not be set." << std::endl;
468  }
469  }
470 
471  if(binningAvailable){
472  for (Int_t i = 0; i < fNPtHardBins; i++) {
473  fHistTrialsAfterSel->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
474  fHistEventsAfterSel->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
475  fHistXsectionAfterSel->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
476 
477  fHistTrials->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
478  fHistXsection->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
479  fHistEvents->GetXaxis()->SetBinLabel(i+1, Form("%d-%d",fPtHardBinning[i],fPtHardBinning[i+1]));
480  }
481  } else {
482  AliErrorStream() << "No suitable binning available - skipping bin labels" << std::endl;
483  }
484 
485 
486  fHistPtHard = new TH1F("fHistPtHard", "fHistPtHard", fNbins*2, fMinBinPt, fMaxBinPt*4);
487  fHistPtHard->GetXaxis()->SetTitle("p_{T,hard} (GeV/c)");
488  fHistPtHard->GetYaxis()->SetTitle("counts");
489  fOutput->Add(fHistPtHard);
490  }
491 
492  fHistZVertex = new TH1F("fHistZVertex","Z vertex position", 60, -30, 30);
493  fHistZVertex->GetXaxis()->SetTitle("z");
494  fHistZVertex->GetYaxis()->SetTitle("counts");
495  fOutput->Add(fHistZVertex);
496 
497  if (fForceBeamType != kpp) {
498  fHistCentrality = new TH1F("fHistCentrality","Event centrality distribution", 200, 0, 100);
499  fHistCentrality->GetXaxis()->SetTitle("Centrality (%)");
500  fHistCentrality->GetYaxis()->SetTitle("counts");
501  fOutput->Add(fHistCentrality);
502 
503  fHistEventPlane = new TH1F("fHistEventPlane","Event plane", 120, -TMath::Pi(), TMath::Pi());
504  fHistEventPlane->GetXaxis()->SetTitle("event plane");
505  fHistEventPlane->GetYaxis()->SetTitle("counts");
506  fOutput->Add(fHistEventPlane);
507  }
508 
509  fHistEventRejection = new TH1F("fHistEventRejection","Reasons to reject event",20,0,20);
510 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
511  fHistEventRejection->SetBit(TH1::kCanRebin);
512 #else
513  fHistEventRejection->SetCanExtend(TH1::kAllAxes);
514 #endif
515  fHistEventRejection->GetXaxis()->SetBinLabel(1,"PhysSel");
516  fHistEventRejection->GetXaxis()->SetBinLabel(2,"trigger");
517  fHistEventRejection->GetXaxis()->SetBinLabel(3,"trigTypeSel");
518  fHistEventRejection->GetXaxis()->SetBinLabel(4,"Cent");
519  fHistEventRejection->GetXaxis()->SetBinLabel(5,"vertex contr.");
520  fHistEventRejection->GetXaxis()->SetBinLabel(6,"Vz");
521  fHistEventRejection->GetXaxis()->SetBinLabel(7,"VzSPD");
522  fHistEventRejection->GetXaxis()->SetBinLabel(8,"trackInEmcal");
523  fHistEventRejection->GetXaxis()->SetBinLabel(9,"minNTrack");
524  fHistEventRejection->GetXaxis()->SetBinLabel(10,"VtxSel2013pA");
525  fHistEventRejection->GetXaxis()->SetBinLabel(11,"PileUp");
526  fHistEventRejection->GetXaxis()->SetBinLabel(12,"EvtPlane");
527  fHistEventRejection->GetXaxis()->SetBinLabel(13,"SelPtHardBin");
528  fHistEventRejection->GetXaxis()->SetBinLabel(14,"Bkg evt");
529  fHistEventRejection->GetYaxis()->SetTitle("counts");
531 
532  fHistTriggerClasses = new TH1F("fHistTriggerClasses","fHistTriggerClasses",3,0,3);
533 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
534  fHistTriggerClasses->SetBit(TH1::kCanRebin);
535 #else
536  fHistTriggerClasses->SetCanExtend(TH1::kAllAxes);
537 #endif
539 
541  fHistTriggerClassesCorr = new TH1F("fHistTriggerClassesCorr","fHistTriggerClassesCorr",3,0,3);
542 #if ROOT_VERSION_CODE < ROOT_VERSION(6,4,2)
543  fHistTriggerClassesCorr->SetBit(TH1::kCanRebin);
544 #else
545  fHistTriggerClassesCorr->SetCanExtend(TH1::kAllAxes);
546 #endif
548  }
549 
550  fHistEventCount = new TH1F("fHistEventCount","fHistEventCount",2,0,2);
551  fHistEventCount->GetXaxis()->SetBinLabel(1,"Accepted");
552  fHistEventCount->GetXaxis()->SetBinLabel(2,"Rejected");
553  fHistEventCount->GetYaxis()->SetTitle("counts");
554  fOutput->Add(fHistEventCount);
555 
556  PostData(1, fOutput);
557 }
558 
573 {
574  if (fIsPythia || fIsHerwig) {
578  fHistPtHard->Fill(fPtHard);
579  }
580 
581 
582  fHistZVertex->Fill(fVertex[2]);
583 
584  if (fForceBeamType != kpp) {
585  fHistCentrality->Fill(fCent);
586  fHistEventPlane->Fill(fEPV0);
587  }
588 
589  std::unique_ptr<TObjArray> triggerClasses(InputEvent()->GetFiredTriggerClasses().Tokenize(" "));
590  TObjString* triggerClass(nullptr);
591  for(auto trg : *triggerClasses){
592  triggerClass = static_cast<TObjString*>(trg);
593  fHistTriggerClasses->Fill(triggerClass->GetString(), 1);
594  }
595 
597  // downscale-corrected number of events are calculated based on the min. bias reference
598  // Formula: N_corr = N_MB * d_Trg/d_{Min_Bias}
599  if(InputEvent()->GetFiredTriggerClasses().Contains(fMinBiasRefTrigger)){
601  Double_t downscaleref = downscalefactors->GetDownscaleFactorForTriggerClass(fMinBiasRefTrigger);
602  for(auto t : downscalefactors->GetTriggerClasses()){
603  Double_t downscaletrg = downscalefactors->GetDownscaleFactorForTriggerClass(t);
604  fHistTriggerClassesCorr->Fill(t, downscaletrg/downscaleref);
605  }
606  }
607  }
608 
609  return kTRUE;
610 }
611 
632 {
633  if (!fLocalInitialized){
634  ExecOnce();
635  UserExecOnce();
636  }
637 
638  if (!fLocalInitialized)
639  return;
640 
641  if (!RetrieveEventObjects())
642  return;
643 
644  if(InputEvent()->GetRunNumber() != fRunNumber){
645  fRunNumber = InputEvent()->GetRunNumber();
648  }
649 
650  if (IsEventSelected()) {
651  if (fGeneralHistograms) fHistEventCount->Fill("Accepted",1);
652  }
653  else {
654  if (fGeneralHistograms) fHistEventCount->Fill("Rejected",1);
655  return;
656  }
657 
659  if (!FillGeneralHistograms())
660  return;
661  }
662 
663  if (!Run())
664  return;
665 
666  if (fCreateHisto) {
667  if (!FillHistograms())
668  return;
669  }
670 
671  if (fCreateHisto && fOutput) {
672  // information for this iteration of the UserExec in the container
673  PostData(1, fOutput);
674  }
675 }
676 
686 {
687  AliWarning("AliAnalysisTaskEmcal::AcceptCluster method is deprecated. Please use GetCusterContainer(c)->AcceptCluster(clus).");
688 
689  if (!clus) return kFALSE;
690 
692  if (!cont) {
693  AliError(Form("%s:Container %d not found",GetName(),c));
694  return 0;
695  }
696  UInt_t rejectionReason = 0;
697  return cont->AcceptCluster(clus, rejectionReason);
698 }
699 
708 Bool_t AliAnalysisTaskEmcal::AcceptTrack(AliVParticle *track, Int_t c) const
709 {
710  AliWarning("AliAnalysisTaskEmcal::AcceptTrack method is deprecated. Please use GetParticleContainer(c)->AcceptParticle(clus).");
711 
712  if (!track) return kFALSE;
713 
715  if (!cont) {
716  AliError(Form("%s:Container %d not found",GetName(),c));
717  return 0;
718  }
719 
720  UInt_t rejectionReason = 0;
721  return cont->AcceptParticle(track, rejectionReason);
722 }
723 
735 Bool_t AliAnalysisTaskEmcal::PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard)
736 {
737 
738  TString file(currFile);
739  fXsec = 0;
740  fTrials = 1;
741 
742  if (file.Contains(".zip#")) {
743  Ssiz_t pos1 = file.Index("root_archive",12,0,TString::kExact);
744  Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
745  Ssiz_t pos2 = file.Index(".root",5,TString::kExact);
746  file.Replace(pos+1,pos2-pos1,"");
747  } else {
748  // not an archive take the basename....
749  file.ReplaceAll(gSystem->BaseName(file.Data()),"");
750  }
751  AliDebug(1,Form("File name: %s",file.Data()));
752 
753  // Get the pt hard bin
754  TString strPthard(file);
755 
756  strPthard.Remove(strPthard.Last('/'));
757  strPthard.Remove(strPthard.Last('/'));
758  if (strPthard.Contains("AOD")) strPthard.Remove(strPthard.Last('/'));
759  strPthard.Remove(0,strPthard.Last('/')+1);
760  if (strPthard.IsDec()) pthard = strPthard.Atoi();
761  else
762  AliWarning(Form("Could not extract file number from path %s", strPthard.Data()));
763 
764  // 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
765  std::unique_ptr<TFile> fxsec(TFile::Open(Form("%s%s",file.Data(),"pyxsec.root")));
766 
767  if (!fxsec) {
768  // next trial fetch the histgram file
769  fxsec = std::unique_ptr<TFile>(TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root")));
770  if (!fxsec) return kFALSE; // not a severe condition but inciate that we have no information
771  else {
772  // find the tlist we want to be independtent of the name so use the Tkey
773  TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
774  if (!key) return kFALSE;
775  TList *list = dynamic_cast<TList*>(key->ReadObj());
776  if (!list) return kFALSE;
777  fXsec = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1);
778  fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
779  }
780  } else { // no tree pyxsec.root
781  TTree *xtree = (TTree*)fxsec->Get("Xsection");
782  if (!xtree) return kFALSE;
783  UInt_t ntrials = 0;
784  Double_t xsection = 0;
785  xtree->SetBranchAddress("xsection",&xsection);
786  xtree->SetBranchAddress("ntrials",&ntrials);
787  xtree->GetEntry(0);
788  fTrials = ntrials;
789  fXsec = xsection;
790  }
791  return kTRUE;
792 }
793 
808 {
810  return kTRUE;
811 
812  TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
813  if (!tree) {
814  AliError(Form("%s - UserNotify: No current tree!",GetName()));
815  return kFALSE;
816  }
817 
818  Float_t xsection = 0;
819  Float_t trials = 0;
820  Int_t pthardbin = 0;
821 
822  TFile *curfile = tree->GetCurrentFile();
823  if (!curfile) {
824  AliError(Form("%s - UserNotify: No current file!",GetName()));
825  return kFALSE;
826  }
827 
828  TChain *chain = dynamic_cast<TChain*>(tree);
829  if (chain) tree = chain->GetTree();
830 
831  Int_t nevents = tree->GetEntriesFast();
832 
833  PythiaInfoFromFile(curfile->GetName(), xsection, trials, pthardbin);
834 
835  if ((pthardbin < 0) || (pthardbin > fNPtHardBins-1)) pthardbin = 0;
836  fHistTrials->Fill(pthardbin, trials);
837  fHistXsection->Fill(pthardbin, xsection);
838  fHistEvents->Fill(pthardbin, nevents);
839 
840  return kTRUE;
841 }
842 
848 {
849  if (!fPythiaInfoName.IsNull() && !fPythiaInfo) {
850  fPythiaInfo = dynamic_cast<AliEmcalPythiaInfo*>(event->FindListObject(fPythiaInfoName));
851  if (!fPythiaInfo) {
852  AliError(Form("%s: Could not retrieve parton infos! %s!", GetName(), fPythiaInfoName.Data()));
853  return;
854  }
855  }
856 }
857 
869 {
870  if (!InputEvent()) {
871  AliError(Form("%s: Could not retrieve event! Returning!", GetName()));
872  return;
873  }
874 
875  LoadPythiaInfo(InputEvent());
876 
877  if (fNeedEmcalGeom) {
878  fGeom = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
879  if (!fGeom) {
880  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()));
881  return;
882  }
883  }
884 
885  if (fEventPlaneVsEmcal >= 0) {
886  if (fGeom) {
887  Double_t ep = (fGeom->GetArm1PhiMax() + fGeom->GetArm1PhiMin()) / 2 * TMath::DegToRad() + fEventPlaneVsEmcal - TMath::Pi();
888  fMinEventPlane = ep - TMath::Pi() / 4;
889  fMaxEventPlane = ep + TMath::Pi() / 4;
890  }
891  else {
892  AliWarning("Could not set event plane limits because EMCal geometry was not loaded!");
893  }
894  }
895 
896  //Load all requested track branches - each container knows name already
897  for (Int_t i =0; i<fParticleCollArray.GetEntriesFast(); i++) {
898  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
899  cont->SetArray(InputEvent());
900  }
901 
902  if (fParticleCollArray.GetEntriesFast()>0) {
904  if (!fTracks) {
905  AliError(Form("%s: Could not retrieve first track branch!", GetName()));
906  return;
907  }
908  }
909 
910  //Load all requested cluster branches - each container knows name already
911  for (Int_t i =0; i<fClusterCollArray.GetEntriesFast(); i++) {
912  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
913  cont->SetArray(InputEvent());
914  }
915 
916  if (fClusterCollArray.GetEntriesFast()>0) {
918  if (!fCaloClusters) {
919  AliError(Form("%s: Could not retrieve first cluster branch!", GetName()));
920  return;
921  }
922  }
923 
924  if (!fCaloCellsName.IsNull() && !fCaloCells) {
925  fCaloCells = dynamic_cast<AliVCaloCells*>(InputEvent()->FindListObject(fCaloCellsName));
926  if (!fCaloCells) {
927  AliError(Form("%s: Could not retrieve cells %s!", GetName(), fCaloCellsName.Data()));
928  return;
929  }
930  }
931 
932  if (!fCaloTriggersName.IsNull() && !fCaloTriggers) {
933  fCaloTriggers = dynamic_cast<AliVCaloTrigger*>(InputEvent()->FindListObject(fCaloTriggersName));
934  if (!fCaloTriggers) {
935  AliError(Form("%s: Could not retrieve calo triggers %s!", GetName(), fCaloTriggersName.Data()));
936  return;
937  }
938  }
939 
940  if (!fCaloTriggerPatchInfoName.IsNull() && !fTriggerPatchInfo) {
941  fTriggerPatchInfo = GetArrayFromEvent(fCaloTriggerPatchInfoName.Data(),"AliEMCALTriggerPatchInfo");
942  if (!fTriggerPatchInfo) {
943  AliError(Form("%s: Could not retrieve calo trigger patch info %s!", GetName(), fCaloTriggerPatchInfoName.Data()));
944  return;
945  }
946 
947  }
948 
949  fLocalInitialized = kTRUE;
950 }
951 
958 {
959  if (fForceBeamType != kNA)
960  return fForceBeamType;
961 
962  AliESDEvent *esd = dynamic_cast<AliESDEvent*>(InputEvent());
963  if (esd) {
964  const AliESDRun *run = esd->GetESDRun();
965  TString beamType = run->GetBeamType();
966  if (beamType == "p-p")
967  return kpp;
968  else if (beamType == "A-A")
969  return kAA;
970  else if (beamType == "p-A")
971  return kpA;
972  else
973  return kNA;
974  } else {
975  Int_t runNumber = InputEvent()->GetRunNumber();
976  // All run number ranges taken from the RCT
977  if ((runNumber >= 136833 && runNumber <= 139517) || // LHC10h
978  (runNumber >= 167693 && runNumber <= 170593) || // LHC11h
979  (runNumber >= 244824 && runNumber <= 246994)) { // LHC15o
980  return kAA;
981  } else if ((runNumber >= 188356 && runNumber <= 188366) || // LHC12g
982  (runNumber >= 195164 && runNumber <= 197388) || // LHC13b-f
983  (runNumber >= 265015 && runNumber <= 267166)) { // LHC16q-t
984  return kpA;
985  } else {
986  return kpp;
987  }
988  }
989 }
990 
998 {
999  if (!fTriggerPatchInfo)
1000  return 0;
1001 
1002  //number of patches in event
1003  Int_t nPatch = fTriggerPatchInfo->GetEntries();
1004 
1005  //loop over patches to define trigger type of event
1006  Int_t nG1 = 0;
1007  Int_t nG2 = 0;
1008  Int_t nJ1 = 0;
1009  Int_t nJ2 = 0;
1010  Int_t nL0 = 0;
1011  AliEMCALTriggerPatchInfo *patch;
1012  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1013  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
1014  if (patch->IsGammaHigh()) nG1++;
1015  if (patch->IsGammaLow()) nG2++;
1016  if (patch->IsJetHigh()) nJ1++;
1017  if (patch->IsJetLow()) nJ2++;
1018  if (patch->IsLevel0()) nL0++;
1019  }
1020 
1021  AliDebug(2, "Patch summary: ");
1022  AliDebug(2, Form("Number of patches: %d", nPatch));
1023  AliDebug(2, Form("Jet: low[%d], high[%d]" ,nJ2, nJ1));
1024  AliDebug(2, Form("Gamma: low[%d], high[%d]" ,nG2, nG1));
1025 
1026  ULong_t triggers(0);
1027  if (nL0>0) SETBIT(triggers, kL0);
1028  if (nG1>0) SETBIT(triggers, kG1);
1029  if (nG2>0) SETBIT(triggers, kG2);
1030  if (nJ1>0) SETBIT(triggers, kJ1);
1031  if (nJ2>0) SETBIT(triggers, kJ2);
1032  return triggers;
1033 }
1034 
1042 {
1043  //
1044  if(trigger==kND) {
1045  AliWarning(Form("%s: Requesting undefined trigger type!", GetName()));
1046  return kFALSE;
1047  }
1048  //MV: removing this logic which as far as I can see doesn't make any sense
1049  // if(trigger & kND){
1050  // return fTriggers == 0;
1051  // }
1052  return TESTBIT(fTriggers, trigger);
1053 }
1054 
1077 {
1078  if (fOffTrigger != AliVEvent::kAny) {
1079  UInt_t res = 0;
1080  const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(InputEvent());
1081  if (eev) {
1082  res = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
1083  } else {
1084  const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
1085  if (aev) {
1086  res = ((AliVAODHeader*)aev->GetHeader())->GetOfflineTrigger();
1087  }
1088  }
1089  if ((res & fOffTrigger) == 0) {
1090  if (fGeneralHistograms) fHistEventRejection->Fill("PhysSel",1);
1091  return kFALSE;
1092  }
1093  }
1094 
1095  if (!fTrigClass.IsNull()) {
1096  TString fired;
1097  const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(InputEvent());
1098  if (eev) {
1099  fired = eev->GetFiredTriggerClasses();
1100  } else {
1101  const AliAODEvent *aev = dynamic_cast<const AliAODEvent*>(InputEvent());
1102  if (aev) {
1103  fired = aev->GetFiredTriggerClasses();
1104  }
1105  }
1106  if (!fired.Contains("-B-")) {
1107  if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
1108  return kFALSE;
1109  }
1110 
1111  std::unique_ptr<TObjArray> arr(fTrigClass.Tokenize("|"));
1112  if (!arr) {
1113  if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
1114  return kFALSE;
1115  }
1116  Bool_t match = 0;
1117  for (Int_t i=0;i<arr->GetEntriesFast();++i) {
1118  TObject *obj = arr->At(i);
1119  if (!obj)
1120  continue;
1121 
1122  //Check if requested trigger was fired
1123  TString objStr = obj->GetName();
1125  (objStr.Contains("J1") || objStr.Contains("J2") || objStr.Contains("G1") || objStr.Contains("G2"))) {
1126  // This is relevant for EMCal triggers with 2 thresholds
1127  // If the kOverlapWithLowThreshold was requested than the overlap between the two triggers goes with the lower threshold trigger
1128  TString trigType1 = "J1";
1129  TString trigType2 = "J2";
1130  if(objStr.Contains("G")) {
1131  trigType1 = "G1";
1132  trigType2 = "G2";
1133  }
1134  if(objStr.Contains(trigType2) && fired.Contains(trigType2.Data())) { //requesting low threshold + overlap
1135  match = 1;
1136  break;
1137  }
1138  else if(objStr.Contains(trigType1) && fired.Contains(trigType1.Data()) && !fired.Contains(trigType2.Data())) { //high threshold only
1139  match = 1;
1140  break;
1141  }
1142  }
1143  else {
1144  // If this is not an EMCal trigger, or no particular treatment of EMCal triggers was requested,
1145  // simply check that the trigger was fired
1146  if (fired.Contains(obj->GetName())) {
1147  match = 1;
1148  break;
1149  }
1150  }
1151  }
1152  if (!match) {
1153  if (fGeneralHistograms) fHistEventRejection->Fill("trigger",1);
1154  return kFALSE;
1155  }
1156  }
1157 
1158  if (fTriggerTypeSel != kND) {
1160  if (fGeneralHistograms) fHistEventRejection->Fill("trigTypeSel",1);
1161  return kFALSE;
1162  }
1163  }
1164 
1165  if ((fMinCent != -999) && (fMaxCent != -999)) {
1166  if (fCent<fMinCent || fCent>fMaxCent) {
1167  if (fGeneralHistograms) fHistEventRejection->Fill("Cent",1);
1168  return kFALSE;
1169  }
1170  }
1171 
1172  if (fUseAliAnaUtils) {
1173  if (!fAliAnalysisUtils)
1174  fAliAnalysisUtils = new AliAnalysisUtils();
1175  fAliAnalysisUtils->SetMinVtxContr(2);
1176  fAliAnalysisUtils->SetMaxVtxZ(999);
1177  if(fMinVz<-998.) fMinVz = -10.;
1178  if(fMaxVz>998.) fMaxVz = 10.;
1179 
1180  if (!fAliAnalysisUtils->IsVertexSelected2013pA(InputEvent())) {
1181  if (fGeneralHistograms) fHistEventRejection->Fill("VtxSel2013pA",1);
1182  return kFALSE;
1183  }
1184 
1185  if (fRejectPileup && fAliAnalysisUtils->IsPileUpEvent(InputEvent())) {
1186  if (fGeneralHistograms) fHistEventRejection->Fill("PileUp",1);
1187  return kFALSE;
1188  }
1189 
1190  if(fTklVsClusSPDCut && fAliAnalysisUtils->IsSPDClusterVsTrackletBG(InputEvent())) {
1191  if (fGeneralHistograms) fHistEventRejection->Fill("Bkg evt",1);
1192  return kFALSE;
1193  }
1194  }
1195 
1196  if ((fMinVz > -998.) && (fMaxVz < 998.)) {
1197  if (fNVertCont == 0 ) {
1198  if (fGeneralHistograms) fHistEventRejection->Fill("vertex contr.",1);
1199  return kFALSE;
1200  }
1201  Double_t vz = fVertex[2];
1202  if (vz < fMinVz || vz > fMaxVz) {
1203  if (fGeneralHistograms) fHistEventRejection->Fill("Vz",1);
1204  return kFALSE;
1205  }
1206 
1207  if (fNVertSPDCont > 0 && fZvertexDiff < 999) {
1208  Double_t vzSPD = fVertexSPD[2];
1209  Double_t dvertex = TMath::Abs(vz-vzSPD);
1210  //if difference larger than fZvertexDiff
1211  if (dvertex > fZvertexDiff) {
1212  if (fGeneralHistograms) fHistEventRejection->Fill("VzSPD",1);
1213  return kFALSE;
1214  }
1215  }
1216  }
1217 
1218  if (fMinPtTrackInEmcal > 0 && fGeom) {
1219  Bool_t trackInEmcalOk = kFALSE;
1220  Int_t ntracks = GetNParticles(0);
1221  for (Int_t i = 0; i < ntracks; i++) {
1222  AliVParticle *track = GetAcceptParticleFromArray(i,0);
1223  if (!track)
1224  continue;
1225 
1226  Double_t phiMin = fGeom->GetArm1PhiMin() * TMath::DegToRad();
1227  Double_t phiMax = fGeom->GetArm1PhiMax() * TMath::DegToRad();
1228  Int_t runNumber = InputEvent()->GetRunNumber();
1229  if (runNumber>=177295 && runNumber<=197470) { //small SM masked in 2012 and 2013
1230  phiMin = 1.4;
1231  phiMax = TMath::Pi();
1232  }
1233 
1234  if (track->Eta() < fGeom->GetArm1EtaMin() || track->Eta() > fGeom->GetArm1EtaMax() || track->Phi() < phiMin || track->Phi() > phiMax)
1235  continue;
1236  if (track->Pt() > fMinPtTrackInEmcal) {
1237  trackInEmcalOk = kTRUE;
1238  break;
1239  }
1240  }
1241  if (!trackInEmcalOk) {
1242  if (fGeneralHistograms) fHistEventRejection->Fill("trackInEmcal",1);
1243  return kFALSE;
1244  }
1245  }
1246 
1247  if (fMinNTrack > 0) {
1248  Int_t nTracksAcc = 0;
1249  Int_t ntracks = GetNParticles(0);
1250  for (Int_t i = 0; i < ntracks; i++) {
1251  AliVParticle *track = GetAcceptParticleFromArray(i,0);
1252  if (!track)
1253  continue;
1254  if (track->Pt() > fTrackPtCut) {
1255  nTracksAcc++;
1256  if (nTracksAcc>=fMinNTrack)
1257  break;
1258  }
1259  }
1260  if (nTracksAcc<fMinNTrack) {
1261  if (fGeneralHistograms) fHistEventRejection->Fill("minNTrack",1);
1262  return kFALSE;
1263  }
1264  }
1265 
1266  if (!(fEPV0 > fMinEventPlane && fEPV0 <= fMaxEventPlane) &&
1267  !(fEPV0 + TMath::Pi() > fMinEventPlane && fEPV0 + TMath::Pi() <= fMaxEventPlane) &&
1268  !(fEPV0 - TMath::Pi() > fMinEventPlane && fEPV0 - TMath::Pi() <= fMaxEventPlane))
1269  {
1270  if (fGeneralHistograms) fHistEventRejection->Fill("EvtPlane",1);
1271  return kFALSE;
1272  }
1273 
1274  if (fSelectPtHardBin != -999 && fSelectPtHardBin != fPtHardBin) {
1275  if (fGeneralHistograms) fHistEventRejection->Fill("SelPtHardBin",1);
1276  return kFALSE;
1277  }
1278 
1279  // Reject filter for MC data
1280  if (!CheckMCOutliers()) return kFALSE;
1281 
1282  return kTRUE;
1283 }
1284 
1291 {
1292  if (!fPythiaHeader || !fMCRejectFilter) return kTRUE;
1293 
1294  // Condition 1: Pythia jet / pT-hard > factor
1295  if (fPtHardAndJetPtFactor > 0.) {
1296  AliTLorentzVector jet;
1297 
1298  Int_t nTriggerJets = fPythiaHeader->NTriggerJets();
1299 
1300  AliDebug(1,Form("Njets: %d, pT Hard %f",nTriggerJets, fPtHard));
1301 
1302  Float_t tmpjet[]={0,0,0,0};
1303  for (Int_t ijet = 0; ijet< nTriggerJets; ijet++) {
1304  fPythiaHeader->TriggerJet(ijet, tmpjet);
1305 
1306  jet.SetPxPyPzE(tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3]);
1307 
1308  AliDebug(1,Form("jet %d; pycell jet pT %f",ijet, jet.Pt()));
1309 
1310  //Compare jet pT and pt Hard
1311  if (jet.Pt() > fPtHardAndJetPtFactor * fPtHard) {
1312  AliInfo(Form("Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n", fPtHard, jet.Pt(), fPtHardAndJetPtFactor));
1313  return kFALSE;
1314  }
1315  }
1316  }
1317  // end condition 1
1318 
1319  // Condition 2 : Reconstructed EMCal cluster pT / pT-hard > factor
1320  if (fPtHardAndClusterPtFactor > 0.) {
1321  AliClusterContainer* mccluscont = GetClusterContainer(0);
1322  if ((Bool_t)mccluscont) {
1323  for (auto cluster : mccluscont->all()) {// Not cuts applied ; use accept for cuts
1324  Float_t ecluster = cluster->E();
1325 
1326  if (ecluster > (fPtHardAndClusterPtFactor * fPtHard)) {
1327  AliInfo(Form("Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f",ecluster,cluster->GetType(),fPtHardAndClusterPtFactor,fPtHard));
1328  return kFALSE;
1329  }
1330  }
1331  }
1332  }
1333  // end condition 2
1334 
1335  // condition 3 : Reconstructed track pT / pT-hard >factor
1336  if (fPtHardAndTrackPtFactor > 0.) {
1337  AliMCParticleContainer* mcpartcont = dynamic_cast<AliMCParticleContainer*>(GetParticleContainer(0));
1338  if ((Bool_t)mcpartcont) {
1339  for (auto mctrack : mcpartcont->all()) {// Not cuts applied ; use accept for cuts
1340  Float_t trackpt = mctrack->Pt();
1341  if (trackpt > (fPtHardAndTrackPtFactor * fPtHard) ) {
1342  AliInfo(Form("Reject : track %2.2f, factor %2.2f, ptHard %f", trackpt, fPtHardAndTrackPtFactor, fPtHard));
1343  return kFALSE;
1344  }
1345  }
1346  }
1347  }
1348  // end condition 3
1349 
1350  return kTRUE;
1351 }
1352 
1361 TClonesArray *AliAnalysisTaskEmcal::GetArrayFromEvent(const char *name, const char *clname)
1362 {
1363  TClonesArray *arr = 0;
1364  TString sname(name);
1365  if (!sname.IsNull()) {
1366  arr = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(sname));
1367  if (!arr) {
1368  AliWarning(Form("%s: Could not retrieve array with name %s!", GetName(), name));
1369  return 0;
1370  }
1371  } else {
1372  return 0;
1373  }
1374 
1375  if (!clname)
1376  return arr;
1377 
1378  TString objname(arr->GetClass()->GetName());
1379  TClass cls(objname);
1380  if (!cls.InheritsFrom(clname)) {
1381  AliWarning(Form("%s: Objects of type %s in %s are not inherited from %s!",
1382  GetName(), cls.GetName(), name, clname));
1383  return 0;
1384  }
1385  return arr;
1386 }
1387 
1393 {
1394  fVertex[0] = 0;
1395  fVertex[1] = 0;
1396  fVertex[2] = 0;
1397  fNVertCont = 0;
1398 
1399  fVertexSPD[0] = 0;
1400  fVertexSPD[1] = 0;
1401  fVertexSPD[2] = 0;
1402  fNVertSPDCont = 0;
1403 
1404  if (fGeneratePythiaInfoObject && MCEvent()) {
1405  GeneratePythiaInfoObject(MCEvent());
1406  }
1407 
1408  const AliVVertex *vert = InputEvent()->GetPrimaryVertex();
1409  if (vert) {
1410  vert->GetXYZ(fVertex);
1411  fNVertCont = vert->GetNContributors();
1412  }
1413 
1414  const AliVVertex *vertSPD = InputEvent()->GetPrimaryVertexSPD();
1415  if (vertSPD) {
1416  vertSPD->GetXYZ(fVertexSPD);
1417  fNVertSPDCont = vertSPD->GetNContributors();
1418  }
1419 
1420  fBeamType = GetBeamType();
1421 
1422  if (fBeamType == kAA || fBeamType == kpA ) {
1424  AliMultSelection *MultSelection = static_cast<AliMultSelection*>(InputEvent()->FindListObject("MultSelection"));
1425  if (MultSelection) {
1426  fCent = MultSelection->GetMultiplicityPercentile(fCentEst.Data());
1427  }
1428  else {
1429  AliWarning(Form("%s: Could not retrieve centrality information! Assuming 99", GetName()));
1430  }
1431  }
1432  else { // old centrality estimation < 2015
1433  AliCentrality *aliCent = InputEvent()->GetCentrality();
1434  if (aliCent) {
1435  fCent = aliCent->GetCentralityPercentile(fCentEst.Data());
1436  }
1437  else {
1438  AliWarning(Form("%s: Could not retrieve centrality information! Assuming 99", GetName()));
1439  }
1440  }
1441 
1442  if (fNcentBins==4) {
1443  if (fCent >= 0 && fCent < 10) fCentBin = 0;
1444  else if (fCent >= 10 && fCent < 30) fCentBin = 1;
1445  else if (fCent >= 30 && fCent < 50) fCentBin = 2;
1446  else if (fCent >= 50 && fCent <= 100) fCentBin = 3;
1447  else {
1448  AliWarning(Form("%s: Negative centrality: %f. Assuming 99", GetName(), fCent));
1449  fCentBin = fNcentBins-1;
1450  }
1451  }
1452  else if (fNcentBins==5) { // for PbPb 2015
1453  if (fCent >= 0 && fCent < 10) fCentBin = 0;
1454  else if (fCent >= 10 && fCent < 30) fCentBin = 1;
1455  else if (fCent >= 30 && fCent < 50) fCentBin = 2;
1456  else if (fCent >= 50 && fCent <= 90) fCentBin = 3;
1457  else if (fCent > 90) {
1458  fCent = 99;
1459  fCentBin = 4;
1460  }
1461  else {
1462  AliWarning(Form("%s: Negative centrality: %f. Assuming 99", GetName(), fCent));
1463  fCentBin = fNcentBins-1;
1464  }
1465  }
1466  else {
1467  Double_t centWidth = (fMaxCent-fMinCent)/(Double_t)fNcentBins;
1468  if(centWidth>0.) {
1469  fCentBin = TMath::FloorNint(fCent/centWidth);
1470  }
1471  else {
1472  fCentBin = 0;
1473  }
1474  if (fCentBin>=fNcentBins) {
1475  AliWarning(Form("%s: fCentBin too large: cent = %f fCentBin = %d. Assuming 99", GetName(),fCent,fCentBin));
1476  fCentBin = fNcentBins-1;
1477  }
1478  }
1479 
1480  AliEventplane *aliEP = InputEvent()->GetEventplane();
1481  if (aliEP) {
1482  fEPV0 = aliEP->GetEventplane("V0" ,InputEvent());
1483  fEPV0A = aliEP->GetEventplane("V0A",InputEvent());
1484  fEPV0C = aliEP->GetEventplane("V0C",InputEvent());
1485  } else {
1486  AliWarning(Form("%s: Could not retrieve event plane information!", GetName()));
1487  }
1488  }
1489  else {
1490  fCent = 99;
1491  fCentBin = 0;
1492  }
1493 
1494  if (fIsPythia) {
1495  if (MCEvent()) {
1496  fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent()->GenEventHeader());
1497  if (!fPythiaHeader) {
1498  // Check if AOD
1499  AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1500 
1501  if (aodMCH) {
1502  for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1503  fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(aodMCH->GetCocktailHeader(i));
1504  if (fPythiaHeader) break;
1505  }
1506  }
1507  }
1508  }
1509  }
1510 
1511  if (fPythiaHeader) {
1512  fPtHard = fPythiaHeader->GetPtHard();
1513 
1514  if(fPtHardBinning.GetSize()){
1515  // pt-hard binning defined for the corresponding dataset - automatically determine the bin
1516  for (fPtHardBin = 0; fPtHardBin < fNPtHardBins; fPtHardBin++) {
1518  break;
1519  }
1520  } else {
1521  // No pt-hard binning defined for the dataset - leaving the bin to 0
1522  fPtHardBin = 0;
1523  }
1524 
1525  fXsection = fPythiaHeader->GetXsection();
1526  fNTrials = fPythiaHeader->Trials();
1527  }
1528 
1529  if (fIsHerwig) {
1530  if (MCEvent()) {
1531  fHerwigHeader = dynamic_cast<AliGenHerwigEventHeader*>(MCEvent()->GenEventHeader());
1532 
1533  if (!fHerwigHeader) {
1534  // Check if AOD
1535  AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
1536 
1537  if (aodMCH) {
1538  for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
1539  fHerwigHeader = dynamic_cast<AliGenHerwigEventHeader*>(aodMCH->GetCocktailHeader(i));
1540  if (fHerwigHeader) break;
1541  }
1542  }
1543  }
1544  }
1545  }
1546 
1547  if (fHerwigHeader) {
1548  fPtHard = fHerwigHeader->GetPtHard();
1549 
1550  if(fPtHardBinning.GetSize()){
1551  // pt-hard binning defined for the corresponding dataset - automatically determine the bin
1552  for (fPtHardBin = 0; fPtHardBin < fNPtHardBins; fPtHardBin++) {
1554  break;
1555  }
1556  } else {
1557  // No pt-hard binning defined for the dataset - leaving the bin to 0
1558  fPtHardBin = 0;
1559  }
1560  fXsection = fHerwigHeader->Weight();
1561  fNTrials = fHerwigHeader->Trials();
1562  }
1563 
1564 
1566 
1567  AliEmcalContainer* cont = 0;
1568 
1569  TIter nextPartColl(&fParticleCollArray);
1570  while ((cont = static_cast<AliEmcalContainer*>(nextPartColl()))) cont->NextEvent();
1571 
1572  TIter nextClusColl(&fClusterCollArray);
1573  while ((cont = static_cast<AliParticleContainer*>(nextClusColl()))) cont->NextEvent();
1574 
1575  return kTRUE;
1576 }
1577 
1586 {
1587  if (TString(n).IsNull()) return 0;
1588 
1590 
1591  fParticleCollArray.Add(cont);
1592 
1593  return cont;
1594 }
1595 
1604 {
1605  if (TString(n).IsNull()) return 0;
1606 
1607  AliTrackContainer* cont = new AliTrackContainer(n);
1608 
1609  fParticleCollArray.Add(cont);
1610 
1611  return cont;
1612 }
1613 
1622 {
1623  if (TString(n).IsNull()) return 0;
1624 
1626 
1627  fParticleCollArray.Add(cont);
1628 
1629  return cont;
1630 }
1631 
1640 {
1641  if (TString(n).IsNull()) return 0;
1642 
1644 
1645  fClusterCollArray.Add(cont);
1646 
1647  return cont;
1648 }
1649 
1656 {
1657  if (i<0 || i>fParticleCollArray.GetEntriesFast()) return 0;
1658  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.At(i));
1659  return cont;
1660 }
1661 
1668 {
1669  if (i<0 || i>fClusterCollArray.GetEntriesFast()) return 0;
1670  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.At(i));
1671  return cont;
1672 }
1673 
1680 {
1681  AliParticleContainer *cont = static_cast<AliParticleContainer*>(fParticleCollArray.FindObject(name));
1682  return cont;
1683 }
1684 
1691 {
1692  AliClusterContainer *cont = static_cast<AliClusterContainer*>(fClusterCollArray.FindObject(name));
1693  return cont;
1694 }
1695 
1702 {
1704  if (!cont) {
1705  AliError(Form("%s: Particle container %d not found",GetName(),i));
1706  return 0;
1707  }
1708  TString contName = cont->GetArrayName();
1709  return cont->GetArray();
1710 }
1711 
1718 {
1720  if (!cont) {
1721  AliError(Form("%s:Cluster container %d not found",GetName(),i));
1722  return 0;
1723  }
1724  return cont->GetArray();
1725 }
1726 
1735 {
1736 
1738  if (!cont) {
1739  AliError(Form("%s: Particle container %d not found",GetName(),c));
1740  return 0;
1741  }
1742  AliVParticle *vp = cont->GetAcceptParticle(p);
1743 
1744  return vp;
1745 }
1746 
1755 {
1757  if (!cont) {
1758  AliError(Form("%s: Cluster container %d not found",GetName(),c));
1759  return 0;
1760  }
1761  AliVCluster *vc = cont->GetAcceptCluster(cl);
1762 
1763  return vc;
1764 }
1765 
1772 {
1774  if (!cont) {
1775  AliError(Form("%s: Particle container %d not found",GetName(),i));
1776  return 0;
1777  }
1778  return cont->GetNEntries();
1779 }
1780 
1788 {
1790  if (!cont) {
1791  AliError(Form("%s: Cluster container %d not found",GetName(),i));
1792  return 0;
1793  }
1794  return cont->GetNEntries();
1795 }
1796 
1808 AliEMCALTriggerPatchInfo* AliAnalysisTaskEmcal::GetMainTriggerPatch(TriggerCategory trigger, Bool_t doSimpleOffline)
1809 {
1810 
1811  if (!fTriggerPatchInfo) {
1812  AliError(Form("%s: fTriggerPatchInfo not available",GetName()));
1813  return 0;
1814  }
1815 
1816  //number of patches in event
1817  Int_t nPatch = fTriggerPatchInfo->GetEntries();
1818 
1819  //extract main trigger patch(es)
1820  AliEMCALTriggerPatchInfo *patch(NULL), *selected(NULL);
1821  for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1822 
1823  patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
1824  if (patch->IsMainTrigger()) {
1825  if(doSimpleOffline){
1826  if(patch->IsOfflineSimple()){
1827  switch(trigger){
1828  case kTriggerLevel0:
1829  // option not yet implemented in the trigger maker
1830  if(patch->IsLevel0()) selected = patch;
1831  break;
1832  case kTriggerLevel1Jet:
1833  if(patch->IsJetHighSimple() || patch->IsJetLowSimple()){
1834  if(!selected) selected = patch;
1835  else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1836  }
1837  break;
1838  case kTriggerLevel1Gamma:
1839  if(patch->IsGammaHighSimple() || patch->IsGammaLowSimple()){
1840  if(!selected) selected = patch;
1841  else if(patch->GetADCOfflineAmp() > selected->GetADCOfflineAmp()) selected = patch;
1842  }
1843  break;
1844  default: // Silence compiler warnings
1845  AliError("Untreated case: Main Patch is recalculated; should be in 'else' branch");
1846  };
1847  }
1848  } else { // Not OfflineSimple
1849  switch(trigger){
1850  case kTriggerLevel0:
1851  if(patch->IsLevel0()) selected = patch;
1852  break;
1853  case kTriggerLevel1Jet:
1854  if(patch->IsJetHigh() || patch->IsJetLow()){
1855  if(!selected) selected = patch;
1856  else if (patch->GetADCAmp() > selected->GetADCAmp())
1857  selected = patch;
1858  }
1859  break;
1860  case kTriggerLevel1Gamma:
1861  if(patch->IsGammaHigh() || patch->IsGammaLow()){
1862  if(!selected) selected = patch;
1863  else if (patch->GetADCAmp() > selected->GetADCAmp())
1864  selected = patch;
1865  }
1866  break;
1867  default:
1868  AliError("Untreated case: Main Patch is recalculated; should be in 'else' branch");
1869  };
1870  }
1871  }
1872  else if ((trigger == kTriggerRecalcJet && patch->IsRecalcJet()) ||
1873  (trigger == kTriggerRecalcGamma && patch->IsRecalcGamma())) { // recalculated patches
1874  if (doSimpleOffline && patch->IsOfflineSimple()) {
1875  if(!selected) selected = patch;
1876  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
1877  selected = patch;
1878  }
1879  else if (!doSimpleOffline && !patch->IsOfflineSimple()) {
1880  if(!selected) selected = patch;
1881  else if (patch->GetADCAmp() > selected->GetADCAmp())
1882  selected = patch;
1883  }
1884  }
1885  }
1886  return selected;
1887 }
1888 
1895 {
1896  if (!(InputEvent()->FindListObject(obj->GetName()))) {
1897  InputEvent()->AddObject(obj);
1898  }
1899  else {
1900  if (!attempt) {
1901  AliFatal(Form("%s: Container with name %s already present. Aborting", GetName(), obj->GetName()));
1902  }
1903  }
1904 }
1905 
1914 {
1915 
1916  if (!fGeom) {
1917  AliWarning(Form("%s - AliAnalysisTaskEmcal::IsTrackInEmcalAcceptance - Geometry is not available!", GetName()));
1918  return kFALSE;
1919  }
1920 
1921  Double_t minPhi = fGeom->GetArm1PhiMin() - edges;
1922  Double_t maxPhi = fGeom->GetArm1PhiMax() + edges;
1923 
1924  if (part->Phi() > minPhi && part->Phi() < maxPhi) {
1925  return kTRUE;
1926  }
1927  else {
1928  return kFALSE;
1929  }
1930 }
1931 
1933 {
1934  axis->SetBinLabel(1, "NullObject");
1935  axis->SetBinLabel(2, "Pt");
1936  axis->SetBinLabel(3, "Acceptance");
1937  axis->SetBinLabel(4, "MCLabel");
1938  axis->SetBinLabel(5, "BitMap");
1939  axis->SetBinLabel(6, "HF cut");
1940  axis->SetBinLabel(7, "Bit6");
1941  axis->SetBinLabel(8, "NotHybridTrack");
1942  axis->SetBinLabel(9, "MCFlag");
1943  axis->SetBinLabel(10, "MCGenerator");
1944  axis->SetBinLabel(11, "ChargeCut");
1945  axis->SetBinLabel(12, "MinDistanceTPCSectorEdge");
1946  axis->SetBinLabel(13, "Bit12");
1947  axis->SetBinLabel(14, "IsEMCal");
1948  axis->SetBinLabel(15, "Time");
1949  axis->SetBinLabel(16, "Energy");
1950  axis->SetBinLabel(17, "ExoticCut");
1951  axis->SetBinLabel(18, "Bit17");
1952  axis->SetBinLabel(19, "Area");
1953  axis->SetBinLabel(20, "AreaEmc");
1954  axis->SetBinLabel(21, "ZLeadingCh");
1955  axis->SetBinLabel(22, "ZLeadingEmc");
1956  axis->SetBinLabel(23, "NEF");
1957  axis->SetBinLabel(24, "MinLeadPt");
1958  axis->SetBinLabel(25, "MaxTrackPt");
1959  axis->SetBinLabel(26, "MaxClusterPt");
1960  axis->SetBinLabel(27, "Flavour");
1961  axis->SetBinLabel(28, "TagStatus");
1962  axis->SetBinLabel(29, "MinNConstituents");
1963  axis->SetBinLabel(30, "Bit29");
1964  axis->SetBinLabel(31, "Bit30");
1965  axis->SetBinLabel(32, "Bit31");
1966 }
1967 
1974 Double_t AliAnalysisTaskEmcal::GetParallelFraction(AliVParticle* part1, AliVParticle* part2)
1975 {
1976  TVector3 vect1(part1->Px(), part1->Py(), part1->Pz());
1977  TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1978  Double_t z = (vect1 * vect2) / (vect2 * vect2);
1979  return z;
1980 }
1981 
1988 Double_t AliAnalysisTaskEmcal::GetParallelFraction(const TVector3& vect1, AliVParticle* part2)
1989 {
1990  TVector3 vect2(part2->Px(), part2->Py(), part2->Pz());
1991  Double_t z = (vect1 * vect2) / (vect2 * vect2);
1992  return z;
1993 }
1994 
2003 void AliAnalysisTaskEmcal::GetEtaPhiDiff(const AliVTrack *t, const AliVCluster *v, Double_t &phidiff, Double_t &etadiff)
2004 {
2005  phidiff = 999;
2006  etadiff = 999;
2007 
2008  if (!t||!v) return;
2009 
2010  Double_t veta = t->GetTrackEtaOnEMCal();
2011  Double_t vphi = t->GetTrackPhiOnEMCal();
2012 
2013  Float_t pos[3] = {0};
2014  v->GetPosition(pos);
2015  TVector3 cpos(pos);
2016  Double_t ceta = cpos.Eta();
2017  Double_t cphi = cpos.Phi();
2018  etadiff=veta-ceta;
2019  phidiff=TVector2::Phi_mpi_pi(vphi-cphi);
2020 }
2021 
2027 Byte_t AliAnalysisTaskEmcal::GetTrackType(const AliVTrack *t)
2028 {
2029  Byte_t ret = 0;
2030  if (t->TestBit(BIT(22)) && !t->TestBit(BIT(23)))
2031  ret = 1;
2032  else if (!t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
2033  ret = 2;
2034  else if (t->TestBit(BIT(22)) && t->TestBit(BIT(23)))
2035  ret = 3;
2036  return ret;
2037 }
2038 
2048 Byte_t AliAnalysisTaskEmcal::GetTrackType(const AliAODTrack *aodTrack, UInt_t filterBit1, UInt_t filterBit2)
2049 {
2050 
2051  Int_t res = 0;
2052 
2053  if (aodTrack->TestFilterBit(filterBit1)) {
2054  res = 0;
2055  }
2056  else if (aodTrack->TestFilterBit(filterBit2)) {
2057  if ((aodTrack->GetStatus()&AliVTrack::kITSrefit)!=0) {
2058  res = 1;
2059  }
2060  else {
2061  res = 2;
2062  }
2063  }
2064  else {
2065  res = 3;
2066  }
2067 
2068  return res;
2069 }
2070 
2076 {
2077  if (!fPythiaInfo) {
2079  }
2080 
2081  AliStack* stack = mcEvent->Stack();
2082 
2083  const Int_t nprim = stack->GetNprimary();
2084  // reject if partons are missing from stack for some reason
2085  if (nprim < 8) return;
2086 
2087  TParticle *part6 = stack->Particle(6);
2088  TParticle *part7 = stack->Particle(7);
2089 
2090  fPythiaInfo->SetPartonFlag6(TMath::Abs(part6->GetPdgCode()));
2091  fPythiaInfo->SetParton6(part6->Pt(), part6->Eta(), part6->Phi(), part6->GetMass());
2092 
2093  fPythiaInfo->SetPartonFlag7(TMath::Abs(part7->GetPdgCode()));
2094  fPythiaInfo->SetParton7(part7->Pt(), part7->Eta(), part7->Phi(), part7->GetMass());
2095 
2096  AliGenPythiaEventHeader *pythiaGenHeader = dynamic_cast<AliGenPythiaEventHeader*>(mcEvent->GenEventHeader());
2097  if(pythiaGenHeader){
2098  Float_t ptWeight=pythiaGenHeader->EventWeight();
2099  fPythiaInfo->SetPythiaEventWeight(ptWeight);}
2100 }
2101 
2107 {
2108  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
2109  if (!mgr) {
2110  ::Error("AddAODHandler", "No analysis manager to connect to.");
2111  return NULL;
2112  }
2113 
2114  AliAODInputHandler* aodHandler = new AliAODInputHandler();
2115 
2116  AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
2117  if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
2118  AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
2119  multiInputHandler->AddInputEventHandler(aodHandler);
2120  }
2121  else {
2122  if (!inputHandler) {
2123  mgr->SetInputEventHandler(aodHandler);
2124  }
2125  else {
2126  ::Error("AddAODHandler", "inputHandler is NOT null. AOD handler was NOT added !!!");
2127  return NULL;
2128  }
2129  }
2130 
2131  return aodHandler;
2132 }
2133 
2139 {
2140  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
2141  if (!mgr) {
2142  ::Error("AddESDHandler", "No analysis manager to connect to.");
2143  return NULL;
2144  }
2145 
2146  AliESDInputHandler *esdHandler = new AliESDInputHandler();
2147 
2148  AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
2149  if (inputHandler && (inputHandler->IsA() == AliMultiInputEventHandler::Class())) {
2150  AliMultiInputEventHandler *multiInputHandler=(AliMultiInputEventHandler*)inputHandler;
2151  multiInputHandler->AddInputEventHandler(esdHandler);
2152  }
2153  else {
2154  if (!inputHandler) {
2155  mgr->SetInputEventHandler(esdHandler);
2156  }
2157  else {
2158  ::Error("AddESDHandler", "inputHandler is NOT null. ESD handler was NOT added !!!");
2159  return NULL;
2160  }
2161  }
2162 
2163  return esdHandler;
2164 }
2165 
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 -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