AliPhysics  vAN-20150630 (513c479)
 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 ,fDisableITSatHighPt(100.f)
91 ,fDisableTPCpidAtHighPt(100.f)
92 ,fEnablePerformance(kFALSE)
93 ,fEnablePtCorrection(kTRUE)
94 ,fRequireITSrefit(kTRUE)
95 ,fRequireTPCrefit(kTRUE)
96 ,fRequireNoKinks(kTRUE)
97 ,fRequireITSrecPoints(2u)
98 ,fRequireITSsignal(0u)
99 ,fRequireSDDrecPoints(0u)
100 ,fRequireSPDrecPoints(1u)
101 ,fRequireTPCrecPoints(70u)
102 ,fRequireTPCsignal(70u)
103 ,fRequireEtaMin(-0.8f)
104 ,fRequireEtaMax(0.8f)
105 ,fRequireYmin(-0.5f)
106 ,fRequireYmax(0.5f)
107 ,fRequireMaxChi2(4.f)
108 ,fRequireMaxDCAxy(0.5f)
109 ,fRequireMaxDCAz(1.f)
110 ,fRequireTPCpidSigmas(3.f)
111 ,fRequireITSpidSigmas(-1.f)
112 ,fRequireMinEnergyLoss(0.)
113 ,fRequireMagneticField(0)
114 ,fRequireVetoSPD(kFALSE)
115 ,fParticle(AliPID::kUnknown)
116 ,fCentBins(0x0)
117 ,fDCABins(0x0)
118 ,fPtBins(0x0)
119 ,fCustomTPCpid(0)
120 ,fFlatteningProbs(0)
121 ,fCentrality(0x0)
122 ,fFlattenedCentrality(0x0)
123 ,fCentralityClasses(0x0)
124 ,fProduction(0x0)
125 ,fAITS_TPC(0x0)
126 ,fAITS_TPC_TOF(0x0)
127 ,fATotal(0x0)
128 ,fAPtCorrection(0x0)
129 ,fMITS_TPC(0x0)
130 ,fMITS_TPC_TOF(0x0)
131 ,fMTotal(0x0)
132 ,fMPtCorrection(0x0)
133 ,fMDCAPrimaryTPC(0x0)
134 ,fMDCASecondaryTPC(0x0)
135 ,fMDCAPrimaryTOF(0x0)
136 ,fMDCASecondaryTOF(0x0)
137 ,fATOFsignal(0x0)
138 ,fATPCcounts(0x0)
139 ,fATOFphiSignal(0x0)
140 ,fATPCphiCounts(0x0)
141 ,fATPCeLoss(0x0)
142 ,fMDCAxyTPC(0x0)
143 ,fMDCAzTPC(0x0)
144 ,fMDCAxyTOF(0x0)
145 ,fMDCAzTOF(0x0)
146 ,fMTOFsignal(0x0)
147 ,fMTPCcounts(0x0)
148 ,fMTOFphiSignal(0x0)
149 ,fMTPCphiCounts(0x0)
150 ,fMTPCeLoss(0x0) {
151  gRandom->SetSeed(0); //TODO: provide a simple method to avoid "complete randomness"
152  Float_t aCorrection[3] = {-2.10154e-03,-4.53472e-01,-3.01246e+00};
153  Float_t mCorrection[3] = {-2.00277e-03,-4.93461e-01,-3.05463e+00};
154  fPtCorrectionA.Set(3, aCorrection);
155  fPtCorrectionM.Set(3,mCorrection);
156  DefineInput(0, TChain::Class());
157  DefineOutput(1, TList::Class());
158 }
159 
163  // Destructor
164 
165  if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;
166  if (fList) delete fList;
167 }
168 
173  fList = new TList();
174  fList->SetOwner(kTRUE);
175 
176  const Int_t nPtBins = fPtBins.GetSize() - 1;
177  const Int_t nCentBins = fCentBins.GetSize() - 1;
178  const Int_t nDCAbins = fDCABins.GetSize() - 1;
179  const Float_t *pTbins = fPtBins.GetArray();
180  const Float_t *centBins = fCentBins.GetArray();
181  const Float_t *dcaBins = fDCABins.GetArray();
182 
183  fCentrality = new TH1F("fCentrality",";Centrality (%);Events / 1%;",100,0.,100.);
184  fCentralityClasses = new TH1F("fCentralityClasses",";Centrality classes(%);Events / Class;",
185  nCentBins,centBins);
186  fFlattenedCentrality = new TH1F("fFlattenCentrality","After the flattening;Centrality (%); \
187  Events / 1%;",100,0.,100.);
188  fList->Add(fCentrality);
191 
192  if (fIsMC) {
193  fMTotal = new TH2F("fMTotal",";Centrality (%);p_{T} (GeV/c); Counts",
194  nCentBins,centBins,nPtBins,pTbins);
195  fATotal = new TH2F("fATotal",";Centrality (%);p_{T} (GeV/c); Counts",
196  nCentBins,centBins,nPtBins,pTbins);
197  fMITS_TPC = new TH2F("fMITS_TPC",";Centrality (%);p_{T} (GeV/c); Counts",
198  nCentBins,centBins,nPtBins,pTbins);
199  fAITS_TPC = new TH2F("fAITS_TPC",";Centrality (%);p_{T} (GeV/c); Counts",
200  nCentBins,centBins,nPtBins,pTbins);
201  fMITS_TPC_TOF = new TH2F("fMITS_TPC_TOF",";Centrality (%);p_{T} (GeV/c); Counts",
202  nCentBins,centBins,nPtBins,pTbins);
203  fAITS_TPC_TOF = new TH2F("fAITS_TPC_TOF",";Centrality (%);p_{T} (GeV/c); Counts",
204  nCentBins,centBins,nPtBins,pTbins);
205  fMDCAPrimaryTPC = new TH3F("fMDCAPrimaryTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
206  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
207  fMDCASecondaryTPC = new TH3F("fMDCASecondaryTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
208  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
209  fMDCAPrimaryTOF = new TH3F("fMDCAPrimaryTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
210  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
211  fMDCASecondaryTOF = new TH3F("fMDCASecondaryTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
212  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
213  fAPtCorrection = new TH2F("fAPtCorrection",
214  ";p_{T}^{rec} (GeV/c);p_{T}^{MC}-p_{T}^{rec} (GeV/c);Entries",
215  160,0.4,6.,80,-1.,1.);
216  fMPtCorrection = new TH2F("fMPtCorrection",
217  ";p_{T}^{rec} (GeV/c);p_{T}^{MC}-p_{T}^{rec} (GeV/c);Entries",
218  160,0.4,6.,80,-1.,1.);
219  fProduction = new TH1F("fProduction",";p (GeV/c);Entries",100,-10,10);
220 
221  fList->Add(fProduction);
222  fList->Add(fMTotal);
223  fList->Add(fATotal);
224  fList->Add(fMITS_TPC);
225  fList->Add(fAITS_TPC);
226  fList->Add(fMITS_TPC_TOF);
227  fList->Add(fAITS_TPC_TOF);
228  fList->Add(fMDCAPrimaryTPC);
229  fList->Add(fMDCASecondaryTPC);
230  fList->Add(fMDCAPrimaryTOF);
231  fList->Add(fMDCASecondaryTOF);
232  fList->Add(fAPtCorrection);
233  fList->Add(fMPtCorrection);
234 
235  } else {
236 
237  float tofBins[fTOFnBins + 1];
238  const float deltaTOF = (fTOFhighBoundary - fTOFlowBoundary) / fTOFnBins;
239  for (int i = 0; i <= fTOFnBins; ++i)
240  tofBins[i] = i * deltaTOF + fTOFlowBoundary;
241  float dcazBins[fDCAzNbins + 1];
242  const float deltaDCAz = 2.f * fDCAzLimit / fDCAzNbins;
243  for (int i = 0; i <= fDCAzNbins; ++i)
244  dcazBins[i] = i * deltaDCAz - fDCAzLimit;
245  const int nTpcBins = 40;
246  float tpcBins[nTpcBins + 1];
247  for (int i = 0; i <= nTpcBins; ++i) {
248  tpcBins[i] = -4.f + i * 0.2f;
249  }
250 
251  fATOFsignal = new TH3F("fATOFsignal",
252  ";Centrality (%);p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
253  nCentBins,centBins,nPtBins,pTbins,fTOFnBins,tofBins);
254  fATPCcounts = new TH2F("fATPCcounts",";Centrality (%);p_{T} (GeV/c); Entries",
255  nCentBins,centBins,nPtBins,pTbins);
256  fATOFphiSignal = new TH3F("fATOFphiSignal",
257  ";#phi;p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
258  64,0.,TMath::TwoPi(),36,0.2,2.,
260  fATPCphiCounts = new TH2F("fATPCphiCounts",";#phi;p_{T} (GeV/c);Counts",64,0.,TMath::TwoPi(),
261  36,0.2,2.);
262  fATPCeLoss = new TH2F("fATPCeLoss",";p (GeV/c);TPC dE/dx (a.u.);Entries",200,0.2,10.,
263  800,0,3200);
264  fMDCAxyTPC = new TH3F("fMDCAxyTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
265  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
266  fMDCAzTPC = new TH3F("fMDCAzTPC",";Centrality (%);p_{T} (GeV/c); DCA_{z} (cm)",
267  nCentBins,centBins,nPtBins,pTbins,fDCAzNbins,dcazBins);
268  fMDCAxyTOF = new TH3F("fMDCAxyTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
269  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
270  fMDCAzTOF = new TH3F("fMDCAzTOF",";Centrality (%);p_{T} (GeV/c); DCA_{z} (cm)",
271  nCentBins,centBins,nPtBins,pTbins,fDCAzNbins,dcazBins);
272  fMTOFsignal = new TH3F("fMTOFsignal",
273  ";Centrality (%);p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
274  nCentBins,centBins,nPtBins,pTbins,fTOFnBins,tofBins);
275  fMTPCcounts = new TH2F("fMTPCcounts",";Centrality (%);p_{T} (GeV/c); Entries",
276  nCentBins,centBins,nPtBins,pTbins);
277  fMTPCeLoss = new TH2F("fMTPCeLoss",";p (GeV/c);TPC dE/dx (a.u.);Entries",200,0.2,10.,
278  800,0,3200);
279  fMTOFphiSignal = new TH3F("fMTOFphiSignal",
280  ";#phi;p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
281  64,0.,TMath::TwoPi(),36,0.2,2.,
283  fMTPCphiCounts = new TH2F("fMTPCphiCounts",";#phi;p_{T} (GeV/c);Counts",64,0.,TMath::TwoPi(),
284  36,0.2,2.);
285 
288 
289  fList->Add(fATOFsignal);
290  fList->Add(fATPCcounts);
294  fList->Add(fMDCAxyTPC);
295  fList->Add(fMDCAzTPC);
296  fList->Add(fMDCAxyTOF);
297  fList->Add(fMDCAzTOF);
298  fList->Add(fMTOFsignal);
299  fList->Add(fMTPCcounts);
303  }
304 
305  PostData(1,fList);
306 }
307 
316  if (fParticle == AliPID::kUnknown) {
317  ::Error("AliAnalysisTaskNucleiYield::UserExec", "No particle type set");
318  PostData(1, fList);
319  return;
320  }
321 
324  AliVEvent *ev = dynamic_cast<AliVEvent*> (InputEvent());
325  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
326  AliInputEventHandler* handl = (AliInputEventHandler*)mgr->GetInputEventHandler();
327 
330  UInt_t mask = handl->IsEventSelected();
331  if (!(mask & 0xffffffff)) {
332  PostData(1, fList);
333  return;
334  }
335 
338  if (!((mask & AliVEvent::kMB) || (mask & AliVEvent::kCentral) ||
339  (mask & AliVEvent::kSemiCentral))) {
340  PostData(1, fList);
341  return;
342  }
343 
346  fPID = handl->GetPIDResponse();
347 
349  AliCentrality *centr = ev->GetCentrality();
350  float centrality = centr->GetCentralityPercentile("V0M");
352  if (centrality < 0. || centrality > 80.) {
353  PostData(1, fList);
354  return;
355  }
356 
359  fPrimaryVertex = (AliVVertex*)ev->GetPrimaryVertex();
360  if(TMath::Abs(fPrimaryVertex->GetZ()) > 10.) {
361  PostData(1, fList);
362  return;
363  }
364 
367  fMagField = ev->GetMagneticField();
369  PostData(1, fList);
370  return;
371  }
372 
377  fCentrality->Fill(centrality);
378  if (Flatten(centrality)) {
379  PostData(1, fList);
380  return;
381  }
382  fCentralityClasses->Fill(centrality);
383  fFlattenedCentrality->Fill(centrality);
384 
385  TClonesArray *stack = 0x0;
386  if (fIsMC) {
387  // get branch "mcparticles"
388  stack = (TClonesArray*)ev->GetList()->FindObject(AliAODMCParticle::StdBranchName());
389  if (!stack) {
390  PostData(1, fList);
391  return;
392  }
393 
395  fMmc.SetOwner(kFALSE);
396  fAmc.SetOwner(kFALSE);
397  for (int iMC = 0; iMC < stack->GetEntriesFast(); ++iMC) {
398  AliAODMCParticle *part = (AliAODMCParticle*)stack->UncheckedAt(iMC);
399  const int pdg = part->GetPdgCode();
400  if (pdg == fPDG) fProduction->Fill(part->P());
401  else if (pdg == -fPDG) fProduction->Fill(-part->P());
402  if (part->Y() > fRequireYmax || part->Y() < fRequireYmin) continue;
403  if (pdg == fPDG) {
404  if (part->IsPhysicalPrimary()) fMTotal->Fill(centrality,part->Pt());
405  fMmc.Add(part);
406  } else if (pdg == -fPDG) {
407  if (part->IsPhysicalPrimary()) fATotal->Fill(centrality,part->Pt());
408  fAmc.Add(part);
409  }
410  }
411  }
412 
414  for (Int_t iT = 0; iT < (Int_t)ev->GetNumberOfTracks(); ++iT) {
415  AliAODTrack *track = dynamic_cast<AliAODTrack*>(ev->GetTrack(iT));
416  if (track->GetID() <= 0) continue;
417  Double_t dca[2];
418  if (!AcceptTrack(track,dca)) continue;
419  const float beta = HasTOF(track);
420  float pT = track->Pt();
421  if (fEnablePtCorrection) PtCorrection(pT,track->Charge() > 0);
422  if (fIsMC) {
423  AliAODMCParticle *part = (AliAODMCParticle*)stack->At(TMath::Abs(track->GetLabel()));
424  if (!part) continue;
425  if (part->GetPdgCode() == fPDG) {
426  if (part->IsPhysicalPrimary()) {
427  fMITS_TPC->Fill(centrality,pT);
428  fMDCAPrimaryTPC->Fill(centrality,part->Pt(),dca[0]);
429  } else fMDCASecondaryTPC->Fill(centrality,part->Pt(),dca[0]);
430  fMPtCorrection->Fill(pT,part->Pt() - pT);
431  if (beta > 0) {
432  if (part->IsPhysicalPrimary()) {
433  fMDCAPrimaryTOF->Fill(centrality,part->Pt(),dca[0]);
434  fMITS_TPC_TOF->Fill(centrality,part->Pt());
435  } else {
436  fMDCASecondaryTOF->Fill(centrality,part->Pt(),dca[0]);
437  }
438  }
439  } else if (part->GetPdgCode() == -fPDG) {
440  fAPtCorrection->Fill(pT,part->Pt() - pT);
441  if (part->IsPhysicalPrimary()) {
442  fAITS_TPC->Fill(centrality,part->Pt());
443  if (beta > 0) fAITS_TPC_TOF->Fill(centrality,part->Pt());
444  }
445  }
446  } else {
447  if (track->Charge() > 0) {
448  fMTPCeLoss->Fill(track->GetTPCmomentum(),track->GetTPCsignal());
449  } else {
450  fATPCeLoss->Fill(track->GetTPCmomentum(),track->GetTPCsignal());
451  }
452  if (!PassesPIDSelection(track)) continue;
453  if (track->Charge() > 0) {
454  fMDCAxyTPC->Fill(centrality, pT, dca[0]);
455  fMDCAzTPC->Fill(centrality, pT, dca[1]);
456  fMTPCcounts->Fill(centrality, pT);
457  fMTPCphiCounts->Fill(track->Phi(),pT);
458  } else {
459  fATPCphiCounts->Fill(track->Phi(),pT);
460  fATPCcounts->Fill(centrality, pT);
461  }
462  if (beta < 0) continue;
464  const float m = track->GetTPCmomentum() * (TMath::Sqrt(1.f - beta * beta) / beta);
465  if (track->Charge() > 0) {
466  fMDCAxyTOF->Fill(centrality, pT, dca[0]);
467  fMDCAzTOF->Fill(centrality, pT, dca[1]);
468  fMTOFsignal->Fill(centrality, pT, m * m - fPDGMassOverZ * fPDGMassOverZ);
469  fMTOFphiSignal->Fill(track->Phi(),pT,m * m - fPDGMassOverZ * fPDGMassOverZ);
470  } else {
471  fATOFsignal->Fill(centrality, pT, m * m - fPDGMassOverZ * fPDGMassOverZ);
472  fATOFphiSignal->Fill(track->Phi(),pT,m * m - fPDGMassOverZ * fPDGMassOverZ);
473  }
474  }
475 
476  } // End AOD track loop
477 
478  fAmc.Clear();
479  fMmc.Clear();
480 
481  // Post output data.
482  PostData(1,fList);
483 }
484 
490  return;
491 }
492 
500 Bool_t AliAnalysisTaskNucleiYield::AcceptTrack(AliAODTrack *track, Double_t dca[2]) {
501  ULong_t status = track->GetStatus();
502  if (!(status & AliVTrack::kTPCrefit) && fRequireTPCrefit) return kFALSE;
503  if (track->Eta() < fRequireEtaMin || track->Eta() > fRequireEtaMax) return kFALSE;
504  if (track->Y(fPDGMass) < fRequireYmin || track->Y(fPDGMass) > fRequireYmax) return kFALSE;
505  AliAODVertex *vtx1 = (AliAODVertex*)track->GetProdVertex();
506  if(Int_t(vtx1->GetType()) == AliAODVertex::kKink && fRequireNoKinks) return kFALSE;
507  if (track->Chi2perNDF() > fRequireMaxChi2) return kFALSE;
508  if (track->GetTPCsignal() < fRequireMinEnergyLoss) return kFALSE;
509 
511  dca[0] = 0.;
512  dca[1] = 0.;
513  if (track->Pt() < fDisableITSatHighPt) {
514  unsigned int nSPD = 0, nITS = 0, nSDD = 0;
515  for (int i = 0; i < 6; ++i) {
516  if (track->HasPointOnITSLayer(i)) {
517  if (i < 2) nSPD++;
518  else if (i < 4) nSDD++;
519  nITS++;
520  }
521  }
522  if (!(status & AliVTrack::kITSrefit) && fRequireITSrefit) return kFALSE;
523  if (nITS < fRequireITSrecPoints) return kFALSE;
524  if (nSPD < fRequireSPDrecPoints) return kFALSE;
525  if (nSDD < fRequireSDDrecPoints) return kFALSE;
526  if (fRequireVetoSPD && nSPD > 0) return kFALSE;
527  Double_t cov[3];
528  if (!track->PropagateToDCA(fPrimaryVertex, fMagField, 100, dca, cov)) return kFALSE;
529  if (TMath::Abs(dca[0]) > fRequireMaxDCAxy) return kFALSE;
530  if (TMath::Abs(dca[1]) > fRequireMaxDCAz) return kFALSE;
531  }
532 
533  return kTRUE;
534 }
535 
541 Float_t AliAnalysisTaskNucleiYield::HasTOF(AliAODTrack *track) {
542  Bool_t hasTOFout = track->GetStatus() & AliVTrack::kTOFout;
543  Bool_t hasTOFtime = track->GetStatus() & AliVTrack::kTIME;
544  const float len = track->GetIntegratedLength();
545  Bool_t hasTOF = Bool_t(hasTOFout & hasTOFtime) && len > 350.f;
546 
547  if (!hasTOF) return -1.;
548  const float p = track->GetTPCmomentum();
549  const float tim = track->GetTOFsignal() - fPID->GetTOFResponse().GetStartTime(p);
550  if (tim < len / LIGHT_SPEED) return -1.;
551  else {
552  const float beta = len / (tim * LIGHT_SPEED);
553  if (beta < EPS || beta > (1. - EPS))
554  return -1.f;
555  else
556  return beta;
557  }
558 }
559 
566 void AliAnalysisTaskNucleiYield::SetCentBins(Int_t nbins, Float_t *bins) {
567  fCentBins.Set(nbins + 1, bins);
568 }
569 
576 void AliAnalysisTaskNucleiYield::SetDCABins(Int_t nbins, Float_t min, Float_t max) {
577  const float delta = (max - min) / nbins;
578  fDCABins.Set(nbins + 1);
579  for (int iB = 0; iB < nbins; ++iB) {
580  fDCABins[iB] = min + iB * delta;
581  }
582  fDCABins[nbins] = max;
583 }
584 
591 void AliAnalysisTaskNucleiYield::SetPtBins(Int_t nbins, Float_t *bins) {
592  fPtBins.Set(nbins + 1, bins);
593 }
594 
601 void AliAnalysisTaskNucleiYield::SetCustomTPCpid(Float_t *par, Float_t sigma) {
602  if (par == 0x0 && sigma <= 0) {
603  fCustomTPCpid.Set(1);
604  } else {
605  fCustomTPCpid.Set(6);
606  for (int i = 0; i < 5; ++i)
607  fCustomTPCpid.AddAt(par[i],i);
608  fCustomTPCpid.AddAt(sigma, 5);
609  }
610 }
611 
619  bool itsPID = kTRUE, tpcPID = kTRUE;
620  if (fRequireITSpidSigmas > 0 && t->Pt() < fDisableITSatHighPt) {
621  AliITSPIDResponse &itsPidResp = fPID->GetITSResponse();
622  itsPID = TMath::Abs(itsPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireITSpidSigmas;
623  }
624 
625  if (t->Pt() < fDisableTPCpidAtHighPt) {
626  if (fCustomTPCpid.GetSize() < 6 || fIsMC) {
627  AliTPCPIDResponse &tpcPidResp = fPID->GetTPCResponse();
628  tpcPID = TMath::Abs(tpcPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireTPCpidSigmas;
629  } else {
630  const float p = t->GetTPCmomentum() / fPDGMassOverZ;
631  const float r = AliExternalTrackParam::BetheBlochAleph(p, fCustomTPCpid[0], fCustomTPCpid[1],
633  fCustomTPCpid[4]);
634  tpcPID = TMath::Abs(t->GetTPCsignal() - r) < fRequireTPCpidSigmas * fCustomTPCpid[5] * r;
635  }
636  }
637 
638  return itsPID && tpcPID;
639 }
640 
648 void AliAnalysisTaskNucleiYield::SetTOFBins(Int_t nbins, Float_t min, Float_t max) {
649  fTOFnBins = nbins;
650  fTOFlowBoundary = min;
651  fTOFhighBoundary = max;
652 }
653 
660 void AliAnalysisTaskNucleiYield::SetDCAzBins(Int_t nbins, Float_t limit) {
661  fDCAzNbins = nbins;
662  fDCAzLimit = limit;
663 }
664 
670 void AliAnalysisTaskNucleiYield::SetParticleType(AliPID::EParticleType part) {
671  fParticle = part;
672  fPDGMass = AliPID::ParticleMass(part);
673  fPDGMassOverZ = AliPID::ParticleMassZ(part);
674 }
675 
686  if (fFlatteningProbs.GetSize() <= 0) {
687  Float_t prob[13] = {
688  0.839266,0.822364,0.807522,0.804727,0.806675,
689  0.828297,0.820842,0.834088,0.861455,1.,
690  0.38112,0.661154,0.953928
691  };
692  fFlatteningProbs.Set(13, prob);
693  }
694  if (!fIsMC) {
695  if (cent >= fFlatteningProbs.GetSize()) return kFALSE;
696  else return gRandom->Rndm() > fFlatteningProbs[int(cent)];
697  } else {
698  // This flattening is required since a strange peak in VOM distribution is observed in MC
699  return (cent < 1) && gRandom->Rndm() > 0.35;
700  }
701 }
702 
709 void AliAnalysisTaskNucleiYield::PtCorrection(float &pt, bool positiveCharge) {
710  Float_t *par = (positiveCharge) ? fPtCorrectionM.GetArray() : fPtCorrectionA.GetArray();
711  const Float_t correction = par[0] + par[1] * TMath::Exp(par[2] * pt);
712  pt -= correction;
713 }
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
Float_t fDisableTPCpidAtHighPt
threshold for TPC pid cut
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 fDisableITSatHighPt
threshold for ITS cuts
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)