AliPhysics  251aa1e (251aa1e)
 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 <array>
16 #include <iostream>
17 #include <memory>
18 
19 #include <TClonesArray.h>
20 #include <THashList.h>
21 #include <TH1.h>
22 #include <THistManager.h>
23 #include <TLinearBinning.h>
24 #include <TList.h>
25 #include <TPDGCode.h>
26 #include <TMath.h>
27 #include <TString.h>
28 
29 #include "AliAnalysisDataContainer.h"
30 #include "AliAnalysisManager.h"
31 #include "AliAnalysisUtils.h"
32 #include "AliAODMCHeader.h"
33 #include "AliAODInputHandler.h"
34 #include "AliAODMCParticle.h"
35 #include "AliAODTrack.h"
37 #include "AliEmcalList.h"
38 #include "AliEmcalTrackSelection.h"
40 #include "AliEMCALTriggerPatchInfo.h"
41 #include "AliEMCALGeometry.h"
42 #include "AliEMCALRecoUtils.h"
43 #include "AliESDEvent.h"
44 #include "AliESDtrack.h"
45 #include "AliGenPythiaEventHeader.h"
46 #include "AliInputEventHandler.h"
47 #include "AliMCEvent.h"
48 #include "AliOADBContainer.h"
49 #include "AliVEvent.h"
50 #include "AliVEventHandler.h"
51 #include "AliVVertex.h"
52 
55 
59 
60 namespace EMCalTriggerPtAnalysis {
61 
62 AliAnalysisTaskChargedParticlesRefMC::AliAnalysisTaskChargedParticlesRefMC():
64  fTrackCuts(nullptr),
65  fTriggerSelection(nullptr),
66  fHistos(nullptr),
67  fWeightHandler(nullptr),
68  fEventTriggers(),
69  fEventWeight(1.),
70  fYshift(0.465),
71  fEtaSign(1),
72  fEtaLabCut(-0.5, 0.5),
73  fEtaCmsCut(-2., 2.),
74  fPhiCut(0., TMath::TwoPi()),
75  fFracPtHard(-1),
76  fEnableSumw2(kFALSE),
77  fStudyPID(kFALSE),
78  fNameAcceptanceOADB()
79 {
80  SetCaloTriggerPatchInfoName("EmcalTriggers");
81  SetNeedEmcalGeom(true);
83 }
84 
86  AliAnalysisTaskEmcal(name, true),
87  fTrackCuts(nullptr),
88  fTriggerSelection(nullptr),
89  fHistos(nullptr),
90  fWeightHandler(nullptr),
91  fEventTriggers(),
92  fEventWeight(1.),
93  fYshift(0.465),
94  fEtaSign(1),
95  fEtaLabCut(-0.5, 0.5),
96  fEtaCmsCut(-2., 2.),
97  fPhiCut(0., TMath::TwoPi()),
98  fFracPtHard(-1),
99  fEnableSumw2(kFALSE),
100  fStudyPID(kFALSE),
101  fNameAcceptanceOADB()
102 {
103  SetCaloTriggerPatchInfoName("EmcalTriggers");
104  SetNeedEmcalGeom(true);
106 }
107 
109  //if(fTrackCuts) delete fTrackCuts;
110  if(fTriggerSelection) delete fTriggerSelection;
111  if(fHistos) delete fHistos;
112 }
113 
116 
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  TString optionstring = fEnableSumw2 ? "s" : "";
124 
125  fHistos->CreateTH1("hPtHard", "Pt of the hard interaction", 1000, 0., 500);
126  const std::array<TString,7> triggers = {"True", "MB", "EMC7", "EJ1", "EJ2", "EG1", "EG2"};
127  const std::array<TString,6> species = {"El", "Mu", "Pi", "Ka", "Pr", "Ot"};
128  for(const auto &trg : triggers){
129  fHistos->CreateTH1(Form("hEventCount%s", trg.Data()), Form("Event Counter for trigger class %s", trg.Data()), 1, 0.5, 1.5, optionstring);
130  fHistos->CreateTH1(Form("hVertexBefore%s", trg.Data()), Form("Vertex distribution before z-cut for trigger class %s", trg.Data()), 500, -50, 50, optionstring);
131  fHistos->CreateTH1(Form("hVertexAfter%s", trg.Data()), Form("Vertex distribution after z-cut for trigger class %s", trg.Data()), 100, -10, 10, optionstring);
132 
133  fHistos->CreateTH3(Form("hPtEtaPhiAll%s", trg.Data()), Form("p_{t}-#eta-#phi distribution of all accepted tracks for trigger %s; p_{t} (GeV/c); #eta; #phi", trg.Data()), newbinning, TLinearBinning(64, -0.8, 0.8), TLinearBinning(100, 0., 2*TMath::Pi()), optionstring);
134  fHistos->CreateTH3(Form("hPtEtaPhiEMCALAll%s", trg.Data()), Form("p_{t}-#eta-#phi distribution of all accepted tracks pointing to the EMCAL for trigger %s; p_{t} (GeV/c); #eta; #phi", trg.Data()), newbinning, TLinearBinning(64, -0.8, 0.8), TLinearBinning(100, 0., 2*TMath::Pi()), optionstring);
135  fHistos->CreateTH3(Form("hPtEtaPhiCent%s", trg.Data()), Form("p_{t}-#eta-#phi distribution of all accepted tracks for trigger %s; p_{t} (GeV/c); #eta; #phi", trg.Data()), newbinning, TLinearBinning(64, -0.8, 0.8), TLinearBinning(100, 0., 2*TMath::Pi()), optionstring);
136  fHistos->CreateTH3(Form("hPtEtaPhiEMCALCent%s", trg.Data()), Form("p_{t}-#eta-#phi distribution of all accepted tracks pointing to the EMCAL for trigger %s; p_{t} (GeV/c); #eta; #phi", trg.Data()), newbinning, TLinearBinning(64, -0.8, 0.8), TLinearBinning(100, 0., 2*TMath::Pi()), optionstring);
137 
138  if(fStudyPID){
139  for(const auto &pid : species){
140  fHistos->CreateTH3(Form("hPtEtaPhiAll%s%s", pid.Data(), trg.Data()), Form("p_{t}-#eta-#phi distribution of all accepted %s for trigger %s; p_{t} (GeV/c); #eta; #phi", pid.Data(), trg.Data()), newbinning, TLinearBinning(64, -0.8, 0.8), TLinearBinning(100, 0., 2*TMath::Pi()), optionstring);
141  fHistos->CreateTH3(Form("hPtEtaPhiEMCALAll%s%s", pid.Data(), trg.Data()), Form("p_{t}-#eta-#phi distribution of all accepted %s pointing to the EMCAL for trigger %s; p_{t} (GeV/c); #eta; #phi", pid.Data(), trg.Data()), newbinning, TLinearBinning(64, -0.8, 0.8), TLinearBinning(100, 0., 2*TMath::Pi()), optionstring);
142  fHistos->CreateTH3(Form("hPtEtaPhiCent%s%s", pid.Data(), trg.Data()), Form("p_{t}-#eta-#phi distribution of all accepted %s for trigger %s; p_{t} (GeV/c); #eta; #phi", pid.Data(), trg.Data()), newbinning, TLinearBinning(64, -0.8, 0.8), TLinearBinning(100, 0., 2*TMath::Pi()), optionstring);
143  fHistos->CreateTH3(Form("hPtEtaPhiEMCALCent%s%s", pid.Data(), trg.Data()), Form("p_{t}-#eta-#phi distribution of all accepted %s pointing to the EMCAL for trigger %s; p_{t} (GeV/c); #eta; #phi", pid.Data(), trg.Data()), newbinning, TLinearBinning(64, -0.8, 0.8), TLinearBinning(100, 0., 2*TMath::Pi()), optionstring);
144  }
145  }
146  }
147  //fHistos->GetListOfHistograms()->Add(fTrackCuts);
148  for(auto hist : *(fHistos->GetListOfHistograms())){
149  fOutput->Add(hist);
150  }
151 
152  PostData(1, fOutput);
153 }
154 
156  fEventTriggers.clear();
157  AliDebugStream(1) << GetName() << ": Using custom event selection" << std::endl;
158  if(!MCEvent()) return false;
159  if(!fTriggerPatchInfo) return false;
160  fEventWeight = fWeightHandler ? fWeightHandler->GetEventWeight(fPythiaHeader) : 1.;
161 
162  // Do MC outlier cut
163  if(fIsPythia){
164  if(!CheckMCOutliers()) return false;
165  }
166 
167 
168  // select trigger
169  bool isMinBias;
170  if((isMinBias = fInputHandler->IsEventSelected() & AliVEvent::kINT7)) fEventTriggers.push_back("MB");
171  // In simulations triggered events are a subset of min. bias events
172  if(fTriggerPatchInfo && fTriggerSelection){
173  if(isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEL0, fTriggerPatchInfo))
174  fEventTriggers.push_back("EMC7"); // triggerstring.Contains("EMC7"),
175  if(isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEJ1, fTriggerPatchInfo))
176  fEventTriggers.push_back("EJ1"); // triggerstring.Contains("EJ1"),
177  if(isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEJ2, fTriggerPatchInfo))
178  fEventTriggers.push_back("EJ2"); // triggerstring.Contains("EJ2"),
179  if(isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEG1, fTriggerPatchInfo))
180  fEventTriggers.push_back("EG1"); // triggerstring.Contains("EG1"),
181  if(isMinBias && fTriggerSelection->IsOfflineSelected(AliEmcalTriggerOfflineSelection::kTrgEG2, fTriggerPatchInfo))
182  fEventTriggers.push_back("EG2"); // triggerstring.Contains("EG2");
183  }
184  if(!fEventTriggers.size()){
185  AliDebugStream(1) << GetName() << ": No trigger selected" << std::endl;
186  }
187 
188  const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
189  if(vtx->GetNContributors() < 1) return false;
190  if(!fAliAnalysisUtils->IsVertexSelected2013pA(fInputEvent)) return false; // Apply new vertex cut
191  if(fAliAnalysisUtils->IsPileUpEvent(fInputEvent)) return false; // Apply new vertex cut
192  // Fill reference distribution for the primary vertex before any z-cut
193  fHistos->FillTH1("hVertexBeforeTrue", vtx->GetZ(), fEventWeight);
194  for(const auto &trg : fEventTriggers) fHistos->FillTH1(Form("hVertexBefore%s", trg.Data()), vtx->GetZ(), fEventWeight);
195  // Apply vertex z cut
196  if(vtx->GetZ() < -10. || vtx->GetZ() > 10.) return false;
197 
198 
199  // Fill Event counter and reference vertex distributions for the different trigger classes
200  fHistos->FillTH1("hEventCountTrue", 1, fEventWeight);
201  fHistos->FillTH1("hVertexAfterTrue", vtx->GetZ(), fEventWeight);
202  for(const auto &trg : fEventTriggers){
203  fHistos->FillTH1(Form("hEventCount%s", trg.Data()), 1, fEventWeight);
204  fHistos->FillTH1(Form("hVertexAfter%s", trg.Data()), vtx->GetZ(), fEventWeight);
205  }
206 
207  return true;
208 }
209 
212 
213  if(!fLocalInitialized) {
214  AliErrorStream() << GetName() << ": Failed initializing AliAnalysisTaskEmcal" << std::endl;
215  return;
216  }
217 
218  // Load acceptance OADB
219  if(fNameAcceptanceOADB.Length() && fTriggerSelection){
220  AliDebugStream(1) << GetName() << ": Loading acceptance map from OADB file " << fNameAcceptanceOADB << std::endl;
221  AliOADBContainer acceptanceCont("AliEmcalTriggerAcceptance");
222  acceptanceCont.InitFromFile(fNameAcceptanceOADB.Data(), "AliEmcalTriggerAcceptance");
223  TObjArray *acceptanceMaps = dynamic_cast<TObjArray *>(acceptanceCont.GetObject(fInputEvent->GetRunNumber()));
224  TH2 *map(nullptr);
225  if((map = dynamic_cast<TH2 *>(acceptanceMaps->FindObject("EG1")))){
226  AliDebugStream(1) << GetName() << ": Found acceptance map for trigger EG1" << std::endl;
227  map->SetDirectory(nullptr);
228  fTriggerSelection->SetAcceptanceMap(AliEmcalTriggerOfflineSelection::kTrgEG1, map);
229  }
230  if((map = dynamic_cast<TH2 *>(acceptanceMaps->FindObject("EG2")))){
231  AliDebugStream(1) << GetName() << ": Found acceptance map for trigger EG2" << std::endl;
232  map->SetDirectory(nullptr);
233  fTriggerSelection->SetAcceptanceMap(AliEmcalTriggerOfflineSelection::kTrgEG2, map);
234  }
235  if((map = dynamic_cast<TH2 *>(acceptanceMaps->FindObject("DG1")))){
236  AliDebugStream(1) << GetName() << ": Found acceptance map for trigger DG1" << std::endl;
237  map->SetDirectory(nullptr);
238  fTriggerSelection->SetAcceptanceMap(AliEmcalTriggerOfflineSelection::kTrgDG1, map);
239  }
240  if((map = dynamic_cast<TH2 *>(acceptanceMaps->FindObject("DG2")))){
241  AliDebugStream(1) << GetName() << ": Found acceptance map for trigger DG2" << std::endl;
242  map->SetDirectory(nullptr);
243  fTriggerSelection->SetAcceptanceMap(AliEmcalTriggerOfflineSelection::kTrgDG1, map);
244  }
245  if((map = dynamic_cast<TH2 *>(acceptanceMaps->FindObject("EJ1")))){
246  AliDebugStream(1) << GetName() << ": Found acceptance map for trigger EJ1" << std::endl;
247  map->SetDirectory(nullptr);
248  fTriggerSelection->SetAcceptanceMap(AliEmcalTriggerOfflineSelection::kTrgEJ1, map);
249  }
250  if((map = dynamic_cast<TH2 *>(acceptanceMaps->FindObject("EJ2")))){
251  AliDebugStream(1) << GetName() << ": Found acceptance map for trigger EJ2" << std::endl;
252  map->SetDirectory(nullptr);
253  fTriggerSelection->SetAcceptanceMap(AliEmcalTriggerOfflineSelection::kTrgEJ2, map);
254  }
255  if((map = dynamic_cast<TH2 *>(acceptanceMaps->FindObject("DJ1")))){
256  AliDebugStream(1) << GetName() << ": Found acceptance map for trigger DJ1" << std::endl;
257  map->SetDirectory(nullptr);
258  fTriggerSelection->SetAcceptanceMap(AliEmcalTriggerOfflineSelection::kTrgDJ1, map);
259  }
260  if((map = dynamic_cast<TH2 *>(acceptanceMaps->FindObject("DJ2")))){
261  AliDebugStream(1) << GetName() << ": Found acceptance map for trigger DJ2" << std::endl;
262  map->SetDirectory(nullptr);
263  fTriggerSelection->SetAcceptanceMap(AliEmcalTriggerOfflineSelection::kTrgDJ1, map);
264  }
265  }
266 }
267 
269  // MonteCarlo Loop
270  // Histograms
271  // - Full eta (-0.8, 0.8), new binning
272  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c without eta cut
273  // - Central eta_{cms} (-0.3, 0.3), new binning,
274  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c
275  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c with eta cut
276  AliVParticle *truepart = NULL;
277  Bool_t isEMCAL(kFALSE);
278  for(int ipart = 0; ipart < fMCEvent->GetNumberOfTracks(); ipart++){
279  truepart = fMCEvent->GetTrack(ipart);
280 
281  // Select only particles within ALICE acceptance
282  if(!fEtaLabCut.IsInRange(truepart->Eta())) continue;
283  if(!fPhiCut.IsInRange(truepart->Phi())) continue;
284  if(TMath::Abs(truepart->Pt()) < 0.1) continue;
285  if(!truepart->Charge()) continue;
286 
287  if(!IsPhysicalPrimary(truepart, fMCEvent)) continue;
288  isEMCAL = (truepart->Phi() > 1.5 && truepart->Phi() < 3.1) ? kTRUE : kFALSE;
289 
290  // Calculate eta in cms frame according
291  // EPJC74 (2014) 3054:
292  // eta_cms = - eta_lab - |yshift|
293  Double_t etacent = -1. * truepart->Eta() - TMath::Abs(fYshift);
294  etacent *= fEtaSign;
295 
296  if(!fEtaCmsCut.IsInRange(etacent)) continue; // Apply eta-cent cut
297 
298  // Get PID
299  TString pid = "";
300  if(fStudyPID){
301  switch(TMath::Abs(truepart->PdgCode())){
302  case kPiPlus: pid = "Pi"; break;
303  case kMuonMinus: pid = "Mu"; break;
304  case kElectron: pid = "El"; break;
305  case kKPlus: pid = "Ka"; break;
306  case kProton: pid = "Pr"; break;
307  default: pid = "Ot"; break;
308  };
309  }
310 
311  // Particle selected (do not filter TRD sectors for MC truth)
312  FillTrackHistos("True", fEventWeight, truepart->Pt(), truepart->Eta() * fEtaSign, etacent, truepart->Phi(), isEMCAL, pid);
313  }
314 
315  // Loop over tracks, fill select particles
316  // Histograms
317  // - Full eta (-0.8, 0.8), new binning
318  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c without eta cut
319  // - Central eta (-0.8, -0.2), new binning,
320  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c
321  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c with eta cut
322  AliVTrack *checktrack(NULL);
323  AliVParticle *assocMC(NULL);
324  double ptparticle(-1.), etaparticle(-100.), etaEMCAL(0.), phiEMCAL(0.);
325  Bool_t hasTRD = kFALSE;
326  for(int itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); ++itrk){
327  checktrack = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(itrk));
328  if(!checktrack) continue;
329  // Find associated particle
330  assocMC = fMCEvent->GetTrack(TMath::Abs(checktrack->GetLabel()));
331  if(!assocMC) continue; // Fake track
332  if(!IsPhysicalPrimary(assocMC, fMCEvent)) continue;
333 
334  // Select only particles within ALICE acceptance
335  if(!fEtaLabCut.IsInRange(checktrack->Eta())) continue;
336  if(!fPhiCut.IsInRange(checktrack->Phi())) continue;
337  if(TMath::Abs(checktrack->Pt()) < 0.1) continue;
338  if(checktrack->IsA() == AliESDtrack::Class()){
339  AliESDtrack copytrack(*(static_cast<AliESDtrack *>(checktrack)));
340  AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&copytrack);
341  etaEMCAL = copytrack.GetTrackEtaOnEMCal();
342  phiEMCAL = copytrack.GetTrackPhiOnEMCal();
343  } else {
344  AliAODTrack copytrack(*(static_cast<AliAODTrack *>(checktrack)));
345  AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&copytrack);
346  etaEMCAL = copytrack.GetTrackEtaOnEMCal();
347  phiEMCAL = copytrack.GetTrackPhiOnEMCal();
348  }
349  Int_t supermoduleID = -1;
350  isEMCAL = fGeom->SuperModuleNumberFromEtaPhi(etaEMCAL, phiEMCAL, supermoduleID);
351  // Exclude supermodules 10 and 11 as they did not participate in the trigger
352  isEMCAL = isEMCAL && supermoduleID < 10;
353  hasTRD = isEMCAL && supermoduleID >= 4; // supermodules 4 - 10 have TRD in front in the 2012-2013 ALICE setup
354 
355  if(!fTrackCuts->IsTrackAccepted(checktrack)) continue;
356 
357  ptparticle = TMath::Abs(assocMC->Pt());
358  etaparticle = assocMC->Eta();
359 
360  // Calculate eta in cms frame according
361  // EPJC74 (2014) 3054:
362  // eta_cms = - eta_lab - |yshift|
363  Double_t etacent = -1. * checktrack->Eta() - TMath::Abs(fYshift);
364  etacent *= fEtaSign;
365 
366  if(!fEtaCmsCut.IsInRange(etacent)) continue; // Apply eta-cent cut
367 
368  // Get PID
369  TString assocpid = "";
370  if(fStudyPID){
371  switch(TMath::Abs(assocMC->PdgCode())){
372  case kPiPlus: assocpid = "Pi"; break;
373  case kMuonMinus: assocpid = "Mu"; break;
374  case kElectron: assocpid = "El"; break;
375  case kKPlus: assocpid = "Ka"; break;
376  case kProton: assocpid = "Pr"; break;
377  default: assocpid = "Ot"; break;
378  };
379  }
380  for(const auto &trg : fEventTriggers)
381  FillTrackHistos(trg, fEventWeight, ptparticle, checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), isEMCAL, assocpid);
382  }
383  return true;
384 }
385 
386 void AliAnalysisTaskChargedParticlesRefMC::FillTrackHistos(
387  const TString &eventclass,
388  Double_t weight,
389  Double_t pt,
390  Double_t etalab,
391  Double_t etacent,
392  Double_t phi,
393  Bool_t inEmcal,
394  const TString &pid
395  )
396 {
397 
398  double kinepointall[3] = {TMath::Abs(pt), etalab, phi}, kinepointcent[3] = {TMath::Abs(pt), etacent, phi};
399  fHistos->FillTH3(Form("hPtEtaPhiAll%s", eventclass.Data()), kinepointall, weight);
400  fHistos->FillTH3(Form("hPtEtaPhiCent%s", eventclass.Data()), kinepointcent, weight);
401  fHistos->FillTH3(Form("hPtEtaPhiAll%s%s", pid.Data(), eventclass.Data()), kinepointall, weight);
402  fHistos->FillTH3(Form("hPtEtaPhiCent%s%s", pid.Data(), eventclass.Data()), kinepointcent, weight);
403 
404  if(inEmcal){
405  fHistos->FillTH3(Form("hPtEtaPhiEMCALAll%s", eventclass.Data()), kinepointall, weight);
406  fHistos->FillTH3(Form("hPtEtaPhiEMCALCent%s", eventclass.Data()), kinepointall, weight);
407  fHistos->FillTH3(Form("hPtEtaPhiEMCALAll%s%s", pid.Data(), eventclass.Data()), kinepointall, weight);
408  fHistos->FillTH3(Form("hPtEtaPhiEMCALCent%s%s", pid.Data(), eventclass.Data()), kinepointall, weight);
409  }
410 }
411 
412 
415 }
416 
417 
418 
419 TString AliAnalysisTaskChargedParticlesRefMC::GetFiredTriggerClasses(const TClonesArray* triggerpatches) {
420  TString triggerstring = "";
421  Int_t nEJ1 = 0, nEJ2 = 0, nEG1 = 0, nEG2 = 0;
422  double minADC_EJ1 = 260.,
423  minADC_EJ2 = 127.,
424  minADC_EG1 = 140.,
425  minADC_EG2 = 89.;
426  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
427  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(*patchIter);
428  if(!patch->IsOfflineSimple()) continue;
429  if(patch->IsJetHighSimple() && patch->GetADCOfflineAmp() > minADC_EJ1) nEJ1++;
430  if(patch->IsJetLowSimple() && patch->GetADCOfflineAmp() > minADC_EJ2) nEJ2++;
431  if(patch->IsGammaHighSimple() && patch->GetADCOfflineAmp() > minADC_EG1) nEG1++;
432  if(patch->IsGammaLowSimple() && patch->GetADCOfflineAmp() > minADC_EG2) nEG2++;
433  }
434  if(nEJ1) triggerstring += "EJ1";
435  if(nEJ2){
436  if(triggerstring.Length()) triggerstring += ",";
437  triggerstring += "EJ2";
438  }
439  if(nEG1){
440  if(triggerstring.Length()) triggerstring += ",";
441  triggerstring += "EG1";
442  }
443  if(nEG2){
444  if(triggerstring.Length()) triggerstring += ",";
445  triggerstring += "EG2";
446  }
447  return triggerstring;
448 }
449 
450 Bool_t AliAnalysisTaskChargedParticlesRefMC::IsPhysicalPrimary(const AliVParticle* const part, AliMCEvent* const mcevent) {
451  Bool_t physprim = false;
452  const AliAODMCParticle *aodmc = dynamic_cast<const AliAODMCParticle *>(part);
453  if(aodmc){
454  physprim = aodmc->IsPhysicalPrimary();
455  } else {
456  physprim = mcevent->IsPhysicalPrimary(part->GetLabel());
457  }
458  return physprim;
459 }
460 
462  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
463 
464  TString taskname = "chargedParticleMCQA_" + name;
465 
467  task->SetJetPtFactor(4.);
468  task->SetTrackPtFactor(1.5);
469  mgr->AddTask(task);
470 
471  TString outfile(mgr->GetCommonFileName());
472  outfile += ":ChargedParticleQA_" + name;
473 
474  task->ConnectInput(0, mgr->GetCommonInputContainer());
475  mgr->ConnectOutput(task, 1, mgr->CreateContainer(Form("TrackResults_%s", name.Data()), AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
476 
477  return task;
478 }
479 
481  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
482 
483  AliAnalysisTaskChargedParticlesRefMC *task = new AliAnalysisTaskChargedParticlesRefMC(Form("chargedParticleMCQA_%s", cutname.Data()));
484  task->SetJetPtFactor(4.);
485  task->SetTrackPtFactor(1.5);
486  // Set Energy thresholds for additional patch selection:
487  // These are events with offline patches of a given type where the trigger reached already the plateau
488  // These numers are determined as:
489  // EMC7: 5 GeV
490  // EG1: 14 GeV
491  // EG2: 8 GeV
492  // EJ1: 22 GeV
493  // EJ2: 12 GeV
494  mgr->AddTask(task);
497  );
498  task->SetTrackSelection(
500  cutname,
501  mgr->GetInputEventHandler()->IsA() == AliAODInputHandler::Class()
502  )
503  );
504 
505  TString outfile(mgr->GetCommonFileName());
506  outfile += ":ChargedParticleQA" + cutname;
507 
508  task->ConnectInput(0, mgr->GetCommonInputContainer());
509  mgr->ConnectOutput(task, 1, mgr->CreateContainer(Form("TrackResults_%s", cutname.Data()), TList::Class(), AliAnalysisManager::kOutputContainer, outfile.Data()));
510 
511  return task;
512 }
513 
517 AliAnalysisTaskChargedParticlesRefMC::PtBinning::PtBinning() :
519 {
520  this->SetMinimum(0.);
521  this->AddStep(1, 0.05);
522  this->AddStep(2, 0.1);
523  this->AddStep(4, 0.2);
524  this->AddStep(7, 0.5);
525  this->AddStep(16, 1);
526  this->AddStep(36, 2);
527  this->AddStep(40, 4);
528  this->AddStep(50, 5);
529  this->AddStep(100, 10);
530  this->AddStep(200, 20);
531 }
532 
533 } /* namespace EMCalTriggerPtAnalysis */
void SetJetPtFactor(Float_t f)
void SetTrackPtFactor(Float_t f)
Bool_t fIsPythia
trigger, if it is a PYTHIA production
double Double_t
Definition: External.C:58
Class creating a linear binning, used in the histogram manager.
static AliEmcalTrackSelection * TrackCutsFactory(TString name, Bool_t isAOD)
Base task in the EMCAL framework.
Bool_t fLocalInitialized
whether or not the task has been already initialized
void SetCaloTriggerPatchInfoName(const char *n)
int Int_t
Definition: External.C:63
AliEMCALGeometry * fGeom
!emcal geometry
static AliAnalysisTaskChargedParticlesRefMC * AddTaskChargedParticlesRefMCDefault(const TString &cutname="standard")
AliGenPythiaEventHeader * fPythiaHeader
!event Pythia header
AliAnalysisUtils * fAliAnalysisUtils
!vertex selection (optional)
Helper class creating user defined custom binning.
Test class for charged particle distributions (MC case)
virtual Bool_t IsEventSelected()
AliEmcalList * fOutput
!output list
Definition: External.C:220
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
void SetMakeGeneralHistograms(Bool_t g)
TClonesArray * fTriggerPatchInfo
!trigger patch info array
void SetNeedEmcalGeom(Bool_t n)
Container class for histograms.
Definition: THistManager.h:43
bool Bool_t
Definition: External.C:53
static AliEmcalTriggerOfflineSelection * TriggerSelectionFactory(Double_t el0, Double_t eg1, Double_t eg2, Double_t ej1, Double_t ej2)
static AliAnalysisTaskChargedParticlesRefMC * AddTaskChargedParticlesRefMC(const TString &suffix)