AliPhysics  2c8507d (2c8507d)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskChargedParticlesRef.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 <vector>
18 #include <map>
19 
20 #include <TArrayD.h>
21 #include <TMath.h>
22 #include <TGrid.h>
23 #include <THashList.h>
24 #include <THistManager.h>
25 #include <TLinearBinning.h>
26 #include <TObjArray.h>
27 #include <TParameter.h>
28 
29 #include "AliAnalysisUtils.h"
30 #include "AliAODInputHandler.h"
31 #include "AliAODTrack.h"
33 #include "AliEMCALGeometry.h"
34 #include "AliEMCALRecoUtils.h"
35 #include "AliEMCALTriggerPatchInfo.h"
36 #include "AliEmcalTrackSelection.h"
38 #include "AliESDtrackCuts.h"
39 #include "AliESDEvent.h"
40 #include "AliInputEventHandler.h"
41 #include "AliOADBContainer.h"
42 #include "AliPIDResponse.h"
43 #include "AliTOFPIDResponse.h"
44 #include "AliVVertex.h"
45 
48 
52 
53 namespace EMCalTriggerPtAnalysis {
54 
58 AliAnalysisTaskChargedParticlesRef::AliAnalysisTaskChargedParticlesRef() :
60  fTrackCuts(nullptr),
61  fAnalysisUtil(nullptr),
62  fTriggerSelection(nullptr),
63  fHistos(nullptr),
64  fGeometry(nullptr),
65  fTriggerPatches(nullptr),
66  fTriggerStringFromPatches(kFALSE),
67  fYshift(0.465),
68  fEtaSign(1),
69  fKineCorrelation(false),
70  fStudyPID(false),
71  fNameDownscaleOADB(""),
72  fDownscaleOADB(nullptr),
73  fDownscaleFactors(nullptr),
74  fCurrentRun(-1),
75  fInitialized(false)
76 {
77  // Restrict analysis to the EMCAL acceptance
78  fEtaLabCut[0] = -0.6;
79  fEtaLabCut[1] = 0.6;
80  fEtaCmsCut[0] = -0.13;
81  fEtaCmsCut[1] = 0.13;
82 }
83 
89  AliAnalysisTaskSE(name),
90  fTrackCuts(nullptr),
91  fAnalysisUtil(nullptr),
92  fTriggerSelection(nullptr),
93  fHistos(nullptr),
94  fGeometry(nullptr),
95  fTriggerPatches(nullptr),
96  fTriggerStringFromPatches(kFALSE),
97  fYshift(0.465),
98  fEtaSign(1),
99  fKineCorrelation(false),
100  fStudyPID(false),
101  fNameDownscaleOADB(""),
102  fDownscaleOADB(nullptr),
103  fDownscaleFactors(nullptr),
104  fCurrentRun(-1),
105  fInitialized(false)
106 {
107  // Restrict analysis to the EMCAL acceptance
108  fEtaLabCut[0] = -0.6;
109  fEtaLabCut[1] = 0.6;
110  fEtaCmsCut[0] = -0.13;
111  fEtaCmsCut[1] = 0.13;
112  DefineOutput(1, TList::Class());
113 }
114 
119  //if(fTrackCuts) delete fTrackCuts;
120  if(fAnalysisUtil) delete fAnalysisUtil;
122  if(fHistos) delete fHistos;
123  if(fDownscaleOADB) delete fDownscaleOADB;
124 }
125 
130  fAnalysisUtil = new AliAnalysisUtils;
131 
132  if(!fTrackCuts) InitializeTrackCuts("standard", fInputHandler->IsA() == AliAODInputHandler::Class());
133 
134  NewPtBinning newbinning;
135 
136  fHistos = new THistManager("Ref");
137  // Exclusive means classes without lower trigger classes (which are downscaled) - in order to make samples statistically independent:
138  // MBExcl means MinBias && !EMCAL trigger
139  std::array<TString, 11> triggers = {
140  "MB", "EMC7",
141  "EJ1", "EJ2", "EG1", "EG2",
142  "EMC7excl", "EG1excl", "EG2excl", "EJ1excl", "EJ2excl"
143  };
144  std::array<Double_t, 5> ptcuts = {1., 2., 5., 10., 20.};
145  // Binning for the PID histogram
146  const int kdimPID = 3;
147  const int knbinsPID[kdimPID] = {1000, 200, 300};
148  const double kminPID[kdimPID] = {-100., 0., 0.}, kmaxPID[kdimPID] = {100., 200., 1.5};
149  for(auto trg : triggers){
150  fHistos->CreateTH1(Form("hEventCount%s", trg.Data()), Form("Event Counter for trigger class %s", trg.Data()), 1, 0.5, 1.5);
151  fHistos->CreateTH1(Form("hVertexBefore%s", trg.Data()), Form("Vertex distribution before z-cut for trigger class %s", trg.Data()), 500, -50, 50);
152  fHistos->CreateTH1(Form("hVertexAfter%s", trg.Data()), Form("Vertex distribution after z-cut for trigger class %s", trg.Data()), 100, -10, 10);
153  fHistos->CreateTH1(Form("hPtEtaAll%s", trg.Data()), Form("Charged particle pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
154  fHistos->CreateTH1(Form("hPtEtaCent%s", trg.Data()), Form("Charged particle pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
155  fHistos->CreateTH1(Form("hPtEMCALEtaAll%s", trg.Data()), Form("Charged particle in EMCAL pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
156  fHistos->CreateTH1(Form("hPtEMCALEtaCent%s", trg.Data()), Form("Charged particle in EMCAL pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
157  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaAll%s", trg.Data()), Form("Charged particle in EMCAL (no TRD in front) pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
158  fHistos->CreateTH1(Form("hPtEMCALNoTRDEtaCent%s", trg.Data()), Form("Charged particle in EMCAL (no TRD in front) pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
159  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaAll%s", trg.Data()), Form("Charged particle in EMCAL (with TRD in front) pt distribution all eta new binning trigger %s", trg.Data()), newbinning);
160  fHistos->CreateTH1(Form("hPtEMCALWithTRDEtaCent%s", trg.Data()), Form("Charged particle in EMCAL (with TRD in front) pt distribution central eta new binning trigger %s", trg.Data()), newbinning);
161  if(fKineCorrelation){
162  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()));
163  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()));
164  }
165  if(fStudyPID){
166  fHistos->CreateTH2(Form("hTPCdEdxEMCAL%s", trg.Data()), Form("TPC dE/dx of charged particles in the EMCAL region for trigger %s", trg.Data()), 400, -20., 20., 200, 0., 200.);
167  fHistos->CreateTH2(Form("hTOFBetaEMCAL%s", trg.Data()), Form("TOF beta of charged particles in the EMCAL region for trigger %s", trg.Data()), 400, -20., 20., 150, 0., 1.5);
168  fHistos->CreateTHnSparse(Form("hPIDcorrEMCAL%s", trg.Data()), Form("Correlation of PID observables for Trigger %s", trg.Data()), kdimPID, knbinsPID, kminPID, kmaxPID);
169  }
170  for(auto ptcut : ptcuts) {
172  Form("hEtaLabDistAllPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
173  Form("Eta (lab) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
174  100,
175  -1.,
176  1.
177  );
179  Form("hEtaLabDistCutPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
180  Form("Eta (lab) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
181  100,
182  -1.,
183  1.
184  );
186  Form("hEtaCentDistAllPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
187  Form("Eta (cent) distribution without etacut for tracks with Pt above %.1f GeV/c trigger %s",
188  ptcut, trg.Data()),
189  160,
190  -1.3,
191  1.3
192  );
194  Form("hEtaCentDistCutPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
195  Form("Eta (cent) distribution with etacut for tracks with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
196  160,
197  -1.3,
198  1.3
199  );
201  Form("hEtaLabDistAllEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
202  Form("Eta (lab) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
203  100,
204  -1.,
205  1.
206  );
208  Form("hEtaLabDistCutEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
209  Form("Eta (lab) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
210  100,
211  -1.,
212  1.
213  );
215  Form("hEtaCentDistAllEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
216  Form("Eta (cent) distribution without etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
217  160,
218  -1.3,
219  1.3
220  );
222  Form("hEtaCentDistCutEMCALPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
223  Form("Eta (cent) distribution with etacut for tracks in EMCAL with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
224  160,
225  -1.3,
226  1.3
227  );
229  Form("hPhiDistAllPt%d%s", static_cast<Int_t>(ptcut), trg.Data()),
230  Form("#phi distribution of particles with Pt above %.1f GeV/c trigger %s", ptcut, trg.Data()),
231  300,
232  0.,
233  2*TMath::Pi()
234  );
235  }
236  }
238  PostData(1, fHistos->GetListOfHistograms());
239 }
240 
250  if(!fInitialized){
251  AliInfoStream() << GetName() << ": Initializing ..." << std::endl;
252  ExecOnce();
253  fInitialized = kTRUE;
254  }
255  if(InputEvent()->GetRunNumber() != fCurrentRun){
256  AliInfoStream() << GetName() << ": Changing run from " << fCurrentRun << " to " << InputEvent()->GetRunNumber() << std::endl;
257  RunChanged(InputEvent()->GetRunNumber());
258  fCurrentRun = InputEvent()->GetRunNumber();
259  }
260  Bool_t hasPIDresponse = fInputHandler->GetPIDResponse() != nullptr;
261  if(fStudyPID && !hasPIDresponse) AliErrorStream() << "PID requested but PID response not available" << std::endl;
262  // Select event
263  TString triggerstring = "";
266  } else {
267  triggerstring = fInputEvent->GetFiredTriggerClasses();
268  }
269  UInt_t selectionstatus = fInputHandler->IsEventSelected();
270  Bool_t isMinBias = selectionstatus & AliVEvent::kINT7,
271  isEJ1 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ1"),
272  isEJ2 = (selectionstatus & AliVEvent::kEMCEJE) && triggerstring.Contains("EJ2"),
273  isEG1 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG1"),
274  isEG2 = (selectionstatus & AliVEvent::kEMCEGA) && triggerstring.Contains("EG2"),
275  isEMC7 = (selectionstatus & AliVEvent::kEMC7) && triggerstring.Contains("CEMC7");
282  }
283  if(!(isMinBias || isEMC7 || isEG1 || isEG2 || isEJ1 || isEJ2)) return;
284  const AliVVertex *vtx = fInputEvent->GetPrimaryVertex();
285  //if(!fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.)) return; // reject pileup event
286  if(vtx->GetNContributors() < 1) return;
287  if(fInputEvent->IsA() == AliESDEvent::Class() && fAnalysisUtil->IsFirstEventInChunk(fInputEvent)) return;
288  bool isSelected = kTRUE;
289  if(!fAnalysisUtil->IsVertexSelected2013pA(fInputEvent)) isSelected = kFALSE; // Apply new vertex cut
290  if(fAnalysisUtil->IsPileUpEvent(fInputEvent)) isSelected = kFALSE; // Apply new vertex cut
291  // Apply vertex z cut
292  if(vtx->GetZ() < -10. || vtx->GetZ() > 10.) isSelected = kFALSE;
293 
294  // Fill Event counter and reference vertex distributions for the different trigger classes
295  if(isMinBias){
296  FillEventCounterHists("MB", vtx->GetZ(), isSelected);
297  }
298  if(isEMC7){
299  FillEventCounterHists("EMC7", vtx->GetZ(), isSelected);
300  if(!isMinBias){
301  FillEventCounterHists("EMC7excl", vtx->GetZ(), isSelected);
302  }
303  }
304  if(isEJ2){
305  FillEventCounterHists("EJ2", vtx->GetZ(), isSelected);
306  // Check for exclusive classes
307  if(!(isMinBias || isEMC7)){
308  FillEventCounterHists("EJ2excl", vtx->GetZ(), isSelected);
309  }
310  }
311  if(isEJ1){
312  FillEventCounterHists("EJ1", vtx->GetZ(), isSelected);
313  // Check for exclusive classes
314  if(!(isMinBias || isEMC7 || isEJ2)){
315  FillEventCounterHists("EJ1excl", vtx->GetZ(), isSelected);
316  }
317  }
318  if(isEG2){
319  FillEventCounterHists("EG2", vtx->GetZ(), isSelected);
320  // Check for exclusive classes
321  if(!(isMinBias || isEMC7)){
322  FillEventCounterHists("EG2excl", vtx->GetZ(), isSelected);
323  }
324  }
325  if(isEG1){
326  FillEventCounterHists("EG1", vtx->GetZ(), isSelected);
327  // Check for exclusive classes
328  if(!(isMinBias || isEMC7 || isEG2)){
329  FillEventCounterHists("EG1excl", vtx->GetZ(), isSelected);
330  }
331  }
332 
333  if(!isSelected) return;
334 
335  // Loop over tracks, fill select particles
336  // Histograms
337  // - Full eta_{lab} (-0.8, 0.8), new binning
338  // - Full eta_{lab} (-0.8, 0.8), old binning
339  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c without eta cut
340  // - Central eta_{cms} (-0.3, -0.2), new binning,
341  // - Central eta_{cms} (-0.8, -0.2), old binning,
342  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c
343  // - Eta distribution for tracks above 1, 2, 5, 10 GeV/c with eta cut
344  AliVTrack *checktrack(nullptr);
345  int ptmin[5] = {1,2,5,10,20}; // for eta distributions
346  Bool_t isEMCAL(kFALSE), hasTRD(kFALSE);
347  Double_t etaEMCAL(0.), phiEMCAL(0.);
348  for(int itrk = 0; itrk < fInputEvent->GetNumberOfTracks(); ++itrk){
349  checktrack = dynamic_cast<AliVTrack *>(fInputEvent->GetTrack(itrk));
350  if(!checktrack) continue;
351  if((checktrack->Eta() < fEtaLabCut[0]) || (checktrack->Eta() > fEtaLabCut[1])) continue;
352  if(TMath::Abs(checktrack->Pt()) < 0.1) continue;
353  if(checktrack->IsA() == AliESDtrack::Class()){
354  AliESDtrack copytrack(*(static_cast<AliESDtrack *>(checktrack)));
355  AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&copytrack);
356  etaEMCAL = copytrack.GetTrackEtaOnEMCal();
357  phiEMCAL = copytrack.GetTrackPhiOnEMCal();
358  } else {
359  AliAODTrack copytrack(*(static_cast<AliAODTrack *>(checktrack)));
360  AliEMCALRecoUtils::ExtrapolateTrackToEMCalSurface(&copytrack);
361  etaEMCAL = copytrack.GetTrackEtaOnEMCal();
362  phiEMCAL = copytrack.GetTrackPhiOnEMCal();
363  }
364  Int_t supermoduleID = -1;
365  isEMCAL = fGeometry->SuperModuleNumberFromEtaPhi(etaEMCAL, phiEMCAL, supermoduleID);
366  // Exclude supermodules 10 and 11 as they did not participate in the trigger
367  isEMCAL = isEMCAL && supermoduleID < 10;
368  hasTRD = isEMCAL && supermoduleID >= 4; // supermodules 4 - 10 have TRD in front in the 2012-2013 ALICE setup
369 
370  // Calculate eta in cms frame according
371  // EPJC74 (2014) 3054:
372  // eta_cms = - eta_lab - |yshift|
373  Double_t etacent = -1. * checktrack->Eta() - TMath::Abs(fYshift);
374  etacent *= fEtaSign;
375 
376  Bool_t etacentcut = etacent > fEtaCmsCut[0] && etacent < fEtaCmsCut[1];
377 
378  if(!fTrackCuts->IsTrackAccepted(checktrack)) continue;
379 
380  // fill histograms allEta
381  if(isMinBias){
382  FillTrackHistos("MB", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
383  if(fStudyPID && hasPIDresponse)
384  if(isEMCAL) FillPIDHistos("MB", *checktrack);
385  }
386  if(isEMC7){
387  FillTrackHistos("EMC7", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
388  if(fStudyPID && hasPIDresponse)
389  if(isEMCAL) FillPIDHistos("EMC7", *checktrack);
390  if(!isMinBias){
391  FillTrackHistos("EMC7excl", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
392  if(fStudyPID && hasPIDresponse)
393  if(isEMCAL) FillPIDHistos("EMC7excl", *checktrack);
394  }
395  }
396  if(isEJ2){
397  FillTrackHistos("EJ2", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
398  if(fStudyPID && hasPIDresponse)
399  if(isEMCAL) FillPIDHistos("EJ2", *checktrack);
400  // check for exclusive classes
401  if(!(isMinBias || isEMC7)){
402  FillTrackHistos("EJ2excl", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
403  if(fStudyPID && hasPIDresponse)
404  if(isEMCAL) FillPIDHistos("EJ2excl", *checktrack);
405  }
406  }
407  if(isEJ1){
408  FillTrackHistos("EJ1", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
409  if(fStudyPID && hasPIDresponse)
410  if(isEMCAL) FillPIDHistos("EJ1", *checktrack);
411  // check for exclusive classes
412  if(!(isMinBias ||isEMC7 || isEJ2)){
413  FillTrackHistos("EJ1excl", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
414  if(fStudyPID && hasPIDresponse)
415  if(isEMCAL) FillPIDHistos("EJ1excl", *checktrack);
416  }
417  }
418  if(isEG2){
419  FillTrackHistos("EG2", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
420  if(fStudyPID && hasPIDresponse)
421  if(isEMCAL) FillPIDHistos("EG2", *checktrack);
422  // check for exclusive classes
423  if(!(isMinBias || isEMC7)){
424  FillTrackHistos("EG2excl", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
425  if(fStudyPID && hasPIDresponse)
426  if(isEMCAL) FillPIDHistos("EG2excl", *checktrack);
427  }
428  }
429  if(isEG1){
430  FillTrackHistos("EG1", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
431  if(fStudyPID && hasPIDresponse)
432  if(isEMCAL) FillPIDHistos("EG1", *checktrack);
433  if(!(isMinBias || isEMC7 || isEG2)){
434  FillTrackHistos("EG1excl", checktrack->Pt(), checktrack->Eta() * fEtaSign, etacent, checktrack->Phi(), etacentcut, isEMCAL, hasTRD);
435  if(fStudyPID && hasPIDresponse)
436  if(isEMCAL) FillPIDHistos("EG1excl", *checktrack);
437  }
438  }
439  }
440  PostData(1, fHistos->GetListOfHistograms());
441 }
442 
450  const std::string &triggerclass,
451  double vtxz,
452  bool isSelected
453 )
454 {
455  Double_t weight = GetTriggerWeight(triggerclass);
456  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << triggerclass << " in event histograms." << std::endl;
457  // Fill reference distribution for the primary vertex before any z-cut
458  fHistos->FillTH1(Form("hVertexBefore%s", triggerclass.c_str()), vtxz, weight);
459  if(isSelected){
460  // Fill Event counter and reference vertex distributions after event selection
461  fHistos->FillTH1(Form("hEventCount%s", triggerclass.c_str()), 1, weight);
462  fHistos->FillTH1(Form("hVertexAfter%s", triggerclass.c_str()), vtxz, weight);
463  }
464 }
465 
473  // Handle geometry
474  if(!fGeometry){
475  fGeometry = AliEMCALGeometry::GetInstance();
476  if(!fGeometry)
477  fGeometry = AliEMCALGeometry::GetInstanceFromRunNumber(InputEvent()->GetRunNumber());
478  }
479  fTriggerPatches = static_cast<TClonesArray *>(fInputEvent->FindListObject("EmcalTriggers"));
480  // Handle OADB container with downscaling factors
481  if(fNameDownscaleOADB.Length()){
482  if(fNameDownscaleOADB.Contains("alien://") && ! gGrid) TGrid::Connect("alien://");
483  fDownscaleOADB = new AliOADBContainer("AliEmcalDownscaleFactors");
484  fDownscaleOADB->InitFromFile(fNameDownscaleOADB.Data(), "AliEmcalDownscaleFactors");
485  }
486 }
487 
496  if(fDownscaleOADB){
497  fDownscaleFactors = static_cast<TObjArray *>(fDownscaleOADB->GetObject(runnumber));
498  }
499 }
500 
512  const std::string &eventclass,
513  Double_t pt,
514  Double_t etalab,
515  Double_t etacent,
516  Double_t phi,
517  Bool_t etacut,
518  Bool_t inEmcal,
519  Bool_t hasTRD
520  )
521 {
522  Double_t weight = GetTriggerWeight(eventclass);
523  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << eventclass << " in particle histograms." << std::endl;
524  fHistos->FillTH1(Form("hPtEtaAll%s", eventclass.c_str()), TMath::Abs(pt), weight);
525  double kinepoint[3] = {TMath::Abs(pt), etalab, phi};
526  if(fKineCorrelation) fHistos->FillTH3(Form("hPtEtaPhiAll%s", eventclass.c_str()),kinepoint , weight);
527  if(inEmcal){
528  fHistos->FillTH1(Form("hPtEMCALEtaAll%s", eventclass.c_str()), TMath::Abs(pt), weight);
529  if(fKineCorrelation) fHistos->FillTH3(Form("hPtEtaPhiEMCALAll%s", eventclass.c_str()), kinepoint, weight);
530  if(hasTRD){
531  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaAll%s", eventclass.c_str()), TMath::Abs(pt), weight);
532  } else {
533  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaAll%s", eventclass.c_str()), TMath::Abs(pt), weight);
534  }
535  }
536 
537  std::array<int, 5> ptmin = {1,2,5,10,20}; // for eta distributions
538  for(auto ptmincut : ptmin){
539  if(TMath::Abs(pt) > static_cast<double>(ptmincut)){
540  fHistos->FillTH1(Form("hPhiDistAllPt%d%s", ptmincut, eventclass.c_str()), phi, weight);
541  fHistos->FillTH1(Form("hEtaLabDistAllPt%d%s", ptmincut, eventclass.c_str()), etalab, weight);
542  fHistos->FillTH1(Form("hEtaCentDistAllPt%d%s", ptmincut, eventclass.c_str()), etacent, weight);
543  if(inEmcal){
544  fHistos->FillTH1(Form("hEtaLabDistAllEMCALPt%d%s", ptmincut, eventclass.c_str()), etalab, weight);
545  fHistos->FillTH1(Form("hEtaCentDistAllEMCALPt%d%s", ptmincut, eventclass.c_str()), etacent, weight);
546  }
547  }
548  }
549 
550  if(etacut){
551  fHistos->FillTH1(Form("hPtEtaCent%s", eventclass.c_str()), TMath::Abs(pt), weight);
552  if(inEmcal){
553  fHistos->FillTH1(Form("hPtEMCALEtaCent%s", eventclass.c_str()), TMath::Abs(pt), weight);
554  if(hasTRD){
555  fHistos->FillTH1(Form("hPtEMCALWithTRDEtaCent%s", eventclass.c_str()), TMath::Abs(pt), weight);
556  } else {
557  fHistos->FillTH1(Form("hPtEMCALNoTRDEtaCent%s", eventclass.c_str()), TMath::Abs(pt), weight);
558  }
559  }
560  for(auto ptmincut : ptmin){
561  if(TMath::Abs(pt) > static_cast<double>(ptmincut)){
562  fHistos->FillTH1(Form("hEtaLabDistCutPt%d%s", ptmincut, eventclass.c_str()), etalab, weight);
563  fHistos->FillTH1(Form("hEtaCentDistCutPt%d%s", ptmincut, eventclass.c_str()), etacent, weight);
564  if(inEmcal){
565  fHistos->FillTH1(Form("hEtaLabDistCutEMCALPt%d%s", ptmincut, eventclass.c_str()), etalab, weight);
566  fHistos->FillTH1(Form("hEtaCentDistCutEMCALPt%d%s", ptmincut, eventclass.c_str()), etacent, weight);
567  }
568  }
569  }
570  }
571 }
572 
574  const std::string &eventclass,
575  const AliVTrack &trk
576 ) {
577  Double_t weight = GetTriggerWeight(eventclass);
578  AliDebugStream(1) << GetName() << ": Using weight " << weight << " for trigger " << eventclass << " in PID histograms." << std::endl;
579  AliPIDResponse *pid = fInputHandler->GetPIDResponse();
580  if(TMath::Abs(trk.Eta()) > 0.5) return;
581  if(!((trk.GetStatus() & AliVTrack::kTOFout) && (trk.GetStatus() & AliVTrack::kTIME))) return;
582 
583  double poverz = TMath::Abs(trk.P())/static_cast<double>(trk.Charge());
584  fHistos->FillTH2(Form("hTPCdEdxEMCAL%s", eventclass.c_str()), poverz, trk.GetTPCsignal(), weight);
585  // correct for units - TOF in ps, track length in cm
586  Double_t trtime = (trk.GetTOFsignal() - pid->GetTOFResponse().GetTimeZero()) * 1e-12;
587  Double_t v = trk.GetIntegratedLength()/(100. * trtime);
588  Double_t beta = v / TMath::C();
589  fHistos->FillTH2(Form("hTOFBetaEMCAL%s", eventclass.c_str()), poverz, beta, weight);
590  double datapoint[3] = {poverz, trk.GetTPCsignal(), beta};
591  fHistos->FillTHnSparse(Form("hPIDcorrEMCAL%s", eventclass.c_str()), datapoint, weight);
592 }
593 
602 Double_t AliAnalysisTaskChargedParticlesRef::GetTriggerWeight(const std::string &triggerclass) const {
603  if(fDownscaleFactors){
604  TParameter<double> *result(nullptr);
605  // Downscaling only done on MB, L0 and the low threshold triggers
606  if(triggerclass.find("MB") != std::string::npos) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("INT7"));
607  else if(triggerclass.find("EMC7") != std::string::npos) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("EMC7"));
608  else if(triggerclass.find("EJ2") != std::string::npos) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("EJ2"));
609  else if(triggerclass.find("EG2") != std::string::npos) result = static_cast<TParameter<double> *>(fDownscaleFactors->FindObject("EG2"));
610  if(result) return 1./result->GetVal();
611  }
612  return 1.;
613 }
614 
622 }
623 
630  TString triggerstring = "";
631  Int_t nEJ1 = 0, nEJ2 = 0, nEG1 = 0, nEG2 = 0;
632  double minADC_EJ1 = 260.,
633  minADC_EJ2 = 127.,
634  minADC_EG1 = 140.,
635  minADC_EG2 = 89.;
636  for(TIter patchIter = TIter(triggerpatches).Begin(); patchIter != TIter::End(); ++patchIter){
637  AliEMCALTriggerPatchInfo *patch = dynamic_cast<AliEMCALTriggerPatchInfo *>(*patchIter);
638  if(!patch->IsOfflineSimple()) continue;
639  if(patch->IsJetHighSimple() && patch->GetADCOfflineAmp() > minADC_EJ1) nEJ1++;
640  if(patch->IsJetLowSimple() && patch->GetADCOfflineAmp() > minADC_EJ2) nEJ2++;
641  if(patch->IsGammaHighSimple() && patch->GetADCOfflineAmp() > minADC_EG1) nEG1++;
642  if(patch->IsGammaLowSimple() && patch->GetADCOfflineAmp() > minADC_EG2) nEG2++;
643  }
644  if(nEJ1) triggerstring += "EJ1";
645  if(nEJ2){
646  if(triggerstring.Length()) triggerstring += ",";
647  triggerstring += "EJ2";
648  }
649  if(nEG1){
650  if(triggerstring.Length()) triggerstring += ",";
651  triggerstring += "EG1";
652  }
653  if(nEG2){
654  if(triggerstring.Length()) triggerstring += ",";
655  triggerstring += "EG2";
656  }
657  return triggerstring;
658 }
659 
666 {
667  this->SetMinimum(0.);
668  this->AddStep(1, 0.05);
669  this->AddStep(2, 0.1);
670  this->AddStep(4, 0.2);
671  this->AddStep(7, 0.5);
672  this->AddStep(16, 1);
673  this->AddStep(36, 2);
674  this->AddStep(40, 4);
675  this->AddStep(50, 5);
676  this->AddStep(100, 10);
677  this->AddStep(200, 20);
678 }
679 
680 } /* namespace EMCalTriggerPtAnalysis */
double Double_t
Definition: External.C:58
Double_t fEtaSign
Sign of the eta distribution (swaps when beam directions swap): p-Pb: +1, Pb-p: -1.
AliEmcalTriggerOfflineSelection * fTriggerSelection
Offline trigger selection.
AliEmcalTrackSelection * fTrackCuts
Standard track selection.
Class creating a linear binning, used in the histogram manager.
static AliEmcalTrackSelection * TrackCutsFactory(TString name, Bool_t isAOD)
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
void FillTH3(const char *hname, double x, double y, double z, double weight=1., Option_t *opt="")
void AddStep(Double_t max, Double_t binwidth)
AliOADBContainer * fDownscaleOADB
! Container with downscale factors for different triggers
TString GetFiredTriggerClassesFromPatches(const TClonesArray *triggerpatches) const
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
Bool_t fTriggerStringFromPatches
Do rebuild the trigger string from trigger patches.
void FillPIDHistos(const std::string &eventclass, const AliVTrack &track)
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Helper class creating user defined custom binning.
const Double_t ptmin
void FillEventCounterHists(const std::string &triggerclass, double vtxz, bool isSelected)
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Declaration of class AliEMCalTriggerExtraCuts.
Bool_t IsOfflineSelected(EmcalTriggerClass trgcls, const TClonesArray *const triggerpatches) const
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Double_t fEtaCmsCut[2]
Cut applied in Eta centre-of-mass frame.
Container class for histograms for the high- charged particle analysis.
Definition: THistManager.h:43
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235
const char Option_t
Definition: External.C:48
void FillTrackHistos(const std::string &eventclass, Double_t pt, Double_t eta, Double_t etacent, Double_t phi, Bool_t etacut, Bool_t inEmcal, Bool_t hasTRD)
bool Bool_t
Definition: External.C:53
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
TH3 * CreateTH3(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, int nbinsz, double zmin, double zmax, Option_t *opt="")
virtual bool IsTrackAccepted(AliVTrack *const trk)=0
void SetMinimum(Double_t min)