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