AliPhysics  90acdf5 (90acdf5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskChargedParticlesRefMC.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2015, 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 <vector>
16 #include <map>
17 
18 #include <TArrayD.h>
19 #include <TChain.h>
20 #include <TClonesArray.h>
21 #include <TFile.h>
22 #include <THashList.h>
23 #include <TH1.h>
24 #include <THistManager.h>
25 #include <TKey.h>
26 #include <TList.h>
27 #include <TPDGCode.h>
28 #include <TProfile.h>
29 #include <TMath.h>
30 #include <TString.h>
31 #include <TSystem.h>
32 #include <TTree.h>
33 
34 #include "AliAnalysisManager.h"
35 #include "AliAnalysisUtils.h"
36 #include "AliAODMCHeader.h"
37 #include "AliAODInputHandler.h"
38 #include "AliAODMCParticle.h"
39 #include "AliAODTrack.h"
41 #include "AliEmcalTrackSelection.h"
43 #include "AliEMCALTriggerPatchInfo.h"
44 #include "AliEMCALGeometry.h"
45 #include "AliEMCALRecoUtils.h"
46 #include "AliESDEvent.h"
47 #include "AliESDtrack.h"
48 #include "AliGenPythiaEventHeader.h"
49 #include "AliInputEventHandler.h"
50 #include "AliMCEvent.h"
51 #include "AliVVertex.h"
52 
55 
59 
60 namespace EMCalTriggerPtAnalysis {
61 
65 AliAnalysisTaskChargedParticlesRefMC::AliAnalysisTaskChargedParticlesRefMC():
66  AliAnalysisTaskSE(),
67  fTrackCuts(NULL),
68  fAnalysisUtil(NULL),
69  fTriggerSelection(NULL),
70  fHistos(NULL),
71  fGeometry(NULL),
72  fWeightHandler(NULL),
73  fUsePythiaHard(kFALSE),
74  fPtHard(0),
75  fPtHardBin(0),
76  fNTrials(0),
77  fXsection(0),
78  fYshift(0.465),
79  fEtaSign(1),
80  fFracPtHard(-1)
81 {
82  // Restrict analysis to the EMCAL acceptance
83  fEtaLabCut[0] = -0.6;
84  fEtaLabCut[1] = 0.6;
85  fEtaCmsCut[0] = -0.13;
86  fEtaCmsCut[1] = 0.13;
87 }
88 
94  AliAnalysisTaskSE(name),
95  fTrackCuts(NULL),
96  fAnalysisUtil(NULL),
97  fTriggerSelection(NULL),
98  fHistos(NULL),
99  fGeometry(NULL),
100  fWeightHandler(NULL),
101  fUsePythiaHard(kFALSE),
102  fPtHard(0),
103  fPtHardBin(0),
104  fNTrials(0),
105  fXsection(0),
106  fYshift(0.465),
107  fEtaSign(1),
108  fFracPtHard(-1)
109 {
110  // Restrict analysis to the EMCAL acceptance
111  fEtaLabCut[0] = -0.6;
112  fEtaLabCut[1] = 0.6;
113  fEtaCmsCut[0] = -0.13;
114  fEtaCmsCut[1] = 0.13;
115  DefineOutput(1, TList::Class());
116 }
117 
122  //if(fTrackCuts) delete fTrackCuts;
123  if(fAnalysisUtil) delete fAnalysisUtil;
125  if(fHistos) delete fHistos;
126 }
131  if(!fAnalysisUtil) fAnalysisUtil = new AliAnalysisUtils;
132  fHistos = new THistManager("Ref");
133 
134  if(!fTrackCuts) InitializeTrackCuts("standard",fInputHandler->IsA() == AliAODInputHandler::Class());
135 
136  OldPtBinning oldbinning;
137  NewPtBinning newbinning;
138 
139  fHistos->CreateTH1("hNtrials", "Number of trials", 1, 0.5, 1.5);
140  fHistos->CreateTProfile("hCrossSection", "PYTHIA cross section", 1, 0.5, 1.5);
141  fHistos->CreateTH1("hNtrialsNoSelect", "Number of trials (without event selection)", 1, 0.5, 1.5);
142  fHistos->CreateTH1("hNtrialsEvent", "Number of trials (from header, after event selection)", 1, 0.5, 1.5);
143  fHistos->CreateTProfile("hCrossSectionEvent", "PYTHIA cross section (from header, after event selection)", 1, 0.5, 1.5);
144  fHistos->CreateTH1("hPtHard", "Pt of the hard interaction", 1000, 0., 500);
145  fHistos->CreateTH1("hTriggerJetPtNoCut", "pt of trigger jets wihtout cuts", 1000, 0., 500);
146  fHistos->CreateTH1("hRatioPtJetPtHardNoCut", "Ratio of pt jet / pt hard without cut", 1000, 0., 20.);
147  fHistos->CreateTH1("hTriggerJetPtWithCut", "pt of trigger jets after cuts", 1000, 0., 500);
148  fHistos->CreateTH1("hRatioPtJetPtHardWithCut", "Ratio of pt jet / pt hard with cut on this ratio", 1000, 0., 20.);
149  TString triggers[16] = {"True", "MB", "EMC7", "EJ1", "EJ2", "EG1", "EG2", "MBexcl", "EJ2excl", "EG2excl", "E1combined", "E1Jonly", "E1Gonly", "E2combined", "E2Jonly", "E2Gonly"};
150  Double_t ptcuts[5] = {1., 2., 5., 10., 20.};
151  TString species[6] = {"El", "Mu", "Pi", "Ka", "Pr", "Ot"};
152  for(TString *trg = triggers; trg < triggers + sizeof(triggers)/sizeof(TString); trg++){
153  fHistos->CreateTH1(Form("hEventCount%s", trg->Data()), Form("Event Counter for trigger class %s", trg->Data()), 1, 0.5, 1.5);
154  fHistos->CreateTH1(Form("hVertexBefore%s", trg->Data()), Form("Vertex distribution before z-cut for trigger class %s", trg->Data()), 500, -50, 50);
155  fHistos->CreateTH1(Form("hVertexAfter%s", trg->Data()), Form("Vertex distribution after z-cut for trigger class %s", trg->Data()), 100, -10, 10);
156  fHistos->CreateTH1(Form("hPtEtaAllOldBinning%s", trg->Data()), Form("Charged particle pt distribution all eta old binning trigger %s", trg->Data()), oldbinning);
157  fHistos->CreateTH1(Form("hPtEtaCentOldBinning%s", trg->Data()), Form("Charged particle pt distribution central eta old binning trigger %s", trg->Data()), oldbinning);
158  fHistos->CreateTH1(Form("hPtEtaAllNewBinning%s", trg->Data()), Form("Charged particle pt distribution all eta new binning trigger %s", trg->Data()), newbinning);
159  fHistos->CreateTH1(Form("hPtEtaCentNewBinning%s", trg->Data()), Form("Charged particle pt distribution central eta new binning trigger %s", trg->Data()), newbinning);
160  fHistos->CreateTH1(Form("hPtEMCALEtaAllOldBinning%s", trg->Data()), Form("Charged particle in EMCAL pt distribution all eta old binning trigger %s", trg->Data()), oldbinning);
161  fHistos->CreateTH1(Form("hPtEMCALEtaCentOldBinning%s", trg->Data()), Form("Charged particle in EMCAL pt distribution central eta old binning trigger %s", trg->Data()), oldbinning);
162  fHistos->CreateTH1(Form("hPtEMCALEtaAllNewBinning%s", trg->Data()), Form("Charged particle in EMCAL pt distribution all eta new binning trigger %s", trg->Data()), newbinning);
163  fHistos->CreateTH1(Form("hPtEMCALEtaCentNewBinning%s", trg->Data()), Form("Charged particle in EMCAL pt distribution central eta new binning trigger %s", trg->Data()), newbinning);
164  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaAllOldBinning%s", trg->Data()), Form("Charged particle in EMCAL (no TRD in front) pt distribution all eta old binning trigger %s", trg->Data()), oldbinning);
165  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaCentOldBinning%s", trg->Data()), Form("Charged particle in EMCAL (no TRD in front) pt distribution central eta old binning trigger %s", trg->Data()), oldbinning);
166  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaAllNewBinning%s", trg->Data()), Form("Charged particle in EMCAL (no TRD in front) pt distribution all eta new binning trigger %s", trg->Data()), newbinning);
167  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaCentNewBinning%s", trg->Data()), Form("Charged particle in EMCAL (no TRD in front) pt distribution central eta new binning trigger %s", trg->Data()), newbinning);
168  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaAllOldBinning%s", trg->Data()), Form("Charged particle in EMCAL (with TRD in front) pt distribution all eta old binning trigger %s", trg->Data()), oldbinning);
169  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaCentOldBinning%s", trg->Data()), Form("Charged particle in EMCAL (with TRD in front) pt distribution central eta old binning trigger %s", trg->Data()), oldbinning);
170  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaAllNewBinning%s", trg->Data()), Form("Charged particle in EMCAL (with TRD in front) pt distribution all eta new binning trigger %s", trg->Data()), newbinning);
171  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaCentNewBinning%s", trg->Data()), Form("Charged particle in EMCAL (with TRD in front) pt distribution central eta new binning trigger %s", trg->Data()), newbinning);
172  for(TString *piditer = species; piditer < species + sizeof(species)/sizeof(TString); ++piditer){
173  fHistos->CreateTH1(Form("hPtEtaAllOldBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s pt distribution all eta old binning trigger %s", piditer->Data(), trg->Data()), oldbinning);
174  fHistos->CreateTH1(Form("hPtEtaCentOldBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s pt distribution central eta old binning trigger %s", piditer->Data(), trg->Data()), oldbinning);
175  fHistos->CreateTH1(Form("hPtEtaAllNewBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s pt distribution all eta new binning trigger %s", piditer->Data(), trg->Data()), newbinning);
176  fHistos->CreateTH1(Form("hPtEtaCentNewBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s pt distribution central eta new binning trigger %s", piditer->Data(), trg->Data()), newbinning);
177  fHistos->CreateTH1(Form("hPtEMCALEtaAllOldBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL pt distribution all eta old binning trigger %s", piditer->Data(), trg->Data()), oldbinning);
178  fHistos->CreateTH1(Form("hPtEMCALEtaCentOldBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL pt distribution central eta old binning trigger %s", piditer->Data(), trg->Data()), oldbinning);
179  fHistos->CreateTH1(Form("hPtEMCALEtaAllNewBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL pt distribution all eta new binning trigger %s", piditer->Data(), trg->Data()), newbinning);
180  fHistos->CreateTH1(Form("hPtEMCALEtaCentNewBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL pt distribution central eta new binning trigger %s", piditer->Data(), trg->Data()), newbinning);
181  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaAllOldBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (no TRD in front) pt distribution all eta old binning trigger %s", piditer->Data(), trg->Data()), oldbinning);
182  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaCentOldBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (no TRD in front) pt distribution central eta old binning trigger %s", piditer->Data(), trg->Data()), oldbinning);
183  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaAllNewBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (no TRD in front) pt distribution all eta new binning trigger %s", piditer->Data(), trg->Data()), newbinning);
184  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaCentNewBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (no TRD in front) pt distribution central eta new binning trigger %s", piditer->Data(), trg->Data()), newbinning);
185  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaAllOldBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (with TRD in front) pt distribution all eta old binning trigger %s", piditer->Data(), trg->Data()), oldbinning);
186  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaCentOldBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (with TRD in front) pt distribution central eta old binning trigger %s", piditer->Data(), trg->Data()), oldbinning);
187  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaAllNewBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (with TRD in front) pt distribution all eta new binning trigger %s", piditer->Data(), trg->Data()), newbinning);
188  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaCentNewBinning%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (with TRD in front) pt distribution central eta new binning trigger %s", piditer->Data(), trg->Data()), newbinning);
189  }
190  for(int ipt = 0; ipt < 5; ipt++){
192  Form("hEtaLabDistAllPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
193  Form("Eta (lab) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
194  100,
195  -1.,
196  1.
197  );
199  Form("hEtaLabDistCutPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
200  Form("Eta (lab) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
201  100,
202  -1.,
203  1.
204  );
206  Form("hEtaCentDistAllPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
207  Form("Eta (cent) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
208  160,
209  -1.3,
210  1.3
211  );
213  Form("hEtaCentDistCutPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
214  Form("Eta (cent) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
215  160,
216  -1.3,
217  1.3
218  );
220  Form("hEtaLabDistAllEMCALPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
221  Form("Eta (lab) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
222  100,
223  -1.,
224  1.
225  );
227  Form("hEtaLabDistCutEMCALPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
228  Form("Eta (lab) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
229  100,
230  -1.,
231  1.
232  );
234  Form("hEtaCentDistAllEMCALPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
235  Form("Eta (cent) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
236  160,
237  -1.3,
238  1.3
239  );
241  Form("hEtaCentDistCutEMCALPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
242  Form("Eta (cent) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
243  160,
244  -1.3,
245  1.3
246  );
248  Form("hPhiDistAllPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
249  Form("#phi distribution of particles with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
250  300,
251  0.,
252  2*TMath::Pi()
253  );
254  }
255  }
256  //fHistos->GetListOfHistograms()->Add(fTrackCuts);
257  PostData(1, fHistos->GetListOfHistograms());
258 }
259 
260 void AliAnalysisTaskChargedParticlesRefMC::UserExec(Option_t*) { // Select event
261  if(!fMCEvent) return;
262  if(!fGeometry){
263  fGeometry = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
264  }
265  AliGenPythiaEventHeader *pyheader = GetPythiaHeader();
266  if(pyheader){
267  FillTriggerJetHistograms(kFALSE, pyheader);
268  fHistos->FillTH1("hNtrialsNoSelect",1,pyheader->Trials());
269  if(fFracPtHard > 0){
270  // Apply outlier cut in case of a positive fraction of pthard
271  if(IsOutlier(pyheader))
272  return;
273  }
274  FillTriggerJetHistograms(kTRUE, pyheader);
275  }
276 
277  Double_t weight = fWeightHandler ? fWeightHandler->GetEventWeight(pyheader) : 1.;
278 
279  //TString triggerstring = GetFiredTriggerClasses(fTriggerPatches);
280  Bool_t isMinBias = fInputHandler->IsEventSelected() & AliVEvent::kINT7,
281  isEMC7 = kFALSE, isEJ1 = kFALSE, isEJ2 = kFALSE, isEG1 = kFALSE, isEG2 = kFALSE;
282  TClonesArray *fTriggerPatches = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject("EmcalTriggers"));
283  if(fTriggerPatches && fTriggerSelection){
284  isEMC7 = isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEL0, fTriggerPatches); // triggerstring.Contains("EMC7"),
285  isEJ1 = isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEJ1, fTriggerPatches); // triggerstring.Contains("EJ1"),
286  isEJ2 = isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEJ2, fTriggerPatches); // triggerstring.Contains("EJ2"),
287  isEG1 = isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEG1, fTriggerPatches); // triggerstring.Contains("EG1"),
288  isEG2 = isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEG2, fTriggerPatches); // triggerstring.Contains("EG2"); // In simulations triggered events are a subset of min. bias events
289 
290  }
291  if(!(isMinBias || isEG1 || isEG2 || isEJ1 || isEJ2)) return;
292  const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
293  //if(!fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.)) return; // reject pileup event
294  if(vtx->GetNContributors() < 1) return;
295  // Fill reference distribution for the primary vertex before any z-cut
296  fHistos->FillTH1("hVertexBeforeTrue", vtx->GetZ(), weight);
297  if(isMinBias) fHistos->FillTH1("hVertexBeforeMB", vtx->GetZ(), weight);
298  if(isEMC7) fHistos->FillTH1("hVertexBeforeEMC7", vtx->GetZ(), weight);
299  if(isEJ1) fHistos->FillTH1("hVertexBeforeEJ1", vtx->GetZ(), weight);
300  if(isEJ2) fHistos->FillTH1("hVertexBeforeEJ2", vtx->GetZ(), weight);
301  if(isEG1) fHistos->FillTH1("hVertexBeforeEG1", vtx->GetZ(), weight);
302  if(isEG2) fHistos->FillTH1("hVertexBeforeEG2", vtx->GetZ(), weight);
303  if(!fAnalysisUtil->IsVertexSelected2013pA(fInputEvent)) return; // Apply new vertex cut
304  if(fAnalysisUtil->IsPileUpEvent(fInputEvent)) return; // Apply new vertex cut
305  // Apply vertex z cut
306  if(vtx->GetZ() < -10. || vtx->GetZ() > 10.) return;
307 
308  // Fill Event counter and reference vertex distributions for the different trigger classes
309  fHistos->FillTH1("hEventCountTrue", 1, weight);
310  fHistos->FillTH1("hVertexAfterTrue", vtx->GetZ(), weight);
311  if(isMinBias){
312  fHistos->FillTH1("hEventCountMB", 1, weight);
313  fHistos->FillTH1("hVertexAfterMB", vtx->GetZ(), weight);
314  // check for exclusive classes
315  if(!(isEG1 || isEG2 || isEJ1 || isEJ2)){
316  fHistos->FillTH1("hEventCountMBexcl", 1, weight);
317  fHistos->FillTH1("hVertexAfterMBexcl", vtx->GetZ(), weight);
318  }
319  }
320  if(isEMC7){
321  fHistos->FillTH1("hEventCountEMC7", 1, weight);
322  fHistos->FillTH1("hVertexAfterEMC7", vtx->GetZ(), weight);
323  }
324  if(isEJ1){
325  fHistos->FillTH1("hEventCountEJ1", 1, weight);
326  fHistos->FillTH1("hVertexAfterEJ1", vtx->GetZ(), weight);
327  if(isEG1 || isEG2){
328  fHistos->FillTH1("hEventCountE1combined", 1, weight);
329  fHistos->FillTH1("hVertexAfterE1combined", vtx->GetZ(), weight);
330  } else {
331  fHistos->FillTH1("hEventCountE1Jonly", 1, weight);
332  fHistos->FillTH1("hVertexAfterE1Jonly", vtx->GetZ(), weight);
333  }
334  }
335  if(isEJ2){
336  fHistos->FillTH1("hEventCountEJ2", 1, weight);
337  fHistos->FillTH1("hVertexAfterEJ2", vtx->GetZ(), weight);
338  // Check for exclusive classes
339  if(!isEJ1){
340  fHistos->FillTH1("hEventCountEJ2excl", 1, weight);
341  fHistos->FillTH1("hVertexAfterEJ2excl", vtx->GetZ(), weight);
342  }
343  if(isEG1 || isEG2){
344  fHistos->FillTH1("hEventCountE2combined", 1, weight);
345  fHistos->FillTH1("hVertexAfterE2combined", vtx->GetZ(), weight);
346  } else {
347  fHistos->FillTH1("hEventCountE2Jonly", 1, weight);
348  fHistos->FillTH1("hVertexAfterE2Jonly", vtx->GetZ(), weight);
349  }
350  }
351  if(isEG1){
352  fHistos->FillTH1("hEventCountEG1", 1, weight);
353  fHistos->FillTH1("hVertexAfterEG1", vtx->GetZ(), weight);
354  if(!(isEJ1 || isEJ2)){
355  fHistos->FillTH1("hEventCountE1Gonly", 1, weight);
356  fHistos->FillTH1("hVertexAfterE1Gonly", vtx->GetZ(), weight);
357  }
358  }
359  if(isEG2){
360  fHistos->FillTH1("hEventCountEG2", 1, weight);
361  fHistos->FillTH1("hVertexAfterEG2", vtx->GetZ(), weight);
362  // check for exclusive trigger classes
363  if(!isEG1){
364  fHistos->FillTH1("hEventCountEG2excl", 1, weight);
365  fHistos->FillTH1("hVertexAfterEG2excl", vtx->GetZ(), weight);
366  }
367  if(!(isEJ1 || isEJ2)){
368  fHistos->FillTH1("hEventCountE2Gonly", 1, weight);
369  fHistos->FillTH1("hVertexAfterE2Gonly", vtx->GetZ(), weight);
370  }
371  }
372 
373  // Fill PYTHIA histograms from event header
374  if(pyheader){
375  fHistos->FillTH1("hNtrialsEvent", 1., pyheader->Trials());
376  fHistos->FillProfile("hCrossSectionEvent", 1., pyheader->GetXsection());
377  fHistos->FillTH1("hPtHard", pyheader->GetPtHard());
378  }
379 
380  // MonteCarlo Loop
381  // Histograms
382  // - Full eta (-0.8, 0.8), new binning
383  // - Full eta_{lab} (-0.8, 0.8), old binning
384  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c without eta cut
385  // - Central eta_{cms} (-0.3, 0.3), new binning,
386  // - Central eta_{cms} (-0.3, 0.3), old binning,
387  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c
388  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c with eta cut
389  AliVParticle *truepart = NULL;
390  Bool_t isEMCAL(kFALSE);
391  for(int ipart = 0; ipart < fMCEvent->GetNumberOfTracks(); ipart++){
392  truepart = fMCEvent->GetTrack(ipart);
393 
394  // Select only particles within ALICE acceptance
395  if((truepart->Eta() < fEtaLabCut[0]) || (truepart->Eta() > fEtaLabCut[1])) continue;
396  if(TMath::Abs(truepart->Pt()) < 0.1) continue;
397  if(!truepart->Charge()) continue;
398 
399  if(!IsPhysicalPrimary(truepart, fMCEvent)) continue;
400  isEMCAL = (truepart->Phi() > 1.5 && truepart->Phi() < 3.1) ? kTRUE : kFALSE;
401 
402  // Calculate eta in cms frame according
403  // EPJC74 (2014) 3054:
404  // eta_cms = - eta_lab - |yshift|
405  Double_t etacent = -1. * truepart->Eta() - TMath::Abs(fYshift);
406  etacent *= fEtaSign;
407 
408  Bool_t etacentcut = etacent > fEtaCmsCut[0] && etacent < fEtaCmsCut[1];
409 
410  // Get PID
411  TString pid = "";
412  switch(TMath::Abs(truepart->PdgCode())){
413  case kPiPlus: pid = "Pi"; break;
414  case kMuonMinus: pid = "Mu"; break;
415  case kElectron: pid = "El"; break;
416  case kKPlus: pid = "Ka"; break;
417  case kProton: pid = "Pr"; break;
418  default: pid = "Ot"; break;
419  };
420 
421  // Particle selected (do not filter TRD sectors for MC truth)
422  FillTrackHistos("True", weight, truepart->Pt(), truepart->Eta() * fEtaSign, etacent, truepart->Phi(), etacentcut, isEMCAL, kFALSE, pid);
423  }
424 
425  // Loop over tracks, fill select particles
426  // Histograms
427  // - Full eta (-0.8, 0.8), new binning
428  // - Full eta (-0.8, 0.8), old binning
429  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c without eta cut
430  // - Central eta (-0.8, -0.2), new binning,
431  // - Central eta (-0.8, -0.2), old binning,
432  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c
433  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c with eta cut
434  AliVTrack *checktrack(NULL);
435  AliVParticle *assocMC(NULL);
436  double ptparticle(-1.), etaparticle(-100.), etaEMCAL(0.), phiEMCAL(0.);
437  Bool_t hasTRD = kFALSE;
438  for(int itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); ++itrk){
439  checktrack = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(itrk));
440  if(!checktrack) continue;
441  // Find associated particle
442  assocMC = fMCEvent->GetTrack(TMath::Abs(checktrack->GetLabel()));
443  if(!assocMC) continue; // Fake track
444  if(!IsPhysicalPrimary(assocMC, fMCEvent)) continue;
445 
446  // Select only particles within ALICE acceptance
447  if((checktrack->Eta() < fEtaLabCut[0]) || (checktrack->Eta() > fEtaLabCut[1])) continue;
448  if(TMath::Abs(checktrack->Pt()) < 0.1) continue;
449  if(checktrack->IsA() == AliESDtrack::Class()){
450  AliESDtrack copytrack(*(static_cast<AliESDtrack *>(checktrack)));
451  AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&copytrack);
452  etaEMCAL = copytrack.GetTrackEtaOnEMCal();
453  phiEMCAL = copytrack.GetTrackPhiOnEMCal();
454  } else {
455  AliAODTrack copytrack(*(static_cast<AliAODTrack *>(checktrack)));
456  AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&copytrack);
457  etaEMCAL = copytrack.GetTrackEtaOnEMCal();
458  phiEMCAL = copytrack.GetTrackPhiOnEMCal();
459  }
460  Int_t supermoduleID = -1;
461  isEMCAL = fGeometry->SuperModuleNumberFromEtaPhi(etaEMCAL, phiEMCAL, supermoduleID);
462  // Exclude supermodules 10 and 11 as they did not participate in the trigger
463  isEMCAL = isEMCAL && supermoduleID < 10;
464  hasTRD = isEMCAL && supermoduleID >= 4; // supermodules 4 - 10 have TRD in front in the 2012-2013 ALICE setup
465 
466  if(!fTrackCuts->IsTrackAccepted(checktrack)) continue;
467 
468  ptparticle = TMath::Abs(assocMC->Pt());
469  etaparticle = assocMC->Eta();
470 
471  // Calculate eta in cms frame according
472  // EPJC74 (2014) 3054:
473  // eta_cms = - eta_lab - |yshift|
474  Double_t etacent = -1. * checktrack->Eta() - TMath::Abs(fYshift);
475  etacent *= fEtaSign;
476 
477  Bool_t etacentcut = etacent > fEtaCmsCut[0] && etacent < fEtaCmsCut[1];
478 
479  // Get PID
480  TString assocpid = "";
481  switch(TMath::Abs(assocMC->PdgCode())){
482  case kPiPlus: assocpid = "Pi"; break;
483  case kMuonMinus: assocpid = "Mu"; break;
484  case kElectron: assocpid = "El"; break;
485  case kKPlus: assocpid = "Ka"; break;
486  case kProton: assocpid = "Pr"; break;
487  default: assocpid = "Ot"; break;
488  };
489 
490  // Go through the trigger classes and fill histograms
491  if(isMinBias){
492  FillTrackHistos("MB", weight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
493  // Check for exclusive classes
494  if(!(isEG1 || isEG2 || isEJ1 || isEJ2)){
495  FillTrackHistos("MBexcl", weight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
496  }
497  }
498  if(isEMC7){
499  FillTrackHistos("EMC7", weight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
500  }
501  if(isEJ1){
502  FillTrackHistos("EJ1", weight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
503  if(isEG1 || isEG2) {
504  FillTrackHistos("E1combined", weight, checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
505  } else {
506  FillTrackHistos("E1Jonly", weight, checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
507  }
508  }
509  if(isEJ2){
510  FillTrackHistos("EJ2", weight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
511  // check for exclusive classes
512  if(!isEJ1){
513  FillTrackHistos("EJ2excl", weight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
514  }
515  if(isEG1 || isEG2) {
516  FillTrackHistos("E2combined", weight, checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
517  } else {
518  FillTrackHistos("E2Jonly", weight, checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
519  }
520  }
521  if(isEG1){
522  FillTrackHistos("EG1", weight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
523  if(!(isEJ1 || isEJ2)){
524  FillTrackHistos("E1Gonly", weight, checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
525  }
526  }
527  if(isEG2){
528  FillTrackHistos("EG2", weight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
529  // check for exclusive classes
530  if(!isEG1){
531  FillTrackHistos("EG2excl", weight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
532  }
533  if(!(isEJ1 || isEJ2)){
534  FillTrackHistos("E2Gonly", weight, checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
535  }
536  }
537  }
538  PostData(1, fHistos->GetListOfHistograms());
539 
540 }
541 
554  const char *eventclass,
555  Double_t weight,
556  Double_t pt,
557  Double_t etalab,
558  Double_t etacent,
559  Double_t phi,
560  Bool_t etacut,
561  Bool_t inEmcal,
562  Bool_t hasTRD,
563  const char *pid
564  )
565 {
566  fHistos->FillTH1(Form("hPtEtaAllNewBinning%s", eventclass), TMath::Abs(pt), weight);
567  fHistos->FillTH1(Form("hPtEtaAllOldBinning%s", eventclass), TMath::Abs(pt), weight);
568  fHistos->FillTH1(Form("hPtEtaAllNewBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
569  fHistos->FillTH1(Form("hPtEtaAllOldBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
570  if(inEmcal){
571  fHistos->FillTH1(Form("hPtEMCALEtaAllNewBinning%s", eventclass), TMath::Abs(pt), weight);
572  fHistos->FillTH1(Form("hPtEMCALEtaAllOldBinning%s", eventclass), TMath::Abs(pt), weight);
573  fHistos->FillTH1(Form("hPtEMCALEtaAllNewBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
574  fHistos->FillTH1(Form("hPtEMCALEtaAllOldBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
575  if(hasTRD){
576  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaAllNewBinning%s", eventclass), TMath::Abs(pt), weight);
577  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaAllOldBinning%s", eventclass), TMath::Abs(pt), weight);
578  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaAllNewBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
579  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaAllOldBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
580  } else {
581  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaAllNewBinning%s", eventclass), TMath::Abs(pt), weight);
582  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaAllOldBinning%s", eventclass), TMath::Abs(pt), weight);
583  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaAllNewBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
584  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaAllOldBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
585  }
586  }
587 
588  int ptmin[5] = {1,2,5,10,20}; // for eta distributions
589  for(int icut = 0; icut < 5; icut++){
590  if(TMath::Abs(pt) > static_cast<double>(ptmin[icut])){
591  fHistos->FillTH1(Form("hPhiDistAllPt%d%s", ptmin[icut], eventclass), phi, weight);
592  fHistos->FillTH1(Form("hEtaLabDistAllPt%d%s", ptmin[icut], eventclass), etalab, weight);
593  fHistos->FillTH1(Form("hEtaCentDistAllPt%d%s", ptmin[icut], eventclass), etacent, weight);
594  if(inEmcal){
595  fHistos->FillTH1(Form("hEtaLabDistAllEMCALPt%d%s", ptmin[icut], eventclass), etalab, weight);
596  fHistos->FillTH1(Form("hEtaCentDistAllEMCALPt%d%s", ptmin[icut], eventclass), etacent, weight);
597  }
598  }
599  }
600 
601  if(etacut){
602  fHistos->FillTH1(Form("hPtEtaCentNewBinning%s", eventclass), TMath::Abs(pt), weight);
603  fHistos->FillTH1(Form("hPtEtaCentOldBinning%s", eventclass), TMath::Abs(pt), weight);
604  fHistos->FillTH1(Form("hPtEtaCentNewBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
605  fHistos->FillTH1(Form("hPtEtaCentOldBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
606  if(inEmcal){
607  fHistos->FillTH1(Form("hPtEMCALEtaCentNewBinning%s", eventclass), TMath::Abs(pt), weight);
608  fHistos->FillTH1(Form("hPtEMCALEtaCentOldBinning%s", eventclass), TMath::Abs(pt), weight);
609  fHistos->FillTH1(Form("hPtEMCALEtaCentNewBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
610  fHistos->FillTH1(Form("hPtEMCALEtaCentOldBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
611  if(hasTRD){
612  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaCentNewBinning%s", eventclass), TMath::Abs(pt), weight);
613  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaCentOldBinning%s", eventclass), TMath::Abs(pt), weight);
614  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaCentNewBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
615  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaCentOldBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
616  } else {
617  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaCentNewBinning%s", eventclass), TMath::Abs(pt), weight);
618  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaCentOldBinning%s", eventclass), TMath::Abs(pt), weight);
619  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaCentNewBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
620  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaCentOldBinning%s%s", pid, eventclass), TMath::Abs(pt), weight);
621  }
622  }
623  for(int icut = 0; icut < 5; icut++){
624  if(TMath::Abs(pt) > static_cast<double>(ptmin[icut])){
625  fHistos->FillTH1(Form("hEtaLabDistCutPt%d%s", ptmin[icut], eventclass), etalab, weight);
626  fHistos->FillTH1(Form("hEtaCentDistCutPt%d%s", ptmin[icut], eventclass), etacent, weight);
627  if(inEmcal){
628  fHistos->FillTH1(Form("hEtaLabDistCutEMCALPt%d%s", ptmin[icut], eventclass), etalab, weight);
629  fHistos->FillTH1(Form("hEtaCentDistCutEMCALPt%d%s", ptmin[icut], eventclass), etacent, weight);
630  }
631  }
632  }
633  }
634 }
635 
641 void AliAnalysisTaskChargedParticlesRefMC::FillTriggerJetHistograms(Bool_t aftercut, AliGenPythiaEventHeader *const header){
642  TString ending = aftercut ? "WithCut" : "NoCut";
643  Float_t pbuf[4];
644  TLorentzVector jetvec;
645  TString hnameSpec = "hTriggerJetPt" + ending,
646  hnameptratio = "hRatioPtJetPtHard" + ending;
647  for(int ijet = 0; ijet < header->NTriggerJets(); ijet++){
648  memset(pbuf, 0, sizeof(Float_t) * 4);
649  header->TriggerJet(ijet, pbuf);
650  jetvec.SetPxPyPzE(pbuf[0], pbuf[1], pbuf[2], pbuf[3]);
651  fHistos->FillTH1(hnameSpec.Data(), TMath::Abs(jetvec.Pt()));
652  fHistos->FillTH1(hnameptratio.Data(), TMath::Abs(jetvec.Pt()/header->GetPtHard()));
653  }
654 }
655 
661 {
662  // Called when file changes.
663  if(!fUsePythiaHard) return kTRUE;
664 
665  TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
666  if (!tree) {
667  AliError(Form("%s - UserNotify: No current tree!",GetName()));
668  return kFALSE;
669  }
670 
671  Float_t xsection = 0;
672  Float_t trials = 0;
673  Int_t pthardbin = 0;
674 
675  TFile *curfile = tree->GetCurrentFile();
676  if (!curfile) {
677  AliError(Form("%s - UserNotify: No current file!",GetName()));
678  return kFALSE;
679  }
680 
681  TChain *chain = dynamic_cast<TChain*>(tree);
682  if (chain) tree = chain->GetTree();
683 
684  Int_t nevents = tree->GetEntriesFast();
685 
686  PythiaInfoFromFile(curfile->GetName(), xsection, trials, pthardbin);
687 
688  fHistos->FillTH1("hNtrials", 1., trials);
689  fHistos->FillProfile("hCrossSection", 1., xsection);
690  //fHistos->FillTH1(pthardbin, nevents);
691 
692  return kTRUE;
693 }
694 
707 Bool_t AliAnalysisTaskChargedParticlesRefMC::PythiaInfoFromFile(const char* currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard) const {
708 
709  TString file(currFile);
710  fXsec = 0;
711  fTrials = 1;
712 
713  if (file.Contains(".zip#")) {
714  Ssiz_t pos1 = file.Index("root_archive",12,0,TString::kExact);
715  Ssiz_t pos = file.Index("#",1,pos1,TString::kExact);
716  Ssiz_t pos2 = file.Index(".root",5,TString::kExact);
717  file.Replace(pos+1,pos2-pos1,"");
718  } else {
719  // not an archive take the basename....
720  file.ReplaceAll(gSystem->BaseName(file.Data()),"");
721  }
722  AliDebug(1,Form("File name: %s",file.Data()));
723 
724  // Get the pt hard bin
725  TString strPthard(file);
726 
727  strPthard.Remove(strPthard.Last('/'));
728  strPthard.Remove(strPthard.Last('/'));
729  if (strPthard.Contains("AOD")) strPthard.Remove(strPthard.Last('/'));
730  strPthard.Remove(0,strPthard.Last('/')+1);
731  if (strPthard.IsDec())
732  pthard = strPthard.Atoi();
733  else
734  AliWarning(Form("Could not extract file number from path %s", strPthard.Data()));
735 
736  // 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
737  TFile *fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec.root"));
738 
739  if (!fxsec) {
740  // next trial fetch the histgram file
741  fxsec = TFile::Open(Form("%s%s",file.Data(),"pyxsec_hists.root"));
742  if (!fxsec) {
743  // not a severe condition but inciate that we have no information
744  return kFALSE;
745  } else {
746  // find the tlist we want to be independtent of the name so use the Tkey
747  TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0);
748  if (!key) {
749  fxsec->Close();
750  return kFALSE;
751  }
752  TList *list = dynamic_cast<TList*>(key->ReadObj());
753  if (!list) {
754  fxsec->Close();
755  return kFALSE;
756  }
757  fXsec = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1);
758  fTrials = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
759  fxsec->Close();
760  }
761  } else { // no tree pyxsec.root
762  TTree *xtree = (TTree*)fxsec->Get("Xsection");
763  if (!xtree) {
764  fxsec->Close();
765  return kFALSE;
766  }
767  UInt_t ntrials = 0;
768  Double_t xsection = 0;
769  xtree->SetBranchAddress("xsection",&xsection);
770  xtree->SetBranchAddress("ntrials",&ntrials);
771  xtree->GetEntry(0);
772  fTrials = ntrials;
773  fXsec = xsection;
774  fxsec->Close();
775  }
776  return kTRUE;
777 }
778 
784  AliGenPythiaEventHeader *pythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent()->GenEventHeader());
785  if (!pythiaHeader) {
786  // Check if AOD
787  AliAODMCHeader* aodMCH = dynamic_cast<AliAODMCHeader*>(InputEvent()->FindListObject(AliAODMCHeader::StdBranchName()));
788  if (aodMCH) {
789  for (UInt_t i = 0;i<aodMCH->GetNCocktailHeaders();i++) {
790  pythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(aodMCH->GetCocktailHeader(i));
791  if (pythiaHeader) break;
792  }
793  }
794  }
795  return pythiaHeader;
796 }
797 
805 }
806 
807 
808 
814 TString AliAnalysisTaskChargedParticlesRefMC::GetFiredTriggerClasses(const TClonesArray* triggerpatches) {
815  TString triggerstring = "";
816  Int_t nEJ1 = 0, nEJ2 = 0, nEG1 = 0, nEG2 = 0;
817  double minADC_EJ1 = 260.,
818  minADC_EJ2 = 127.,
819  minADC_EG1 = 140.,
820  minADC_EG2 = 89.;
821  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
822  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(*patchIter);
823  if(!patch->IsOfflineSimple()) continue;
824  if(patch->IsJetHighSimple() && patch->GetADCOfflineAmp() > minADC_EJ1) nEJ1++;
825  if(patch->IsJetLowSimple() && patch->GetADCOfflineAmp() > minADC_EJ2) nEJ2++;
826  if(patch->IsGammaHighSimple() && patch->GetADCOfflineAmp() > minADC_EG1) nEG1++;
827  if(patch->IsGammaLowSimple() && patch->GetADCOfflineAmp() > minADC_EG2) nEG2++;
828  }
829  if(nEJ1) triggerstring += "EJ1";
830  if(nEJ2){
831  if(triggerstring.Length()) triggerstring += ",";
832  triggerstring += "EJ2";
833  }
834  if(nEG1){
835  if(triggerstring.Length()) triggerstring += ",";
836  triggerstring += "EG1";
837  }
838  if(nEG2){
839  if(triggerstring.Length()) triggerstring += ",";
840  triggerstring += "EG2";
841  }
842  return triggerstring;
843 }
844 
853 Bool_t AliAnalysisTaskChargedParticlesRefMC::IsPhysicalPrimary(const AliVParticle* const part, AliMCEvent* const mcevent) {
854  Bool_t physprim = false;
855  const AliAODMCParticle *aodmc = dynamic_cast<const AliAODMCParticle *>(part);
856  if(aodmc){
857  physprim = aodmc->IsPhysicalPrimary();
858  } else {
859  physprim = mcevent->IsPhysicalPrimary(part->GetLabel());
860  }
861  return physprim;
862 }
863 
869 Bool_t AliAnalysisTaskChargedParticlesRefMC::IsOutlier(AliGenPythiaEventHeader * const header) const {
870  Bool_t hasOutlier = kFALSE;
871  Float_t pbuf[4];
872  TLorentzVector jetvec;
873  for(int ijet = 0; ijet < header->NTriggerJets(); ijet++){
874  memset(pbuf, 0, sizeof(Float_t) * 4);
875  header->TriggerJet(ijet, pbuf);
876  jetvec.SetPxPyPzE(pbuf[0], pbuf[1], pbuf[2], pbuf[3]);
877  if(TMath::Abs(jetvec.Pt()) >= this->fFracPtHard * header->GetPtHard()){
878  hasOutlier = true;
879  break;
880  }
881  }
882  return hasOutlier;
883 }
884 
890 {
891  this->SetMinimum(0.);
892  this->AddStep(2.5, 0.1);
893  this->AddStep(7., 0.25);
894  this->AddStep(15., 0.5);
895  this->AddStep(25., 1.);
896  this->AddStep(40., 2.5);
897  this->AddStep(50., 5.);
898  this->AddStep(100., 10.);
899 }
900 
906 {
907  this->SetMinimum(0.);
908  this->AddStep(1, 0.05);
909  this->AddStep(2, 0.1);
910  this->AddStep(4, 0.2);
911  this->AddStep(7, 0.5);
912  this->AddStep(16, 1);
913  this->AddStep(36, 2);
914  this->AddStep(40, 4);
915  this->AddStep(50, 5);
916  this->AddStep(100, 10);
917  this->AddStep(200, 20);
918 }
919 
920 } /* namespace EMCalTriggerPtAnalysis */
const AliEMCalTriggerWeightHandler * fWeightHandler
Weight handler (optional)
void FillTriggerJetHistograms(Bool_t aftercut, AliGenPythiaEventHeader *const header)
static AliEmcalTrackSelection * TrackCutsFactory(TString name, Bool_t isAOD)
TSystem * gSystem
TList * list
void AddStep(Double_t max, Double_t binwidth)
Double_t fFracPtHard
Cut on the maximum fraction of pt hard of any trigger jet.
AliEmcalTriggerOfflineSelection * fTriggerSelection
Offline trigger selection.
void CreateTProfile(const char *name, const char *title, int nbinsX, double xmin, double xmax, Option_t *opt="")
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
Bool_t IsPhysicalPrimary(const AliVParticle *const part, AliMCEvent *const mcevent)
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Helper class creating user defined custom binning.
void FillProfile(const char *name, double x, double y, double weight=1.)
const Double_t ptmin
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Bool_t PythiaInfoFromFile(const char *currFile, Float_t &fXsec, Float_t &fTrials, Int_t &pthard) const
Bool_t IsOfflineSelected(EmcalTriggerClass trgcls, const TClonesArray *const triggerpatches) const
Unit test class for charged particle distributions (MC case)
double GetEventWeight(const AliMCEvent *const event) const
void FillTrackHistos(const char *eventclass, Double_t weight, Double_t pt, Double_t eta, Double_t etacent, Double_t phi, Bool_t etacut, Bool_t inEmcal, Bool_t hasTRD, const char *pid)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TFile * file
Int_t nevents[nsamples]
Double_t fEtaSign
Sign of the eta distribution (swaps when beam directions swap): p-Pb: +1, Pb-p: -1.
Container class for histograms for the high- charged particle analysis.
Definition: THistManager.h:43
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235
virtual bool IsTrackAccepted(AliVTrack *const trk)=0
void SetMinimum(Double_t min)