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