AliPhysics  7f2a7c4 (7f2a7c4)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnaChargedParticles.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 // --- ROOT system ---
17 #include "TParticle.h"
18 #include "TH2F.h"
19 #include "TDatabasePDG.h"
20 
21 //---- AliRoot system ----
22 #include "AliAnaChargedParticles.h"
23 #include "AliCaloTrackReader.h"
24 #include "AliAODPWG4Particle.h"
25 #include "AliStack.h"
26 #include "AliFiducialCut.h"
27 #include "AliVTrack.h"
28 #include "AliAODMCParticle.h"
29 #include "AliAODTrack.h"
30 #include "AliAODEvent.h"
31 #include "AliESDEvent.h"
32 
36 
37 //__________________________________________________
39 //__________________________________________________
42 fFillTrackBCHistograms(0), fFillVertexBC0Histograms(0),
43 fFillEtaPhiRegionHistograms(0),
44 fMomentum(),
45 // Histograms
46 fhNtracks(0), fhPt(0), fhPtNoCut(0),
47 fhPtCutDCA(0), fhPtCutDCABCOK(0),
48 fhPtNotPrimary(), fhPtNotSharedClusterCut(0),
49 fhPhiNeg(0), fhEtaNeg(0),
50 fhPhiPos(0), fhEtaPos(0),
51 fhEtaPhiPos(0), fhEtaPhiNeg(0),
52 fhTrackResolution(0),
53 fhPtVtxOutBC0(0), fhEtaPhiVtxOutBC0(0),
54 fhPtVtxInBC0(0), fhEtaPhiVtxInBC0(0),
55 fhPtSPDRefit(0), fhPtNoSPDRefit(0), fhPtNoSPDNoRefit(0),
56 fhEtaPhiSPDRefitPt02(0), fhEtaPhiNoSPDRefitPt02(0), fhEtaPhiNoSPDNoRefitPt02(0),
57 fhEtaPhiSPDRefitPt3(0), fhEtaPhiNoSPDRefitPt3(0), fhEtaPhiNoSPDNoRefitPt3(0),
58 // TOF
59 fhTOFSignal(0), fhTOFSignalPtCut(0), fhTOFSignalBCOK(0),
60 fhPtTOFSignal(0), fhPtTOFSignalDCACut(0),
61 fhPtTOFSignalVtxOutBC0(0), fhPtTOFSignalVtxInBC0(0),
62 fhPtTOFStatus0(0), fhEtaPhiTOFStatus0(0),
63 fhEtaPhiTOFBC0(0), fhEtaPhiTOFBCPlus(0), fhEtaPhiTOFBCMinus(0),
64 fhEtaPhiTOFBC0PileUpSPD(0),
65 fhEtaPhiTOFBCPlusPileUpSPD(0),
66 fhEtaPhiTOFBCMinusPileUpSPD(0),
67 fhProductionVertexBC(0),
68 fhPtNPileUpSPDVtx(0), fhPtNPileUpTrkVtx(0),
69 fhPtNPileUpSPDVtxBC0(0), fhPtNPileUpTrkVtxBC0(0)
70 {
71  for(Int_t i = 0; i < 7; i++)
72  {
73  fhPtPileUp [i] = 0;
74  fhPtTOFSignalPileUp[i] = 0;
78  }
79 
80  for(Int_t i = 0; i < 3; i++)
81  {
82  fhPtDCA [i] = 0 ;
83 
84  fhPtDCASPDRefit [i] = 0 ;
85  fhPtDCANoSPDRefit [i] = 0 ;
86  fhPtDCANoSPDNoRefit [i] = 0 ;
87 
88  fhPtDCAPileUp [i] = 0 ;
89  fhPtDCATOFBC0 [i] = 0 ;
90  fhPtDCATOFBCOut [i] = 0 ;
91  fhPtDCAPileUpTOFBC0 [i] = 0 ;
92  fhPtDCANoTOFHit [i] = 0 ;
93  fhPtDCAPileUpNoTOFHit [i] = 0 ;
94 
95  fhPtDCAVtxOutBC0 [i] = 0 ;
96  fhPtDCAVtxInBC0 [i] = 0 ;
97  fhPtDCAVtxOutBC0PileUp[i] = 0 ;
98  fhPtDCAVtxInBC0PileUp [i] = 0 ;
100  fhPtDCAVtxInBC0NoTOFHit [i] = 0 ;
103  }
104 
105  for(Int_t i = 0; i < 18; i++)
106  {
107  for(Int_t j = 0; j < 2; j++)
108  {
109  fhPtPerRegion [i][j] = 0;
110  fhSumPtPerRegion[i][j] = 0;
111  }
112  }
113 
114  // MC
115  for(Int_t imcPart = 0; imcPart < 6; imcPart++)
116  {
117  fhPtMCPart [imcPart] = 0;
118  fhPtMCPrimPart [imcPart] = 0;
119  fhPhiMCPart [imcPart] = 0;
120  fhPhiMCPrimPart[imcPart] = 0;
121  fhEtaMCPart [imcPart] = 0;
122  fhEtaMCPrimPart[imcPart] = 0;
123  }
124 
125  //Initialize parameters
126  InitParameters();
127 }
128 
129 //__________________________________________________
131 //__________________________________________________
133 {
134  Int_t pdg = 0 ;
135  Int_t nprim = 0 ;
136 
137  TParticle * primStack = 0;
138  AliAODMCParticle * primAOD = 0;
139 
140  // Get the ESD MC particles container
141  AliStack * stack = 0;
142  if( GetReader()->ReadStack() )
143  {
144  stack = GetMCStack();
145  if(!stack ) return;
146  nprim = stack->GetNtrack();
147  }
148 
149  // Get the AOD MC particles container
150  TClonesArray * mcparticles = 0;
151  if( GetReader()->ReadAODMCParticles() )
152  {
153  mcparticles = GetReader()->GetAODMCParticles();
154  if( !mcparticles ) return;
155  nprim = mcparticles->GetEntriesFast();
156  }
157 
158  for(Int_t i=0 ; i < nprim; i++)
159  {
160  if ( !GetReader()->AcceptParticleMCLabel( i ) ) continue ;
161 
162  if(GetReader()->ReadStack())
163  {
164  primStack = stack->Particle(i) ;
165  if(!primStack)
166  {
167  AliWarning("ESD primaries pointer not available!!");
168  continue;
169  }
170 
171  if( primStack->GetStatusCode() != 1 ) continue;
172 
173  Int_t charge = (Int_t )TDatabasePDG::Instance()->GetParticle(primStack->GetPdgCode())->Charge();
174  if( TMath::Abs(charge) == 0 ) continue;
175 
176  pdg = TMath::Abs(primStack->GetPdgCode());
177 
178  // Protection against floating point exception
179  if ( primStack->Energy() == TMath::Abs(primStack->Pz()) ||
180  (primStack->Energy() - primStack->Pz()) < 1e-3 ||
181  (primStack->Energy() + primStack->Pz()) < 0 ) continue ;
182 
183  //printf("i %d, %s %d %s %d \n",i, stack->Particle(i)->GetName(), stack->Particle(i)->GetPdgCode(),
184  // prim->GetName(), prim->GetPdgCode());
185 
186  //Charged kinematics
187  primStack->Momentum(fMomentum);
188  }
189  else
190  {
191  primAOD = (AliAODMCParticle *) mcparticles->At(i);
192  if(!primAOD)
193  {
194  AliWarning("AOD primaries pointer not available!!");
195  continue;
196  }
197 
198  if( primAOD->GetStatus() != 1 ) continue;
199 
200  if(TMath::Abs(primAOD->Charge()) == 0 ) continue;
201 
202  pdg = TMath::Abs(primAOD->GetPdgCode());
203 
204  // Protection against floating point exception
205  if ( primAOD->E() == TMath::Abs(primAOD->Pz()) ||
206  (primAOD->E() - primAOD->Pz()) < 1e-3 ||
207  (primAOD->E() + primAOD->Pz()) < 0 ) continue ;
208 
209  //Charged kinematics
210  fMomentum.SetPxPyPzE(primAOD->Px(),primAOD->Py(),primAOD->Pz(),primAOD->E());
211  }
212 
213  Int_t mcType = kmcUnknown;
214  if (pdg==211 ) mcType = kmcPion;
215  else if(pdg==2212) mcType = kmcProton;
216  else if(pdg==321 ) mcType = kmcKaon;
217  else if(pdg==11 ) mcType = kmcElectron;
218  else if(pdg==13 ) mcType = kmcMuon;
219 
220  //printf("pdg %d, charge %f, mctype %d\n",pdg, charge, mcType);
221 
222  Float_t ptPrim = fMomentum.Pt();
223  Float_t etaPrim = fMomentum.Eta();
224  Float_t phiPrim = fMomentum.Phi();
225  if(phiPrim < 0) phiPrim+=TMath::TwoPi();
226 
227  Bool_t in = GetFiducialCut()->IsInFiducialCut(etaPrim,phiPrim,kCTS) ;
228 
229  if(in)
230  fhPtMCPrimPart[mcType]->Fill(ptPrim, GetEventWeight());
231 
232  fhEtaMCPrimPart [mcType]->Fill(ptPrim, etaPrim, GetEventWeight());
233  fhPhiMCPrimPart [mcType]->Fill(ptPrim, phiPrim, GetEventWeight());
234  }
235 }
236 
237 //_______________________________________________________
240 //_______________________________________________________
242 {
243  TList * outputContainer = new TList() ;
244  outputContainer->SetName("ChargedParticleHistos") ;
245 
249 
250  fhNtracks = new TH1F ("hNtracks","# of tracks", 1000,0,1000);
251  fhNtracks->SetXTitle("# of tracks");
252  outputContainer->Add(fhNtracks);
253 
254  fhPt = new TH1F ("hPt","#it{p}_{T} distribution", nptbins,ptmin,ptmax);
255  fhPt->SetXTitle("#it{p}_{T} (GeV/#it{c})");
256  outputContainer->Add(fhPt);
257 
259  {
260  for(Int_t i = 0; i < 18; i++)
261  {
262  for(Int_t j = 0; j < 2; j++)
263  {
264  fhPtPerRegion[i][j] = new TH1F
265  (Form("hPt_Sector%d_Side%d",i,j),
266  Form("#it{p}_{T} distribution per region (%d,%d)",i,j),
267  nptbins,ptmin,ptmax);
268  fhPtPerRegion[i][j]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
269  outputContainer->Add(fhPtPerRegion[i][j]);
270 
271  fhSumPtPerRegion[i][j] = new TH1F
272  (Form("hSumPt_Sector%d_Side%d",i,j),
273  Form("#Sigma #it{p}_{T} distribution per region (%d,%d)",i,j),
274  nptbins,ptmin,ptmax);
275  fhSumPtPerRegion[i][j]->SetXTitle("#Sigma #it{p}_{T} (GeV/#it{c})");
276  outputContainer->Add(fhSumPtPerRegion[i][j]);
277  }
278  }
279  }
280 
281  fhPtNoCut = new TH1F ("hPtNoCut","#it{p}_{T} distribution, raw tracks", nptbins,ptmin,ptmax);
282  fhPtNoCut->SetXTitle("#it{p}_{T} (GeV/#it{c})");
283  outputContainer->Add(fhPtNoCut);
284 
285  if(!GetReader()->IsDCACutOn())
286  {
287  fhPtCutDCA = new TH1F ("hPtCutDCA","#it{p}_{T} distribution, cut DCA", nptbins,ptmin,ptmax);
288  fhPtCutDCA->SetXTitle("#it{p}_{T} (GeV/#it{c})");
289  outputContainer->Add(fhPtCutDCA);
290  }
291 
292  if(fFillVertexBC0Histograms && !GetReader()->IsDCACutOn())
293  {
294  fhPtCutDCABCOK = new TH1F ("hPtCutDCABCOK","#it{p}_{T} distribution, DCA cut, track BC=0 or -100", nptbins,ptmin,ptmax);
295  fhPtCutDCABCOK->SetXTitle("#it{p}_{T} (GeV/#it{c})");
296  outputContainer->Add(fhPtCutDCABCOK);
297  }
298 
299  if( GetReader()->GetDataType() == AliCaloTrackReader::kAOD )
300  {
301  fhPtNotPrimary = new TH1F ("hPtNotPrimary","#it{p}_{T} distribution, not primary", nptbins,ptmin,ptmax);
302  fhPtNotPrimary->SetXTitle("#it{p}_{T} (GeV/#it{c})");
303  outputContainer->Add(fhPtNotPrimary);
304 
305  fhPtNotSharedClusterCut = new TH1F ("hPtNotSharedClusterCut","#it{p}_{T} distribution, shared clusters cut out", nptbins,ptmin,ptmax);
306  fhPtNotSharedClusterCut->SetXTitle("#it{p}_{T} (GeV/#it{c})");
307  outputContainer->Add(fhPtNotSharedClusterCut);
308  }
309 
310  fhPhiNeg = new TH2F ("hPhiNegative","#phi of negative charges distribution",
311  nptbins,ptmin,ptmax, nphibins,phimin,phimax);
312  fhPhiNeg->SetYTitle("#phi (rad)");
313  fhPhiNeg->SetXTitle("#it{p}_{T} (GeV/#it{c})");
314  outputContainer->Add(fhPhiNeg);
315 
316  fhEtaNeg = new TH2F ("hEtaNegative","#eta of negative charges distribution",
317  nptbins,ptmin,ptmax, netabins,etamin,etamax);
318  fhEtaNeg->SetYTitle("#eta ");
319  fhEtaNeg->SetXTitle("#it{p}_{T} (GeV/#it{c})");
320  outputContainer->Add(fhEtaNeg);
321 
322  fhPhiPos = new TH2F ("hPhiPositive","#phi of positive charges distribution",
323  nptbins,ptmin,ptmax, nphibins,phimin,phimax);
324  fhPhiPos->SetYTitle("#phi (rad)");
325  fhPhiPos->SetXTitle("#it{p}_{T} (GeV/#it{c})");
326  outputContainer->Add(fhPhiPos);
327 
328  fhEtaPos = new TH2F ("hEtaPositive","#eta of positive charges distribution",
329  nptbins,ptmin,ptmax, netabins,etamin,etamax);
330  fhEtaPos->SetYTitle("#eta ");
331  fhEtaPos->SetXTitle("#it{p}_{T} (GeV/#it{c})");
332  outputContainer->Add(fhEtaPos);
333 
334  fhEtaPhiPos = new TH2F ("hEtaPhiPositive","pt/eta/phi of positive charge",netabins,etamin,etamax, nphibins,phimin,phimax);
335  fhEtaPhiPos->SetXTitle("#eta ");
336  fhEtaPhiPos->SetYTitle("#phi (rad)");
337  outputContainer->Add(fhEtaPhiPos);
338 
339  fhEtaPhiNeg = new TH2F ("hEtaPhiNegative","#eta vs #phi of negative charge",netabins,etamin,etamax, nphibins,phimin,phimax);
340  fhEtaPhiNeg->SetXTitle("#eta ");
341  fhEtaPhiNeg->SetYTitle("#phi (rad)");
342  outputContainer->Add(fhEtaPhiNeg);
343 
344  if( GetReader()->GetDataType() == AliCaloTrackReader::kESD )
345  {
346  fhTrackResolution = new TH2F ("hTrackResolution","Track resolution: #sigma_{#it{p}_{T}} vs #it{p}_{T}, ESDs",
347  nptbins,ptmin,ptmax,600,0,0.3);
348  fhTrackResolution->SetXTitle("#it{p}_{T} (GeV/#it{c})");
349  fhTrackResolution->SetYTitle("#sigma_{#it{p}_{T}} / #it{p}_{T} (GeV/#it{c})");
350  outputContainer->Add(fhTrackResolution);
351  }
352 
354  {
355  fhPtVtxOutBC0 = new TH1F ("hPtVtxOutBC0","#it{p}_{T} distribution, vertex in BC=0", nptbins,ptmin,ptmax);
356  fhPtVtxOutBC0->SetXTitle("#it{p}_{T} (GeV/#it{c})");
357  outputContainer->Add(fhPtVtxOutBC0);
358 
359  fhEtaPhiVtxOutBC0 = new TH2F ("hEtaPhiVtxOutBC0","#eta vs #phi of all charges with vertex in BC=0",netabins,etamin,etamax, nphibins,phimin,phimax);
360  fhEtaPhiVtxOutBC0->SetXTitle("#eta ");
361  fhEtaPhiVtxOutBC0->SetYTitle("#phi (rad)");
362  outputContainer->Add(fhEtaPhiVtxOutBC0);
363 
364  fhPtVtxInBC0 = new TH1F ("hPtVtxInBC0","#it{p}_{T} distribution, vertex in BC=0", nptbins,ptmin,ptmax);
365  fhPtVtxInBC0->SetXTitle("#it{p}_{T} (GeV/#it{c})");
366  outputContainer->Add(fhPtVtxInBC0);
367 
368  fhEtaPhiVtxInBC0 = new TH2F ("hEtaPhiVtxInBC0","#eta vs #phi of all charges with vertex in BC=0",netabins,etamin,etamax, nphibins,phimin,phimax);
369  fhEtaPhiVtxInBC0->SetXTitle("#eta ");
370  fhEtaPhiVtxInBC0->SetYTitle("#phi (rad)");
371  outputContainer->Add(fhEtaPhiVtxInBC0);
372  }
373 
374  fhPtSPDRefit = new TH1F ("hPtSPDRefit","#it{p}_{T} distribution of tracks with SPD and ITS refit", nptbins,ptmin,ptmax);
375  fhPtSPDRefit->SetXTitle("#it{p}_{T} (GeV/#it{c})");
376  outputContainer->Add(fhPtSPDRefit);
377 
378  fhEtaPhiSPDRefitPt02 = new TH2F ("hEtaPhiSPDRefitPt02","#eta vs #phi of tracks with SPD and ITS refit, #it{p}_{T}< 2 GeV/#it{c}",
379  netabins,etamin,etamax, nphibins,phimin,phimax);
380  fhEtaPhiSPDRefitPt02->SetXTitle("#eta ");
381  fhEtaPhiSPDRefitPt02->SetYTitle("#phi (rad)");
382  outputContainer->Add(fhEtaPhiSPDRefitPt02);
383 
384  fhEtaPhiSPDRefitPt3 = new TH2F ("hEtaPhiSPDRefitPt3","#eta vs #phi of tracks with SPD and ITS refit, #it{p}_{T}> 3 GeV/#it{c}",
385  netabins,etamin,etamax, nphibins,phimin,phimax);
386  fhEtaPhiSPDRefitPt3->SetXTitle("#eta ");
387  fhEtaPhiSPDRefitPt3->SetYTitle("#phi (rad)");
388  outputContainer->Add(fhEtaPhiSPDRefitPt3);
389 
390  fhPtNoSPDRefit = new TH1F ("hPtNoSPDRefit","#it{p}_{T} distribution of constrained tracks no SPD and with ITSRefit",
391  nptbins,ptmin,ptmax);
392  fhPtNoSPDRefit->SetXTitle("#it{p}_{T} (GeV/#it{c})");
393  outputContainer->Add(fhPtNoSPDRefit);
394 
395  fhEtaPhiNoSPDRefitPt02 = new TH2F ("hEtaPhiNoSPDRefitPt02","#eta vs #phi of constrained tracks no SPD and with ITSRefit, #it{p}_{T}< 2 GeV/#it{c}",
396  netabins,etamin,etamax, nphibins,phimin,phimax);
397  fhEtaPhiNoSPDRefitPt02->SetXTitle("#eta ");
398  fhEtaPhiNoSPDRefitPt02->SetYTitle("#phi (rad)");
399  outputContainer->Add(fhEtaPhiNoSPDRefitPt02);
400 
401  fhEtaPhiNoSPDRefitPt3 = new TH2F ("hEtaPhiNoSPDRefitPt3","#eta vs #phi of of constrained tracks no SPD and with ITSRefit, #it{p}_{T}> 3 GeV/#it{c}",
402  netabins,etamin,etamax, nphibins,phimin,phimax);
403  fhEtaPhiNoSPDRefitPt3->SetXTitle("#eta ");
404  fhEtaPhiNoSPDRefitPt3->SetYTitle("#phi (rad)");
405  outputContainer->Add(fhEtaPhiNoSPDRefitPt3);
406 
407  fhPtNoSPDNoRefit = new TH1F ("hPtNoSPDNoRefit","#it{p}_{T} distribution of constrained tracks with no SPD requierement and without ITSRefit",
408  nptbins,ptmin,ptmax);
409  fhPtNoSPDNoRefit->SetXTitle("#it{p}_{T} (GeV/#it{c})");
410  outputContainer->Add(fhPtNoSPDNoRefit);
411 
412  fhEtaPhiNoSPDNoRefitPt02 = new TH2F ("hEtaPhiNoSPDNoRefitPt02",
413  "#eta vs #phi of constrained tracks with no SPD requierement and without ITSRefit, #it{p}_{T}< 2 GeV/#it{c}",
414  netabins,etamin,etamax, nphibins,phimin,phimax);
415  fhEtaPhiNoSPDNoRefitPt02->SetXTitle("#eta ");
416  fhEtaPhiNoSPDNoRefitPt02->SetYTitle("#phi (rad)");
417  outputContainer->Add(fhEtaPhiNoSPDNoRefitPt02);
418 
419  fhEtaPhiNoSPDNoRefitPt3 = new TH2F ("hEtaPhiNoSPDNoRefitPt3",
420  "#eta vs #phi of constrained tracks with no SPD requierement and without ITSRefit, #it{p}_{T}> 3 GeV/#it{c}",
421  netabins,etamin,etamax, nphibins,phimin,phimax);
422  fhEtaPhiNoSPDNoRefitPt3->SetXTitle("#eta ");
423  fhEtaPhiNoSPDNoRefitPt3->SetYTitle("#phi (rad)");
424  outputContainer->Add(fhEtaPhiNoSPDNoRefitPt3);
425 
427  {
428  fhProductionVertexBC = new TH1F("hProductionVertexBC", "tracks production vertex bunch crossing ", 41 , -20 , 20 ) ;
429  fhProductionVertexBC->SetYTitle("# tracks");
430  fhProductionVertexBC->SetXTitle("Bunch crossing");
431  outputContainer->Add(fhProductionVertexBC);
432  }
433 
434  Int_t ntofbins = 1000;
435  Int_t mintof = -500;
436  Int_t maxtof = 500;
437 
438  fhTOFSignal = new TH1F ("hTOFSignal","TOF signal", ntofbins,mintof,maxtof);
439  fhTOFSignal->SetXTitle("TOF signal (ns)");
440  outputContainer->Add(fhTOFSignal);
441 
443  {
444  fhTOFSignalBCOK = new TH1F ("hTOFSignalBCOK","TOF signal", ntofbins,mintof,maxtof);
445  fhTOFSignalBCOK->SetXTitle("TOF signal (ns)");
446  outputContainer->Add(fhTOFSignalBCOK);
447  }
448 
449  fhTOFSignalPtCut = new TH1F ("hTOFSignalPtCut","TOF signal", ntofbins,mintof,maxtof);
450  fhTOFSignalPtCut->SetXTitle("TOF signal (ns)");
451  outputContainer->Add(fhTOFSignalPtCut);
452 
453  fhPtTOFSignal = new TH2F ("hPtTOFSignal","TOF signal", nptbins,ptmin,ptmax,ntofbins,mintof,maxtof);
454  fhPtTOFSignal->SetYTitle("TOF signal (ns)");
455  fhPtTOFSignal->SetXTitle("#it{p}_{T} (GeV/#it{c})");
456  outputContainer->Add(fhPtTOFSignal);
457 
458  if(!GetReader()->IsDCACutOn())
459  {
460  fhPtTOFSignalDCACut = new TH2F ("hPtTOFSignalDCACut","TOF signal after DCA cut", nptbins,ptmin,ptmax,ntofbins,mintof,maxtof);
461  fhPtTOFSignalDCACut->SetYTitle("TOF signal (ns)");
462  fhPtTOFSignalDCACut->SetXTitle("#it{p}_{T} (GeV/#it{c})");
463  outputContainer->Add(fhPtTOFSignalDCACut);
464  }
465 
467  {
468  fhPtTOFSignalVtxOutBC0 = new TH2F ("hPtTOFSignalVtxOutBC0","TOF signal, vtx BC!=0", nptbins,ptmin,ptmax,ntofbins,mintof,maxtof);
469  fhPtTOFSignalVtxOutBC0->SetYTitle("TOF signal (ns)");
470  fhPtTOFSignalVtxOutBC0->SetXTitle("#it{p}_{T} (GeV/#it{c})");
471  outputContainer->Add(fhPtTOFSignalVtxOutBC0);
472 
473  fhPtTOFSignalVtxInBC0 = new TH2F ("hPtTOFSignalVtxInBC0","TOF signal, vtx BC=0", nptbins,ptmin,ptmax,ntofbins,mintof,maxtof);
474  fhPtTOFSignalVtxInBC0->SetYTitle("TOF signal (ns)");
475  fhPtTOFSignalVtxInBC0->SetXTitle("#it{p}_{T} (GeV/#it{c})");
476  outputContainer->Add(fhPtTOFSignalVtxInBC0);
477  }
478 
479  if(IsPileUpAnalysisOn())
480  {
481  TString pileUpName[] = {"SPD","EMCAL","SPDOrEMCAL","SPDAndEMCAL","SPDAndNotEMCAL","EMCALAndNotSPD","NotSPDAndNotEMCAL"} ;
482 
483  for(Int_t i = 0 ; i < 7 ; i++)
484  {
485  fhPtPileUp[i] = new TH1F(Form("hPtPileUp%s",pileUpName[i].Data()),
486  Form("Track #it{p}_{T}distribution, %s Pile-Up event",pileUpName[i].Data()),
487  nptbins,ptmin,ptmax);
488  fhPtPileUp[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
489  outputContainer->Add(fhPtPileUp[i]);
490 
491  fhPtTOFSignalPileUp[i] = new TH2F(Form("hPtTOFSignalPileUp%s",pileUpName[i].Data()),
492  Form("Track TOF vs #it{p}_{T}distribution, %s Pile-Up event",pileUpName[i].Data()),
493  nptbins,ptmin,ptmax,ntofbins,mintof,maxtof);
494  fhPtTOFSignalPileUp[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
495  fhPtTOFSignalPileUp[i]->SetXTitle("TOF signal (ns)");
496  outputContainer->Add(fhPtTOFSignalPileUp[i]);
497 
499  {
500  fhPtTOFSignalVtxOutBC0PileUp[i] = new TH2F(Form("hPtTOFSignalVtxOutBC0PileUp%s",pileUpName[i].Data()),
501  Form("Track TOF vs #it{p}_{T}distribution, %s Pile-Up event, vtx BC!=0",pileUpName[i].Data()),
502  nptbins,ptmin,ptmax,ntofbins,mintof,maxtof);
503  fhPtTOFSignalVtxOutBC0PileUp[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
504  fhPtTOFSignalVtxOutBC0PileUp[i]->SetXTitle("TOF signal (ns)");
505  outputContainer->Add(fhPtTOFSignalVtxOutBC0PileUp[i]);
506 
507  fhPtTOFSignalVtxInBC0PileUp[i] = new TH2F(Form("hPtTOFSignalVtxInBC0PileUp%s",pileUpName[i].Data()),
508  Form("Track TOF vs #it{p}_{T}distribution, %s Pile-Up event, vtx BC=0",pileUpName[i].Data()),
509  nptbins,ptmin,ptmax,ntofbins,mintof,maxtof);
510  fhPtTOFSignalVtxInBC0PileUp[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
511  fhPtTOFSignalVtxInBC0PileUp[i]->SetXTitle("TOF signal (ns)");
512  outputContainer->Add(fhPtTOFSignalVtxInBC0PileUp[i]);
513  }
514 
516  {
517  fhProductionVertexBCPileUp[i] = new TH1F(Form("hProductionVertexBCPileUp%s",pileUpName[i].Data()),
518  Form("tracks production vertex bunch crossing, %s Pile-Up event",pileUpName[i].Data()),
519  41 , -20 , 20 ) ;
520  fhProductionVertexBCPileUp[i]->SetYTitle("# tracks");
521  fhProductionVertexBCPileUp[i]->SetXTitle("Bunch crossing");
522  outputContainer->Add(fhProductionVertexBCPileUp[i]);
523  }
524  }
525 
527  {
528  fhEtaPhiTOFBC0 = new TH2F ("hEtaPhiTOFBC0","eta-phi for tracks with hit on TOF, and tof corresponding to BC=0",netabins,etamin,etamax, nphibins,phimin,phimax);
529  fhEtaPhiTOFBC0->SetXTitle("#eta ");
530  fhEtaPhiTOFBC0->SetYTitle("#phi (rad)");
531  outputContainer->Add(fhEtaPhiTOFBC0);
532 
533  fhEtaPhiTOFBCPlus = new TH2F ("hEtaPhiTOFBCPlus","eta-phi for tracks with hit on TOF, and tof corresponding to BC>0",netabins,etamin,etamax, nphibins,phimin,phimax);
534  fhEtaPhiTOFBCPlus->SetXTitle("#eta ");
535  fhEtaPhiTOFBCPlus->SetYTitle("#phi (rad)");
536  outputContainer->Add(fhEtaPhiTOFBCPlus);
537 
538  fhEtaPhiTOFBCMinus = new TH2F ("hEtaPhiTOFBCMinus","eta-phi for tracks with hit on TOF, and tof corresponding to BC<0",netabins,etamin,etamax, nphibins,phimin,phimax);
539  fhEtaPhiTOFBCMinus->SetXTitle("#eta ");
540  fhEtaPhiTOFBCMinus->SetYTitle("#phi (rad)");
541  outputContainer->Add(fhEtaPhiTOFBCMinus);
542 
543  if(IsPileUpAnalysisOn())
544  {
545  fhEtaPhiTOFBC0PileUpSPD = new TH2F ("hEtaPhiTOFBC0PileUpSPD","eta-phi for tracks with hit on TOF, and tof corresponding to BC=0, SPD pile-up",netabins,etamin,etamax, nphibins,phimin,phimax);
546  fhEtaPhiTOFBC0PileUpSPD->SetXTitle("#eta ");
547  fhEtaPhiTOFBC0PileUpSPD->SetYTitle("#phi (rad)");
548  outputContainer->Add(fhEtaPhiTOFBC0PileUpSPD);
549 
550  fhEtaPhiTOFBCPlusPileUpSPD = new TH2F ("hEtaPhiTOFBCPlusPileUpSPD","eta-phi for tracks with hit on TOF, and tof corresponding to BC>0, SPD pile-up",netabins,etamin,etamax, nphibins,phimin,phimax);
551  fhEtaPhiTOFBCPlusPileUpSPD->SetXTitle("#eta ");
552  fhEtaPhiTOFBCPlusPileUpSPD->SetYTitle("#phi (rad)");
553  outputContainer->Add(fhEtaPhiTOFBCPlusPileUpSPD);
554 
555  fhEtaPhiTOFBCMinusPileUpSPD = new TH2F ("hEtaPhiTOFBCMinusPileUpSPD","eta-phi for tracks with hit on TOF, and tof corresponding to BC<0, SPD pile-up",netabins,etamin,etamax, nphibins,phimin,phimax);
556  fhEtaPhiTOFBCMinusPileUpSPD->SetXTitle("#eta ");
557  fhEtaPhiTOFBCMinusPileUpSPD->SetYTitle("#phi (rad)");
558  outputContainer->Add(fhEtaPhiTOFBCMinusPileUpSPD);
559  }
560  }
561  }
562 
563  fhPtTOFStatus0 = new TH1F ("hPtTOFStatus0","#it{p}_{T} distribution of tracks not hitting TOF", nptbins,ptmin,ptmax);
564  fhPtTOFStatus0->SetXTitle("#it{p}_{T} (GeV/#it{c})");
565  outputContainer->Add(fhPtTOFStatus0);
566 
567 
568  fhEtaPhiTOFStatus0 = new TH2F ("hEtaPhiTOFStatus0","eta-phi for tracks without hit on TOF",netabins,etamin,etamax, nphibins,phimin,phimax);
569  fhEtaPhiTOFStatus0->SetXTitle("#eta ");
570  fhEtaPhiTOFStatus0->SetYTitle("#phi (rad)");
571  outputContainer->Add(fhEtaPhiTOFStatus0);
572 
573  TString dcaName[] = {"xy","z","Cons"} ;
574  Int_t ndcabins = 800;
575  Int_t mindca = -4;
576  Int_t maxdca = 4;
577 
578  for(Int_t i = 0 ; i < 3 ; i++)
579  {
580  fhPtDCA[i] = new TH2F(Form("hPtDCA%s",dcaName[i].Data()),
581  Form("Track DCA%s vs #it{p}_{T}distribution",dcaName[i].Data()),
582  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
583  fhPtDCA[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
584  fhPtDCA[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
585  outputContainer->Add(fhPtDCA[i]);
586 
587  fhPtDCASPDRefit[i] = new TH2F(Form("hPtDCA%sSPDRefit",dcaName[i].Data()),
588  Form("Track DCA%s vs #it{p}_{T}distribution of tracks with SPD and ITS refit",dcaName[i].Data()),
589  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
590  fhPtDCASPDRefit[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
591  fhPtDCASPDRefit[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
592  outputContainer->Add(fhPtDCASPDRefit[i]);
593 
594  fhPtDCANoSPDRefit[i] = new TH2F(Form("hPtDCA%sNoSPDRefit",dcaName[i].Data()),
595  Form("Track DCA%s vs #it{p}_{T}distributionof constrained tracks no SPD and with ITSRefit",dcaName[i].Data()),
596  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
597  fhPtDCANoSPDRefit[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
598  fhPtDCANoSPDRefit[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
599  outputContainer->Add(fhPtDCANoSPDRefit[i]);
600 
601  fhPtDCANoSPDNoRefit[i] = new TH2F(Form("hPtDCA%sNoSPDNoRefit",dcaName[i].Data()),
602  Form("Track DCA%s vs #it{p}_{T}distribution, constrained tracks with no SPD requierement and without ITSRefit",dcaName[i].Data()),
603  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
604  fhPtDCANoSPDNoRefit[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
605  fhPtDCANoSPDNoRefit[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
606  outputContainer->Add(fhPtDCANoSPDNoRefit[i]);
607 
609  {
610  fhPtDCATOFBC0[i] = new TH2F(Form("hPtDCA%sTOFBC0",dcaName[i].Data()),
611  Form("Track DCA%s vs #it{p}_{T}distribution, BC=0",dcaName[i].Data()),
612  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
613  fhPtDCATOFBC0[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
614  fhPtDCATOFBC0[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
615  outputContainer->Add(fhPtDCATOFBC0[i]);
616 
617  fhPtDCATOFBCOut[i] = new TH2F(Form("hPtDCA%sTOFBCOut",dcaName[i].Data()),
618  Form("Track DCA%s vs #it{p}_{T}distribution, BC!=0",dcaName[i].Data()),
619  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
620  fhPtDCATOFBCOut[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
621  fhPtDCATOFBCOut[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
622  outputContainer->Add(fhPtDCATOFBCOut[i]);
623  }
624 
625  fhPtDCANoTOFHit[i] = new TH2F(Form("hPtDCA%sNoTOFHit",dcaName[i].Data()),
626  Form("Track (no TOF hit) DCA%s vs #it{p}_{T}distribution",dcaName[i].Data()),
627  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
628  fhPtDCANoTOFHit[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
629  fhPtDCANoTOFHit[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
630  outputContainer->Add(fhPtDCANoTOFHit[i]);
631 
633  {
634  fhPtDCAVtxOutBC0[i] = new TH2F(Form("hPtDCA%sVtxOutBC0",dcaName[i].Data()),
635  Form("Track DCA%s vs #it{p}_{T}distribution, vertex with BC!=0",dcaName[i].Data()),
636  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
637  fhPtDCAVtxOutBC0[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
638  fhPtDCAVtxOutBC0[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
639  outputContainer->Add(fhPtDCAVtxOutBC0[i]);
640 
641  fhPtDCAVtxOutBC0NoTOFHit[i] = new TH2F(Form("hPtDCA%sVtxOutBC0NoTOFHit",dcaName[i].Data()),
642  Form("Track (no TOF hit) DCA%s vs #it{p}_{T}distribution, vertex with BC!=0",dcaName[i].Data()),
643  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
644  fhPtDCAVtxOutBC0NoTOFHit[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
645  fhPtDCAVtxOutBC0NoTOFHit[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
646  outputContainer->Add(fhPtDCAVtxOutBC0NoTOFHit[i]);
647 
648  fhPtDCAVtxInBC0[i] = new TH2F(Form("hPtDCA%sVtxInBC0",dcaName[i].Data()),
649  Form("Track DCA%s vs #it{p}_{T}distribution, vertex with BC==0",dcaName[i].Data()),
650  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
651  fhPtDCAVtxInBC0[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
652  fhPtDCAVtxInBC0[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
653  outputContainer->Add(fhPtDCAVtxInBC0[i]);
654 
655  fhPtDCAVtxInBC0NoTOFHit[i] = new TH2F(Form("hPtDCA%sVtxInBC0NoTOFHit",dcaName[i].Data()),
656  Form("Track (no TOF hit) DCA%s vs #it{p}_{T}distribution, vertex with BC==0",dcaName[i].Data()),
657  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
658  fhPtDCAVtxInBC0NoTOFHit[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
659  fhPtDCAVtxInBC0NoTOFHit[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
660  outputContainer->Add(fhPtDCAVtxInBC0NoTOFHit[i]);
661  }
662 
663  if(IsPileUpAnalysisOn())
664  {
665  fhPtDCAPileUp[i] = new TH2F(Form("hPtDCA%sPileUp",dcaName[i].Data()),
666  Form("Track DCA%s vs #it{p}_{T}distribution, SPD Pile-Up",dcaName[i].Data()),
667  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
668  fhPtDCAPileUp[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
669  fhPtDCAPileUp[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
670  outputContainer->Add(fhPtDCAPileUp[i]);
671 
673  {
674  fhPtDCAPileUpTOFBC0[i] = new TH2F(Form("hPtDCA%sPileUpTOFBC0",dcaName[i].Data()),
675  Form("Track DCA%s vs #it{p}_{T}distribution",dcaName[i].Data()),
676  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
677  fhPtDCAPileUpTOFBC0[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
678  fhPtDCAPileUpTOFBC0[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
679  outputContainer->Add(fhPtDCAPileUpTOFBC0[i]);
680  }
681 
682  fhPtDCAPileUpNoTOFHit[i] = new TH2F(Form("hPtDCA%sPileUpNoTOFHit",dcaName[i].Data()),
683  Form("Track (no TOF hit) DCA%s vs #it{p}_{T}distribution, SPD Pile-Up, vertex with BC!=0",dcaName[i].Data()),
684  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
685  fhPtDCAPileUpNoTOFHit[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
686  fhPtDCAPileUpNoTOFHit[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
687  outputContainer->Add(fhPtDCAPileUpNoTOFHit[i]);
688 
690  {
691  fhPtDCAVtxOutBC0PileUp[i] = new TH2F(Form("hPtDCA%sPileUpVtxOutBC0",dcaName[i].Data()),
692  Form("Track DCA%s vs #it{p}_{T}distribution, SPD Pile-Up, vertex with BC!=0",dcaName[i].Data()),
693  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
694  fhPtDCAVtxOutBC0PileUp[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
695  fhPtDCAVtxOutBC0PileUp[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
696  outputContainer->Add(fhPtDCAVtxOutBC0PileUp[i]);
697 
698  fhPtDCAVtxOutBC0PileUpNoTOFHit[i] = new TH2F(Form("hPtDCA%sVtxOutBC0PileUpNoTOFHit",dcaName[i].Data()),
699  Form("Track (no TOF hit) DCA%s vs #it{p}_{T}distribution, SPD Pile-Up, vertex with BC!=0",dcaName[i].Data()),
700  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
701  fhPtDCAVtxOutBC0PileUpNoTOFHit[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
702  fhPtDCAVtxOutBC0PileUpNoTOFHit[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
703  outputContainer->Add(fhPtDCAVtxOutBC0PileUpNoTOFHit[i]);
704 
705  fhPtDCAVtxInBC0PileUp[i] = new TH2F(Form("hPtDCA%sPileUpVtxInBC0",dcaName[i].Data()),
706  Form("Track DCA%s vs #it{p}_{T}distribution, SPD Pile-Up,vertex with BC==0",dcaName[i].Data()),
707  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
708  fhPtDCAVtxInBC0PileUp[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
709  fhPtDCAVtxInBC0PileUp[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
710  outputContainer->Add(fhPtDCAVtxInBC0PileUp[i]);
711 
712  fhPtDCAVtxInBC0PileUpNoTOFHit[i] = new TH2F(Form("hPtDCA%sVtxInBC0PileUpNoTOFHit",dcaName[i].Data()),
713  Form("Track (no TOF hit) DCA%s vs #it{p}_{T}distribution, SPD Pile-Up, vertex with BC==0",dcaName[i].Data()),
714  nptbins,ptmin,ptmax,ndcabins,mindca,maxdca);
715  fhPtDCAVtxInBC0PileUpNoTOFHit[i]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
716  fhPtDCAVtxInBC0PileUpNoTOFHit[i]->SetYTitle(Form("DCA_{%s}",dcaName[i].Data()));
717  outputContainer->Add(fhPtDCAVtxInBC0PileUpNoTOFHit[i]);
718  }
719  }
720  }
721 
722  if(IsDataMC())
723  {
724  //enum mvType{kmcPion = 0, kmcProton = 1, kmcKaon = 2, kmcMuon = 3, kmcElectron = 4, kmcUnknown = 4 };
725 
726  TString histoName[] = {"Pion","Proton","Kaon","Muon","Electron","Unknown"};
727  TString titleName[] = {"#pi^{#pm}","p^{#pm}","K^{#pm}","#mu^{#pm}","e^{#pm}","x^{#pm}"};
728 
729  for(Int_t imcPart = 0; imcPart < 6; imcPart++)
730  {
731  fhPtMCPart[imcPart] = new TH1F (Form("hPtMC%s",histoName[imcPart].Data()),
732  Form("reconstructed #it{p}_{T} distribution from %s",titleName[imcPart].Data()),
733  nptbins,ptmin,ptmax);
734  fhPtMCPart[imcPart]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
735  outputContainer->Add(fhPtMCPart[imcPart]);
736 
737  fhPhiMCPart[imcPart] = new TH2F (Form("hPhiMC%s",histoName[imcPart].Data()),
738  Form("reconstructed #phi vs #it{p}_{T} distribution from %s",titleName[imcPart].Data()),
739  nptbins,ptmin,ptmax, nphibins,phimin,phimax);
740  fhPhiMCPart[imcPart]->SetYTitle("#phi (rad)");
741  fhPhiMCPart[imcPart]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
742  outputContainer->Add(fhPhiMCPart[imcPart]);
743 
744  fhEtaMCPart[imcPart] = new TH2F (Form("hEtaMC%s",histoName[imcPart].Data()),
745  Form("reconstructed #eta vs #it{p}_{T} distribution from %s",titleName[imcPart].Data()),
746  nptbins,ptmin,ptmax, netabins,etamin,etamax);
747  fhEtaMCPart[imcPart]->SetYTitle("#eta ");
748  fhEtaMCPart[imcPart]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
749  outputContainer->Add(fhEtaMCPart[imcPart]);
750 
751  fhPtMCPrimPart[imcPart] = new TH1F (Form("hPtMCPrimary%s",histoName[imcPart].Data()),
752  Form("generated #it{p}_{T} distribution from %s",titleName[imcPart].Data()),
753  nptbins,ptmin,ptmax);
754  fhPtMCPrimPart[imcPart]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
755  outputContainer->Add(fhPtMCPrimPart[imcPart]);
756 
757  fhPhiMCPrimPart[imcPart] = new TH2F (Form("hPhiMCPrimary%s",histoName[imcPart].Data()),
758  Form("generated #phi vs #it{p}_{T} distribution from %s",titleName[imcPart].Data()),
759  nptbins,ptmin,ptmax, nphibins,phimin,phimax);
760  fhPhiMCPrimPart[imcPart]->SetYTitle("#phi (rad)");
761  fhPhiMCPrimPart[imcPart]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
762  outputContainer->Add(fhPhiMCPrimPart[imcPart]);
763 
764  fhEtaMCPrimPart[imcPart] = new TH2F (Form("hEtaMCPrimary%s",histoName[imcPart].Data()),
765  Form("generated #eta vs #it{p}_{T} distribution from %s",titleName[imcPart].Data()),
766  nptbins,ptmin,ptmax, netabins,etamin,etamax);
767  fhEtaMCPrimPart[imcPart]->SetYTitle("#eta ");
768  fhEtaMCPrimPart[imcPart]->SetXTitle("#it{p}_{T} (GeV/#it{c})");
769  outputContainer->Add(fhEtaMCPrimPart[imcPart]);
770  }
771  }
772 
773  fhPtNPileUpSPDVtx = new TH2F ("hPt_NPileUpVertSPD","pT of cluster vs N pile-up SPD vertex",
774  nptbins,ptmin,ptmax,20,0,20);
775  fhPtNPileUpSPDVtx->SetYTitle("# vertex ");
776  fhPtNPileUpSPDVtx->SetXTitle("#it{p}_{T} (GeV/#it{c})");
777  outputContainer->Add(fhPtNPileUpSPDVtx);
778 
779  fhPtNPileUpTrkVtx = new TH2F ("hPt_NPileUpVertTracks","pT of cluster vs N pile-up Tracks vertex",
780  nptbins,ptmin,ptmax, 20,0,20 );
781  fhPtNPileUpTrkVtx->SetYTitle("# vertex ");
782  fhPtNPileUpTrkVtx->SetXTitle("#it{p}_{T} (GeV/#it{c})");
783  outputContainer->Add(fhPtNPileUpTrkVtx);
784 
786  {
787  fhPtNPileUpSPDVtxBC0 = new TH2F ("hPt_NPileUpVertSPD_BC0","pT of cluster vs N pile-up SPD vertex",
788  nptbins,ptmin,ptmax,20,0,20);
789  fhPtNPileUpSPDVtxBC0->SetYTitle("# vertex ");
790  fhPtNPileUpSPDVtxBC0->SetXTitle("#it{p}_{T} (GeV/#it{c})");
791  outputContainer->Add(fhPtNPileUpSPDVtxBC0);
792 
793  fhPtNPileUpTrkVtxBC0 = new TH2F ("hPt_NPileUpVertTracks_BC0","pT of cluster vs N pile-up Tracks vertex",
794  nptbins,ptmin,ptmax, 20,0,20 );
795  fhPtNPileUpTrkVtxBC0->SetYTitle("# vertex ");
796  fhPtNPileUpTrkVtxBC0->SetXTitle("#it{p}_{T} (GeV/#it{c})");
797  outputContainer->Add(fhPtNPileUpTrkVtxBC0);
798  }
799 
800  return outputContainer;
801 }
802 
803 //___________________________________________
805 //___________________________________________
807 {
808  SetOutputAODClassName("AliAODPWG4Particle");
809  SetOutputAODName("PWG4Particle");
810 
811  AddToHistogramsName("AnaCharged_");
812 }
813 
814 //____________________________________________________________
816 //____________________________________________________________
818 {
819  if(! opt)
820  return;
821 
822  printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
824 
825  printf("Min Pt = %3.2f\n", GetMinPt());
826  printf("Max Pt = %3.2f\n", GetMaxPt());
827 }
828 
829 //_________________________________
831 //_________________________________
833 {
834  if(!GetReader()->IsCTSSwitchedOn())
835  AliFatal("STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!");
836 }
837 
838 //_________________________________________________
841 //_________________________________________________
843 {
844  if(!GetCTSTracks() || GetCTSTracks()->GetEntriesFast() == 0) return ;
845 
846  Int_t ntracks = GetCTSTracks()->GetEntriesFast();
847  Double_t vert[3] = {0,0,0}; //vertex ;
848 
849  AliDebug(1,Form("In CTS aod entries %d", ntracks));
850 
851  AliVEvent * event = GetReader()->GetInputEvent();
852  AliESDEvent* esdEv = dynamic_cast<AliESDEvent*> (event);
853  AliAODEvent* aodEv = dynamic_cast<AliAODEvent*> (event);
854 
855  Int_t vtxBC = GetReader()->GetVertexBC();
856  if(!GetReader()->IsDCACutOn()) vtxBC = GetReader()->GetVertexBC(event->GetPrimaryVertex());
857 
859  {
860  fhProductionVertexBC->Fill(vtxBC, GetEventWeight());
861 
862  if(IsPileUpAnalysisOn())
863  {
864  if(GetReader()->IsPileUpFromSPD()) fhProductionVertexBCPileUp[0]->Fill(vtxBC, GetEventWeight());
865  if(GetReader()->IsPileUpFromEMCal()) fhProductionVertexBCPileUp[1]->Fill(vtxBC, GetEventWeight());
866  if(GetReader()->IsPileUpFromSPDOrEMCal()) fhProductionVertexBCPileUp[2]->Fill(vtxBC, GetEventWeight());
867  if(GetReader()->IsPileUpFromSPDAndEMCal()) fhProductionVertexBCPileUp[3]->Fill(vtxBC, GetEventWeight());
868  if(GetReader()->IsPileUpFromSPDAndNotEMCal()) fhProductionVertexBCPileUp[4]->Fill(vtxBC, GetEventWeight());
869  if(GetReader()->IsPileUpFromEMCalAndNotSPD()) fhProductionVertexBCPileUp[5]->Fill(vtxBC, GetEventWeight());
870  if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) fhProductionVertexBCPileUp[6]->Fill(vtxBC, GetEventWeight());
871  }
872  }
873 
874  // N pile up vertices
875  Int_t nVtxSPD = -1;
876  Int_t nVtxTrk = -1;
877 
878  if (esdEv)
879  {
880  nVtxSPD = esdEv->GetNumberOfPileupVerticesSPD();
881  nVtxTrk = esdEv->GetNumberOfPileupVerticesTracks();
882 
883  }//ESD
884  else if (aodEv)
885  {
886  nVtxSPD = aodEv->GetNumberOfPileupVerticesSPD();
887  nVtxTrk = aodEv->GetNumberOfPileupVerticesTracks();
888  }//AOD
889 
890 
891  //printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - primary vertex BC %d\n",vtxBC);
892 
893  Double_t bz = event->GetMagneticField();
894 
895  // Fill AODParticle with CTS aods
896  Float_t pt = 0;
897  Float_t phi = 0;
898  Float_t eta = 0;
899  Int_t evtIndex = 0;
900  for(Int_t i = 0; i < ntracks; i++)
901  {
902  AliVTrack * track = (AliVTrack*) (GetCTSTracks()->At(i));
903 
904  pt = track->Pt();
905  eta = track->Eta();
906  phi = track->Phi();
907 
908  fhPtNoCut->Fill(pt, GetEventWeight());
909 
910  fhPtNPileUpSPDVtx->Fill(pt, nVtxSPD, GetEventWeight());
911  fhPtNPileUpTrkVtx->Fill(pt, nVtxTrk, GetEventWeight());
912 
913  AliAODTrack * aodTrack = dynamic_cast<AliAODTrack*>(track);
914  AliESDtrack * esdTrack = dynamic_cast<AliESDtrack*>(track);
915 
916  if ( esdTrack )
917  {
918  fhTrackResolution->Fill(pt, TMath::Sqrt(esdTrack->GetCovariance()[14])*pt, GetEventWeight());
919  }
920 
921  if ( aodTrack )
922  {
923  Double_t frac = Double_t(aodTrack->GetTPCnclsS()) / Double_t(aodTrack->GetTPCncls());
924 
925  if ( frac > GetReader()->GetTPCSharedClusterFraction() )
927 
928  if ( aodTrack->GetType()!= AliAODTrack::kPrimary )
929  fhPtNotPrimary->Fill(pt, GetEventWeight());
930  }
931 
932  // TOF
933  ULong_t status = track->GetStatus();
934  Bool_t okTOF = (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ;
935  Double32_t tof = track->GetTOFsignal()*1e-3;
936 
937  // DCA
938  Double_t dcaCons = -999;
939  if(aodTrack)
940  {
941  dcaCons = aodTrack->DCA();
942  //vtxBC = aodTrack->GetProdVertex()->GetBC();
943  }
944 
945  Double_t dca[2] = {1e6,1e6};
946  Double_t covar[3] = {1e6,1e6,1e6};
947  track->PropagateToDCA(GetReader()->GetInputEvent()->GetPrimaryVertex(),bz,100.,dca,covar);
948 
949  Float_t trackDCA = dca[0];
950 
951  if(dcaCons == -999)
952  {
953  fhPtDCA[0]->Fill(pt, dca[0], GetEventWeight());
954  fhPtDCA[1]->Fill(pt, dca[1], GetEventWeight());
955  }
956  else
957  {
958  trackDCA = dcaCons;
959  fhPtDCA[2]->Fill(pt, dcaCons, GetEventWeight());
960  }
961 
962  if ( GetReader()->AcceptDCA(pt,trackDCA) && !GetReader()->IsDCACutOn() )
963  fhPtCutDCA->Fill(pt, GetEventWeight());
964 
966  {
967  if(TMath::Abs(vtxBC) > 0 && vtxBC!=AliVTrack::kTOFBCNA)
968  {
969  fhPtVtxOutBC0->Fill(pt, GetEventWeight());
970  fhEtaPhiVtxOutBC0->Fill(eta, phi, GetEventWeight());
971 
972  if(dcaCons == -999)
973  {
974  fhPtDCAVtxOutBC0[0]->Fill(pt, dca[0], GetEventWeight());
975  fhPtDCAVtxOutBC0[1]->Fill(pt, dca[1], GetEventWeight());
976  }
977  else
978  fhPtDCAVtxOutBC0[2]->Fill(pt, dcaCons, GetEventWeight());
979  }
980  else
981  {
982  fhPtVtxInBC0->Fill(pt, GetEventWeight());
983  fhEtaPhiVtxInBC0->Fill(eta, phi, GetEventWeight());
984 
985  fhPtNPileUpSPDVtxBC0->Fill(pt, nVtxSPD, GetEventWeight());
986  fhPtNPileUpTrkVtxBC0->Fill(pt, nVtxTrk, GetEventWeight());
987 
988  if ( GetReader()->AcceptDCA(pt,trackDCA) && !GetReader()->IsDCACutOn() )
989  fhPtCutDCABCOK->Fill(pt, GetEventWeight());
990 
991  if(dcaCons == -999)
992  {
993  fhPtDCAVtxInBC0[0]->Fill(pt, dca[0], GetEventWeight());
994  fhPtDCAVtxInBC0[1]->Fill(pt, dca[1], GetEventWeight());
995  }
996  else
997  fhPtDCAVtxInBC0[2]->Fill(pt, dcaCons, GetEventWeight());
998  }
999  }
1000 
1001  if(IsPileUpAnalysisOn() && GetReader()->IsPileUpFromSPD())
1002  {
1003  if(dcaCons == -999)
1004  {
1005  fhPtDCAPileUp[0]->Fill(pt, dca[0], GetEventWeight());
1006  fhPtDCAPileUp[1]->Fill(pt, dca[1], GetEventWeight());
1007  }
1008  else
1009  fhPtDCAPileUp[2]->Fill(pt, dcaCons, GetEventWeight());
1010 
1012  {
1013  if(TMath::Abs(vtxBC) > 0 && vtxBC!=AliVTrack::kTOFBCNA)
1014  {
1015  if(dcaCons == -999)
1016  {
1017  fhPtDCAVtxOutBC0PileUp[0]->Fill(pt, dca[0], GetEventWeight());
1018  fhPtDCAVtxOutBC0PileUp[1]->Fill(pt, dca[1], GetEventWeight());
1019  }
1020  else fhPtDCAVtxOutBC0PileUp[2]->Fill(pt, dcaCons, GetEventWeight());
1021  }
1022  else
1023  {
1024  if(dcaCons == -999)
1025  {
1026  fhPtDCAVtxInBC0PileUp[0]->Fill(pt, dca[0], GetEventWeight());
1027  fhPtDCAVtxInBC0PileUp[1]->Fill(pt, dca[1], GetEventWeight());
1028  }
1029  else fhPtDCAVtxInBC0PileUp[2]->Fill(pt, dcaCons, GetEventWeight());
1030  }
1031  }
1032  }
1033 
1034  if(!okTOF)
1035  {
1036  if(dcaCons == -999)
1037  {
1038  fhPtDCANoTOFHit[0]->Fill(pt, dca[0], GetEventWeight());
1039  fhPtDCANoTOFHit[1]->Fill(pt, dca[1], GetEventWeight());
1040  }
1041  else
1042  fhPtDCANoTOFHit[2]->Fill(pt, dcaCons, GetEventWeight());
1043 
1045  {
1046  if(TMath::Abs(vtxBC) > 0 && vtxBC!=AliVTrack::kTOFBCNA)
1047  {
1048  if(dcaCons == -999)
1049  {
1050  fhPtDCAVtxOutBC0NoTOFHit[0]->Fill(pt, dca[0], GetEventWeight());
1051  fhPtDCAVtxOutBC0NoTOFHit[1]->Fill(pt, dca[1], GetEventWeight());
1052  }
1053  else
1054  fhPtDCAVtxOutBC0NoTOFHit[2]->Fill(pt, dcaCons, GetEventWeight());
1055  }
1056  else
1057  {
1058  if(dcaCons == -999)
1059  {
1060  fhPtDCAVtxInBC0NoTOFHit[0]->Fill(pt, dca[0], GetEventWeight());
1061  fhPtDCAVtxInBC0NoTOFHit[1]->Fill(pt, dca[1], GetEventWeight());
1062  }
1063  else
1064  fhPtDCAVtxInBC0NoTOFHit[2]->Fill(pt, dcaCons, GetEventWeight());
1065 
1066  }
1067  }
1068 
1069  if(IsPileUpAnalysisOn() && GetReader()->IsPileUpFromSPD())
1070  {
1071  if(dcaCons == -999)
1072  {
1073  fhPtDCAPileUpNoTOFHit[0]->Fill(pt, dca[0], GetEventWeight());
1074  fhPtDCAPileUpNoTOFHit[1]->Fill(pt, dca[1], GetEventWeight());
1075  }
1076  else
1077  fhPtDCAPileUpNoTOFHit[2]->Fill(pt, dcaCons, GetEventWeight());
1078 
1080  {
1081  if(TMath::Abs(vtxBC) > 0 && vtxBC!=AliVTrack::kTOFBCNA)
1082  {
1083  if(dcaCons == -999)
1084  {
1085  fhPtDCAVtxOutBC0PileUpNoTOFHit[0]->Fill(pt, dca[0], GetEventWeight());
1086  fhPtDCAVtxOutBC0PileUpNoTOFHit[1]->Fill(pt, dca[1], GetEventWeight());
1087  }
1088  else
1089  fhPtDCAVtxOutBC0PileUpNoTOFHit[2]->Fill(pt, dcaCons, GetEventWeight());
1090  }
1091  else
1092  {
1093  if(dcaCons == -999)
1094  {
1095  fhPtDCAVtxInBC0PileUpNoTOFHit[0]->Fill(pt, dca[0], GetEventWeight());
1096  fhPtDCAVtxInBC0PileUpNoTOFHit[1]->Fill(pt, dca[1], GetEventWeight());
1097  }
1098  else
1099  fhPtDCAVtxInBC0PileUpNoTOFHit[2]->Fill(pt, dcaCons, GetEventWeight());
1100 
1101  }
1102  }
1103  }
1104  }
1105 
1106  //printf("track pT %2.2f, DCA Cons %f, DCA1 %f, DCA2 %f, TOFBC %d, oktof %d, tof %f\n",
1107  // pt,dcaCons,dca[0],dca[1],track->GetTOFBunchCrossing(bz),okTOF, tof);
1108 
1109 
1110 // if( vtxBC == 0 && trackBC !=0 && trackBC!=AliVTrack::kTOFBCNA)
1111 // printf("TOF Signal %e, BC %d, pt %f, dca_xy %f, dca_z %f, dca_tpc %f \n", tof,trackBC, pt,dca[0],dca[1],dcaCons);
1112 
1113 
1114  if(okTOF)
1115  {
1116  fhTOFSignal ->Fill(tof, GetEventWeight());
1117  fhPtTOFSignal->Fill(pt, tof, GetEventWeight());
1118  if(GetReader()->AcceptDCA(pt,trackDCA) && !GetReader()->IsDCACutOn() )
1119  fhPtTOFSignalDCACut->Fill(pt, tof, GetEventWeight());
1120 
1122  {
1123  if(TMath::Abs(vtxBC) > 0 && vtxBC!=AliVTrack::kTOFBCNA)
1124  fhPtTOFSignalVtxOutBC0->Fill(pt, tof, GetEventWeight());
1125  else
1126  fhPtTOFSignalVtxInBC0->Fill(pt, tof, GetEventWeight());
1127  }
1128 
1129  Int_t trackBC = 1000;
1130 
1132  {
1133  trackBC = track->GetTOFBunchCrossing(bz);
1134 
1135  if(trackBC==0)
1136  {
1137  fhTOFSignalBCOK->Fill(tof, GetEventWeight());
1138 
1139  if(dcaCons == -999)
1140  {
1141  fhPtDCATOFBC0[0]->Fill(pt, dca[0], GetEventWeight());
1142  fhPtDCATOFBC0[1]->Fill(pt, dca[1], GetEventWeight());
1143  }
1144  else
1145  fhPtDCATOFBC0[2]->Fill(pt, dcaCons, GetEventWeight());
1146 
1147  if(IsPileUpAnalysisOn() && GetReader()->IsPileUpFromSPD())
1148  {
1149  if(dcaCons == -999)
1150  {
1151  fhPtDCAPileUpTOFBC0[0]->Fill(pt, dca[0], GetEventWeight());
1152  fhPtDCAPileUpTOFBC0[1]->Fill(pt, dca[1], GetEventWeight());
1153  }
1154  else
1155  fhPtDCAPileUpTOFBC0[2]->Fill(pt, dcaCons, GetEventWeight());
1156  }
1157  }
1158  else if(trackBC!=AliVTrack::kTOFBCNA)
1159  {
1160  if(dcaCons == -999)
1161  {
1162  fhPtDCATOFBCOut[0]->Fill(pt, dca[0], GetEventWeight());
1163  fhPtDCATOFBCOut[1]->Fill(pt, dca[1], GetEventWeight());
1164  }
1165  else
1166  fhPtDCATOFBCOut[2]->Fill(pt, dcaCons, GetEventWeight());
1167  }
1168  }
1169 
1170  if(IsPileUpAnalysisOn())
1171  {
1172  if(GetReader()->IsPileUpFromSPD()) fhPtTOFSignalPileUp[0]->Fill(pt, tof, GetEventWeight());
1173  if(GetReader()->IsPileUpFromEMCal()) fhPtTOFSignalPileUp[1]->Fill(pt, tof, GetEventWeight());
1174  if(GetReader()->IsPileUpFromSPDOrEMCal()) fhPtTOFSignalPileUp[2]->Fill(pt, tof, GetEventWeight());
1175  if(GetReader()->IsPileUpFromSPDAndEMCal()) fhPtTOFSignalPileUp[3]->Fill(pt, tof, GetEventWeight());
1176  if(GetReader()->IsPileUpFromSPDAndNotEMCal()) fhPtTOFSignalPileUp[4]->Fill(pt, tof, GetEventWeight());
1177  if(GetReader()->IsPileUpFromEMCalAndNotSPD()) fhPtTOFSignalPileUp[5]->Fill(pt, tof, GetEventWeight());
1178  if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) fhPtTOFSignalPileUp[6]->Fill(pt, tof, GetEventWeight());
1179 
1181  {
1182  if (trackBC == 0 )
1183  {
1184  fhEtaPhiTOFBC0 ->Fill(eta, phi, GetEventWeight());
1185  if(IsPileUpAnalysisOn() && GetReader()->IsPileUpFromSPD())
1186  fhEtaPhiTOFBC0PileUpSPD->Fill(eta, phi, GetEventWeight());
1187  }
1188  else if (trackBC < 0 )
1189  {
1190  fhEtaPhiTOFBCPlus ->Fill(eta, phi, GetEventWeight());
1191  if(IsPileUpAnalysisOn() && GetReader()->IsPileUpFromSPD())
1192  fhEtaPhiTOFBCPlusPileUpSPD ->Fill(eta, phi, GetEventWeight());
1193  }
1194  else if (trackBC > 0)
1195  {
1196  fhEtaPhiTOFBCMinus->Fill(eta, phi, GetEventWeight());
1197  if(IsPileUpAnalysisOn() && GetReader()->IsPileUpFromSPD())
1198  fhEtaPhiTOFBCMinusPileUpSPD->Fill(eta, phi, GetEventWeight());
1199  }
1200  }
1201 
1203  {
1204  if(TMath::Abs(vtxBC) > 0 && vtxBC!=AliVTrack::kTOFBCNA)
1205  {
1206  if(GetReader()->IsPileUpFromSPD()) fhPtTOFSignalVtxOutBC0PileUp[0]->Fill(pt, tof, GetEventWeight());
1207  if(GetReader()->IsPileUpFromEMCal()) fhPtTOFSignalVtxOutBC0PileUp[1]->Fill(pt, tof, GetEventWeight());
1208  if(GetReader()->IsPileUpFromSPDOrEMCal()) fhPtTOFSignalVtxOutBC0PileUp[2]->Fill(pt, tof, GetEventWeight());
1209  if(GetReader()->IsPileUpFromSPDAndEMCal()) fhPtTOFSignalVtxOutBC0PileUp[3]->Fill(pt, tof, GetEventWeight());
1210  if(GetReader()->IsPileUpFromSPDAndNotEMCal()) fhPtTOFSignalVtxOutBC0PileUp[4]->Fill(pt, tof, GetEventWeight());
1211  if(GetReader()->IsPileUpFromEMCalAndNotSPD()) fhPtTOFSignalVtxOutBC0PileUp[5]->Fill(pt, tof, GetEventWeight());
1212  if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) fhPtTOFSignalVtxOutBC0PileUp[6]->Fill(pt, tof, GetEventWeight());
1213  }
1214  else
1215  {
1216  if(GetReader()->IsPileUpFromSPD()) fhPtTOFSignalVtxInBC0PileUp[0]->Fill(pt, tof, GetEventWeight());
1217  if(GetReader()->IsPileUpFromEMCal()) fhPtTOFSignalVtxInBC0PileUp[1]->Fill(pt, tof, GetEventWeight());
1218  if(GetReader()->IsPileUpFromSPDOrEMCal()) fhPtTOFSignalVtxInBC0PileUp[2]->Fill(pt, tof, GetEventWeight());
1219  if(GetReader()->IsPileUpFromSPDAndEMCal()) fhPtTOFSignalVtxInBC0PileUp[3]->Fill(pt, tof, GetEventWeight());
1220  if(GetReader()->IsPileUpFromSPDAndNotEMCal()) fhPtTOFSignalVtxInBC0PileUp[4]->Fill(pt, tof, GetEventWeight());
1221  if(GetReader()->IsPileUpFromEMCalAndNotSPD()) fhPtTOFSignalVtxInBC0PileUp[5]->Fill(pt, tof, GetEventWeight());
1222  if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) fhPtTOFSignalVtxInBC0PileUp[6]->Fill(pt, tof, GetEventWeight());
1223  }
1224  }
1225  }
1226  }
1227 
1228  // Fill AODParticle after some selection
1229  fMomentum.SetPxPyPzE(track->Px(),track->Py(),track->Pz(),0);
1231 
1232  AliDebug(1,Form("Track pt %2.2f, eta %2.2f, phi %2.2f in fiducial cut %d",pt,eta,phi,in));
1233 
1234  // Acceptance selection
1235  if(IsFiducialCutOn() && ! in ) continue ;
1236 
1237  // Momentum selection
1238  if(pt < GetMinPt() || pt > GetMaxPt()) continue;
1239 
1240  if(okTOF) fhTOFSignalPtCut->Fill(tof, GetEventWeight());
1241  else
1242  {
1243  fhPtTOFStatus0 ->Fill(pt, GetEventWeight());
1244  fhEtaPhiTOFStatus0->Fill(eta, phi, GetEventWeight());
1245  }
1246 
1247  Bool_t bITSRefit = (status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit;
1248  Bool_t bConstrained = kFALSE;
1249  if (aodTrack) bConstrained = aodTrack->IsGlobalConstrained();
1250  else if(esdTrack) bConstrained = (!esdTrack->HasPointOnITSLayer(0) && !esdTrack->HasPointOnITSLayer(1));
1251  //printf("Track %d, pt %2.2f, eta %2.2f, phi %2.2f, SPDRefit %d, refit %d, dcaCons %2.2f\n",
1252  // i, pt, eta, phi, bConstrained, bITSRefit, dcaCons);
1253 
1254  if(bConstrained)
1255  {
1256  if(bITSRefit)
1257  {
1258  fhPtNoSPDRefit->Fill(pt, GetEventWeight());
1259  if(pt < 2)fhEtaPhiNoSPDRefitPt02->Fill(eta, phi, GetEventWeight());
1260  if(pt > 3)fhEtaPhiNoSPDRefitPt3 ->Fill(eta, phi, GetEventWeight());
1261 
1262  if(dcaCons == -999)
1263  {
1264  fhPtDCANoSPDRefit[0]->Fill(pt, dca[0], GetEventWeight());
1265  fhPtDCANoSPDRefit[1]->Fill(pt, dca[1], GetEventWeight());
1266  }
1267  else
1268  fhPtDCANoSPDRefit[2]->Fill(pt, dcaCons, GetEventWeight());
1269 
1270  }
1271  else
1272  {
1273  fhPtNoSPDNoRefit->Fill(pt, GetEventWeight());
1274  if(pt < 2)fhEtaPhiNoSPDNoRefitPt02->Fill(eta, phi, GetEventWeight());
1275  if(pt > 3)fhEtaPhiNoSPDNoRefitPt3 ->Fill(eta, phi, GetEventWeight());
1276  if(dcaCons == -999)
1277  {
1278  fhPtDCANoSPDNoRefit[0]->Fill(pt, dca[0], GetEventWeight());
1279  fhPtDCANoSPDNoRefit[1]->Fill(pt, dca[1], GetEventWeight());
1280  }
1281  else
1282  fhPtDCANoSPDNoRefit[2]->Fill(pt, dcaCons, GetEventWeight());
1283  }
1284  }
1285  else
1286  {
1287  fhPtSPDRefit->Fill(pt, GetEventWeight());
1288  if(pt < 2)fhEtaPhiSPDRefitPt02->Fill(eta, phi, GetEventWeight());
1289  if(pt > 3)fhEtaPhiSPDRefitPt3 ->Fill(eta, phi, GetEventWeight());
1290  if(dcaCons == -999)
1291  {
1292  fhPtDCASPDRefit[0]->Fill(pt, dca[0], GetEventWeight());
1293  fhPtDCASPDRefit[1]->Fill(pt, dca[1], GetEventWeight());
1294  }
1295  else
1296  fhPtDCASPDRefit[2]->Fill(pt, dcaCons, GetEventWeight());
1297  }
1298 
1299  // Mixed event
1300  if (GetMixedEvent())
1301  {
1302  evtIndex = GetMixedEvent()->EventIndex(GetReader()->GetTrackID(track)) ; // needed instead of track->GetID() since AOD needs some manipulations
1303  }
1304 
1305  GetVertex(vert,evtIndex);
1306  if(TMath::Abs(vert[2])> GetZvertexCut()) return;
1307 
1308  AliAODPWG4Particle tr = AliAODPWG4Particle(track->Px(),track->Py(),track->Pz(),0);
1309  tr.SetDetectorTag(kCTS);
1310  tr.SetLabel(track->GetLabel());
1311  tr.SetTrackLabel(GetReader()->GetTrackID(track),-1); // needed instead of track->GetID() since AOD needs some manipulations
1312  tr.SetChargedBit(track->Charge()>0);
1313 
1314  AddAODParticle(tr);
1315  } // loop
1316 
1317  AliDebug(1,Form("Final aod branch entries %d", GetOutputAODBranch()->GetEntriesFast()));
1318 }
1319 
1320 //________________________________________________________
1322 //________________________________________________________
1324 {
1326 
1327  //Loop on stored AODParticles
1328  Int_t naod = GetOutputAODBranch()->GetEntriesFast();
1329 
1331 
1332  AliDebug(1,Form("AOD branch entries %d", naod));
1333 
1334  Float_t pt = 0;
1335  Float_t phi = 0;
1336  Float_t eta = 0;
1337 
1338  Float_t sum[18][2];
1339  for(Int_t i = 0; i < 18; i++)
1340  for(Int_t j = 0; j < 2; j++)
1341  sum[i][j] = 0;
1342 
1343  for(Int_t iaod = 0; iaod < naod ; iaod++)
1344  {
1345  AliAODPWG4Particle* track = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
1346 
1347  pt = track->Pt();
1348  eta = track->Eta();
1349  phi = track->Phi();
1350 
1351  fhPt->Fill(pt, GetEventWeight());
1352 
1354  {
1355  Int_t sector = GetTrackSector(phi);
1356  Bool_t side = GetTrackSide (eta);
1357 
1358  //printf("track eta %2.2f, side %d, phi %2.2f sector %d\n",
1359  // eta, GetTrackSide(eta), phi, GetTrackSector(phi));
1360 
1361  fhPtPerRegion[sector][side]->Fill(pt, GetEventWeight());
1362  sum[sector][side]+=pt;
1363  }
1364 
1365  if(track->GetChargedBit())
1366  {
1367  fhPhiPos ->Fill(pt, phi, GetEventWeight());
1368  fhEtaPos ->Fill(pt, eta, GetEventWeight());
1369  fhEtaPhiPos->Fill(eta, phi, GetEventWeight());
1370  }
1371  else
1372  {
1373  fhPhiNeg ->Fill(pt, phi, GetEventWeight());
1374  fhEtaNeg ->Fill(pt, eta, GetEventWeight());
1375  fhEtaPhiNeg->Fill(eta, phi, GetEventWeight());
1376  }
1377 
1378  if(IsPileUpAnalysisOn())
1379  {
1380  if(GetReader()->IsPileUpFromSPD()) {fhPtPileUp[0]->Fill(pt, GetEventWeight());}
1381  if(GetReader()->IsPileUpFromEMCal()) {fhPtPileUp[1]->Fill(pt, GetEventWeight());}
1382  if(GetReader()->IsPileUpFromSPDOrEMCal()) {fhPtPileUp[2]->Fill(pt, GetEventWeight());}
1383  if(GetReader()->IsPileUpFromSPDAndEMCal()) {fhPtPileUp[3]->Fill(pt, GetEventWeight());}
1384  if(GetReader()->IsPileUpFromSPDAndNotEMCal()) {fhPtPileUp[4]->Fill(pt, GetEventWeight());}
1385  if(GetReader()->IsPileUpFromEMCalAndNotSPD()) {fhPtPileUp[5]->Fill(pt, GetEventWeight());}
1386  if(GetReader()->IsPileUpFromNotSPDAndNotEMCal()) {fhPtPileUp[6]->Fill(pt, GetEventWeight());}
1387  }
1388 
1389  if(IsDataMC())
1390  {
1391  // Play with the MC stack if available
1392  Int_t mompdg = -1;
1393  Int_t label = track->GetLabel();
1394 
1395  if(label >= 0)
1396  {
1397  if( GetReader()->ReadStack() && label < GetMCStack()->GetNtrack())
1398  {
1399  TParticle * mom = GetMCStack()->Particle(label);
1400  mompdg =TMath::Abs(mom->GetPdgCode());
1401  }
1402  else if(GetReader()->ReadAODMCParticles())
1403  {
1404  AliAODMCParticle * aodmom = 0;
1405  //Get the list of MC particles
1406  aodmom = (AliAODMCParticle*) (GetReader()->GetAODMCParticles())->At(label);
1407  mompdg =TMath::Abs(aodmom->GetPdgCode());
1408  }
1409  }
1410 
1411  Int_t mcType = kmcUnknown;
1412  if (mompdg==211 ) mcType = kmcPion;
1413  else if(mompdg==2212) mcType = kmcProton;
1414  else if(mompdg==321 ) mcType = kmcKaon;
1415  else if(mompdg==11 ) mcType = kmcElectron;
1416  else if(mompdg==13 ) mcType = kmcMuon;
1417 
1418  fhPtMCPart [mcType]->Fill(pt, GetEventWeight());
1419  fhEtaMCPart[mcType]->Fill(pt, eta, GetEventWeight());
1420  fhPhiMCPart[mcType]->Fill(pt, phi, GetEventWeight());
1421 
1422  } // Work with stack also
1423 
1424  } // aod branch loop
1425 
1427  {
1428  for(Int_t i = 0; i < 18; i++)
1429  {
1430  for(Int_t j = 0; j < 2; j++)
1431  {
1432  fhSumPtPerRegion[i][j]->Fill(sum[i][j], GetEventWeight());
1433  }
1434  }
1435  }
1436 }
Int_t charge
Float_t GetHistoPtMax() const
Int_t pdg
TH2F * fhPtDCAVtxInBC0PileUpNoTOFHit[3]
! DCA (xy,z,constrained) of all tracks, vertex BC=0, SPD pile-up, no hit in TOF
Float_t GetHistoPtMin() const
virtual TObjArray * GetCTSTracks() const
TH2F * fhPtDCANoTOFHit[3]
! DCA (xy,z,constrained) of all tracks, no hit in TOF
TH2F * fhPtDCAPileUpNoTOFHit[3]
! DCA (xy,z,constrained) of all tracks, SPD pile-up, no hit in TOF
TH2F * fhPtDCATOFBCOut[3]
! DCA (xy,z,constrained) of all tracks, hit in TOF and BC!=0
Bool_t fFillTrackBCHistograms
Fill histograms for tracks with TOF BC=0 or not related histograms.
TH2F * fhPtTOFSignalVtxInBC0
! TOF signal vs track pT, good status
double Double_t
Definition: External.C:58
Int_t GetTrackSector(Float_t trackPhi) const
TH1F * fhPtNotSharedClusterCut
! pT spectra of tracks not passing the shared clusters cut (AOD)
virtual void AddToHistogramsName(TString add)
Bool_t GetTrackSide(Float_t trackEta) const
Definition: External.C:236
TH2F * fhPtTOFSignalVtxInBC0PileUp[7]
! TOF signal vs track pT, good status, pile-up
TH1F * fhTOFSignalPtCut
! TOF signal pt and acceptance cut
TH2F * fhPtDCAVtxOutBC0PileUp[3]
! DCA (xy,z,constrained) of all tracks, vertex BC!=0, SPD pile-up
TH2F * fhPtDCAVtxOutBC0NoTOFHit[3]
! DCA (xy,z,constrained) of all tracks, vertex BC!=0, no hit in TOF
TH2F * fhPtTOFSignalPileUp[7]
! TOF signal vs track pT, good status, pile-up
Bool_t ReadAODMCParticles() const
virtual void GetVertex(Double_t vertex[3]) const
TH2F * fhPtTOFSignalDCACut
! TOF signal vs track pT, good status
TH2F * fhPtNPileUpSPDVtx
! cluster pt vs number of spd pile-up vertices
Int_t GetVertexBC(const AliVVertex *vtx)
virtual AliVEvent * GetInputEvent() const
TH1F * fhProductionVertexBCPileUp[7]
! Check BC of production vertex, pile-up
TH2F * fhEtaPhiNoSPDRefitPt3
! eta-phi distribution of constrained tracks no SPD and with ITSRefit, pT > 3 GeV ...
TH2F * fhEtaPhiTOFBCMinusPileUpSPD
! eta/phi of tracks passing TOF status selection, tracks in BC<0, pile-up spd
TH2F * fhPhiMCPart[6]
! phi distribution vs pT, 6 hadron ID
virtual Float_t GetZvertexCut() const
Maximal number of events for mixin.
TH2F * fhEtaPhiPos
! eta vs phi distribution of positive charge
TH2F * fhEtaPhiNoSPDRefitPt02
! eta-phi distribution of constrained tracks no SPD and with ITSRefit, 0 < pT < 2 GeV ...
void FillPrimaryHistograms()
Fill primary generated particles histograms if MC data is available.
TH2F * fhPtTOFSignalVtxOutBC0PileUp[7]
! TOF signal vs track pT, good status, pile-up
virtual void SetOutputAODClassName(TString name)
TH2F * fhEtaMCPrimPart[6]
! Number of generated charged hadrons vs eta coming from MC particle, 6 hadron ID ...
TH2F * fhEtaPhiTOFStatus0
! eta/phi of tracks not passing TOF status selection
Int_t GetHistoPhiBins() const
TH2F * fhEtaPhiNeg
! eta vs phi distribution of negative charge
TH2F * fhPtDCAVtxInBC0NoTOFHit[3]
! DCA (xy,z,constrained) of all tracks, vertex BC=0, no hit in TOF
TH2F * fhPtDCA[3]
! DCA (xy,z,constrained) of all tracks
TH2F * fhPtDCAPileUp[3]
! DCA (xy,z,constrained) of all tracks, SPD pile-up
TH1F * fhPt
! pT distribution
virtual TClonesArray * GetOutputAODBranch() const
TH1F * fhNtracks
! Track multiplicity distribution
TH2F * fhEtaPhiTOFBC0PileUpSPD
! eta/phi of tracks passing TOF status selection, tracks in BC=0, pile-up spd
TH1F * fhPtPileUp[7]
! pT distribution, pile-up defined events
TH2F * fhPtTOFSignalVtxOutBC0
! TOF signal vs track pT, good status
Float_t GetHistoPhiMin() const
TH2F * fhPhiNeg
! phi distribution vs pT, negative
void MakeAnalysisFillHistograms()
Fill histograms for the selected tracks.
virtual void SetOutputAODName(TString name)
TH1F * fhPtNoSPDRefit
! pT distribution of constrained tracks no SPD and with ITSRefit
TH2F * fhEtaPhiTOFBCPlusPileUpSPD
! eta/phi of tracks passing TOF status selection, tracks in BC>0, pile-up spd
const Double_t etamin
Base class for CaloTrackCorr analysis algorithms.
void Init()
Init. Check that tracks are read, if not abort.
virtual AliFiducialCut * GetFiducialCut()
int Int_t
Definition: External.C:63
TH1F * fhPtNotPrimary
! pT spectra of tracks not declared as primary (AOD)
TH1F * fhPtVtxInBC0
! pT distribution of tracks from a vertex with BC=0
TH2F * fhPtNPileUpTrkVtx
! cluster pt vs number of track pile-up vertices
virtual TClonesArray * GetAODMCParticles() const
virtual AliHistogramRanges * GetHistogramRanges()
TH2F * fhEtaNeg
! eta distribution vs pT, negative
float Float_t
Definition: External.C:68
const Double_t ptmax
TH2F * fhPtDCAVtxOutBC0PileUpNoTOFHit[3]
! DCA (xy,z,constrained) of all tracks, vertex BC!=0, SPD pile-up, no hit in TOF
TH2F * fhEtaPhiSPDRefitPt3
! eta-phi distribution of tracks with SPD and ITS refit, pT > 3 GeV
TH1F * fhPtTOFStatus0
! pT of tracks not passing TOF status selection
Bool_t IsInFiducialCut(Float_t eta, Float_t phi, Int_t det) const
TH2F * fhEtaPhiNoSPDNoRefitPt3
! eta-phi distribution of constrained tracks with no SPD requierement and without ITSRefit...
TH1F * fhSumPtPerRegion[18][2]
! pT distribution in TPC regions
void Print(const Option_t *opt) const
Print some relevant parameters set for the analysis.
TH2F * fhEtaPhiTOFBC0
! eta/phi of tracks passing TOF status selection, tracks in BC=0
TH2F * fhPhiMCPrimPart[6]
! Number of generated charged hadrons vs phi coming from MC particle, 6 hadron ID ...
TH1F * fhPtVtxOutBC0
! pT distribution of tracks from a vertex with BC!=0
const Double_t ptmin
unsigned long ULong_t
Definition: External.C:38
TH2F * fhPtNPileUpSPDVtxBC0
! cluster pt vs number of spd pile-up vertices, track in BC=0
virtual Float_t GetTPCSharedClusterFraction() const
Bool_t fFillEtaPhiRegionHistograms
Fill track pT spectrum histograms in different eta-phi windows.
virtual Double_t GetEventWeight() const
TH2F * fhPtTOFSignal
! TOF signal vs track pT, good status
TH1F * fhProductionVertexBC
! Check BC of production vertex
TH2F * fhPtDCAPileUpTOFBC0[3]
! DCA (xy,z,constrained) of all tracks, hit in TOF and BC=0
Float_t GetHistoEtaMin() const
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)
TH1F * fhTOFSignal
! TOF signal
TH1F * fhPtCutDCA
! pT distribution, Apply DCA cut
TH2F * fhPtDCATOFBC0[3]
! DCA (xy,z,constrained) of all tracks, hit in TOF and BC=0
TH2F * fhEtaMCPart[6]
! eta distribution vs pT, 6 hadron ID
TH1F * fhPtNoSPDNoRefit
! pT distribution of constrained tracks with no SPD requierement and without ITSRefit ...
void InitParameters()
Initialize the parameters of the analysis.
Float_t GetHistoEtaMax() const
virtual void AddAODParticle(AliAODPWG4Particle part)
Int_t GetHistoPtBins() const
TH1F * fhPtMCPart[6]
! pT distribution, 6 hadron ID
Track selection for correlation analysis.
Bool_t fFillVertexBC0Histograms
Fill histograms for tracks with vertex BC=0 or not related histograms.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TH2F * fhEtaPhiVtxInBC0
! eta/phi distribution of tracks from a vertex with BC=0
TH2F * fhPhiPos
! phi distribution vs pT, positive
TH1F * fhPtMCPrimPart[6]
! Number of generated charged hadrons vs pT coming from MC particle, 6 hadron ID
TH2F * fhEtaPos
! eta distribution vs pT, positive
TH2F * fhPtDCANoSPDRefit[3]
! DCA (xy,z,constrained) of constrained tracks no SPD and with ITSRefit
TH1F * fhPtCutDCABCOK
! pT distribution, Apply DCA cut, BC=0 or -100
const Double_t etamax
TH2F * fhPtDCAVtxInBC0[3]
! DCA (xy,z,constrained) of all tracks, vertex BC==0
TH2F * fhEtaPhiNoSPDNoRefitPt02
! eta-phi distribution of constrained tracks with no SPD requierement and without ITSRefit...
virtual void Print(const Option_t *) const
Print some relevant parameters set for the analysis.
TH1F * fhTOFSignalBCOK
! TOF signal pt and acceptance cut
TH2F * fhEtaPhiSPDRefitPt02
! eta-phi distribution of tracks with SPD and ITS refit, 0 < pT < 2 GeV
const char Option_t
Definition: External.C:48
TH2F * fhPtDCAVtxInBC0PileUp[3]
! DCA (xy,z,constrained) of all tracks, vertex BC==0, SPD pile-up
TH2F * fhPtNPileUpTrkVtxBC0
! cluster pt vs number of track pile-up vertices, track in BC=0
Float_t GetHistoPhiMax() const
AliAnaChargedParticles()
Default constructor. Initialize parameters with default values.
bool Bool_t
Definition: External.C:53
virtual AliCaloTrackReader * GetReader() const
Int_t GetHistoEtaBins() const
TH2F * fhEtaPhiTOFBCMinus
! eta/phi of tracks passing TOF status selection, tracks in BC<0
TH1F * fhPtSPDRefit
! pT distribution of tracks with SPD and ITS refit
TH2F * fhPtDCASPDRefit[3]
! DCA (xy,z,constrained) of tracks with SPD and ITS refit
TH2F * fhEtaPhiTOFBCPlus
! eta/phi of tracks passing TOF status selection, tracks in BC>0
TH2F * fhEtaPhiVtxOutBC0
! eta/phi distribution of tracks from a vertex with BC!=0
TH2F * fhPtDCAVtxOutBC0[3]
! DCA (xy,z,constrained) of all tracks, vertex BC!=0
TLorentzVector fMomentum
! Temporary momentum container
TH1F * fhPtPerRegion[18][2]
! pT distribution in TPC regions
TH2F * fhPtDCANoSPDNoRefit[3]
! DCA (xy,z,constrained) of constrained tracks with no SPD requierement and without ITSRefit ...
Int_t nptbins
TH1F * fhPtNoCut
! pT distribution, no cut
virtual AliMixedEvent * GetMixedEvent() const
TH2F * fhTrackResolution
! track resolution sigma pT vs pT, ESDs
const Double_t phimin