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