AliPhysics  6cf2591 (6cf2591)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskCheckHFMCProd.cxx
Go to the documentation of this file.
1 #include "AliAnalysisTaskSE.h"
2 #include "AliAnalysisManager.h"
3 #include "AliAnalysisDataContainer.h"
4 #include "AliESDEvent.h"
5 #include "AliESDtrackCuts.h"
6 #include "AliStack.h"
7 #include "AliCentrality.h"
8 #include "AliMCEventHandler.h"
9 #include "AliMCEvent.h"
10 #include "AliHeader.h"
11 #include "AliGenCocktailEventHeader.h"
12 #include "AliGenHijingEventHeader.h"
13 #include "AliGenEventHeader.h"
14 #include "AliCollisionGeometry.h"
15 #include "AliGenerator.h"
16 #include "AliVertexingHFUtils.h"
17 #include "AliMultiplicity.h"
18 #include <TParticle.h>
19 #include <TSystem.h>
20 #include <TTree.h>
21 #include <TNtuple.h>
22 #include <TH1F.h>
23 #include <TH2F.h>
24 #include <TH3F.h>
25 #include <TChain.h>
26 #include "AliESDInputHandlerRP.h"
28 
29 /**************************************************************************
30  * Copyright(c) 1998-2012, ALICE Experiment at CERN, All rights reserved. *
31  * *
32  * Author: The ALICE Off-line Project. *
33  * Contributors are mentioned in the code where appropriate. *
34  * *
35  * Permission to use, copy, modify and distribute this software and its *
36  * documentation strictly for non-commercial purposes is hereby granted *
37  * without fee, provided that the above copyright notice appears in all *
38  * copies and that both the copyright notice and this permission notice *
39  * appear in the supporting documentation. The authors make no claims *
40  * about the suitability of this software for any purpose. It is *
41  * provided "as is" without express or implied warranty. *
42  **************************************************************************/
43 
44 /* $Id$ */
45 
46 //*************************************************************************
47 // Implementation of class AliAnalysisTaskCheckHFMCProd
48 // AliAnalysisTask to check MC production at ESD+Kine level
49 //
50 //
51 // Authors: F. Prino, prino@to.infn.it
52 //
53 //*************************************************************************
54 
58 
59 //______________________________________________________________________________
61  AliAnalysisTaskSE("HFMCChecks"),
62  fOutput(0),
63  fHistoNEvents(0),
64  fHistoPhysPrim(0),
65  fHistoPhysPrimPiKPi09(0),
66  fHistoPhysPrimPiKPi09vsb(0),
67  fHistoTracks(0),
68  fHistoSelTracks(0),
69  fHistoTracklets(0),
70  fHistoTrackletsEta1(0),
71  fHistoPtPhysPrim(0),
72  fHistoEtaPhysPrim(0),
73  fHistoSPD3DVtxX(0),
74  fHistoSPD3DVtxY(0),
75  fHistoSPD3DVtxZ(0),
76  fHistoSPDZVtxX(0),
77  fHistoSPDZVtxY(0),
78  fHistoSPDZVtxZ(0),
79  fHistoTRKVtxX(0),
80  fHistoTRKVtxY(0),
81  fHistoTRKVtxZ(0),
82  fHistoNcharmed(0),
83  fHistoNbVsNc(0),
84  fHistOriginPrompt(0),
85  fHistOriginFeeddown(0),
86  fHistMotherID(0),
87  fHistDSpecies(0),
88  fHistBSpecies(0),
89  fHistLcDecayChan(0),
90  fHistNcollHFtype(0),
91  fHistNinjectedvsb(0),
92  fHistEtaPhiPtGenEle(0),
93  fHistEtaPhiPtGenPi(0),
94  fHistEtaPhiPtGenK(0),
95  fHistEtaPhiPtGenPro(0),
96  fHistEtaPhiPtRecEle(0),
97  fHistEtaPhiPtRecPi(0),
98  fHistEtaPhiPtRecK(0),
99  fHistEtaPhiPtRecPro(0),
100  fHistPtRecVsPtGen(0),
101  fHistPhiRecVsPhiGen(0),
102  fHistEtaRecVsEtaGen(0),
103  fHistPtRecGood(0),
104  fHistPtRecFake(0),
105  fSearchUpToQuark(kFALSE),
106  fSystem(0),
107  fESDtrackCuts(0x0),
108  fReadMC(kTRUE)
109 {
110  //
111  for(Int_t i=0; i<5; i++){
112  fHistBYPtAllDecay[i]=0x0;
113  fHistYPtAllDecay[i]=0x0;
114  fHistYPtPromptAllDecay[i]=0x0;
116  fHistYPtPrompt[i]=0x0;
117  fHistYPtFeeddown[i]=0x0;
118  }
119  for(Int_t i=0; i<2; i++){
120  fHistYPtD0byDecChannel[i]=0x0;
122  fHistYPtDsbyDecChannel[i]=0x0;
123  }
125 
126  DefineInput(0, TChain::Class());
127  DefineOutput(1, TList::Class());
128 }
129 
130 
131 //___________________________________________________________________________
133  //
134  if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;
135  if (fOutput) {
136  delete fOutput;
137  fOutput = 0;
138  }
139  delete fESDtrackCuts;
140 
141 }
142 
143 //___________________________________________________________________________
146 
147  fOutput = new TList();
148  fOutput->SetOwner();
149  fOutput->SetName("OutputHistos");
150 
151  fHistoNEvents = new TH1F("hNEvents", "Number of processed events",3,-0.5,2.5);
152  fHistoNEvents->SetMinimum(0);
153  fOutput->Add(fHistoNEvents);
154 
155  Double_t maxMult=100.;
156  if(fSystem==1) maxMult=10000.;
157  if(fSystem==2) maxMult=500.;
158  fHistoPhysPrim = new TH1F("hPhysPrim","",100,-0.5,maxMult-0.5);
159  fOutput->Add(fHistoPhysPrim);
160  fHistoPhysPrimPiKPi09 = new TH1F("hPhysPrimPiKPi09","",100,-0.5,maxMult-0.5);
162  fHistoPhysPrimPiKPi09vsb = new TH2F("hPhysPrimPiKPi09vsb","",50,0.,20.,100,-0.5,maxMult-0.5);
164 
165  fHistoTracks = new TH1F("hTracks","",100,-0.5,maxMult*2-0.5);
166  fOutput->Add(fHistoTracks);
167  fHistoSelTracks = new TH1F("hSelTracks","",100,-0.5,maxMult-0.5);
168  fOutput->Add(fHistoSelTracks);
169  fHistoTracklets = new TH1F("hTracklets","",100,-0.5,maxMult-0.5);
170  fOutput->Add(fHistoTracklets);
171  fHistoTrackletsEta1 = new TH1F("hTrackletsEta1","",100,-0.5,maxMult-0.5);
173  fHistoPtPhysPrim = new TH1F("hPtPhysPrim","",100,0.,20.);
175  fHistoEtaPhysPrim = new TH1F("hEtaPhysPrim","",100,-10.,10.);
177 
178  fHistoSPD3DVtxX = new TH1F("hSPD3DvX","",100,-1.,1.);
179  fOutput->Add(fHistoSPD3DVtxX);
180  fHistoSPD3DVtxY = new TH1F("hSPD3DvY","",100,-1.,1.);
181  fOutput->Add(fHistoSPD3DVtxY);
182  fHistoSPD3DVtxZ = new TH1F("hSPD3DvZ","",100,-15.,15.);
183  fOutput->Add(fHistoSPD3DVtxZ);
184 
185  fHistoSPDZVtxX = new TH1F("hSPDZvX","",100,-1.,1.);
186  fOutput->Add(fHistoSPDZVtxX);
187  fHistoSPDZVtxY = new TH1F("hSPDZvY","",100,-1.,1.);
188  fOutput->Add(fHistoSPDZVtxY);
189  fHistoSPDZVtxZ = new TH1F("hSPDZvZ","",100,-15.,15.);
190  fOutput->Add(fHistoSPDZVtxZ);
191 
192 
193  fHistoTRKVtxX = new TH1F("hTRKvX","",100,-1.,1.);
194  fOutput->Add(fHistoTRKVtxX);
195  fHistoTRKVtxY = new TH1F("hTRKvY","",100,-1.,1.);
196  fOutput->Add(fHistoTRKVtxY);
197  fHistoTRKVtxZ = new TH1F("hTRKvZ","",100,-15.,15.);
198  fOutput->Add(fHistoTRKVtxZ);
199 
200  Int_t nBinscb=11;
201  if(fSystem==1) nBinscb=200;
202  if(fSystem==2) nBinscb=21;
203  Double_t maxncn=nBinscb-0.5;
204  fHistoNcharmed = new TH2F("hncharmed","",100,-0.5,maxMult-0.5,nBinscb,-0.5,maxncn);
205  fOutput->Add(fHistoNcharmed);
206  fHistoNbVsNc = new TH2F("hnbvsnc","",nBinscb,-0.5,maxncn,nBinscb,-0.5,maxncn);
207  fOutput->Add(fHistoNbVsNc);
208 
209  fHistYPtPrompt[0] = new TH2F("hyptD0prompt","D0 - Prompt",40,0.,40.,20,-2.,2.);
210  fHistYPtPrompt[1] = new TH2F("hyptDplusprompt","Dplus - Prompt",40,0.,40.,20,-2.,2.);
211  fHistYPtPrompt[2] = new TH2F("hyptDstarprompt","Dstar - Prompt",40,0.,40.,20,-2.,2.);
212  fHistYPtPrompt[3] = new TH2F("hyptDsprompt","Ds - Prompt",40,0.,40.,20,-2.,2.);
213  fHistYPtPrompt[4] = new TH2F("hyptLcprompt","Lc - Prompt",40,0.,40.,20,-2.,2.);
214 
215  fHistBYPtAllDecay[0] = new TH2F("hyptB0AllDecay","B0 - All",40,0.,40.,40,-2.,2.);
216  fHistBYPtAllDecay[1] = new TH2F("hyptBplusAllDecay","Bplus - All",40,0.,40.,40,-2.,2.);
217  fHistBYPtAllDecay[2] = new TH2F("hyptBstarAllDecay","Bstar - All",40,0.,40.,40,-2.,2.);
218  fHistBYPtAllDecay[3] = new TH2F("hyptBsAllDecay","Bs - All",40,0.,40.,40,-2.,2.);
219  fHistBYPtAllDecay[4] = new TH2F("hyptLbAllDecay","LB - All",40,0.,40.,40,-2.,2.);
220 
221  fHistYPtAllDecay[0] = new TH2F("hyptD0AllDecay","D0 - All",40,0.,40.,40,-2.,2.);
222  fHistYPtAllDecay[1] = new TH2F("hyptDplusAllDecay","Dplus - All",40,0.,40.,40,-2.,2.);
223  fHistYPtAllDecay[2] = new TH2F("hyptDstarAllDecay","Dstar - All",40,0.,40.,40,-2.,2.);
224  fHistYPtAllDecay[3] = new TH2F("hyptDsAllDecay","Ds - All",40,0.,40.,40,-2.,2.);
225  fHistYPtAllDecay[4] = new TH2F("hyptLcAllDecay","Lc - All",40,0.,40.,40,-2.,2.);
226 
227  fHistYPtPromptAllDecay[0] = new TH2F("hyptD0promptAllDecay","D0 - Prompt",40,0.,40.,40,-2.,2.);
228  fHistYPtPromptAllDecay[1] = new TH2F("hyptDpluspromptAllDecay","Dplus - Prompt",40,0.,40.,40,-2.,2.);
229  fHistYPtPromptAllDecay[2] = new TH2F("hyptDstarpromptAllDecay","Dstar - Prompt",40,0.,40.,40,-2.,2.);
230  fHistYPtPromptAllDecay[3] = new TH2F("hyptDspromptAllDecay","Ds - Prompt",40,0.,40.,40,-2.,2.);
231  fHistYPtPromptAllDecay[4] = new TH2F("hyptLcpromptAllDecay","Lc - Prompt",40,0.,40.,40,-2.,2.);
232 
233  fHistYPtFeeddownAllDecay[0] = new TH2F("hyptD0feeddownAllDecay","D0 - FromB",40,0.,40.,40,-2.,2.);
234  fHistYPtFeeddownAllDecay[1] = new TH2F("hyptDplusfeeddownAllDecay","Dplus - FromB",40,0.,40.,40,-2.,2.);
235  fHistYPtFeeddownAllDecay[2] = new TH2F("hyptDstarfeeddownAllDecay","Dstar - FromB",40,0.,40.,40,-2.,2.);
236  fHistYPtFeeddownAllDecay[3] = new TH2F("hyptDsfeeddownAllDecay","Ds - FromB",40,0.,40.,40,-2.,2.);
237  fHistYPtFeeddownAllDecay[4] = new TH2F("hyptLcfeeddownAllDecay","Lc - FromB",40,0.,40.,40,-2.,2.);
238 
239 
240  fHistYPtFeeddown[0] = new TH2F("hyptD0feeddown","D0 - Feeddown",40,0.,40.,20,-2.,2.);
241  fHistYPtFeeddown[1] = new TH2F("hyptDplusfeeddown","Dplus - Feeddown",40,0.,40.,20,-2.,2.);
242  fHistYPtFeeddown[2] = new TH2F("hyptDstarfeedown","Dstar - Feeddown",40,0.,40.,20,-2.,2.);
243  fHistYPtFeeddown[3] = new TH2F("hyptDsfeedown","Ds - Feeddown",40,0.,40.,20,-2.,2.);
244  fHistYPtFeeddown[4] = new TH2F("hyptLcfeedown","Lc - Feeddown",40,0.,40.,20,-2.,2.);
245 
246  for(Int_t ih=0; ih<5; ih++){
247  fHistBYPtAllDecay[ih]->SetMinimum(0);
248  fOutput->Add(fHistBYPtAllDecay[ih]);
249  fHistYPtAllDecay[ih]->SetMinimum(0);
250  fOutput->Add(fHistYPtAllDecay[ih]);
251  fHistYPtPromptAllDecay[ih]->SetMinimum(0);
253  fHistYPtFeeddownAllDecay[ih]->SetMinimum(0);
255  fHistYPtPrompt[ih]->SetMinimum(0);
256  fOutput->Add(fHistYPtPrompt[ih]);
257  fHistYPtFeeddown[ih]->SetMinimum(0);
258  fOutput->Add(fHistYPtFeeddown[ih]);
259  }
260 
261  fHistYPtD0byDecChannel[0] = new TH2F("hyptD02","D0 - 2prong",40,0.,40.,20,-2.,2.);
262  fHistYPtD0byDecChannel[1] = new TH2F("hyptD04","D0 - 4prong",40,0.,40.,20,-2.,2.);
263  fHistYPtDplusbyDecChannel[0] = new TH2F("hyptDplusnonreson","Dplus - non reson",40,0.,40.,20,-2.,2.);
264  fHistYPtDplusbyDecChannel[1] = new TH2F("hyptDplusreson","Dplus - reson via K0*",40,0.,40.,20,-2.,2.);
265  fHistYPtDplusbyDecChannel[2] = new TH2F("hyptDplusKKpi","Dplus -> KKpi",40,0.,40.,20,-2.,2.);
266  fHistYPtDsbyDecChannel[0] = new TH2F("hyptDsphi","Ds - vis Phi",40,0.,40.,20,-2.,2.);
267  fHistYPtDsbyDecChannel[1] = new TH2F("hyptDsk0st","Ds - via k0*",40,0.,40.,20,-2.,2.);
268 
269  for(Int_t ih=0; ih<2; ih++){
270 
271  fHistYPtD0byDecChannel[ih]->SetMinimum(0);
273  fHistYPtDplusbyDecChannel[ih]->SetMinimum(0);
275  fHistYPtDsbyDecChannel[ih]->SetMinimum(0);
277  }
278  fHistYPtDplusbyDecChannel[2]->SetMinimum(0);
280 
281  fHistOriginPrompt=new TH1F("hOriginPrompt","",100,0.,0.5);
282  fHistOriginPrompt->SetMinimum(0);
284  fHistOriginFeeddown=new TH1F("hOriginFeeddown","",100,0.,0.5);
285  fHistOriginFeeddown->SetMinimum(0);
287  fHistMotherID=new TH1F("hMotherID","",1000,-1.5,998.5);
288  fHistMotherID->SetMinimum(0);
289  fOutput->Add(fHistMotherID);
290  fHistDSpecies=new TH1F("hDSpecies","",10,-0.5,9.5);
291  fHistDSpecies->GetXaxis()->SetBinLabel(1,"D0");
292  fHistDSpecies->GetXaxis()->SetBinLabel(2,"D0bar");
293  fHistDSpecies->GetXaxis()->SetBinLabel(3,"D+");
294  fHistDSpecies->GetXaxis()->SetBinLabel(4,"D-");
295  fHistDSpecies->GetXaxis()->SetBinLabel(5,"D*+");
296  fHistDSpecies->GetXaxis()->SetBinLabel(6,"D*-");
297  fHistDSpecies->GetXaxis()->SetBinLabel(7,"Ds+");
298  fHistDSpecies->GetXaxis()->SetBinLabel(8,"Ds-");
299  fHistDSpecies->GetXaxis()->SetBinLabel(9,"Lc+");
300  fHistDSpecies->GetXaxis()->SetBinLabel(10,"Lc-");
301  fHistDSpecies->SetMinimum(0);
302  fOutput->Add(fHistDSpecies);
303  fHistBSpecies=new TH1F("hBSpecies","",10,-0.5,9.5);
304  fHistBSpecies->GetXaxis()->SetBinLabel(1,"B0");
305  fHistBSpecies->GetXaxis()->SetBinLabel(2,"B0bar");
306  fHistBSpecies->GetXaxis()->SetBinLabel(3,"B+");
307  fHistBSpecies->GetXaxis()->SetBinLabel(4,"B-");
308  fHistBSpecies->GetXaxis()->SetBinLabel(5,"B*+");
309  fHistBSpecies->GetXaxis()->SetBinLabel(6,"B*-");
310  fHistBSpecies->GetXaxis()->SetBinLabel(7,"Bs+");
311  fHistBSpecies->GetXaxis()->SetBinLabel(8,"Bs-");
312  fHistBSpecies->GetXaxis()->SetBinLabel(9,"Lb+");
313  fHistBSpecies->GetXaxis()->SetBinLabel(10,"Lb-");
314  fHistBSpecies->SetMinimum(0);
315  fOutput->Add(fHistBSpecies);
316  fHistLcDecayChan=new TH1F("hLcDecayChan","",9,-2.5,6.5);
317  fHistLcDecayChan->GetXaxis()->SetBinLabel(1,"Violates p cons");
318  fHistLcDecayChan->GetXaxis()->SetBinLabel(2,"Other decay");
319  fHistLcDecayChan->GetXaxis()->SetBinLabel(3,"Error");
320  fHistLcDecayChan->GetXaxis()->SetBinLabel(4,"pK#pi non res");
321  fHistLcDecayChan->GetXaxis()->SetBinLabel(5,"pK#pi via K*0");
322  fHistLcDecayChan->GetXaxis()->SetBinLabel(6,"pK#pi via #Delta++");
323  fHistLcDecayChan->GetXaxis()->SetBinLabel(7,"pK#pi via #Lambda1520");
324  fHistLcDecayChan->GetXaxis()->SetBinLabel(8,"pK0s#rightarrowp#pi#pi");
325  fHistLcDecayChan->GetXaxis()->SetBinLabel(9,"#pi#Lambda#rightarrowp#pi#pi");
326  fHistLcDecayChan->SetMinimum(0);
328 
329  fHistNcollHFtype=new TH2F("hNcollHFtype","",5,-1.5,3.5,30,-0.5,29.5);
331  fHistNinjectedvsb=new TH2F("hNinjectedvsb","",50,0.,20.,140,-0.5,139.5);
333 
334  Double_t binseta[11]={-1.0,-0.8,-0.6,-0.4,-0.2,0.,0.2,0.4,0.6,0.8,1.0};
335  const Int_t nBinsPhi=40;
336  Double_t binsphi[nBinsPhi+1];
337  for(Int_t ib=0; ib<=nBinsPhi; ib++) binsphi[ib]=ib*TMath::Pi()/20.;
338  const Int_t nBinsPt=24;
339  Double_t binspt[nBinsPt+1]={0.,0.10,0.15,0.2,0.25,
340  0.3,0.4,0.5,0.6,0.7,
341  0.8,0.9,1.,1.25,1.5,
342  1.75,2.,2.5,3.,4.,
343  5.,7.5,10.,15.,20.};
344 
345  fHistEtaPhiPtGenEle=new TH3F("hEtaPhiPtGenEle","",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
347  fHistEtaPhiPtGenPi=new TH3F("hEtaPhiPtGenPi","",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
349  fHistEtaPhiPtGenK=new TH3F("hEtaPhiPtGenK","",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
351  fHistEtaPhiPtGenPro=new TH3F("hEtaPhiPtGenPro","",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
353 
354 
355  fHistEtaPhiPtRecEle=new TH3F("hEtaPhiPtRecEle","",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
357  fHistEtaPhiPtRecPi=new TH3F("hEtaPhiPtRecPi","",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
359  fHistEtaPhiPtRecK=new TH3F("hEtaPhiPtRecK","",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
361  fHistEtaPhiPtRecPro=new TH3F("hEtaPhiPtRecPro","",10,binseta,nBinsPhi,binsphi,nBinsPt,binspt);
363 
364  fHistPtRecVsPtGen=new TH2F("hPtRecVsPtGen"," ; particle p_{T} (GeV/c); track p_{T} (GeV/c)",100,0.,10.,100,0.,10.);
366  fHistPhiRecVsPhiGen=new TH2F("hPhiRecVsPhiGen"," ; particle #varphi ; track #varphi",100,0.,2.*TMath::Pi(),100,0.,2.*TMath::Pi());
368  fHistEtaRecVsEtaGen=new TH2F("hEtaRecVsEtaGen"," ; particle #eta ; track #eta",100,0.,2.*TMath::Pi(),100,0.,2.*TMath::Pi());
370 
371  fHistPtRecGood=new TH1F("hPtRecGood"," ; track p_{T} (GeV/c)",100,0.,10.);
372  fOutput->Add(fHistPtRecGood);
373  fHistPtRecFake=new TH1F("hPtRecFake"," ; track p_{T} (GeV/c)",100,0.,10.);
374  fOutput->Add(fHistPtRecFake);
375 
376  PostData(1,fOutput);
377 
378 }
379 //______________________________________________________________________________
381 {
382  //
383 
384  AliESDEvent *esd = (AliESDEvent*) (InputEvent());
385 
386 
387  if(!esd) {
388  printf("AliAnalysisTaskSDDRP::Exec(): bad ESD\n");
389  return;
390  }
391 
392  fHistoNEvents->Fill(0);
393 
394  if(!fESDtrackCuts){
395  Int_t year=2011;
396  if(esd->GetRunNumber()<=139517) year=2010;
397  if(year==2010) fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(kFALSE);
398  else fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
399  fESDtrackCuts->SetMaxDCAToVertexXY(2.4);
400  fESDtrackCuts->SetMaxDCAToVertexZ(3.2);
401  fESDtrackCuts->SetDCAToVertex2D(kTRUE);
402  fESDtrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
403  AliESDtrackCuts::kAny);
404  }
405 
406  Int_t nTracks=esd->GetNumberOfTracks();
407  fHistoTracks->Fill(nTracks);
408  Int_t nSelTracks=0;
409  for(Int_t it=0; it<nTracks; it++){
410  AliESDtrack* tr=esd->GetTrack(it);
411  UInt_t status=tr->GetStatus();
412  if(!(status&AliESDtrack::kITSrefit)) continue;
413  if(!(status&AliESDtrack::kTPCin)) continue;
414  nSelTracks++;
415  }
416  fHistoSelTracks->Fill(nSelTracks);
417 
418  const AliMultiplicity* mult=esd->GetMultiplicity();
419  Int_t nTracklets=mult->GetNumberOfTracklets();
420  Int_t nTracklets1=0;
421  for(Int_t it=0; it<nTracklets; it++){
422  Double_t eta=TMath::Abs(mult->GetEta(it));
423  if(eta<1) nTracklets1++;
424  }
425  fHistoTracklets->Fill(nTracklets);
426  fHistoTrackletsEta1->Fill(nTracklets1);
427 
428  const AliESDVertex *spdv=esd->GetVertex();
429  if(spdv && spdv->IsFromVertexer3D()){
430  fHistoSPD3DVtxX->Fill(spdv->GetX());
431  fHistoSPD3DVtxY->Fill(spdv->GetY());
432  fHistoSPD3DVtxZ->Fill(spdv->GetZ());
433  }
434  if(spdv && spdv->IsFromVertexerZ()){
435  fHistoSPDZVtxX->Fill(spdv->GetX());
436  fHistoSPDZVtxY->Fill(spdv->GetY());
437  fHistoSPDZVtxZ->Fill(spdv->GetZ());
438  }
439  const AliESDVertex *trkv=esd->GetPrimaryVertex();
440  if(trkv && trkv->GetNContributors()>1){
441  fHistoTRKVtxX->Fill(trkv->GetX());
442  fHistoTRKVtxY->Fill(trkv->GetY());
443  fHistoTRKVtxZ->Fill(trkv->GetZ());
444  }
445 
446  AliStack* stack=0;
447 
448  if(fReadMC){
449  AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
450  if (!eventHandler) {
451  Printf("ERROR: Could not retrieve MC event handler");
452  return;
453  }
454  AliMCEvent* mcEvent = eventHandler->MCEvent();
455  if (!mcEvent) {
456  Printf("ERROR: Could not retrieve MC event");
457  return;
458  }
459  stack = mcEvent->Stack();
460  if (!stack) {
461  Printf("ERROR: stack not available");
462  return;
463  }
464  const AliVVertex* mcVert=mcEvent->GetPrimaryVertex();
465  if(!mcVert){
466  Printf("ERROR: generated vertex not available");
467  return;
468  }
469  if(TMath::Abs(mcVert->GetZ())>10) return;
470 
471  // const AliHeader* h=(AliHeader*)mcEvent->GetHeader();
472  // cout<<h<<endl;
473  TString genname=mcEvent->GenEventHeader()->ClassName();
474  Int_t nColl=-1;
475  Double_t imppar=-999.;
476  Int_t nInjected=0;
477  Int_t typeHF=-1;
478  TList* lgen=0x0;
479  if(genname.Contains("CocktailEventHeader")){
480  AliGenCocktailEventHeader *cockhead=(AliGenCocktailEventHeader*)mcEvent->GenEventHeader();
481  lgen=cockhead->GetHeaders();
482  for(Int_t ig=0; ig<lgen->GetEntries(); ig++){
483  AliGenerator* gen=(AliGenerator*)lgen->At(ig);
484  TString title=gen->GetName();
485  if(title.Contains("bchadr")){
486  typeHF=1;
487  nInjected++;
488  }else if(title.Contains("chadr")) {
489  typeHF=0;
490  nInjected++;
491  }else if(title.Contains("bele")){
492  typeHF=3;
493  nInjected++;
494  }else if(title.Contains("cele")){
495  typeHF=2;
496  nInjected++;
497  }else if(title.Contains("pythiaHF")){
498  nInjected++;
499  }else if(title.Contains("hijing") || title.Contains("Hijing")){
500  AliGenHijingEventHeader* hijh=(AliGenHijingEventHeader*)lgen->At(ig);
501  imppar=hijh->ImpactParameter();
502  }
503  }
504  nColl=lgen->GetEntries();
505  fHistNcollHFtype->Fill(typeHF,nColl);
506  fHistNinjectedvsb->Fill(imppar,nInjected);
507  }else if(genname.Contains("HijingEventHeader")){
508  AliGenHijingEventHeader* hijh=(AliGenHijingEventHeader*)mcEvent->GenEventHeader();
509  imppar=hijh->ImpactParameter();
510  }else{
511  TString genTitle=mcEvent->GenEventHeader()->GetTitle();
512  if(genTitle.Contains("bchadr")) typeHF=1;
513  else if(genTitle.Contains("chadr")) typeHF=0;
514  else if(genTitle.Contains("bele")) typeHF=3;
515  else if(genTitle.Contains("cele")) typeHF=2;
516  fHistNcollHFtype->Fill(typeHF,1.);
517  }
518  Int_t nParticles=stack->GetNtrack();
519  Double_t dNchdy = 0.;
520  Int_t nb = 0, nc=0;
521  Int_t nCharmed=0;
522  Int_t nPhysPrim=0;
523  Int_t nPiKPeta09=0;
524  for (Int_t i=0;i<nParticles;i++){
525  TParticle* part = (TParticle*)stack->Particle(i);
526  Int_t absPdg=TMath::Abs(part->GetPdgCode());
527  Int_t pdg=part->GetPdgCode();
528  if(absPdg==4) nc++;
529  if(absPdg==5) nb++;
530  if(stack->IsPhysicalPrimary(i)){
531  Double_t eta=part->Eta();
532  fHistoEtaPhysPrim->Fill(eta);
533  if(absPdg==11) fHistEtaPhiPtGenEle->Fill(eta,part->Phi(),part->Pt());
534  else if(absPdg==211) fHistEtaPhiPtGenPi->Fill(eta,part->Phi(),part->Pt());
535  else if(absPdg==321) fHistEtaPhiPtGenK->Fill(eta,part->Phi(),part->Pt());
536  else if(absPdg==2212) fHistEtaPhiPtGenPro->Fill(eta,part->Phi(),part->Pt());
537 
538  if(TMath::Abs(eta)<0.5){
539  dNchdy+=0.6666; // 2/3 for the ratio charged/all
540  nPhysPrim++;
541  }
542  if(TMath::Abs(eta)<0.9){
543  fHistoPtPhysPrim->Fill(part->Pt());
544  if(absPdg==211 || absPdg==321 || absPdg==2212){
545  nPiKPeta09++;
546  }
547  }
548  }
549  Float_t rapid=-999.;
550  if (part->Energy() != TMath::Abs(part->Pz())){
551  rapid=0.5*TMath::Log((part->Energy()+part->Pz())/(part->Energy()-part->Pz()));
552  }
553  Int_t iPart=-1;
554  Int_t iType=0;
555  Int_t iSpecies=-1;
556  Int_t dummy[4];
557  if(absPdg==421){
558  iSpecies=0;
559  iType=AliVertexingHFUtils::CheckD0Decay(stack,i,dummy);
560  if(iType>0) iPart=0;
561  }
562  else if(absPdg==411){
563  iSpecies=1;
564  iType=AliVertexingHFUtils::CheckDplusDecay(stack,i,dummy);
565  if(iType<0){
566  Int_t iTypeKKpi=AliVertexingHFUtils::CheckDplusKKpiDecay(stack,i,dummy);
567  if(iTypeKKpi>0) iType=3;
568  }
569  if(iType>0) iPart=1;
570  }
571  else if(absPdg==413){
572  iSpecies=2;
573  iType=AliVertexingHFUtils::CheckDstarDecay(stack,i,dummy);
574  if(iType>0) iPart=2;
575  }
576  else if(absPdg==431){
577  iSpecies=3;
578  iType=AliVertexingHFUtils::CheckDsDecay(stack,i,dummy);
579  if(iType==1 || iType==2) iPart=3;
580  }
581  else if(absPdg==4122){
582  iSpecies=4;
583  iType=AliVertexingHFUtils::CheckLcpKpiDecay(stack,i,dummy);
584  if(iType<0){
585  Int_t iTypeV0=AliVertexingHFUtils::CheckLcV0bachelorDecay(stack,i,dummy);
586  if(iTypeV0==1) iType=5;
587  if(iTypeV0==2) iType=6;
588  }
589  fHistLcDecayChan->Fill(iType);
590  if(iType>=0) iPart=4;
591  }
592  if(iSpecies>=0) fHistYPtAllDecay[iSpecies]->Fill(part->Pt(),rapid);
593 
594  // check beauty mesons
595  if(absPdg==511) fHistBYPtAllDecay[0]->Fill(part->Pt(),rapid);
596  else if(absPdg==521) fHistBYPtAllDecay[1]->Fill(part->Pt(),rapid);
597  else if(absPdg==513) fHistBYPtAllDecay[2]->Fill(part->Pt(),rapid);
598  else if(absPdg==531) fHistBYPtAllDecay[3]->Fill(part->Pt(),rapid);
599  else if(absPdg==5122) fHistBYPtAllDecay[4]->Fill(part->Pt(),rapid);
600 
601  if(pdg==511) fHistBSpecies->Fill(0);
602  else if(pdg==-511) fHistBSpecies->Fill(1);
603  else if(pdg==521) fHistBSpecies->Fill(2);
604  else if(pdg==-521) fHistBSpecies->Fill(3);
605  else if(pdg==513) fHistBSpecies->Fill(4);
606  else if(pdg==-513) fHistBSpecies->Fill(5);
607  else if(pdg==531) fHistBSpecies->Fill(6);
608  else if(pdg==-531) fHistBSpecies->Fill(7);
609  else if(pdg==5122) fHistBSpecies->Fill(8);
610  else if(pdg==-5122) fHistBSpecies->Fill(9);
611 
612  if(iSpecies<0) continue; // not a charm meson
613 
614  if(pdg==421) fHistDSpecies->Fill(0);
615  else if(pdg==-421) fHistDSpecies->Fill(1);
616  else if(pdg==411) fHistDSpecies->Fill(2);
617  else if(pdg==-411) fHistDSpecies->Fill(3);
618  else if(pdg==413) fHistDSpecies->Fill(4);
619  else if(pdg==-413) fHistDSpecies->Fill(5);
620  else if(pdg==431) fHistDSpecies->Fill(6);
621  else if(pdg==-431) fHistDSpecies->Fill(7);
622  else if(pdg==4122) fHistDSpecies->Fill(8);
623  else if(pdg==-4122) fHistDSpecies->Fill(9);
624 
625  Double_t distx=part->Vx()-mcVert->GetX();
626  Double_t disty=part->Vy()-mcVert->GetY();
627  Double_t distz=part->Vz()-mcVert->GetZ();
628  Double_t distToVert=TMath::Sqrt(distx*distx+disty*disty+distz*distz);
629  fHistMotherID->Fill(part->GetFirstMother());
631  if(iFromB==4){
632  fHistYPtPromptAllDecay[iSpecies]->Fill(part->Pt(),rapid);
633  fHistOriginPrompt->Fill(distToVert);
634  }
635  else if(iFromB==5){
636  fHistYPtFeeddownAllDecay[iSpecies]->Fill(part->Pt(),rapid);
637  fHistOriginFeeddown->Fill(distToVert);
638  }
639 
640  if(iPart<0) continue;
641  if(iType<0) continue;
642  nCharmed++;
643  if(iPart==0 && iType>0 && iType<=2){
644  fHistYPtD0byDecChannel[iType-1]->Fill(part->Pt(),rapid);
645  }else if(iPart==1 && iType>0 && iType<=3){
646  fHistYPtDplusbyDecChannel[iType-1]->Fill(part->Pt(),rapid);
647  }else if(iPart==3 && iType>0 && iType<=2){
648  fHistYPtDsbyDecChannel[iType-1]->Fill(part->Pt(),rapid);
649  }
650 
651  if(iFromB==4 && iPart>=0 && iPart<5) fHistYPtPrompt[iPart]->Fill(part->Pt(),rapid);
652  else if(iFromB==5 && iPart>=0 && iPart<5) fHistYPtFeeddown[iPart]->Fill(part->Pt(),rapid);
653  }
654 
655  for(Int_t i=0; i<nTracks; i++){
656  AliESDtrack* track=esd->GetTrack(i);
657  if(fESDtrackCuts->AcceptTrack(track)){
658  if(track->GetLabel()>0) fHistPtRecGood->Fill(track->Pt());
659  else fHistPtRecFake->Fill(track->Pt());
660  Int_t label=TMath::Abs(track->GetLabel());
661 
662  if(stack->IsPhysicalPrimary(label)){
663  TParticle* part = (TParticle*)stack->Particle(label);
664  Int_t absPdg=TMath::Abs(part->GetPdgCode());
665  if(absPdg==11) fHistEtaPhiPtRecEle->Fill(part->Eta(),part->Phi(),part->Pt());
666  else if(absPdg==211) fHistEtaPhiPtRecPi->Fill(part->Eta(),part->Phi(),part->Pt());
667  else if(absPdg==321) fHistEtaPhiPtRecK->Fill(part->Eta(),part->Phi(),part->Pt());
668  else if(absPdg==2212) fHistEtaPhiPtRecPro->Fill(part->Eta(),part->Phi(),part->Pt());
669  fHistPtRecVsPtGen->Fill(part->Pt(),track->Pt());
670  fHistPhiRecVsPhiGen->Fill(part->Phi(),track->Phi());
671  fHistEtaRecVsEtaGen->Fill(part->Eta(),track->Eta());
672  }
673  }
674  }
675  fHistoNcharmed->Fill(dNchdy,nCharmed);
676  fHistoNbVsNc->Fill(nc,nb);
677  fHistoPhysPrim->Fill(nPhysPrim);
678  fHistoPhysPrimPiKPi09->Fill(nPiKPeta09);
679  fHistoPhysPrimPiKPi09vsb->Fill(imppar,nPiKPeta09);
680  }
681 
682  PostData(1,fOutput);
683 
684 }
685 //______________________________________________________________________________
687 {
689  fOutput = dynamic_cast<TList*> (GetOutputData(1));
690  if (!fOutput) {
691  printf("ERROR: fOutput not available\n");
692  return;
693  }
694 
695  return;
696 }
697 
698 
699 
700 
701 //______________________________________________________________________________
703  if(labLc<0) return -1;
704  TParticle* dp = (TParticle*)stack->Particle(labLc);
705  Int_t pdgdp=dp->GetPdgCode();
706  Int_t nDau=dp->GetNDaughters();
707 
708  if(nDau==3){
709  Int_t nKaons=0;
710  Int_t nPions=0;
711  Int_t nProtons=0;
712  for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
713  if(iDau<0) return -1;
714  TParticle* dau=(TParticle*)stack->Particle(iDau);
715  Int_t pdgdau=dau->GetPdgCode();
716  if(TMath::Abs(pdgdau)==321){
717  if(pdgdp>0 && pdgdau>0) return -1;
718  if(pdgdp<0 && pdgdau<0) return -1;
719  nKaons++;
720  }else if(TMath::Abs(pdgdau)==211){
721  if(pdgdp<0 && pdgdau>0) return -1;
722  if(pdgdp>0 && pdgdau<0) return -1;
723  nPions++;
724  }else if(TMath::Abs(pdgdau)==2212){
725  if(pdgdp<0 && pdgdau>0) return -1;
726  if(pdgdp>0 && pdgdau<0) return -1;
727  nProtons++;
728  }else{
729  return -1;
730  }
731  }
732  if(nPions!=1) return -1;
733  if(nKaons!=1) return -1;
734  if(nProtons!=1) return -1;
735  for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
736  if(iDau<0) return -1;
737  }
738  return 0;
739  }
740 
741  if(nDau==2){
742  Int_t nKaons=0;
743  Int_t nPions=0;
744  Int_t nProtons=0;
745  for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
746  if(iDau<0) return -1;
747  TParticle* dau=(TParticle*)stack->Particle(iDau);
748  Int_t pdgdau=dau->GetPdgCode();
749  if(TMath::Abs(pdgdau)==313 || TMath::Abs(pdgdau)==3124 || TMath::Abs(pdgdau)==2224
750  || TMath::Abs(pdgdau)==3122 || TMath::Abs(pdgdau)==311){
751  Int_t nDauRes=dau->GetNDaughters();
752  if(nDauRes!=2) return -1;
753  for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
754  if(resDau<0) return -1;
755  TParticle* resdau=(TParticle*)stack->Particle(resDau);
756  Int_t pdgresdau=resdau->GetPdgCode();
757  if(TMath::Abs(pdgresdau)==321){
758  if(pdgdp>0 && pdgresdau>0) return -1;
759  if(pdgdp<0 && pdgresdau<0) return -1;
760  nKaons++;
761  }
762  if(TMath::Abs(pdgresdau)==211){
763  if(pdgdp<0 && pdgresdau>0) return -1;
764  if(pdgdp>0 && pdgresdau<0) return -1;
765  nPions++;
766  }
767  if(TMath::Abs(pdgresdau)==2212){
768  if(pdgdp<0 && pdgresdau>0) return -1;
769  if(pdgdp>0 && pdgresdau<0) return -1;
770  nProtons++;
771  }
772  }
773  }else if(TMath::Abs(pdgdau)==321){
774  if(pdgdp>0 && pdgdau>0) return -1;
775  if(pdgdp<0 && pdgdau<0) return -1;
776  nKaons++;
777  }else if(TMath::Abs(pdgdau)==211){
778  if(pdgdp<0 && pdgdau>0) return -1;
779  if(pdgdp>0 && pdgdau<0) return -1;
780  nPions++;
781  }else if(TMath::Abs(pdgdau)==2212){
782  if(pdgdp<0 && pdgdau>0) return -1;
783  if(pdgdp>0 && pdgdau<0) return -1;
784  nProtons++;
785  }else{
786  return -1;
787  }
788  }
789  if(nPions!=1) return -1;
790  if(nKaons!=1) return -1;
791  if(nProtons!=1) return -1;
792  for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
793  if(iDau<0) return -1;
794  }
795  return 1;
796  }
797  return -1;
798 }
799 
TH3F * fHistEtaPhiPtRecK
! histo of generated kaons
Int_t pdg
AliESDtrackCuts * fESDtrackCuts
0=pp, 1=PbPb, 2=pPb
TH1F * fHistPtRecGood
! pt distribution of "good" tracks
static Int_t CheckDplusDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistBSpecies
! histo of B hadron species
TH1F * fHistoSPDZVtxY
! histo with distr. of y coord. of SPDZ vertex
double Double_t
Definition: External.C:58
Definition: External.C:260
TH2F * fHistYPtPrompt[5]
! histo of y vs. pt from prompt D0, D+, D*, Ds, Lc
Int_t fSystem
c/b separation using quarks
Definition: External.C:236
TH3F * fHistEtaPhiPtGenEle
! histo of generated electrons
const char * title
Definition: MakeQAPdf.C:26
TH1F * fHistoSPDZVtxX
! histo with distr. of x coord. of SPDZ vertex
TH2F * fHistYPtDplusbyDecChannel[3]
! histo of y vs. pt for D+->Kpipi and D+->K0*pi
TH1F * fHistMotherID
! histo of mother ID
TH3F * fHistEtaPhiPtGenK
! histo of generated kaons
TH2F * fHistBYPtAllDecay[5]
! histo of y vs. pt from prompt B0, B+, B*, Bs, Lb
static Int_t CheckDstarDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistOriginFeeddown
! histo of D production point (feeddown)
TH1F * fHistoPhysPrimPiKPi09
! histo of n. of primary pi, K, p
static Int_t CheckDsDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH2F * fHistEtaRecVsEtaGen
! correlation between rec and gen pt
static Int_t CheckLcpKpiDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistoTracklets
! histo with number of SPD tracklets
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
virtual void UserExec(Option_t *option)
TH2F * fHistYPtDsbyDecChannel[2]
! histo of y vs. pt for Ds->phipi and Ds->K0*K
TH1F * fHistoSPD3DVtxX
! histo with distr. of x coord. of SPD3D vertex
TH2F * fHistoNbVsNc
! histo of n. b quarks vs. n c. quarks
TH1F * fHistoTRKVtxX
! histo with distr. of x coord. of TRK vertex
TH2F * fHistNcollHFtype
! histo of number of injected events vs. type
TH2F * fHistYPtFeeddown[5]
! histo of y vs. pt from feeddown D0, D+, D*, Ds, Lc
TH3F * fHistEtaPhiPtRecPro
! histo of generated protons
TH1F * fHistoSelTracks
! histo with number of TPC+ITS refit ESD tracks
static Int_t CheckLcV0bachelorDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistoPhysPrim
! histo of n. of physical primaries in |eta|<0.5
TH1F * fHistoNEvents
! histo with N of events
int Int_t
Definition: External.C:63
TH3F * fHistEtaPhiPtGenPi
! histo of generated pions
unsigned int UInt_t
Definition: External.C:33
TH3F * fHistEtaPhiPtGenPro
! histo of generated protons
float Float_t
Definition: External.C:68
TH1F * fHistPtRecFake
! pt distribution of fake tracks
TH1F * fHistOriginPrompt
! histo of D production point (prompt)
static Int_t CheckD0Decay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH2F * fHistYPtPromptAllDecay[5]
! histo of y vs. pt from prompt D0, D+, D*, Ds, Lc, no selection on decay channel ...
TH2F * fHistoNcharmed
! histo of D mesons vs. dN/dy
TH2F * fHistoPhysPrimPiKPi09vsb
! histo of n. of primary pi, K, p vs. b
TH2F * fHistPhiRecVsPhiGen
! correlation between rec and gen pt
static Int_t CheckDplusKKpiDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fHistoTRKVtxZ
! histo with distr. of z coord. of TRK vertex
TH1F * fHistDSpecies
! histo of D hadron species
TH2F * fHistYPtAllDecay[5]
! histo of y vs. pt from prompt D0, D+, D*, Ds, Lc, no selection on decay channel ...
TH1F * fHistoEtaPhysPrim
! histo of eta distribution of physical primaries
TH1F * fHistoSPD3DVtxY
! histo with distr. of y coord. of SPD3D vertex
TH1F * fHistoTrackletsEta1
! histo with number of SPD tracklets in |eta|<1
TH2F * fHistYPtD0byDecChannel[2]
! histo of y vs. pt for D0->Kpi and D0->Kpipipi
TH1F * fHistoTracks
! histo with number of ESD tracks
TH1F * fHistoPtPhysPrim
! histo of pt distribution of phys primaries
TH1F * fHistoSPDZVtxZ
! histo with distr. of z coord. of SPDZ vertex
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TH1F * fHistoTRKVtxY
! histo with distr. of y coord. of TRK vertex
TH3F * fHistEtaPhiPtRecEle
! histo of generated electrons
TH2F * fHistYPtFeeddownAllDecay[5]
! histo of y vs. pt from prompt D0, D+, D*, Ds, Lc, no selection on decay channel ...
TList * fOutput
! list of output histos
const char Option_t
Definition: External.C:48
TH1F * fHistLcDecayChan
! histo of Lc decay modes
TH2F * fHistNinjectedvsb
! histo of number of injected events vs. b
TH1F * fHistoSPD3DVtxZ
! histo with distr. of z coord. of SPD3D vertex
TH3F * fHistEtaPhiPtRecPi
! histo of generated pions
Double_t maxMult
TH2F * fHistPtRecVsPtGen
! correlation between rec and gen pt
Int_t CheckLcDecay(Int_t labLc, AliStack *stack) const
virtual void Terminate(Option_t *option)