AliPhysics  vAN-20150506 (1fbaa09)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAnalysisTaskNucleiYield.cxx
Go to the documentation of this file.
2 
3 // ROOT includes
4 #include <TAxis.h>
5 #include <TChain.h>
6 #include <TH1F.h>
7 #include <TH2F.h>
8 #include <TH3F.h>
9 #include <TList.h>
10 #include <TMath.h>
11 #include <TParticle.h>
12 #include <TClonesArray.h>
13 #include <TTree.h>
14 #include <TRandom3.h>
15 
16 // ALIROOT includes
17 #include "AliAnalysisManager.h"
18 #include "AliCentrality.h"
19 #include "AliPID.h"
20 #include "AliTPCPIDResponse.h"
21 #include "AliTOFPIDResponse.h"
22 #include "AliVTrack.h"
23 #include "AliVVertex.h"
24 #include "AliVEvent.h"
25 #include "AliPIDResponse.h"
26 #include "AliVParticle.h"
27 #include "AliMCEvent.h"
28 #include "AliInputEventHandler.h"
29 #include "AliVEventHandler.h"
30 #include "AliStack.h"
31 #include "AliAODTrack.h"
32 #include "AliAODMCParticle.h"
33 #include "AliAODVertex.h"
34 
35 #define LIGHT_SPEED 2.99792457999999984e-02 // in the units that TOF likes
36 #define EPS 1.e-15
37 
38 using TMath::TwoPi;
39 
43 
48 static void BinLogAxis(const TH1 *h) {
49  TAxis *axis = const_cast<TAxis*>(h->GetXaxis());
50  const Int_t bins = axis->GetNbins();
51 
52  const Double_t from = axis->GetXmin();
53  const Double_t to = axis->GetXmax();
54  Double_t *newBins = new Double_t[bins + 1];
55 
56  newBins[0] = from;
57  Double_t factor = pow(to / from, 1. / bins);
58 
59  for (Int_t i = 1; i <= bins; i++) {
60  newBins[i] = factor * newBins[i - 1];
61  }
62  axis->Set(bins, newBins);
63  delete [] newBins;
64 }
65 
72 :AliAnalysisTaskSE(taskname.Data()) //
73 ,fList(0x0)
74 ,fPDG(0x0)
75 ,fPDGMass(0)
76 ,fPDGMassOverZ(0)
77 ,fIsMC(kFALSE)
78 ,fPID(0x0)
79 ,fMagField(0.f)
80 ,fPrimaryVertex(0x0)
81 ,fMmc()
82 ,fAmc()
83 ,fDCAzLimit(10.)
84 ,fDCAzNbins(400)
85 ,fPtCorrectionA(3)
86 ,fPtCorrectionM(3)
87 ,fTOFlowBoundary(-2.4)
88 ,fTOFhighBoundary(3.6)
89 ,fTOFnBins(75)
90 ,fEnablePerformance(kFALSE)
91 ,fEnablePtCorrection(kTRUE)
92 ,fRequireITSrefit(kTRUE)
93 ,fRequireTPCrefit(kTRUE)
94 ,fRequireNoKinks(kTRUE)
95 ,fRequireITSrecPoints(2u)
96 ,fRequireITSsignal(0u)
97 ,fRequireSDDrecPoints(0u)
98 ,fRequireSPDrecPoints(1u)
99 ,fRequireTPCrecPoints(70u)
100 ,fRequireTPCsignal(70u)
101 ,fRequireEtaMin(-0.8f)
102 ,fRequireEtaMax(0.8f)
103 ,fRequireYmin(-0.5f)
104 ,fRequireYmax(0.5f)
105 ,fRequireMaxChi2(4.f)
106 ,fRequireMaxDCAxy(0.5f)
107 ,fRequireMaxDCAz(1.f)
108 ,fRequireTPCpidSigmas(3.f)
109 ,fRequireITSpidSigmas(-1.f)
110 ,fRequireMinEnergyLoss(0.)
111 ,fRequireMagneticField(0)
112 ,fRequireVetoSPD(kFALSE)
113 ,fParticle(AliPID::kUnknown)
114 ,fCentBins(0x0)
115 ,fDCABins(0x0)
116 ,fPtBins(0x0)
117 ,fCustomTPCpid(0)
118 ,fFlatteningProbs(0)
119 ,fCentrality(0x0)
120 ,fFlattenedCentrality(0x0)
121 ,fCentralityClasses(0x0)
122 ,fProduction(0x0)
123 ,fAITS_TPC(0x0)
124 ,fAITS_TPC_TOF(0x0)
125 ,fATotal(0x0)
126 ,fAPtCorrection(0x0)
127 ,fMITS_TPC(0x0)
128 ,fMITS_TPC_TOF(0x0)
129 ,fMTotal(0x0)
130 ,fMPtCorrection(0x0)
131 ,fMDCAPrimaryTPC(0x0)
132 ,fMDCASecondaryTPC(0x0)
133 ,fMDCAPrimaryTOF(0x0)
134 ,fMDCASecondaryTOF(0x0)
135 ,fATOFsignal(0x0)
136 ,fATPCcounts(0x0)
137 ,fATOFphiSignal(0x0)
138 ,fATPCphiCounts(0x0)
139 ,fATPCeLoss(0x0)
140 ,fMDCAxyTPC(0x0)
141 ,fMDCAzTPC(0x0)
142 ,fMDCAxyTOF(0x0)
143 ,fMDCAzTOF(0x0)
144 ,fMTOFsignal(0x0)
145 ,fMTPCcounts(0x0)
146 ,fMTOFphiSignal(0x0)
147 ,fMTPCphiCounts(0x0)
148 ,fMTPCeLoss(0x0) {
149  gRandom->SetSeed(0); //TODO: provide a simple method to avoid "complete randomness"
150  Float_t aCorrection[3] = {-2.10154e-03,-4.53472e-01,-3.01246e+00};
151  Float_t mCorrection[3] = {-2.00277e-03,-4.93461e-01,-3.05463e+00};
152  fPtCorrectionA.Set(3, aCorrection);
153  fPtCorrectionM.Set(3,mCorrection);
154  DefineInput(0, TChain::Class());
155  DefineOutput(1, TList::Class());
156 }
157 
161  // Destructor
162 
163  if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;
164  if (fList) delete fList;
165 }
166 
171  fList = new TList();
172  fList->SetOwner(kTRUE);
173 
174  const Int_t nPtBins = fPtBins.GetSize() - 1;
175  const Int_t nCentBins = fCentBins.GetSize() - 1;
176  const Int_t nDCAbins = fDCABins.GetSize() - 1;
177  const Float_t *pTbins = fPtBins.GetArray();
178  const Float_t *centBins = fCentBins.GetArray();
179  const Float_t *dcaBins = fDCABins.GetArray();
180 
181  fCentrality = new TH1F("fCentrality",";Centrality (%);Events / 1%;",100,0.,100.);
182  fCentralityClasses = new TH1F("fCentralityClasses",";Centrality classes(%);Events / Class;",
183  nCentBins,centBins);
184  fFlattenedCentrality = new TH1F("fFlattenCentrality","After the flattening;Centrality (%); \
185  Events / 1%;",100,0.,100.);
186  fList->Add(fCentrality);
189 
190  if (fIsMC) {
191  fMTotal = new TH2F("fMTotal",";Centrality (%);p_{T} (GeV/c); Counts",
192  nCentBins,centBins,nPtBins,pTbins);
193  fATotal = new TH2F("fATotal",";Centrality (%);p_{T} (GeV/c); Counts",
194  nCentBins,centBins,nPtBins,pTbins);
195  fMITS_TPC = new TH2F("fMITS_TPC",";Centrality (%);p_{T} (GeV/c); Counts",
196  nCentBins,centBins,nPtBins,pTbins);
197  fAITS_TPC = new TH2F("fAITS_TPC",";Centrality (%);p_{T} (GeV/c); Counts",
198  nCentBins,centBins,nPtBins,pTbins);
199  fMITS_TPC_TOF = new TH2F("fMITS_TPC_TOF",";Centrality (%);p_{T} (GeV/c); Counts",
200  nCentBins,centBins,nPtBins,pTbins);
201  fAITS_TPC_TOF = new TH2F("fAITS_TPC_TOF",";Centrality (%);p_{T} (GeV/c); Counts",
202  nCentBins,centBins,nPtBins,pTbins);
203  fMDCAPrimaryTPC = new TH3F("fMDCAPrimaryTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
204  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
205  fMDCASecondaryTPC = new TH3F("fMDCASecondaryTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
206  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
207  fMDCAPrimaryTOF = new TH3F("fMDCAPrimaryTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
208  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
209  fMDCASecondaryTOF = new TH3F("fMDCASecondaryTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
210  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
211  fAPtCorrection = new TH2F("fAPtCorrection",
212  ";p_{T}^{rec} (GeV/c);p_{T}^{MC}-p_{T}^{rec} (GeV/c);Entries",
213  160,0.4,6.,80,-1.,1.);
214  fMPtCorrection = new TH2F("fMPtCorrection",
215  ";p_{T}^{rec} (GeV/c);p_{T}^{MC}-p_{T}^{rec} (GeV/c);Entries",
216  160,0.4,6.,80,-1.,1.);
217  fProduction = new TH1F("fProduction",";p (GeV/c);Entries",100,-10,10);
218 
219  fList->Add(fProduction);
220  fList->Add(fMTotal);
221  fList->Add(fATotal);
222  fList->Add(fMITS_TPC);
223  fList->Add(fAITS_TPC);
224  fList->Add(fMITS_TPC_TOF);
225  fList->Add(fAITS_TPC_TOF);
226  fList->Add(fMDCAPrimaryTPC);
227  fList->Add(fMDCASecondaryTPC);
228  fList->Add(fMDCAPrimaryTOF);
229  fList->Add(fMDCASecondaryTOF);
230  fList->Add(fAPtCorrection);
231  fList->Add(fMPtCorrection);
232 
233  } else {
234 
235  float tofBins[fTOFnBins + 1];
236  const float deltaTOF = (fTOFhighBoundary - fTOFlowBoundary) / fTOFnBins;
237  for (int i = 0; i <= fTOFnBins; ++i)
238  tofBins[i] = i * deltaTOF + fTOFlowBoundary;
239  float dcazBins[fDCAzNbins + 1];
240  const float deltaDCAz = 2.f * fDCAzLimit / fDCAzNbins;
241  for (int i = 0; i <= fDCAzNbins; ++i)
242  dcazBins[i] = i * deltaDCAz - fDCAzLimit;
243  const int nTpcBins = 40;
244  float tpcBins[nTpcBins + 1];
245  for (int i = 0; i <= nTpcBins; ++i) {
246  tpcBins[i] = -4.f + i * 0.2f;
247  }
248 
249  fATOFsignal = new TH3F("fATOFsignal",
250  ";Centrality (%);p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
251  nCentBins,centBins,nPtBins,pTbins,fTOFnBins,tofBins);
252  fATPCcounts = new TH2F("fATPCcounts",";Centrality (%);p_{T} (GeV/c); Entries",
253  nCentBins,centBins,nPtBins,pTbins);
254  fATOFphiSignal = new TH3F("fATOFphiSignal",
255  ";#phi;p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
256  64,0.,TMath::TwoPi(),36,0.2,2.,
258  fATPCphiCounts = new TH2F("fATPCphiCounts",";#phi;p_{T} (GeV/c);Counts",64,0.,TMath::TwoPi(),
259  36,0.2,2.);
260  fATPCeLoss = new TH2F("fATPCeLoss",";p (GeV/c);TPC dE/dx (a.u.);Entries",200,0.2,10.,
261  800,0,3200);
262  fMDCAxyTPC = new TH3F("fMDCAxyTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
263  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
264  fMDCAzTPC = new TH3F("fMDCAzTPC",";Centrality (%);p_{T} (GeV/c); DCA_{z} (cm)",
265  nCentBins,centBins,nPtBins,pTbins,fDCAzNbins,dcazBins);
266  fMDCAxyTOF = new TH3F("fMDCAxyTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
267  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
268  fMDCAzTOF = new TH3F("fMDCAzTOF",";Centrality (%);p_{T} (GeV/c); DCA_{z} (cm)",
269  nCentBins,centBins,nPtBins,pTbins,fDCAzNbins,dcazBins);
270  fMTOFsignal = new TH3F("fMTOFsignal",
271  ";Centrality (%);p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
272  nCentBins,centBins,nPtBins,pTbins,fTOFnBins,tofBins);
273  fMTPCcounts = new TH2F("fMTPCcounts",";Centrality (%);p_{T} (GeV/c); Entries",
274  nCentBins,centBins,nPtBins,pTbins);
275  fMTPCeLoss = new TH2F("fMTPCeLoss",";p (GeV/c);TPC dE/dx (a.u.);Entries",200,0.2,10.,
276  800,0,3200);
277  fMTOFphiSignal = new TH3F("fMTOFphiSignal",
278  ";#phi;p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
279  64,0.,TMath::TwoPi(),36,0.2,2.,
281  fMTPCphiCounts = new TH2F("fMTPCphiCounts",";#phi;p_{T} (GeV/c);Counts",64,0.,TMath::TwoPi(),
282  36,0.2,2.);
283 
286 
287  fList->Add(fATOFsignal);
288  fList->Add(fATPCcounts);
292  fList->Add(fMDCAxyTPC);
293  fList->Add(fMDCAzTPC);
294  fList->Add(fMDCAxyTOF);
295  fList->Add(fMDCAzTOF);
296  fList->Add(fMTOFsignal);
297  fList->Add(fMTPCcounts);
301  }
302 
303  PostData(1,fList);
304 }
305 
314  if (fParticle == AliPID::kUnknown) {
315  ::Error("AliAnalysisTaskNucleiYield::UserExec", "No particle type set");
316  PostData(1, fList);
317  return;
318  }
319 
322  AliVEvent *ev = dynamic_cast<AliVEvent*> (InputEvent());
323  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
324  AliInputEventHandler* handl = (AliInputEventHandler*)mgr->GetInputEventHandler();
325 
328  UInt_t mask = handl->IsEventSelected();
329  if (!(mask & 0xffffffff)) {
330  PostData(1, fList);
331  return;
332  }
333 
336  if (!((mask & AliVEvent::kMB) || (mask & AliVEvent::kCentral) ||
337  (mask & AliVEvent::kSemiCentral))) {
338  PostData(1, fList);
339  return;
340  }
341 
344  fPID = handl->GetPIDResponse();
345 
347  AliCentrality *centr = ev->GetCentrality();
348  float centrality = centr->GetCentralityPercentile("V0M");
350  if (centrality < 0. || centrality > 80.) {
351  PostData(1, fList);
352  return;
353  }
354 
357  fPrimaryVertex = (AliVVertex*)ev->GetPrimaryVertex();
358  if(TMath::Abs(fPrimaryVertex->GetZ()) > 10.) {
359  PostData(1, fList);
360  return;
361  }
362 
365  fMagField = ev->GetMagneticField();
367  PostData(1, fList);
368  return;
369  }
370 
375  fCentrality->Fill(centrality);
376  if (Flatten(centrality)) {
377  PostData(1, fList);
378  return;
379  }
380  fCentralityClasses->Fill(centrality);
381  fFlattenedCentrality->Fill(centrality);
382 
383  TClonesArray *stack = 0x0;
384  if (fIsMC) {
385  // get branch "mcparticles"
386  stack = (TClonesArray*)ev->GetList()->FindObject(AliAODMCParticle::StdBranchName());
387  if (!stack) {
388  PostData(1, fList);
389  return;
390  }
391 
393  fMmc.SetOwner(kFALSE);
394  fAmc.SetOwner(kFALSE);
395  for (int iMC = 0; iMC < stack->GetEntriesFast(); ++iMC) {
396  AliAODMCParticle *part = (AliAODMCParticle*)stack->UncheckedAt(iMC);
397  const int pdg = part->GetPdgCode();
398  if (pdg == fPDG) fProduction->Fill(part->P());
399  else if (pdg == -fPDG) fProduction->Fill(-part->P());
400  if (part->Y() > fRequireYmax || part->Y() < fRequireYmin) continue;
401  if (pdg == fPDG) {
402  if (part->IsPhysicalPrimary()) fMTotal->Fill(centrality,part->Pt());
403  fMmc.Add(part);
404  } else if (pdg == -fPDG) {
405  if (part->IsPhysicalPrimary()) fATotal->Fill(centrality,part->Pt());
406  fAmc.Add(part);
407  }
408  }
409  }
410 
412  for (Int_t iT = 0; iT < (Int_t)ev->GetNumberOfTracks(); ++iT) {
413  AliAODTrack *track = dynamic_cast<AliAODTrack*>(ev->GetTrack(iT));
414  if (track->GetID() <= 0) continue;
415  Double_t dca[2];
416  if (!AcceptTrack(track,dca)) continue;
417  const float beta = HasTOF(track);
418  float pT = track->Pt();
419  if (fEnablePtCorrection) PtCorrection(pT,track->Charge() > 0);
420  if (fIsMC) {
421  AliAODMCParticle *part = (AliAODMCParticle*)stack->At(TMath::Abs(track->GetLabel()));
422  if (!part) continue;
423  if (part->GetPdgCode() == fPDG) {
424  if (part->IsPhysicalPrimary()) {
425  fMITS_TPC->Fill(centrality,pT);
426  fMDCAPrimaryTPC->Fill(centrality,part->Pt(),dca[0]);
427  } else fMDCASecondaryTPC->Fill(centrality,part->Pt(),dca[0]);
428  fMPtCorrection->Fill(pT,part->Pt() - pT);
429  if (beta > 0) {
430  if (part->IsPhysicalPrimary()) {
431  fMDCAPrimaryTOF->Fill(centrality,part->Pt(),dca[0]);
432  fMITS_TPC_TOF->Fill(centrality,part->Pt());
433  } else {
434  fMDCASecondaryTOF->Fill(centrality,part->Pt(),dca[0]);
435  }
436  }
437  } else if (part->GetPdgCode() == -fPDG) {
438  fAPtCorrection->Fill(pT,part->Pt() - pT);
439  if (part->IsPhysicalPrimary()) {
440  fAITS_TPC->Fill(centrality,part->Pt());
441  if (beta > 0) fAITS_TPC_TOF->Fill(centrality,part->Pt());
442  }
443  }
444  } else {
445  if (track->Charge() > 0) {
446  fMTPCeLoss->Fill(track->GetTPCmomentum(),track->GetTPCsignal());
447  } else {
448  fATPCeLoss->Fill(track->GetTPCmomentum(),track->GetTPCsignal());
449  }
450  if (!PassesPIDSelection(track)) continue;
451  if (track->Charge() > 0) {
452  fMDCAxyTPC->Fill(centrality, pT, dca[0]);
453  fMDCAzTPC->Fill(centrality, pT, dca[1]);
454  fMTPCcounts->Fill(centrality, pT);
455  fMTPCphiCounts->Fill(track->Phi(),pT);
456  } else {
457  fATPCphiCounts->Fill(track->Phi(),pT);
458  fATPCcounts->Fill(centrality, pT);
459  }
460  if (beta < 0) continue;
462  const float m = track->GetTPCmomentum() * (TMath::Sqrt(1.f - beta * beta) / beta);
463  if (track->Charge() > 0) {
464  fMDCAxyTOF->Fill(centrality, pT, dca[0]);
465  fMDCAzTOF->Fill(centrality, pT, dca[1]);
466  fMTOFsignal->Fill(centrality, pT, m * m - fPDGMassOverZ * fPDGMassOverZ);
467  fMTOFphiSignal->Fill(track->Phi(),pT,m * m - fPDGMassOverZ * fPDGMassOverZ);
468  } else {
469  fATOFsignal->Fill(centrality, pT, m * m - fPDGMassOverZ * fPDGMassOverZ);
470  fATOFphiSignal->Fill(track->Phi(),pT,m * m - fPDGMassOverZ * fPDGMassOverZ);
471  }
472  }
473 
474  } // End AOD track loop
475 
476  fAmc.Clear();
477  fMmc.Clear();
478 
479  // Post output data.
480  PostData(1,fList);
481 }
482 
488  return;
489 }
490 
498 Bool_t AliAnalysisTaskNucleiYield::AcceptTrack(AliAODTrack *track, Double_t dca[2]) {
499  ULong_t status = track->GetStatus();
500  if (!(status & AliVTrack::kITSrefit) && fRequireITSrefit) return kFALSE;
501  if (!(status & AliVTrack::kTPCrefit) && fRequireTPCrefit) return kFALSE;
502  if (track->Eta() < fRequireEtaMin || track->Eta() > fRequireEtaMax) return kFALSE;
503  if (track->Y(fPDGMass) < fRequireYmin || track->Y(fPDGMass) > fRequireYmax) return kFALSE;
504  AliAODVertex *vtx1 = (AliAODVertex*)track->GetProdVertex();
505  if(Int_t(vtx1->GetType()) == AliAODVertex::kKink && fRequireNoKinks) return kFALSE;
506  unsigned int nSPD = 0, nITS = 0, nSDD = 0;
507  for (int i = 0; i < 6; ++i) {
508  if (track->HasPointOnITSLayer(i)) {
509  if (i < 2) nSPD++;
510  else if (i < 4) nSDD++;
511  nITS++;
512  }
513  }
514  if (track->GetTPCsignal() < fRequireMinEnergyLoss) return kFALSE;
515  if (nITS < fRequireITSrecPoints) return kFALSE;
516  if (nSPD < fRequireSPDrecPoints) return kFALSE;
517  if (nSDD < fRequireSDDrecPoints) return kFALSE;
518  if (fRequireVetoSPD && nSPD > 0) return kFALSE;
519  if (track->Chi2perNDF() > fRequireMaxChi2) return kFALSE;
520  Double_t cov[3];
521  if (!track->PropagateToDCA(fPrimaryVertex, fMagField, 100, dca, cov)) return kFALSE;
522  if (TMath::Abs(dca[0]) > fRequireMaxDCAxy) return kFALSE;
523  if (TMath::Abs(dca[1]) > fRequireMaxDCAz) return kFALSE;
524  return kTRUE;
525 }
526 
532 Float_t AliAnalysisTaskNucleiYield::HasTOF(AliAODTrack *track) {
533  Bool_t hasTOFout = track->GetStatus() & AliVTrack::kTOFout;
534  Bool_t hasTOFtime = track->GetStatus() & AliVTrack::kTIME;
535  const float len = track->GetIntegratedLength();
536  Bool_t hasTOF = Bool_t(hasTOFout & hasTOFtime) && len > 350.f;
537 
538  if (!hasTOF) return -1.;
539  const float p = track->GetTPCmomentum();
540  const float tim = track->GetTOFsignal() - fPID->GetTOFResponse().GetStartTime(p);
541  if (tim < len / LIGHT_SPEED) return -1.;
542  else {
543  const float beta = len / (tim * LIGHT_SPEED);
544  if (beta < EPS || beta > (1. - EPS))
545  return -1.f;
546  else
547  return beta;
548  }
549 }
550 
557 void AliAnalysisTaskNucleiYield::SetCentBins(Int_t nbins, Float_t *bins) {
558  fCentBins.Set(nbins + 1, bins);
559 }
560 
567 void AliAnalysisTaskNucleiYield::SetDCABins(Int_t nbins, Float_t min, Float_t max) {
568  const float delta = (max - min) / nbins;
569  fDCABins.Set(nbins + 1);
570  for (int iB = 0; iB < nbins; ++iB) {
571  fDCABins[iB] = min + iB * delta;
572  }
573  fDCABins[nbins] = max;
574 }
575 
582 void AliAnalysisTaskNucleiYield::SetPtBins(Int_t nbins, Float_t *bins) {
583  fPtBins.Set(nbins + 1, bins);
584 }
585 
592 void AliAnalysisTaskNucleiYield::SetCustomTPCpid(Float_t *par, Float_t sigma) {
593  if (par == 0x0 && sigma <= 0) {
594  fCustomTPCpid.Set(1);
595  } else {
596  fCustomTPCpid.Set(6);
597  for (int i = 0; i < 5; ++i)
598  fCustomTPCpid.AddAt(par[i],i);
599  fCustomTPCpid.AddAt(sigma, 5);
600  }
601 }
602 
610  bool itsPID = kTRUE;
611  if (fRequireITSpidSigmas > 0) {
612  AliITSPIDResponse &itsPidResp = fPID->GetITSResponse();
613  itsPID = TMath::Abs(itsPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireITSpidSigmas;
614  }
615 
616  if (fCustomTPCpid.GetSize() < 6 || fIsMC) {
617  AliTPCPIDResponse &tpcPidResp = fPID->GetTPCResponse();
618  return itsPID && TMath::Abs(tpcPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireTPCpidSigmas;
619  } else {
620  const float p = t->GetTPCmomentum() / fPDGMassOverZ;
621  const float r = AliExternalTrackParam::BetheBlochAleph(p, fCustomTPCpid[0], fCustomTPCpid[1],
623  fCustomTPCpid[4]);
624  return itsPID && TMath::Abs(t->GetTPCsignal() - r) < fRequireTPCpidSigmas * fCustomTPCpid[5] * r;
625  }
626 
627 }
628 
636 void AliAnalysisTaskNucleiYield::SetTOFBins(Int_t nbins, Float_t min, Float_t max) {
637  fTOFnBins = nbins;
638  fTOFlowBoundary = min;
639  fTOFhighBoundary = max;
640 }
641 
648 void AliAnalysisTaskNucleiYield::SetDCAzBins(Int_t nbins, Float_t limit) {
649  fDCAzNbins = nbins;
650  fDCAzLimit = limit;
651 }
652 
658 void AliAnalysisTaskNucleiYield::SetParticleType(AliPID::EParticleType part) {
659  fParticle = part;
660  fPDGMass = AliPID::ParticleMass(part);
661  fPDGMassOverZ = AliPID::ParticleMassZ(part);
662 }
663 
674  if (fFlatteningProbs.GetSize() <= 0) {
675  Float_t prob[13] = {
676  0.839266,0.822364,0.807522,0.804727,0.806675,
677  0.828297,0.820842,0.834088,0.861455,1.,
678  0.38112,0.661154,0.953928
679  };
680  fFlatteningProbs.Set(13, prob);
681  }
682  if (!fIsMC) {
683  if (cent >= fFlatteningProbs.GetSize()) return kFALSE;
684  else return gRandom->Rndm() > fFlatteningProbs[int(cent)];
685  } else {
686  // This flattening is required since a strange peak in VOM distribution is observed in MC
687  return (cent < 1) && gRandom->Rndm() > 0.35;
688  }
689 }
690 
697 void AliAnalysisTaskNucleiYield::PtCorrection(float &pt, bool positiveCharge) {
698  Float_t *par = (positiveCharge) ? fPtCorrectionM.GetArray() : fPtCorrectionA.GetArray();
699  const Float_t correction = par[0] + par[1] * TMath::Exp(par[2] * pt);
700  pt -= correction;
701 }
TH3F * fMDCASecondaryTPC
! *(MC only)* distribution of secondaries for ITS+TPC tracks
void SetPtBins(Int_t nbins, Float_t *bins)
TArrayF fPtBins
Transverse momentum bins.
Float_t fPDGMassOverZ
PDG mass over z.
TH1F * fFlattenedCentrality
! Events centrality distribution after the flattening
AliPIDResponse * fPID
! PID response class
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
TH3F * fATOFsignal
! *(Data only)* TOF signal for anti-matter
TH1F * fCentrality
! Events centrality distribution
UShort_t fRequireITSrecPoints
Cut on tracks: minimum number of required ITS recpoints.
TH3F * fMDCAPrimaryTOF
! *(MC only)* distribution of primaries for ITS+TPC+TOF tracks
TList fMmc
*(MC only)* List of matter particles
Int_t fRequireMagneticField
{0 : any magnetic field is fine, -1 : only negative magnetic field, 1 : only positive} ...
Int_t fPDG
PDG code of the particle of interest.
TH3F * fMDCAxyTOF
! *(Data only)* distribution for ITS+TPC+TOF tracks
TH2F * fATotal
! *(MC only)* Particles in acceptance (anti-matter)
Float_t fRequireMinEnergyLoss
Cut on the minimum energy loss counts in TPC.
UShort_t fRequireSDDrecPoints
Cut on tracks: minimum number of required SDD recpoints.
TH2F * fMPtCorrection
! *(MC only)* as a function of for matter
TH3F * fMDCAxyTPC
! *(Data only)* distribution for ITS+TPC tracks
Bool_t fRequireNoKinks
Cut on tracks: set true to exclude tracks from kink vertices.
Bool_t AcceptTrack(AliAODTrack *t, Double_t dca[2])
TH2F * fATPCeLoss
! *(Data only)* TPC dE/dx for anti-matter
TH1F * fCentralityClasses
! Events statistics per centrality classes
static void BinLogAxis(const TH1 *h)
TList fAmc
*(MC only)* List of anti-matter particles
TH3F * fMDCAPrimaryTPC
! *(MC only)* distribution of primaries for ITS+TPC tracks
void SetDCAzBins(Int_t nbins, Float_t limit)
Float_t fMagField
Magnetic field value for the current event.
TH2F * fMITS_TPC
! *(MC only)* Tracks reconstructed in ITS-TPC acceptance (matter)
Bool_t fRequireVetoSPD
Cut away all the tracks with at least 1 SPD cluster.
Int_t fTOFnBins
Number of bins used for the TOF mass spectra.
TH2F * fAPtCorrection
! *(MC only)* as a function of for anti-matter
void SetParticleType(AliPID::EParticleType part)
TH2F * fMTPCcounts
! *(Data only)* TPC counts for matter
TArrayF fCustomTPCpid
Custom parametrisation of the Bethe-Bloch.
TH2F * fAITS_TPC_TOF
! *(MC only)* Tracks reconstructed in ITS-TPC-TOF acceptance (anti-matter)
Int_t fDCAzNbins
Number of bins used for distributions.
Bool_t fRequireITSrefit
Cut on tracks: set true to require ITS refit.
TH3F * fATOFphiSignal
! *(Data only)* TOF signal for anti-matter as a function of
#define LIGHT_SPEED
Float_t fRequireMaxChi2
Cut on tracks: maximum TPC .
Bool_t fEnablePtCorrection
If true enables the MC based correction.
TArrayF fPtCorrectionM
Array containing the parametrisation of the.
TH3F * fMDCAzTOF
! *(Data only)* distribution for ITS+TPC+TOF tracks
UShort_t fRequireSPDrecPoints
Cut on tracks: minimum number of required SPD recpoints.
Float_t fTOFhighBoundary
Upper limit for the TOF mass spectra histograms.
Float_t fTOFlowBoundary
Lower limit for the TOF mass spectra histograms.
TH3F * fMDCAzTPC
! *(Data only)* distribution for ITS+TPC tracks
TH3F * fMTOFsignal
! *(Data only)* TOF signal for matter
AliVVertex * fPrimaryVertex
! Primary vertex of the current event
TArrayF fPtCorrectionA
Array containing the parametrisation of the.
TH2F * fMTPCeLoss
! *(Data only)* TPC dE/dx for matter
Bool_t fEnablePerformance
If true enables the task saves in the output the performance plots.
TH2F * fATPCcounts
! *(Data only)* TPC counts for anti-matter
TH2F * fMTotal
! *(MC only)* Particles in acceptance (matter)
void PtCorrection(float &pt, bool positiveCharge)
void SetCustomTPCpid(Float_t *par, Float_t sigma)
void SetCentBins(Int_t nbins, Float_t *bins)
AliPID::EParticleType fParticle
Particle specie.
AliAnalysisTaskNucleiYield(TString taskname="NucleiYieldTask")
TArrayF fFlatteningProbs
Flattening probabilities.
void SetTOFBins(Int_t nbins, Float_t min, Float_t max)
TH2F * fMITS_TPC_TOF
! *(MC only)* Tracks reconstructed in ITS-TPC-TOF acceptance (matter)
This task fills histograms required to perform the analysis on the light nuclei yield.
Bool_t fRequireTPCrefit
Cut on tracks: set true to require TPC refit.
Float_t fRequireEtaMin
Cut on tracks: minimum eta for the track.
TH3F * fMDCASecondaryTOF
! *(MC only)* distribution of secondaries for ITS+TPC+TOF tracks
Float_t fRequireYmin
Cut on tracks: mimimum y for the track (using PDG mass)
Float_t fDCAzLimit
Limits of the histograms.
Float_t fRequireTPCpidSigmas
Cut on TPC PID number of sigmas.
TH3F * fMTOFphiSignal
! *(Data only)* TOF signal for matter as a function of
TH2F * fATPCphiCounts
! *(Data only)* TPC counts for anti-matter as a function of
Bool_t fIsMC
Switch between MC and data.
TH1F * fProduction
! *(MC only)* Total number of produced particles
Float_t fRequireYmax
Cut on tracks: maximum y for the track (using PDG mass)
TH2F * fMTPCphiCounts
! *(Data only)* TPC counts for matter as a function of
TArrayF fCentBins
Centrality bins.
void SetDCABins(Int_t nbins, Float_t min, Float_t max)
Float_t fRequireITSpidSigmas
Cut on ITS PID number of sigmas.
Float_t fRequireMaxDCAxy
Cut on tracks: maximum for the track.
Float_t fRequireMaxDCAz
Cut on tracks: maximum for the track.
Float_t fRequireEtaMax
Cut on tracks: maximum eta for the track.
TH2F * fAITS_TPC
! *(MC only)* Tracks reconstructed in ITS-TPC acceptance (anti-matter)