AliPhysics  b095172 (b095172)
 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 <iostream>
16 #include <memory>
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():
67  fTrackCuts(nullptr),
68  fTriggerSelection(nullptr),
69  fHistos(nullptr),
70  fWeightHandler(nullptr),
71  fEventTriggers(),
72  fEventWeight(1.),
73  fYshift(0.465),
74  fEtaSign(1),
75  fEtaLabCut(-0.6, 0.6),
76  fEtaCmsCut(-0.13, 0.13),
77  fFracPtHard(-1)
78 {
79  SetCaloTriggerPatchInfoName("EmcalTriggers");
80  SetNeedEmcalGeom(true);
81 }
82 
88  AliAnalysisTaskEmcal(name, true),
89  fTrackCuts(nullptr),
90  fTriggerSelection(nullptr),
91  fHistos(nullptr),
92  fWeightHandler(nullptr),
93  fEventTriggers(),
94  fEventWeight(1.),
95  fYshift(0.465),
96  fEtaSign(1),
97  fEtaLabCut(-0.6, 0.6),
98  fEtaCmsCut(-0.13, 0.13),
99  fFracPtHard(-1)
100 {
101  SetCaloTriggerPatchInfoName("EmcalTriggers");
102  SetNeedEmcalGeom(true);
103 }
104 
109  //if(fTrackCuts) delete fTrackCuts;
111  if(fHistos) delete fHistos;
112 }
117  if(!fAliAnalysisUtils) fAliAnalysisUtils = new AliAnalysisUtils;
118  fHistos = new THistManager("Ref");
119 
120  if(!fTrackCuts) InitializeTrackCuts("standard",fInputHandler->IsA() == AliAODInputHandler::Class());
121 
122  PtBinning newbinning;
123 
124  fHistos->CreateTH1("hPtHard", "Pt of the hard interaction", 1000, 0., 500);
125  TString triggers[7] = {"True", "MB", "EMC7", "EJ1", "EJ2", "EG1", "EG2"};
126  Double_t ptcuts[5] = {1., 2., 5., 10., 20.};
127  TString species[6] = {"El", "Mu", "Pi", "Ka", "Pr", "Ot"};
128  for(TString *trg = triggers; trg < triggers + sizeof(triggers)/sizeof(TString); trg++){
129  fHistos->CreateTH1(Form("hEventCount%s", trg->Data()), Form("Event Counter for trigger class %s", trg->Data()), 1, 0.5, 1.5);
130  fHistos->CreateTH1(Form("hVertexBefore%s", trg->Data()), Form("Vertex distribution before z-cut for trigger class %s", trg->Data()), 500, -50, 50);
131  fHistos->CreateTH1(Form("hVertexAfter%s", trg->Data()), Form("Vertex distribution after z-cut for trigger class %s", trg->Data()), 100, -10, 10);
132  fHistos->CreateTH1(Form("hPtEtaAll%s", trg->Data()), Form("Charged particle pt distribution all eta trigger %s", trg->Data()), newbinning);
133  fHistos->CreateTH1(Form("hPtEtaCent%s", trg->Data()), Form("Charged particle pt distribution central eta trigger %s", trg->Data()), newbinning);
134  fHistos->CreateTH1(Form("hPtEMCALEtaAll%s", trg->Data()), Form("Charged particle in EMCAL pt distribution all eta trigger %s", trg->Data()), newbinning);
135  fHistos->CreateTH1(Form("hPtEMCALEtaCent%s", trg->Data()), Form("Charged particle in EMCAL pt distribution central eta trigger %s", trg->Data()), newbinning);
136  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaAll%s", trg->Data()), Form("Charged particle in EMCAL (no TRD in front) pt distribution all eta trigger %s", trg->Data()), newbinning);
137  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaCent%s", trg->Data()), Form("Charged particle in EMCAL (no TRD in front) pt distribution central eta trigger %s", trg->Data()), newbinning);
138  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaAll%s", trg->Data()), Form("Charged particle in EMCAL (with TRD in front) pt distribution all eta trigger %s", trg->Data()), newbinning);
139  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaCent%s", trg->Data()), Form("Charged particle in EMCAL (with TRD in front) pt distribution central eta trigger %s", trg->Data()), newbinning);
140  for(TString *piditer = species; piditer < species + sizeof(species)/sizeof(TString); ++piditer){
141  fHistos->CreateTH1(Form("hPtEtaAll%s%s", piditer->Data(), trg->Data()), Form("Charged %s pt distribution all eta trigger %s", piditer->Data(), trg->Data()), newbinning);
142  fHistos->CreateTH1(Form("hPtEtaCent%s%s", piditer->Data(), trg->Data()), Form("Charged %s pt distribution central eta trigger %s", piditer->Data(), trg->Data()), newbinning);
143  fHistos->CreateTH1(Form("hPtEMCALEtaAll%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL pt distribution all eta trigger %s", piditer->Data(), trg->Data()), newbinning);
144  fHistos->CreateTH1(Form("hPtEMCALEtaCent%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL pt distribution central eta trigger %s", piditer->Data(), trg->Data()), newbinning);
145  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaAll%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (no TRD in front) pt distribution all eta trigger %s", piditer->Data(), trg->Data()), newbinning);
146  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaCent%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (no TRD in front) pt distribution central eta trigger %s", piditer->Data(), trg->Data()), newbinning);
147  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaAll%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (with TRD in front) pt distribution all eta trigger %s", piditer->Data(), trg->Data()), newbinning);
148  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaCent%s%s", piditer->Data(), trg->Data()), Form("Charged %s in EMCAL (with TRD in front) pt distribution central eta trigger %s", piditer->Data(), trg->Data()), newbinning);
149  }
150  for(int ipt = 0; ipt < 5; ipt++){
152  Form("hEtaLabDistAllPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
153  Form("Eta (lab) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
154  100,
155  -1.,
156  1.
157  );
159  Form("hEtaLabDistCutPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
160  Form("Eta (lab) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
161  100,
162  -1.,
163  1.
164  );
166  Form("hEtaCentDistAllPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
167  Form("Eta (cent) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
168  160,
169  -1.3,
170  1.3
171  );
173  Form("hEtaCentDistCutPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
174  Form("Eta (cent) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
175  160,
176  -1.3,
177  1.3
178  );
180  Form("hEtaLabDistAllEMCALPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
181  Form("Eta (lab) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
182  100,
183  -1.,
184  1.
185  );
187  Form("hEtaLabDistCutEMCALPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
188  Form("Eta (lab) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
189  100,
190  -1.,
191  1.
192  );
194  Form("hEtaCentDistAllEMCALPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
195  Form("Eta (cent) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
196  160,
197  -1.3,
198  1.3
199  );
201  Form("hEtaCentDistCutEMCALPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
202  Form("Eta (cent) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
203  160,
204  -1.3,
205  1.3
206  );
208  Form("hPhiDistAllPt%d%s", static_cast<Int_t>(ptcuts[ipt]), trg->Data()),
209  Form("#phi distribution of particles with Pt above %.1f GeV/c trigger %s", ptcuts[ipt], trg->Data()),
210  300,
211  0.,
212  2*TMath::Pi()
213  );
214  }
215  }
216  //fHistos->GetListOfHistograms()->Add(fTrackCuts);
217  for(auto hist : *(fHistos->GetListOfHistograms())){
218  fOutput->Add(hist);
219  }
220 }
221 
223  AliDebugStream(1) << GetName() << ": Using custom event selection" << std::endl;
224  if(!MCEvent()) return false;
225  if(!fTriggerPatchInfo) return false;
227 
228  // Do MC outlier cut
229  if(fIsPythia){
230  if(!CheckMCOutliers()) return false;
231  }
232 
233 
234  // select trigger
235  fEventTriggers.clear();
236  bool isMinBias;
237  if((isMinBias = fInputHandler->IsEventSelected() & AliVEvent::kINT7)) fEventTriggers.push_back("MB");
238  // In simulations triggered events are a subset of min. bias events
241  fEventTriggers.push_back("EMC7"); // triggerstring.Contains("EMC7"),
243  fEventTriggers.push_back("EJ1"); // triggerstring.Contains("EJ1"),
245  fEventTriggers.push_back("EJ2"); // triggerstring.Contains("EJ2"),
247  fEventTriggers.push_back("EG1"); // triggerstring.Contains("EG1"),
249  fEventTriggers.push_back("EG2"); // triggerstring.Contains("EG2");
250  }
251  if(!fEventTriggers.size()){
252  AliDebugStream(1) << GetName() << ": No trigger selected" << std::endl;
253  }
254 
255  const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
256  if(vtx->GetNContributors() < 1) return false;
257  if(!fAliAnalysisUtils->IsVertexSelected2013pA(fInputEvent)) return false; // Apply new vertex cut
258  if(fAliAnalysisUtils->IsPileUpEvent(fInputEvent)) return false; // Apply new vertex cut
259  // Fill reference distribution for the primary vertex before any z-cut
260  fHistos->FillTH1("hVertexBeforeTrue", vtx->GetZ(), fEventWeight);
261  for(const auto &trg : fEventTriggers) fHistos->FillTH1(Form("hVertexBefore%s", trg.c_str()), vtx->GetZ(), fEventWeight);
262  // Apply vertex z cut
263  if(vtx->GetZ() < -10. || vtx->GetZ() > 10.) return false;
264 
265 
266  // Fill Event counter and reference vertex distributions for the different trigger classes
267  fHistos->FillTH1("hEventCountTrue", 1, fEventWeight);
268  fHistos->FillTH1("hVertexAfterTrue", vtx->GetZ(), fEventWeight);
269  for(const auto &trg : fEventTriggers){
270  fHistos->FillTH1(Form("hEventCount%s", trg.c_str()), 1, fEventWeight);
271  fHistos->FillTH1(Form("hVertexAfter%s", trg.c_str()), vtx->GetZ(), fEventWeight);
272  }
273 
274  return true;
275 }
276 
278 
279  // MonteCarlo Loop
280  // Histograms
281  // - Full eta (-0.8, 0.8), new binning
282  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c without eta cut
283  // - Central eta_{cms} (-0.3, 0.3), new binning,
284  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c
285  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c with eta cut
286  AliVParticle *truepart = NULL;
287  Bool_t isEMCAL(kFALSE);
288  for(int ipart = 0; ipart < fMCEvent->GetNumberOfTracks(); ipart++){
289  truepart = fMCEvent->GetTrack(ipart);
290 
291  // Select only particles within ALICE acceptance
292  if(!fEtaLabCut.IsInRange(truepart->Eta())) continue;
293  if(TMath::Abs(truepart->Pt()) < 0.1) continue;
294  if(!truepart->Charge()) continue;
295 
296  if(!IsPhysicalPrimary(truepart, fMCEvent)) continue;
297  isEMCAL = (truepart->Phi() > 1.5 && truepart->Phi() < 3.1) ? kTRUE : kFALSE;
298 
299  // Calculate eta in cms frame according
300  // EPJC74 (2014) 3054:
301  // eta_cms = - eta_lab - |yshift|
302  Double_t etacent = -1. * truepart->Eta() - TMath::Abs(fYshift);
303  etacent *= fEtaSign;
304 
305  Bool_t etacentcut = fEtaCmsCut.IsInRange(etacent);
306 
307  // Get PID
308  TString pid = "";
309  switch(TMath::Abs(truepart->PdgCode())){
310  case kPiPlus: pid = "Pi"; break;
311  case kMuonMinus: pid = "Mu"; break;
312  case kElectron: pid = "El"; break;
313  case kKPlus: pid = "Ka"; break;
314  case kProton: pid = "Pr"; break;
315  default: pid = "Ot"; break;
316  };
317 
318  // Particle selected (do not filter TRD sectors for MC truth)
319  FillTrackHistos("True", fEventWeight, truepart->Pt(), truepart->Eta() * fEtaSign, etacent, truepart->Phi(), etacentcut, isEMCAL, kFALSE, pid);
320  }
321 
322  // Loop over tracks, fill select particles
323  // Histograms
324  // - Full eta (-0.8, 0.8), new binning
325  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c without eta cut
326  // - Central eta (-0.8, -0.2), new binning,
327  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c
328  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c with eta cut
329  AliVTrack *checktrack(NULL);
330  AliVParticle *assocMC(NULL);
331  double ptparticle(-1.), etaparticle(-100.), etaEMCAL(0.), phiEMCAL(0.);
332  Bool_t hasTRD = kFALSE;
333  for(int itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); ++itrk){
334  checktrack = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(itrk));
335  if(!checktrack) continue;
336  // Find associated particle
337  assocMC = fMCEvent->GetTrack(TMath::Abs(checktrack->GetLabel()));
338  if(!assocMC) continue; // Fake track
339  if(!IsPhysicalPrimary(assocMC, fMCEvent)) continue;
340 
341  // Select only particles within ALICE acceptance
342  if(!fEtaLabCut.IsInRange(checktrack->Eta())) continue;
343  if(TMath::Abs(checktrack->Pt()) < 0.1) continue;
344  if(checktrack->IsA() == AliESDtrack::Class()){
345  AliESDtrack copytrack(*(static_cast<AliESDtrack *>(checktrack)));
346  AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&copytrack);
347  etaEMCAL = copytrack.GetTrackEtaOnEMCal();
348  phiEMCAL = copytrack.GetTrackPhiOnEMCal();
349  } else {
350  AliAODTrack copytrack(*(static_cast<AliAODTrack *>(checktrack)));
351  AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&copytrack);
352  etaEMCAL = copytrack.GetTrackEtaOnEMCal();
353  phiEMCAL = copytrack.GetTrackPhiOnEMCal();
354  }
355  Int_t supermoduleID = -1;
356  isEMCAL = fGeom->SuperModuleNumberFromEtaPhi(etaEMCAL, phiEMCAL, supermoduleID);
357  // Exclude supermodules 10 and 11 as they did not participate in the trigger
358  isEMCAL = isEMCAL && supermoduleID < 10;
359  hasTRD = isEMCAL && supermoduleID >= 4; // supermodules 4 - 10 have TRD in front in the 2012-2013 ALICE setup
360 
361  if(!fTrackCuts->IsTrackAccepted(checktrack)) continue;
362 
363  ptparticle = TMath::Abs(assocMC->Pt());
364  etaparticle = assocMC->Eta();
365 
366  // Calculate eta in cms frame according
367  // EPJC74 (2014) 3054:
368  // eta_cms = - eta_lab - |yshift|
369  Double_t etacent = -1. * checktrack->Eta() - TMath::Abs(fYshift);
370  etacent *= fEtaSign;
371 
372  Bool_t etacentcut = fEtaCmsCut.IsInRange(etacent);
373 
374  // Get PID
375  TString assocpid = "";
376  switch(TMath::Abs(assocMC->PdgCode())){
377  case kPiPlus: assocpid = "Pi"; break;
378  case kMuonMinus: assocpid = "Mu"; break;
379  case kElectron: assocpid = "El"; break;
380  case kKPlus: assocpid = "Ka"; break;
381  case kProton: assocpid = "Pr"; break;
382  default: assocpid = "Ot"; break;
383  };
384  for(const auto &trg : fEventTriggers)
385  FillTrackHistos(trg.c_str(), fEventWeight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD, assocpid);
386  }
387  return true;
388 }
389 
402  const char *eventclass,
403  Double_t weight,
404  Double_t pt,
405  Double_t etalab,
406  Double_t etacent,
407  Double_t phi,
408  Bool_t etacut,
409  Bool_t inEmcal,
410  Bool_t hasTRD,
411  const char *pid
412  )
413 {
414  fHistos->FillTH1(Form("hPtEtaAll%s", eventclass), TMath::Abs(pt), weight);
415  fHistos->FillTH1(Form("hPtEtaAll%s%s", pid, eventclass), TMath::Abs(pt), weight);
416  if(inEmcal){
417  fHistos->FillTH1(Form("hPtEMCALEtaAll%s", eventclass), TMath::Abs(pt), weight);
418  fHistos->FillTH1(Form("hPtEMCALEtaAll%s%s", pid, eventclass), TMath::Abs(pt), weight);
419  if(hasTRD){
420  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaAll%s", eventclass), TMath::Abs(pt), weight);
421  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaAll%s%s", pid, eventclass), TMath::Abs(pt), weight);
422  } else {
423  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaAll%s", eventclass), TMath::Abs(pt), weight);
424  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaAll%s%s", pid, eventclass), TMath::Abs(pt), weight);
425  }
426  }
427 
428  int ptmin[5] = {1,2,5,10,20}; // for eta distributions
429  for(int icut = 0; icut < 5; icut++){
430  if(TMath::Abs(pt) > static_cast<double>(ptmin[icut])){
431  fHistos->FillTH1(Form("hPhiDistAllPt%d%s", ptmin[icut], eventclass), phi, weight);
432  fHistos->FillTH1(Form("hEtaLabDistAllPt%d%s", ptmin[icut], eventclass), etalab, weight);
433  fHistos->FillTH1(Form("hEtaCentDistAllPt%d%s", ptmin[icut], eventclass), etacent, weight);
434  if(inEmcal){
435  fHistos->FillTH1(Form("hEtaLabDistAllEMCALPt%d%s", ptmin[icut], eventclass), etalab, weight);
436  fHistos->FillTH1(Form("hEtaCentDistAllEMCALPt%d%s", ptmin[icut], eventclass), etacent, weight);
437  }
438  }
439  }
440 
441  if(etacut){
442  fHistos->FillTH1(Form("hPtEtaCent%s", eventclass), TMath::Abs(pt), weight);
443  fHistos->FillTH1(Form("hPtEtaCent%s%s", pid, eventclass), TMath::Abs(pt), weight);
444  if(inEmcal){
445  fHistos->FillTH1(Form("hPtEMCALEtaCent%s", eventclass), TMath::Abs(pt), weight);
446  fHistos->FillTH1(Form("hPtEMCALEtaCent%s%s", pid, eventclass), TMath::Abs(pt), weight);
447  if(hasTRD){
448  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaCent%s", eventclass), TMath::Abs(pt), weight);
449  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaCent%s%s", pid, eventclass), TMath::Abs(pt), weight);
450  } else {
451  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaCent%s", eventclass), TMath::Abs(pt), weight);
452  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaCent%s%s", pid, eventclass), TMath::Abs(pt), weight);
453  }
454  }
455  for(int icut = 0; icut < 5; icut++){
456  if(TMath::Abs(pt) > static_cast<double>(ptmin[icut])){
457  fHistos->FillTH1(Form("hEtaLabDistCutPt%d%s", ptmin[icut], eventclass), etalab, weight);
458  fHistos->FillTH1(Form("hEtaCentDistCutPt%d%s", ptmin[icut], eventclass), etacent, weight);
459  if(inEmcal){
460  fHistos->FillTH1(Form("hEtaLabDistCutEMCALPt%d%s", ptmin[icut], eventclass), etalab, weight);
461  fHistos->FillTH1(Form("hEtaCentDistCutEMCALPt%d%s", ptmin[icut], eventclass), etacent, weight);
462  }
463  }
464  }
465  }
466 }
467 
468 
476 }
477 
478 
479 
486  TString triggerstring = "";
487  Int_t nEJ1 = 0, nEJ2 = 0, nEG1 = 0, nEG2 = 0;
488  double minADC_EJ1 = 260.,
489  minADC_EJ2 = 127.,
490  minADC_EG1 = 140.,
491  minADC_EG2 = 89.;
492  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
493  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(*patchIter);
494  if(!patch->IsOfflineSimple()) continue;
495  if(patch->IsJetHighSimple() && patch->GetADCOfflineAmp() > minADC_EJ1) nEJ1++;
496  if(patch->IsJetLowSimple() && patch->GetADCOfflineAmp() > minADC_EJ2) nEJ2++;
497  if(patch->IsGammaHighSimple() && patch->GetADCOfflineAmp() > minADC_EG1) nEG1++;
498  if(patch->IsGammaLowSimple() && patch->GetADCOfflineAmp() > minADC_EG2) nEG2++;
499  }
500  if(nEJ1) triggerstring += "EJ1";
501  if(nEJ2){
502  if(triggerstring.Length()) triggerstring += ",";
503  triggerstring += "EJ2";
504  }
505  if(nEG1){
506  if(triggerstring.Length()) triggerstring += ",";
507  triggerstring += "EG1";
508  }
509  if(nEG2){
510  if(triggerstring.Length()) triggerstring += ",";
511  triggerstring += "EG2";
512  }
513  return triggerstring;
514 }
515 
524 Bool_t AliAnalysisTaskChargedParticlesRefMC::IsPhysicalPrimary(const AliVParticle* const part, AliMCEvent* const mcevent) {
525  Bool_t physprim = false;
526  const AliAODMCParticle *aodmc = dynamic_cast<const AliAODMCParticle *>(part);
527  if(aodmc){
528  physprim = aodmc->IsPhysicalPrimary();
529  } else {
530  physprim = mcevent->IsPhysicalPrimary(part->GetLabel());
531  }
532  return physprim;
533 }
534 
540 {
541  this->SetMinimum(0.);
542  this->AddStep(1, 0.05);
543  this->AddStep(2, 0.1);
544  this->AddStep(4, 0.2);
545  this->AddStep(7, 0.5);
546  this->AddStep(16, 1);
547  this->AddStep(36, 2);
548  this->AddStep(40, 4);
549  this->AddStep(50, 5);
550  this->AddStep(100, 10);
551  this->AddStep(200, 20);
552 }
553 
554 } /* namespace EMCalTriggerPtAnalysis */
const AliEMCalTriggerWeightHandler * fWeightHandler
Weight handler (optional)
Bool_t fIsPythia
trigger, if it is a PYTHIA production
double Double_t
Definition: External.C:58
std::vector< std::string > fEventTriggers
! Temporary container for selected triggers
AliCutValueRange< double > fEtaLabCut
Cut applied in Eta Lab frame.
static AliEmcalTrackSelection * TrackCutsFactory(TString name, Bool_t isAOD)
Base task in the EMCAL framework.
void AddStep(Double_t max, Double_t binwidth)
void SetCaloTriggerPatchInfoName(const char *n)
AliCutValueRange< double > fEtaCmsCut
Cut applied in Eta centre-of-mass frame.
AliEmcalTriggerOfflineSelection * fTriggerSelection
Offline trigger selection.
int Int_t
Definition: External.C:63
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
AliEMCALGeometry * fGeom
!emcal geometry
Bool_t IsPhysicalPrimary(const AliVParticle *const part, AliMCEvent *const mcevent)
AliGenPythiaEventHeader * fPythiaHeader
!event Pythia header
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
AliAnalysisUtils * fAliAnalysisUtils
!vertex selection (optional)
Helper class creating user defined custom binning.
const Double_t ptmin
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
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
AliEmcalList * fOutput
!output list
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
TClonesArray * fTriggerPatchInfo
!trigger patch info array
void SetNeedEmcalGeom(Bool_t n)
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
bool Bool_t
Definition: External.C:53
virtual bool IsTrackAccepted(AliVTrack *const trk)=0
void SetMinimum(Double_t min)