AliPhysics  ff1d528 (ff1d528)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskCombinHF.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2018, 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 /* $Id: $ */
17 
18 //*************************************************************************
19 // Class AliAnalysisTaskCombinHF
20 // AliAnalysisTaskSE to build D meson candidates by combining tracks
21 // background is computed LS and track rotations is
22 // Authors: F. Prino, A. Rossi
24 
25 #include <TList.h>
26 #include <TH1F.h>
27 #include <TDatabasePDG.h>
28 #include <TH2F.h>
29 #include <TH3F.h>
30 #include <THnSparse.h>
31 
32 #include "AliAnalysisManager.h"
33 #include "AliInputEventHandler.h"
34 #include "AliPIDResponse.h"
35 #include "AliAODHandler.h"
36 #include "AliAODEvent.h"
37 #include "AliAODMCParticle.h"
38 #include "AliAODMCHeader.h"
39 #include "AliAODVertex.h"
40 #include "AliAODTrack.h"
41 #include "AliVertexingHFUtils.h"
43 
47 
48 //________________________________________________________________________
51  fOutput(0x0),
52  fHistNEvents(0x0),
53  fHistEventMultZv(0x0),
54  fHistEventMultZvEvSel(0x0),
55  fHistTrackStatus(0x0),
56  fHistTrackEtaMultZv(0x0),
57  fHistCheckOrigin(0x0),
58  fHistCheckOriginSel(0x0),
59  fHistCheckDecChan(0x0),
60  fHistCheckDecChanAcc(0x0),
61  fPtVsYVsMultGen(0x0),
62  fPtVsYVsMultGenLargeAcc(0x0),
63  fPtVsYVsMultGenLimAcc(0x0),
64  fPtVsYVsMultGenAcc(0x0),
65  fPtVsYVsMultGenAccEvSel(0x0),
66  fPtVsYVsMultReco(0x0),
67  fMassVsPtVsY(0x0),
68  fMassVsPtVsYRot(0x0),
69  fMassVsPtVsYLSpp(0x0),
70  fMassVsPtVsYLSmm(0x0),
71  fMassVsPtVsYSig(0x0),
72  fMassVsPtVsYRefl(0x0),
73  fMassVsPtVsYBkg(0x0),
74  fNSelected(0x0),
75  fNormRotated(0x0),
76  fDeltaMass(0x0),
77  fDeltaMassFullAnalysis(0x0),
78  fMassVsPtVsYME(0x0),
79  fMassVsPtVsYMELSpp(0x0),
80  fMassVsPtVsYMELSmm(0x0),
81  fEventsPerPool(0x0),
82  fMixingsPerPool(0x0),
83  fFilterMask(BIT(4)),
84  fTrackCutsAll(0x0),
85  fTrackCutsPion(0x0),
86  fTrackCutsKaon(0x0),
87  fPhiMassCut(99999.),
88  fPidHF(new AliAODPidHF()),
89  fAnalysisCuts(0x0),
90  fMinMass(1.720),
91  fMaxMass(2.150),
92  fMaxPt(10.),
93  fPtBinWidth(0.5),
94  fEtaAccCut(0.9),
95  fPtAccCut(0.1),
96  fNRotations(9),
97  fMinAngleForRot(5*TMath::Pi()/6),
98  fMaxAngleForRot(7*TMath::Pi()/6),
99  fNRotations3(9),
100  fMinAngleForRot3(2*TMath::Pi()/6),
101  fMaxAngleForRot3(4*TMath::Pi()/6),
102  fCounter(0x0),
103  fMeson(kDzero),
104  fReadMC(kFALSE),
105  fPromptFeeddown(kPrompt),
106  fGoUpToQuark(kTRUE),
107  fFullAnalysis(0),
108  fPIDstrategy(knSigma),
109  fmaxPforIDPion(0.8),
110  fmaxPforIDKaon(2.),
111  fKeepNegID(kFALSE),
112  fPIDselCaseZero(0),
113  fBayesThresKaon(0.4),
114  fBayesThresPion(0.4),
115  fDoEventMixing(1),
116  fNumberOfEventsForMixing(20),
117  fMaxzVertDistForMix(5.),
118  fMaxMultDiffForMix(5.),
119  fNzVertPools(1),
120  fNzVertPoolsLimSize(2),
121  fzVertPoolLims(0x0),
122  fNMultPools(1),
123  fNMultPoolsLimSize(2),
124  fMultPoolLims(0x0),
125  fNOfPools(1),
126  fEventBuffer(0x0),
127  fEventInfo(new TObjString("")),
128  fVtxZ(0),
129  fMultiplicity(0),
130  fMinMultiplicity(-0.5),
131  fMaxMultiplicity(199.5),
132  fKaonTracks(0x0),
133  fPionTracks(0x0)
134 {
136 }
137 
138 //________________________________________________________________________
140  AliAnalysisTaskSE("DmesonCombin"),
141  fOutput(0x0),
142  fHistNEvents(0x0),
143  fHistEventMultZv(0x0),
144  fHistEventMultZvEvSel(0x0),
145  fHistTrackStatus(0x0),
146  fHistTrackEtaMultZv(0x0),
147  fHistCheckOrigin(0x0),
148  fHistCheckOriginSel(0x0),
149  fHistCheckDecChan(0x0),
150  fHistCheckDecChanAcc(0x0),
151  fPtVsYVsMultGen(0x0),
152  fPtVsYVsMultGenLargeAcc(0x0),
153  fPtVsYVsMultGenLimAcc(0x0),
154  fPtVsYVsMultGenAcc(0x0),
155  fPtVsYVsMultGenAccEvSel(0x0),
156  fPtVsYVsMultReco(0x0),
157  fMassVsPtVsY(0x0),
158  fMassVsPtVsYRot(0x0),
159  fMassVsPtVsYLSpp(0x0),
160  fMassVsPtVsYLSmm(0x0),
161  fMassVsPtVsYSig(0x0),
162  fMassVsPtVsYRefl(0x0),
163  fMassVsPtVsYBkg(0x0),
164  fNSelected(0x0),
165  fNormRotated(0x0),
166  fDeltaMass(0x0),
167  fDeltaMassFullAnalysis(0x0),
168  fMassVsPtVsYME(0x0),
169  fMassVsPtVsYMELSpp(0x0),
170  fMassVsPtVsYMELSmm(0x0),
171  fEventsPerPool(0x0),
172  fMixingsPerPool(0x0),
173  fFilterMask(BIT(4)),
174  fTrackCutsAll(0x0),
175  fTrackCutsPion(0x0),
176  fTrackCutsKaon(0x0),
177  fPhiMassCut(99999.),
178  fPidHF(new AliAODPidHF()),
179  fAnalysisCuts(analysiscuts),
180  fMinMass(1.720),
181  fMaxMass(2.150),
182  fMaxPt(10.),
183  fPtBinWidth(0.5),
184  fEtaAccCut(0.9),
185  fPtAccCut(0.1),
186  fNRotations(9),
187  fMinAngleForRot(5*TMath::Pi()/6),
188  fMaxAngleForRot(7*TMath::Pi()/6),
189  fNRotations3(9),
190  fMinAngleForRot3(2*TMath::Pi()/6),
191  fMaxAngleForRot3(4*TMath::Pi()/6),
192  fCounter(0x0),
193  fMeson(meson),
194  fReadMC(kFALSE),
195  fPromptFeeddown(1),
196  fGoUpToQuark(kTRUE),
197  fFullAnalysis(0),
198  fPIDstrategy(knSigma),
199  fmaxPforIDPion(0.8),
200  fmaxPforIDKaon(2.),
201  fKeepNegID(kFALSE),
202  fPIDselCaseZero(0),
203  fBayesThresKaon(0.4),
204  fBayesThresPion(0.4),
205  fDoEventMixing(1),
206  fNumberOfEventsForMixing(20),
207  fMaxzVertDistForMix(5.),
208  fMaxMultDiffForMix(5.),
209  fNzVertPools(1),
210  fNzVertPoolsLimSize(2),
211  fzVertPoolLims(0x0),
212  fNMultPools(1),
213  fNMultPoolsLimSize(2),
214  fMultPoolLims(0x0),
215  fNOfPools(1),
216  fEventBuffer(0x0),
217  fEventInfo(new TObjString("")),
218  fVtxZ(0),
219  fMultiplicity(0),
220  fMinMultiplicity(-0.5),
221  fMaxMultiplicity(199.5),
222  fKaonTracks(0x0),
223  fPionTracks(0x0)
224 {
226 
227  DefineOutput(1,TList::Class()); //My private output
228  DefineOutput(2,AliNormalizationCounter::Class());
229 }
230 
231 //________________________________________________________________________
233 {
234  //
236  //
237  if(fOutput && !fOutput->IsOwner()){
238  delete fHistNEvents;
239  delete fHistEventMultZv;
240  delete fHistEventMultZvEvSel;
241  delete fHistTrackStatus;
242  delete fHistTrackEtaMultZv;
243  delete fHistCheckOrigin;
244  delete fHistCheckOriginSel;
245  delete fHistCheckDecChan;
246  delete fHistCheckDecChanAcc;
247  delete fPtVsYVsMultGen;
249  delete fPtVsYVsMultGenLimAcc;
250  delete fPtVsYVsMultGenAcc;
252  delete fPtVsYVsMultReco;
253  delete fMassVsPtVsY;
254  delete fMassVsPtVsYLSpp;
255  delete fMassVsPtVsYLSmm;
256  delete fMassVsPtVsYRot;
257  delete fMassVsPtVsYSig;
258  delete fMassVsPtVsYRefl;
259  delete fMassVsPtVsYBkg;
260  delete fNSelected;
261  delete fNormRotated;
262  delete fDeltaMass;
263  delete fDeltaMassFullAnalysis;
264  delete fMassVsPtVsYME;
265  delete fMassVsPtVsYMELSpp;
266  delete fMassVsPtVsYMELSmm;
267  }
268 
269  delete fOutput;
270  delete fCounter;
271  delete fTrackCutsAll;
272  delete fTrackCutsPion;
273  delete fTrackCutsKaon;
274  delete fPidHF;
275  delete fAnalysisCuts;
276  if(fKaonTracks) fKaonTracks->Delete();
277  if(fPionTracks) fPionTracks->Delete();
278  delete fKaonTracks;
279  delete fPionTracks;
280 
281  if(fEventBuffer){
282  for(Int_t i=0; i<fNOfPools; i++) delete fEventBuffer[i];
283  delete fEventBuffer;
284  }
285  delete fEventInfo;
286  delete [] fzVertPoolLims;
287  delete [] fMultPoolLims;
288 }
289 
290 //________________________________________________________________________
292 {
294  if(fzVertPoolLims) delete [] fzVertPoolLims;
295  fNzVertPools=nPools;
296  fNzVertPoolsLimSize=nPools+1;
298  for(Int_t ib=0; ib<fNzVertPoolsLimSize; ib++) fzVertPoolLims[ib]=zVertLimits[ib];
299  return;
300 }
301 //________________________________________________________________________
303 {
304  // sets the pools for event mizing in zvertex
305  if(fMultPoolLims) delete [] fMultPoolLims;
306  fNMultPools=nPools;
307  fNMultPoolsLimSize=nPools+1;
309  for(Int_t ib=0; ib<nPools+1; ib++) fMultPoolLims[ib]=multLimits[ib];
310  return;
311 }
312 //________________________________________________________________________
314 {
316  //
317  if(fDebug > 1) printf("AnalysisTaskCombinHF::UserCreateOutputObjects() \n");
318 
319  fOutput = new TList();
320  fOutput->SetOwner();
321  fOutput->SetName("OutputHistos");
322 
323  fHistNEvents = new TH1F("hNEvents", "number of events ",9,-0.5,8.5);
324  fHistNEvents->GetXaxis()->SetBinLabel(1,"nEventsAnal");
325  fHistNEvents->GetXaxis()->SetBinLabel(2,"n. passing IsEvSelected");
326  fHistNEvents->GetXaxis()->SetBinLabel(3,"n. rejected due to trigger");
327  fHistNEvents->GetXaxis()->SetBinLabel(4,"n. rejected due to phys sel");
328  fHistNEvents->GetXaxis()->SetBinLabel(5,"n. rejected due to not reco vertex");
329  fHistNEvents->GetXaxis()->SetBinLabel(6,"n. rejected for contr vertex");
330  fHistNEvents->GetXaxis()->SetBinLabel(7,"n. rejected for vertex out of accept");
331  fHistNEvents->GetXaxis()->SetBinLabel(8,"n. rejected for pileup events");
332  fHistNEvents->GetXaxis()->SetBinLabel(9,"no. of out centrality events");
333 
334  fHistNEvents->GetXaxis()->SetNdivisions(1,kFALSE);
335  fHistNEvents->Sumw2();
336  fHistNEvents->SetMinimum(0);
337  fOutput->Add(fHistNEvents);
338 
339  fHistEventMultZv = new TH2F("hEventMultZv","",30,-15.,15.,200,fMinMultiplicity,fMaxMultiplicity);
341 
342  fHistEventMultZvEvSel = new TH2F("hEventMultZvEvSel","",30,-15.,15.,200,fMinMultiplicity,fMaxMultiplicity);
344 
345  fHistTrackStatus = new TH1F("hTrackStatus", "",8,-0.5,7.5);
346  fHistTrackStatus->GetXaxis()->SetBinLabel(1,"Not OK");
347  fHistTrackStatus->GetXaxis()->SetBinLabel(2,"Track OK");
348  fHistTrackStatus->GetXaxis()->SetBinLabel(3,"Kaon, Not OK");
349  fHistTrackStatus->GetXaxis()->SetBinLabel(4,"Kaon OK");
350  fHistTrackStatus->GetXaxis()->SetBinLabel(5,"Pion, Not OK");
351  fHistTrackStatus->GetXaxis()->SetBinLabel(6,"Pion OK");
352  fHistTrackStatus->GetXaxis()->SetBinLabel(7,"Kaon||Pion, Not OK");
353  fHistTrackStatus->GetXaxis()->SetBinLabel(8,"Kaon||Pion OK");
354  fHistTrackStatus->GetXaxis()->SetNdivisions(1,kFALSE);
355  fHistTrackStatus->Sumw2();
356  fHistTrackStatus->SetMinimum(0);
358 
359  fHistTrackEtaMultZv = new TH3F("hTrackEtaMultZv","",40,-1.,1.,30,-15.,15.,200,fMinMultiplicity,fMaxMultiplicity);
361 
362  Int_t nPtBins = (Int_t)(fMaxPt/fPtBinWidth+0.001);
364 
365  if(fReadMC){
366 
367  fHistCheckOrigin=new TH1F("hCheckOrigin","",7,-1.5,5.5);
368  fHistCheckOrigin->Sumw2();
369  fHistCheckOrigin->SetMinimum(0);
371 
372  fHistCheckOriginSel=new TH1F("hCheckOriginSel","",7,-1.5,5.5);
373  fHistCheckOriginSel->Sumw2();
374  fHistCheckOriginSel->SetMinimum(0);
376 
377  fHistCheckDecChan=new TH1F("hCheckDecChan","",7,-2.5,4.5);
378  fHistCheckDecChan->Sumw2();
379  fHistCheckDecChan->SetMinimum(0);
381 
382  fHistCheckDecChanAcc=new TH1F("hCheckDecChanAcc","",7,-2.5,4.5);
383  fHistCheckDecChanAcc->Sumw2();
384  fHistCheckDecChanAcc->SetMinimum(0);
386 
387  fPtVsYVsMultGen= new TH3F("hPtVsYVsMultGen","",nPtBins,0.,maxPt,20,-1.,1.,200,fMinMultiplicity,fMaxMultiplicity);
388  fPtVsYVsMultGen->Sumw2();
389  fPtVsYVsMultGen->SetMinimum(0);
390  fOutput->Add(fPtVsYVsMultGen);
391 
392  fPtVsYVsMultGenLargeAcc= new TH3F("hPtVsYVsMultGenLargeAcc","",nPtBins,0.,maxPt,20,-1.,1.,200,fMinMultiplicity,fMaxMultiplicity);
393  fPtVsYVsMultGenLargeAcc->Sumw2();
394  fPtVsYVsMultGenLargeAcc->SetMinimum(0);
396 
397  fPtVsYVsMultGenLimAcc= new TH3F("hPtVsYVsMultGenLimAcc","",nPtBins,0.,maxPt,20,-1.,1.,200,fMinMultiplicity,fMaxMultiplicity);
398  fPtVsYVsMultGenLimAcc->Sumw2();
399  fPtVsYVsMultGenLimAcc->SetMinimum(0);
401 
402  fPtVsYVsMultGenAcc= new TH3F("hPtVsYVsMultGenAcc","",nPtBins,0.,maxPt,20,-1.,1.,200,fMinMultiplicity,fMaxMultiplicity);
403  fPtVsYVsMultGenAcc->Sumw2();
404  fPtVsYVsMultGenAcc->SetMinimum(0);
406 
407  fPtVsYVsMultGenAccEvSel= new TH3F("hPtVsYVsMultGenAccEvSel","",nPtBins,0.,maxPt,20,-1.,1.,200,fMinMultiplicity,fMaxMultiplicity);
408  fPtVsYVsMultGenAccEvSel->Sumw2();
409  fPtVsYVsMultGenAccEvSel->SetMinimum(0);
411 
412  fPtVsYVsMultReco= new TH3F("hPtVsYVsMultReco","",nPtBins,0.,maxPt,20,-1.,1.,200,fMinMultiplicity,fMaxMultiplicity);
413  fPtVsYVsMultReco->Sumw2();
414  fPtVsYVsMultReco->SetMinimum(0);
416  }
417 
418 
419  Int_t nMassBins=static_cast<Int_t>(fMaxMass*1000.-fMinMass*1000.);
420  Double_t maxm=fMinMass+nMassBins*0.001;
421  fMassVsPtVsY=new TH3F("hMassVsPtVsY","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
422  fMassVsPtVsY->Sumw2();
423  fMassVsPtVsY->SetMinimum(0);
424  fOutput->Add(fMassVsPtVsY);
425 
426  fMassVsPtVsYRot=new TH3F("hMassVsPtVsYRot","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
427  fMassVsPtVsYRot->Sumw2();
428  fMassVsPtVsYRot->SetMinimum(0);
429  fOutput->Add(fMassVsPtVsYRot);
430 
431  fMassVsPtVsYLSpp=new TH3F("hMassVsPtVsYLSpp","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
432  fMassVsPtVsYLSpp->Sumw2();
433  fMassVsPtVsYLSpp->SetMinimum(0);
435  fMassVsPtVsYLSmm=new TH3F("hMassVsPtVsYLSmm","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
436  fMassVsPtVsYLSmm->Sumw2();
437  fMassVsPtVsYLSmm->SetMinimum(0);
439 
440  fMassVsPtVsYSig=new TH3F("hMassVsPtVsYSig","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
441  fMassVsPtVsYSig->Sumw2();
442  fMassVsPtVsYSig->SetMinimum(0);
443  fOutput->Add(fMassVsPtVsYSig);
444 
445  fMassVsPtVsYRefl=new TH3F("hMassVsPtVsYRefl","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
446  fMassVsPtVsYRefl->Sumw2();
447  fMassVsPtVsYRefl->SetMinimum(0);
449 
450  fMassVsPtVsYBkg=new TH3F("hMassVsPtVsYBkg","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
451  fMassVsPtVsYBkg->Sumw2();
452  fMassVsPtVsYBkg->SetMinimum(0);
453  fOutput->Add(fMassVsPtVsYBkg);
454 
455  fNSelected=new TH1F("hNSelected","",100,-0.5,99.5);
456  fNSelected->Sumw2();
457  fNSelected->SetMinimum(0);
458  fOutput->Add(fNSelected);
459 
460  fNormRotated=new TH1F("hNormRotated","",11,-0.5,10.5);
461  fNormRotated->Sumw2();
462  fNormRotated->SetMinimum(0);
463  fOutput->Add(fNormRotated);
464 
465  fDeltaMass=new TH1F("hDeltaMass","",100,-0.4,0.4);
466  fDeltaMass->Sumw2();
467  fDeltaMass->SetMinimum(0);
468  fOutput->Add(fDeltaMass);
469 
470  Int_t binSparseDMassRot[5]={nMassBins,100,24,40,20};
471  Double_t edgeLowSparseDMassRot[5]={fMinMass,-0.4,0.,-4.,0};
472  Double_t edgeHighSparseDMassRot[5]={maxm,0.4,12.,4.,3.14};
473  fDeltaMassFullAnalysis=new THnSparseF("fDeltaMassFullAnalysis","fDeltaMassFullAnalysis;inv mass (GeV/c);#Delta inv mass (GeV/c) ; p_{T}^{D} (GeV/c); #Delta p_{T} (GeV/c); daughter angle (2prongs) (rad);",5,binSparseDMassRot,edgeLowSparseDMassRot,edgeHighSparseDMassRot);
475 
476  fMassVsPtVsYME=new TH3F("hMassVsPtVsYME","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
477  fMassVsPtVsYME->Sumw2();
478  fMassVsPtVsYME->SetMinimum(0);
479  fOutput->Add(fMassVsPtVsYME);
480 
481  fMassVsPtVsYMELSpp=new TH3F("hMassVsPtVsYMELSpp","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
482  fMassVsPtVsYMELSpp->Sumw2();
483  fMassVsPtVsYMELSpp->SetMinimum(0);
485 
486  fMassVsPtVsYMELSmm=new TH3F("hMassVsPtVsYMELSmm","",nMassBins,fMinMass,maxm,nPtBins,0.,maxPt,20,-1.,1.);
487  fMassVsPtVsYMELSmm->Sumw2();
488  fMassVsPtVsYMELSmm->SetMinimum(0);
490 
493  if(fDoEventMixing==2) fNOfPools=1;
495  fEventsPerPool=new TH2F("hEventsPerPool","hEventsPerPool",fNzVertPools,fzVertPoolLims,fNMultPools,fMultPoolLims);
496  fMixingsPerPool=new TH2F("hMixingsPerPool","hMixingsPerPool",fNzVertPools,fzVertPoolLims,fNMultPools,fMultPoolLims);
497  }else{
498  fEventsPerPool=new TH2F("hEventsPerPool","hEventsPerPool",1,-10.,10.,1,-0.5,2000.5);
499  fMixingsPerPool=new TH2F("hMixingsPerPool","hMixingsPerPool",1,-10.,10.,1,-0.5,2000.5);
500  }
501  fEventsPerPool->Sumw2();
502  fEventsPerPool->SetMinimum(0);
503  fOutput->Add(fEventsPerPool);
504  fMixingsPerPool->Sumw2();
505  fMixingsPerPool->SetMinimum(0);
506  fOutput->Add(fMixingsPerPool);
507 
508  //Counter for Normalization
509  fCounter = new AliNormalizationCounter("NormalizationCounter");
510  fCounter->Init();
511 
512  fKaonTracks = new TObjArray();
513  fPionTracks=new TObjArray();
514  fKaonTracks->SetOwner();
515  fPionTracks->SetOwner();
516 
517  fEventBuffer = new TTree*[fNOfPools];
518  for(Int_t i=0; i<fNOfPools; i++){
519  fEventBuffer[i]=new TTree(Form("EventBuffer_%d",i), "Temporary buffer for event mixing");
520  fEventBuffer[i]->Branch("zVertex", &fVtxZ);
521  fEventBuffer[i]->Branch("multiplicity", &fMultiplicity);
522  fEventBuffer[i]->Branch("eventInfo", "TObjString",&fEventInfo);
523  fEventBuffer[i]->Branch("karray", "TObjArray", &fKaonTracks);
524  fEventBuffer[i]->Branch("parray", "TObjArray", &fPionTracks);
525  }
526 
527  PostData(1,fOutput);
528  PostData(2,fCounter);
529 }
530 
531 //________________________________________________________________________
534 
535  AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
536  if(!aod && AODEvent() && IsStandardAOD()) {
537  // In case there is an AOD handler writing a standard AOD, use the AOD
538  // event in memory rather than the input (ESD) event.
539  aod = dynamic_cast<AliAODEvent*> (AODEvent());
540  }
541  if(!aod){
542  printf("AliAnalysisTaskCombinHF::UserExec: AOD not found!\n");
543  return;
544  }
545 
546  // fix for temporary bug in ESDfilter
547  // the AODs with null vertex pointer didn't pass the PhysSel
548  if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return;
549 
550  // Reject events with trigger mask 0 of the LHC13d3 production
551  // For these events the ITS layers are skipped in the trakcing
552  // and the vertex reconstruction efficiency from tracks is biased
553  if(fReadMC){
554  Int_t runnumber = aod->GetRunNumber();
555  if(aod->GetTriggerMask()==0 &&
556  (runnumber>=195344 && runnumber<=195677)){
557  return;
558  }
559  }
560 
561  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
562  AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
563  AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
564  fPidHF->SetPidResponse(pidResp);
565 
566 
567  fHistNEvents->Fill(0); // count event
568  // Post the data already here
569  PostData(1,fOutput);
570 
572 
573  Bool_t isEvSel=fAnalysisCuts->IsEventSelected(aod);
577  }else{
579  fHistNEvents->Fill(8);
580  }else{
584  }else{
587  }
588  }
589  }
590 
592  // events not passing the centrality selection can be removed immediately. For the others we must count the generated D mesons
593 
594  Int_t ntracks=aod->GetNumberOfTracks();
595  fVtxZ = aod->GetPrimaryVertex()->GetZ();
597 
598  TClonesArray *arrayMC=0;
599  AliAODMCHeader *mcHeader=0;
600  if(fReadMC){
601  arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
602  if(!arrayMC) {
603  printf("AliAnalysisTaskCombinHF::UserExec: MC particles branch not found!\n");
604  return;
605  }
606 
607  // load MC header
608  mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
609  if(!mcHeader) {
610  printf("AliAnalysisTaskCombinHF::UserExec: MC header branch not found!\n");
611  return;
612  }
613  Double_t zMCVertex = mcHeader->GetVtxZ();
614  if (TMath::Abs(zMCVertex) < fAnalysisCuts->GetMaxVtxZ()){ // only cut on zVertex applied to count the signal
615  FillGenHistos(arrayMC,isEvSel);
616  }
617  fHistEventMultZv->Fill(zMCVertex,fMultiplicity);
618  if(isEvSel) fHistEventMultZvEvSel->Fill(zMCVertex,fMultiplicity);
619  }else{
621  if(isEvSel) fHistEventMultZvEvSel->Fill(fVtxZ,fMultiplicity);
622  }
623 
624 
625  if(!isEvSel)return;
626 
627  fHistNEvents->Fill(1);
628 
629 
630  // select and flag tracks
631  UChar_t* status = new UChar_t[ntracks];
632  for(Int_t iTr=0; iTr<ntracks; iTr++){
633  status[iTr]=0;
634  AliAODTrack* track=dynamic_cast<AliAODTrack*>(aod->GetTrack(iTr));
635  if(!track){
636  AliWarning("Error in casting track to AOD track. Not a standard AOD?");
637  continue;
638  }
639  if(IsTrackSelected(track)) status[iTr]+=1;
640 
641  // PID
642  if (fPIDstrategy == knSigma) {
643  // nsigma PID
644  if(IsKaon(track)) status[iTr]+=2;
645  if(IsPion(track)) status[iTr]+=4;
646  }
648  // Bayesian PID
649  Double_t *weights = new Double_t[AliPID::kSPECIES];
650  fPidHF->GetPidCombined()->ComputeProbabilities(track, fPidHF->GetPidResponse(), weights);
652  if (TMath::MaxElement(AliPID::kSPECIES, weights) == weights[AliPID::kKaon]) status[iTr] += 2;
653  if (TMath::MaxElement(AliPID::kSPECIES, weights) == weights[AliPID::kPion]) status[iTr] += 4;
654  }
655  if (fPIDstrategy == kBayesianThres) {
656  if (weights[AliPID::kKaon] > fBayesThresKaon) status[iTr] += 2;
657  if (weights[AliPID::kPion] > fBayesThresPion) status[iTr] += 4;
658  }
659  delete[] weights;
660  }
661 
662  fHistTrackStatus->Fill(status[iTr]);
663  fHistTrackEtaMultZv->Fill(track->Eta(),fVtxZ,fMultiplicity);
664  }
665 
666  // build the combinatorics
667  Int_t nSelected=0;
668  Int_t nFiltered=0;
669  Double_t dummypos[3]={0.,0.,0.};
670  AliAODVertex* v2=new AliAODVertex(dummypos,999.,-1,2);
671  AliAODVertex* v3=new AliAODVertex(dummypos,999.,-1,3);
672  // dummy values of track impact parameter, needed to build an AliAODRecoDecay object
673  Double_t d02[2]={0.,0.};
674  Double_t d03[3]={0.,0.,0.};
675  AliAODRecoDecay* tmpRD2 = new AliAODRecoDecay(0x0,2,0,d02);
676  AliAODRecoDecay* tmpRD3 = new AliAODRecoDecay(0x0,3,1,d03);
677  UInt_t pdg0[2]={321,211};
678  UInt_t pdgp[3]={321,211,211};
679  UInt_t pdgs[3]={321,211,321};
680  Double_t tmpp[3];
681  Double_t px[3],py[3],pz[3];
682  Int_t dgLabels[3];
683  fKaonTracks->Delete();
684  fPionTracks->Delete();
685 
686  for(Int_t iTr1=0; iTr1<ntracks; iTr1++){
687  AliAODTrack* trK=dynamic_cast<AliAODTrack*>(aod->GetTrack(iTr1));
688  if(!trK){
689  AliWarning("Error in casting track to AOD track. Not a standard AOD?");
690  continue;
691  }
692  if((status[iTr1] & 1)==0) continue;
693  if(fDoEventMixing>0){
694  if(status[iTr1] & 2) fKaonTracks->AddLast(new TLorentzVector(trK->Px(),trK->Py(),trK->Pz(),trK->Charge()));
695  if(status[iTr1] & 4) fPionTracks->AddLast(new TLorentzVector(trK->Px(),trK->Py(),trK->Pz(),trK->Charge()));
696  }
697  if((status[iTr1] & 2)==0) continue;
698  Int_t chargeK=trK->Charge();
699  trK->GetPxPyPz(tmpp);
700  px[0] = tmpp[0];
701  py[0] = tmpp[1];
702  pz[0] = tmpp[2];
703  dgLabels[0]=trK->GetLabel();
704  for(Int_t iTr2=0; iTr2<ntracks; iTr2++){
705  if((status[iTr2] & 1)==0) continue;
706  if((status[iTr2] & 4)==0) continue;
707  if(iTr1==iTr2) continue;
708  AliAODTrack* trPi1=dynamic_cast<AliAODTrack*>(aod->GetTrack(iTr2));
709  if(!trPi1){
710  AliWarning("Error in casting track to AOD track. Not a standard AOD?");
711  continue;
712  }
713  Int_t chargePi1=trPi1->Charge();
714  trPi1->GetPxPyPz(tmpp);
715  px[1] = tmpp[0];
716  py[1] = tmpp[1];
717  pz[1] = tmpp[2];
718  dgLabels[1]=trPi1->GetLabel();
719  if(fMeson==kDzero){
720  if(chargePi1==chargeK){
721  // LS candidate
722  FillLSHistos(421,2,tmpRD2,px,py,pz,pdg0,chargePi1);
723  }else{
724  // OS candidate
725  nFiltered++;
726  v2->AddDaughter(trK);
727  v2->AddDaughter(trPi1);
728  tmpRD2->SetSecondaryVtx(v2);
729  Bool_t ok=FillHistos(421,2,tmpRD2,px,py,pz,pdg0,arrayMC,dgLabels);
730  v2->RemoveDaughters();
731  if(ok) nSelected++;
732  }
733  }else{
734  for(Int_t iTr3=iTr2+1; iTr3<ntracks; iTr3++){
735  if((status[iTr3] & 1)==0) continue;
736  if(fMeson==kDplus && (status[iTr3] & 4)==0) continue;
737  if(fMeson==kDs && (status[iTr3] & 2)==0) continue;
738  if(iTr1==iTr3) continue;
739  AliAODTrack* trPi2=dynamic_cast<AliAODTrack*>(aod->GetTrack(iTr3));
740  if(!trPi2){
741  AliWarning("Error in casting track to AOD track. Not a standard AOD?");
742  continue;
743  }
744  Int_t chargePi2=trPi2->Charge();
745  trPi2->GetPxPyPz(tmpp);
746  px[2] = tmpp[0];
747  py[2] = tmpp[1];
748  pz[2] = tmpp[2];
749  dgLabels[2]=trPi2->GetLabel();
750  if(fMeson==kDs){
751  Double_t massKK=ComputeInvMassKK(trK,trPi2);
752  Double_t deltaMass=massKK-TDatabasePDG::Instance()->GetParticle(333)->Mass();
753  if(TMath::Abs(deltaMass)>fPhiMassCut) continue;
754  }
755  Bool_t isThreeLS=kFALSE;
756  if(chargePi1==chargeK && chargePi2==chargeK){
757  isThreeLS=kTRUE;
758  if(fMeson==kDplus)FillLSHistos(411,3,tmpRD3,px,py,pz,pdgp,chargePi1);
759  else if(fMeson==kDs)FillLSHistos(431,3,tmpRD3,px,py,pz,pdgs,chargePi1);
760  }
761  Bool_t acceptOS=kFALSE;
762  if(fMeson==kDplus){
763  if(chargePi1!=chargeK && chargePi2!=chargeK)acceptOS=kTRUE;
764  }else if(fMeson==kDs){
765  if(chargePi2!=chargeK && !isThreeLS) acceptOS=kTRUE;
766  }
767  if(acceptOS){
768  nFiltered++;
769  v3->AddDaughter(trK);
770  v3->AddDaughter(trPi1);
771  v3->AddDaughter(trPi2);
772  tmpRD3->SetSecondaryVtx(v3);
773  Bool_t ok=kFALSE;
774  if(fMeson==kDplus) ok=FillHistos(411,3,tmpRD3,px,py,pz,pdgp,arrayMC,dgLabels);
775  else if(fMeson==kDs) ok=FillHistos(431,3,tmpRD3,px,py,pz,pdgs,arrayMC,dgLabels);
776  v3->RemoveDaughters();
777  if(ok) nSelected++;
778  }
779  }
780  }
781  }
782  }
783 
784  delete [] status;
785  delete v2;
786  delete v3;
787  delete tmpRD2;
788  delete tmpRD3;
789 
790  fNSelected->Fill(nSelected);
791 
792  fCounter->StoreCandidates(aod,nFiltered,kTRUE);
793  fCounter->StoreCandidates(aod,nSelected,kFALSE);
794  fEventInfo->SetString(Form("Ev%d_esd%d_Pi%d_K%d",mgr->GetNcalls(),((AliAODHeader*)aod->GetHeader())->GetEventNumberESDFile(),fPionTracks->GetEntries(),fKaonTracks->GetEntries()));
795  if(fDoEventMixing==1){
797  if(ind>=0 && ind<fNOfPools){
799  fEventBuffer[ind]->Fill();
800  if(fEventBuffer[ind]->GetEntries() >= fNumberOfEventsForMixing){
802  DoMixingWithPools(ind);
803  ResetPool(ind);
804  }
805  }
806  }else if(fDoEventMixing==2){ // mix with cuts, no pools
807  fEventBuffer[0]->Fill();
808  }
809  PostData(1,fOutput);
810  PostData(2,fCounter);
811 
812  return;
813 }
814 
815 //________________________________________________________________________
816 void AliAnalysisTaskCombinHF::FillLSHistos(Int_t pdgD,Int_t nProngs, AliAODRecoDecay* tmpRD, Double_t* px, Double_t* py, Double_t* pz, UInt_t *pdgdau, Int_t charge){
818 
819  tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
820  Double_t pt = tmpRD->Pt();
821  Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
822  if(minv2>fMinMass*fMinMass && minv2<fMaxMass*fMaxMass){
823  Double_t rapid = tmpRD->Y(pdgD);
824  if(fAnalysisCuts->IsInFiducialAcceptance(pt,rapid)){
825  if(charge>0) fMassVsPtVsYLSpp->Fill(TMath::Sqrt(minv2),pt,rapid);
826  else fMassVsPtVsYLSmm->Fill(TMath::Sqrt(minv2),pt,rapid);
827  }
828  }
829  return;
830 }
831 
832 //________________________________________________________________________
833 void AliAnalysisTaskCombinHF::FillGenHistos(TClonesArray* arrayMC, Bool_t isEvSel){
835  Int_t totPart=arrayMC->GetEntriesFast();
836  Int_t thePDG=411;
837  Int_t nProng=3;
838  if(fMeson==kDzero){
839  thePDG=421;
840  nProng=2;
841  }else if(fMeson==kDs){
842  thePDG=431;
843  nProng=3;
844  }
845  for(Int_t ip=0; ip<totPart; ip++){
846  AliAODMCParticle *part = (AliAODMCParticle*)arrayMC->At(ip);
847  if(TMath::Abs(part->GetPdgCode())==thePDG){
849  fHistCheckOrigin->Fill(orig);
850  if(fPromptFeeddown==kFeeddown && orig!=5) continue;
851  else if(fPromptFeeddown==kPrompt && orig!=4) continue;
852  else if(fPromptFeeddown==kBoth && orig<4) continue;
853  fHistCheckOriginSel->Fill(orig);
854  Int_t deca=0;
855  Bool_t isGoodDecay=kFALSE;
856  Int_t labDau[4]={-1,-1,-1,-1};
857  if(fMeson==kDzero){
858  deca=AliVertexingHFUtils::CheckD0Decay(arrayMC,part,labDau);
859  if(part->GetNDaughters()!=2) continue;
860  if(deca==1) isGoodDecay=kTRUE;
861  }else if(fMeson==kDplus){
862  deca=AliVertexingHFUtils::CheckDplusDecay(arrayMC,part,labDau);
863  if(deca>0) isGoodDecay=kTRUE;
864  }else if(fMeson==kDs){
865  deca=AliVertexingHFUtils::CheckDsDecay(arrayMC,part,labDau);
866  if(deca==1) isGoodDecay=kTRUE;
867  }
868  fHistCheckDecChan->Fill(deca);
869  if(labDau[0]==-1){
870  // printf(Form("Meson %d Label of daughters not filled correctly -- %d\n",fMeson,isGoodDecay));
871  continue; //protection against unfilled array of labels
872  }
873  Bool_t isInAcc=CheckAcceptance(arrayMC,nProng,labDau);
874  if(isInAcc) fHistCheckDecChanAcc->Fill(deca);
875  if(isGoodDecay){
876  Double_t ptgen=part->Pt();
877  Double_t ygen=part->Y();
878  if(fAnalysisCuts->IsInFiducialAcceptance(ptgen,ygen)){
879  fPtVsYVsMultGen->Fill(ptgen,ygen,fMultiplicity);
880  if(TMath::Abs(ygen)<0.5) fPtVsYVsMultGenLimAcc->Fill(ptgen,ygen,fMultiplicity);
881  if(isInAcc) fPtVsYVsMultGenAcc->Fill(ptgen,ygen,fMultiplicity);
882  if(isEvSel && isInAcc) fPtVsYVsMultGenAccEvSel->Fill(ptgen,ygen,fMultiplicity);
883  }
884  if(TMath::Abs(ygen)<0.9) fPtVsYVsMultGenLargeAcc->Fill(ptgen,ygen,fMultiplicity);
885  }
886  }
887  }
888 }
889 
890 //________________________________________________________________________
891 Bool_t AliAnalysisTaskCombinHF::FillHistos(Int_t pdgD,Int_t nProngs, AliAODRecoDecay* tmpRD, Double_t* px, Double_t* py, Double_t* pz, UInt_t *pdgdau, TClonesArray *arrayMC, Int_t* dgLabels){
893 
894  Bool_t accept=kFALSE;
895 
896  tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
897  Double_t pt = tmpRD->Pt();
898  Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
899  Double_t mass=TMath::Sqrt(minv2);
900 
901  if(minv2>fMinMass*fMinMass && minv2<fMaxMass*fMaxMass){
902  Double_t rapid = tmpRD->Y(pdgD);
903  if(fAnalysisCuts->IsInFiducialAcceptance(pt,rapid)){
904  fMassVsPtVsY->Fill(mass,pt,rapid);
905  accept=kTRUE;
906  if(fReadMC){
907  Int_t signPdg[3]={0,0,0};
908  for(Int_t iii=0; iii<nProngs; iii++) signPdg[iii]=pdgdau[iii];
909  Int_t labD = tmpRD->MatchToMC(pdgD,arrayMC,nProngs,signPdg);
910  if(labD>=0){
911  AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(arrayMC->At(TMath::Abs(dgLabels[0])));
912  if(part){
914  if((fPromptFeeddown==kFeeddown && orig==5)|| (fPromptFeeddown==kPrompt && orig==4) || (fPromptFeeddown==kBoth && orig>=4)) {
915 
916  Int_t pdgCode = TMath::Abs( part->GetPdgCode() );
917  if(pdgCode==321){
918  fMassVsPtVsYSig->Fill(mass,pt,rapid);
919  AliAODMCParticle* dmes = dynamic_cast<AliAODMCParticle*>(arrayMC->At(labD));
920  if(dmes){
921  fPtVsYVsMultReco->Fill(dmes->Pt(),dmes->Y(),fMultiplicity);
922  }
923  }else{
924  fMassVsPtVsYRefl->Fill(mass,pt,rapid);
925  }
926  }
927  }
928  }else{
929  fMassVsPtVsYBkg->Fill(mass,pt,rapid);
930  }
931  }
932  }
933  }
934 
935  Int_t nRotated=0;
936  Double_t massRot=0;// calculated later only if candidate is acceptable
937  Double_t angleProngXY;
938  if(TMath::Abs(pdgD)==421)angleProngXY=TMath::ACos((px[0]*px[1]+py[0]*py[1])/TMath::Sqrt((px[0]*px[0]+py[0]*py[0])*(px[1]*px[1]+py[1]*py[1])));
939  else {
940  angleProngXY=TMath::ACos(((px[0]+px[1])*px[2]+(py[0]+py[1])*py[2])/TMath::Sqrt(((px[0]+px[1])*(px[0]+px[1])+(py[0]+py[1])*(py[0]+py[1]))*(px[2]*px[2]+py[2]*py[2])));
941  }
942  Double_t ptOrig=pt;
943 
944 
945  Double_t rotStep=0.;
946  if(fNRotations>1) rotStep=(fMaxAngleForRot-fMinAngleForRot)/(fNRotations-1); // -1 is to ensure that the last rotation is done with angle=fMaxAngleForRot
947  if(TMath::Abs(pdgD)==421) fNRotations3=1;
948  Double_t rotStep3=0.;
949  if(fNRotations3>1) rotStep3=(fMaxAngleForRot3-fMinAngleForRot3)/(fNRotations3-1); // -1 is to ensure that the last rotation is done with angle=fMaxAngleForRot
950 
951  for(Int_t irot=0; irot<fNRotations; irot++){
952  Double_t phirot=fMinAngleForRot+rotStep*irot;
953  Double_t tmpx=px[0];
954  Double_t tmpy=py[0];
955  Double_t tmpx2=px[2];
956  Double_t tmpy2=py[2];
957  px[0]=tmpx*TMath::Cos(phirot)-tmpy*TMath::Sin(phirot);
958  py[0]=tmpx*TMath::Sin(phirot)+tmpy*TMath::Cos(phirot);
959  for(Int_t irot3=0; irot3<fNRotations3; irot3++){
960  if(pdgD==411 || pdgD==431){
961  Double_t phirot2=fMaxAngleForRot3-rotStep3*irot;
962  px[2]=tmpx*TMath::Cos(phirot2)-tmpy*TMath::Sin(phirot2);
963  py[2]=tmpx*TMath::Sin(phirot2)+tmpy*TMath::Cos(phirot2);
964  }
965  tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
966  pt = tmpRD->Pt();
967  minv2 = tmpRD->InvMass2(nProngs,pdgdau);
968  if(minv2>fMinMass*fMinMass && minv2<fMaxMass*fMaxMass){
969  Double_t rapid = tmpRD->Y(pdgD);
970  if(fAnalysisCuts->IsInFiducialAcceptance(pt,rapid)){
971  massRot=TMath::Sqrt(minv2);
972  fMassVsPtVsYRot->Fill(massRot,pt,rapid);
973  nRotated++;
974  fDeltaMass->Fill(massRot-mass);
975  if(fFullAnalysis){
976  Double_t pointRot[5]={mass,massRot-mass,ptOrig,pt-ptOrig,angleProngXY};
977  fDeltaMassFullAnalysis->Fill(pointRot);
978  }
979  }
980  }
981  }
982  px[0]=tmpx;
983  py[0]=tmpy;
984  if(pdgD==411 || pdgD==431){
985  px[2]=tmpx2;
986  py[2]=tmpy2;
987  }
988  }
989  fNormRotated->Fill(nRotated);
990 
991  return accept;
992 
993 }
994 //________________________________________________________________________
995 void AliAnalysisTaskCombinHF::FillMEHistos(Int_t pdgD,Int_t nProngs, AliAODRecoDecay* tmpRD, Double_t* px, Double_t* py, Double_t* pz, UInt_t *pdgdau){
997 
998  tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
999  Double_t pt = tmpRD->Pt();
1000  Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
1001  Double_t mass=TMath::Sqrt(minv2);
1002 
1003  if(minv2>fMinMass*fMinMass && minv2<fMaxMass*fMaxMass){
1004  Double_t rapid = tmpRD->Y(pdgD);
1005  if(fAnalysisCuts->IsInFiducialAcceptance(pt,rapid)){
1006  fMassVsPtVsYME->Fill(mass,pt,rapid);
1007  }
1008  }
1009  return;
1010 }
1011 //________________________________________________________________________
1012 void AliAnalysisTaskCombinHF::FillMEHistosLS(Int_t pdgD,Int_t nProngs, AliAODRecoDecay* tmpRD, Double_t* px, Double_t* py, Double_t* pz, UInt_t *pdgdau, Int_t charge){
1014 
1015  tmpRD->SetPxPyPzProngs(nProngs,px,py,pz);
1016  Double_t pt = tmpRD->Pt();
1017  Double_t minv2 = tmpRD->InvMass2(nProngs,pdgdau);
1018  Double_t mass=TMath::Sqrt(minv2);
1019 
1020  if(minv2>fMinMass*fMinMass && minv2<fMaxMass*fMaxMass){
1021  Double_t rapid = tmpRD->Y(pdgD);
1022  if(fAnalysisCuts->IsInFiducialAcceptance(pt,rapid)){
1023  if(charge>0) fMassVsPtVsYMELSpp->Fill(mass,pt,rapid);
1024  if(charge<0) fMassVsPtVsYMELSmm->Fill(mass,pt,rapid);
1025  }
1026  }
1027  return;
1028 }
1029 //________________________________________________________________________
1032 
1033  if(track->Charge()==0) return kFALSE;
1034  if(track->GetID()<0&&!fKeepNegID)return kFALSE;
1035  if(fFilterMask>=0){
1036  if(!(track->TestFilterMask(fFilterMask))) return kFALSE;
1037  }
1038  if(!SelectAODTrack(track,fTrackCutsAll)) return kFALSE;
1039  return kTRUE;
1040 }
1041 
1042 //________________________________________________________________________
1045 
1046  if(!fPidHF) return kTRUE;
1047  Int_t isKaon=fPidHF->MakeRawPid(track,AliPID::kKaon);
1048  Double_t mom=track->P();
1049  if(SelectAODTrack(track,fTrackCutsKaon)) {
1050  if(isKaon>=1) return kTRUE;
1051  if(isKaon<=-1) return kFALSE;
1052  switch(fPIDselCaseZero){// isKaon=0
1053  case 0:
1054  {
1055  return kTRUE;// always accept
1056  }
1057  break;
1058  case 1:
1059  {
1060  if(isKaon>=0 && track->P()>fmaxPforIDKaon)return kTRUE;// accept only if in a compatibility band starting from p=fmaxPforIDKaon
1061  }
1062  break;
1063  case 2:
1064  {
1065  if(track->P()>fmaxPforIDKaon)return kTRUE;
1066  AliPIDResponse *pidResp=fPidHF->GetPidResponse();// more elaborated strategy: asymmetric cuts, with fix momenta and nsigma ranges for the moment
1067  Double_t nsigma=pidResp->NumberOfSigmasTPC(track,AliPID::kKaon);
1068  if(nsigma>-2.&& nsigma<3. && mom<0.6)isKaon=1;
1069  else if(nsigma>-1.&& nsigma<3.&& mom<0.8)isKaon=1;
1070  if(isKaon==1)return kTRUE;
1071  }
1072  break;
1073  default:
1074  {
1075  AliWarning(Form("WRONG CASE OF PID STRATEGY SELECTED: %d (can range from 0 to 2)",fPIDselCaseZero));
1076  return kFALSE;// actually case 0 could be set as the default and return kTRUE
1077  }
1078  }
1079  }
1080 
1081  return kFALSE;
1082 }
1083 //_______________________________________________________________________
1086 
1087  if(!fPidHF) return kTRUE;
1088  Int_t isPion=fPidHF->MakeRawPid(track,AliPID::kPion);
1089  Double_t mom=track->P();
1090  if(SelectAODTrack(track,fTrackCutsPion)) {
1091  if(isPion>=1) return kTRUE;
1092  if(isPion<=-1) return kFALSE;
1093  switch(fPIDselCaseZero){// isPion=0
1094  case 0:
1095  {
1096  return kTRUE;// always accept
1097  }
1098  break;
1099  case 1:
1100  {
1101  if(track->P()>fmaxPforIDPion)return kTRUE;// accept only if in a compatibility band starting from p=fmaxPforIDPion
1102  }
1103  break;
1104  case 2:
1105  {
1106  // more elaborated strategy: asymmetric cuts, with fix momenta and nsigma ranges for the moment
1107  if(track->P()>fmaxPforIDPion)return kTRUE;
1108  AliPIDResponse *pidResp=fPidHF->GetPidResponse();
1109  Double_t nsigma=pidResp->NumberOfSigmasTPC(track,AliPID::kPion);
1110  if(nsigma<2.&& nsigma>-3. && mom<0.6)isPion=1;
1111  else if(nsigma<1. && nsigma> -3. && mom<0.8)isPion=1;
1112  if(isPion==1)return kTRUE;
1113  }
1114  break;
1115  default:
1116  {
1117  AliWarning(Form("WRONG CASE OF PID STRATEGY SELECTED: %d (can range from 0 to 2)",fPIDselCaseZero));
1118  return kFALSE;// actually case 0 could be set as the default and return kTRUE
1119  }
1120  }
1121  }
1122 
1123  return kFALSE;
1124 }
1125 
1126 //________________________________________________________________________
1127 Bool_t AliAnalysisTaskCombinHF::SelectAODTrack(AliAODTrack *track, AliESDtrackCuts *cuts){
1129 
1130  if(!cuts) return kTRUE;
1131 
1132  AliESDtrack esdTrack(track);
1133  // set the TPC cluster info
1134  esdTrack.SetTPCClusterMap(track->GetTPCClusterMap());
1135  esdTrack.SetTPCSharedMap(track->GetTPCSharedMap());
1136  esdTrack.SetTPCPointsF(track->GetTPCNclsF());
1137  if(!cuts->IsSelected(&esdTrack)) return kFALSE;
1138 
1139  return kTRUE;
1140 }
1141 
1142 //_________________________________________________________________
1143 Bool_t AliAnalysisTaskCombinHF::CheckAcceptance(TClonesArray* arrayMC,Int_t nProng, Int_t *labDau){
1145  for (Int_t iProng = 0; iProng<nProng; iProng++){
1146  AliAODMCParticle* mcPartDaughter=dynamic_cast<AliAODMCParticle*>(arrayMC->At(labDau[iProng]));
1147  if(!mcPartDaughter) return kFALSE;
1148  Double_t eta = mcPartDaughter->Eta();
1149  Double_t pt = mcPartDaughter->Pt();
1150  if (TMath::Abs(eta) > fEtaAccCut || pt < fPtAccCut) return kFALSE;
1151  }
1152  return kTRUE;
1153 }
1154 //_________________________________________________________________
1157  if(!fzVertPoolLims || !fMultPoolLims) return 0;
1158  Int_t theBinZ=TMath::BinarySearch(fNzVertPoolsLimSize,fzVertPoolLims,zvert);
1159  if(theBinZ<0 || theBinZ>=fNzVertPoolsLimSize) return -1;
1160  Int_t theBinM=TMath::BinarySearch(fNMultPoolsLimSize,fMultPoolLims,mult);
1161  if(theBinM<0 || theBinM>=fNMultPoolsLimSize) return -1;
1162  return fNMultPools*theBinZ+theBinM;
1163 }
1164 //_________________________________________________________________
1167  if(poolIndex<0 || poolIndex>=fNOfPools) return;
1168  delete fEventBuffer[poolIndex];
1169  fEventBuffer[poolIndex]=new TTree(Form("EventBuffer_%d",poolIndex), "Temporary buffer for event mixing");
1170  fEventBuffer[poolIndex]->Branch("zVertex", &fVtxZ);
1171  fEventBuffer[poolIndex]->Branch("multiplicity", &fMultiplicity);
1172  fEventBuffer[poolIndex]->Branch("eventInfo", "TObjString",&fEventInfo);
1173  fEventBuffer[poolIndex]->Branch("karray", "TObjArray", &fKaonTracks);
1174  fEventBuffer[poolIndex]->Branch("parray", "TObjArray", &fPionTracks);
1175  return;
1176 }
1177 //_________________________________________________________________
1180  if(TMath::Abs(zv2-zv1)>fMaxzVertDistForMix) return kFALSE;
1181  if(TMath::Abs(mult2-mult1)>fMaxMultDiffForMix) return kFALSE;
1182  return kTRUE;
1183 }
1184 //_________________________________________________________________
1187 
1188  if(fDoEventMixing==0) return;
1189  Int_t nEvents=fEventBuffer[0]->GetEntries();
1190  if(fDebug > 1) printf("AnalysisTaskCombinHF::DoMixingWithCuts Start Event Mixing of %d events\n",nEvents);
1191 
1192  TObjArray* karray=0x0;
1193  TObjArray* parray=0x0;
1194  Double_t zVertex,mult;
1195  TObjString* eventInfo=0x0;
1196  fEventBuffer[0]->SetBranchAddress("karray", &karray);
1197  fEventBuffer[0]->SetBranchAddress("parray", &parray);
1198  fEventBuffer[0]->SetBranchAddress("eventInfo",&eventInfo);
1199  fEventBuffer[0]->SetBranchAddress("zVertex", &zVertex);
1200  fEventBuffer[0]->SetBranchAddress("multiplicity", &mult);
1201  Double_t d02[2]={0.,0.};
1202  Double_t d03[3]={0.,0.,0.};
1203  AliAODRecoDecay* tmpRD2 = new AliAODRecoDecay(0x0,2,0,d02);
1204  AliAODRecoDecay* tmpRD3 = new AliAODRecoDecay(0x0,3,1,d03);
1205  UInt_t pdg0[2]={321,211};
1206  // UInt_t pdgp[3]={321,211,211};
1207  Double_t px[3],py[3],pz[3];
1208  Int_t evId1,esdId1,nk1,np1;
1209  Int_t evId2,esdId2,nk2,np2;
1210 
1211  for(Int_t iEv1=0; iEv1<nEvents; iEv1++){
1212  fEventBuffer[0]->GetEvent(iEv1);
1213  TObjArray* karray1=(TObjArray*)karray->Clone();
1214  Double_t zVertex1=zVertex;
1215  Double_t mult1=mult;
1216  Int_t nKaons=karray1->GetEntries();
1217  Int_t nPionsForCheck=parray->GetEntries();
1218  sscanf((eventInfo->String()).Data(),"Ev%d_esd%d_Pi%d_K%d",&evId1,&esdId1,&np1,&nk1);
1219  if(nk1!=nKaons || np1!=nPionsForCheck){
1220  printf("AnalysisTaskCombinHF::DoMixingWithCuts ERROR: read event does not match to the stored one\n");
1221  delete karray1;
1222  continue;
1223  }
1224  for(Int_t iEv2=0; iEv2<fNumberOfEventsForMixing; iEv2++){
1225  Int_t iToMix=iEv1+iEv2+1;
1226  if(iEv1>=(nEvents-fNumberOfEventsForMixing)) iToMix=iEv1-iEv2-1;
1227  if(iToMix<0) continue;
1228  if(iToMix==iEv1) continue;
1229  if(iToMix<iEv1) continue;
1230  fEventBuffer[0]->GetEvent(iToMix);
1231  Double_t zVertex2=zVertex;
1232  Double_t mult2=mult;
1233  if(TMath::Abs(zVertex2-zVertex1)<0.0001 && TMath::Abs(mult2-mult1)<0.001){
1234  printf("AnalysisTaskCombinHF::DoMixingWithCuts ERROR: same event in mixing??? %d %d %f %f %f %f\n",iEv1,iEv2,zVertex1,zVertex2,mult1,mult2);
1235  continue;
1236  }
1237  TObjArray* parray2=(TObjArray*)parray->Clone();
1238  Int_t nPions=parray2->GetEntries();
1239  Int_t nKaonsForCheck=karray->GetEntries();
1240  sscanf((eventInfo->String()).Data(),"Ev%d_esd%d_Pi%d_K%d",&evId2,&esdId2,&np2,&nk2);
1241  if(nk2!=nKaonsForCheck || np2!=nPions){
1242  printf("AnalysisTaskCombinHF::DoMixingWithCuts ERROR: read event does not match to the stored one\n");
1243  delete parray2;
1244  continue;
1245  }
1246  if(evId2==evId1 && esdId2==esdId1){
1247  printf("AnalysisTaskCombinHF::DoMixingWithCuts ERROR: same event in mixing??? %d %d nK=%d %d nPi=%d %d\n",evId1,evId2,nKaons,nKaonsForCheck,nPionsForCheck,nPions);
1248  delete parray2;
1249  continue;
1250  }
1251  if(CanBeMixed(zVertex1,zVertex2,mult1,mult2)){
1252  for(Int_t iTr1=0; iTr1<nKaons; iTr1++){
1253  TLorentzVector* trK=(TLorentzVector*)karray1->At(iTr1);
1254  Double_t chargeK=trK->T();
1255  px[0] = trK->Px();
1256  py[0] = trK->Py();
1257  pz[0] = trK->Pz();
1258  for(Int_t iTr2=0; iTr2<nPions; iTr2++){
1259  TLorentzVector* trPi1=(TLorentzVector*)parray2->At(iTr2);
1260  Double_t chargePi1=trPi1->T();
1261  px[1] = trPi1->Px();
1262  py[1] = trPi1->Py();
1263  pz[1] = trPi1->Pz();
1264  if(fMeson==kDzero && chargePi1*chargeK<0){
1265  FillMEHistos(421,2,tmpRD2,px,py,pz,pdg0);
1266  }
1267  if(fMeson==kDzero && chargePi1*chargeK>0){
1268  FillMEHistosLS(421,2,tmpRD2,px,py,pz,pdg0,(Int_t)chargePi1);
1269  }
1270  }
1271  }
1272  }
1273  delete parray2;
1274  }
1275  delete karray1;
1276  }
1277  delete tmpRD2;
1278  delete tmpRD3;
1279 }
1280 //_________________________________________________________________
1283 
1284  if(fDoEventMixing==0) return;
1285  if(poolIndex<0 || poolIndex>fNzVertPools*fNMultPools) return;
1286 
1287  Int_t nEvents=fEventBuffer[poolIndex]->GetEntries();
1288  if(fDebug > 1) printf("AliAnalysisTaskCombinHF::DoMixingWithPools Start Event Mixing of %d events\n",nEvents);
1289  TObjArray* karray=0x0;
1290  TObjArray* parray=0x0;
1291  Double_t zVertex,mult;
1292  TObjString* eventInfo=0x0;
1293  fEventBuffer[poolIndex]->SetBranchAddress("karray", &karray);
1294  fEventBuffer[poolIndex]->SetBranchAddress("parray", &parray);
1295  fEventBuffer[poolIndex]->SetBranchAddress("eventInfo",&eventInfo);
1296  fEventBuffer[poolIndex]->SetBranchAddress("zVertex", &zVertex);
1297  fEventBuffer[poolIndex]->SetBranchAddress("multiplicity", &mult);
1298 
1299  // dummy values of track impact parameter, needed to build an AliAODRecoDecay object
1300  Double_t d02[2]={0.,0.};
1301  Double_t d03[3]={0.,0.,0.};
1302  AliAODRecoDecay* tmpRD2 = new AliAODRecoDecay(0x0,2,0,d02);
1303  AliAODRecoDecay* tmpRD3 = new AliAODRecoDecay(0x0,3,1,d03);
1304  UInt_t pdg0[2]={321,211};
1305  UInt_t pdgp[3]={321,211,211};
1306  UInt_t pdgs[3]={321,211,321};
1307  Double_t px[3],py[3],pz[3];
1308  Int_t evId1,esdId1,nk1,np1;
1309  Int_t evId2,esdId2,nk2,np2;
1310 
1311  for(Int_t iEv1=0; iEv1<nEvents; iEv1++){
1312  fEventBuffer[poolIndex]->GetEvent(iEv1);
1313  TObjArray* karray1=(TObjArray*)karray->Clone();
1314  Double_t zVertex1=zVertex;
1315  Double_t mult1=mult;
1316  Int_t nKaons=karray1->GetEntries();
1317  Int_t nPionsForCheck=parray->GetEntries();
1318  sscanf((eventInfo->String()).Data(),"Ev%d_esd%d_Pi%d_K%d",&evId1,&esdId1,&np1,&nk1);
1319  if(nk1!=nKaons || np1!=nPionsForCheck){
1320  printf("AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: read event does not match to the stored one\n");
1321  delete karray1;
1322  continue;
1323  }
1324  for(Int_t iEv2=0; iEv2<nEvents; iEv2++){
1325  if(iEv2==iEv1) continue;
1326  fEventBuffer[poolIndex]->GetEvent(iEv2);
1327  Double_t zVertex2=zVertex;
1328  Double_t mult2=mult;
1329  if(TMath::Abs(zVertex2-zVertex1)<0.0001 && TMath::Abs(mult2-mult1)<0.001){
1330  printf("AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: same event in mixing??? %d %d %f %f %f %f\n",iEv1,iEv2,zVertex1,zVertex2,mult1,mult2);
1331  continue;
1332  }
1333  TObjArray* parray2=(TObjArray*)parray->Clone();
1334  Int_t nPions=parray2->GetEntries();
1335  Int_t nKaonsForCheck=karray->GetEntries();
1336  sscanf((eventInfo->String()).Data(),"Ev%d_esd%d_Pi%d_K%d",&evId2,&esdId2,&np2,&nk2);
1337  if(nk2!=nKaonsForCheck || np2!=nPions){
1338  printf("AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: read event does not match to the stored one\n");
1339  delete parray2;
1340  continue;
1341  }
1342  if(evId2==evId1 && esdId2==esdId1){
1343  printf("AliAnalysisTaskCombinHF::DoMixingWithPools ERROR: same event in mixing??? %d %d nK=%d %d nPi=%d %d\n",evId1,evId2,nKaons,nKaonsForCheck,nPionsForCheck,nPions);
1344  delete parray2;
1345  continue;
1346  }
1347  TObjArray* parray3=0x0;
1348  Int_t nPions3=0;
1349  if(fMeson!=kDzero){
1350  Int_t iEv3=iEv2+1;
1351  if(iEv3==iEv1) iEv3=iEv2+2;
1352  if(iEv3>=nEvents) iEv3=iEv2-3;
1353  if(nEvents==2) iEv3=iEv1;
1354  if(iEv3<0) iEv3=iEv2-1;
1355  fEventBuffer[poolIndex]->GetEvent(iEv3);
1356  parray3=(TObjArray*)parray->Clone();
1357  nPions3=parray3->GetEntries();
1358  }
1359  for(Int_t iTr1=0; iTr1<nKaons; iTr1++){
1360  TLorentzVector* trK=(TLorentzVector*)karray1->At(iTr1);
1361  Double_t chargeK=trK->T();
1362  px[0] = trK->Px();
1363  py[0] = trK->Py();
1364  pz[0] = trK->Pz();
1365  for(Int_t iTr2=0; iTr2<nPions; iTr2++){
1366  TLorentzVector* trPi1=(TLorentzVector*)parray2->At(iTr2);
1367  Double_t chargePi1=trPi1->T();
1368  px[1] = trPi1->Px();
1369  py[1] = trPi1->Py();
1370  pz[1] = trPi1->Pz();
1371  if(chargePi1*chargeK<0){
1372  if(fMeson==kDzero){
1373  FillMEHistos(421,2,tmpRD2,px,py,pz,pdg0);
1374  }else{
1375  if(parray3){
1376  for(Int_t iTr3=iTr2+1; iTr3<nPions3; iTr3++){
1377  TLorentzVector* trPi2=(TLorentzVector*)parray3->At(iTr3);
1378  Double_t chargePi2=trPi2->T();
1379  px[2] = trPi2->Px();
1380  py[2] = trPi2->Py();
1381  pz[2] = trPi2->Pz();
1382  if(chargePi2*chargeK<0){
1383  if(fMeson==kDplus) FillMEHistos(411,3,tmpRD3,px,py,pz,pdgp);
1384  else if(fMeson==kDs) FillMEHistos(431,3,tmpRD3,px,py,pz,pdgs);
1385  }
1386  }
1387  }
1388  }
1389  }else if(chargePi1*chargeK>0){
1390  if(fMeson==kDzero) FillMEHistosLS(421,2,tmpRD2,px,py,pz,pdg0,(Int_t)chargePi1);
1391  }
1392  }
1393  }
1394  delete parray3;
1395  delete parray2;
1396  }
1397  delete karray1;
1398  }
1399  delete tmpRD2;
1400  delete tmpRD3;
1401 }
1402 //_________________________________________________________________
1404 {
1406  if(fDoEventMixing==0) return;
1407  printf("AliAnalysisTaskCombinHF: FinishTaskOutput\n");
1408 
1409  if(fDoEventMixing==1){
1410  for(Int_t i=0; i<fNOfPools; i++){
1411  Int_t nEvents=fEventBuffer[i]->GetEntries();
1412  if(nEvents>1) DoMixingWithPools(i);
1413  }
1414  }else if(fDoEventMixing==2){
1415  DoMixingWithCuts();
1416  }
1417 }
1418 //_________________________________________________________________
1419 Double_t AliAnalysisTaskCombinHF::ComputeInvMassKK(AliAODTrack* tr1, AliAODTrack* tr2) const{
1421  Double_t massK=TDatabasePDG::Instance()->GetParticle(321)->Mass();
1422  Double_t p1=tr1->P();
1423  Double_t p2=tr2->P();
1424  Double_t pxtot=tr1->Px()+tr2->Px();
1425  Double_t pytot=tr1->Py()+tr2->Py();
1426  Double_t pztot=tr1->Pz()+tr2->Pz();
1427  Double_t e1=TMath::Sqrt(massK*massK+p1*p1);
1428  Double_t e2=TMath::Sqrt(massK*massK+p2*p2);
1429  Double_t etot=e1+e2;
1430  Double_t m2=etot*etot-(pxtot*pxtot+pytot*pytot+pztot*pztot);
1431  return TMath::Sqrt(m2);
1432 }
1433 //_________________________________________________________________
1435 {
1437  //
1438  if(fDebug > 1) printf("AliAnalysisTaskCombinHF: Terminate() \n");
1439  fOutput = dynamic_cast<TList*> (GetOutputData(1));
1440  if (!fOutput) {
1441  printf("ERROR: fOutput not available\n");
1442  return;
1443  }
1444  fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("hNEvents"));
1445  if(fHistNEvents){
1446  printf("Number of analyzed events = %d\n",(Int_t)fHistNEvents->GetBinContent(2));
1447  }else{
1448  printf("ERROR: fHistNEvents not available\n");
1449  return;
1450  }
1451  return;
1452 }
1453 
Int_t charge
Bool_t IsEventRejectedDueToCentrality() const
Definition: AliRDHFCuts.h:321
Double_t fEtaAccCut
width of pt bin (GeV/c)
Bool_t FillHistos(Int_t pdgD, Int_t nProngs, AliAODRecoDecay *tmpRD, Double_t *px, Double_t *py, Double_t *pz, UInt_t *pdgdau, TClonesArray *arrayMC, Int_t *dgLabels)
Bool_t IsEventRejectedDueToZVertexOutsideFiducialRegion() const
Definition: AliRDHFCuts.h:315
Bool_t IsTrackSelected(AliAODTrack *track)
static Int_t CheckD0Decay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
Bool_t IsEventRejectedDueToNotRecoVertex() const
Definition: AliRDHFCuts.h:309
double Double_t
Definition: External.C:58
Definition: External.C:260
Double_t fMaxzVertDistForMix
maximum number of events to be used in event mixing
void FillMEHistosLS(Int_t pdgD, Int_t nProngs, AliAODRecoDecay *tmpRD, Double_t *px, Double_t *py, Double_t *pz, UInt_t *pdgdau, Int_t charge)
Int_t fNzVertPoolsLimSize
number of pools in z vertex for event mixing
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
TH3F * fMassVsPtVsYMELSpp
! hist. of Y vs. Pt vs. Mass (mixedevents)
Bool_t IsKaon(AliAODTrack *track)
Definition: External.C:236
Bool_t CheckAcceptance(TClonesArray *arrayMC, Int_t nProng, Int_t *labDau)
static Int_t CheckDplusDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
TH1F * fHistTrackStatus
!hist. of status of tracks
AliNormalizationCounter * fCounter
maximum angle for track rotation (3rd prong)
TH3F * fPtVsYVsMultGenAccEvSel
! hist. of Y vs. Pt vs. Mult generated (D in acc, sel ev.)
Bool_t IsPion(AliAODTrack *track)
Int_t IsEventSelectedInCentrality(AliVEvent *event)
Int_t fNMultPoolsLimSize
number of pools in multiplicity for event mixing
void FillMEHistos(Int_t pdgD, Int_t nProngs, AliAODRecoDecay *tmpRD, Double_t *px, Double_t *py, Double_t *pz, UInt_t *pdgdau)
static Int_t CheckDsDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
void ConfigureMultiplicityPools(Int_t nPools, Double_t *multLimits)
Double_t fMaxMultiplicity
lower limit for multiplcities in MC histos
TH1F * fNSelected
! hist. of n. of selected D+
TList * fOutput
! list send on output slot 0
Bool_t fReadMC
mesonSpecies (see enum)
TH3F * fMassVsPtVsY
! hist. of Y vs. Pt vs. Mass (all cand)
TH2F * fHistEventMultZvEvSel
!hist. of evnt Mult vs. Zv for selected ev
Double_t fMinAngleForRot
number of rotations
Double_t mass
Double_t fPtAccCut
eta limits for acceptance step
Bool_t IsEventRejectedDueToVertexContributors() const
Definition: AliRDHFCuts.h:312
TH3F * fPtVsYVsMultGen
! hist. of Y vs. Pt vs. Mult generated (all D)
Double_t fPtBinWidth
maximum pT value for inv. mass histograms
void ConfigureZVertPools(Int_t nPools, Double_t *zVertLimits)
Bool_t fKeepNegID
flag for upper p limit for id band for kaon
TTree ** fEventBuffer
number of pools
Double_t fBayesThresPion
threshold for kaon identification via Bayesian PID
Double_t fMaxPt
maximum value of invariant mass
TH3F * fPtVsYVsMultReco
! hist. of Y vs. Pt vs. Mult generated (Reco D)
Int_t fNRotations3
maximum angle for track rotation
void FillGenHistos(TClonesArray *arrayMC, Bool_t isEvSel)
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:247
TH2F * fHistEventMultZv
!hist. of evnt Mult vs. Zv for all events
TH3F * fPtVsYVsMultGenLimAcc
! hist. of Y vs. Pt vs. Mult generated (|y|<0.5)
Bool_t CanBeMixed(Double_t zv1, Double_t zv2, Double_t mult1, Double_t mult2)
Double_t fPhiMassCut
kaon track selection
const Int_t nPtBins
AliAODPidHF * fPidHF
cut on the KK inv mass for phi selection
static Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent *ev, Double_t mineta, Double_t maxeta)
Int_t fPIDselCaseZero
flag to keep also track with negative ID (default kFALSE, change it only if you know what you are doi...
TH1F * fHistNEvents
!hist. for No. of events
TH1F * fNormRotated
! hist. rotated/selected D+
TH3F * fMassVsPtVsYLSmm
! hist. of Y vs. Pt vs. Mass (like sign –)
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
AliPIDCombined * GetPidCombined() const
Definition: AliAODPidHF.h:161
Double_t fMaxAngleForRot
minimum angle for track rotation
Int_t GetPoolIndex(Double_t zvert, Double_t mult)
Double_t fMinAngleForRot3
number of rotations (3rd prong)
AliESDtrackCuts * fTrackCutsAll
FilterMask.
AliRDHFCuts * fAnalysisCuts
PID configuration.
THnSparse * fDeltaMassFullAnalysis
! hist. mass difference after rotations with more details
Int_t fNzVertPools
cut on multiplicity difference for event mixing with cuts
TH3F * fMassVsPtVsYSig
! hist. of Y vs. Pt vs. Mass (signal)
Int_t fFullAnalysis
flag for definition of c,b origin
Double_t * fzVertPoolLims
number of pools in z vertex for event mixing +1
Bool_t IsEventRejectedDueToPileup() const
Definition: AliRDHFCuts.h:318
Double_t nsigma
void FillLSHistos(Int_t pdgD, Int_t nProngs, AliAODRecoDecay *tmpRD, Double_t *px, Double_t *py, Double_t *pz, UInt_t *pdgdau, Int_t charge)
virtual void UserExec(Option_t *option)
Int_t MakeRawPid(AliAODTrack *track, Int_t specie)
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
virtual void Terminate(Option_t *option)
Double_t ComputeInvMassKK(AliAODTrack *tr1, AliAODTrack *tr2) const
Double_t fMinMultiplicity
multiplicity
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)
Bool_t IsEventRejectedDuePhysicsSelection() const
Definition: AliRDHFCuts.h:336
Double_t fMinMass
Cuts for candidates.
Int_t fPIDstrategy
flag to set analysis level (0 is the fastest)
Double_t fVtxZ
unique event Id for event mixing checks
AliESDtrackCuts * fTrackCutsKaon
pion track selection
Bool_t fGoUpToQuark
flag to select prompt (1), feeddown (2) or all (3)
Bool_t SelectAODTrack(AliAODTrack *track, AliESDtrackCuts *cuts)
Bool_t IsEventSelected(AliVEvent *event)
TH1F * fHistCheckDecChanAcc
!hist. of decay channel of D meson in acc.
Int_t fDoEventMixing
threshold for pion identification via Bayesian PID
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
TH3F * fPtVsYVsMultGenAcc
! hist. of Y vs. Pt vs. Mult generated (D in acc)
TH3F * fMassVsPtVsYME
! hist. of Y vs. Pt vs. Mass (mixedevents)
Float_t nEvents[nProd]
TH3F * fPtVsYVsMultGenLargeAcc
! hist. of Y vs. Pt vs. Mult generated (|y|<0.9)
Double_t fmaxPforIDKaon
flag for upper p limit for id band for pion
TH2F * fEventsPerPool
! hist with number of events per pool
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TH3F * fMassVsPtVsYBkg
! hist. of Y vs. Pt vs. Mass (background)
TH2F * fMixingsPerPool
! hist with number of mixings per pool
TH3F * fMassVsPtVsYLSpp
! hist. of Y vs. Pt vs. Mass (like sign ++)
Int_t fNumberOfEventsForMixing
flag for event mixing
TObjArray * fPionTracks
array of kaon-compatible tracks (TLorentzVectors)
void DoMixingWithPools(Int_t poolIndex)
Int_t fNRotations
pt limits for acceptance step
const char Option_t
Definition: External.C:48
TH1F * fHistCheckOriginSel
!hist. of origin (c/b) of D meson
Double_t fBayesThresKaon
flag to change PID strategy
Bool_t IsEventRejectedDueToTrigger() const
Definition: AliRDHFCuts.h:306
TH1F * fDeltaMass
! hist. mass difference after rotations
TObjArray * fKaonTracks
upper limit for multiplcities in MC histos
bool Bool_t
Definition: External.C:53
Int_t fPromptFeeddown
flag for access to MC
virtual Bool_t IsInFiducialAcceptance(Double_t, Double_t) const
Definition: AliRDHFCuts.h:301
Int_t GetUseCentrality() const
Definition: AliRDHFCuts.h:270
Double_t fMaxMultDiffForMix
cut on zvertex distance for event mixing with cuts
Double_t fMaxMass
minimum value of invariant mass
TString meson
TH3F * fMassVsPtVsYMELSmm
! hist. of Y vs. Pt vs. Mass (mixedevents)
TH1F * fHistCheckDecChan
!hist. of decay channel of D meson
Double_t fmaxPforIDPion
knSigma, kBayesianMaxProb, kBayesianThres
TH3F * fMassVsPtVsYRefl
! hist. of Y vs. Pt vs. Mass (reflections)
Double_t * fMultPoolLims
number of pools in multiplicity for event mixing +1
Double_t fMaxAngleForRot3
minimum angle for track rotation (3rd prong)
void SetPidResponse(AliPIDResponse *pidResp)
Definition: AliAODPidHF.h:111
TH3F * fMassVsPtVsYRot
! hist. of Y vs. Pt vs. Mass (rotations)
TH1F * fHistCheckOrigin
!hist. of origin (c/b) of D meson