AliPhysics  29d4213 (29d4213)
 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 ,fRequireMaxMomentum(-1.)
116 ,fFixForLHC14a6(kTRUE)
117 ,fParticle(AliPID::kUnknown)
118 ,fCentBins(0x0)
119 ,fDCABins(0x0)
120 ,fPtBins(0x0)
121 ,fCustomTPCpid(0)
122 ,fFlatteningProbs(0)
123 ,fCentrality(0x0)
124 ,fFlattenedCentrality(0x0)
125 ,fCentralityClasses(0x0)
126 ,fProduction(0x0)
127 ,fAITS_TPC(0x0)
128 ,fAITS_TPC_TOF(0x0)
129 ,fATotal(0x0)
130 ,fAPtCorrection(0x0)
131 ,fMITS_TPC(0x0)
132 ,fMITS_TPC_TOF(0x0)
133 ,fMTotal(0x0)
134 ,fMPtCorrection(0x0)
135 ,fMDCAPrimaryTPC(0x0)
136 ,fMDCASecondaryTPC(0x0)
137 ,fMDCAPrimaryTOF(0x0)
138 ,fMDCASecondaryTOF(0x0)
139 ,fATOFsignal(0x0)
140 ,fATPCcounts(0x0)
141 ,fATOFphiSignal(0x0)
142 ,fATPCphiCounts(0x0)
143 ,fATPCeLoss(0x0)
144 ,fMDCAxyTPC(0x0)
145 ,fMDCAzTPC(0x0)
146 ,fMDCAxyTOF(0x0)
147 ,fMDCAzTOF(0x0)
148 ,fMTOFsignal(0x0)
149 ,fMTPCcounts(0x0)
150 ,fMTOFphiSignal(0x0)
151 ,fMTPCphiCounts(0x0)
152 ,fMTPCeLoss(0x0) {
153  gRandom->SetSeed(0); //TODO: provide a simple method to avoid "complete randomness"
154  Float_t aCorrection[3] = {-2.10154e-03,-4.53472e-01,-3.01246e+00};
155  Float_t mCorrection[3] = {-2.00277e-03,-4.93461e-01,-3.05463e+00};
156  fPtCorrectionA.Set(3, aCorrection);
157  fPtCorrectionM.Set(3,mCorrection);
158  DefineInput(0, TChain::Class());
159  DefineOutput(1, TList::Class());
160 }
161 
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");
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 
378  fCentrality->Fill(centrality);
379  if (Flatten(centrality)) {
380  PostData(1, fList);
381  return;
382  }
383  fCentralityClasses->Fill(centrality);
384  fFlattenedCentrality->Fill(centrality);
385 
386  TClonesArray *stack = 0x0;
387  if (fIsMC) {
388  // get branch "mcparticles"
389  stack = (TClonesArray*)ev->GetList()->FindObject(AliAODMCParticle::StdBranchName());
390  if (!stack) {
391  PostData(1, fList);
392  return;
393  }
394 
396  fMmc.SetOwner(kFALSE);
397  fAmc.SetOwner(kFALSE);
398  for (int iMC = 0; iMC < stack->GetEntriesFast(); ++iMC) {
399  AliAODMCParticle *part = (AliAODMCParticle*)stack->UncheckedAt(iMC);
400  const int pdg = part->GetPdgCode();
401  if (pdg == fPDG) fProduction->Fill(part->P());
402  else if (pdg == -fPDG) fProduction->Fill(-part->P());
403  if (part->Y() > fRequireYmax || part->Y() < fRequireYmin) continue;
404  if (pdg == fPDG) {
405  if (part->IsPhysicalPrimary()) fMTotal->Fill(centrality,part->Pt());
406  fMmc.Add(part);
407  } else if (pdg == -fPDG) {
408  if (part->IsPhysicalPrimary()) fATotal->Fill(centrality,part->Pt());
409  fAmc.Add(part);
410  }
411  }
412  }
413 
415  for (Int_t iT = 0; iT < (Int_t)ev->GetNumberOfTracks(); ++iT) {
416  AliAODTrack *track = dynamic_cast<AliAODTrack*>(ev->GetTrack(iT));
417  if (track->GetID() <= 0) continue;
418  Double_t dca[2];
419  if (!AcceptTrack(track,dca)) continue;
420  const float beta = HasTOF(track);
421  float pT = track->Pt();
422  if (fEnablePtCorrection) PtCorrection(pT,track->Charge() > 0);
423  if (fIsMC) {
424  AliAODMCParticle *part = (AliAODMCParticle*)stack->At(TMath::Abs(track->GetLabel()));
425  if (!part) continue;
426  if (part->GetPdgCode() == fPDG) {
427  if (part->IsPhysicalPrimary()) {
428  fMITS_TPC->Fill(centrality,pT);
429  fMDCAPrimaryTPC->Fill(centrality,part->Pt(),dca[0]);
430  } else fMDCASecondaryTPC->Fill(centrality,part->Pt(),dca[0]);
431  fMPtCorrection->Fill(pT,part->Pt() - pT);
432  if (beta > 0) {
433  if (part->IsPhysicalPrimary()) {
434  fMDCAPrimaryTOF->Fill(centrality,part->Pt(),dca[0]);
435  fMITS_TPC_TOF->Fill(centrality,part->Pt());
436  } else {
437  fMDCASecondaryTOF->Fill(centrality,part->Pt(),dca[0]);
438  }
439  }
440  } else if (part->GetPdgCode() == -fPDG) {
441  fAPtCorrection->Fill(pT,part->Pt() - pT);
442  if (part->IsPhysicalPrimary()) {
443  fAITS_TPC->Fill(centrality,part->Pt());
444  if (beta > 0) fAITS_TPC_TOF->Fill(centrality,part->Pt());
445  }
446  }
447  } else {
448  if (track->Charge() > 0) {
449  fMTPCeLoss->Fill(track->GetTPCmomentum(),track->GetTPCsignal());
450  } else {
451  fATPCeLoss->Fill(track->GetTPCmomentum(),track->GetTPCsignal());
452  }
453  if (!PassesPIDSelection(track)) continue;
454  if (track->Charge() > 0) {
455  fMDCAxyTPC->Fill(centrality, pT, dca[0]);
456  fMDCAzTPC->Fill(centrality, pT, dca[1]);
457  fMTPCcounts->Fill(centrality, pT);
458  fMTPCphiCounts->Fill(track->Phi(),pT);
459  } else {
460  fATPCphiCounts->Fill(track->Phi(),pT);
461  fATPCcounts->Fill(centrality, pT);
462  }
463  if (beta < 0) continue;
465  const float m = track->GetTPCmomentum() * (TMath::Sqrt(1.f - beta * beta) / beta);
466  if (track->Charge() > 0) {
467  fMDCAxyTOF->Fill(centrality, pT, dca[0]);
468  fMDCAzTOF->Fill(centrality, pT, dca[1]);
469  fMTOFsignal->Fill(centrality, pT, m * m - fPDGMassOverZ * fPDGMassOverZ);
470  fMTOFphiSignal->Fill(track->Phi(),pT,m * m - fPDGMassOverZ * fPDGMassOverZ);
471  } else {
472  fATOFsignal->Fill(centrality, pT, m * m - fPDGMassOverZ * fPDGMassOverZ);
473  fATOFphiSignal->Fill(track->Phi(),pT,m * m - fPDGMassOverZ * fPDGMassOverZ);
474  }
475  }
476 
477  } // End AOD track loop
478 
479  fAmc.Clear();
480  fMmc.Clear();
481 
482  // Post output data.
483  PostData(1,fList);
484 }
485 
491  return;
492 }
493 
501 Bool_t AliAnalysisTaskNucleiYield::AcceptTrack(AliAODTrack *track, Double_t dca[2]) {
502  ULong_t status = track->GetStatus();
503  if (!(status & AliVTrack::kTPCrefit) && fRequireTPCrefit) return kFALSE;
504  if (track->Eta() < fRequireEtaMin || track->Eta() > fRequireEtaMax) return kFALSE;
505  if (track->Y(fPDGMass) < fRequireYmin || track->Y(fPDGMass) > fRequireYmax) return kFALSE;
506  AliAODVertex *vtx1 = (AliAODVertex*)track->GetProdVertex();
507  if(Int_t(vtx1->GetType()) == AliAODVertex::kKink && fRequireNoKinks) return kFALSE;
508  if (track->Chi2perNDF() > fRequireMaxChi2) return kFALSE;
509  if (track->GetTPCsignal() < fRequireMinEnergyLoss) return kFALSE;
510  if (fRequireMaxMomentum > 0 && track->P() > fRequireMaxMomentum) return kFALSE;
511 
513  dca[0] = 0.;
514  dca[1] = 0.;
515  if (track->Pt() < fDisableITSatHighPt) {
516  unsigned int nSPD = 0, nITS = 0, nSDD = 0;
517  for (int i = 0; i < 6; ++i) {
518  if (track->HasPointOnITSLayer(i)) {
519  if (i < 2) nSPD++;
520  else if (i < 4) nSDD++;
521  nITS++;
522  }
523  }
524  if (!(status & AliVTrack::kITSrefit) && fRequireITSrefit) return kFALSE;
525  if (nITS < fRequireITSrecPoints) return kFALSE;
526  if (nSPD < fRequireSPDrecPoints) return kFALSE;
527  if (nSDD < fRequireSDDrecPoints) return kFALSE;
528  if (fRequireVetoSPD && nSPD > 0) return kFALSE;
529  Double_t cov[3];
530  if (!track->PropagateToDCA(fPrimaryVertex, fMagField, 100, dca, cov)) return kFALSE;
531  if (TMath::Abs(dca[0]) > fRequireMaxDCAxy) return kFALSE;
532  if (TMath::Abs(dca[1]) > fRequireMaxDCAz) return kFALSE;
533  }
534 
535  return kTRUE;
536 }
537 
543 Float_t AliAnalysisTaskNucleiYield::HasTOF(AliAODTrack *track) {
544  Bool_t hasTOFout = track->GetStatus() & AliVTrack::kTOFout;
545  Bool_t hasTOFtime = track->GetStatus() & AliVTrack::kTIME;
546  const float len = track->GetIntegratedLength();
547  Bool_t hasTOF = Bool_t(hasTOFout & hasTOFtime) && len > 350.f;
548 
549  if (!hasTOF) return -1.;
550  const float p = track->GetTPCmomentum();
551  const float tim = track->GetTOFsignal() - fPID->GetTOFResponse().GetStartTime(p);
552  if (tim < len / LIGHT_SPEED) return -1.;
553  else {
554  const float beta = len / (tim * LIGHT_SPEED);
555  if (beta < EPS || beta > (1. - EPS))
556  return -1.f;
557  else
558  return beta;
559  }
560 }
561 
568 void AliAnalysisTaskNucleiYield::SetCentBins(Int_t nbins, Float_t *bins) {
569  fCentBins.Set(nbins + 1, bins);
570 }
571 
578 void AliAnalysisTaskNucleiYield::SetDCABins(Int_t nbins, Float_t min, Float_t max) {
579  const float delta = (max - min) / nbins;
580  fDCABins.Set(nbins + 1);
581  for (int iB = 0; iB < nbins; ++iB) {
582  fDCABins[iB] = min + iB * delta;
583  }
584  fDCABins[nbins] = max;
585 }
586 
593 void AliAnalysisTaskNucleiYield::SetDCABins(Int_t nbins, Float_t *bins) {
594  fDCABins.Set(nbins + 1, bins);
595 }
596 
603 void AliAnalysisTaskNucleiYield::SetPtBins(Int_t nbins, Float_t *bins) {
604  fPtBins.Set(nbins + 1, bins);
605 }
606 
614  if (par == 0x0 && sigma <= 0) {
615  fCustomTPCpid.Set(1);
616  } else {
617  fCustomTPCpid.Set(6);
618  for (int i = 0; i < 5; ++i)
619  fCustomTPCpid.AddAt(par[i],i);
620  fCustomTPCpid.AddAt(sigma, 5);
621  }
622 }
623 
631  bool itsPID = kTRUE, tpcPID = kTRUE;
632  if (fRequireITSpidSigmas > 0 && t->Pt() < fDisableITSatHighPt) {
633  AliITSPIDResponse &itsPidResp = fPID->GetITSResponse();
634  itsPID = TMath::Abs(itsPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireITSpidSigmas;
635  }
636 
637  if (t->Pt() < fDisableTPCpidAtHighPt) {
638  if (fCustomTPCpid.GetSize() < 6 || fIsMC) {
639  AliTPCPIDResponse &tpcPidResp = fPID->GetTPCResponse();
640  tpcPID = TMath::Abs(tpcPidResp.GetNumberOfSigmas(t, fParticle)) < fRequireTPCpidSigmas;
641  } else {
642  const float p = t->GetTPCmomentum() / fPDGMassOverZ;
643  const float r = AliExternalTrackParam::BetheBlochAleph(p, fCustomTPCpid[0], fCustomTPCpid[1],
645  fCustomTPCpid[4]);
646  tpcPID = TMath::Abs(t->GetTPCsignal() - r) < fRequireTPCpidSigmas * fCustomTPCpid[5] * r;
647  }
648  }
649 
650  return itsPID && tpcPID;
651 }
652 
660 void AliAnalysisTaskNucleiYield::SetTOFBins(Int_t nbins, Float_t min, Float_t max) {
661  fTOFnBins = nbins;
662  fTOFlowBoundary = min;
663  fTOFhighBoundary = max;
664 }
665 
672 void AliAnalysisTaskNucleiYield::SetDCAzBins(Int_t nbins, Float_t limit) {
673  fDCAzNbins = nbins;
674  fDCAzLimit = limit;
675 }
676 
682 void AliAnalysisTaskNucleiYield::SetParticleType(AliPID::EParticleType part) {
683  fParticle = part;
684  fPDGMass = AliPID::ParticleMass(part);
685  fPDGMassOverZ = AliPID::ParticleMassZ(part);
686 }
687 
698  if (fFlatteningProbs.GetSize() <= 0) {
699  Float_t prob[13] = {
700  0.839266,0.822364,0.807522,0.804727,0.806675,
701  0.828297,0.820842,0.834088,0.861455,1.,
702  0.38112,0.661154,0.953928
703  };
704  fFlatteningProbs.Set(13, prob);
705  }
706  if (!fIsMC) {
707  if (cent >= fFlatteningProbs.GetSize()) return kFALSE;
708  else return gRandom->Rndm() > fFlatteningProbs[int(cent)];
709  } else {
710  // This flattening is required since a strange peak in VOM distribution is observed in MC
711  if (fFixForLHC14a6) {
712  if (cent < 1.5e-3f) {
713  return true;
714  } else if (cent < 0.05 && gRandom->Rndm() < 0.5) {
715  return true;
716  }
717  }
718  }
719  return false;
720 }
721 
728 void AliAnalysisTaskNucleiYield::PtCorrection(float &pt, bool positiveCharge) {
729  Float_t *par = (positiveCharge) ? fPtCorrectionM.GetArray() : fPtCorrectionA.GetArray();
730  const Float_t correction = par[0] + par[1] * TMath::Exp(par[2] * pt);
731  pt -= correction;
732 }
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.
Float_t fRequireMaxMomentum
Cut in momentum for TPC only spectrum.
void SetDCABins(Int_t nbins, Float_t min, Float_t max)
Float_t fRequireITSpidSigmas
Cut on ITS PID number of sigmas.
Bool_t fFixForLHC14a6
Switch on/off the fix for the MC centrality distribution.
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)