AliPhysics  vAN-20150429 (ffa5c54)
 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 ,fRequireSPDrecPoints(1u)
98 ,fRequireTPCrecPoints(70u)
99 ,fRequireTPCsignal(70u)
100 ,fRequireEtaMin(-0.8f)
101 ,fRequireEtaMax(0.8f)
102 ,fRequireYmin(-0.5f)
103 ,fRequireYmax(0.5f)
104 ,fRequireMaxChi2(4.f)
105 ,fRequireMaxDCAxy(0.5f)
106 ,fRequireMaxDCAz(1.f)
107 ,fRequireTPCpidSigmas(3.f)
108 ,fRequireITSpidSigmas(-1.f)
109 ,fRequireMinEnergyLoss(0.)
110 ,fRequireMagneticField(0)
111 ,fParticle(AliPID::kUnknown)
112 ,fCentBins(0x0)
113 ,fDCABins(0x0)
114 ,fPtBins(0x0)
115 ,fCustomTPCpid(0)
116 ,fFlatteningProbs(0)
117 ,fCentrality(0x0)
118 ,fFlattenedCentrality(0x0)
119 ,fCentralityClasses(0x0)
120 ,fProduction(0x0)
121 ,fAITS_TPC(0x0)
122 ,fAITS_TPC_TOF(0x0)
123 ,fATotal(0x0)
124 ,fAPtCorrection(0x0)
125 ,fMITS_TPC(0x0)
126 ,fMITS_TPC_TOF(0x0)
127 ,fMTotal(0x0)
128 ,fMPtCorrection(0x0)
129 ,fMDCAPrimaryTPC(0x0)
130 ,fMDCASecondaryTPC(0x0)
131 ,fMDCAPrimaryTOF(0x0)
132 ,fMDCASecondaryTOF(0x0)
133 ,fATOFsignal(0x0)
134 ,fATPCcounts(0x0)
135 ,fATOFphiSignal(0x0)
136 ,fATPCphiCounts(0x0)
137 ,fATPCeLoss(0x0)
138 ,fMDCAxyTPC(0x0)
139 ,fMDCAzTPC(0x0)
140 ,fMDCAxyTOF(0x0)
141 ,fMDCAzTOF(0x0)
142 ,fMTOFsignal(0x0)
143 ,fMTPCcounts(0x0)
144 ,fMTOFphiSignal(0x0)
145 ,fMTPCphiCounts(0x0)
146 ,fMTPCeLoss(0x0) {
147  gRandom->SetSeed(0); //TODO: provide a simple method to avoid "complete randomness"
148  Float_t aCorrection[3] = {-2.10154e-03,-4.53472e-01,-3.01246e+00};
149  Float_t mCorrection[3] = {-2.00277e-03,-4.93461e-01,-3.05463e+00};
150  fPtCorrectionA.Set(3, aCorrection);
151  fPtCorrectionM.Set(3,mCorrection);
152  DefineInput(0, TChain::Class());
153  DefineOutput(1, TList::Class());
154 }
155 
159  // Destructor
160 
161  if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;
162  if (fList) delete fList;
163 }
164 
169  fList = new TList();
170  fList->SetOwner(kTRUE);
171 
172  const Int_t nPtBins = fPtBins.GetSize() - 1;
173  const Int_t nCentBins = fCentBins.GetSize() - 1;
174  const Int_t nDCAbins = fDCABins.GetSize() - 1;
175  const Float_t *pTbins = fPtBins.GetArray();
176  const Float_t *centBins = fCentBins.GetArray();
177  const Float_t *dcaBins = fDCABins.GetArray();
178 
179  fCentrality = new TH1F("fCentrality",";Centrality (%);Events / 1%;",100,0.,100.);
180  fCentralityClasses = new TH1F("fCentralityClasses",";Centrality classes(%);Events / Class;",
181  nCentBins,centBins);
182  fFlattenedCentrality = new TH1F("fFlattenCentrality","After the flattening;Centrality (%); \
183  Events / 1%;",100,0.,100.);
184  fList->Add(fCentrality);
187 
188  if (fIsMC) {
189  fMTotal = new TH2F("fMTotal",";Centrality (%);p_{T} (GeV/c); Counts",
190  nCentBins,centBins,nPtBins,pTbins);
191  fATotal = new TH2F("fATotal",";Centrality (%);p_{T} (GeV/c); Counts",
192  nCentBins,centBins,nPtBins,pTbins);
193  fMITS_TPC = new TH2F("fMITS_TPC",";Centrality (%);p_{T} (GeV/c); Counts",
194  nCentBins,centBins,nPtBins,pTbins);
195  fAITS_TPC = new TH2F("fAITS_TPC",";Centrality (%);p_{T} (GeV/c); Counts",
196  nCentBins,centBins,nPtBins,pTbins);
197  fMITS_TPC_TOF = new TH2F("fMITS_TPC_TOF",";Centrality (%);p_{T} (GeV/c); Counts",
198  nCentBins,centBins,nPtBins,pTbins);
199  fAITS_TPC_TOF = new TH2F("fAITS_TPC_TOF",";Centrality (%);p_{T} (GeV/c); Counts",
200  nCentBins,centBins,nPtBins,pTbins);
201  fMDCAPrimaryTPC = new TH3F("fMDCAPrimaryTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
202  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
203  fMDCASecondaryTPC = new TH3F("fMDCASecondaryTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
204  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
205  fMDCAPrimaryTOF = new TH3F("fMDCAPrimaryTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
206  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
207  fMDCASecondaryTOF = new TH3F("fMDCASecondaryTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
208  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
209  fAPtCorrection = new TH2F("fAPtCorrection",
210  ";p_{T}^{rec} (GeV/c);p_{T}^{MC}-p_{T}^{rec} (GeV/c);Entries",
211  160,0.4,6.,80,-1.,1.);
212  fMPtCorrection = new TH2F("fMPtCorrection",
213  ";p_{T}^{rec} (GeV/c);p_{T}^{MC}-p_{T}^{rec} (GeV/c);Entries",
214  160,0.4,6.,80,-1.,1.);
215  fProduction = new TH1F("fProduction",";p (GeV/c);Entries",100,-10,10);
216 
217  fList->Add(fProduction);
218  fList->Add(fMTotal);
219  fList->Add(fATotal);
220  fList->Add(fMITS_TPC);
221  fList->Add(fAITS_TPC);
222  fList->Add(fMITS_TPC_TOF);
223  fList->Add(fAITS_TPC_TOF);
224  fList->Add(fMDCAPrimaryTPC);
225  fList->Add(fMDCASecondaryTPC);
226  fList->Add(fMDCAPrimaryTOF);
227  fList->Add(fMDCASecondaryTOF);
228  fList->Add(fAPtCorrection);
229  fList->Add(fMPtCorrection);
230 
231  } else {
232 
233  float tofBins[fTOFnBins + 1];
234  const float deltaTOF = (fTOFhighBoundary - fTOFlowBoundary) / fTOFnBins;
235  for (int i = 0; i <= fTOFnBins; ++i)
236  tofBins[i] = i * deltaTOF + fTOFlowBoundary;
237  float dcazBins[fDCAzNbins + 1];
238  const float deltaDCAz = 2.f * fDCAzLimit / fDCAzNbins;
239  for (int i = 0; i <= fDCAzNbins; ++i)
240  dcazBins[i] = i * deltaDCAz - fDCAzLimit;
241  const int nTpcBins = 40;
242  float tpcBins[nTpcBins + 1];
243  for (int i = 0; i <= nTpcBins; ++i) {
244  tpcBins[i] = -4.f + i * 0.2f;
245  }
246 
247  fATOFsignal = new TH3F("fATOFsignal",
248  ";Centrality (%);p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
249  nCentBins,centBins,nPtBins,pTbins,fTOFnBins,tofBins);
250  fATPCcounts = new TH2F("fATPCcounts",";Centrality (%);p_{T} (GeV/c); Entries",
251  nCentBins,centBins,nPtBins,pTbins);
252  fATOFphiSignal = new TH3F("fATOFphiSignal",
253  ";#phi;p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
254  64,0.,TMath::TwoPi(),36,0.2,2.,
256  fATPCphiCounts = new TH2F("fATPCphiCounts",";#phi;p_{T} (GeV/c);Counts",64,0.,TMath::TwoPi(),
257  36,0.2,2.);
258  fATPCeLoss = new TH2F("fATPCeLoss",";p (GeV/c);TPC dE/dx (a.u.);Entries",200,0.2,10.,
259  800,0,3200);
260  fMDCAxyTPC = new TH3F("fMDCAxyTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
261  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
262  fMDCAzTPC = new TH3F("fMDCAzTPC",";Centrality (%);p_{T} (GeV/c); DCA_{z} (cm)",
263  nCentBins,centBins,nPtBins,pTbins,fDCAzNbins,dcazBins);
264  fMDCAxyTOF = new TH3F("fMDCAxyTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
265  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
266  fMDCAzTOF = new TH3F("fMDCAzTOF",";Centrality (%);p_{T} (GeV/c); DCA_{z} (cm)",
267  nCentBins,centBins,nPtBins,pTbins,fDCAzNbins,dcazBins);
268  fMTOFsignal = new TH3F("fMTOFsignal",
269  ";Centrality (%);p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
270  nCentBins,centBins,nPtBins,pTbins,fTOFnBins,tofBins);
271  fMTPCcounts = new TH2F("fMTPCcounts",";Centrality (%);p_{T} (GeV/c); Entries",
272  nCentBins,centBins,nPtBins,pTbins);
273  fMTPCeLoss = new TH2F("fMTPCeLoss",";p (GeV/c);TPC dE/dx (a.u.);Entries",200,0.2,10.,
274  800,0,3200);
275  fMTOFphiSignal = new TH3F("fMTOFphiSignal",
276  ";#phi;p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
277  64,0.,TMath::TwoPi(),36,0.2,2.,
279  fMTPCphiCounts = new TH2F("fMTPCphiCounts",";#phi;p_{T} (GeV/c);Counts",64,0.,TMath::TwoPi(),
280  36,0.2,2.);
281 
284 
285  fList->Add(fATOFsignal);
286  fList->Add(fATPCcounts);
290  fList->Add(fMDCAxyTPC);
291  fList->Add(fMDCAzTPC);
292  fList->Add(fMDCAxyTOF);
293  fList->Add(fMDCAzTOF);
294  fList->Add(fMTOFsignal);
295  fList->Add(fMTPCcounts);
299  }
300 
301  PostData(1,fList);
302 }
303 
312  if (fParticle == AliPID::kUnknown) {
313  ::Error("AliAnalysisTaskNucleiYield::UserExec", "No particle type set");
314  PostData(1, fList);
315  return;
316  }
317 
320  AliVEvent *ev = dynamic_cast<AliVEvent*> (InputEvent());
321  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
322  AliInputEventHandler* handl = (AliInputEventHandler*)mgr->GetInputEventHandler();
323 
326  UInt_t mask = handl->IsEventSelected();
327  if (!(mask & 0xffffffff)) {
328  PostData(1, fList);
329  return;
330  }
331 
334  if (!((mask & AliVEvent::kMB) || (mask & AliVEvent::kCentral) ||
335  (mask & AliVEvent::kSemiCentral))) {
336  PostData(1, fList);
337  return;
338  }
339 
342  fPID = handl->GetPIDResponse();
343 
345  AliCentrality *centr = ev->GetCentrality();
346  float centrality = centr->GetCentralityPercentile("V0M");
348  if (centrality < 0. || centrality > 80.) {
349  PostData(1, fList);
350  return;
351  }
352 
355  fPrimaryVertex = (AliVVertex*)ev->GetPrimaryVertex();
356  if(TMath::Abs(fPrimaryVertex->GetZ()) > 10.) {
357  PostData(1, fList);
358  return;
359  }
360 
363  fMagField = ev->GetMagneticField();
365  PostData(1, fList);
366  return;
367  }
368 
373  fCentrality->Fill(centrality);
374  if (Flatten(centrality)) {
375  PostData(1, fList);
376  return;
377  }
378  fCentralityClasses->Fill(centrality);
379  fFlattenedCentrality->Fill(centrality);
380 
381  TClonesArray *stack = 0x0;
382  if (fIsMC) {
383  // get branch "mcparticles"
384  stack = (TClonesArray*)ev->GetList()->FindObject(AliAODMCParticle::StdBranchName());
385  if (!stack) {
386  PostData(1, fList);
387  return;
388  }
389 
391  fMmc.SetOwner(kFALSE);
392  fAmc.SetOwner(kFALSE);
393  for (int iMC = 0; iMC < stack->GetEntriesFast(); ++iMC) {
394  AliAODMCParticle *part = (AliAODMCParticle*)stack->UncheckedAt(iMC);
395  const int pdg = part->GetPdgCode();
396  if (pdg == fPDG) fProduction->Fill(part->P());
397  else if (pdg == -fPDG) fProduction->Fill(-part->P());
398  if (part->Y() > fRequireYmax || part->Y() < fRequireYmin) continue;
399  if (pdg == fPDG) {
400  if (part->IsPhysicalPrimary()) fMTotal->Fill(centrality,part->Pt());
401  fMmc.Add(part);
402  } else if (pdg == -fPDG) {
403  if (part->IsPhysicalPrimary()) fATotal->Fill(centrality,part->Pt());
404  fAmc.Add(part);
405  }
406  }
407  }
408 
410  for (Int_t iT = 0; iT < (Int_t)ev->GetNumberOfTracks(); ++iT) {
411  AliAODTrack *track = dynamic_cast<AliAODTrack*>(ev->GetTrack(iT));
412  if (track->GetID() <= 0) continue;
413  Double_t dca[2];
414  if (!AcceptTrack(track,dca)) continue;
415  const float beta = HasTOF(track);
416  float pT = track->Pt();
417  if (fEnablePtCorrection) PtCorrection(pT,track->Charge() > 0);
418  if (fIsMC) {
419  AliAODMCParticle *part = (AliAODMCParticle*)stack->At(TMath::Abs(track->GetLabel()));
420  if (!part) continue;
421  if (part->GetPdgCode() == fPDG) {
422  if (part->IsPhysicalPrimary()) {
423  fMITS_TPC->Fill(centrality,pT);
424  fMDCAPrimaryTPC->Fill(centrality,part->Pt(),dca[0]);
425  } else fMDCASecondaryTPC->Fill(centrality,part->Pt(),dca[0]);
426  fMPtCorrection->Fill(pT,part->Pt() - pT);
427  if (beta > 0) {
428  if (part->IsPhysicalPrimary()) {
429  fMDCAPrimaryTOF->Fill(centrality,part->Pt(),dca[0]);
430  fMITS_TPC_TOF->Fill(centrality,part->Pt());
431  } else {
432  fMDCASecondaryTOF->Fill(centrality,part->Pt(),dca[0]);
433  }
434  }
435  } else if (part->GetPdgCode() == -fPDG) {
436  fAPtCorrection->Fill(pT,part->Pt() - pT);
437  if (part->IsPhysicalPrimary()) {
438  fAITS_TPC->Fill(centrality,part->Pt());
439  if (beta > 0) fAITS_TPC_TOF->Fill(centrality,part->Pt());
440  }
441  }
442  } else {
443  if (track->Charge() > 0) {
444  fMTPCeLoss->Fill(track->GetTPCmomentum(),track->GetTPCsignal());
445  } else {
446  fATPCeLoss->Fill(track->GetTPCmomentum(),track->GetTPCsignal());
447  }
448  if (!PassesPIDSelection(track)) continue;
449  if (track->Charge() > 0) {
450  fMDCAxyTPC->Fill(centrality, pT, dca[0]);
451  fMDCAzTPC->Fill(centrality, pT, dca[1]);
452  fMTPCcounts->Fill(centrality, pT);
453  fMTPCphiCounts->Fill(track->Phi(),pT);
454  } else {
455  fATPCphiCounts->Fill(track->Phi(),pT);
456  fATPCcounts->Fill(centrality, pT);
457  }
458  if (beta < 0) continue;
460  const float m = track->GetTPCmomentum() * (TMath::Sqrt(1.f - beta * beta) / beta);
461  if (track->Charge() > 0) {
462  fMDCAxyTOF->Fill(centrality, pT, dca[0]);
463  fMDCAzTOF->Fill(centrality, pT, dca[1]);
464  fMTOFsignal->Fill(centrality, pT, m * m - fPDGMassOverZ * fPDGMassOverZ);
465  fMTOFphiSignal->Fill(track->Phi(),pT,m * m - fPDGMassOverZ * fPDGMassOverZ);
466  } else {
467  fATOFsignal->Fill(centrality, pT, m * m - fPDGMassOverZ * fPDGMassOverZ);
468  fATOFphiSignal->Fill(track->Phi(),pT,m * m - fPDGMassOverZ * fPDGMassOverZ);
469  }
470  }
471 
472  } // End AOD track loop
473 
474  fAmc.Clear();
475  fMmc.Clear();
476 
477  // Post output data.
478  PostData(1,fList);
479 }
480 
486  return;
487 }
488 
496 Bool_t AliAnalysisTaskNucleiYield::AcceptTrack(AliAODTrack *track, Double_t dca[2]) {
497  ULong_t status = track->GetStatus();
498  if (!(status & AliVTrack::kITSrefit) && fRequireITSrefit) return kFALSE;
499  if (!(status & AliVTrack::kTPCrefit) && fRequireTPCrefit) return kFALSE;
500  if (track->Eta() < fRequireEtaMin || track->Eta() > fRequireEtaMax) return kFALSE;
501  if (track->Y(fPDGMass) < fRequireYmin || track->Y(fPDGMass) > fRequireYmax) return kFALSE;
502  AliAODVertex *vtx1 = (AliAODVertex*)track->GetProdVertex();
503  if(Int_t(vtx1->GetType()) == AliAODVertex::kKink && fRequireNoKinks) return kFALSE;
504  unsigned int nSPD = 0, nITS = 0;
505  for (int i = 0; i < 6; ++i) {
506  if (track->HasPointOnITSLayer(i)) {
507  if(i < 2) nSPD++;
508  nITS++;
509  }
510  }
511  if (track->GetTPCsignal() < fRequireMinEnergyLoss) return kFALSE;
512  if (nITS < fRequireITSrecPoints) return kFALSE;
513  if (nSPD < fRequireSPDrecPoints) return kFALSE;
514  if (track->Chi2perNDF() > fRequireMaxChi2) return kFALSE;
515  Double_t cov[3];
516  if (!track->PropagateToDCA(fPrimaryVertex, fMagField, 100, dca, cov)) return kFALSE;
517  if (TMath::Abs(dca[0]) > fRequireMaxDCAxy) return kFALSE;
518  if (TMath::Abs(dca[1]) > fRequireMaxDCAz) return kFALSE;
519  return kTRUE;
520 }
521 
527 Float_t AliAnalysisTaskNucleiYield::HasTOF(AliAODTrack *track) {
528  Bool_t hasTOFout = track->GetStatus() & AliVTrack::kTOFout;
529  Bool_t hasTOFtime = track->GetStatus() & AliVTrack::kTIME;
530  const float len = track->GetIntegratedLength();
531  Bool_t hasTOF = Bool_t(hasTOFout & hasTOFtime) && len > 350.f;
532 
533  if (!hasTOF) return -1.;
534  const float p = track->GetTPCmomentum();
535  const float tim = track->GetTOFsignal() - fPID->GetTOFResponse().GetStartTime(p);
536  if (tim < len / LIGHT_SPEED) return -1.;
537  else {
538  const float beta = len / (tim * LIGHT_SPEED);
539  if (beta < EPS || beta > (1. - EPS))
540  return -1.f;
541  else
542  return beta;
543  }
544 }
545 
552 void AliAnalysisTaskNucleiYield::SetCentBins(Int_t nbins, Float_t *bins) {
553  fCentBins.Set(nbins + 1, bins);
554 }
555 
562 void AliAnalysisTaskNucleiYield::SetDCABins(Int_t nbins, Float_t min, Float_t max) {
563  const float delta = (max - min) / nbins;
564  fDCABins.Set(nbins + 1);
565  for (int iB = 0; iB < nbins; ++iB) {
566  fDCABins[iB] = min + iB * delta;
567  }
568  fDCABins[nbins] = max;
569 }
570 
577 void AliAnalysisTaskNucleiYield::SetPtBins(Int_t nbins, Float_t *bins) {
578  fPtBins.Set(nbins + 1, bins);
579 }
580 
587 void AliAnalysisTaskNucleiYield::SetCustomTPCpid(Float_t *par, Float_t sigma) {
588  if (par == 0x0 && sigma <= 0) {
589  fCustomTPCpid.Set(1);
590  } else {
591  fCustomTPCpid.Set(6);
592  for (int i = 0; i < 5; ++i)
593  fCustomTPCpid.AddAt(par[i],i);
594  fCustomTPCpid.AddAt(sigma, 5);
595  }
596 }
597 
605  if (fCustomTPCpid.GetSize() < 6 || fIsMC) {
606  bool itsPID = kTRUE;
607  AliITSPIDResponse &itsPidResp = fPID->GetITSResponse();
608  AliTPCPIDResponse &tpcPidResp = fPID->GetTPCResponse();
609  if (fRequireITSpidSigmas > 0) {
610  itsPID = TMath::Abs(itsPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireITSpidSigmas;
611  }
612  return itsPID && TMath::Abs(tpcPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireTPCpidSigmas;
613  } else {
614  const float p = t->GetTPCmomentum() / fPDGMassOverZ;
615  const float r = AliExternalTrackParam::BetheBlochAleph(p, fCustomTPCpid[0], fCustomTPCpid[1],
617  fCustomTPCpid[4]);
618  return TMath::Abs(t->GetTPCsignal() - r) < fRequireTPCpidSigmas * fCustomTPCpid[5] * r;
619  }
620 
621 }
622 
630 void AliAnalysisTaskNucleiYield::SetTOFBins(Int_t nbins, Float_t min, Float_t max) {
631  fTOFnBins = nbins;
632  fTOFlowBoundary = min;
633  fTOFhighBoundary = max;
634 }
635 
642 void AliAnalysisTaskNucleiYield::SetDCAzBins(Int_t nbins, Float_t limit) {
643  fDCAzNbins = nbins;
644  fDCAzLimit = limit;
645 }
646 
652 void AliAnalysisTaskNucleiYield::SetParticleType(AliPID::EParticleType part) {
653  fParticle = part;
654  fPDGMass = AliPID::ParticleMass(part);
655  fPDGMassOverZ = AliPID::ParticleMassZ(part);
656 }
657 
668  if (fFlatteningProbs.GetSize() <= 0) {
669  Float_t prob[13] = {
670  0.839266,0.822364,0.807522,0.804727,0.806675,
671  0.828297,0.820842,0.834088,0.861455,1.,
672  0.38112,0.661154,0.953928
673  };
674  fFlatteningProbs.Set(13, prob);
675  }
676  if (!fIsMC) {
677  if (cent >= fFlatteningProbs.GetSize()) return kFALSE;
678  else return gRandom->Rndm() > fFlatteningProbs[int(cent)];
679  } else {
680  // This flattening is required since a strange peak in VOM distribution is observed in MC
681  return (cent < 1) && gRandom->Rndm() > 0.35;
682  }
683 }
684 
691 void AliAnalysisTaskNucleiYield::PtCorrection(float &pt, bool positiveCharge) {
692  Float_t *par = (positiveCharge) ? fPtCorrectionM.GetArray() : fPtCorrectionA.GetArray();
693  const Float_t correction = par[0] + par[1] * TMath::Exp(par[2] * pt);
694  pt -= correction;
695 }
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.
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)
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)