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