AliPhysics  ed43440 (ed43440)
AliAnalysisTaskSEDplus.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2008, 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 AliAnalysisTaskSEDplus
20 // AliAnalysisTaskSE for the D+ candidates Invariant Mass Histogram and
21 // comparison of heavy-flavour decay candidates
22 // to MC truth (kinematics stored in the AOD)
23 // Authors: Renu Bala, bala@to.infn.it
24 // F. Prino, prino@to.infn.it
25 // G. Ortona, ortona@to.infn.it
27 
28 #include <TClonesArray.h>
29 #include <TNtuple.h>
30 #include <TCanvas.h>
31 #include <TList.h>
32 #include <TString.h>
33 #include <TDatabasePDG.h>
34 #include "AliAnalysisManager.h"
36 #include "AliAODHandler.h"
37 #include "AliAODEvent.h"
38 #include "AliAODVertex.h"
39 #include "AliAODTrack.h"
41 #include "AliAnalysisVertexingHF.h"
42 #include "AliAnalysisTaskSE.h"
43 #include "AliAnalysisTaskSEDplus.h"
45 #include "AliVertexingHFUtils.h"
46 
48 ClassImp(AliAnalysisTaskSEDplus);
50 
51 //________________________________________________________________________
54  fOutput(0),
55  fHistNEvents(0),
56  fHistNCandidates(0),
57  fMassHist(0x0),
58  fMassHistPlus(0x0),
59  fMassHistMinus(0x0),
60  fMassHistNoPid(0x0),
61  fCosPHist(0x0),
62  fDLenHist(0x0),
63  fSumd02Hist(0x0),
64  fSigVertHist(0x0),
65  fPtMaxHist(0x0),
66  fPtKHist(0x0),
67  fPtpi1Hist(0x0),
68  fPtpi2Hist(0x0),
69  fDCAHist(0x0),
70  fDLxy(0x0),
71  fCosxy(0x0),
72  fHistTrackVar(0),
73  fMCAccPrompt(0),
74  fMCAccBFeed(0),
75  fPtVsMassNoPid(0),
76  fPtVsMass(0),
77  fPtVsMassPlus(0),
78  fPtVsMassMinus(0),
79  fPtVsMassBadDaus(0),
80  fPtVsMassGoodDaus(0),
81  fYVsPtNoPid(0),
82  fYVsPt(0),
83  fYVsPtSigNoPid(0),
84  fYVsPtSig(0),
85  fPhiEtaCand(0),
86  fPhiEtaCandSigReg(0),
87  fSPDMult(0),
88  fDaughterClass(0),
89  fDeltaID(0),
90  fIDDauVsIDTra(0),
91  fMassHistLS(0x0),
92  fCosPHistLS(0x0),
93  fDLenHistLS(0x0),
94  fSumd02HistLS(0x0),
95  fSigVertHistLS(0x0),
96  fPtMaxHistLS(0x0),
97  fDCAHistLS(0x0),
98  fNtupleDplus(0),
99  fUpmasslimit(1.965),
100  fLowmasslimit(1.765),
101  fNPtBins(1),
102  fBinWidth(0.002),
103  fListCuts(0),
104  fRDCutsAnalysis(0),
105  fCounter(0),
106  fFillNtuple(0),
107  fAODProtection(1),
108  fReadMC(kFALSE),
109  fUseStrangeness(kFALSE),
110  fUseBit(kTRUE),
111  fCutsDistr(kFALSE),
112  fDoImpPar(kFALSE),
113  fDoSparse(kFALSE),
114  fDoTrackVarHist(kFALSE),
115  fStepMCAcc(kFALSE),
116  fUseQuarkTagInKine(kTRUE),
117  fNImpParBins(400),
118  fLowerImpPar(-1000.),
119  fHigherImpPar(1000.),
120  fDoLS(0),
121  fEtaSelection(0),
122  fSystem(0),
123  fNtrcklMin(0),
124  fNtrcklMax(10000),
125  fCutOnTrckl(kFALSE)
126 {
128 
129  for(Int_t i=0;i<3;i++){
130  fHistCentrality[i]=0;
131  fCorreld0Kd0pi[i]=0;
132  }
133 
134  for(Int_t i=0; i<5; i++)fHistMassPtImpPar[i]=0;
135  for(Int_t i=0; i<3; i++)fSparseCutVars[i]=0;
136 }
137 
138 //________________________________________________________________________
140  AliAnalysisTaskSE(name),
141  fOutput(0),
142  fHistNEvents(0),
143  fHistNCandidates(0),
144  fMassHist(0x0),
145  fMassHistPlus(0x0),
146  fMassHistMinus(0x0),
147  fMassHistNoPid(0x0),
148  fCosPHist(0x0),
149  fDLenHist(0x0),
150  fSumd02Hist(0x0),
151  fSigVertHist(0x0),
152  fPtMaxHist(0x0),
153  fPtKHist(0x0),
154  fPtpi1Hist(0x0),
155  fPtpi2Hist(0x0),
156  fDCAHist(0x0),
157  fDLxy(0x0),
158  fCosxy(0x0),
159  fHistTrackVar(0),
160  fMCAccPrompt(0),
161  fMCAccBFeed(0),
162  fPtVsMassNoPid(0),
163  fPtVsMass(0),
164  fPtVsMassPlus(0),
165  fPtVsMassMinus(0),
166  fPtVsMassBadDaus(0),
168  fYVsPtNoPid(0),
169  fYVsPt(0),
170  fYVsPtSigNoPid(0),
171  fYVsPtSig(0),
172  fPhiEtaCand(0),
174  fSPDMult(0),
175  fDaughterClass(0),
176  fDeltaID(0),
177  fIDDauVsIDTra(0),
178  fMassHistLS(0x0),
179  fCosPHistLS(0x0),
180  fDLenHistLS(0x0),
181  fSumd02HistLS(0x0),
182  fSigVertHistLS(0x0),
183  fPtMaxHistLS(0x0),
184  fDCAHistLS(0x0),
185  fNtupleDplus(0),
186  fUpmasslimit(1.965),
187  fLowmasslimit(1.765),
188  fNPtBins(1),
189  fBinWidth(0.002),
190  fListCuts(0),
191  fRDCutsAnalysis(dpluscutsana),
192  fCounter(0),
193  fFillNtuple(fillNtuple),
194  fAODProtection(1),
195  fReadMC(kFALSE),
196  fUseStrangeness(kFALSE),
197  fUseBit(kTRUE),
198  fCutsDistr(kFALSE),
199  fDoImpPar(kFALSE),
200  fDoSparse(kFALSE),
201  fDoTrackVarHist(kFALSE),
202  fStepMCAcc(kFALSE),
203  fUseQuarkTagInKine(kTRUE),
204  fNImpParBins(400),
205  fLowerImpPar(-1000.),
206  fHigherImpPar(1000.),
207  fDoLS(0),
208  fEtaSelection(0),
209  fSystem(0),
210  fNtrcklMin(0),
211  fNtrcklMax(10000),
212  fCutOnTrckl(kFALSE)
213 {
214  //
216  //
218 
219  for(Int_t i=0;i<3;i++){
220  fHistCentrality[i]=0;
221  fCorreld0Kd0pi[i]=0;
222  }
223 
224  for(Int_t i=0; i<5; i++)fHistMassPtImpPar[i]=0;
225  for(Int_t i=0; i<3; i++)fSparseCutVars[i]=0;
226 
227  // Default constructor
228  // Output slot #1 writes into a TList container
229  DefineOutput(1,TList::Class()); //My private output
230  // Output slot #2 writes cut to private output
231  // DefineOutput(2,AliRDHFCutsDplustoKpipi::Class());
232  DefineOutput(2,TList::Class());
233  // Output slot #3 writes cut to private output
234  DefineOutput(3,AliNormalizationCounter::Class());
235 
236  if(fFillNtuple){
237  // Output slot #4 writes into a TNtuple container
238  DefineOutput(4,TNtuple::Class()); //My private output
239  }
240 }
241 
242 //________________________________________________________________________
244 {
245  //
247  //
248  if(fOutput && !fOutput->IsOwner()){
249  delete fHistNEvents;
250  delete fHistNCandidates;
251  for(Int_t i=0;i<3*fNPtBins;i++){
252  delete fMassHist[i];
253  delete fMassHistPlus[i];
254  delete fMassHistMinus[i];
255  delete fMassHistNoPid[i];
256  delete fCosPHist[i];
257  delete fDLenHist[i];
258  delete fSumd02Hist[i];
259  delete fSigVertHist[i];
260  delete fPtMaxHist[i];
261  delete fPtKHist[i];
262  delete fPtpi1Hist[i];
263  delete fPtpi2Hist[i];
264  delete fDCAHist[i];
265  delete fDLxy[i];
266  delete fCosxy[i];
267  delete fCosPHistLS[i];
268  delete fDLenHistLS[i];
269  delete fSumd02HistLS[i];
270  delete fSigVertHistLS[i];
271  delete fPtMaxHistLS[i];
272  delete fDCAHistLS[i];
273  }
274  delete [] fMassHist;
275  delete [] fMassHistPlus;
276  delete [] fMassHistMinus;
277  delete [] fMassHistNoPid;
278  delete [] fCosPHist;
279  delete [] fDLenHist;
280  delete [] fSumd02Hist;
281  delete [] fSigVertHist;
282  delete [] fPtMaxHist;
283  delete [] fPtKHist;
284  delete [] fPtpi1Hist;
285  delete [] fPtpi2Hist;
286  delete [] fDCAHist;
287  delete [] fDLxy;
288  delete [] fCosxy;
289 
290  for(Int_t i=0;i<5*fNPtBins;i++){
291  delete fMassHistLS[i];
292  }
293 
294  delete [] fMassHistLS;
295  delete [] fCosPHistLS;
296  delete [] fDLenHistLS;
297  delete [] fSumd02HistLS;
298  delete [] fSigVertHistLS;
299  delete [] fPtMaxHistLS;
300  delete [] fDCAHistLS;
301 
302  for(Int_t i=0;i<3;i++){
303  delete fCorreld0Kd0pi[i];
304  delete fHistCentrality[i];
305  }
306  for(Int_t i=0;i<5;i++){
307  delete fHistMassPtImpPar[i];
308  }
309  for(Int_t i=0;i<3;i++){
310  delete fSparseCutVars[i];
311  }
312  delete fPtVsMassNoPid;
313  delete fPtVsMass;
314  delete fPtVsMassPlus;
315  delete fPtVsMassMinus;
316  delete fPtVsMassBadDaus;
317  delete fPtVsMassGoodDaus;
318  delete fYVsPtNoPid;
319  delete fYVsPt;
320  delete fYVsPtSigNoPid;
321  delete fYVsPtSig;
322  delete fPhiEtaCand;
323  delete fPhiEtaCandSigReg;
324  delete fSPDMult;
325  delete fDaughterClass;
326  delete fDeltaID;
327  delete fIDDauVsIDTra;
328  delete fHistTrackVar;
329  delete fMCAccPrompt;
330  delete fMCAccBFeed;
331  }
332 
333  delete fOutput;
334  delete fNtupleDplus;
335  delete fListCuts;
336  delete fRDCutsAnalysis;
337  delete fCounter;
338 
339 }
340 //_________________________________________________________________
343  Float_t bw=GetBinWidth();
344  fUpmasslimit = 1.865+range;
345  fLowmasslimit = 1.865-range;
346  SetBinWidth(bw);
347 }
348 //_________________________________________________________________
351  if(uplimit>lowlimit)
352  {
353  Float_t bw=GetBinWidth();
354  fUpmasslimit = lowlimit;
355  fLowmasslimit = uplimit;
356  SetBinWidth(bw);
357  }
358 }
359 //________________________________________________________________
361  Float_t width=w;
362  Int_t nbins=(Int_t)((fUpmasslimit-fLowmasslimit)/width+0.5);
363  Int_t missingbins=4-nbins%4;
364  nbins=nbins+missingbins;
365  width=(fUpmasslimit-fLowmasslimit)/nbins;
366  if(missingbins!=0){
367  printf("AliAnalysisTaskSEDplus::SetBinWidth: W-bin width of %f will produce histograms not rebinnable by 4. New width set to %f\n",w,width);
368  }
369  else{
370  if(fDebug>1) printf("AliAnalysisTaskSEDplus::SetBinWidth: width set to %f\n",width);
371  }
372  fBinWidth=width;
373 }
374 //_________________________________________________________________
376  return (Int_t)((fUpmasslimit-fLowmasslimit)/fBinWidth+0.5);
377 }
378 //_________________________________________________________________
379 void AliAnalysisTaskSEDplus::LSAnalysis(TClonesArray *arrayOppositeSign,TClonesArray *arrayLikeSign,AliAODEvent *aod,AliAODVertex *vtx1, Int_t nDplusOS){
380  //
381  //
383  //
384  if(fDebug>1)printf("started LS\n");
385 
386  //histograms for like sign
388  TH1F *histLSPlus = new TH1F("LSPlus","LSPlus",nbins,fLowmasslimit,fUpmasslimit);
389  TH1F *histLSMinus = new TH1F("LSMinus","LSMinus",nbins,fLowmasslimit,fUpmasslimit);
390 
391  Int_t nPosTrks=0,nNegTrks=0;
392  Int_t nOStriplets = arrayOppositeSign->GetEntriesFast();
393  Int_t nDplusLS=0;
394  Int_t nDminusLS=0;
395  Int_t nLikeSign = arrayLikeSign->GetEntriesFast();
396  Int_t index=0;
397 
398  // loop over like sign candidates
399  for(Int_t iLikeSign = 0; iLikeSign < nLikeSign; iLikeSign++) {
400  AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)arrayLikeSign->UncheckedAt(iLikeSign);
401  if(fUseBit && !d->HasSelectionBit(AliRDHFCuts::kDplusCuts))continue;
402  Bool_t unsetvtx=kFALSE;
403  if(!d->GetOwnPrimaryVtx()) {
404  d->SetOwnPrimaryVtx(vtx1); // needed to compute all variables
405  unsetvtx=kTRUE;
406  }
407  Double_t ptCand = d->Pt();
408  Int_t iPtBin = fRDCutsAnalysis->PtBin(ptCand);
409  if(iPtBin<0)continue;
410  Int_t sign= d->GetCharge();
411  if(sign>0){
412  nPosTrks++;
413  }else{
414  nNegTrks++;
415  }
417  Int_t passTightCuts=fRDCutsAnalysis->GetIsSelectedCuts();
418  if(passTightCuts>0){
419  Float_t invMass = d->InvMassDplus();
420  index=GetLSHistoIndex(iPtBin);
421  fMassHistLS[index+1]->Fill(invMass);
422  if(sign>0){
423  histLSPlus->Fill(invMass);
424  nDplusLS++;
425  }else{
426  histLSMinus->Fill(invMass);
427  nDminusLS++;
428  }
429  if(fCutsDistr){
430  Double_t dlen=d->DecayLength();
431  Double_t cosp=d->CosPointingAngle();
432  Double_t sumD02=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
433  Double_t dca=d->GetDCA();
434  Double_t sigvert=d->GetSigmaVert();
435  Double_t ptmax=0;
436  for(Int_t i=0;i<3;i++){
437  if(d->PtProng(i)>ptmax)ptmax=d->PtProng(i);
438  }
439  fCosPHistLS[iPtBin]->Fill(cosp);
440  fDLenHistLS[iPtBin]->Fill(dlen);
441  fSumd02HistLS[iPtBin]->Fill(sumD02);
442  fSigVertHistLS[iPtBin]->Fill(sigvert);
443  fPtMaxHistLS[iPtBin]->Fill(ptmax);
444  fDCAHistLS[iPtBin]->Fill(dca);
445  }
446  }
447  if(unsetvtx) d->UnsetOwnPrimaryVtx();
448  }
449  //wei:normalized to the number of combinations (production)
450  //wei2:normalized to the number of LS/OS (production)
451  //wei3:normalized to the number of LS/OS (analysis)
452  //wei4:normalized to the number of combinations (analysis)
453  Float_t wei2=0;
454  if(nLikeSign!=0)wei2 = (Float_t)nOStriplets/(Float_t)nLikeSign;
455  Float_t wei3=0;
456  if(nDplusLS!=0)wei3 = (Float_t)nDplusOS/(Float_t)(nDplusLS+nDminusLS);
457  Float_t weiplus=1.,weiminus=1.;
458  Float_t wei4plus=1.,wei4minus=1.;
459  //wei* should be automatically protected, since to get a triplet there must be at least 3 good tracks in the event
460  if(nPosTrks>2)weiplus=3.*(Float_t)nNegTrks/((Float_t)nPosTrks-2.);
461  if(nDplusLS>2)wei4plus=3.*(Float_t)nDminusLS/((Float_t)nDplusLS-2.);
462  if(nNegTrks>2)weiminus=3.*(Float_t)nPosTrks/((Float_t)nNegTrks-2.);
463  if(nDminusLS>2)wei4minus=3.*(Float_t)nDplusLS/((Float_t)nDminusLS-2.);
464 
465  fMassHistLS[index]->Add(histLSPlus,weiplus);
466  fMassHistLS[index]->Add(histLSMinus,weiminus);
467  fMassHistLS[index+2]->Add(histLSPlus,wei2);
468  fMassHistLS[index+2]->Add(histLSMinus,wei2);
469  fMassHistLS[index+3]->Add(histLSPlus,wei3);
470  fMassHistLS[index+3]->Add(histLSMinus,wei3);
471  fMassHistLS[index+4]->Add(histLSPlus,wei4plus);
472  fMassHistLS[index+4]->Add(histLSMinus,wei4minus);
473 
474  delete histLSPlus;histLSPlus=0;
475  delete histLSMinus;histLSMinus=0;
476 
477  if(fDebug>1) printf("LS analysis terminated\n");
478 }
479 
480 //__________________________________________
482  //
484  //
485  if(fDebug > 1) printf("AnalysisTaskSEDplus::Init() \n");
486 
487  //PostData(2,fRDCutsloose);//we should then put those cuts in a tlist if we have more than 1
488  fListCuts=new TList();
489  fListCuts->SetOwner();
491  analysis->SetName("AnalysisCuts");
492 
493  fListCuts->Add(analysis);
494  PostData(2,fListCuts);
495 
496  return;
497 }
498 
499 //________________________________________________________________________
501 {
503  //
504  if(fDebug > 1) printf("AnalysisTaskSEDplus::UserCreateOutputObjects() \n");
505 
506  // Several histograms are more conveniently managed in a TList
507  fOutput = new TList();
508  fOutput->SetOwner();
509  fOutput->SetName("OutputHistos");
510 
511  fHistNEvents = new TH1F("fHistNEvents", "number of events ",10,-0.5,9.5);
512  fHistNEvents->GetXaxis()->SetBinLabel(1,"nEvents read");
513  fHistNEvents->GetXaxis()->SetBinLabel(2,"Rejected due to mismatch in trees");
514  fHistNEvents->GetXaxis()->SetBinLabel(3,"nEvents with good AOD");
515  fHistNEvents->GetXaxis()->SetBinLabel(4,"Rejected due to trigger");
516  fHistNEvents->GetXaxis()->SetBinLabel(5,"Rejected due to vertex reco");
517  fHistNEvents->GetXaxis()->SetBinLabel(6,"Rejected due to pileup");
518  fHistNEvents->GetXaxis()->SetBinLabel(7,"Rejected due to centrality");
519  fHistNEvents->GetXaxis()->SetBinLabel(8,"Rejected due to vtxz");
520  fHistNEvents->GetXaxis()->SetBinLabel(9,"Rejected due to Physics Sel");
521  fHistNEvents->GetXaxis()->SetBinLabel(10,"nEvents accepted");
522  fHistNEvents->GetXaxis()->SetNdivisions(1,kFALSE);
523  fHistNEvents->SetMinimum(0);
524  fOutput->Add(fHistNEvents);
525 
526  fHistNCandidates = new TH1F("hNCandidates","number of candidates",7,-0.5,6.5);
527  fHistNCandidates->GetXaxis()->SetBinLabel(1,"no. of 3prong candidates");
528  fHistNCandidates->GetXaxis()->SetBinLabel(2,"no. of cand with D+ bitmask");
529  fHistNCandidates->GetXaxis()->SetBinLabel(3,"D+ not on-the-fly reco");
530  fHistNCandidates->GetXaxis()->SetBinLabel(4,"D+ after topological cuts");
531  fHistNCandidates->GetXaxis()->SetBinLabel(5,"D+ after Topological+SingleTrack cuts");
532  fHistNCandidates->GetXaxis()->SetBinLabel(6,"D+ after Topological+SingleTrack+PID cuts");
533  fHistNCandidates->GetXaxis()->SetBinLabel(7,"D+ rejected by preselect");
534  fHistNCandidates->GetXaxis()->SetNdivisions(1,kFALSE);
535  fHistNCandidates->SetMinimum(0);
537 
538  fMassHist = new TH1F*[3*fNPtBins];
539  fMassHistPlus = new TH1F*[3*fNPtBins];
540  fMassHistMinus = new TH1F*[3*fNPtBins];
541  fMassHistNoPid = new TH1F*[3*fNPtBins];
542  fCosPHist = new TH1F*[3*fNPtBins];
543  fDLenHist = new TH1F*[3*fNPtBins];
544  fSumd02Hist = new TH1F*[3*fNPtBins];
545  fSigVertHist = new TH1F*[3*fNPtBins];
546  fPtMaxHist = new TH1F*[3*fNPtBins];
547  fPtKHist = new TH1F*[3*fNPtBins];
548  fPtpi1Hist = new TH1F*[3*fNPtBins];
549  fPtpi2Hist = new TH1F*[3*fNPtBins];
550  fDCAHist = new TH1F*[3*fNPtBins];
551  fDLxy = new TH1F*[3*fNPtBins];
552  fCosxy = new TH1F*[3*fNPtBins];
553 
554  TString hisname;
555  Int_t index=0;
557  fHistCentrality[0]=new TH2F("hCentrMult","centrality",100,0.5,30000.5,40,0.,100.);
558  fHistCentrality[1]=new TH2F("hCentrMult(selectedCent)","centrality(selectedCent)",100,0.5,30000.5,40,0.,100.);
559  fHistCentrality[2]=new TH2F("hCentrMult(OutofCent)","centrality(OutofCent)",100,0.5,30000.5,40,0.,100.);
560  for(Int_t i=0;i<3;i++){
561  fHistCentrality[i]->Sumw2();
562  fOutput->Add(fHistCentrality[i]);
563  }
564  for(Int_t i=0;i<fNPtBins;i++){
565 
566  index=GetHistoIndex(i);
567 
568  hisname.Form("hMassNoPidPt%d",i);
569  fMassHistNoPid[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
570  fMassHistNoPid[index]->Sumw2();
571  hisname.Form("hCosPAllPt%d",i);
572  fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.5,1.);
573  fCosPHist[index]->Sumw2();
574  hisname.Form("hDLenAllPt%d",i);
575  fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.5);
576  fDLenHist[index]->Sumw2();
577  hisname.Form("hSumd02AllPt%d",i);
578  fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,1.);
579  fSumd02Hist[index]->Sumw2();
580  hisname.Form("hSigVertAllPt%d",i);
581  fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
582  fSigVertHist[index]->Sumw2();
583  hisname.Form("hPtMaxAllPt%d",i);
584  fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.5,5.);
585  fPtMaxHist[index]->Sumw2();
586  hisname.Form("hPtKPt%d",i);
587  fPtKHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
588  fPtKHist[index]->Sumw2();
589  hisname.Form("hPtpi1Pt%d",i);
590  fPtpi1Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
591  fPtpi1Hist[index]->Sumw2();
592  hisname.Form("hPtpi2Pt%d",i);
593  fPtpi2Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
594  fPtpi2Hist[index]->Sumw2();
595  hisname.Form("hDCAAllPt%d",i);
596  fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
597  fDCAHist[index]->Sumw2();
598 
599  hisname.Form("hDLxyPt%d",i);
600  fDLxy[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.);
601  fDLxy[index]->Sumw2();
602  hisname.Form("hCosxyPt%d",i);
603  fCosxy[index]=new TH1F(hisname.Data(),hisname.Data(),100,-1,1.);
604  fCosxy[index]->Sumw2();
605 
606  hisname.Form("hMassPt%dTC",i);
607  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
608  fMassHist[index]->Sumw2();
609  hisname.Form("hMassPt%dTCPlus",i);
610  fMassHistPlus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
611  fMassHistPlus[index]->Sumw2();
612  hisname.Form("hMassPt%dTCMinus",i);
613  fMassHistMinus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
614  fMassHistMinus[index]->Sumw2();
615 
616  index=GetSignalHistoIndex(i);
617  hisname.Form("hSigNoPidPt%d",i);
618  fMassHistNoPid[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
619  fMassHistNoPid[index]->Sumw2();
620  hisname.Form("hCosPSigPt%d",i);
621  fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.5,1.);
622  fCosPHist[index]->Sumw2();
623  hisname.Form("hDLenSigPt%d",i);
624  fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.5);
625  fDLenHist[index]->Sumw2();
626  hisname.Form("hSumd02SigPt%d",i);
627  fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,1.);
628  fSumd02Hist[index]->Sumw2();
629  hisname.Form("hSigVertSigPt%d",i);
630  fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
631  fSigVertHist[index]->Sumw2();
632  hisname.Form("hPtMaxSigPt%d",i);
633  fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.5,5.);
634  fPtMaxHist[index]->Sumw2();
635  hisname.Form("hPtKSigPt%d",i);
636  fPtKHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
637  fPtKHist[index]->Sumw2();
638  hisname.Form("hPtpi1SigPt%d",i);
639  fPtpi1Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
640  fPtpi1Hist[index]->Sumw2();
641  hisname.Form("hPtpi2SigPt%d",i);
642  fPtpi2Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
643  fPtpi2Hist[index]->Sumw2();
644 
645  hisname.Form("hDCASigPt%d",i);
646  fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
647  fDCAHist[index]->Sumw2();
648 
649  hisname.Form("hDLxySigPt%d",i);
650  fDLxy[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.);
651  fDLxy[index]->Sumw2();
652  hisname.Form("hCosxySigPt%d",i);
653  fCosxy[index]=new TH1F(hisname.Data(),hisname.Data(),100,-1,1.);
654  fCosxy[index]->Sumw2();
655  hisname.Form("hSigPt%dTC",i);
656  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
657  fMassHist[index]->Sumw2();
658  hisname.Form("hSigPt%dTCPlus",i);
659  fMassHistPlus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
660  fMassHistPlus[index]->Sumw2();
661  hisname.Form("hSigPt%dTCMinus",i);
662  fMassHistMinus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
663  fMassHistMinus[index]->Sumw2();
664 
665 
666  index=GetBackgroundHistoIndex(i);
667  hisname.Form("hBkgNoPidPt%d",i);
668  fMassHistNoPid[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
669  fMassHistNoPid[index]->Sumw2();
670  hisname.Form("hCosPBkgPt%d",i);
671  fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.5,1.);
672  fCosPHist[index]->Sumw2();
673  hisname.Form("hDLenBkgPt%d",i);
674  fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.5);
675  fDLenHist[index]->Sumw2();
676  hisname.Form("hSumd02BkgPt%d",i);
677  fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,1.);
678  fSumd02Hist[index]->Sumw2();
679  hisname.Form("hSigVertBkgPt%d",i);
680  fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
681  fSigVertHist[index]->Sumw2();
682  hisname.Form("hPtMaxBkgPt%d",i);
683  fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.5,5.);
684  fPtMaxHist[index]->Sumw2();
685  hisname.Form("hPtKBkgPt%d",i);
686  fPtKHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
687  fPtKHist[index]->Sumw2();
688  hisname.Form("hPtpi1BkgPt%d",i);
689  fPtpi1Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
690  fPtpi1Hist[index]->Sumw2();
691  hisname.Form("hPtpi2BkgPt%d",i);
692  fPtpi2Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
693  fPtpi2Hist[index]->Sumw2();
694  hisname.Form("hDCABkgPt%d",i);
695  fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
696  fDCAHist[index]->Sumw2();
697 
698  hisname.Form("hDLxyBkgPt%d",i);
699  fDLxy[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.);
700  fDLxy[index]->Sumw2();
701  hisname.Form("hCosxyBkgPt%d",i);
702  fCosxy[index]=new TH1F(hisname.Data(),hisname.Data(),100,-1,1.);
703  fCosxy[index]->Sumw2();
704 
705 
706  hisname.Form("hBkgPt%dTC",i);
707  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
708  fMassHist[index]->Sumw2();
709  hisname.Form("hBkgPt%dTCPlus",i);
710  fMassHistPlus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
711  fMassHistPlus[index]->Sumw2();
712  hisname.Form("hBkgPt%dTCMinus",i);
713  fMassHistMinus[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
714  fMassHistMinus[index]->Sumw2();
715  }
716 
717 
718  for(Int_t i=0; i<3*fNPtBins; i++){
719  fOutput->Add(fMassHistNoPid[i]);
720  if(fCutsDistr){
721  fOutput->Add(fCosPHist[i]);
722  fOutput->Add(fDLenHist[i]);
723  fOutput->Add(fSumd02Hist[i]);
724  fOutput->Add(fSigVertHist[i]);
725  fOutput->Add(fPtMaxHist[i]);
726  fOutput->Add(fPtKHist[i]);
727  fOutput->Add(fPtpi1Hist[i]);
728  fOutput->Add(fPtpi2Hist[i]);
729  fOutput->Add(fDCAHist[i]);
730  fOutput->Add(fDLxy[i]);
731  fOutput->Add(fCosxy[i]);
732  }
733  fOutput->Add(fMassHist[i]);
734  fOutput->Add(fMassHistPlus[i]);
735  fOutput->Add(fMassHistMinus[i]);
736 
737  }
738 
739  fCorreld0Kd0pi[0]=new TH2F("hCorreld0Kd0piAll","",100,-0.02,0.02,100,-0.02,0.02);
740  fCorreld0Kd0pi[1]=new TH2F("hCorreld0Kd0piSig","",100,-0.02,0.02,100,-0.02,0.02);
741  fCorreld0Kd0pi[2]=new TH2F("hCorreld0Kd0piBkg","",100,-0.02,0.02,100,-0.02,0.02);
742  if(fCutsDistr){
743  for(Int_t i=0; i<3; i++){
744  fCorreld0Kd0pi[i]->Sumw2();
745  fOutput->Add(fCorreld0Kd0pi[i]);
746  }
747  }
748 
749 
750  const Int_t nPtBins=440;
751  Double_t ptBinLims[nPtBins+1];
752  for(Int_t jb=0; jb<=300; jb++) ptBinLims[jb]=0.1*(Double_t)jb; // 100 MeV bins in 0<pt<30
753  for(Int_t jb=301; jb<=440; jb++) ptBinLims[jb]=ptBinLims[300]+0.5*(Double_t)(jb-300); // 500 MeV bins in 30<pt<100
754 
755  fPtVsMassNoPid=new TH2F("hPtVsMassNoPid","PtVsMass (no PID)",nbins,fLowmasslimit,fUpmasslimit,nPtBins,ptBinLims);
756  fPtVsMass=new TH2F("hPtVsMass","PtVsMass",nbins,fLowmasslimit,fUpmasslimit,nPtBins,ptBinLims);
757  fPtVsMassPlus=new TH2F("hPtVsMassPlus","PtVsMass",nbins,fLowmasslimit,fUpmasslimit,nPtBins,ptBinLims);
758  fPtVsMassMinus=new TH2F("hPtVsMassMinus","PtVsMass",nbins,fLowmasslimit,fUpmasslimit,nPtBins,ptBinLims);
759  fPtVsMassGoodDaus=new TH2F("hPtVsMassGoodDaus","PtVsMassGoodDaus",nbins,fLowmasslimit,fUpmasslimit,nPtBins,ptBinLims);
760  fPtVsMassBadDaus=new TH2F("hPtVsMassBadDaus","PtVsMassBadDaus",nbins,fLowmasslimit,fUpmasslimit,nPtBins,ptBinLims);
761 
762  fYVsPtNoPid=new TH3F("hYVsPtNoPid","YvsPt (no PID)",40,0.,20.,80,-2.,2.,nbins,fLowmasslimit,fUpmasslimit);
763  fYVsPt=new TH3F("hYVsPt","YvsPt",40,0.,20.,80,-2.,2.,nbins,fLowmasslimit,fUpmasslimit);
764  fYVsPtSigNoPid=new TH2F("hYVsPtSigNoPid","YvsPt (MC, only sig., no PID)",40,0.,20.,80,-2.,2.);
765  fYVsPtSig=new TH2F("hYVsPtSig","YvsPt (MC, only Sig)",40,0.,20.,80,-2.,2.);
766  fPhiEtaCand=new TH2F("hPhiEtaCand","phi vs. eta candidates",20,-1.,1.,50,0.,2*TMath::Pi());
767  fPhiEtaCandSigReg=new TH2F("hPhiEtaCandSigReg","phi vs. eta candidates",20,-1.,1.,50,0.,2*TMath::Pi());
768 
769  Double_t maxmult;
770  if(fSystem==1) maxmult=5000;
771  else maxmult=200;
772  fSPDMult = new TH1F("hSPDMult", "Tracklets multiplicity; Tracklets ; Entries",200,0.,maxmult);
773  fOutput->Add(fPtVsMassNoPid);
774  fOutput->Add(fPtVsMass);
775  fOutput->Add(fPtVsMassPlus);
776  fOutput->Add(fPtVsMassMinus);
779  fOutput->Add(fYVsPtNoPid);
780  fOutput->Add(fYVsPt);
781  fOutput->Add(fYVsPtSigNoPid);
782  fOutput->Add(fYVsPtSig);
783  fOutput->Add(fPhiEtaCand);
785  fOutput->Add(fSPDMult);
786 
787  fDaughterClass = new TH1F("hDaughterClass","",10,-0.5,9.5);
788  fDaughterClass->GetXaxis()->SetBinLabel(1,"AliAODTrack - good ID");
789  fDaughterClass->GetXaxis()->SetBinLabel(2,"AliAODTrack - charge0");
790  fDaughterClass->GetXaxis()->SetBinLabel(3,"AliAODTrack - ID=0");
791  fDaughterClass->GetXaxis()->SetBinLabel(4,"AliAODTrack - neg ID");
792  fDaughterClass->GetXaxis()->SetBinLabel(5,"AliAODTrack - different ID");
793  fDaughterClass->GetXaxis()->SetBinLabel(6,"AliAODRecoDecayHF2Prong");
794  fDaughterClass->GetXaxis()->SetBinLabel(7,"AliAODRecoDecayHF3Prong");
795  fDaughterClass->GetXaxis()->SetBinLabel(8,"AliAODRecoCascadeHF");
796  fDaughterClass->GetXaxis()->SetBinLabel(9,"Other");
797  fDeltaID = new TH1F("hDeltaID"," ; GetDaughter->GetID() - GetProngID()",20001,-10000.5,10000.5);
798  if(fSystem==0){
799  fIDDauVsIDTra = new TH2F("hIDDauVsIDTra"," ; GetProngID() ; GetDaughter->GetID()",1001,-500.5,500.5,1001,-500.5,500.5);
800  }else{
801  fIDDauVsIDTra = new TH2F("hIDDauVsIDTra"," ; GetProngID() ; GetDaughter->GetID()",1000,-30000,30000,1000,-30000,30000);
802  }
803  fOutput->Add(fDaughterClass);
804  fOutput->Add(fDeltaID);
805  fOutput->Add(fIDDauVsIDTra);
806 
807  //Counter for Normalization
808  TString normName="NormalizationCounter";
809  AliAnalysisDataContainer *cont = GetOutputSlot(3)->GetContainer();
810  if(cont)normName=(TString)cont->GetName();
811  fCounter = new AliNormalizationCounter(normName.Data());
812  fCounter->Init();
813 
819 
820  PostData(1,fOutput);
821 
822  if(fFillNtuple==1){
823  OpenFile(4); // 4 is the slot number of the ntuple
824 
825 
826  fNtupleDplus = new TNtuple("fNtupleDplus","D +","pdg:Px:Py:Pz:Pt:charge:piddau0:piddau1:piddau2:Ptpi:PtK:Ptpi2:mompi:momK:mompi2:cosp:cospxy:DecLen:NormDecLen:DecLenXY:NormDecLenXY:InvMass:sigvert:d0Pi:d0K:d0Pi2:maxdca:ntracks:centr:RunNumber:BadDau");
827 
828  }
829 
830  if(fFillNtuple==2){
831  OpenFile(4); // 4 is the slot number of the ntuple
832 
833 
834  fNtupleDplus = new TNtuple("fNtupleDplus","D +","pdg:Pt:InvMass:d0:origin");
835 
836  }
837 
838  return;
839 }
840 
841 //________________________________________________________________________
843 {
846 
847  AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
848 
849  fHistNEvents->Fill(0); // count event
850 
851  if(fAODProtection>=0){
852  // Protection against different number of events in the AOD and deltaAOD
853  // In case of discrepancy the event is rejected.
854  Int_t matchingAODdeltaAODlevel = AliRDHFCuts::CheckMatchingAODdeltaAODevents();
855  if (matchingAODdeltaAODlevel<0 || (matchingAODdeltaAODlevel==0 && fAODProtection==1)) {
856  // AOD/deltaAOD trees have different number of entries || TProcessID do not match while it was required
857  fHistNEvents->Fill(1);
858  return;
859  }
860  }
861 
862  TClonesArray *array3Prong = 0;
863  TClonesArray *arrayLikeSign =0;
864  if(!aod && AODEvent() && IsStandardAOD()) {
865  // In case there is an AOD handler writing a standard AOD, use the AOD
866  // event in memory rather than the input (ESD) event.
867  aod = dynamic_cast<AliAODEvent*> (AODEvent());
868  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
869  // have to taken from the AOD event hold by the AliAODExtension
870  AliAODHandler* aodHandler = (AliAODHandler*)
871  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
872  if(aodHandler->GetExtensions()) {
873  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
874  AliAODEvent *aodFromExt = ext->GetAOD();
875  array3Prong=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
876  arrayLikeSign=(TClonesArray*)aodFromExt->GetList()->FindObject("LikeSign3Prong");
877  }
878  } else if(aod) {
879  array3Prong=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
880  arrayLikeSign=(TClonesArray*)aod->GetList()->FindObject("LikeSign3Prong");
881  }
882 
883  if(!aod || !array3Prong) {
884  printf("AliAnalysisTaskSEDplus::UserExec: Charm3Prong branch not found!\n");
885  return;
886  }
887  if(!arrayLikeSign && fDoLS) {
888  printf("AliAnalysisTaskSEDplus::UserExec: LikeSign3Prong branch not found!\n");
889  return;
890  }
891 
892  // fix for temporary bug in ESDfilter
893  // the AODs with null vertex pointer didn't pass the PhysSel
894  if(!aod->GetPrimaryVertex()||TMath::Abs(aod->GetMagneticField())<0.001) return;
895 
896  //Store the event in AliNormalizationCounter->To disable for Pb-Pb? Add a flag to disable it?
898 
899  fHistNEvents->Fill(2);
900 
901  Int_t runNumber=aod->GetRunNumber();
902 
903  //Event selection
904  Bool_t isEvSel=fRDCutsAnalysis->IsEventSelected(aod);
905  Float_t ntracks=aod->GetNumberOfTracks();
907  Float_t evCentr=0;
909  fHistCentrality[0]->Fill(ntracks,evCentr);
910  if(fRDCutsAnalysis->GetWhyRejection()==5) fHistNEvents->Fill(3);
911  if(!isEvSel && fRDCutsAnalysis->GetWhyRejection()==0) fHistNEvents->Fill(4);
912  if(fRDCutsAnalysis->GetWhyRejection()==1) fHistNEvents->Fill(5);
913  if(fRDCutsAnalysis->GetWhyRejection()==2){fHistNEvents->Fill(6);fHistCentrality[2]->Fill(ntracks,evCentr);}
914  if(fRDCutsAnalysis->GetWhyRejection()==6)fHistNEvents->Fill(7);
915  if(fRDCutsAnalysis->GetWhyRejection()==7)fHistNEvents->Fill(8);
916 
917  TClonesArray *arrayMC=0;
918  AliAODMCHeader *mcHeader=0;
919  // load MC particles
920  if(fReadMC){
921  arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
922  if(!arrayMC) {
923  printf("AliAnalysisTaskSEDplus::UserExec: MC particles branch not found!\n");
924  return;
925  }
926 
927  // load MC header
928  mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
929  if(!mcHeader) {
930  printf("AliAnalysisTaskSEDplus::UserExec: MC header branch not found!\n");
931  return;
932  }
933  }
934  if(fReadMC && fStepMCAcc){
935  if(aod->GetTriggerMask()==0 &&
936  (runNumber>=195344 && runNumber<=195677)){
937  // protection for events with empty trigger mask in p-Pb
938  return;
939  }
941  // events not passing the centrality selection can be removed immediately.
942 
943  FillMCAcceptanceHistos(arrayMC, mcHeader, tracklets);
944  }
945  // trigger class for PbPb C0SMH-B-NOPF-ALLNOTRD
946  //TString trigclass=aod->GetFiredTriggerClasses();
947  // Post the data already here
948  PostData(1,fOutput);
949  if(!isEvSel)return;
950  // printf("ntracklet===%d\n",tracklets);
951  if(fCutOnTrckl && (tracklets<fNtrcklMin || tracklets>fNtrcklMax)) {return;}
952  fSPDMult->Fill(tracklets);
953 
954  fHistCentrality[1]->Fill(ntracks,evCentr);
955  fHistNEvents->Fill(9);
956 
957  // AOD primary vertex
958  AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
959  // vtx1->Print();
960  // TString primTitle = vtx1->GetTitle();
961  //if(primTitle.Contains("VertexerTracks") && vtx1->GetNContributors()>0)fHistNEvents->Fill(2);
962 
963 
964  Int_t n3Prong = array3Prong->GetEntriesFast();
965  // printf("Number of D+->Kpipi: %d and of tracks: %d\n",n3Prong,aod->GetNumberOfTracks());
966 
967  Int_t nOS=0;
968  Int_t index;
969  Int_t pdgDgDplustoKpipi[3]={321,211,211};
970 
971  // vHF object is needed to call the method that refills the missing info of the candidates
972  // if they have been deleted in dAOD reconstruction phase
973  // in order to reduce the size of the file
975  if(fDoLS>1){//Normalizations for LS
976  for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
977  AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
980  }
981  }
982  }else{//Standard analysis
983  // Double_t cutsDplus[12]={0.2,0.4,0.4,0.,0.,0.01,0.06,0.02,0.,0.85,0.,10000000000.};//TO REMOVE
984  //Double_t *cutsDplus = new (Double_t*)fRDCuts->GetCuts();
985  Int_t nSelectednopid=0,nSelected=0;
986  for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
987  AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
988  fHistNCandidates->Fill(0);
990  continue;
991  }
992  fHistNCandidates->Fill(1);
993 
994  TObjArray arrTracks(3);
995  for(Int_t jdau=0; jdau<3; jdau++){
996  AliAODTrack *tr=vHF->GetProng(aod,d,jdau);
997  arrTracks.AddAt(tr,jdau);
998  }
999  if(!fRDCutsAnalysis->PreSelect(arrTracks)){
1000  fHistNCandidates->Fill(6);
1001  continue;
1002  }
1003 
1004  if(!(vHF->FillRecoCand(aod,d))) { //Fill the data members of the candidate only if they are empty.
1005  fHistNCandidates->Fill(2); //monitor how often this fails
1006  continue;
1007  }
1008 
1009  Bool_t goodDaus=kTRUE;
1010  for(Int_t jdau=0; jdau<3; jdau++){
1011  Int_t idStored=d->GetProngID(jdau);
1012  TObject* odau=(TObject*)d->GetDaughter(jdau);
1013  TString cname=odau->ClassName();
1014  if(cname.Contains("AliAODTrack")){
1015  AliAODTrack* tr=(AliAODTrack*)d->GetDaughter(jdau);
1016  if(tr->Charge()==0){
1017  fDaughterClass->Fill(1);
1018  goodDaus=kFALSE;
1019  }
1020  Int_t idRecov=tr->GetID();
1021  Int_t dId=idRecov-idStored;
1022  fIDDauVsIDTra->Fill(idStored,idRecov);
1023  fDeltaID->Fill(dId);
1024  if(dId!=0){
1025  goodDaus=kFALSE;
1026  fDaughterClass->Fill(4);
1027  }else{
1028  if(idStored>0) fDaughterClass->Fill(0);
1029  else if(idStored==0) fDaughterClass->Fill(2);
1030  else{
1031  goodDaus=kFALSE;
1032  fDaughterClass->Fill(3);
1033  }
1034  }
1035  }else if(cname.Contains("AliAODRecoDecayHF2")){
1036  fDaughterClass->Fill(5);
1037  goodDaus=kFALSE;
1038  }else if(cname.Contains("AliAODRecoDecayHF3")){
1039  fDaughterClass->Fill(6);
1040  goodDaus=kFALSE;
1041  }else if(cname.Contains("AliAODRecoCascadeHF")){
1042  fDaughterClass->Fill(7);
1043  goodDaus=kFALSE;
1044  }else{
1045  fDaughterClass->Fill(8);
1046  goodDaus=kFALSE;
1047  }
1048  }
1049  Double_t ptCand = d->Pt();
1050  Double_t invMass=d->InvMassDplus();
1051  if(goodDaus) fPtVsMassGoodDaus->Fill(invMass,ptCand);
1052  else fPtVsMassBadDaus->Fill(invMass,ptCand);
1053 
1054  Int_t passTopolAndPIDCuts=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kAll,aod);
1055  Bool_t passSingleTrackCuts=kTRUE;
1056  if(fRDCutsAnalysis->GetIsSelectedCuts() && fRDCutsAnalysis->GetIsSelectedPID() && !passTopolAndPIDCuts) passSingleTrackCuts=kFALSE;
1057 
1058  if(!fRDCutsAnalysis->GetIsSelectedCuts()) continue;
1059  fHistNCandidates->Fill(3);
1060  if(!passSingleTrackCuts) continue;
1061  fHistNCandidates->Fill(4);
1062  if(passTopolAndPIDCuts) fHistNCandidates->Fill(5);
1063 
1064  Double_t etaD=d->Eta();
1065  Double_t phiD=d->Phi();
1066  if(fEtaSelection!=0){
1067  if(fEtaSelection==1 && etaD<0) continue;
1068  if(fEtaSelection==-1 && etaD>0) continue;
1069  }
1070 
1071  Bool_t unsetvtx=kFALSE;
1072  if(!d->GetOwnPrimaryVtx()){
1073  d->SetOwnPrimaryVtx(vtx1);
1074  unsetvtx=kTRUE;
1075  }
1076 
1077  Int_t iPtBin = fRDCutsAnalysis->PtBin(ptCand);
1078 
1079  Bool_t recVtx=kFALSE;
1080  AliAODVertex *origownvtx=0x0;
1082  if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
1083  if(fRDCutsAnalysis->RecalcOwnPrimaryVtx(d,aod))recVtx=kTRUE;
1084  else fRDCutsAnalysis->CleanOwnPrimaryVtx(d,aod,origownvtx);
1085  }
1086 
1087  Int_t labDp=-1;
1088  Bool_t isPrimary=kFALSE;
1089  Bool_t isFeeddown=kFALSE;
1090  Float_t pdgCode=-2;
1091  Float_t trueImpParXY=0.;
1092  Double_t ptB=-1.5;
1093  if(fReadMC){
1094  labDp = d->MatchToMC(411,arrayMC,3,pdgDgDplustoKpipi);
1095  if(labDp>=0){
1096  AliAODMCParticle *partDp = (AliAODMCParticle*)arrayMC->At(labDp);
1097  Int_t orig=AliVertexingHFUtils::CheckOrigin(arrayMC,partDp,fUseQuarkTagInKine);//Prompt = 4, FeedDown = 5
1098  pdgCode=TMath::Abs(partDp->GetPdgCode());
1099  if(orig==4){
1100  isPrimary=kTRUE;
1101  isFeeddown=kFALSE;
1102  }else if(orig==5){
1103  isPrimary=kFALSE;
1104  isFeeddown=kTRUE;
1105  trueImpParXY=GetTrueImpactParameter(mcHeader,arrayMC,partDp)*10000.;
1106  ptB=AliVertexingHFUtils::GetBeautyMotherPt(arrayMC,partDp);
1107  }else{
1108  pdgCode=-3;
1109  }
1110  }else{
1111  pdgCode=-1;
1112  }
1113  }
1114 
1115  Double_t rapid=d->YDplus();
1116  fYVsPtNoPid->Fill(ptCand,rapid,invMass);
1117  if(passTopolAndPIDCuts) {
1118  fYVsPt->Fill(ptCand,rapid,invMass);
1119  nOS++;
1120  }
1121  if(fReadMC && labDp>=0){
1122  fYVsPtSigNoPid->Fill(ptCand,rapid, invMass);
1123  if(passTopolAndPIDCuts)fYVsPtSig->Fill(ptCand,rapid, invMass);
1124  }
1125 
1126  Bool_t isFidAcc=fRDCutsAnalysis->IsInFiducialAcceptance(ptCand,rapid);
1127  if(isFidAcc){
1128 
1129  Double_t minPtDau=999.,ptmax=0,maxdca=0,sigvert=0,sumD02=0;
1130  Double_t dlen=0,cosp=0,dlenxy=0,cospxy=0, ndlenxy=0, dd0max=0;
1132  dlen=d->DecayLength();
1133  cosp=d->CosPointingAngle();
1134  sumD02=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
1135  maxdca=-9999.;
1136  for(Int_t idau=0;idau<3;idau++) if(d->GetDCA(idau)>maxdca) maxdca=d->GetDCA(idau);
1137  sigvert=d->GetSigmaVert();
1138  ptmax=0;
1139  dlenxy = d->DecayLengthXY();
1140  ndlenxy=d->NormalizedDecayLengthXY();
1141  cospxy=d->CosPointingAngleXY();
1142  for(Int_t i=0; i<3; i++) {
1143  if(d->PtProng(i)>ptmax)ptmax=d->PtProng(i);
1144  if(d->PtProng(i)<minPtDau) minPtDau=d->PtProng(i);
1145  Double_t diffIP, errdiffIP;
1146  d->Getd0MeasMinusExpProng(i,aod->GetMagneticField(),diffIP,errdiffIP);
1147  Double_t normdd0= diffIP/errdiffIP;
1148  if(i==0) dd0max=normdd0;
1149  else if(TMath::Abs(normdd0)>TMath::Abs(dd0max)) dd0max=normdd0;
1150  }
1151  }
1152  Double_t impparXY=d->ImpParXY()*10000.;
1153  Double_t resSel=0;
1154  if(fRDCutsAnalysis->GetIsSelectedCuts()) resSel=1;
1155  if(passTopolAndPIDCuts) resSel=2;
1156  if(fSystem==1) dd0max = TMath::Abs(dd0max);
1157 
1158  //for all THnSparses except for FD
1159  Double_t arrayForSparse[kVarForSparse]={invMass,ptCand,TMath::Abs(impparXY),resSel,minPtDau,sigvert,cosp,cospxy,dlen,dlenxy,ndlenxy,dd0max,(Double_t)tracklets};
1160  //for THnSparses for FD
1161  Double_t arrayForSparseFD[kVarForSparseFD]={invMass,ptCand,TMath::Abs(impparXY),resSel,minPtDau,sigvert,cosp,cospxy,dlen,dlenxy,ndlenxy,dd0max,(Double_t)tracklets,ptB};
1162 
1163  //for imppar THnSparses
1164  Double_t arrayForImpPar[kVarForImpPar]={invMass,ptCand,impparXY};
1165  //for imppar THnSparse with true FD imppar
1166  Double_t arrayForImpParFDTrue[kVarForImpPar]={invMass,ptCand,trueImpParXY};
1167 
1168  Double_t flagOrigin = 0;
1169 
1170  AliAODTrack *track;
1171  if(fDoTrackVarHist) {
1172  for(int i = 0; i < 3; i++) {
1173  Double_t ptTrack = 0, nCrossedRowsTPC = 0, nClustersTPC = 0, ratioCRowsFClu = 0, isSig = 0;
1174  track = (AliAODTrack*)d->GetDaughter(i);
1175  AliESDtrack esdTrack(track);
1176  esdTrack.SetTPCClusterMap(track->GetTPCClusterMap());
1177  esdTrack.SetTPCSharedMap(track->GetTPCSharedMap());
1178  esdTrack.SetTPCPointsF(track->GetTPCNclsF());
1179  ptTrack = track->Pt();
1180  nCrossedRowsTPC = esdTrack.GetTPCCrossedRows();
1181  nClustersTPC = esdTrack.GetTPCNcls();
1182  if(esdTrack.GetTPCNclsF()>0) {
1183  ratioCRowsFClu = nCrossedRowsTPC / esdTrack.GetTPCNclsF();
1184  if(labDp>=0){
1185  if(isPrimary) isSig = 1.;
1186  else if(isFeeddown) isSig = 2.;
1187  }
1188  }
1189  Double_t arrayForTrackSparse[kVarForTrackSparse]={ptCand,invMass,ptTrack,nClustersTPC,nCrossedRowsTPC,ratioCRowsFClu,isSig};
1190  if(passTopolAndPIDCuts){
1191  if(fDoTrackVarHist) fHistTrackVar->Fill(arrayForTrackSparse);
1192  }
1193  }
1194  }
1195 
1196  //Fill histos
1197  index=GetHistoIndex(iPtBin);
1198  nSelectednopid++;
1199  fPtVsMassNoPid->Fill(invMass,ptCand);
1200  fMassHistNoPid[index]->Fill(invMass);
1201  if(fDoImpPar && passTopolAndPIDCuts){
1202  fHistMassPtImpPar[0]->Fill(arrayForImpPar);
1203  }
1204  if(fDoSparse){
1205  fSparseCutVars[0]->Fill(arrayForSparse);
1206  }
1207  if(passTopolAndPIDCuts){
1208  nSelected++;
1209  fPtVsMass->Fill(invMass,ptCand);
1210  fMassHist[index]->Fill(invMass);
1211  if(d->GetCharge()>0){
1212  fPtVsMassPlus->Fill(invMass,ptCand);
1213  fMassHistPlus[index]->Fill(invMass);
1214  }
1215  else if(d->GetCharge()<0){
1216  fPtVsMassMinus->Fill(invMass,ptCand);
1217  fMassHistMinus[index]->Fill(invMass);
1218  }
1219  fPhiEtaCand->Fill(etaD,phiD);
1220  if(TMath::Abs(invMass-1.8696)<0.05) fPhiEtaCandSigReg->Fill(etaD,phiD);
1221  if(fCutsDistr){
1222  fCosPHist[index]->Fill(cosp);
1223  fDLenHist[index]->Fill(dlen);
1224  fSumd02Hist[index]->Fill(sumD02);
1225  fSigVertHist[index]->Fill(sigvert);
1226  fPtMaxHist[index]->Fill(ptmax);
1227  fPtKHist[index]->Fill(d->PtProng(1));
1228  fPtpi1Hist[index]->Fill(d->PtProng(0));
1229  fPtpi2Hist[index]->Fill(d->PtProng(2));
1230  fDCAHist[index]->Fill(maxdca);
1231  fDLxy[index]->Fill(ndlenxy);
1232  fCosxy[index]->Fill(cospxy);
1233  fCorreld0Kd0pi[0]->Fill(d->Getd0Prong(0)*d->Getd0Prong(1),d->Getd0Prong(2)*d->Getd0Prong(1));
1234  }
1235  }
1236 
1237  // fill ntuple
1238  if(fFillNtuple==1){
1239 
1240  Float_t tmp[31];
1241 
1242  tmp[0]=pdgCode;
1243  if(isFeeddown) tmp[0]+=5000.;
1244  tmp[1]=d->Px();
1245  tmp[2]=d->Py();
1246  tmp[3]=d->Pz();
1247  tmp[4]=d->Pt();
1248  tmp[5]=d->GetCharge();
1249  // tmp[5]=fRDCutsAnalysis->GetPIDBitMask(d);
1250  tmp[6]=fRDCutsAnalysis->GetPIDTrackTPCTOFBitMap((AliAODTrack*)d->GetDaughter(0));
1251  tmp[7]=fRDCutsAnalysis->GetPIDTrackTPCTOFBitMap((AliAODTrack*)d->GetDaughter(1));
1252  tmp[8]=fRDCutsAnalysis->GetPIDTrackTPCTOFBitMap((AliAODTrack*)d->GetDaughter(2));
1253  tmp[9]=d->PtProng(0);
1254  tmp[10]=d->PtProng(1);
1255  tmp[11]=d->PtProng(2);
1256  tmp[12]=d->PProng(0);
1257  tmp[13]=d->PProng(1);
1258  tmp[14]=d->PProng(2);
1259  tmp[15]=cosp;
1260  tmp[16]=cospxy;
1261  tmp[17]=dlen;
1262  tmp[18]=d->NormalizedDecayLength();
1263  tmp[19]=dlenxy;
1264  tmp[20]=ndlenxy;
1265  tmp[21]=d->InvMassDplus();
1266  tmp[22]=sigvert;
1267  tmp[23]=d->Getd0Prong(0);
1268  tmp[24]=d->Getd0Prong(1);
1269  tmp[25]=d->Getd0Prong(2);
1270  tmp[26]=maxdca;
1271  tmp[27]=ntracks;
1272  tmp[28]=fRDCutsAnalysis->GetCentrality(aod);
1273  tmp[29]=runNumber;
1274  tmp[30]=d->HasBadDaughters();
1275  fNtupleDplus->Fill(tmp);
1276  PostData(4,fNtupleDplus);
1277  }
1278 
1279  if(fFillNtuple==2 && passTopolAndPIDCuts){
1280  Float_t tmp[5];
1281  tmp[0]=pdgCode;
1282  if(isFeeddown) tmp[0]+=5000.;
1283  tmp[1]=d->Pt();
1284  tmp[2]=d->InvMassDplus();
1285  tmp[3]=impparXY;
1286  if(!fReadMC){flagOrigin=0;};
1287  if(fReadMC){
1288  if(isPrimary&&labDp>=0)flagOrigin=1;
1289  if(isFeeddown&&labDp>=0)flagOrigin=2;
1290  if(!(labDp>=0))flagOrigin=3;
1291 
1292  }
1293 
1294  tmp[4]=flagOrigin;
1295  fNtupleDplus->Fill(tmp);
1296  PostData(4,fNtupleDplus);
1297  }
1298 
1299  if(fReadMC){
1300  if(labDp>=0) {
1301  index=GetSignalHistoIndex(iPtBin);
1302  if(fDoImpPar && passTopolAndPIDCuts){
1303  if(isPrimary) fHistMassPtImpPar[1]->Fill(arrayForImpPar);
1304  else if(isFeeddown){
1305  fHistMassPtImpPar[2]->Fill(arrayForImpPar);
1306  fHistMassPtImpPar[3]->Fill(arrayForImpParFDTrue);
1307  }
1308  }
1309  if(fDoSparse){
1310  if(isPrimary) fSparseCutVars[1]->Fill(arrayForSparse);
1311  else if(isFeeddown){
1312  fSparseCutVars[2]->Fill(arrayForSparseFD);
1313  }
1314  }
1315  }else{
1316  index=GetBackgroundHistoIndex(iPtBin);
1317  if(fDoImpPar && passTopolAndPIDCuts)fHistMassPtImpPar[4]->Fill(arrayForImpPar);
1318  }
1319  fMassHistNoPid[index]->Fill(invMass);
1320  if(passTopolAndPIDCuts){
1321  if(fCutsDistr){
1322  Float_t fact=1.;
1323  Float_t factor[3]={1.,1.,1.};
1324  if(fUseStrangeness) fact=GetStrangenessWeights(d,arrayMC,factor);
1325  fCosPHist[index]->Fill(cosp,fact);
1326  fDLenHist[index]->Fill(dlen,fact);
1327  fDLxy[index]->Fill(ndlenxy);
1328  fCosxy[index]->Fill(cospxy);
1329  Float_t sumd02s=d->Getd0Prong(0)*d->Getd0Prong(0)*factor[0]*factor[0]+d->Getd0Prong(1)*d->Getd0Prong(1)*factor[1]*factor[1]+d->Getd0Prong(2)*d->Getd0Prong(2)*factor[2]*factor[2];
1330  fSumd02Hist[index]->Fill(sumd02s);
1331  fSigVertHist[index]->Fill(sigvert,fact);
1332  fPtMaxHist[index]->Fill(ptmax,fact);
1333  fPtKHist[index]->Fill(d->PtProng(1),fact);
1334  fPtpi1Hist[index]->Fill(d->PtProng(0),fact);
1335  fPtpi2Hist[index]->Fill(d->PtProng(2),fact);
1336  fDCAHist[index]->Fill(maxdca,fact);
1337  fCorreld0Kd0pi[1]->Fill(d->Getd0Prong(0)*d->Getd0Prong(1),d->Getd0Prong(2)*d->Getd0Prong(1));
1338  }
1339  fMassHist[index]->Fill(invMass);
1340  if(d->GetCharge()>0) fMassHistPlus[index]->Fill(invMass);
1341  else if(d->GetCharge()<0) fMassHistMinus[index]->Fill(invMass);
1342  }
1343  }
1344  }
1345 
1346  if(recVtx)fRDCutsAnalysis->CleanOwnPrimaryVtx(d,aod,origownvtx);
1347 
1348  if(unsetvtx) d->UnsetOwnPrimaryVtx();
1349  }
1350  fCounter->StoreCandidates(aod,nSelectednopid,kTRUE);
1351  fCounter->StoreCandidates(aod,nSelected,kFALSE);
1352  }
1353  delete vHF;
1354  //start LS analysis
1355  if(fDoLS && arrayLikeSign) LSAnalysis(array3Prong,arrayLikeSign,aod,vtx1,nOS);
1356 
1357  PostData(1,fOutput);
1358  PostData(2,fListCuts);
1359  PostData(3,fCounter);
1360  return;
1361 }
1362 
1363 //________________________________________________________________________
1366 
1367  TString hisname;
1368  Int_t indexLS=0;
1369  Int_t index=0;
1371 
1372  fMassHistLS = new TH1F*[5*fNPtBins];
1373  fCosPHistLS = new TH1F*[3*fNPtBins];
1374  fDLenHistLS = new TH1F*[3*fNPtBins];
1375  fSumd02HistLS = new TH1F*[3*fNPtBins];
1376  fSigVertHistLS = new TH1F*[3*fNPtBins];
1377  fPtMaxHistLS = new TH1F*[3*fNPtBins];
1378  fDCAHistLS = new TH1F*[3*fNPtBins];
1379 
1380  for(Int_t i=0;i<fNPtBins;i++){
1381 
1382  index=GetHistoIndex(i);
1383  indexLS=GetLSHistoIndex(i);
1384 
1385  hisname.Form("hLSPt%d",i);
1386  fMassHistLS[indexLS] = new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
1387  fMassHistLS[indexLS]->Sumw2();
1388 
1389  hisname.Form("hCosPAllPt%dLS",i);
1390  fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.);
1391  fCosPHistLS[index]->Sumw2();
1392  hisname.Form("hDLenAllPt%dLS",i);
1393  fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5);
1394  fDLenHistLS[index]->Sumw2();
1395  hisname.Form("hSumd02AllPt%dLS",i);
1396  fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.);
1397  fSumd02HistLS[index]->Sumw2();
1398  hisname.Form("hSigVertAllPt%dLS",i);
1399  fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
1400  fSigVertHistLS[index]->Sumw2();
1401  hisname.Form("hPtMaxAllPt%dLS",i);
1402  fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.);
1403  fPtMaxHistLS[index]->Sumw2();
1404  hisname.Form("hDCAAllPt%dLS",i);
1405  fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
1406  fDCAHistLS[index]->Sumw2();
1407 
1408  index=GetSignalHistoIndex(i);
1409  indexLS++;
1410 
1411  hisname.Form("hLSPt%dnw",i);
1412  fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
1413  fMassHistLS[indexLS]->Sumw2();
1414 
1415  hisname.Form("hCosPSigPt%dLS",i);
1416  fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.);
1417  fCosPHistLS[index]->Sumw2();
1418  hisname.Form("hDLenSigPt%dLS",i);
1419  fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5);
1420  fDLenHistLS[index]->Sumw2();
1421  hisname.Form("hSumd02SigPt%dLS",i);
1422  fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.);
1423  fSumd02HistLS[index]->Sumw2();
1424  hisname.Form("hSigVertSigPt%dLS",i);
1425  fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
1426  fSigVertHistLS[index]->Sumw2();
1427  hisname.Form("hPtMaxSigPt%dLS",i);
1428  fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.);
1429  fPtMaxHistLS[index]->Sumw2();
1430  hisname.Form("hDCASigPt%dLS",i);
1431  fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
1432  fDCAHistLS[index]->Sumw2();
1433 
1434  index=GetBackgroundHistoIndex(i);
1435  indexLS++;
1436 
1437  hisname.Form("hLSPt%dLCntrip",i);
1438  fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
1439  fMassHistLS[indexLS]->Sumw2();
1440 
1441  hisname.Form("hCosPBkgPt%dLS",i);
1442  fCosPHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,1.);
1443  fCosPHistLS[index]->Sumw2();
1444  hisname.Form("hDLenBkgPt%dLS",i);
1445  fDLenHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.5);
1446  fDLenHistLS[index]->Sumw2();
1447  hisname.Form("hSumd02BkgPt%dLS",i);
1448  fSumd02HistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,1.);
1449  fSumd02HistLS[index]->Sumw2();
1450  hisname.Form("hSigVertBkgPt%dLS",i);
1451  fSigVertHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
1452  fSigVertHistLS[index]->Sumw2();
1453  hisname.Form("hPtMaxBkgPt%dLS",i);
1454  fPtMaxHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.5,5.);
1455  fPtMaxHistLS[index]->Sumw2();
1456  hisname.Form("hDCABkgPt%dLS",i);
1457  fDCAHistLS[index]=new TH1F(hisname.Data(),hisname.Data(),nbins,0.,0.1);
1458  fDCAHistLS[index]->Sumw2();
1459 
1460  indexLS++;
1461  hisname.Form("hLSPt%dLCntripsinglecut",i);
1462  fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
1463  fMassHistLS[indexLS]->Sumw2();
1464 
1465  indexLS++;
1466  hisname.Form("hLSPt%dspc",i);
1467  fMassHistLS[indexLS]=new TH1F(hisname.Data(),hisname.Data(),nbins,fLowmasslimit,fUpmasslimit);
1468  fMassHistLS[indexLS]->Sumw2();
1469  }
1470 
1471  for(Int_t i=0; i<3*fNPtBins; i++){
1472  fOutput->Add(fCosPHistLS[i]);
1473  fOutput->Add(fDLenHistLS[i]);
1474  fOutput->Add(fSumd02HistLS[i]);
1475  fOutput->Add(fSigVertHistLS[i]);
1476  fOutput->Add(fPtMaxHistLS[i]);
1477  fOutput->Add(fDCAHistLS[i]);
1478  }
1479  for(Int_t i=0; i<5*fNPtBins; i++){
1480  fOutput->Add(fMassHistLS[i]);
1481  }
1482 }
1483 
1484 //________________________________________________________________________
1487 
1488  Int_t nmassbins=GetNBinsHistos();
1489 
1490  Int_t nptbins=80;
1491  Double_t ptmin=0.;
1492  Double_t ptmax=40.;
1493 
1494  //dimensions for THnSparse
1495  TString axTit[kVarForImpPar]={"M_{K#pi#pi} (GeV/c^{2})","p_{T} (GeV/c)","Imp Par (#mum)"};
1496 
1500 
1501  //mass, pt, imppar, PIDsel
1502  //mass, pt, imppar, PIDsel
1503  fHistMassPtImpPar[0]=new THnSparseF("hMassPtImpParAll",
1504  "Mass vs. pt vs.imppar - All",
1505  kVarForImpPar,nbins,xmin,xmax);
1506  fHistMassPtImpPar[1]=new THnSparseF("hMassPtImpParPrompt",
1507  "Mass vs. pt vs.imppar - promptD",
1508  kVarForImpPar,nbins,xmin,xmax);
1509  fHistMassPtImpPar[2]=new THnSparseF("hMassPtImpParBfeed",
1510  "Mass vs. pt vs.imppar - DfromB",
1511  kVarForImpPar,nbins,xmin,xmax);
1512  fHistMassPtImpPar[3]=new THnSparseF("hMassPtImpParTrueBfeed",
1513  "Mass vs. pt vs.true imppar -DfromB",
1514  kVarForImpPar,nbins,xmin,xmax);
1515  fHistMassPtImpPar[4]=new THnSparseF("hMassPtImpParBkg",
1516  "Mass vs. pt vs.imppar - backgr.",
1517  kVarForImpPar,nbins,xmin,xmax);
1518 
1519  for(Int_t i=0; i<5; i++){
1520  for(Int_t iax=0; iax<kVarForImpPar; iax++) fHistMassPtImpPar[i]->GetAxis(iax)->SetTitle(axTit[iax].Data());
1521  fOutput->Add(fHistMassPtImpPar[i]);
1522  }
1523 }
1524 
1525 //________________________________________________________________________
1528 
1529  Int_t nmassbins=GetNBinsHistos();
1530 
1531  Int_t nptbins=80;
1532  Double_t ptmin=0.;
1533  Double_t ptmax=40.;
1534 
1535  Int_t nselbins=2;
1536  Double_t minsel=0.5;
1537  Double_t maxsel=2.5;
1538 
1539  Int_t nnormdlbins=30;
1540  Double_t minnormdl=0.;
1541  Double_t maxnormdl=30.;
1542 
1543  Int_t nmultbins;
1544  Double_t maxmult;
1545  Double_t minmult=-0.5;
1546 
1547  Int_t nd0bins;
1548  Double_t d0min;
1549  Double_t d0max;
1550 
1551  Int_t nptmindaubins;
1552  Double_t minptmindau;
1553  Double_t maxptmindau;
1554 
1555  Int_t nsigvertbins;
1556  Double_t minsigvert;
1557  Double_t maxsigvert;
1558 
1559  Int_t ndeclbins;
1560  Double_t mindecl;
1561  Double_t maxdecl;
1562 
1563  Int_t ndeclxybins;
1564  Double_t mindeclxy;
1565  Double_t maxdeclxy;
1566 
1567  Int_t ncospbins;
1568  Double_t mincosp;
1569  Double_t maxcosp;
1570 
1571  Int_t ncospxybins;
1572  Double_t mincospxy;
1573  Double_t maxcospxy;
1574 
1575  Int_t nd0d0expbins;
1576  Double_t mind0d0;
1577  Double_t maxd0d0;
1578 
1579  if(fSystem==1) {
1580  nd0bins=18;
1581  d0min=0.;
1582  d0max=180;
1583 
1584  nptmindaubins=1;//dummy axis
1585  minptmindau=0.2;
1586  maxptmindau=1.2;
1587 
1588  nsigvertbins=10;
1589  minsigvert=0.012;
1590  maxsigvert=0.032;
1591 
1592  ndeclbins=35;
1593  mindecl=0.;
1594  maxdecl=0.35;
1595 
1596  ndeclxybins=35;
1597  mindeclxy=0.;
1598  maxdeclxy=0.35;
1599 
1600  ncospbins=30;
1601  mincosp=0.97;
1602  maxcosp=1.;
1603 
1604  ncospxybins=30;
1605  mincospxy=0.97;
1606  maxcospxy=1.;
1607 
1608  nd0d0expbins=12;
1609  mind0d0=0.;
1610  maxd0d0=6.;
1611 
1612  maxmult=5000.5;//dummy axis
1613  nmultbins=1;
1614  }
1615  else {
1616  nd0bins=60;
1617  d0min=0.;
1618  d0max=300;
1619 
1620  nptmindaubins=10;
1621  minptmindau=0.2;
1622  maxptmindau=1.2;
1623 
1624  nsigvertbins=25;
1625  minsigvert=0.010;
1626  maxsigvert=0.035;
1627 
1628  ndeclbins=70;
1629  mindecl=0.;
1630  maxdecl=0.70;
1631 
1632  ndeclxybins=70;
1633  mindeclxy=0.;
1634  maxdeclxy=0.70;
1635 
1636  ncospbins=100;
1637  mincosp=0.90;
1638  maxcosp=1.;
1639 
1640  ncospxybins=30;
1641  mincospxy=0.97;
1642  maxcospxy=1.;
1643 
1644  nd0d0expbins=40;
1645  mind0d0=-10.;
1646  maxd0d0=10.;
1647 
1648  maxmult=200.5;
1649  nmultbins = maxmult-minmult;
1650  }
1651 
1652  //dimensions for THnSparse which are NOT for BFeed
1653  TString axTit[kVarForSparse]={"M_{K#pi#pi} (GeV/c^{2})","p_{T} (GeV/c)","Imp Par (#mum)","passTopolPID","min. daughter p_{T} (GeV/c)","sigmaVertex","cos(#theta_{P})","cos(#theta_{P}^{xy})","decL (cm)","decL XY (cm)","Norm decL XY","Norm max d0-d0exp","N_{trkls}"};
1654 
1655  Int_t nbins[kVarForSparse]={nmassbins,nptbins,nd0bins,nselbins,nptmindaubins,nsigvertbins,ncospbins,ncospxybins,ndeclbins,ndeclxybins,nnormdlbins,nd0d0expbins,nmultbins};
1656  Double_t xmin[kVarForSparse]={fLowmasslimit,ptmin,d0min,minsel,minptmindau,minsigvert,mincosp,mincospxy,mindecl,mindeclxy,minnormdl,mind0d0,minmult};
1657  Double_t xmax[kVarForSparse]={fUpmasslimit,ptmax,d0max,maxsel,maxptmindau,maxsigvert,maxcosp,maxcospxy,maxdecl,maxdeclxy,maxnormdl,maxd0d0,maxmult};
1658 
1659  //dimensions for THnSparse for BFeed
1660  Int_t nbinsFD[kVarForSparseFD]={nmassbins,nptbins,nd0bins,nselbins,nptmindaubins,nsigvertbins,ncospbins,ncospxybins,ndeclbins,ndeclbins,nnormdlbins,nd0d0expbins,nmultbins,84};
1661  Double_t xminFD[kVarForSparseFD]={fLowmasslimit,ptmin,d0min,minsel,minptmindau,minsigvert,mincosp,mincospxy,mindecl,mindeclxy,minnormdl,mind0d0,minmult,-2};
1662  Double_t xmaxFD[kVarForSparseFD]={fUpmasslimit,ptmax,d0max,maxsel,maxptmindau,maxsigvert,maxcosp,maxcospxy,maxdecl,maxdeclxy,maxnormdl,maxd0d0,maxmult,40};
1663 
1664  //mass, pt, imppar, cosPoinXY, decLXY, norm decLXY (for BFeed also ptB)
1665  fSparseCutVars[0]=new THnSparseF("hMassPtCutVarsAll",
1666  "Mass vs. pt vs. cut vars - All",
1667  kVarForSparse,nbins,xmin,xmax);
1668  fSparseCutVars[1]=new THnSparseF("hMassPtCutVarsPrompt",
1669  "Mass vs. pt vs. cut vars - promptD",
1670  kVarForSparse,nbins,xmin,xmax);
1671  fSparseCutVars[2]=new THnSparseF("hMassPtCutVarsBfeed",
1672  "Mass vs. pt vs. cut vars - DfromB",
1673  kVarForSparseFD,nbinsFD,xminFD,xmaxFD);
1674 
1675  for(Int_t i=0; i<3; i++){
1676  for(Int_t iax=0; iax<kVarForSparse; iax++) fSparseCutVars[i]->GetAxis(iax)->SetTitle(axTit[iax].Data());
1677  if(i == 2 || i == 3) fSparseCutVars[i]->GetAxis(kVarForSparseFD-1)->SetTitle("p_{T}^{B} (GeV/c)");
1678  fOutput->Add(fSparseCutVars[i]);
1679  }
1680 }
1681 
1682 //________________________________________________________________________
1685 
1686  Int_t nmassbins = GetNBinsHistos();
1687 
1688  Int_t nbins[kVarForTrackSparse] = {40,nmassbins,50,170,170,100,3};
1689  Double_t xmin[kVarForTrackSparse] = {0.,fLowmasslimit,0.,0.5,0.5,0.,-0.5};
1690  Double_t xmax[kVarForTrackSparse] = {40.,fUpmasslimit,5.,170.5,170.5,1.,2.5};
1691 
1692  //pt, y
1693  fHistTrackVar = new THnSparseF("hHistTrackVar","hHistTrackVar",kVarForTrackSparse,nbins,xmin,xmax);
1694  fHistTrackVar->GetAxis(0)->SetTitle("D^{+} p_{T} (GeV/c)");
1695  fHistTrackVar->GetAxis(1)->SetTitle("k#pi#pi inv. mass (GeV/c^{2})");
1696  fHistTrackVar->GetAxis(2)->SetTitle("track p_{T} (GeV/c)");
1697  fHistTrackVar->GetAxis(3)->SetTitle("N TPC clusters");
1698  fHistTrackVar->GetAxis(4)->SetTitle("N TPC cross. rows");
1699  fHistTrackVar->GetAxis(5)->SetTitle("TPC clust./cross.rows");
1700  fHistTrackVar->GetAxis(6)->SetTitle("Bkg = 0, Signal = 1");
1701 
1702  fOutput->Add(fHistTrackVar);
1703 }
1704 
1705 
1706 //________________________________________________________________________
1709 
1710  const Int_t nVarPrompt = 3;
1711  const Int_t nVarFD = 4;
1712 
1713  Double_t multmin=-0.5;
1714  Double_t multmax;
1715  Int_t nmultbins;
1716  if(fSystem==0) {
1717  multmax=200.5;
1718  nmultbins=multmax-multmin;
1719  }
1720  else {
1721  multmax=5000.5;
1722  nmultbins=1;
1723  }
1724 
1725  Int_t nbinsPrompt[nVarPrompt]={200,100,nmultbins};
1726  Int_t nbinsFD[nVarFD]={200,100,nmultbins,200};
1727 
1728  Double_t xminPrompt[nVarPrompt] = {0.,-1.,multmin};
1729  Double_t xmaxPrompt[nVarPrompt] = {40.,1.,multmax};
1730 
1731  Double_t xminFD[nVarFD] = {0.,-1.,multmin,0.};
1732  Double_t xmaxFD[nVarFD] = {40.,1.,multmax,40.};
1733 
1734  //pt, y
1735  fMCAccPrompt = new THnSparseF("hMCAccPrompt","kStepMCAcceptance pt vs. y vs. Ntracklets - promptD",nVarPrompt,nbinsPrompt,xminPrompt,xmaxPrompt);
1736  fMCAccPrompt->GetAxis(0)->SetTitle("p_{T} (GeV/c)");
1737  fMCAccPrompt->GetAxis(1)->SetTitle("y");
1738  fMCAccPrompt->GetAxis(2)->SetTitle("N_{trklts}");
1739 
1740  //pt,y,ptB
1741  fMCAccBFeed = new THnSparseF("hMCAccBFeed","kStepMCAcceptance pt vs. y vs. Ntracklets vs. ptB - DfromB",nVarFD,nbinsFD,xminFD,xmaxFD);
1742  fMCAccBFeed->GetAxis(0)->SetTitle("p_{T} (GeV/c)");
1743  fMCAccBFeed->GetAxis(1)->SetTitle("y");
1744  fMCAccBFeed->GetAxis(2)->SetTitle("N_{trklts}");
1745  fMCAccBFeed->GetAxis(3)->SetTitle("p_{T}^{B} (GeV/c)");
1746 
1747  fOutput->Add(fMCAccPrompt);
1748  fOutput->Add(fMCAccBFeed);
1749 }
1750 
1751 //________________________________________________________________________
1752 void AliAnalysisTaskSEDplus::FillMCAcceptanceHistos(TClonesArray *arrayMC, AliAODMCHeader *mcHeader, Int_t tracklets){
1754 
1755  const Int_t nProng = 3;
1756 
1757  Double_t zMCVertex = mcHeader->GetVtxZ(); //vertex MC
1758 
1759  for(Int_t iPart=0; iPart<arrayMC->GetEntriesFast(); iPart++){
1760  AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(arrayMC->At(iPart));
1761  if (TMath::Abs(mcPart->GetPdgCode()) == 411){
1762 
1763  Int_t orig=AliVertexingHFUtils::CheckOrigin(arrayMC,mcPart,fUseQuarkTagInKine);//Prompt = 4, FeedDown = 5
1764 
1765  Int_t deca = 0;
1766  Bool_t isGoodDecay=kFALSE;
1767  Int_t labDau[4]={-1,-1,-1,-1};
1768  Bool_t isInAcc = kFALSE;
1769  Bool_t isFidAcc = kFALSE;
1770 
1771  deca=AliVertexingHFUtils::CheckDplusDecay(arrayMC,mcPart,labDau);
1772  if(deca > 0) isGoodDecay=kTRUE;
1773 
1774  if(labDau[0]==-1){
1775  continue; //protection against unfilled array of labels
1776  }
1777 
1778  isFidAcc=fRDCutsAnalysis->IsInFiducialAcceptance(mcPart->Pt(),mcPart->Y());
1779  isInAcc=CheckAcc(arrayMC,nProng,labDau);
1780 
1781  if(isGoodDecay && TMath::Abs(zMCVertex) < fRDCutsAnalysis->GetMaxVtxZ() && isFidAcc && isInAcc) {
1782  //for prompt
1783  if(orig == 4){
1784  //fill histo for prompt
1785  Double_t arrayMCprompt[3] = {mcPart->Pt(),mcPart->Y(),(Double_t)tracklets};
1786  fMCAccPrompt->Fill(arrayMCprompt);
1787  }
1788  //for FD
1789  else if(orig == 5){
1790  Double_t ptB = AliVertexingHFUtils::GetBeautyMotherPt(arrayMC,mcPart);
1791  //fill histo for FD
1792  Double_t arrayMCFD[4] = {mcPart->Pt(),mcPart->Y(),(Double_t)tracklets,ptB};
1793  fMCAccBFeed->Fill(arrayMCFD);
1794  }
1795  else
1796  continue;
1797  }
1798  }
1799  }
1800 }
1801 
1802 //________________________________________________________________________
1804 {
1806  //
1807  if(fDebug > 1) printf("AnalysisTaskSEDplus: Terminate() \n");
1808 
1809  fOutput = dynamic_cast<TList*> (GetOutputData(1));
1810  if (!fOutput) {
1811  printf("ERROR: fOutput not available\n");
1812  return;
1813  }
1814 
1815  fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents"));
1816  if(fHistNEvents){
1817  printf("Number of analyzed events = %d\n",(Int_t)fHistNEvents->GetBinContent(10));
1818  }else{
1819  printf("ERROR: fHistNEvents not available\n");
1820  return;
1821  }
1822 
1823  return;
1824 }
1825 //_________________________________________________________________________________________________
1826 Float_t AliAnalysisTaskSEDplus::GetTrueImpactParameter(const AliAODMCHeader *mcHeader, TClonesArray* arrayMC, const AliAODMCParticle *partDp) const {
1828 
1829  Double_t vtxTrue[3];
1830  mcHeader->GetVertex(vtxTrue);
1831  Double_t origD[3];
1832  partDp->XvYvZv(origD);
1833  Short_t charge=partDp->Charge();
1834  Double_t pXdauTrue[3],pYdauTrue[3],pZdauTrue[3];
1835  for(Int_t iDau=0; iDau<3; iDau++){
1836  pXdauTrue[iDau]=0.;
1837  pYdauTrue[iDau]=0.;
1838  pZdauTrue[iDau]=0.;
1839  }
1840 
1841  Int_t nDau=partDp->GetNDaughters();
1842  Int_t labelFirstDau = partDp->GetDaughter(0);
1843  if(nDau==3){
1844  for(Int_t iDau=0; iDau<3; iDau++){
1845  Int_t ind = labelFirstDau+iDau;
1846  AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(arrayMC->At(ind));
1847  if(!part){
1848  AliError("Daughter particle not found in MC array");
1849  return 99999.;
1850  }
1851  pXdauTrue[iDau]=part->Px();
1852  pYdauTrue[iDau]=part->Py();
1853  pZdauTrue[iDau]=part->Pz();
1854  }
1855  }else if(nDau==2){
1856  Int_t theDau=0;
1857  for(Int_t iDau=0; iDau<2; iDau++){
1858  Int_t ind = labelFirstDau+iDau;
1859  AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(arrayMC->At(ind));
1860  if(!part){
1861  AliError("Daughter particle not found in MC array");
1862  return 99999.;
1863  }
1864  Int_t pdgCode=TMath::Abs(part->GetPdgCode());
1865  if(pdgCode==211 || pdgCode==321){
1866  pXdauTrue[theDau]=part->Px();
1867  pYdauTrue[theDau]=part->Py();
1868  pZdauTrue[theDau]=part->Pz();
1869  ++theDau;
1870  }else{
1871  Int_t nDauRes=part->GetNDaughters();
1872  if(nDauRes==2){
1873  Int_t labelFirstDauRes = part->GetDaughter(0);
1874  for(Int_t iDauRes=0; iDauRes<2; iDauRes++){
1875  Int_t indDR = labelFirstDauRes+iDauRes;
1876  AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(arrayMC->At(indDR));
1877  if(!partDR){
1878  AliError("Daughter particle not found in MC array");
1879  return 99999.;
1880  }
1881 
1882  Int_t pdgCodeDR=TMath::Abs(partDR->GetPdgCode());
1883  if(pdgCodeDR==211 || pdgCodeDR==321){
1884  pXdauTrue[theDau]=partDR->Px();
1885  pYdauTrue[theDau]=partDR->Py();
1886  pZdauTrue[theDau]=partDR->Pz();
1887  ++theDau;
1888  }
1889  }
1890  }
1891  }
1892  }
1893  if(theDau!=3){
1894  AliError("Wrong number of decay prongs");
1895  return 99999.;
1896  }
1897  }
1898 
1899  Double_t d0dummy[3]={0.,0.,0.};
1900  AliAODRecoDecayHF aodDplusMC(vtxTrue,origD,3,charge,pXdauTrue,pYdauTrue,pZdauTrue,d0dummy);
1901  return aodDplusMC.ImpParXY();
1902 
1903 }
1904 //_________________________________________________________________________________________________
1907 
1908  for(Int_t iprong=0;iprong<3;iprong++){
1909  factor[iprong]=1;
1910  AliAODTrack *trad = (AliAODTrack*)d->GetDaughter(iprong);
1911  Int_t labd= trad->GetLabel();
1912  if(labd>=0){
1913  AliAODMCParticle *dau = (AliAODMCParticle*)arrayMC->At(labd);
1914  if(dau){
1915  Int_t labm = dau->GetMother();
1916  if(labm>=0){
1917  AliAODMCParticle *mot = (AliAODMCParticle*)arrayMC->At(labm);
1918  if(mot){
1919  if(TMath::Abs(mot->GetPdgCode())==310 || TMath::Abs(mot->GetPdgCode())==130 || TMath::Abs(mot->GetPdgCode())==321){ //K0_S, K0_L, K^+-
1920  if(d->PtProng(iprong)<=1)factor[iprong]=1./.7;
1921  else factor[iprong]=1./.6;
1922  // fNentries->Fill(12);
1923  }
1924  if(TMath::Abs(mot->GetPdgCode())==3122) { //Lambda
1925  factor[iprong]=1./0.25;
1926  // fNentries->Fill(13);
1927  }//if 3122
1928  }//if(mot)
1929  }//if labm>0
1930  }//if(dau)
1931  }//if labd>=0
1932  }//prong loop
1933 
1934  Float_t fact=1.;
1935  for(Int_t k=0;k<3;k++)fact=fact*factor[k];
1936  return fact;
1937 
1938 }
1939 
1940 //_________________________________________________________________
1941 Bool_t AliAnalysisTaskSEDplus::CheckAcc(TClonesArray* arrayMC,Int_t nProng, Int_t *labDau){
1943  for (Int_t iProng = 0; iProng<nProng; iProng++){
1944  AliAODMCParticle* mcPartDaughter=dynamic_cast<AliAODMCParticle*>(arrayMC->At(labDau[iProng]));
1945  if(!mcPartDaughter) return kFALSE;
1946  Double_t eta = mcPartDaughter->Eta();
1947  Double_t pt = mcPartDaughter->Pt();
1948  if (TMath::Abs(eta) > 0.9 || pt < 0.1) return kFALSE;
1949  }
1950  return kTRUE;
1951 }
Int_t charge
THnSparseF * fMCAccPrompt
!histo for StepMCAcc for Dplus prompt (pt,y,ptB)
Bool_t fCutOnTrckl
maximum number of tracklets
TH2F * fPhiEtaCand
! hist. with eta/phi distribution of candidates
Double_t NormalizedDecayLengthXY() const
TH1F ** fSigVertHist
!hist. for sigVert (topol+PID)
TH1F ** fSumd02HistLS
!hist. for LS cuts variable 3 (topol+PID)
AliAODTrack * GetProng(AliVEvent *event, AliAODRecoDecayHF *rd, Int_t iprong)
Double_t NormalizedDecayLength() const
void FillMCAcceptanceHistos(TClonesArray *arrayMC, AliAODMCHeader *mcHeader, Int_t tracklets)
Bool_t fUseStrangeness
flag for access to MC
AliRDHFCutsDplustoKpipi * fRDCutsAnalysis
list of cuts
virtual void UserCreateOutputObjects()
Implementation of interface methods.
Int_t GetIsSelectedPID() const
Definition: AliRDHFCuts.h:374
double Double_t
Definition: External.C:58
Definition: External.C:260
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
THnSparseF * fHistMassPtImpPar[5]
! histograms for impact parameter
Definition: External.C:236
TH2F * fYVsPtSigNoPid
! hist. of Y vs. Pt (MC, only sig, w/o PID)
void Getd0MeasMinusExpProng(Int_t ip, Double_t magf, Double_t &d0diff, Double_t &errd0diff) const
static Int_t CheckDplusDecay(AliMCEvent *mcEvent, Int_t label, Int_t *arrayDauLab)
TH1F ** fMassHistLS
!hist. for LS inv mass (topol+PID)
Int_t fAODProtection
flag for filling ntuple 0 no NTuple 1 big Ntuple 2 small NTuple
Int_t GetIsSelectedCuts() const
Definition: AliRDHFCuts.h:373
TH2F * fPtVsMassPlus
! hist. of pt vs. mass, D+ candidates (topol+PID cuts)
Bool_t fDoSparse
flag to activate impact paramter histos
Int_t IsEventSelectedInCentrality(AliVEvent *event)
Bool_t HasSelectionBit(Int_t i) const
TH3F * fYVsPt
! hist. of Y vs. Pt vs. Mass (topol+PID cuts)
virtual void Terminate(Option_t *option)
const Double_t d0min
TH1F ** fMassHistMinus
! hist. for D- inv mass (topol+PID cuts)
TH1F ** fSumd02Hist
!hist. for sum d02 (topol+PID)
Int_t fEtaSelection
flag to do LS analysis
Bool_t fDoTrackVarHist
flag to activate sparses for cut variation study
Float_t fLowerImpPar
nunber of bins in impact parameter histos
TH2F * fHistCentrality[3]
!hist. for cent distr (all,sel ev, )
Double_t ImpParXY() const
TH1F * fSPDMult
! hist. of spd mult
static Int_t CheckMatchingAODdeltaAODevents()
Int_t GetLSHistoIndex(Int_t iPtBin) const
TH1F ** fCosxy
!hist. for Cosxy (topol+PID)
Int_t GetSignalHistoIndex(Int_t iPtBin) const
THnSparseF * fHistTrackVar
! histograms for track cuts study
UInt_t GetPIDTrackTPCTOFBitMap(AliAODTrack *track) const
Int_t GetWhyRejection() const
Definition: AliRDHFCuts.h:317
TH1F ** fPtpi1Hist
!hist. for PtPi1 (topol+PID)
Double_t CosPointingAngleXY() const
TH1F ** fDLenHistLS
!hist. for LS cuts variable 2 (topol+PID)
TList * fListCuts
width of one bin in output histos
Bool_t FillRecoCand(AliVEvent *event, AliAODRecoDecayHF3Prong *rd3)
TAxis * GetAxis(TDirectory *dir, const char *name, Bool_t verbose=true)
TH2F * fPtVsMassGoodDaus
! hist. of pt vs. mass (topol+PID cuts)
TList * fOutput
! list send on output slot 0
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
Bool_t fCutsDistr
flag to use bitmask
TH1F ** fPtMaxHist
!hist. for Pt Max (topol+PID)
const Double_t d0max
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
Functions to check the decay tree.
TH1F ** fDCAHistLS
!hist. for LS cuts variable 6 (topol+PID)
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:258
void LSAnalysis(TClonesArray *arrayOppositeSign, TClonesArray *arrayLikeSign, AliAODEvent *aod, AliAODVertex *vtx1, Int_t nDplusOS)
Int_t GetBackgroundHistoIndex(Int_t iPtBin) const
Bool_t HasBadDaughters() const
TH2F * fYVsPtSig
! hist. of Y vs. Pt (MC, only sig, topol+PID cuts)
TH1F ** fPtKHist
!hist. for PtK (topol+PID)
const Int_t nPtBins
Float_t fHigherImpPar
lower limit in impact parameter (um)
Class for cuts on AOD reconstructed D+->Kpipi.
static Int_t GetNumberOfTrackletsInEtaRange(AliAODEvent *ev, Double_t mineta, Double_t maxeta)
int Int_t
Definition: External.C:63
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
float Float_t
Definition: External.C:68
TH1F ** fMassHistPlus
! hist. for D+ inv mass (topol+PID cuts)
const Double_t ptmax
TH2F * fPtVsMassBadDaus
! hist. of pt vs. mass (topol+PID cuts)
TH2F * fPtVsMass
! hist. of pt vs. mass (topol+PID cuts)
AliAODVertex * GetOwnPrimaryVtx() const
Double_t GetSigmaVert(const AliAODEvent *aod=0x0)
TH1F ** fPtMaxHistLS
!hist. for LS cuts variable 5 (topol+PID)
Int_t fDoLS
higher limit in impact parameter (um)
virtual Int_t PreSelect(TObjArray aodTracks)
TH2F * fPhiEtaCandSigReg
! hist. eta/phi of candidates in D+ mass region
const Double_t ptmin
Float_t GetCentrality(AliAODEvent *aodEvent)
Definition: AliRDHFCuts.h:259
UShort_t GetProngID(Int_t ip) const
Float_t GetTrueImpactParameter(const AliAODMCHeader *mcHeader, TClonesArray *arrayMC, const AliAODMCParticle *partDp) const
Int_t fNImpParBins
flag for quark/hadron level identification of prompt and feeddown
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)
TH3F * fYVsPtNoPid
! hist. of Y vs. Pt vs. Mass(w/o PID)
Int_t GetHistoIndex(Int_t iPtBin) const
THnSparseF * fMCAccBFeed
!histo for StepMCAcc for Dplus FD (pt,y,ptB)
short Short_t
Definition: External.C:23
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
TH1F ** fMassHistNoPid
! hist. for inv mass (w/o PID)
TH1F ** fMassHist
! hist. for inv mass (topol+PID cuts)
TH2F * fPtVsMassNoPid
! hist. of pt vs. mass (w/o PID)
Double_t DecayLengthXY() const
static Double_t GetBeautyMotherPt(TClonesArray *arrayMC, AliAODMCParticle *mcPart)
Bool_t CheckAcc(TClonesArray *arrayMC, Int_t nProng, Int_t *labDau)
Bool_t GetIsPrimaryWithoutDaughters() const
Definition: AliRDHFCuts.h:279
TH1F ** fDLenHist
!hist. for Dec Length (topol+PID)
Bool_t IsEventSelected(AliVEvent *event)
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
TH1F * fHistNEvents
! hist. for No. of events
Float_t fBinWidth
Number of Pt Bins.
void SetMassLimits(Float_t range)
TH1F ** fCosPHistLS
!hist. for LS cuts variable 1 (topol+PID)
TH1F ** fCosPHist
!hist. for PointingAngle (topol+PID)
TH1F ** fDCAHist
!hist. for DCA (topol+PID)
void CleanOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod, AliAODVertex *origownvtx) const
Int_t fSystem
eta region to accept D+ 0=all, -1 = negative, 1 = positive
TH2F * fCorreld0Kd0pi[3]
!hist. for d0k*d0pi vs. d0k*d0pi (topol+PID)
virtual void UserExec(Option_t *option)
Bool_t fDoImpPar
flag to activate cuts distr histos
AliNormalizationCounter * fCounter
Cuts for Analysis.
Bool_t fUseBit
flag to enhance strangeness in MC to fit to data
const char Option_t
Definition: External.C:48
Int_t GetNPtBins() const
Definition: AliRDHFCuts.h:250
TH1F ** fDLxy
!hist. for DLxy (topol+PID)
TH2F * fPtVsMassMinus
! hist. of pt vs. mass, D- candidates (topol+PID cuts)
const Int_t nbins
TH1F ** fSigVertHistLS
!hist. for LS cuts variable 4 (topol+PID)
bool Bool_t
Definition: External.C:53
Double_t CosPointingAngle() const
Float_t GetStrangenessWeights(const AliAODRecoDecayHF3Prong *d, TClonesArray *arrayMC, Float_t factor[3]) const
Float_t fLowmasslimit
upper inv mass limit for histos
Int_t GetUseCentrality() const
Definition: AliRDHFCuts.h:281
Bool_t RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
TH1F * fHistNCandidates
! hist. for No. of candidates
Int_t PtBin(Double_t pt) const
Double_t DecayLength() const
TNtuple * fNtupleDplus
! output ntuple
Bool_t fStepMCAcc
flag to activate track variable cut studies
Int_t fNPtBins
lower inv mass limit for histos
Bool_t fUseQuarkTagInKine
flag to activate histos for StepMCAcc
Int_t nptbins
THnSparseF * fSparseCutVars[3]
! histograms for cut variation study
Int_t fNtrcklMax
minimum number of tracklets
TList * OpenFile(const char *fname)
Definition: DrawAnaELoss.C:65
TH1F ** fPtpi2Hist
!hist. for PtPi2 (topol+PID)