AliPhysics  vAN-20151012 (2287573)
 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 ,fFixForLHC14a6(kTRUE)
116 ,fParticle(AliPID::kUnknown)
117 ,fCentBins(0x0)
118 ,fDCABins(0x0)
119 ,fPtBins(0x0)
120 ,fCustomTPCpid(0)
121 ,fFlatteningProbs(0)
122 ,fCentrality(0x0)
123 ,fFlattenedCentrality(0x0)
124 ,fCentralityClasses(0x0)
125 ,fProduction(0x0)
126 ,fAITS_TPC(0x0)
127 ,fAITS_TPC_TOF(0x0)
128 ,fATotal(0x0)
129 ,fAPtCorrection(0x0)
130 ,fMITS_TPC(0x0)
131 ,fMITS_TPC_TOF(0x0)
132 ,fMTotal(0x0)
133 ,fMPtCorrection(0x0)
134 ,fMDCAPrimaryTPC(0x0)
135 ,fMDCASecondaryTPC(0x0)
136 ,fMDCAPrimaryTOF(0x0)
137 ,fMDCASecondaryTOF(0x0)
138 ,fATOFsignal(0x0)
139 ,fATPCcounts(0x0)
140 ,fATOFphiSignal(0x0)
141 ,fATPCphiCounts(0x0)
142 ,fATPCeLoss(0x0)
143 ,fMDCAxyTPC(0x0)
144 ,fMDCAzTPC(0x0)
145 ,fMDCAxyTOF(0x0)
146 ,fMDCAzTOF(0x0)
147 ,fMTOFsignal(0x0)
148 ,fMTPCcounts(0x0)
149 ,fMTOFphiSignal(0x0)
150 ,fMTPCphiCounts(0x0)
151 ,fMTPCeLoss(0x0) {
152  gRandom->SetSeed(0); //TODO: provide a simple method to avoid "complete randomness"
153  Float_t aCorrection[3] = {-2.10154e-03,-4.53472e-01,-3.01246e+00};
154  Float_t mCorrection[3] = {-2.00277e-03,-4.93461e-01,-3.05463e+00};
155  fPtCorrectionA.Set(3, aCorrection);
156  fPtCorrectionM.Set(3,mCorrection);
157  DefineInput(0, TChain::Class());
158  DefineOutput(1, TList::Class());
159 }
160 
164  if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;
165  if (fList) delete fList;
166 }
167 
172  fList = new TList();
173  fList->SetOwner(kTRUE);
174 
175  const Int_t nPtBins = fPtBins.GetSize() - 1;
176  const Int_t nCentBins = fCentBins.GetSize() - 1;
177  const Int_t nDCAbins = fDCABins.GetSize() - 1;
178  const Float_t *pTbins = fPtBins.GetArray();
179  const Float_t *centBins = fCentBins.GetArray();
180  const Float_t *dcaBins = fDCABins.GetArray();
181 
182  fCentrality = new TH1F("fCentrality",";Centrality (%);Events / 1%;",100,0.,100.);
183  fCentralityClasses = new TH1F("fCentralityClasses",";Centrality classes(%);Events / Class;",
184  nCentBins,centBins);
185  fFlattenedCentrality = new TH1F("fFlattenCentrality","After the flattening;Centrality (%); \
186  Events / 1%;",100,0.,100.);
187  fList->Add(fCentrality);
190 
191  if (fIsMC) {
192  fMTotal = new TH2F("fMTotal",";Centrality (%);p_{T} (GeV/c); Counts",
193  nCentBins,centBins,nPtBins,pTbins);
194  fATotal = new TH2F("fATotal",";Centrality (%);p_{T} (GeV/c); Counts",
195  nCentBins,centBins,nPtBins,pTbins);
196  fMITS_TPC = new TH2F("fMITS_TPC",";Centrality (%);p_{T} (GeV/c); Counts",
197  nCentBins,centBins,nPtBins,pTbins);
198  fAITS_TPC = new TH2F("fAITS_TPC",";Centrality (%);p_{T} (GeV/c); Counts",
199  nCentBins,centBins,nPtBins,pTbins);
200  fMITS_TPC_TOF = new TH2F("fMITS_TPC_TOF",";Centrality (%);p_{T} (GeV/c); Counts",
201  nCentBins,centBins,nPtBins,pTbins);
202  fAITS_TPC_TOF = new TH2F("fAITS_TPC_TOF",";Centrality (%);p_{T} (GeV/c); Counts",
203  nCentBins,centBins,nPtBins,pTbins);
204  fMDCAPrimaryTPC = new TH3F("fMDCAPrimaryTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
205  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
206  fMDCASecondaryTPC = new TH3F("fMDCASecondaryTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
207  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
208  fMDCAPrimaryTOF = new TH3F("fMDCAPrimaryTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
209  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
210  fMDCASecondaryTOF = new TH3F("fMDCASecondaryTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
211  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
212  fAPtCorrection = new TH2F("fAPtCorrection",
213  ";p_{T}^{rec} (GeV/c);p_{T}^{MC}-p_{T}^{rec} (GeV/c);Entries",
214  160,0.4,6.,80,-1.,1.);
215  fMPtCorrection = new TH2F("fMPtCorrection",
216  ";p_{T}^{rec} (GeV/c);p_{T}^{MC}-p_{T}^{rec} (GeV/c);Entries",
217  160,0.4,6.,80,-1.,1.);
218  fProduction = new TH1F("fProduction",";p (GeV/c);Entries",100,-10,10);
219 
220  fList->Add(fProduction);
221  fList->Add(fMTotal);
222  fList->Add(fATotal);
223  fList->Add(fMITS_TPC);
224  fList->Add(fAITS_TPC);
225  fList->Add(fMITS_TPC_TOF);
226  fList->Add(fAITS_TPC_TOF);
227  fList->Add(fMDCAPrimaryTPC);
228  fList->Add(fMDCASecondaryTPC);
229  fList->Add(fMDCAPrimaryTOF);
230  fList->Add(fMDCASecondaryTOF);
231  fList->Add(fAPtCorrection);
232  fList->Add(fMPtCorrection);
233 
234  } else {
235 
236  float tofBins[fTOFnBins + 1];
237  const float deltaTOF = (fTOFhighBoundary - fTOFlowBoundary) / fTOFnBins;
238  for (int i = 0; i <= fTOFnBins; ++i)
239  tofBins[i] = i * deltaTOF + fTOFlowBoundary;
240  float dcazBins[fDCAzNbins + 1];
241  const float deltaDCAz = 2.f * fDCAzLimit / fDCAzNbins;
242  for (int i = 0; i <= fDCAzNbins; ++i)
243  dcazBins[i] = i * deltaDCAz - fDCAzLimit;
244  const int nTpcBins = 40;
245  float tpcBins[nTpcBins + 1];
246  for (int i = 0; i <= nTpcBins; ++i) {
247  tpcBins[i] = -4.f + i * 0.2f;
248  }
249 
250  fATOFsignal = new TH3F("fATOFsignal",
251  ";Centrality (%);p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
252  nCentBins,centBins,nPtBins,pTbins,fTOFnBins,tofBins);
253  fATPCcounts = new TH2F("fATPCcounts",";Centrality (%);p_{T} (GeV/c); Entries",
254  nCentBins,centBins,nPtBins,pTbins);
255  fATOFphiSignal = new TH3F("fATOFphiSignal",
256  ";#phi;p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
257  64,0.,TMath::TwoPi(),36,0.2,2.,
259  fATPCphiCounts = new TH2F("fATPCphiCounts",";#phi;p_{T} (GeV/c);Counts",64,0.,TMath::TwoPi(),
260  36,0.2,2.);
261  fATPCeLoss = new TH2F("fATPCeLoss",";p (GeV/c);TPC dE/dx (a.u.);Entries",200,0.2,10.,
262  800,0,3200);
263  fMDCAxyTPC = new TH3F("fMDCAxyTPC",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
264  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
265  fMDCAzTPC = new TH3F("fMDCAzTPC",";Centrality (%);p_{T} (GeV/c); DCA_{z} (cm)",
266  nCentBins,centBins,nPtBins,pTbins,fDCAzNbins,dcazBins);
267  fMDCAxyTOF = new TH3F("fMDCAxyTOF",";Centrality (%);p_{T} (GeV/c); DCA_{xy} (cm)",
268  nCentBins,centBins,nPtBins,pTbins,nDCAbins,dcaBins);
269  fMDCAzTOF = new TH3F("fMDCAzTOF",";Centrality (%);p_{T} (GeV/c); DCA_{z} (cm)",
270  nCentBins,centBins,nPtBins,pTbins,fDCAzNbins,dcazBins);
271  fMTOFsignal = new TH3F("fMTOFsignal",
272  ";Centrality (%);p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
273  nCentBins,centBins,nPtBins,pTbins,fTOFnBins,tofBins);
274  fMTPCcounts = new TH2F("fMTPCcounts",";Centrality (%);p_{T} (GeV/c); Entries",
275  nCentBins,centBins,nPtBins,pTbins);
276  fMTPCeLoss = new TH2F("fMTPCeLoss",";p (GeV/c);TPC dE/dx (a.u.);Entries",200,0.2,10.,
277  800,0,3200);
278  fMTOFphiSignal = new TH3F("fMTOFphiSignal",
279  ";#phi;p_{T} (GeV/c);m_{TOF}^{2}-m_{PDG}^{2} (GeV/c^{2})^{2}",
280  64,0.,TMath::TwoPi(),36,0.2,2.,
282  fMTPCphiCounts = new TH2F("fMTPCphiCounts",";#phi;p_{T} (GeV/c);Counts",64,0.,TMath::TwoPi(),
283  36,0.2,2.);
284 
287 
288  fList->Add(fATOFsignal);
289  fList->Add(fATPCcounts);
293  fList->Add(fMDCAxyTPC);
294  fList->Add(fMDCAzTPC);
295  fList->Add(fMDCAxyTOF);
296  fList->Add(fMDCAzTOF);
297  fList->Add(fMTOFsignal);
298  fList->Add(fMTPCcounts);
302  }
303 
304  PostData(1,fList);
305 }
306 
315  if (fParticle == AliPID::kUnknown) {
316  ::Error("AliAnalysisTaskNucleiYield::UserExec", "No particle type set");
317  PostData(1, fList);
318  return;
319  }
320 
323  AliVEvent *ev = dynamic_cast<AliVEvent*> (InputEvent());
324  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
325  AliInputEventHandler* handl = (AliInputEventHandler*)mgr->GetInputEventHandler();
326 
329  UInt_t mask = handl->IsEventSelected();
330  if (!(mask & 0xffffffff)) {
331  PostData(1, fList);
332  return;
333  }
334 
337  if (!((mask & AliVEvent::kMB) || (mask & AliVEvent::kCentral) ||
338  (mask & AliVEvent::kSemiCentral))) {
339  PostData(1, fList);
340  return;
341  }
342 
345  fPID = handl->GetPIDResponse();
346 
348  AliCentrality *centr = ev->GetCentrality();
349  float centrality = centr->GetCentralityPercentile("V0M");
352  PostData(1, fList);
353  return;
354  }
355 
358  fPrimaryVertex = (AliVVertex*)ev->GetPrimaryVertex();
359  if(TMath::Abs(fPrimaryVertex->GetZ()) > 10.) {
360  PostData(1, fList);
361  return;
362  }
363 
366  fMagField = ev->GetMagneticField();
368  PostData(1, fList);
369  return;
370  }
371 
376 
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::SetDCABins(Int_t nbins, Float_t *bins) {
592  fDCABins.Set(nbins + 1, bins);
593 }
594 
601 void AliAnalysisTaskNucleiYield::SetPtBins(Int_t nbins, Float_t *bins) {
602  fPtBins.Set(nbins + 1, bins);
603 }
604 
612  if (par == 0x0 && sigma <= 0) {
613  fCustomTPCpid.Set(1);
614  } else {
615  fCustomTPCpid.Set(6);
616  for (int i = 0; i < 5; ++i)
617  fCustomTPCpid.AddAt(par[i],i);
618  fCustomTPCpid.AddAt(sigma, 5);
619  }
620 }
621 
629  bool itsPID = kTRUE, tpcPID = kTRUE;
630  if (fRequireITSpidSigmas > 0 && t->Pt() < fDisableITSatHighPt) {
631  AliITSPIDResponse &itsPidResp = fPID->GetITSResponse();
632  itsPID = TMath::Abs(itsPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireITSpidSigmas;
633  }
634 
635  if (t->Pt() < fDisableTPCpidAtHighPt) {
636  if (fCustomTPCpid.GetSize() < 6 || fIsMC) {
637  AliTPCPIDResponse &tpcPidResp = fPID->GetTPCResponse();
638  tpcPID = TMath::Abs(tpcPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireTPCpidSigmas;
639  } else {
640  const float p = t->GetTPCmomentum() / fPDGMassOverZ;
641  const float r = AliExternalTrackParam::BetheBlochAleph(p, fCustomTPCpid[0], fCustomTPCpid[1],
643  fCustomTPCpid[4]);
644  tpcPID = TMath::Abs(t->GetTPCsignal() - r) < fRequireTPCpidSigmas * fCustomTPCpid[5] * r;
645  }
646  }
647 
648  return itsPID && tpcPID;
649 }
650 
658 void AliAnalysisTaskNucleiYield::SetTOFBins(Int_t nbins, Float_t min, Float_t max) {
659  fTOFnBins = nbins;
660  fTOFlowBoundary = min;
661  fTOFhighBoundary = max;
662 }
663 
670 void AliAnalysisTaskNucleiYield::SetDCAzBins(Int_t nbins, Float_t limit) {
671  fDCAzNbins = nbins;
672  fDCAzLimit = limit;
673 }
674 
680 void AliAnalysisTaskNucleiYield::SetParticleType(AliPID::EParticleType part) {
681  fParticle = part;
682  fPDGMass = AliPID::ParticleMass(part);
683  fPDGMassOverZ = AliPID::ParticleMassZ(part);
684 }
685 
696  if (fFlatteningProbs.GetSize() <= 0) {
697  Float_t prob[13] = {
698  0.839266,0.822364,0.807522,0.804727,0.806675,
699  0.828297,0.820842,0.834088,0.861455,1.,
700  0.38112,0.661154,0.953928
701  };
702  fFlatteningProbs.Set(13, prob);
703  }
704  if (!fIsMC) {
705  if (cent >= fFlatteningProbs.GetSize()) return kFALSE;
706  else return gRandom->Rndm() > fFlatteningProbs[int(cent)];
707  } else {
708  // This flattening is required since a strange peak in VOM distribution is observed in MC
709  if (fFixForLHC14a6) {
710  if (cent < 1.5e-3f) {
711  return true;
712  } else if (cent < 0.05 && gRandom->Rndm() < 0.5) {
713  return true;
714  }
715  }
716  }
717  return false;
718 }
719 
726 void AliAnalysisTaskNucleiYield::PtCorrection(float &pt, bool positiveCharge) {
727  Float_t *par = (positiveCharge) ? fPtCorrectionM.GetArray() : fPtCorrectionA.GetArray();
728  const Float_t correction = par[0] + par[1] * TMath::Exp(par[2] * pt);
729  pt -= correction;
730 }
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
Int_t pdg
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
centrality
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.
TRandom * gRandom
TH2F * fAPtCorrection
! *(MC only)* as a function of for anti-matter
void SetParticleType(AliPID::EParticleType part)
Double_t * sigma
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.
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
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
const Int_t nbins
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)
const Int_t nPtBins
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.
Bool_t fFixForLHC14a6
Cut away all the tracks with at least 1 SPD cluster.
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)