AliPhysics  a4b41ad (a4b41ad)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskSEDs.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 2007-2009, 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 
19 // //
20 // Analysis task to produce Ds candidates mass spectra //
21 // Origin: F.Prino, Torino, prino@to.infn.it //
22 // //
24 
25 #include <TClonesArray.h>
26 #include <TNtuple.h>
27 #include <TList.h>
28 #include <TString.h>
29 #include <TH1F.h>
30 #include <TMath.h>
31 #include <THnSparse.h>
32 #include <TDatabasePDG.h>
33 #include <Riostream.h>
34 
35 #include "AliAnalysisManager.h"
36 #include "AliAODHandler.h"
37 #include "AliAODEvent.h"
38 #include "AliAODVertex.h"
39 #include "AliAODTrack.h"
40 #include "AliAODMCHeader.h"
41 #include "AliAODMCParticle.h"
42 #include "AliAODRecoDecay.h"
44 #include "AliAnalysisVertexingHF.h"
45 #include "AliRDHFCutsDstoKKpi.h"
46 #include "AliAnalysisTaskSE.h"
48 #include "AliAnalysisTaskSEDs.h"
49 #include "AliVertexingHFUtils.h"
50 
54 
55 //________________________________________________________________________
58  fOutput(0),
59  fHistNEvents(0),
60  fPtVsMass(0),
61  fPtVsMassPhi(0),
62  fPtVsMassK0st(0),
63  fYVsPt(0),
64  fYVsPtSig(0),
65  fHistAllV0multNTPCout(0),
66  fHistSelV0multNTPCout(0),
67  fNtupleDs(0),
68  fFillNtuple(0),
69  fReadMC(kFALSE),
70  fWriteOnlySignal(kFALSE),
71  fDoCutVarHistos(kTRUE),
72  fUseSelectionBit(kFALSE),
73  fFillSparse(kTRUE),
74  fFillSparseDplus(kFALSE),
75  fDoRotBkg(kFALSE),
76  fDoBkgPhiSB(kFALSE),
77  fDoCutV0multTPCout(kFALSE),
78  fAODProtection(1),
79  fNPtBins(0),
80  fListCuts(0),
81  fMassRange(0.8),
82  fMassBinSize(0.002),
83  fminMass(1.6),
84  fmaxMass(2.5),
85  fMaxDeltaPhiMass4Rot(0.010),
86  fCounter(0),
87  fAnalysisCuts(0),
88  fnSparse(0),
89  fnSparseIP(0),
90  fSystem(0)
91 {
93 
94  for(Int_t i=0;i<3;i++){
95  fHistCentrality[i]=0;
97  }
98  for(Int_t i=0;i<4;i++) {
99  fChanHist[i]=0;
100  }
101  for(Int_t i=0;i<4*kMaxPtBins;i++){
102  fPtCandHist[i]=0;
103  fMassHist[i]=0;
104  fMassHistPhi[i]=0;
105  fMassHistK0st[i]=0;
106  fCosPHist[i]=0;
107  fDLenHist[i]=0;
108  fSumd02Hist[i]=0;
109  fSigVertHist[i]=0;
110  fPtMaxHist[i]=0;
111  fDCAHist[i]=0;
112  fPtProng0Hist[i]=0;
113  fPtProng1Hist[i]=0;
114  fPtProng2Hist[i]=0;
115  fDalitz[i]=0;
116  fDalitzPhi[i]=0;
117  fDalitzK0st[i]=0;
118  }
119  for(Int_t i=0;i<kMaxPtBins;i++){
120  fMassHistKK[i]=0;
121  fMassHistKpi[i]=0;
122  fMassRotBkgHistPhi[i]=0;
123  fMassLSBkgHistPhi[i]=0;
124  fMassRSBkgHistPhi[i]=0;
125  }
126  for(Int_t i=0;i<kMaxPtBins+1;i++){
127  fPtLimits[i]=0;
128  }
129  for (Int_t i=0; i<4; i++) {
130  fnSparseMC[i]=0;
131  fnSparseMCDplus[i]=0;
132  }
133 }
134 
135 //________________________________________________________________________
136 AliAnalysisTaskSEDs::AliAnalysisTaskSEDs(const char *name,AliRDHFCutsDstoKKpi* analysiscuts,Int_t fillNtuple):
137  AliAnalysisTaskSE(name),
138  fOutput(0),
139  fHistNEvents(0),
140  fPtVsMass(0),
141  fPtVsMassPhi(0),
142  fPtVsMassK0st(0),
143  fYVsPt(0),
144  fYVsPtSig(0),
145  fHistAllV0multNTPCout(0),
146  fHistSelV0multNTPCout(0),
147  fNtupleDs(0),
148  fFillNtuple(fillNtuple),
149  fReadMC(kFALSE),
150  fWriteOnlySignal(kFALSE),
151  fDoCutVarHistos(kTRUE),
152  fUseSelectionBit(kFALSE),
153  fFillSparse(kTRUE),
154  fFillSparseDplus(kFALSE),
155  fDoRotBkg(kTRUE),
156  fDoBkgPhiSB(kTRUE),
157  fDoCutV0multTPCout(kFALSE),
158  fAODProtection(1),
159  fNPtBins(0),
160  fListCuts(0),
161  fMassRange(0.8),
162  fMassBinSize(0.002),
163  fminMass(1.6),
164  fmaxMass(2.5),
165  fMaxDeltaPhiMass4Rot(0.010),
166  fCounter(0),
167  fAnalysisCuts(analysiscuts),
168  fnSparse(0),
169  fnSparseIP(0),
170  fSystem(0)
171 {
174 
175  for(Int_t i=0;i<3;i++){
176  fHistCentrality[i]=0;
177  fHistCentralityMult[i]=0;
178  }
179  for(Int_t i=0;i<4;i++) {
180  fChanHist[i]=0;
181  }
182  for(Int_t i=0;i<4*kMaxPtBins;i++){
183  fPtCandHist[i]=0;
184  fMassHist[i]=0;
185  fMassHistPhi[i]=0;
186  fMassHistK0st[i]=0;
187  fCosPHist[i]=0;
188  fDLenHist[i]=0;
189  fSumd02Hist[i]=0;
190  fSigVertHist[i]=0;
191  fPtMaxHist[i]=0;
192  fDCAHist[i]=0;
193  fPtProng0Hist[i]=0;
194  fPtProng1Hist[i]=0;
195  fPtProng2Hist[i]=0;
196  fDalitz[i]=0;
197  fDalitzPhi[i]=0;
198  fDalitzK0st[i]=0;
199  }
200  for(Int_t i=0;i<kMaxPtBins;i++){
201  fMassHistKK[i]=0;
202  fMassHistKpi[i]=0;
203  fMassRotBkgHistPhi[i]=0;
204  fMassLSBkgHistPhi[i]=0;
205  fMassRSBkgHistPhi[i]=0;
206  }
207  for(Int_t i=0;i<kMaxPtBins+1;i++){
208  fPtLimits[i]=0;
209  }
210 
211  for (Int_t i=0; i<4; i++) {
212  fnSparseMC[i]=0;
213  fnSparseMCDplus[i]=0;
214  }
215 
218  SetPtBins(nptbins,ptlim);
219 
220  DefineOutput(1,TList::Class()); //My private output
221 
222  DefineOutput(2,TList::Class());
223 
224  DefineOutput(3,AliNormalizationCounter::Class());
225 
226  if(fFillNtuple>0){
227  // Output slot #4 writes into a TNtuple container
228  DefineOutput(4,TNtuple::Class()); //My private output
229  }
230 
231 }
232 
233 //________________________________________________________________________
236  if(n>kMaxPtBins){
237  printf("Max. number of Pt bins = %d\n",kMaxPtBins);
239  fPtLimits[0]=0.;
240  fPtLimits[1]=1.;
241  fPtLimits[2]=3.;
242  fPtLimits[3]=5.;
243  fPtLimits[4]=10.;
244  for(Int_t i=5; i<kMaxPtBins+1; i++) fPtLimits[i]=99999999.;
245  }else{
246  fNPtBins=n;
247  for(Int_t i=0; i<fNPtBins+1; i++) fPtLimits[i]=lim[i];
248  for(Int_t i=fNPtBins+1; i<kMaxPtBins+1; i++) fPtLimits[i]=99999999.;
249  }
250  if(fDebug > 1){
251  printf("Number of Pt bins = %d\n",fNPtBins);
252  for(Int_t i=0; i<fNPtBins; i++) printf(" Bin%d = %8.2f-%8.2f\n",i,fPtLimits[i],fPtLimits[i+1]);
253  }
254 }
255 //________________________________________________________________________
257 {
258  // Destructor
259  if(fOutput && !fOutput->IsOwner()){
260  delete fHistNEvents;
261  delete fHistAllV0multNTPCout;
262  delete fHistSelV0multNTPCout;
263  for(Int_t i=0;i<4;i++){
264  delete fChanHist[i];
265  }
266  for(Int_t i=0;i<4*fNPtBins;i++){
267  delete fMassHist[i];
268  delete fMassHistPhi[i];
269  delete fMassHistK0st[i];
270  delete fCosPHist[i];
271  delete fDLenHist[i];
272  delete fSumd02Hist[i];
273  delete fSigVertHist[i];
274  delete fPtMaxHist[i];
275  delete fPtCandHist[i];
276  delete fDCAHist[i];
277  delete fPtProng0Hist[i];
278  delete fPtProng1Hist[i];
279  delete fPtProng2Hist[i];
280  delete fDalitz[i];
281  delete fDalitzPhi[i];
282  delete fDalitzK0st[i];
283  }
284  for(Int_t i=0;i<fNPtBins;i++){
285  delete fMassHistKK[i];
286  delete fMassHistKpi[i];
287  delete fMassRotBkgHistPhi[i];
288  delete fMassLSBkgHistPhi[i];
289  delete fMassRSBkgHistPhi[i];
290  }
291  delete fPtVsMass;
292  delete fPtVsMassPhi;
293  delete fPtVsMassK0st;
294  delete fYVsPt;
295  delete fYVsPtSig;
296  for(Int_t i=0;i<3;i++){
297  delete fHistCentrality[i];
298  delete fHistCentralityMult[i];
299  }
300 
301  delete fnSparse;
302  delete fnSparseIP;
303  for (Int_t i=0; i<4; i++) {
304  delete fnSparseMC[i];
305  if(fFillSparseDplus)delete fnSparseMCDplus[i];
306  }
307  }
308  delete fOutput;
309  delete fListCuts;
310  delete fNtupleDs;
311  delete fCounter;
312  delete fAnalysisCuts;
313 
314 }
315 
316 //________________________________________________________________________
318 {
320 
321  if(fDebug > 1) printf("AnalysisTaskSEDs::Init() \n");
322 
323  fListCuts=new TList();
324  fListCuts->SetOwner();
325  fListCuts->SetName("CutObjects");
326 
328  analysis->SetName("AnalysisCuts");
329 
330  fListCuts->Add(analysis);
331  PostData(2,fListCuts);
332  return;
333 }
334 
335 //________________________________________________________________________
337 {
339  //
340  if(fDebug > 1) printf("AnalysisTaskSEDs::UserCreateOutputObjects() \n");
341 
342  // Several histograms are more conveniently managed in a TList
343  fOutput = new TList();
344  fOutput->SetOwner();
345  fOutput->SetName("OutputHistos");
346 
347  fHistNEvents = new TH1F("hNEvents", "number of events ",15,-0.5,14.5);
348  fHistNEvents->GetXaxis()->SetBinLabel(1,"nEventsRead");
349  fHistNEvents->GetXaxis()->SetBinLabel(2,"nEvents Matched dAOD");
350  fHistNEvents->GetXaxis()->SetBinLabel(3,"nEvents Mismatched dAOD");
351  fHistNEvents->GetXaxis()->SetBinLabel(4,"nEventsAnal");
352  fHistNEvents->GetXaxis()->SetBinLabel(5,"n. passing IsEvSelected");
353  fHistNEvents->GetXaxis()->SetBinLabel(6,"n. rejected due to trigger");
354  fHistNEvents->GetXaxis()->SetBinLabel(7,"n. rejected due to not reco vertex");
355  fHistNEvents->GetXaxis()->SetBinLabel(8,"n. rejected for contr vertex");
356  fHistNEvents->GetXaxis()->SetBinLabel(9,"n. rejected for vertex out of accept");
357  fHistNEvents->GetXaxis()->SetBinLabel(10,"n. rejected for pileup events");
358  fHistNEvents->GetXaxis()->SetBinLabel(11,"no. of out centrality events");
359  fHistNEvents->GetXaxis()->SetBinLabel(12,"no. of 3 prong candidates");
360  fHistNEvents->GetXaxis()->SetBinLabel(13,"no. of Ds after filtering cuts");
361  fHistNEvents->GetXaxis()->SetBinLabel(14,"no. of Ds after selection cuts");
362  fHistNEvents->GetXaxis()->SetBinLabel(15,"no. of not on-the-fly rec Ds");
363 
364  fHistNEvents->GetXaxis()->SetNdivisions(1,kFALSE);
365 
366  fHistNEvents->Sumw2();
367  fHistNEvents->SetMinimum(0);
368  fOutput->Add(fHistNEvents);
369 
370  fHistCentrality[0]=new TH1F("hCentr","centrality",10000,0.,100.);
371  fHistCentrality[1]=new TH1F("hCentr(selectedCent)","centrality(selectedCent)",10000,0.,100.);
372  fHistCentrality[2]=new TH1F("hCentr(OutofCent)","centrality(OutofCent)",10000,0.,100.);
373  fHistCentralityMult[0]=new TH2F("hCentrMult","centrality vs mult",100,0.5,30000.5,40,0.,100.);
374  fHistCentralityMult[1]=new TH2F("hCentrMult(selectedCent)","centrality vs mult(selectedCent)",100,0.5,30000.5,40,0.,100.);
375  fHistCentralityMult[2]=new TH2F("hCentrMult(OutofCent)","centrality vs mult(OutofCent)",100,0.5,30000.5,40,0.,100.);
376  for(Int_t i=0;i<3;i++){
377  fHistCentrality[i]->Sumw2();
378  fOutput->Add(fHistCentrality[i]);
379  fHistCentralityMult[i]->Sumw2();
380  fOutput->Add(fHistCentralityMult[i]);
381  }
382  if(fDoCutV0multTPCout) {
383  fHistAllV0multNTPCout = new TH2F("HistAllV0multNTPCout", "V0mult vs # TPCout (all) ;V0mult ;# TPCout", 1000, 0., 40000, 1000, 0, 30000);
384  fHistSelV0multNTPCout = new TH2F("HistSelV0multNTPCout", "V0mult vs # TPCout (sel) ;V0mult ;# TPCout", 1000, 0., 40000, 1000, 0, 30000);
385  fHistAllV0multNTPCout->Sumw2();
386  fHistSelV0multNTPCout->Sumw2();
389  }
390 
391  Double_t massDs=TDatabasePDG::Instance()->GetParticle(431)->Mass();
392 
393  Int_t nInvMassBins=(Int_t)(fMassRange/fMassBinSize+0.5);
394  if(nInvMassBins%2==1) nInvMassBins++;
395  // Double_t minMass=massDs-1.0*nInvMassBins*fMassBinSize;
396  Double_t minMass=massDs-0.5*nInvMassBins*fMassBinSize;
397  // Double_t maxMass=massDs+1.0*nInvMassBins*fMassBinSize;
398  Double_t maxMass=massDs+0.5*nInvMassBins*fMassBinSize;
399  fminMass = minMass;
400  fmaxMass = maxMass;
401 
402  TString hisname;
403  TString htype;
404  Int_t index;
405  for(Int_t iType=0; iType<4; iType++){
406  for(Int_t i=0;i<fNPtBins;i++){
407  if(iType==0){
408  htype="All";
409  index=GetHistoIndex(i);
410  }else if(iType==1){
411  htype="Sig";
412  index=GetSignalHistoIndex(i);
413  }else if(iType==2){
414  htype="Bkg";
415  index=GetBackgroundHistoIndex(i);
416  }else{
417  htype="ReflSig";
418  index=GetReflSignalHistoIndex(i);
419  }
420  hisname.Form("hMass%sPt%d",htype.Data(),i);
421  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),nInvMassBins,minMass,maxMass);
422  fMassHist[index]->Sumw2();
423  hisname.Form("hMass%sPt%dphi",htype.Data(),i);
424  fMassHistPhi[index]=new TH1F(hisname.Data(),hisname.Data(),nInvMassBins,minMass,maxMass);
425  fMassHistPhi[index]->Sumw2();
426  hisname.Form("hMass%sPt%dk0st",htype.Data(),i);
427  fMassHistK0st[index]=new TH1F(hisname.Data(),hisname.Data(),nInvMassBins,minMass,maxMass);
428  fMassHistK0st[index]->Sumw2();
429  hisname.Form("hCosP%sPt%d",htype.Data(),i);
430  fCosPHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.5,1.);
431  fCosPHist[index]->Sumw2();
432  hisname.Form("hDLen%sPt%d",htype.Data(),i);
433  fDLenHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.5);
434  fDLenHist[index]->Sumw2();
435  hisname.Form("hSumd02%sPt%d",htype.Data(),i);
436  fSumd02Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,1.);
437  fSumd02Hist[index]->Sumw2();
438  hisname.Form("hSigVert%sPt%d",htype.Data(),i);
439  fSigVertHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
440  fSigVertHist[index]->Sumw2();
441  hisname.Form("hPtMax%sPt%d",htype.Data(),i);
442  fPtMaxHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.5,20.);
443  fPtMaxHist[index]->Sumw2();
444  hisname.Form("hPtCand%sPt%d",htype.Data(),i);
445  fPtCandHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.5,20.);
446  fPtCandHist[index]->Sumw2();
447  hisname.Form("hDCA%sPt%d",htype.Data(),i);
448  fDCAHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
449  fDCAHist[index]->Sumw2();
450  hisname.Form("hPtProng0%sPt%d",htype.Data(),i);
451  fPtProng0Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.0,20.);
452  fPtProng0Hist[index]->Sumw2();
453  hisname.Form("hPtProng1%sPt%d",htype.Data(),i);
454  fPtProng1Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.0,20.);
455  fPtProng1Hist[index]->Sumw2();
456  hisname.Form("hPtProng2%sPt%d",htype.Data(),i);
457  fPtProng2Hist[index]=new TH1F(hisname.Data(),hisname.Data(),100,0.0,20.);
458  fPtProng2Hist[index]->Sumw2();
459  hisname.Form("hDalitz%sPt%d",htype.Data(),i);
460  fDalitz[index]=new TH2F(hisname.Data(),hisname.Data(),100,0.,2.,100,0.,2.);
461  fDalitz[index]->Sumw2();
462  hisname.Form("hDalitz%sPt%dphi",htype.Data(),i);
463  fDalitzPhi[index]=new TH2F(hisname.Data(),hisname.Data(),100,0.,2.,100,0.,2.);
464  fDalitzPhi[index]->Sumw2();
465  hisname.Form("hDalitz%sPt%dk0st",htype.Data(),i);
466  fDalitzK0st[index]=new TH2F(hisname.Data(),hisname.Data(),100,0.,2.,100,0.,2.);
467  fDalitzK0st[index]->Sumw2();
468  }
469  }
470 
471  for(Int_t i=0; i<4*fNPtBins; i++){
472  fOutput->Add(fMassHist[i]);
473  fOutput->Add(fMassHistPhi[i]);
474  fOutput->Add(fMassHistK0st[i]);
475  fOutput->Add(fPtCandHist[i]);
476  if(fDoCutVarHistos){
477  fOutput->Add(fCosPHist[i]);
478  fOutput->Add(fDLenHist[i]);
479  fOutput->Add(fSumd02Hist[i]);
480  fOutput->Add(fSigVertHist[i]);
481  fOutput->Add(fPtMaxHist[i]);
482  fOutput->Add(fDCAHist[i]);
483  fOutput->Add(fPtProng0Hist[i]);
484  fOutput->Add(fPtProng1Hist[i]);
485  fOutput->Add(fPtProng2Hist[i]);
486  fOutput->Add(fDalitz[i]);
487  fOutput->Add(fDalitzPhi[i]);
488  fOutput->Add(fDalitzK0st[i]);
489  }
490  }
491 
492  fChanHist[0] = new TH1F("hChanAll", "KKpi and piKK candidates",64,-0.5,63.5);
493  fChanHist[1] = new TH1F("hChanSig", "KKpi and piKK candidates",64,-0.5,63.5);
494  fChanHist[2] = new TH1F("hChanBkg", "KKpi and piKK candidates",64,-0.5,63.5);
495  fChanHist[3] = new TH1F("hChanReflSig", "KKpi and piKK candidates",64,-0.5,63.5);
496  for(Int_t i=0;i<4;i++){
497  fChanHist[i]->Sumw2();
498  fChanHist[i]->SetMinimum(0);
499  fOutput->Add(fChanHist[i]);
500  }
501 
502 
503  fPtVsMass=new TH2F("hPtVsMass","PtVsMass (prod. cuts)",nInvMassBins,minMass,maxMass,40,0.,20.);
504  fPtVsMassPhi=new TH2F("hPtVsMassPhi","PtVsMass (phi selection)",nInvMassBins,minMass,maxMass,200,0.,20.);
505  fPtVsMassK0st=new TH2F("hPtVsMassK0st","PtVsMass (K0* selection)",nInvMassBins,minMass,maxMass,200,0.,20.);
506  fYVsPt=new TH2F("hYVsPt","YvsPt (prod. cuts)",40,0.,20.,80,-2.,2.);
507  fYVsPtSig=new TH2F("hYVsPtSig","YvsPt (MC, only sig., prod. cuts)",40,0.,20.,80,-2.,2.);
508 
509  for(Int_t i=0;i<fNPtBins;i++){
510  hisname.Form("hMassKKPt%d",i);
511  fMassHistKK[i]=new TH1F(hisname.Data(),hisname.Data(),200,0.95,1.35);
512  fMassHistKK[i]->Sumw2();
513  fOutput->Add(fMassHistKK[i]);
514  hisname.Form("hMassKpiPt%d",i);
515  fMassHistKpi[i]=new TH1F(hisname.Data(),hisname.Data(),200,0.7,1.1);
516  fMassHistKpi[i]->Sumw2();
517  fOutput->Add(fMassHistKpi[i]);
518  if(fDoRotBkg) {
519  hisname.Form("hMassAllPt%dphi_RotBkg",i);
520  fMassRotBkgHistPhi[i]=new TH1F(hisname.Data(),hisname.Data(),nInvMassBins,minMass,maxMass);
521  fMassRotBkgHistPhi[i]->Sumw2();
522  fOutput->Add(fMassRotBkgHistPhi[i]);
523  }
524  if(fDoBkgPhiSB) {
525  hisname.Form("fMassLSBkgHistPhiPt%d",i);
526  fMassLSBkgHistPhi[i]=new TH1F(hisname.Data(),hisname.Data(),nInvMassBins,minMass,maxMass);
527  fMassLSBkgHistPhi[i]->Sumw2();
528  fOutput->Add(fMassLSBkgHistPhi[i]);
529  hisname.Form("fMassRSBkgHistPhiPt%d",i);
530  fMassRSBkgHistPhi[i]=new TH1F(hisname.Data(),hisname.Data(),nInvMassBins,minMass,maxMass);
531  fMassRSBkgHistPhi[i]->Sumw2();
532  fOutput->Add(fMassRSBkgHistPhi[i]);
533  }
534  }
535 
536  fOutput->Add(fPtVsMass);
537  fOutput->Add(fPtVsMassPhi);
538  fOutput->Add(fPtVsMassK0st);
539  fOutput->Add(fYVsPt);
540  fOutput->Add(fYVsPtSig);
541 
542  Int_t nBinsReco[knVarForSparse] = {350, 20, 30, 14, 14, 20, 10, 10, 14, 6, 6, 12};
543  Double_t xminReco[knVarForSparse] = {1.6, 0., 0.00, 0.0, 0.0, 0., 0.9, 0.9, 0.00, 0.7, 0.0, 0.};
544  Double_t xmaxReco[knVarForSparse] = {2.3, 20., 0.015, 0.07, 0.07, 10., 1.0, 1.0, 0.07, 1.0, 0.3, 6.};
545  TString axis[knVarForSparse] = {"invMassDsAllPhi","p_{T}","#Delta Mass(KK)","dlen","dlen_{xy}","normdl_{xy}","cosP","cosP_{xy}","sigVert","cosPiDs","|cosPiKPhi^{3}|","normIP"};
546  if(fSystem == 1) { //pPb,PbPb
547  nBinsReco[0] = 200; //Ds mass
548  xminReco[0] = 1.75;
549  xmaxReco[0] = 2.15;
550 
551  nBinsReco[1] = 16; //pt
552  xminReco[1] = 0.;
553  xmaxReco[1] = 16.;
554 
555  nBinsReco[2] = 12; //#Delta Mass(KK)
556  xmaxReco[2] = 0.012;
557 
558  nBinsReco[3] = 7; //dlen
559  nBinsReco[4] = 7; //dlenxy
560  nBinsReco[5] = 10; //ndlenxy
561 
562  nBinsReco[6] = 6; //cosP
563  xminReco[6] = 0.97;
564  xmaxReco[6] = 1.0;
565 
566  nBinsReco[7] = 6; //cosPxy
567  xminReco[7] = 0.97;
568  xmaxReco[7] = 1.0;
569  }
570 
571  Int_t nBinsAcc[knVarForSparseAcc] = {20, 20};
572  Double_t xminAcc[knVarForSparseAcc] = {0., -1.};
573  Double_t xmaxAcc[knVarForSparseAcc] = {20, 1.};
574 
575  Int_t nBinsIP[knVarForSparseIP] = { 20, 400, 400, 400, 400, 3};
576  Double_t xminIP[knVarForSparseIP] = { 0., -10., -10., -10., -10., 0.};
577  Double_t xmaxIP[knVarForSparseIP] = {20., 10., 10., 10., 10., 3.};
578  TString axisIP[knVarForSparseIP] = {"motherPt","maxNormImp","IP0","IP1","IP2","candType"};
579 
580  if(fFillSparse) {
581 
582  if(fReadMC) {
583  TString label[knVarForSparseAcc] = {"fromC","fromB"};
584  for (Int_t i=0; i<2; i++) {
585  fnSparseMC[i] = new THnSparseF(Form("fnSparseAcc_%s",label[i].Data()),Form("MC nSparse (Acc.Step)- %s",label[i].Data()),
586  knVarForSparseAcc, nBinsAcc, xminAcc, xmaxAcc);
587  fnSparseMC[i]->GetAxis(0)->SetTitle("p_{T} (GeV/c)");
588  fnSparseMC[i]->GetAxis(1)->SetTitle("y");
589  fOutput->Add(fnSparseMC[i]);
590 
591  //Dplus
592  if(fFillSparseDplus) {
593  fnSparseMCDplus[i] = new THnSparseF(Form("fnSparseAccDplus_%s",label[i].Data()),Form("MC nSparse D^{+} (Acc.Step)- %s",label[i].Data()),
594  knVarForSparseAcc, nBinsAcc, xminAcc, xmaxAcc);
595  fnSparseMCDplus[i]->GetAxis(0)->SetTitle("p_{T} (GeV/c)");
596  fnSparseMCDplus[i]->GetAxis(1)->SetTitle("y");
597  fOutput->Add(fnSparseMCDplus[i]);
598  }
599  }
600  for (Int_t i=2; i<4; i++) {
601  fnSparseMC[i] = new THnSparseF(Form("fnSparseReco_%s",label[i-2].Data()),Form("MC nSparse (Reco Step)- %s",label[i-2].Data()),
602  knVarForSparse, nBinsReco, xminReco, xmaxReco);
603  for (Int_t j=0; j<knVarForSparse; j++) {
604  fnSparseMC[i]->GetAxis(j)->SetTitle(Form("%s",axis[j].Data()));
605  }
606  fOutput->Add(fnSparseMC[i]);
607 
608  //Dplus
609  if(fFillSparseDplus) {
610  fnSparseMCDplus[i] = new THnSparseF(Form("fnSparseRecoDplus_%s",label[i-2].Data()),Form("MC nSparse D^{+} (Reco Step)- %s",label[i-2].Data()),
611  knVarForSparse, nBinsReco, xminReco, xmaxReco);
612  for (Int_t j=0; j<knVarForSparse; j++) {
613  fnSparseMCDplus[i]->GetAxis(j)->SetTitle(Form("%s",axis[j].Data()));
614  }
615  fOutput->Add(fnSparseMCDplus[i]);
616  }
617  }
618 
619  fnSparseIP = new THnSparseF("fnSparseIP","nSparseIP", knVarForSparseIP, nBinsIP, xminIP, xmaxIP);
620  for (Int_t j=0; j<knVarForSparseIP; j++) {
621  fnSparseIP->GetAxis(j)->SetTitle(Form("%s",axisIP[j].Data()));
622  }
623  fnSparseIP->GetAxis(5)->SetTitle("candType (0.5=bkg; 1.5=prompt; 2.5=FD)");
624  fOutput->Add(fnSparseIP);
625  }
626  else {
627  fnSparse = new THnSparseF("fnSparse","nSparse", knVarForSparse, nBinsReco, xminReco, xmaxReco);
628  for (Int_t j=0; j<knVarForSparse; j++) {
629  fnSparse->GetAxis(j)->SetTitle(Form("%s",axis[j].Data()));
630  }
631  fOutput->Add(fnSparse);
632  }
633  }
634 
635  //Counter for Normalization
636  fCounter = new AliNormalizationCounter("NormalizationCounter");
637  fCounter->Init();
638 
639  PostData(1,fOutput);
640  PostData(3,fCounter);
641 
642  if(fFillNtuple>0){
643  OpenFile(4); // 4 is the slot number of the ntuple
644 
645  fNtupleDs = new TNtuple("fNtupleDs","Ds","labDs:retcode:pdgcode0:Pt0:Pt1:Pt2:PtRec:P0:P1:P2:PidTrackBit0:PidTrackBit1:PidTrackBit2:PointingAngle:PointingAngleXY:DecLeng:DecLengXY:NorDecLeng:NorDecLengXY:InvMassKKpi:InvMasspiKK:sigvert:d00:d01:d02:dca:d0square:InvMassPhiKKpi:InvMassPhipiKK:InvMassK0starKKpi:InvMassK0starpiKK:cosinePiDsFrameKKpi:cosinePiDsFramepiKK:cosineKPhiFrameKKpi:cosineKPhiFramepiKK:centrality:runNumber");
646 
647  }
648 
649 
650  return;
651 }
652 
653 //________________________________________________________________________
655 {
658 
659  AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
660 
661  fHistNEvents->Fill(0); // all events
662  if(fAODProtection>=0){
663  // Protection against different number of events in the AOD and deltaAOD
664  // In case of discrepancy the event is rejected.
665  Int_t matchingAODdeltaAODlevel = AliRDHFCuts::CheckMatchingAODdeltaAODevents();
666  if (matchingAODdeltaAODlevel<0 || (matchingAODdeltaAODlevel==0 && fAODProtection==1)) {
667  // AOD/deltaAOD trees have different number of entries || TProcessID do not match while it was required
668  fHistNEvents->Fill(2);
669  return;
670  }
671  fHistNEvents->Fill(1);
672  }
673 
674  TClonesArray *array3Prong = 0;
675  if(!aod && AODEvent() && IsStandardAOD()) {
676  // In case there is an AOD handler writing a standard AOD, use the AOD
677  // event in memory rather than the input (ESD) event.
678  aod = dynamic_cast<AliAODEvent*> (AODEvent());
679  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
680  // have to taken from the AOD event hold by the AliAODExtension
681  AliAODHandler* aodHandler = (AliAODHandler*)
682  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
683  if(aodHandler->GetExtensions()) {
684  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
685  AliAODEvent *aodFromExt = ext->GetAOD();
686  array3Prong=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
687  }
688  } else if(aod) {
689  array3Prong=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
690  }
691 
692  if(!aod || !array3Prong) {
693  printf("AliAnalysisTaskSEDs::UserExec: Charm3Prong branch not found!\n");
694  return;
695  }
696 
697 
698  // fix for temporary bug in ESDfilter
699  // the AODs with null vertex pointer didn't pass the PhysSel
700  if(!aod->GetPrimaryVertex() || TMath::Abs(aod->GetMagneticField())<0.001) return;
701 
702 
703  fHistNEvents->Fill(3); // count event
704  // Post the data already here
705  PostData(1,fOutput);
706 
708 
709 
710  Bool_t isEvSel=fAnalysisCuts->IsEventSelected(aod);
711  Float_t ntracks=aod->GetNumberOfTracks();
712  Float_t evCentr=fAnalysisCuts->GetCentrality(aod);
713 
714  fHistCentrality[0]->Fill(evCentr);
715  fHistCentralityMult[0]->Fill(ntracks,evCentr);
722  fHistNEvents->Fill(10);
723  fHistCentrality[2]->Fill(evCentr);
724  fHistCentralityMult[2]->Fill(ntracks,evCentr);
725  }
726 
728  Int_t runNumber=aod->GetRunNumber();
729 
730 
731 
732  TClonesArray *arrayMC=0;
733  AliAODMCHeader *mcHeader=0;
734 
735  // AOD primary vertex
736  AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
737  // vtx1->Print();
738 
739  // load MC particles
740  if(fReadMC){
741 
742  arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
743  if(!arrayMC) {
744  printf("AliAnalysisTaskSEDs::UserExec: MC particles branch not found!\n");
745  return;
746  }
747 
748  // load MC header
749  mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
750  if(!mcHeader) {
751  printf("AliAnalysisTaskSEDs::UserExec: MC header branch not found!\n");
752  return;
753  }
754  }
755 
756 
757  if(fReadMC && fFillSparse){
758  if(aod->GetTriggerMask()==0 && (runNumber>=195344 && runNumber<=195677))
759  // protection for events with empty trigger mask in p-Pb
760  return;
762  // events not passing the centrality selection can be removed immediately.
763  return;
764  Double_t zMCVertex = mcHeader->GetVtxZ();
765  if (TMath::Abs(zMCVertex) > fAnalysisCuts->GetMaxVtxZ())
766  return;
767  FillMCGenAccHistos(arrayMC, mcHeader);
768  }
769 
770  if(!isEvSel)return;
771  fHistNEvents->Fill(4);
772  fHistCentrality[1]->Fill(evCentr);
773  fHistCentralityMult[1]->Fill(ntracks,evCentr);
774 
775  if(fDoCutV0multTPCout) {
776  //cut on V0mult. vs #tracks kTPCout
777  Float_t V0mult=0.;
778  AliAODVZERO *aodVZERO = (AliAODVZERO*)aod->GetVZEROData();
779  if(aodVZERO) {
780  for(int ich=0; ich<64;ich++) V0mult += aodVZERO->GetMultiplicity(ich);
781  }
782  Int_t nTPCout=0;
783  for (Int_t i=0;i<aod->GetNumberOfTracks();++i) {
784  AliVTrack *track = aod->GetTrack(i);
785  if (!track) continue;
786  if((track->GetStatus() & AliVTrack::kTPCout)) nTPCout++;
787  }
788  fHistAllV0multNTPCout->Fill(V0mult,nTPCout);
789  if(nTPCout > (0.32*V0mult+750)) return;
790  else fHistSelV0multNTPCout->Fill(V0mult,nTPCout);
791  }
792 
793  Int_t n3Prong = array3Prong->GetEntriesFast();
794  if(fDebug>1) printf("Number of Ds->KKpi: %d\n",n3Prong);
795 
796 
797  Int_t pdgDstoKKpi[3]={321,321,211};
798  Int_t nSelected=0;
799  Int_t nFiltered=0;
800  Double_t massPhi=TDatabasePDG::Instance()->GetParticle(333)->Mass();
801 
802  // vHF object is needed to call the method that refills the missing info of the candidates
803  // if they have been deleted in dAOD reconstruction phase
804  // in order to reduce the size of the file
806 
807  for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
808 
809 
810  AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
811  fHistNEvents->Fill(11);
812 
814  continue;
815  }
816  nFiltered++;
817  fHistNEvents->Fill(12);
818 
819  if(!(vHF->FillRecoCand(aod,d))) {
820  fHistNEvents->Fill(14); //monitor how often this fails
821  continue;
822  }
823 
824  Bool_t unsetvtx=kFALSE;
825  if(!d->GetOwnPrimaryVtx()){
826  d->SetOwnPrimaryVtx(vtx1);
827  unsetvtx=kTRUE;
828  // NOTE: the ow primary vertex should be unset, otherwise there is a memory leak
829  // Pay attention if you use continue inside this loop!!!
830  }
831 
832  Bool_t recVtx=kFALSE;
833  AliAODVertex *origownvtx=0x0;
834 
835  Double_t ptCand = d->Pt();
836  Int_t iPtBin=TMath::BinarySearch(fNPtBins,fPtLimits,(Float_t)ptCand);
837  Double_t rapid=d->YDs();
838  fYVsPt->Fill(ptCand,rapid);
839  Bool_t isFidAcc=fAnalysisCuts->IsInFiducialAcceptance(ptCand,rapid);
840 
841  if(isFidAcc){
842 
843  Int_t retCodeAnalysisCuts=fAnalysisCuts->IsSelected(d,AliRDHFCuts::kAll,aod);
844  Int_t retCodeNoRes=retCodeAnalysisCuts;
846  if(origRes){
848  retCodeNoRes=fAnalysisCuts->IsSelected(d,AliRDHFCuts::kAll,aod);
850  }
851  Double_t massKK = 0.;
852 
853  if(retCodeNoRes&1){ //KKpi
854  massKK=d->InvMass2Prongs(0,1,321,321);
855  Double_t massKp=d->InvMass2Prongs(1,2,321,211);
856  fMassHistKK[iPtBin]->Fill(massKK);
857  fMassHistKpi[iPtBin]->Fill(massKp);
858  }
859  if(retCodeNoRes&2){ //piKK
860  massKK=d->InvMass2Prongs(1,2,321,321);
861  Double_t massKp=d->InvMass2Prongs(0,1,211,321);
862  fMassHistKK[iPtBin]->Fill(massKK);
863  fMassHistKpi[iPtBin]->Fill(massKp);
864  }
865 
866  Int_t isKKpi=retCodeAnalysisCuts&1;
867  Int_t ispiKK=retCodeAnalysisCuts&2;
868  Int_t isPhiKKpi=retCodeAnalysisCuts&4;
869  Int_t isPhipiKK=retCodeAnalysisCuts&8;
870  Int_t isK0starKKpi=retCodeAnalysisCuts&16;
871  Int_t isK0starpiKK=retCodeAnalysisCuts&32;
872 
873  if(retCodeAnalysisCuts>0){
875  if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
876  if(fAnalysisCuts->RecalcOwnPrimaryVtx(d,aod))recVtx=kTRUE;
877  else fAnalysisCuts->CleanOwnPrimaryVtx(d,aod,origownvtx);
878  }
879 
880 
881  fHistNEvents->Fill(13);
882  nSelected++;
883 
884  Int_t index=GetHistoIndex(iPtBin);
885  fPtCandHist[index]->Fill(ptCand);
886 
887 
888  Double_t weightKKpi=1.;
889  Double_t weightpiKK=1.;
891  weightKKpi=fAnalysisCuts->GetWeightForKKpi();
892  weightpiKK=fAnalysisCuts->GetWeightForpiKK();
893  if(weightKKpi>1. || weightKKpi<0.) weightKKpi=0.;
894  if(weightpiKK>1. || weightpiKK<0.) weightpiKK=0.;
895  }
896 
897  fChanHist[0]->Fill(retCodeAnalysisCuts);
898 
899 
900  Double_t invMass = 0.;
901  Int_t indexMCKKpi=-1;
902  Int_t indexMCpiKK=-1;
903  Int_t labDs=-1;
904  Int_t labDplus=-1;
905  Int_t pdgCode0=-999;
906  Int_t isMCSignal=-1;
907 
908 
909  if(fReadMC){
910 
911  labDs = d->MatchToMC(431,arrayMC,3,pdgDstoKKpi);
912  labDplus = d->MatchToMC(411,arrayMC,3,pdgDstoKKpi);
913  if(labDs>=0){
914  Int_t labDau0=((AliAODTrack*)d->GetDaughter(0))->GetLabel();
915  AliAODMCParticle* p=(AliAODMCParticle*)arrayMC->UncheckedAt(TMath::Abs(labDau0));
916  pdgCode0=TMath::Abs(p->GetPdgCode());
917 
918  if(isKKpi){
919  if(pdgCode0==321) {
920  indexMCKKpi=GetSignalHistoIndex(iPtBin);
921  fYVsPtSig->Fill(ptCand,rapid);
922  fChanHist[1]->Fill(retCodeAnalysisCuts);
923  isMCSignal=1;
924  }else{
925  indexMCKKpi=GetReflSignalHistoIndex(iPtBin);
926  fChanHist[3]->Fill(retCodeAnalysisCuts);
927  isMCSignal=0;
928  }
929  }
930  if(ispiKK){
931  if(pdgCode0==211) {
932  indexMCpiKK=GetSignalHistoIndex(iPtBin);
933  fYVsPtSig->Fill(ptCand,rapid);
934  fChanHist[1]->Fill(retCodeAnalysisCuts);
935  isMCSignal=1;
936  }else{
937  indexMCpiKK=GetReflSignalHistoIndex(iPtBin);
938  fChanHist[3]->Fill(retCodeAnalysisCuts);
939  isMCSignal=0;
940  }
941  }
942  }else{
943  indexMCpiKK=GetBackgroundHistoIndex(iPtBin);
944  indexMCKKpi=GetBackgroundHistoIndex(iPtBin);
945  fChanHist[2]->Fill(retCodeAnalysisCuts);
946  if(labDplus>=0) {
947  Int_t labDau0=((AliAODTrack*)d->GetDaughter(0))->GetLabel();
948  AliAODMCParticle* p=(AliAODMCParticle*)arrayMC->UncheckedAt(TMath::Abs(labDau0));
949  pdgCode0=TMath::Abs(p->GetPdgCode());
950  }
951  }
952  }
953 
954  Double_t candType = 0.5; //for bkg
955  Double_t massPhi=TDatabasePDG::Instance()->GetParticle(333)->Mass();
956 
957  if(isKKpi){
958  if(fDoRotBkg && TMath::Abs(massKK-massPhi)<=fMaxDeltaPhiMass4Rot)GenerateRotBkg(d,1,iPtBin);
959  if(fDoBkgPhiSB && 0.010<TMath::Abs(massKK-massPhi)<0.030)GenerateBkgFromPhiSB(d,1,iPtBin,massKK);
960 
961  invMass=d->InvMassDsKKpi();
962  fMassHist[index]->Fill(invMass,weightKKpi);
963  fPtVsMass->Fill(invMass,ptCand,weightKKpi);
964  if(isPhiKKpi){
965  fMassHistPhi[index]->Fill(invMass,weightKKpi);
966  fPtVsMassPhi->Fill(invMass,ptCand,weightKKpi);
967  }
968  if(isK0starKKpi){
969  fMassHistK0st[index]->Fill(invMass,weightKKpi);
970  fPtVsMassK0st->Fill(invMass,ptCand,weightKKpi);
971  }
972  if(fReadMC && indexMCKKpi!=-1){
973  fMassHist[indexMCKKpi]->Fill(invMass,weightKKpi);
974  if(isPhiKKpi) {
975  fMassHistPhi[indexMCKKpi]->Fill(invMass,weightKKpi);
976  if(fFillSparse) {
977  if(indexMCKKpi==GetSignalHistoIndex(iPtBin) || labDplus >= 0) {
978  AliAODMCParticle *partDs;
979  if(indexMCKKpi==GetSignalHistoIndex(iPtBin)) partDs = (AliAODMCParticle*)arrayMC->At(labDs);
980  if(labDplus >= 0) partDs = (AliAODMCParticle*)arrayMC->At(labDplus);
981  Int_t orig = AliVertexingHFUtils::CheckOrigin(arrayMC,partDs,kTRUE);
982  if(orig==4) {
983  candType = 1.5;
984  }
985  if(orig==5) {
986  candType = 2.5;
987  }
988  }
989  }
990  }
991  if(isK0starKKpi) fMassHistK0st[indexMCKKpi]->Fill(invMass,weightKKpi);
992  }
993  }
994  if(ispiKK){
995  if(fDoRotBkg && TMath::Abs(massKK-massPhi)<=fMaxDeltaPhiMass4Rot)GenerateRotBkg(d,2,iPtBin);
996  if(fDoBkgPhiSB && 0.010<TMath::Abs(massKK-massPhi)<0.030)GenerateBkgFromPhiSB(d,2,iPtBin,massKK);
997 
998  invMass=d->InvMassDspiKK();
999  fMassHist[index]->Fill(invMass,weightpiKK);
1000  fPtVsMass->Fill(invMass,ptCand,weightpiKK);
1001  if(isPhipiKK){
1002  fMassHistPhi[index]->Fill(invMass,weightpiKK);
1003  fPtVsMassPhi->Fill(invMass,ptCand,weightpiKK);
1004  }
1005  if(isK0starpiKK){
1006  fMassHistK0st[index]->Fill(invMass,weightpiKK);
1007  fPtVsMassK0st->Fill(invMass,ptCand,weightpiKK);
1008  }
1009  if(fReadMC && indexMCpiKK!=-1){
1010  fMassHist[indexMCpiKK]->Fill(invMass,weightpiKK);
1011  if(isPhipiKK) {
1012  fMassHistPhi[indexMCpiKK]->Fill(invMass,weightpiKK);
1013  if(fFillSparse) {
1014  if(indexMCpiKK==GetSignalHistoIndex(iPtBin) || labDplus >= 0) {
1015  AliAODMCParticle *partDs;
1016  if(indexMCpiKK==GetSignalHistoIndex(iPtBin)) partDs = (AliAODMCParticle*)arrayMC->At(labDs);
1017  if(labDplus >= 0) partDs = (AliAODMCParticle*)arrayMC->At(labDplus);
1018  Int_t orig = AliVertexingHFUtils::CheckOrigin(arrayMC,partDs,kTRUE);
1019  if(orig==4) {
1020  candType = 1.5;
1021  }
1022  if(orig==5) {
1023  candType = 2.5;
1024  }
1025  }
1026  }
1027  }
1028  if(isK0starpiKK) fMassHistK0st[indexMCpiKK]->Fill(invMass,weightpiKK);
1029  }
1030  }
1031 
1032 
1034 
1035  if(fFillSparse) {
1036 
1037  const Int_t nProng = 3;
1038  Double_t deltaMassKK=999.;
1039  Double_t dlen=d->DecayLength();
1040  Double_t dlenxy=d->DecayLengthXY();
1041  Double_t normdl=d->NormalizedDecayLength();
1042  Double_t normdlxy=d->NormalizedDecayLengthXY();
1043  Double_t cosp=d->CosPointingAngle();
1044  Double_t cospxy=d->CosPointingAngleXY();
1045  Double_t pt0=d->PtProng(0);
1046  Double_t pt1=d->PtProng(1);
1047  Double_t pt2=d->PtProng(2);
1048  Double_t sigvert=d->GetSigmaVert();
1049  Double_t cosPiDs=-99.;
1050  Double_t cosPiKPhi=-99.;
1051  Double_t normIP; //to store the maximum topomatic var. among the 3 prongs
1052  Double_t normIPprong[nProng]; //to store IP of k,k,pi
1053  if(isPhiKKpi) {
1054  Double_t tmpNormIP[nProng];
1055 
1056  invMass = d->InvMassDsKKpi();
1057  massKK = d->InvMass2Prongs(0,1,321,321);
1058  deltaMassKK = TMath::Abs(massKK-massPhi);
1059  cosPiDs = d->CosPiDsLabFrameKKpi();
1060  cosPiKPhi = d->CosPiKPhiRFrameKKpi();
1061  cosPiKPhi = TMath::Abs(cosPiKPhi*cosPiKPhi*cosPiKPhi);
1062 
1063  for(Int_t ip=0; ip<nProng; ip++) {
1064  Double_t diffIP, errdiffIP;
1065  d->Getd0MeasMinusExpProng(ip,aod->GetMagneticField(),diffIP,errdiffIP);
1066  tmpNormIP[ip] = diffIP/errdiffIP;
1067  if(ip==0) normIP = tmpNormIP[ip];
1068  else if(TMath::Abs(tmpNormIP[ip])>TMath::Abs(normIP)) normIP = tmpNormIP[ip];
1069  }
1070  normIPprong[0] = tmpNormIP[0];
1071  normIPprong[1] = tmpNormIP[1];
1072  normIPprong[2] = tmpNormIP[2];
1073 
1074  Double_t var4nSparse[knVarForSparse] = {invMass,ptCand,deltaMassKK,dlen,dlenxy,normdlxy,cosp,cospxy,
1075  sigvert,cosPiDs,cosPiKPhi,TMath::Abs(normIP)};
1076 
1077  if(!fReadMC) {
1078  fnSparse->Fill(var4nSparse);
1079  }
1080  else {
1081  if(indexMCKKpi==GetSignalHistoIndex(iPtBin)) {
1082  if(candType==1.5) fnSparseMC[2]->Fill(var4nSparse);
1083  if(candType==2.5) fnSparseMC[3]->Fill(var4nSparse);
1084  }
1085  else if(labDplus>=0 && pdgCode0==321) {
1086  if(candType==1.5) fnSparseMCDplus[2]->Fill(var4nSparse);
1087  if(candType==2.5) fnSparseMCDplus[3]->Fill(var4nSparse);
1088  }
1089  }
1090  }
1091  if(isPhipiKK) {
1092  Double_t tmpNormIP[nProng];
1093 
1094  invMass = d->InvMassDspiKK();
1095  massKK = d->InvMass2Prongs(1,2,321,321);
1096  deltaMassKK = TMath::Abs(massKK-massPhi);
1097  cosPiDs = d->CosPiDsLabFramepiKK();
1098  cosPiKPhi = d->CosPiKPhiRFramepiKK();
1099  cosPiKPhi = TMath::Abs(cosPiKPhi*cosPiKPhi*cosPiKPhi);
1100 
1101  for(Int_t ip=0; ip<nProng; ip++) {
1102  Double_t diffIP, errdiffIP;
1103  d->Getd0MeasMinusExpProng(ip,aod->GetMagneticField(),diffIP,errdiffIP);
1104  tmpNormIP[ip] = diffIP/errdiffIP;
1105  if(ip==0) normIP = tmpNormIP[ip];
1106  else if(TMath::Abs(tmpNormIP[ip])>TMath::Abs(normIP)) normIP = tmpNormIP[ip];
1107  }
1108 
1109  normIPprong[0] = tmpNormIP[2];
1110  normIPprong[1] = tmpNormIP[1];
1111  normIPprong[2] = tmpNormIP[0];
1112 
1113  Double_t var4nSparse[knVarForSparse] = {invMass,ptCand,deltaMassKK,dlen,dlenxy,normdlxy,cosp,cospxy,
1114  sigvert,cosPiDs,cosPiKPhi,TMath::Abs(normIP)};
1115 
1116  if(!fReadMC) {
1117  fnSparse->Fill(var4nSparse);
1118  }
1119  else {
1120  if(indexMCpiKK==GetSignalHistoIndex(iPtBin)) {
1121  if(candType==1.5) fnSparseMC[2]->Fill(var4nSparse);
1122  if(candType==2.5) fnSparseMC[3]->Fill(var4nSparse);
1123  }
1124  else if(labDplus>=0 && pdgCode0==211) {
1125  if(candType==1.5) fnSparseMCDplus[2]->Fill(var4nSparse);
1126  if(candType==2.5) fnSparseMCDplus[3]->Fill(var4nSparse);
1127  }
1128  }
1129  }
1130 
1131  if(fReadMC && (isPhiKKpi || isPhiKKpi)) {
1132  Double_t var[6] = {ptCand,normIP,normIPprong[0],normIPprong[1],normIPprong[2],candType};
1133  fnSparseIP->Fill(var);
1134  }
1135  }
1137 
1138  if(fDoCutVarHistos){
1139  Double_t dlen=d->DecayLength();
1140  Double_t cosp=d->CosPointingAngle();
1141  Double_t pt0=d->PtProng(0);
1142  Double_t pt1=d->PtProng(1);
1143  Double_t pt2=d->PtProng(2);
1144  Double_t sigvert=d->GetSigmaVert();
1145  Double_t sumD02=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
1146  Double_t dca=d->GetDCA();
1147  Double_t ptmax=0;
1148  for(Int_t i=0;i<3;i++){
1149  if(d->PtProng(i)>ptmax)ptmax=d->PtProng(i);
1150  }
1151  fCosPHist[index]->Fill(cosp);
1152  fDLenHist[index]->Fill(dlen);
1153  fSigVertHist[index]->Fill(sigvert);
1154  fSumd02Hist[index]->Fill(sumD02);
1155  fPtMaxHist[index]->Fill(ptmax);
1156  fDCAHist[index]->Fill(dca);
1157  fPtProng0Hist[index]->Fill(pt0);
1158  fPtProng1Hist[index]->Fill(pt1);
1159  fPtProng2Hist[index]->Fill(pt2);
1160  if(isKKpi){
1161  Double_t massKK=d->InvMass2Prongs(0,1,321,321);
1162  Double_t massKp=d->InvMass2Prongs(1,2,321,211);
1163  fDalitz[index]->Fill(massKK,massKp);
1164  if(isPhiKKpi) fDalitzPhi[index]->Fill(massKK,massKp);
1165  if(isK0starKKpi) fDalitzK0st[index]->Fill(massKK,massKp);
1166  if(fReadMC && indexMCKKpi!=-1){
1167  fDalitz[indexMCKKpi]->Fill(massKK,massKp);
1168  if(isPhiKKpi) fDalitzPhi[indexMCKKpi]->Fill(massKK,massKp);
1169  if(isK0starKKpi) fDalitzK0st[indexMCKKpi]->Fill(massKK,massKp);
1170  fCosPHist[indexMCKKpi]->Fill(cosp);
1171  fDLenHist[indexMCKKpi]->Fill(dlen);
1172  fSigVertHist[indexMCKKpi]->Fill(sigvert);
1173  fSumd02Hist[indexMCKKpi]->Fill(sumD02);
1174  fPtMaxHist[indexMCKKpi]->Fill(ptmax);
1175  fPtCandHist[indexMCKKpi]->Fill(ptCand);
1176  fDCAHist[indexMCKKpi]->Fill(dca);
1177  fPtProng0Hist[indexMCKKpi]->Fill(pt0);
1178  fPtProng1Hist[indexMCKKpi]->Fill(pt1);
1179  fPtProng2Hist[indexMCKKpi]->Fill(pt2);
1180  }
1181  }
1182  if(ispiKK){
1183  Double_t massKK=d->InvMass2Prongs(1,2,321,321);
1184  Double_t massKp=d->InvMass2Prongs(0,1,211,321);
1185  fDalitz[index]->Fill(massKK,massKp);
1186  if(isPhipiKK) fDalitzPhi[index]->Fill(massKK,massKp);
1187  if(isK0starpiKK) fDalitzK0st[index]->Fill(massKK,massKp);
1188 
1189 
1190  if(fReadMC && indexMCpiKK!=-1){
1191  fDalitz[indexMCpiKK]->Fill(massKK,massKp);
1192  if(isPhipiKK) fDalitzPhi[indexMCpiKK]->Fill(massKK,massKp);
1193  if(isK0starpiKK) fDalitzK0st[indexMCpiKK]->Fill(massKK,massKp);
1194  fCosPHist[indexMCpiKK]->Fill(cosp);
1195  fDLenHist[indexMCpiKK]->Fill(dlen);
1196  fSigVertHist[indexMCpiKK]->Fill(sigvert);
1197  fSumd02Hist[indexMCpiKK]->Fill(sumD02);
1198  fPtMaxHist[indexMCpiKK]->Fill(ptmax);
1199  fPtCandHist[indexMCpiKK]->Fill(ptCand);
1200  fDCAHist[indexMCpiKK]->Fill(dca);
1201  fPtProng0Hist[indexMCpiKK]->Fill(pt0);
1202  fPtProng1Hist[indexMCpiKK]->Fill(pt1);
1203  fPtProng2Hist[indexMCpiKK]->Fill(pt2);
1204  }
1205  }
1206 
1207 
1208  }
1209 
1210  Float_t tmp[37];
1211  if(fFillNtuple>0){
1212 
1213  if ((fFillNtuple==1 && (isPhiKKpi || isPhipiKK)) || (fFillNtuple==2 && (isK0starKKpi || isK0starpiKK)) || (fFillNtuple==3 && (isKKpi || ispiKK))){
1214 
1215  AliAODTrack *track0=(AliAODTrack*)d->GetDaughter(0);
1216  AliAODTrack *track1=(AliAODTrack*)d->GetDaughter(1);
1217  AliAODTrack *track2=(AliAODTrack*)d->GetDaughter(2);
1218 
1219  UInt_t bitMapPIDTrack0=fAnalysisCuts->GetPIDTrackTPCTOFBitMap(track0);
1220  UInt_t bitMapPIDTrack1=fAnalysisCuts->GetPIDTrackTPCTOFBitMap(track1);
1221  UInt_t bitMapPIDTrack2=fAnalysisCuts->GetPIDTrackTPCTOFBitMap(track2);
1222 
1223  tmp[0]=Float_t(labDs);
1224  if(fReadMC && fWriteOnlySignal) tmp[0]=Float_t(isMCSignal);
1225  tmp[1]=Float_t(retCodeAnalysisCuts);
1226  tmp[2]=Float_t(pdgCode0);
1227  tmp[3]=d->PtProng(0);
1228  tmp[4]=d->PtProng(1);
1229  tmp[5]=d->PtProng(2);
1230  tmp[6]=d->Pt();
1231  tmp[7]=d->PProng(0);
1232  tmp[8]=d->PProng(1);
1233  tmp[9]=d->PProng(2);
1234  tmp[10]=Int_t(bitMapPIDTrack0);
1235  tmp[11]=Int_t(bitMapPIDTrack1);
1236  tmp[12]=Int_t(bitMapPIDTrack2);
1237  tmp[13]=d->CosPointingAngle();
1238  tmp[14]=d->CosPointingAngleXY();
1239  tmp[15]=d->DecayLength();
1240  tmp[16]=d->DecayLengthXY();
1241  tmp[17]=d->NormalizedDecayLength();
1242  tmp[18]=d->NormalizedDecayLengthXY();
1243  tmp[19]=d->InvMassDsKKpi();
1244  tmp[20]=d->InvMassDspiKK();
1245  tmp[21]=d->GetSigmaVert();
1246  tmp[22]=d->Getd0Prong(0);
1247  tmp[23]=d->Getd0Prong(1);
1248  tmp[24]=d->Getd0Prong(2);
1249  tmp[25]=d->GetDCA();
1250  tmp[26]=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
1251  tmp[27]=d->InvMass2Prongs(0,1,321,321);
1252  tmp[28]=d->InvMass2Prongs(1,2,321,321);
1253  tmp[29]=d->InvMass2Prongs(1,2,321,211);
1254  tmp[30]=d->InvMass2Prongs(0,1,211,321);
1255  tmp[31]=d->CosPiDsLabFrameKKpi();
1256  tmp[32]=d->CosPiDsLabFramepiKK();
1257  tmp[33]=d->CosPiKPhiRFrameKKpi();
1258  tmp[34]=d->CosPiKPhiRFramepiKK();
1259  tmp[35]=(Float_t)(centrality);
1260  tmp[36]=(Float_t)(runNumber);
1261 
1262  if(fReadMC && fWriteOnlySignal){
1263  if(isMCSignal>=0) fNtupleDs->Fill(tmp);
1264  }else{
1265  fNtupleDs->Fill(tmp);
1266  }
1267  PostData(4,fNtupleDs);
1268  }
1269  }
1270  } //if(retCodeAnalysisCuts
1271  } // if(isFidAcc)
1272 
1273  if(unsetvtx) d->UnsetOwnPrimaryVtx();
1274  if(recVtx)fAnalysisCuts->CleanOwnPrimaryVtx(d,aod,origownvtx);
1275  }
1276 
1277  fCounter->StoreCandidates(aod,nFiltered,kTRUE);
1278  fCounter->StoreCandidates(aod,nSelected,kFALSE);
1279 
1280  delete vHF;
1281 
1282  PostData(1,fOutput);
1283  PostData(3,fCounter);
1284 
1285  return;
1286 }
1287 
1288 //_________________________________________________________________
1289 
1291 {
1293  //
1294  if(fDebug > 1) printf("AnalysisTaskSEDs: Terminate() \n");
1295  fOutput = dynamic_cast<TList*> (GetOutputData(1));
1296  if (!fOutput) {
1297  printf("ERROR: fOutput not available\n");
1298  return;
1299  }
1300  fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("hNEvents"));
1301  if(fHistNEvents){
1302  printf("Number of analyzed events = %d\n",(Int_t)fHistNEvents->GetBinContent(2));
1303  }else{
1304  printf("ERROR: fHistNEvents not available\n");
1305  return;
1306  }
1307  return;
1308 }
1309 
1310 //_________________________________________________________________
1311 void AliAnalysisTaskSEDs::FillMCGenAccHistos(TClonesArray *arrayMC, AliAODMCHeader *mcHeader){
1313 
1314  Int_t nProng = 3;
1315  Double_t zMCVertex = mcHeader->GetVtxZ(); //vertex MC
1316  if(TMath::Abs(zMCVertex) <= fAnalysisCuts->GetMaxVtxZ()) {
1317  for(Int_t iPart=0; iPart<arrayMC->GetEntriesFast(); iPart++){
1318 
1319  AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(arrayMC->At(iPart));
1320 
1321  if(TMath::Abs(mcPart->GetPdgCode()) == 431) {
1322  Int_t orig = AliVertexingHFUtils::CheckOrigin(arrayMC,mcPart,kTRUE);//Prompt = 4, FeedDown = 5
1323 
1324  Int_t deca = 0;
1325  Bool_t isGoodDecay = kFALSE;
1326  Int_t labDau[3] = {-1,-1,-1};
1327  Bool_t isFidAcc = kFALSE;
1328  Bool_t isDaugInAcc = kFALSE;
1329 
1330  deca = AliVertexingHFUtils::CheckDsDecay(arrayMC,mcPart,labDau);
1331  if(deca == 1) isGoodDecay=kTRUE; // == 1 -> Phi pi -> kkpi
1332 
1333  if(labDau[0]==-1) continue; //protection against unfilled array of labels
1334 
1335  if(isGoodDecay) {
1336  Double_t pt = mcPart->Pt();
1337  Double_t rapid = mcPart->Y();
1338  isFidAcc = fAnalysisCuts->IsInFiducialAcceptance(pt,rapid);
1339  isDaugInAcc = CheckDaugAcc(arrayMC,nProng,labDau);
1340 
1341  if(isFidAcc) {
1342  Double_t var4nSparseAcc[2] = {pt,rapid};
1343  if(isDaugInAcc) {
1344  if(orig==4) fnSparseMC[0]->Fill(var4nSparseAcc);
1345  if(orig==5) fnSparseMC[1]->Fill(var4nSparseAcc);
1346  }
1347  }
1348  }
1349  }
1350 
1351  if(fFillSparseDplus && TMath::Abs(mcPart->GetPdgCode()) == 411) {
1352  Int_t orig = AliVertexingHFUtils::CheckOrigin(arrayMC,mcPart,kTRUE);//Prompt = 4, FeedDown = 5
1353 
1354  Int_t deca = 0;
1355  Bool_t isGoodDecay = kFALSE;
1356  Int_t labDau[3] = {-1,-1,-1};
1357  Bool_t isFidAcc = kFALSE;
1358  Bool_t isDaugInAcc = kFALSE;
1359 
1360  deca = AliVertexingHFUtils::CheckDplusKKpiDecay(arrayMC,mcPart,labDau);
1361  if(deca == 1) isGoodDecay=kTRUE; // == 1 -> Phi pi -> kkpi
1362 
1363  if(labDau[0]==-1) continue; //protection against unfilled array of labels
1364 
1365  if(isGoodDecay) {
1366  Double_t pt = mcPart->Pt();
1367  Double_t rapid = mcPart->Y();
1368  isFidAcc = fAnalysisCuts->IsInFiducialAcceptance(pt,rapid);
1369  isDaugInAcc = CheckDaugAcc(arrayMC,nProng,labDau);
1370 
1371  if(isFidAcc) {
1372  Double_t var4nSparseAcc[2] = {pt,rapid};
1373  if(isDaugInAcc) {
1374  if(orig==4) fnSparseMCDplus[0]->Fill(var4nSparseAcc);
1375  if(orig==5) fnSparseMCDplus[1]->Fill(var4nSparseAcc);
1376  }
1377  }
1378  }
1379  }
1380  }
1381  }
1382 }
1383 //_________________________________________________________________
1384 Bool_t AliAnalysisTaskSEDs::CheckDaugAcc(TClonesArray* arrayMC,Int_t nProng, Int_t *labDau){
1386 
1387  for (Int_t iProng = 0; iProng<nProng; iProng++){
1388  AliAODMCParticle* mcPartDaughter=dynamic_cast<AliAODMCParticle*>(arrayMC->At(labDau[iProng]));
1389  if(!mcPartDaughter) {
1390  return kFALSE;
1391  }
1392  Double_t eta = mcPartDaughter->Eta();
1393  Double_t pt = mcPartDaughter->Pt();
1394  if (TMath::Abs(eta) > 0.9 || pt < 0.1) {
1395  return kFALSE;
1396  }
1397  }
1398  return kTRUE;
1399 }
1400 
1401 //_________________________________________________________________
1402 
1404 
1405  const Int_t nprongs = 3;
1406  Double_t PxProng[nprongs], PyProng[nprongs], PtProng[nprongs], PzProng[nprongs], P2Prong[nprongs], mProng[nprongs];
1407  Double_t Px, Py, Pz, P2;
1408  UInt_t pdg[3]={321,321,211};
1409  int idPion = 2;
1410  if(dec==2) {
1411  pdg[0]=211;
1412  pdg[2]=321;
1413  idPion = 0;
1414  }
1415 
1416  for (Int_t ip=0; ip<nprongs; ip++) {
1417  PxProng[ip] = d->PxProng(ip);
1418  PyProng[ip] = d->PxProng(ip);
1419  PtProng[ip] = d->PtProng(ip);
1420  PzProng[ip] = d->PzProng(ip);
1421  P2Prong[ip] = d->P2Prong(ip);
1422  mProng[ip] = TDatabasePDG::Instance()->GetParticle(pdg[ip])->Mass();
1423  }
1424 
1425  for(Int_t i=0; i<9; i++) { //9 rotations implemented for the pion track around Pi
1426  Px = 0.;
1427  Py = 0.;
1428  Pz = 0.;
1429  Double_t theta = 0.;
1430  theta = TMath::ATan(PyProng[idPion]/PxProng[idPion]);
1431  if (PxProng[idPion]<0.) theta += TMath::Pi();
1432  theta += TMath::Pi()*(5/6 + 1/27*i);
1433 
1434  PxProng[idPion] = PtProng[idPion]*TMath::Cos(theta);
1435  PyProng[idPion] = PtProng[idPion]*TMath::Sin(theta);
1436  P2Prong[idPion] = PtProng[idPion]*PtProng[idPion] + PzProng[idPion]*PzProng[idPion];
1437 
1438  for (Int_t j=0; j<nprongs; j++) {
1439  Px += PxProng[j];
1440  Py += PyProng[j];
1441  Pz += PzProng[j];
1442  }
1443  P2 = Px*Px + Py*Py + Pz*Pz;
1444 
1445  Double_t energysum = 0.;
1446  for(Int_t j=0; j<nprongs; j++) {
1447  energysum += TMath::Sqrt(mProng[j]*mProng[j]+P2Prong[j]);
1448  }
1449  Double_t mass = TMath::Sqrt(energysum*energysum-P2);
1450  if(fminMass<=mass<fmaxMass) fMassRotBkgHistPhi[iPtBin]->Fill(mass);
1451  }
1452 }
1453 
1454 
1455 //_________________________________________________________________
1456 
1458 
1459  Double_t massDs;
1460  Double_t massPhi=TDatabasePDG::Instance()->GetParticle(333)->Mass();
1461  if(dec==1) massDs = d->InvMassDsKKpi();
1462  else if(dec==2) d->InvMassDspiKK();
1463  if(massKK<massPhi)fMassLSBkgHistPhi[iPtBin]->Fill(massDs);
1464  else fMassRSBkgHistPhi[iPtBin]->Fill(massDs);
1465 }
1466 
1467 
1468 
1469 
1470 
1471 
1472 
1473 
Double_t NormalizedDecayLengthXY() const
Bool_t IsEventRejectedDueToCentrality() const
Definition: AliRDHFCuts.h:317
Int_t pdg
THnSparseF * fnSparseMCDplus[4]
TH1F * fPtMaxHist[4 *kMaxPtBins]
! hist. for Pt Max (Prod Cuts)
Bool_t IsEventRejectedDueToZVertexOutsideFiducialRegion() const
Definition: AliRDHFCuts.h:311
Double_t NormalizedDecayLength() const
THnSparseF * fnSparseMC[4]
!<!THnSparse for topomatic variable
Bool_t IsEventRejectedDueToNotRecoVertex() const
Definition: AliRDHFCuts.h:305
double Double_t
Definition: External.C:58
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
Definition: External.C:236
void Getd0MeasMinusExpProng(Int_t ip, Double_t magf, Double_t &d0diff, Double_t &errd0diff) const
TH1F * fPtProng1Hist[4 *kMaxPtBins]
! hist. for DCA (Prod Cuts)
void SetPtBins(Int_t n, Float_t *lim)
Int_t IsEventSelectedInCentrality(AliVEvent *event)
Bool_t HasSelectionBit(Int_t i) const
TH2F * fDalitzK0st[4 *kMaxPtBins]
! dalitz plot via K0* (sig,bkg,tot)
Bool_t fFillSparseDplus
flag for usage of THnSparse
Double_t mass
Double_t CosPiDsLabFrameKKpi() const
centrality
Int_t GetHistoIndex(Int_t iPtBin) const
static Int_t CheckMatchingAODdeltaAODevents()
Double_t fMassRange
limits for pt bins
Bool_t IsEventRejectedDueToVertexContributors() const
Definition: AliRDHFCuts.h:308
TH2F * fPtVsMass
! hist. of pt vs. mass (prod. cuts)
static Int_t CheckDsDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
Double_t CosPointingAngleXY() const
TH1F * fPtProng0Hist[4 *kMaxPtBins]
! hist. for Pt Max (Prod Cuts)
Bool_t FillRecoCand(AliVEvent *event, AliAODRecoDecayHF3Prong *rd3)
TH2F * fYVsPtSig
! hist. of Y vs. Pt (MC, only sig, prod. cuts)
Int_t GetPidOption() const
virtual void UserCreateOutputObjects()
Implementation of interface methods.
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
Bool_t fFillSparse
flag for usage of HasSelectionBit
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:243
TH1F * fSumd02Hist[4 *kMaxPtBins]
! hist. for sum d02 (Prod Cuts)
UInt_t GetPIDTrackTPCTOFBitMap(AliAODTrack *track) const
TH1F * fMassHistPhi[4 *kMaxPtBins]
! hist. of mass spectra via phi (sig,bkg,tot)
Bool_t fDoBkgPhiSB
flag to create rotational bkg (rotating pi track)
THnSparseF * fnSparse
Cuts for Analysis.
TNtuple * fNtupleDs
! output ntuple
TH1F * fMassRotBkgHistPhi[kMaxPtBins]
! hist. of bkg generated from rot. of the pion
void GenerateRotBkg(AliAODRecoDecayHF3Prong *d, Int_t dec, Int_t iPtBin)
Bool_t fDoRotBkg
flag for usage of THnSparse
TH1F * fHistCentrality[3]
!hist. for cent distr (all,sel ev, )
int Int_t
Definition: External.C:63
AliNormalizationCounter * fCounter
flag to set mass window of phi meson (when using pion rotation to create bkg)
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
TH2F * fHistCentralityMult[3]
!hist. for cent distr vs mult (all,sel ev, )
const Double_t ptmax
TH1F * fHistNEvents
! hist. for No. of events
AliRDHFCutsDstoKKpi * fAnalysisCuts
TList * fOutput
! list send on output slot 0
TH2F * fHistAllV0multNTPCout
! histo for V0mult vs #tracks TPCout (all)
Double_t CosPiKPhiRFrameKKpi() const
AliAODVertex * GetOwnPrimaryVtx() const
void GenerateBkgFromPhiSB(AliAODRecoDecayHF3Prong *d, Int_t dec, Int_t iPtBin, Double_t massKK)
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
Double_t GetSigmaVert(const AliAODEvent *aod=0x0)
THnSparseF * fnSparseIP
!<!THnSparse for candidates on data
Bool_t CheckDaugAcc(TClonesArray *arrayMC, Int_t nProng, Int_t *labDau)
TH2F * fDalitzPhi[4 *kMaxPtBins]
! dalitz plot via phi (sig,bkg,tot)
TH2F * fHistSelV0multNTPCout
! histo for V0mult vs #tracks TPCout (sel)
Float_t GetCentrality(AliAODEvent *aodEvent)
Definition: AliRDHFCuts.h:244
Bool_t IsEventRejectedDueToPileup() const
Definition: AliRDHFCuts.h:314
static Int_t CheckDplusKKpiDecay(AliStack *stack, Int_t label, Int_t *arrayDauLab)
TH1F * fMassHistKpi[kMaxPtBins]
! hist. of mass spectra of Kpi
TH1F * fMassRSBkgHistPhi[kMaxPtBins]
! hist. of bkg generated from right phi sideband + pion
Bool_t IsCutOnResonancesApplied() const
TH1F * fPtCandHist[4 *kMaxPtBins]
! hist. for Pt Max (Prod Cuts)
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)
void FillMCGenAccHistos(TClonesArray *arrayMC, AliAODMCHeader *mcHeader)
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
Double_t CosPiDsLabFramepiKK() const
Bool_t fReadMC
0 = pp, 1 = pPb,PbPb
Double_t DecayLengthXY() const
Int_t fAODProtection
flag to activate cut on V0mult vs #tracks TPCout
Bool_t GetIsPrimaryWithoutDaughters() const
Definition: AliRDHFCuts.h:264
Int_t GetSignalHistoIndex(Int_t iPtBin) const
Bool_t IsEventSelected(AliVEvent *event)
TH1F * fMassLSBkgHistPhi[kMaxPtBins]
! hist. of bkg generated from left phi sideband + pion
virtual void UserExec(Option_t *option)
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
Int_t GetReflSignalHistoIndex(Int_t iPtBin) const
virtual void Terminate(Option_t *option)
TH1F * fCosPHist[4 *kMaxPtBins]
! hist. of cos pointing angle (sig,bkg,tot)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Double_t minMass
Bool_t fDoCutV0multTPCout
flag to create bkg from phi sidebands
void CleanOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod, AliAODVertex *origownvtx) const
Float_t * GetPtBinLimits() const
Definition: AliRDHFCuts.h:234
TH1F * fDLenHist[4 *kMaxPtBins]
! hist. of decay length (sig,bkg,tot)
Bool_t fUseSelectionBit
flag to create and fill histos with distributions of cut variables
Double_t GetWeightForpiKK() const
Double_t GetWeightForKKpi() const
const char Option_t
Definition: External.C:48
TH1F * fChanHist[4]
! hist. with KKpi and piKK candidates (sig,bkg,tot)
TH1F * fMassHist[4 *kMaxPtBins]
! hist. of mass spectra (sig,bkg,tot)
Int_t GetNPtBins() const
Definition: AliRDHFCuts.h:235
TH1F * fDCAHist[4 *kMaxPtBins]
! hist. for DCA (Prod Cuts)
Bool_t IsEventRejectedDueToTrigger() const
Definition: AliRDHFCuts.h:302
Bool_t fDoCutVarHistos
flag to control ntuple writing in MC
Double_t maxMass
TH1F * fPtProng2Hist[4 *kMaxPtBins]
! hist. for DCA (Prod Cuts)
bool Bool_t
Definition: External.C:53
Double_t CosPointingAngle() const
TH2F * fDalitz[4 *kMaxPtBins]
! dalitz plot (sig,bkg,tot)
Int_t GetUseCentrality() const
Definition: AliRDHFCuts.h:266
TH1F * fSigVertHist[4 *kMaxPtBins]
! hist. for sigVert (Prod Cuts)
Bool_t RecalcOwnPrimaryVtx(AliAODRecoDecayHF *d, AliAODEvent *aod) const
Double_t DecayLength() const
TH2F * fPtVsMassPhi
! hist. of pt vs. mass (phi selection)
TH1F * fMassHistKK[kMaxPtBins]
! hist. of mass spectra of KK
Double_t CosPiKPhiRFramepiKK() const
Int_t nptbins
TH1F * fMassHistK0st[4 *kMaxPtBins]
! hist. of mass spectra via K0* (sig,bkg,tot)
TH2F * fYVsPt
! hist. of Y vs. Pt (prod. cuts)
TH2F * fPtVsMassK0st
! hist. of pt vs. mass (K0* selection)
TList * fListCuts
number of Pt bins
void ApplyCutOnResonances(Bool_t opt=kTRUE)
TList * OpenFile(const char *fname)
Definition: DrawAnaELoss.C:65
UChar_t fNPtBins
-1: no protection, 0: check AOD/dAOD nEvents only, 1: check AOD/dAOD nEvents + TProcessID names ...
Bool_t fWriteOnlySignal
flag for access to MC
Double_t fMassBinSize
range for mass histogram
Double_t fminMass
bin size for inv. mass histo
Int_t GetBackgroundHistoIndex(Int_t iPtBin) const
Float_t fPtLimits[kMaxPtBins+1]