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