AliPhysics  a0db429 (a0db429)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
AliAnalysisTaskSELambdacTMVA.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: AliAnalysisTaskSELambdacTMVA.cxx$ */
17 
18 //*************************************************************************
19 // AliAnalysisTaskSE for the Lambdac candidates, for TMVA analysis,
20 // and checks on MC generated and reconstructed Lambdac
21 //
22 // Modified from AliAnalysisTaskSELambdac
23 // Authors: Jaime Norman (jaime.norman@cern.ch)
24 // Marcel Figueredo (marcel.figueredo@cern.ch)
25 //*************************************************************************
26 
27 
28 #include <TClonesArray.h>
29 #include <TNtuple.h>
30 #include <TCanvas.h>
31 #include <TList.h>
32 #include <TString.h>
33 #include <TH1F.h>
34 #include <TH2F.h>
35 #include <TDatabasePDG.h>
36 
37 #include <AliAnalysisDataSlot.h>
38 #include <AliAnalysisDataContainer.h>
39 #include "AliAnalysisManager.h"
40 #include "AliAODHandler.h"
41 #include "AliAODEvent.h"
42 #include "AliAODVertex.h"
43 #include "AliAODTrack.h"
44 #include "AliAODMCHeader.h"
45 #include "AliAODMCParticle.h"
47 #include "AliAnalysisVertexingHF.h"
48 #include "AliAnalysisTaskSE.h"
50 #include "AliKFParticle.h"
51 #include "AliAODPidHF.h"
52 #include "AliRDHFCutsLctopKpi.h"
53 #include "AliRDHFCuts.h"
54 #include "AliKFVertex.h"
55 #include "AliESDVertex.h"
56 //#include "AliAODpidUtil.h"
57 #include "AliAODPid.h"
58 #include "AliInputEventHandler.h"
59 #include "AliPID.h"
61 #include "AliVertexingHFUtils.h"
62 #include "AliCFVertexingHF3Prong.h"
63 #include "AliCFTaskVertexingHF.h"
64 #include "AliLog.h"
65 
69 
70  //________________________________________________________________________
72  AliAnalysisTaskSE(),
73  fOutput(0),
74  fHistNEvents(0),
75  fHistNEventsRejTM(0),
76  fhPIDmassLcPt(0),
77  fhPIDmassLcPtSig(0),
78  fhPIDmassLcPtSigc(0),
79  fhPIDmassLcPtSigb(0),
80  fhMCmassLcPt(0),
81  fhMCmassLcPtSig(0),
82  fhMCmassLcPtSigc(0),
83  fhMCmassLcPtSigb(0),
84  fhProbmassLcPt(0),
85  fhProbmassLcPtSig(0),
86  fhProbmassLcPtSigc(0),
87  fhProbmassLcPtSigb(0),
88  fhIsLcResonantGen(0),
89  fhIsLcResonantReco(0),
90  fhIsLcGen(0),
91  fhIsLcReco(0),
92  fhRecoPDGmom(0),
93  fhSelectBit(0),
94  fhSelectionBits(0),
95  fhSelectionBitsSigc(0),
96  fhSelectionBitsSigb(0),
97  fNtupleLambdac(0),
98  fIsLc(0),
99  fIsLcResonant(0),
100  fRDCutsAnalysis(0),
101  fListCuts(0),
102  fFillNtuple(0),
103  fUpmasslimit(2.486),
104  fLowmasslimit(2.086),
105  fReadMC(kFALSE),
106  fMCPid(kFALSE),
107  fRealPid(kFALSE),
108  fResPid(kTRUE),
109  fUseKF(kFALSE),
110  fAnalysis(kFALSE),
111  fVHF(0),
112  fLcCut(kFALSE),
113  fLcPIDCut(kFALSE),
114  fKeepLcNotFromQuark(kFALSE),
115  fIsHijing(kFALSE),
116  fKeepBkgNt(kTRUE),
117  fSyst(2),
118  fNentries(0),
119  fPIDResponse(0),
120  fCounter(0),
121  fVertUtil(0)
122 
123 {
124  //
126  //
127 
128  for(Int_t i=0;i<12;i++) {
129  fhNBkgNI[i]=0x0;
130  fhNLc[i]=0x0;
131  fhNLcc[i]=0x0;
132  fhNLcNonRc[i]=0x0;
133  fhNLcL1520c[i]=0x0;
134  fhNLcKstarc[i]=0x0;
135  fhNLcDeltac[i]=0x0;
136  fhNLcb[i]=0x0;
137  fhNLcNonRb[i]=0x0;
138  fhNLcL1520b[i]=0x0;
139  fhNLcKstarb[i]=0x0;
140  fhNLcDeltab[i]=0x0;
141 
142  fhPtEtaBkgNI[i]=0x0;
143  fhPtEtaLc[i]=0x0;
144  fhPtEtaLcc[i]=0x0;
145  fhPtEtaLcNonRc[i]=0x0;
146  fhPtEtaLcL1520c[i]=0x0;
147  fhPtEtaLcKstarc[i]=0x0;
148  fhPtEtaLcDeltac[i]=0x0;
149  fhPtEtaLcb[i]=0x0;
150  fhPtEtaLcNonRb[i]=0x0;
151  fhPtEtaLcL1520b[i]=0x0;
152  fhPtEtaLcKstarb[i]=0x0;
153  fhPtEtaLcDeltab[i]=0x0;
154 
155  fhPtYBkgNI[i]=0x0;
156  fhPtYLc[i]=0x0;
157  fhPtYLcc[i]=0x0;
158  fhPtYLcNonRc[i]=0x0;
159  fhPtYLcL1520c[i]=0x0;
160  fhPtYLcKstarc[i]=0x0;
161  fhPtYLcDeltac[i]=0x0;
162  fhPtYLcb[i]=0x0;
163  fhPtYLcNonRb[i]=0x0;
164  fhPtYLcL1520b[i]=0x0;
165  fhPtYLcKstarb[i]=0x0;
166  fhPtYLcDeltab[i]=0x0;
167 
168  fhPtPhiBkgNI[i]=0x0;
169  fhPtPhiLc[i]=0x0;
170  fhPtPhiLcc[i]=0x0;
171  fhPtPhiLcNonRc[i]=0x0;
172  fhPtPhiLcL1520c[i]=0x0;
173  fhPtPhiLcKstarc[i]=0x0;
174  fhPtPhiLcDeltac[i]=0x0;
175  fhPtPhiLcb[i]=0x0;
176  fhPtPhiLcNonRb[i]=0x0;
177  fhPtPhiLcL1520b[i]=0x0;
178  fhPtPhiLcKstarb[i]=0x0;
179  fhPtPhiLcDeltab[i]=0x0;
180 
181  }
182 }
183 
184 //________________________________________________________________________
186  AliAnalysisTaskSE(name),
187  fOutput(0),
188  fHistNEvents(0),
189  fHistNEventsRejTM(0),
190  fhPIDmassLcPt(0),
191  fhPIDmassLcPtSig(0),
192  fhPIDmassLcPtSigc(0),
193  fhPIDmassLcPtSigb(0),
194  fhMCmassLcPt(0),
195  fhMCmassLcPtSig(0),
196  fhMCmassLcPtSigc(0),
197  fhMCmassLcPtSigb(0),
198  fhProbmassLcPt(0),
199  fhProbmassLcPtSig(0),
200  fhProbmassLcPtSigc(0),
201  fhProbmassLcPtSigb(0),
202  fhIsLcResonantGen(0),
203  fhIsLcResonantReco(0),
204  fhIsLcGen(0),
205  fhIsLcReco(0),
206  fhRecoPDGmom(0),
207  fhSelectBit(0),
208  fhSelectionBits(0),
209  fhSelectionBitsSigc(0),
210  fhSelectionBitsSigb(0),
211  fNtupleLambdac(0),
212  fIsLc(0),
213  fIsLcResonant(0),
214  fRDCutsAnalysis(lccutsana),
215  fListCuts(0),
216  fUpmasslimit(2.486),
217  fLowmasslimit(2.086),
218  fFillNtuple(fillNtuple),
219  fReadMC(kFALSE),
220  fMCPid(kFALSE),
221  fRealPid(kFALSE),
222  fResPid(kTRUE),
223  fUseKF(kFALSE),
224  fAnalysis(kFALSE),
225  fVHF(0),
226  fLcCut(kFALSE),
227  fLcPIDCut(kFALSE),
228  fKeepLcNotFromQuark(kFALSE),
229  fIsHijing(kFALSE),
230  fKeepBkgNt(kTRUE),
231  fSyst(2),
232  fNentries(0),
233  fPIDResponse(0),
234  fCounter(0),
235  fVertUtil(0)
236 {
237  //
240  //
241  for(Int_t i=0;i<12;i++) {
242  fhNBkgNI[i]=0x0;
243  fhNLc[i]=0x0;
244  fhNLcc[i]=0x0;
245  fhNLcNonRc[i]=0x0;
246  fhNLcL1520c[i]=0x0;
247  fhNLcKstarc[i]=0x0;
248  fhNLcDeltac[i]=0x0;
249  fhNLcb[i]=0x0;
250  fhNLcNonRb[i]=0x0;
251  fhNLcL1520b[i]=0x0;
252  fhNLcKstarb[i]=0x0;
253  fhNLcDeltab[i]=0x0;
254 
255  fhPtEtaBkgNI[i]=0x0;
256  fhPtEtaLc[i]=0x0;
257  fhPtEtaLcc[i]=0x0;
258  fhPtEtaLcNonRc[i]=0x0;
259  fhPtEtaLcL1520c[i]=0x0;
260  fhPtEtaLcKstarc[i]=0x0;
261  fhPtEtaLcDeltac[i]=0x0;
262  fhPtEtaLcb[i]=0x0;
263  fhPtEtaLcNonRb[i]=0x0;
264  fhPtEtaLcL1520b[i]=0x0;
265  fhPtEtaLcKstarb[i]=0x0;
266  fhPtEtaLcDeltab[i]=0x0;
267 
268  fhPtYBkgNI[i]=0x0;
269  fhPtYLc[i]=0x0;
270  fhPtYLcc[i]=0x0;
271  fhPtYLcNonRc[i]=0x0;
272  fhPtYLcL1520c[i]=0x0;
273  fhPtYLcKstarc[i]=0x0;
274  fhPtYLcDeltac[i]=0x0;
275  fhPtYLcb[i]=0x0;
276  fhPtYLcNonRb[i]=0x0;
277  fhPtYLcL1520b[i]=0x0;
278  fhPtYLcKstarb[i]=0x0;
279  fhPtYLcDeltab[i]=0x0;
280 
281  fhPtPhiBkgNI[i]=0x0;
282  fhPtPhiLc[i]=0x0;
283  fhPtPhiLcc[i]=0x0;
284  fhPtPhiLcNonRc[i]=0x0;
285  fhPtPhiLcL1520c[i]=0x0;
286  fhPtPhiLcKstarc[i]=0x0;
287  fhPtPhiLcDeltac[i]=0x0;
288  fhPtPhiLcb[i]=0x0;
289  fhPtPhiLcNonRb[i]=0x0;
290  fhPtPhiLcL1520b[i]=0x0;
291  fhPtPhiLcKstarb[i]=0x0;
292  fhPtPhiLcDeltab[i]=0x0;
293 
294  }
296 
297  DefineOutput(1,TList::Class()); //My private output
298  DefineOutput(2,TList::Class());
299  DefineOutput(3,TH1F::Class());
300  DefineOutput(4,AliNormalizationCounter::Class());
301  if (fFillNtuple) {
302  // Output slot #2 writes into a TNtuple container
303  DefineOutput(5,TNtuple::Class()); //My private output
304  }
305 }
306 
307 
308 //________________________________________________________________________
310 {
311  //
313  //
314 
315  if (fOutput) {
316  delete fOutput;
317  fOutput = 0;
318  }
319 
320 
321  if (fVHF) {
322  delete fVHF;
323  fVHF = 0;
324  }
325 
326  if(fRDCutsAnalysis){
327  delete fRDCutsAnalysis;
328  fRDCutsAnalysis = 0;
329  }
330 
331  if (fListCuts) {
332  delete fListCuts;
333  fListCuts = 0;
334  }
335  if (fNentries){
336  delete fNentries;
337  fNentries = 0;
338  }
339  /*
340  if (fUtilPid){
341  delete fUtilPid;
342  fUtilPid = 0;
343  }
344  */
345  if (fPIDResponse) {
346  delete fPIDResponse;
347  }
348  if(fCounter){
349  delete fCounter;
350  fCounter = 0;
351  }
352  if(fVertUtil) {
353  delete fVertUtil;
354  fVertUtil = 0;
355  }
356 
357 }
358 
359 
360 
361 //_________________________________________________________________
363 {
364  //
366  //
367 
368  if (fDebug > 1) printf("AnalysisTaskSELambdac::Init() \n");
369 
370  fListCuts=new TList();
371  fListCuts->SetOwner();
372 
374  PostData(2,fListCuts);
375 
376  return;
377 }
378 
379 //________________________________________________________________________
381 {
382  //
384  //
385 
386  if (fDebug > 1) printf("AnalysisTaskSELambdac::UserCreateOutputObjects() \n");
387 
388  // Several histograms are more conveniently managed in a TList
389  fOutput = new TList();
390  fOutput->SetOwner();
391  fOutput->SetName("OutputHistos");
392 
393  TString hisname,histitle;
394 
395  //Lc bit QA
396  fhSelectBit = new TH1F("hSelectBit","hSelectBit",5,-0.5,4.5);
397  fhSelectBit->GetXaxis()->SetBinLabel(2,"All");
398  fhSelectBit->GetXaxis()->SetBinLabel(3,"SelectionMap");
399  fhSelectBit->GetXaxis()->SetBinLabel(4,"!LcCut");
400  fhSelectBit->GetXaxis()->SetBinLabel(5,"!LcPID");
401  fhSelectBit->GetXaxis()->SetNdivisions(1,kFALSE);
402  fOutput->Add(fhSelectBit);
403 
404  fHistNEvents = new TH1F("fHistNEvents", "Number of processed events; ; Events",3,-0.5,2.5);
405  fHistNEvents->GetXaxis()->SetBinLabel(2,"N events");
406  fHistNEvents->GetXaxis()->SetBinLabel(3,"N events (after selection)");
407  fHistNEvents->GetXaxis()->SetNdivisions(1,kFALSE);
408  fHistNEvents->Sumw2();
409  fOutput->Add(fHistNEvents);
410 
411  fhPIDmassLcPt = new TH2F("hPIDmassLcPt","hPIDmassLcPt;3-Prong p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
412  fhPIDmassLcPtSig = new TH2F("hPIDmassLcPtSig","hPIDmassLcPtSig;3-Prong signal p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
413  fhPIDmassLcPtSigc = new TH2F("hPIDmassLcPtSigc","hPIDmassLcPtSigc;3-Prong signal p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
414  fhPIDmassLcPtSigb = new TH2F("hPIDmassLcPtSigb","hPIDmassLcPtSigb;3-Prong signal p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
415  fhMCmassLcPt = new TH2F("hMCmassLcPt","hMCmassLcPt;3-Prong p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
416  fhMCmassLcPtSig = new TH2F("hMCmassLcPtSig","hMCmassLcPtSig;3-Prong signal p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
417  fhMCmassLcPtSigc = new TH2F("hMCmassLcPtSigc","hMCmassLcPtSigc;3-Prong signal p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
418  fhMCmassLcPtSigb = new TH2F("hMCmassLcPtSigb","hMCmassLcPtSigb;3-Prong signal p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
419  fhProbmassLcPt = new TH2F("hProbmassLcPt","hProbmassLcPt;3-Prong p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
420  fhProbmassLcPtSig = new TH2F("hProbmassLcPtSig","hProbmassLcPtSig;3-Prong signal p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
421  fhProbmassLcPtSigc = new TH2F("hProbmassLcPtSigc","hProbmassLcPtSigc;3-Prong signal p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
422  fhProbmassLcPtSigb = new TH2F("hProbmassLcPtSigb","hProbmassLcPtSigb;3-Prong signal p_{T} GeV/c;Invariant mass pK#pi (GeV/c)",150,0.,15.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
423  fOutput->Add(fhPIDmassLcPt);
427  fOutput->Add(fhMCmassLcPt);
428  fOutput->Add(fhMCmassLcPtSig);
431  fOutput->Add(fhProbmassLcPt);
435 
436  fhIsLcResonantGen = new TH1F("hIsLcResonantGen","IsLcResonant flag gen",6,-1.5,4.5);
437  fhIsLcResonantReco = new TH1F("hIsLcResonantReco","IsLcResonant flag reco",6,-1.5,4.5);
438  fhIsLcGen = new TH1F("hIsLcGen","IsLc flag gen",4,-1.5,2.5);
439  fhIsLcReco = new TH1F("hIsLcReco","IsLc flag reco",4,-1.5,2.5);
442  fOutput->Add(fhIsLcGen);
443  fOutput->Add(fhIsLcReco);
444 
445  fhRecoPDGmom = new TH1F("hRecoPDGmom","pdg of mother reco. MatchToMCLambdac",7,-0.5,6.5);
446  fOutput->Add(fhRecoPDGmom);
447 
448  fhSetIsLc = new TH1F("hSetIsLc","Check candidates before/after rec. set is Lc",2,-0.5,1.5);
449  fOutput->Add(fhSetIsLc);
450 
451  fhSelectionBits = new TH2F("hSelectionBits","Reconstruction + selection bit",13,-0.5,12.5,150,0,15);
452  fhSelectionBits->GetXaxis()->SetBinLabel(2,"D0toKpiCuts");
453  fhSelectionBits->GetXaxis()->SetBinLabel(3,"D0toKpiPID");
454  fhSelectionBits->GetXaxis()->SetBinLabel(4,"D0fromDstarCuts");
455  fhSelectionBits->GetXaxis()->SetBinLabel(5,"D0fromDstarPID");
456  fhSelectionBits->GetXaxis()->SetBinLabel(6,"DplusCuts");
457  fhSelectionBits->GetXaxis()->SetBinLabel(7,"DplusPID");
458  fhSelectionBits->GetXaxis()->SetBinLabel(8,"DsCuts");
459  fhSelectionBits->GetXaxis()->SetBinLabel(9,"DsPID");
460  fhSelectionBits->GetXaxis()->SetBinLabel(10,"LcCuts");
461  fhSelectionBits->GetXaxis()->SetBinLabel(11,"LcPID");
462  fhSelectionBits->GetXaxis()->SetBinLabel(12,"DstarCuts");
463  fhSelectionBits->GetXaxis()->SetBinLabel(13,"DstarPID");
464  fhSelectionBits->GetYaxis()->SetTitle("p_{T} (GeV/c)");
465  fhSelectionBits->GetXaxis()->SetNdivisions(1,kFALSE);
466  fOutput->Add(fhSelectionBits);
467 
468  fhSelectionBitsSigc = new TH2F("hSelectionBitsSigc","Reconstruction + selection bit from c",13,-0.5,12.5,150,0,15);
469  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(2,"D0toKpiCuts");
470  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(3,"D0toKpiPID");
471  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(4,"D0fromDstarCuts");
472  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(5,"D0fromDstarPID");
473  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(6,"DplusCuts");
474  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(7,"DplusPID");
475  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(8,"DsCuts");
476  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(9,"DsPID");
477  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(10,"LcCuts");
478  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(11,"LcPID");
479  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(12,"DstarCuts");
480  fhSelectionBitsSigc->GetXaxis()->SetBinLabel(13,"DstarPID");
481  fhSelectionBitsSigc->GetYaxis()->SetTitle("p_{T} (GeV/c)");
482  fhSelectionBitsSigc->GetXaxis()->SetNdivisions(1,kFALSE);
484 
485  fhSelectionBitsSigb = new TH2F("hSelectionBitsSigb","Reconstruction + selection bit from b",13,-0.5,13.5,150,0,15);
486  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(2,"D0toKpiCuts");
487  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(3,"D0toKpiPID");
488  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(4,"D0fromDstarCuts");
489  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(5,"D0fromDstarPID");
490  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(6,"DplusCuts");
491  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(7,"DplusPID");
492  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(8,"DsCuts");
493  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(9,"DsPID");
494  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(10,"LcCuts");
495  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(11,"LcPID");
496  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(12,"DstarCuts");
497  fhSelectionBitsSigb->GetXaxis()->SetBinLabel(13,"DstarPID");
498  fhSelectionBitsSigb->GetYaxis()->SetTitle("p_{T} (GeV/c)");
499  fhSelectionBitsSigb->GetXaxis()->SetNdivisions(1,kFALSE);
501 
502 // enum ESele {kD0toKpiCuts,kD0toKpiPID,kD0fromDstarCuts,kD0fromDstarPID,kDplusCuts,kDplusPID,kDsCuts,kDsPID,kLcCuts,kLcPID,kDstarCuts,kDstarPID};
503 
504  TString stepnames[12] = {"GeneratedLimAcc","GeneratedAll","Generated","GeneratedAcc","Reco3Prong","LcBit","IsSelectedTracks","IsInFidAcc","PtRange","IsSelectedCandidate","IsSelectedPID","IsSelectedNtuple"};
505  for(Int_t i=0;i<12;i++) { // histograms for efficiency cross check
506  //Lc vs Pt histograms
507  hisname.Form("hNBkgNI%i",i);
508  histitle.Form("N Bkg not injected %s",stepnames[i].Data());
509  fhNBkgNI[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
510  hisname.Form("hNLc%i",i);
511  histitle.Form("N Lc %s",stepnames[i].Data());
512  fhNLc[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
513  hisname.Form("hNLcc%i",i);
514  histitle.Form("N Lc from c %s",stepnames[i].Data());
515  fhNLcc[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
516  hisname.Form("hNLcNonRc%i",i);
517  histitle.Form("N Lc non resonant from c %s",stepnames[i].Data());
518  fhNLcNonRc[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
519  hisname.Form("hNLcL1520c%i",i);
520  histitle.Form("N Lc -> L(1520) + p from c %s",stepnames[i].Data());
521  fhNLcL1520c[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
522  hisname.Form("hNLcKstarc%i",i);
523  histitle.Form("N Lc -> K* + pi from c %s",stepnames[i].Data());
524  fhNLcKstarc[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
525  hisname.Form("hNLcDeltac%i",i);
526  histitle.Form("N Lc -> Delta + K from c %s",stepnames[i].Data());
527  fhNLcDeltac[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
528  hisname.Form("hNLcb%i",i);
529  histitle.Form("N Lc from b %s",stepnames[i].Data());
530  fhNLcb[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
531  hisname.Form("hNLcNonRb%i",i);
532  histitle.Form("N Lc non resonant from b %s",stepnames[i].Data());
533  fhNLcNonRb[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
534  hisname.Form("hNLcL1520b%i",i);
535  histitle.Form("N Lc -> L(1520) + p from b %s",stepnames[i].Data());
536  fhNLcL1520b[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
537  hisname.Form("hNLcKstarb%i",i);
538  histitle.Form("N Lc -> K* + pi from b %s",stepnames[i].Data());
539  fhNLcKstarb[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
540  hisname.Form("hNLcDeltab%i",i);
541  histitle.Form("N Lc -> Delta + K from b %s",stepnames[i].Data());
542  fhNLcDeltab[i] = new TH1F(hisname.Data(),histitle.Data(),100,0,20);
543  fOutput->Add(fhNBkgNI[i]);
544  fOutput->Add(fhNLc[i]);
545  fOutput->Add(fhNLcc[i]);
546  fOutput->Add(fhNLcNonRc[i]);
547  fOutput->Add(fhNLcL1520c[i]);
548  fOutput->Add(fhNLcKstarc[i]);
549  fOutput->Add(fhNLcDeltac[i]);
550  fOutput->Add(fhNLcb[i]);
551  fOutput->Add(fhNLcNonRb[i]);
552  fOutput->Add(fhNLcL1520b[i]);
553  fOutput->Add(fhNLcKstarb[i]);
554  fOutput->Add(fhNLcDeltab[i]);
555 
556  //Pt vs eta histograms
557  hisname.Form("hPtEtaBkgNI%i",i);
558  histitle.Form("Pt vs #eta Bkg not injected %s",stepnames[i].Data());
559  fhPtEtaBkgNI[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
560  hisname.Form("hPtEtaLc%i",i);
561  histitle.Form("Pt vs #eta Lc %s",stepnames[i].Data());
562  fhPtEtaLc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
563  hisname.Form("hPtEtaLcc%i",i);
564  histitle.Form("Pt vs #eta Lc from c %s",stepnames[i].Data());
565  fhPtEtaLcc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
566  hisname.Form("hPtEtaLcNonRc%i",i);
567  histitle.Form("Pt vs #eta Lc non resonant from c %s",stepnames[i].Data());
568  fhPtEtaLcNonRc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
569  hisname.Form("hPtEtaLcL1520c%i",i);
570  histitle.Form("Pt vs #eta Lc -> L(1520) + p from c %s",stepnames[i].Data());
571  fhPtEtaLcL1520c[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
572  hisname.Form("hPtEtaLcKstarc%i",i);
573  histitle.Form("Pt vs #eta Lc -> K* + pi from c %s",stepnames[i].Data());
574  fhPtEtaLcKstarc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
575  hisname.Form("hPtEtaLcDeltac%i",i);
576  histitle.Form("Pt vs #eta Lc -> Delta + K from c %s",stepnames[i].Data());
577  fhPtEtaLcDeltac[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
578  hisname.Form("hPtEtaLcb%i",i);
579  histitle.Form("Pt vs #eta Lc from b %s",stepnames[i].Data());
580  fhPtEtaLcb[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
581  hisname.Form("hPtEtaLcNonRb%i",i);
582  histitle.Form("Pt vs #eta Lc non resonant from b %s",stepnames[i].Data());
583  fhPtEtaLcNonRb[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
584  hisname.Form("hPtEtaLcL1520b%i",i);
585  histitle.Form("Pt vs #eta Lc -> L(1520) + p from b %s",stepnames[i].Data());
586  fhPtEtaLcL1520b[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
587  hisname.Form("hPtEtaLcKstarb%i",i);
588  histitle.Form("Pt vs #eta Lc -> K* + pi from b %s",stepnames[i].Data());
589  fhPtEtaLcKstarb[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
590  hisname.Form("hPtEtaLcDeltab%i",i);
591  histitle.Form("Pt vs #eta Lc -> Delta + K from b %s",stepnames[i].Data());
592  fhPtEtaLcDeltab[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
593  fOutput->Add(fhPtEtaBkgNI[i]);
594  fOutput->Add(fhPtEtaLc[i]);
595  fOutput->Add(fhPtEtaLcc[i]);
596  fOutput->Add(fhPtEtaLcNonRc[i]);
597  fOutput->Add(fhPtEtaLcL1520c[i]);
598  fOutput->Add(fhPtEtaLcKstarc[i]);
599  fOutput->Add(fhPtEtaLcDeltac[i]);
600  fOutput->Add(fhPtEtaLcb[i]);
601  fOutput->Add(fhPtEtaLcNonRb[i]);
602  fOutput->Add(fhPtEtaLcL1520b[i]);
603  fOutput->Add(fhPtEtaLcKstarb[i]);
604  fOutput->Add(fhPtEtaLcDeltab[i]);
605 
606  //Pt vs Y histograms
607  hisname.Form("hPtYBkgNI%i",i);
608  histitle.Form("Pt vs Y Bkg not injected %s",stepnames[i].Data());
609  fhPtYBkgNI[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
610  hisname.Form("hPtYLc%i",i);
611  histitle.Form("Pt vs Y Lc %s",stepnames[i].Data());
612  fhPtYLc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
613  hisname.Form("hPtYLcc%i",i);
614  histitle.Form("Pt vs Y Lc from c %s",stepnames[i].Data());
615  fhPtYLcc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
616  hisname.Form("hPtYLcNonRc%i",i);
617  histitle.Form("Pt vs Y Lc non resonant from c %s",stepnames[i].Data());
618  fhPtYLcNonRc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
619  hisname.Form("hPtYLcL1520c%i",i);
620  histitle.Form("Pt vs Y Lc -> L(1520) + p from c %s",stepnames[i].Data());
621  fhPtYLcL1520c[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
622  hisname.Form("hPtYLcKstarc%i",i);
623  histitle.Form("Pt vs Y Lc -> K* + pi from c %s",stepnames[i].Data());
624  fhPtYLcKstarc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
625  hisname.Form("hPtYLcDeltac%i",i);
626  histitle.Form("Pt vs Y Lc -> Delta + K from c %s",stepnames[i].Data());
627  fhPtYLcDeltac[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
628  hisname.Form("hPtYLcb%i",i);
629  histitle.Form("Pt vs Y Lc from b %s",stepnames[i].Data());
630  fhPtYLcb[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
631  hisname.Form("hPtYLcNonRb%i",i);
632  histitle.Form("Pt vs Y Lc non resonant from b %s",stepnames[i].Data());
633  fhPtYLcNonRb[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
634  hisname.Form("hPtYLcL1520b%i",i);
635  histitle.Form("Pt vs Y Lc -> L(1520) + p from b %s",stepnames[i].Data());
636  fhPtYLcL1520b[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
637  hisname.Form("hPtYLcKstarb%i",i);
638  histitle.Form("Pt vs Y Lc -> K* + pi from b %s",stepnames[i].Data());
639  fhPtYLcKstarb[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
640  hisname.Form("hPtYLcDeltab%i",i);
641  histitle.Form("Pt vs Y Lc -> Delta + K from b %s",stepnames[i].Data());
642  fhPtYLcDeltab[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,200,-10,10);
643  fOutput->Add(fhPtYBkgNI[i]);
644  fOutput->Add(fhPtYLc[i]);
645  fOutput->Add(fhPtYLcc[i]);
646  fOutput->Add(fhPtYLcNonRc[i]);
647  fOutput->Add(fhPtYLcL1520c[i]);
648  fOutput->Add(fhPtYLcKstarc[i]);
649  fOutput->Add(fhPtYLcDeltac[i]);
650  fOutput->Add(fhPtYLcb[i]);
651  fOutput->Add(fhPtYLcNonRb[i]);
652  fOutput->Add(fhPtYLcL1520b[i]);
653  fOutput->Add(fhPtYLcKstarb[i]);
654  fOutput->Add(fhPtYLcDeltab[i]);
655 
656  //Pt vs phi histograms
657  hisname.Form("hPtPhiBkgNI%i",i);
658  histitle.Form("Pt vs #phi Bkg not injected %s",stepnames[i].Data());
659  fhPtPhiBkgNI[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
660  hisname.Form("hPtPhiLc%i",i);
661  histitle.Form("Pt vs #phi Lc %s",stepnames[i].Data());
662  fhPtPhiLc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
663  hisname.Form("hPtPhiLcc%i",i);
664  histitle.Form("Pt vs #phi Lc from c %s",stepnames[i].Data());
665  fhPtPhiLcc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
666  hisname.Form("hPtPhiLcNonRc%i",i);
667  histitle.Form("Pt vs #phi Lc non resonant from c %s",stepnames[i].Data());
668  fhPtPhiLcNonRc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
669  hisname.Form("hPtPhiLcL1520c%i",i);
670  histitle.Form("Pt vs #phi Lc -> L(1520) + p from c %s",stepnames[i].Data());
671  fhPtPhiLcL1520c[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
672  hisname.Form("hPtPhiLcKstarc%i",i);
673  histitle.Form("Pt vs #phi Lc -> K* + pi from c %s",stepnames[i].Data());
674  fhPtPhiLcKstarc[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
675  hisname.Form("hPtPhiLcDeltac%i",i);
676  histitle.Form("Pt vs #phi Lc -> Delta + K from c %s",stepnames[i].Data());
677  fhPtPhiLcDeltac[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
678  hisname.Form("hPtPhiLcb%i",i);
679  histitle.Form("Pt vs #phi Lc from b %s",stepnames[i].Data());
680  fhPtPhiLcb[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
681  hisname.Form("hPtPhiLcNonRb%i",i);
682  histitle.Form("Pt vs #phi Lc non resonant from b %s",stepnames[i].Data());
683  fhPtPhiLcNonRb[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
684  hisname.Form("hPtPhiLcL1520b%i",i);
685  histitle.Form("Pt vs #phi Lc -> L(1520) + p from b %s",stepnames[i].Data());
686  fhPtPhiLcL1520b[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
687  hisname.Form("hPtPhiLcKstarb%i",i);
688  histitle.Form("Pt vs #phi Lc -> K* + pi from b %s",stepnames[i].Data());
689  fhPtPhiLcKstarb[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
690  hisname.Form("hPtPhiLcDeltab%i",i);
691  histitle.Form("Pt vs #phi Lc -> Delta + K from b %s",stepnames[i].Data());
692  fhPtPhiLcDeltab[i] = new TH2F(hisname.Data(),histitle.Data(),20,0,20,70,0,7);
693  fOutput->Add(fhPtPhiBkgNI[i]);
694  fOutput->Add(fhPtPhiLc[i]);
695  fOutput->Add(fhPtPhiLcc[i]);
696  fOutput->Add(fhPtPhiLcNonRc[i]);
697  fOutput->Add(fhPtPhiLcL1520c[i]);
698  fOutput->Add(fhPtPhiLcKstarc[i]);
699  fOutput->Add(fhPtPhiLcDeltac[i]);
700  fOutput->Add(fhPtPhiLcb[i]);
701  fOutput->Add(fhPtPhiLcNonRb[i]);
702  fOutput->Add(fhPtPhiLcL1520b[i]);
703  fOutput->Add(fhPtPhiLcKstarb[i]);
704  fOutput->Add(fhPtPhiLcDeltab[i]);
705  }
706 
707 
708  fhPtMisIdpKpi = new TH1F("hMisIdpKpi","pKpi id'd as piKp",30,0,30);
709  fhPtMisIdpiKp = new TH1F("hMisIdpiKp","piKp id'd as pKpi",30,0,30);
710  fhPtCorrId = new TH1F("hCorrId","Correctly id'd pKpi",30,0,30);
711  fOutput->Add(fhPtMisIdpKpi);
712  fOutput->Add(fhPtMisIdpiKp);
713  fOutput->Add(fhPtCorrId);
714  fhInvMassMisIdpKpi = new TH2F("hInvMassIdpKpi","inv mass pKpi id'd as piKp",300,0.,30.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
715  fhInvMassMisIdpiKp = new TH2F("hInvMassIdpiKp","inv mass piKp id'd as pKpi",300,0.,30.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
718 
719  fhPtMisIdpKpiProb = new TH1F("hMisIdpKpiProb","pKpi id'd as piKp, most prob. PID",30,0,30);
720  fhPtMisIdpiKpProb = new TH1F("hMisIdpiKpProb","piKp id'd as pKpi, most prob. PID",30,0,30);
721  fhPtCorrIdProb = new TH1F("hCorrIdProb","Correctly id'd pKpi, most prob. PID",30,0,30);
724  fOutput->Add(fhPtCorrIdProb);
725  fhInvMassMisIdpKpiProb = new TH2F("hInvMassIdpKpiProb","inv mass pKpi id'd as piKp most prob. PID",300,0.,30.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
726  fhInvMassMisIdpiKpProb = new TH2F("hInvMassIdpiKpProb","inv mass piKp id'd as pKpi most prob. PID",300,0.,30.,(fUpmasslimit-fLowmasslimit)/0.002,fLowmasslimit,fUpmasslimit);
729 
730 
731  // fhChi2 = new TH1F("fhChi2", "Chi2",100,0.,10.);
732  // fhChi2->Sumw2();
733  // fOutput->Add(fhChi2);
734 
735  fNentries=new TH1F("fNentries", "n Events/Candidates QA", 16,0.5,16.5);
736 
737  //Event and candidate QA - entries at each step
738  fNentries->GetXaxis()->SetBinLabel(1,"nEventsRejTM");
739  fNentries->GetXaxis()->SetBinLabel(2,"nEventsNoVtx");
740  fNentries->GetXaxis()->SetBinLabel(3,"nEventsRejCutPileup");
741  fNentries->GetXaxis()->SetBinLabel(4,"nLcGen");
742  fNentries->GetXaxis()->SetBinLabel(5,"nLcGenFidAcc");
743  fNentries->GetXaxis()->SetBinLabel(6,"nCandReco3Prong");
744  fNentries->GetXaxis()->SetBinLabel(7,"nCandLcBit");
745  fNentries->GetXaxis()->SetBinLabel(8,"nCandIsSelTracks");
746  fNentries->GetXaxis()->SetBinLabel(9,"nCandIsInFidAcc");
747  fNentries->GetXaxis()->SetBinLabel(10,"ptbin=-1");
748  fNentries->GetXaxis()->SetBinLabel(11,"nCandIsSelCand");
749  fNentries->GetXaxis()->SetBinLabel(12,"PID=0");
750  fNentries->GetXaxis()->SetBinLabel(13,"PID=1");
751  fNentries->GetXaxis()->SetBinLabel(14,"PID=2");
752  fNentries->GetXaxis()->SetBinLabel(15,"PID=3");
753  fNentries->GetXaxis()->SetBinLabel(16,"nLcSelected");
754  fNentries->GetXaxis()->SetNdivisions(1,kFALSE);
755 
756  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
757  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
758  fPIDResponse = inputHandler->GetPIDResponse();
759 
764  fRDCutsAnalysis->GetPidHF()->SetOldPid(kFALSE);
767  }
768 
769 
770  PostData(1,fOutput);
771  PostData(3,fNentries);
772 
773  TString normName="NormalizationCounter";
774  AliAnalysisDataContainer *cont = GetOutputSlot(4)->GetContainer();
775  if(cont)normName=(TString)cont->GetName();
776  fCounter = new AliNormalizationCounter(normName.Data());
777  fCounter->Init();
778  PostData(4,fCounter);
779  if (fFillNtuple) {
780  //basic ntuple
781  TString ntName="fNtupleLambdac";
782  AliAnalysisDataContainer *contnt = GetOutputSlot(5)->GetContainer();
783  if(contnt)ntName=(TString)contnt->GetName();
784  if(fFillNtuple==1) fNtupleLambdac = new TNtuple(ntName.Data(), "Lc", "isLcBkg:InvMasspKpi:InvMasspiKp:Charge:PtTr0:PtTr1:PtTr2:PtLc:CosP:DecayL:DecayLSig:Dist12:SigVert:DCA:DecayLXY:DecayLXYSig:isLcResonant:selectionPID:Tr0Ppi:Tr0PK:Tr0Pp:Tr1Ppi:Tr1PK:Tr1Pp:Tr2Ppi:Tr2PK:Tr2Pp");
785  //NSigma PID
786  else if(fFillNtuple==2) fNtupleLambdac = new TNtuple(ntName.Data(), "Lc", "isLcBkg:InvMasspKpi:InvMasspiKp:Charge:PtTr0:PtTr1:PtTr2:PtLc:CosP:DecayL:DecayLSig:Dist12:SigVert:DCATr0:DecayLXY:DecayLXYSig:isLcResonant:selectionPID:Tr0Ppi:Tr0PK:Tr0Pp:Tr1Ppi:Tr1PK:Tr1Pp:Tr2Ppi:Tr2PK:Tr2Pp:d00:d01:d02:d0Squared:d00Sig:d01Sig:d02Sig:d00SigResidual:d01SigResidual:d02SigResidual:CosPXY:DCATr1:DCATr2:Dist23:RunNumber");
787  //2 prong decay products
788  else if(fFillNtuple==3) fNtupleLambdac = new TNtuple(ntName.Data(), "Lc", "isLcBkg:InvMasspKpi:InvMasspiKp:Charge:PtTr0:PtTr1:PtTr2:PtLc:CosP:DecayL:DecayLSig:Dist12:SigVert:DCATr0:DecayLXY:DecayLXYSig:isLcResonant:selectionPID:Tr0Ppi:Tr0PK:Tr0Pp:Tr1Ppi:Tr1PK:Tr1Pp:Tr2Ppi:Tr2PK:Tr2Pp:d00:d01:d02:d0Squared:d00Sig:d01Sig:d02Sig:d00SigResidual:d01SigResidual:d02SigResidual:CosPXY:DCATr1:DCATr2:Dist23:RunNumber:InvMasspK:InvMassKpi:InvMassppi:InvMassKp:InvMasspiK:InvMasspip");
789  else AliFatal("Invalid fill ntuple argument");
790  PostData(5,fNtupleLambdac);
791  }
792 
793  return;
794 }
795 
796 //________________________________________________________________________
797 void AliAnalysisTaskSELambdacTMVA::UserExec(Option_t */*option*/)
798 {
799  //
802  //
803  AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
804  //tmp
805  fHistNEvents->Fill(1); // count event
806  // Post the data already here
807 
808 
809  TClonesArray *array3Prong = 0;
810  TClonesArray *arrayLikeSign =0;
811  if(!aod && AODEvent() && IsStandardAOD()) {
812  // In case there is an AOD handler writing a standard AOD, use the AOD
813  // event in memory rather than the input (ESD) event.
814  aod = dynamic_cast<AliAODEvent*> (AODEvent());
815  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
816  // have to taken from the AOD event hold by the AliAODExtension
817  AliAODHandler* aodHandler = (AliAODHandler*)
818  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
819  if(aodHandler->GetExtensions()) {
820  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
821  AliAODEvent *aodFromExt = ext->GetAOD();
822  array3Prong=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
823  arrayLikeSign=(TClonesArray*)aodFromExt->GetList()->FindObject("LikeSign3Prong");
824  }
825  } else if(aod) {
826  array3Prong=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
827  arrayLikeSign=(TClonesArray*)aod->GetList()->FindObject("LikeSign3Prong");
828  }
829 
830  if(!aod) return;
831 
832  TClonesArray *arrayMC=0;
833  AliAODMCHeader *mcHeader=0;
834 
835  // load MC particles
836  if(fReadMC){
837 
838  arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
839  if(!arrayMC) {
840  AliError("AliAnalysisTaskSELambdacTMVA::UserExec: MC particles branch not found!\n");
841  return;
842  }
843 
844 
845  // load MC header
846  mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
847  if(!mcHeader) {
848  AliError("AliAnalysisTaskSELambdacTMVA::UserExec: MC header branch not found!\n");
849  return;
850  }
851  //if(TString(AliAODMCHeader::StdBranchName()).Contains("LHC15f2")) {
852  // AliInfo("LHC15f2 - fIsHijing==kTRUE");
853  // fIsHijing=kTRUE;
854  //}
855  //else {
856  // AliInfo("Not LHC15f2 - fIsHijing==kFALSE");
857  // fIsHijing=kFALSE;
858  //}
859  }
860 
861 
862  if(!array3Prong || !aod) {
863  AliError("AliAnalysisTaskSELambdacTMVA::UserExec: Charm3Prong branch not found!\n");
864  return;
865  }
866  if(!arrayLikeSign) {
867  AliDebug(2,"AliAnalysisTaskSELambdacTMVA::UserExec: LikeSign3Prong branch not found!\n");
868  // return;
869  }
870 
871  //Trigger mask = 0 rejection for LHC13d3
872  Int_t runnumber = aod->GetRunNumber();
873  if (aod->GetTriggerMask() == 0 && (runnumber >= 195344 && runnumber <= 195677)){
874  Int_t nentriesTM = arrayMC->GetEntriesFast();
875  AliDebug(2,Form("Event rejected because of null trigger mask, n entries = %i",nentriesTM));
876  fNentries->Fill(1);
877  return;
878  }
879 
880  // fix for temporary bug in ESDfilter
881  // the AODs with null vertex pointer didn't pass the PhysSel
882  AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
883  if(!vtx1 || TMath::Abs(aod->GetMagneticField())<0.001) {
884  fNentries->Fill(2);
885  //return;
886  }
888  TString trigclass=aod->GetFiredTriggerClasses();
889  //if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL"))
890 
891  //Bool_t isThereA3prongWithGoodTracks = kFALSE;
892  //Bool_t isThereA3ProngLcKine = kFALSE;
893  //Bool_t isThereA3ProngLcKineANDpid = kFALSE;
894  //Bool_t isThereA3ProngLcMC = kFALSE;
895  //Bool_t isThereA3ProngCyes = kFALSE;
896  //Bool_t isThereA3ProngByes = kFALSE;
897  //Bool_t isThereA3ProngJPsi = kFALSE;
898 
899  Int_t n3Prong = array3Prong->GetEntriesFast();
900  Int_t nSelectedloose[1]={0};
901  Int_t nSelectedtight[1]={0};
902 
903  //MC Generated level
904  //loop over MC particles to find Lc generated
905  Bool_t isInFidAcc = kFALSE;
906  Bool_t isInAcc = kFALSE;
907  if(fReadMC) {
908  // Event selection as done is CF task
909  Double_t zPrimVertex = vtx1 ->GetZ();
910  Double_t zMCVertex = mcHeader->GetVtxZ();
911  if (TMath::Abs(zMCVertex) > fRDCutsAnalysis->GetMaxVtxZ()){
912  return;
913  }
914  for (Int_t iPart=0; iPart<arrayMC->GetEntriesFast(); iPart++) {
915  fIsLc=0;
916  fIsLcResonant=0;
917  AliAODMCParticle* mcPart = dynamic_cast<AliAODMCParticle*>(arrayMC->At(iPart));
918  if (!mcPart){
919  AliError("Failed casting particle from MC array!, Skipping particle");
920  continue;
921  }
922  //Check whether particle is Lc
923  SetIsLcGen(mcPart,arrayMC);
924  if(fIsLc==0) continue;
925  //-- is Lc --
926  isInFidAcc = fRDCutsAnalysis->IsInFiducialAcceptance(mcPart->Pt(),mcPart->Y());
927  fCandidateVars[0] = mcPart->Pt();
928  fCandidateVars[1] = mcPart->Eta();
929  fCandidateVars[2] = mcPart->Y();
930  fCandidateVars[3] = mcPart->Phi();
931  Int_t imother = -1;
932  if(!fIsHijing) imother=mcPart->GetMother();
933  if(imother>0) { //found mother
934  AliAODMCParticle* mcPartMother = dynamic_cast<AliAODMCParticle*>(arrayMC->At(imother));
935  if(!mcPart){
936  AliError("Failed casting mother particle, Skipping particle");
937  continue;
938  }
939  }
940 
941  //Check daughters
942  SetLambdacDaugh(mcPart,arrayMC,isInAcc);
943  if(fIsLcResonant>=1 && (fIsHijing || imother>0)) { //if signal, and is LHC15f2 or has mother
944  AliDebug(2,"Lc has p K pi in final state");
946  fNentries->Fill(4);
947  if(isInFidAcc){
948  fNentries->Fill(5);
949  if((TMath::Abs(mcPart->Y()) < 0.5)) {//limited acceptance
950  AliDebug(2,"Lc in limited acceptance");
952  }
953  FillEffHists(kGenerated); //MC generated ---> Should be within fiducial acceptance
954  if(isInAcc) FillEffHists(kGeneratedAcc); //all daughters in acceptance
955  }
956  }
957  else if(fIsLcResonant==0){
958  AliError("no p K pi final state");
959  // TClonesArray *ares = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
960  // Int_t nentriesres = ares->GetEntriesFast();
961  // for(Int_t ires=0;ires<nentriesres;ires++) {
962  // AliAODMCParticle* mcPartRes = dynamic_cast<AliAODMCParticle*>(ares->At(ires));
963  // Printf("%i",ires);
964  // mcPartRes->Print();
965  // }
966  // TIter next(aod->GetList());
967  // while (TObject *obj = next())
968  // obj->Print();
969  }
970  else AliError(Form("Not pKpi or background - should not happen! fIsLcResonant = %i",fIsLcResonant));
971  fhIsLcResonantGen->Fill(Double_t(fIsLcResonant));
972  fhIsLcGen->Fill(Double_t(fIsLc));
973  }
974  }
975 
976 
977  fHistNEvents->Fill(2); // count event after event selection (as CF task)
978 
979  Bool_t isEvSelAnCuts=fRDCutsAnalysis->IsEventSelected(aod);
980  if(!isEvSelAnCuts){ //reject if not selected with analysis cut
981  if(fRDCutsAnalysis->GetWhyRejection()==1) // rejected for pileup
982  fNentries->Fill(3);
983  return;
984  }
985 
986  //
987  //Reconstruction level
988  //loop over 3 prong candidates
989  //
990 
991  for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
992  AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
993  //(AliAODEvent *aod,AliAODRecoDecayHF3Prong *part,TClonesArray *arrayMC)
994  fhSetIsLc->Fill(0);
995  SetIsLcReco(d,arrayMC);
996  fhSetIsLc->Fill(1);
997  fhIsLcResonantReco->Fill(Double_t(fIsLcResonant));
998  fhIsLcReco->Fill(Double_t(fIsLc));
999  fCandidateVars[0] = d->Pt();
1000  fCandidateVars[1] = d->Eta();
1001  fCandidateVars[2] = d->Y(4122);
1002  fCandidateVars[3] = d->Phi();
1003 
1005  fNentries->Fill(6);
1006 
1007  Bool_t unsetvtx=kFALSE;
1008  if(!d->GetOwnPrimaryVtx()){
1009  d->SetOwnPrimaryVtx(vtx1);
1010  unsetvtx=kTRUE;
1011  }
1012 
1013  //add histogram with filter bit
1014  //one at start of task, one at filter bit selection
1015  //check every bit, bit vs pT
1016  //Filter bit selection and QA:
1017  fhSelectBit->Fill(1);
1018  if(d->GetSelectionMap()){
1019  // enum ESele {kD0toKpiCuts,kD0toKpiPID,kD0fromDstarCuts,kD0fromDstarPID,kDplusCuts,kDplusPID,kDsCuts,kDsPID,kLcCuts,kLcPID,kDstarCuts,kDstarPID};
1023 
1024  fhSelectBit->Fill(2);
1027  if(fLcCut&&!d->HasSelectionBit(AliRDHFCuts::kLcCuts)) continue;
1028  if(fLcPIDCut&&!d->HasSelectionBit(AliRDHFCuts::kLcPID)) continue;
1029  }
1031  fNentries->Fill(7);
1032 
1033  //track selection
1034  Int_t isSelectedTracks = fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kTracks,aod);
1035  if(!isSelectedTracks) continue;
1037  fNentries->Fill(8);
1038 
1039  //isThereA3prongWithGoodTracks=kTRUE;
1040 
1041  if (fRDCutsAnalysis->IsInFiducialAcceptance(d->Pt(),d->Y(4122))) {fNentries->Fill(9);}else{continue;}
1043 
1044  Int_t ptbin=fRDCutsAnalysis->PtBin(d->Pt());
1045  if(ptbin==-1) {fNentries->Fill(10); continue;} //out of bounds
1047 
1048  //idproton, pion using isSelectedPID
1049  //Bool_t isPID=fRDCutsAnalysis->GetIsUsePID();
1050  Int_t isSelectedPID=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kPID,aod);
1051 
1052  if(isSelectedPID==0 ) fNentries->Fill(12);
1053  else if(isSelectedPID==1) fNentries->Fill(13);
1054  else if(isSelectedPID==2) fNentries->Fill(14);
1055  else fNentries->Fill(15);
1056  if(isSelectedPID>0) FillEffHists(kIsSelectedPID);
1057  //PID selection using maximum probability configuration
1058  Int_t selectionProb = GetPIDselectionMaxProb(d);
1059 
1060  Int_t selection=fRDCutsAnalysis->IsSelected(d,AliRDHFCuts::kCandidate,aod);
1061  if(!selection) continue;
1063  fNentries->Fill(11);
1064 
1065  FillMassHists(aod,d,arrayMC,selection,selectionProb);
1066 
1067 
1068  if(fFillNtuple) FillNtuple(aod,d,arrayMC,selection);
1070  if(fIsLc>=1 && fIsLc <= 2) fNentries->Fill(16);
1071  if(unsetvtx) d->UnsetOwnPrimaryVtx();
1072  }
1073  fCounter->StoreCandidates(aod,nSelectedloose[0],kTRUE);
1074  fCounter->StoreCandidates(aod,nSelectedtight[0],kFALSE);
1075 
1076  PostData(1,fOutput);
1077  PostData(3,fNentries);
1078  PostData(4,fCounter);
1079 
1080  return;
1081 }
1082 
1083 
1084 
1085 //________________________________________________________________________
1087 {
1088  //
1090  //
1091 
1092  if (fDebug > 1) printf("AnalysisTaskSELambdac: Terminate() \n");
1093 
1094  fOutput = dynamic_cast<TList*> (GetOutputData(1));
1095  if (!fOutput) {
1096  AliError("ERROR: fOutput not available\n");
1097  return;
1098  }
1099  //fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents"));
1100 
1101  if(fFillNtuple){
1102  fNtupleLambdac = dynamic_cast<TNtuple*>(GetOutputData(5));
1103  }
1104 
1105 
1106  return;
1107 }
1108 
1109 //________________________________________________________________________
1111 
1112  //
1114  //
1115 
1116  Int_t lambdacLab[3]={0,0,0};
1117  // Int_t pdgs[3]={0,0,0};
1118  for(Int_t i=0;i<3;i++){
1119  AliAODTrack *daugh=(AliAODTrack*)d->GetDaughter(i);
1120  Int_t lab=daugh->GetLabel();
1121  if(lab<0) return 0;
1122  AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab);
1123  if(!part) continue;
1124  // pdgs[i]=part->GetPdgCode();
1125  Int_t partPdgcode = TMath::Abs(part->GetPdgCode());
1126  if(partPdgcode==211 || partPdgcode==321 || partPdgcode==2212){
1127  Int_t motherLabel=part->GetMother();
1128  if(motherLabel<0) return 0;
1129  AliAODMCParticle *motherPart = (AliAODMCParticle*)arrayMC->At(motherLabel);
1130  if(!motherPart) continue;
1131  Int_t motherPdg = TMath::Abs(motherPart->GetPdgCode());
1132  if(motherPdg==4122) {
1133  if(GetLambdacDaugh(motherPart,arrayMC)){lambdacLab[i]=motherLabel;continue;}
1134  }
1135  if(motherPdg==313 || motherPdg==2224 || motherPdg==3124){
1136  Int_t granMotherLabel=motherPart->GetMother();
1137  if(granMotherLabel<0) return 0;
1138  AliAODMCParticle *granMotherPart = (AliAODMCParticle*)arrayMC->At(granMotherLabel);
1139  if(!granMotherPart) continue;
1140  Int_t granMotherPdg = TMath::Abs(granMotherPart->GetPdgCode());
1141  if(granMotherPdg ==4122) {
1142  if(GetLambdacDaugh(granMotherPart,arrayMC)) {lambdacLab[i]=granMotherLabel;continue;}
1143  }
1144  }
1145  }
1146  }
1147 
1148  if(lambdacLab[0]==lambdacLab[1] && lambdacLab[1]==lambdacLab[2]) {return lambdacLab[0];}
1149  return 0;
1150 
1151 }
1152 
1153 //-----------------------------
1154 
1155 Int_t AliAnalysisTaskSELambdacTMVA::LambdacDaugh(AliAODMCParticle *part, TClonesArray *arrayMC, Bool_t &IsInAcc) const {
1156 
1157  //
1161  //
1162 
1163  Int_t numberOfLambdac=0;
1164  IsInAcc=kTRUE;
1165  if(TMath::Abs(part->GetPdgCode())!=4122) return 0;
1166  // Int_t daughTmp[2];
1167  // daughTmp[0]=part->GetDaughter(0);
1168  // daughTmp[1]=part->GetDaughter(1);
1169  Int_t nDaugh = (Int_t)part->GetNDaughters();
1170  if(nDaugh<2) return 0;
1171  if(nDaugh>3) return 0;
1172  AliAODMCParticle* pdaugh1 = (AliAODMCParticle*)arrayMC->At(part->GetDaughter(0));
1173  if(!pdaugh1) {return 0;}
1174  Int_t number1 = TMath::Abs(pdaugh1->GetPdgCode());
1175  AliAODMCParticle* pdaugh2 = (AliAODMCParticle*)arrayMC->At(part->GetDaughter(1));
1176  if(!pdaugh2) {return 0;}
1177  Int_t number2 = TMath::Abs(pdaugh2->GetPdgCode());
1178 
1179  AliDebug(2,"Is non resonant?");
1180  if(nDaugh==3){
1181  Int_t thirdDaugh=part->GetDaughter(1)-1;
1182  AliAODMCParticle* pdaugh3 = (AliAODMCParticle*)arrayMC->At(thirdDaugh);
1183  Int_t number3 = TMath::Abs(pdaugh3->GetPdgCode());
1184  if((number1==321 && number2==211 && number3==2212) ||
1185  (number1==211 && number2==321 && number3==2212) ||
1186  (number1==211 && number2==2212 && number3==321) ||
1187  (number1==321 && number2==2212 && number3==211) ||
1188  (number1==2212 && number2==321 && number3==211) ||
1189  (number1==2212 && number2==211 && number3==321)) {
1190  numberOfLambdac++;
1191  if( TMath::Abs(pdaugh1->Eta()) > 0.9 || pdaugh1->Pt() < 0.1
1192  || TMath::Abs(pdaugh2->Eta()) > 0.9 || pdaugh2->Pt() < 0.1
1193  || TMath::Abs(pdaugh3->Eta()) > 0.9 || pdaugh3->Pt() < 0.1) IsInAcc=kFALSE;
1194  AliDebug(2,"Lc decays non-resonantly");
1195  return 1;
1196  }
1197  }
1198 
1199  if(nDaugh==2){
1200 
1201  //Lambda resonant
1202 
1203  //Lambda -> p K*0
1204  //
1205  Int_t nfiglieK=0;
1206 
1207  if((number1==2212 && number2==313)){
1208  nfiglieK=pdaugh2->GetNDaughters();
1209  if(nfiglieK!=2) return 0;
1210  AliAODMCParticle* pdaughK1 = (AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(0));
1211  AliAODMCParticle* pdaughK2 = (AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(1));
1212  if(!pdaughK1) return 0;
1213  if(!pdaughK2) return 0;
1214  if((TMath::Abs(pdaughK1->GetPdgCode())==211 && TMath::Abs(pdaughK2->GetPdgCode())==321) || (TMath::Abs(pdaughK1->GetPdgCode())==321 && TMath::Abs(pdaughK2->GetPdgCode())==211)) {
1215  numberOfLambdac++;
1216  if( TMath::Abs(pdaugh1->Eta()) > 0.9 || pdaugh1->Pt() < 0.1
1217  || TMath::Abs(pdaughK1->Eta()) > 0.9 || pdaughK1->Pt() < 0.1
1218  || TMath::Abs(pdaughK2->Eta()) > 0.9 || pdaughK2->Pt() < 0.1) IsInAcc=kFALSE;
1219  AliDebug(2,"Lc decays via K* p");
1220  return 3;
1221  }
1222  }
1223 
1224  if((number1==313 && number2==2212)){
1225  nfiglieK=pdaugh1->GetNDaughters();
1226  if(nfiglieK!=2) return 0;
1227  AliAODMCParticle* pdaughK1 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(0));
1228  AliAODMCParticle* pdaughK2 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(1));
1229  if(!pdaughK1) return 0;
1230  if(!pdaughK2) return 0;
1231  if((TMath::Abs(pdaughK1->GetPdgCode())==211 && TMath::Abs(pdaughK2->GetPdgCode())==321) || (TMath::Abs(pdaughK1->GetPdgCode())==321 && TMath::Abs(pdaughK2->GetPdgCode())==211)) {
1232  numberOfLambdac++;
1233  if( TMath::Abs(pdaugh2->Eta()) > 0.9 || pdaugh2->Pt() < 0.1
1234  || TMath::Abs(pdaughK1->Eta()) > 0.9 || pdaughK1->Pt() < 0.1
1235  || TMath::Abs(pdaughK2->Eta()) > 0.9 || pdaughK2->Pt() < 0.1) IsInAcc=kFALSE;
1236  AliDebug(2,"Lc decays via K* p");
1237  return 3;
1238  }
1239  }
1240 
1241  //Lambda -> Delta++ k
1242  Int_t nfiglieDelta=0;
1243  if(number1==321 && number2==2224){
1244  nfiglieDelta=pdaugh2->GetNDaughters();
1245  if(nfiglieDelta!=2) return 0;
1246  AliAODMCParticle *pdaughD1=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(0));
1247  AliAODMCParticle *pdaughD2=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(1));
1248  if(!pdaughD1) return 0;
1249  if(!pdaughD2) return 0;
1250  if((TMath::Abs(pdaughD1->GetPdgCode())==211 && TMath::Abs(pdaughD2->GetPdgCode())==2212) || (TMath::Abs(pdaughD1->GetPdgCode())==2212 && TMath::Abs(pdaughD2->GetPdgCode())==211)) {
1251  numberOfLambdac++;
1252  if( TMath::Abs(pdaugh1->Eta()) > 0.9 || pdaugh1->Pt() < 0.1
1253  || TMath::Abs(pdaughD1->Eta()) > 0.9 || pdaughD1->Pt() < 0.1
1254  || TMath::Abs(pdaughD2->Eta()) > 0.9 || pdaughD2->Pt() < 0.1) IsInAcc=kFALSE;
1255  AliDebug(2,"Lc decays via Delta++ k");
1256  return 4;
1257  }
1258  }
1259  if(number1==2224 && number2==321){
1260  nfiglieDelta=pdaugh1->GetNDaughters();
1261  if(nfiglieDelta!=2) return 0;
1262  AliAODMCParticle* pdaughD1 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(0));
1263  AliAODMCParticle* pdaughD2 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(1));
1264  if(!pdaughD1) return 0;
1265  if(!pdaughD2) return 0;
1266  if((TMath::Abs(pdaughD1->GetPdgCode())==211 && TMath::Abs(pdaughD2->GetPdgCode())==2212) || (TMath::Abs(pdaughD1->GetPdgCode())==2212 && TMath::Abs(pdaughD2->GetPdgCode())==211)) {
1267  numberOfLambdac++;
1268  if( TMath::Abs(pdaugh2->Eta()) > 0.9 || pdaugh2->Pt() < 0.1
1269  || TMath::Abs(pdaughD1->Eta()) > 0.9 || pdaughD1->Pt() < 0.1
1270  || TMath::Abs(pdaughD2->Eta()) > 0.9 || pdaughD2->Pt() < 0.1) IsInAcc=kFALSE;
1271  AliDebug(2,"Lc decays via Delta++ k");
1272  return 4;
1273  }
1274  }
1275 
1276 
1277  //Lambdac -> Lambda(1520) pi
1278  Int_t nfiglieLa=0;
1279  if(number1==3124 && number2==211){
1280  nfiglieLa=pdaugh1->GetNDaughters();
1281  if(nfiglieLa!=2) return 0;
1282  AliAODMCParticle *pdaughL1=(AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(0));
1283  AliAODMCParticle *pdaughL2=(AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(1));
1284  if(!pdaughL1) return 0;
1285  if(!pdaughL2) return 0;
1286  if((TMath::Abs(pdaughL1->GetPdgCode())==321 && TMath::Abs(pdaughL2->GetPdgCode())==2212) || (TMath::Abs(pdaughL1->GetPdgCode())==2212 && TMath::Abs(pdaughL2->GetPdgCode())==321)) {
1287  numberOfLambdac++;
1288  if( TMath::Abs(pdaugh2->Eta()) > 0.9 || pdaugh2->Pt() < 0.1
1289  || TMath::Abs(pdaughL1->Eta()) > 0.9 || pdaughL1->Pt() < 0.1
1290  || TMath::Abs(pdaughL2->Eta()) > 0.9 || pdaughL2->Pt() < 0.1) IsInAcc=kFALSE;
1291  AliDebug(2,"Lc decays via Lambda(1520) pi");
1292  return 2;
1293  }
1294  }
1295  if(number1==211 && number2==3124){
1296  nfiglieLa=pdaugh2->GetNDaughters();
1297  if(nfiglieLa!=2) return 0;
1298  AliAODMCParticle *pdaughL1=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(0));
1299  AliAODMCParticle *pdaughL2=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(1));
1300  if(!pdaughL1) return 0;
1301  if(!pdaughL2) return 0;
1302  if((TMath::Abs(pdaughL1->GetPdgCode())==321 && TMath::Abs(pdaughL2->GetPdgCode())==2212) || (TMath::Abs(pdaughL1->GetPdgCode())==2212 && TMath::Abs(pdaughL2->GetPdgCode())==321)) {
1303  numberOfLambdac++;
1304  if( TMath::Abs(pdaugh1->Eta()) > 0.9 || pdaugh1->Pt() < 0.1
1305  || TMath::Abs(pdaughL1->Eta()) > 0.9 || pdaughL1->Pt() < 0.1
1306  || TMath::Abs(pdaughL2->Eta()) > 0.9 || pdaughL2->Pt() < 0.1) IsInAcc=kFALSE;
1307  AliDebug(2,"Lc decays via Lambda(1520) pi");
1308  return 2;
1309  }
1310  }
1311  }
1312 
1313  if(numberOfLambdac>0) {return -100; AliDebug(2,"Lc decays via one of 4 resonances!");}
1314  return 0;
1315 }
1316 
1317 //-----------------------------
1318 
1319 void AliAnalysisTaskSELambdacTMVA::SetIsLcGen(AliAODMCParticle *mcPart, TClonesArray *arrayMC) {
1320 
1321  //
1324  //
1325 
1326  fIsLc=0;
1327  if(TMath::Abs(mcPart->GetPdgCode())==4122) {
1328  AliDebug(2,"Found Lc! now check mother");
1329  fIsLc=1;
1330  Int_t pdgMom = 0;
1331  pdgMom=fVertUtil->CheckOrigin(arrayMC,mcPart,fKeepLcNotFromQuark ? kFALSE : kTRUE);
1332  if(pdgMom == 5){
1333  AliDebug(2,"Lc comes from b");
1334  fIsLc=2;
1335  }
1336  else if(pdgMom==4) {
1337  fIsLc=1;
1338  }
1339  else {
1340  fIsLc=0;
1341  fhIsLcResonantGen->Fill(-1);
1342  }
1343  }
1344 }
1345 
1346 
1347 //-----------------------------
1348 
1350  TClonesArray *arrayMC) {
1351 
1352  //
1356  //
1357 
1358  Int_t labDp=-1;
1359  fIsLc = 0;
1360  fIsLcResonant=0;
1361  if(!fReadMC) return;
1362  else{ //MC, check if Lc prompt or non prompt
1363  Int_t pdgCand =4122;
1364  Int_t pdgDaughter[3]={-1,-1,-1};
1365  pdgDaughter[0]=2212;
1366  pdgDaughter[1]=321;
1367  pdgDaughter[2]=211;
1368 
1369  labDp = part->MatchToMC(pdgCand,arrayMC,3,pdgDaughter);
1370  if(labDp>=0){
1371  AliAODMCParticle *partDp = (AliAODMCParticle*)arrayMC->At(labDp);
1372  Int_t pdgMom=fVertUtil->CheckOrigin(arrayMC,partDp,fKeepLcNotFromQuark ? kFALSE : kTRUE);
1373  fhRecoPDGmom->Fill(pdgMom);
1374  if(pdgMom == 4) fIsLc=1;
1375  else if(pdgMom == 5) fIsLc=2;
1376  else fIsLc=0;
1377  Bool_t dummy = kTRUE;
1378  if(fIsLc>0) SetLambdacDaugh(partDp, arrayMC, dummy);
1379  }
1380 
1381  }
1382 }
1383 
1384 //---------------------------
1385 
1386 void AliAnalysisTaskSELambdacTMVA::FillMassHists(AliAODEvent *aod, AliAODRecoDecayHF3Prong *d, TClonesArray *arrayMC, Int_t selection, Int_t selectionProb) {
1388  Bool_t IsInjected = 0;
1389  Double_t invMassLcpKpi = d->InvMassLcpKpi();
1390  Double_t invMassLcpiKp = d->InvMassLcpiKp();
1391  Bool_t ispKpiMC = 0;
1392  Bool_t ispiKpMC = 0;
1393 
1394  if(fReadMC) {
1395  ispKpiMC = IspKpiMC(d,arrayMC);
1396  ispiKpMC = IspiKpMC(d,arrayMC);
1397  AliAODMCHeader *mcHeader2 = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1398  if(!fIsHijing) IsInjected = fVertUtil->IsCandidateInjected(d,mcHeader2,arrayMC); //for dedicated MC set to 0
1399 
1400  //signal
1401  if(fIsLc>=1) {
1402  //MC PID
1403  fhMCmassLcPtSig->Fill(d->Pt(),ispKpiMC ? invMassLcpKpi : invMassLcpiKp);
1404  if(fIsLc==1) fhMCmassLcPtSigc->Fill(d->Pt(),ispKpiMC ? invMassLcpKpi : invMassLcpiKp);
1405  else if(fIsLc==2) fhMCmassLcPtSigb->Fill(d->Pt(),ispKpiMC ? invMassLcpKpi : invMassLcpiKp);
1406  //Real PID
1407  if(selection==1){
1408  fhPIDmassLcPtSig->Fill(d->Pt(),invMassLcpKpi);
1409  if(fIsLc==1) fhPIDmassLcPtSigc->Fill(d->Pt(),invMassLcpKpi);
1410  else if(fIsLc==2) fhPIDmassLcPtSigb->Fill(d->Pt(),invMassLcpKpi);
1411  }
1412  else if(selection==2){
1413  fhPIDmassLcPtSig->Fill(d->Pt(),invMassLcpiKp);
1414  if(fIsLc==1) fhPIDmassLcPtSigc->Fill(d->Pt(),invMassLcpiKp);
1415  else if(fIsLc==2) fhPIDmassLcPtSigb->Fill(d->Pt(),invMassLcpiKp);
1416  }
1417  else if(selection==3){
1418  fhPIDmassLcPtSig->Fill(d->Pt(),invMassLcpiKp,0.5);
1419  fhPIDmassLcPtSig->Fill(d->Pt(),invMassLcpKpi,0.5);
1420  if(fIsLc==1) {
1421  fhPIDmassLcPtSigc->Fill(d->Pt(),invMassLcpiKp,0.5);
1422  fhPIDmassLcPtSigc->Fill(d->Pt(),invMassLcpKpi,0.5);
1423  }
1424  else if(fIsLc==2) {
1425  fhPIDmassLcPtSigb->Fill(d->Pt(),invMassLcpiKp,0.5);
1426  fhPIDmassLcPtSigb->Fill(d->Pt(),invMassLcpKpi,0.5);
1427  }
1428  }
1429  //max prob PID
1430  if(selectionProb==1) {
1431  fhProbmassLcPtSig->Fill(d->Pt(), invMassLcpKpi);
1432  if(fIsLc==1)fhProbmassLcPtSigc->Fill(d->Pt(), invMassLcpKpi);
1433  if(fIsLc==2)fhProbmassLcPtSigb->Fill(d->Pt(), invMassLcpKpi);
1434  }
1435  else if(selectionProb==2) {
1436  fhProbmassLcPtSig->Fill(d->Pt(), invMassLcpiKp);
1437  if(fIsLc==1)fhProbmassLcPtSigc->Fill(d->Pt(), invMassLcpiKp);
1438  if(fIsLc==2)fhProbmassLcPtSigb->Fill(d->Pt(), invMassLcpiKp);
1439  }
1440 
1441  // mis id'd signal candidates
1442  if(ispKpiMC && selection==2){ //RDHF PID
1443  fhPtMisIdpKpi->Fill(fCandidateVars[0]);
1444  fhInvMassMisIdpKpi->Fill(fCandidateVars[0],invMassLcpiKp);
1445  }
1446  else if(ispiKpMC && selection==1){
1447  fhPtMisIdpiKp->Fill(fCandidateVars[0]);
1448  fhInvMassMisIdpiKp->Fill(fCandidateVars[0],invMassLcpKpi);
1449  }
1450  else fhPtCorrId->Fill(fCandidateVars[0]);
1451 
1452  if(ispKpiMC && selectionProb==2){ //PID using max prob. criteria
1454  fhInvMassMisIdpKpiProb->Fill(fCandidateVars[0],invMassLcpiKp);
1455  }
1456  else if(ispiKpMC && selectionProb==1){
1458  fhInvMassMisIdpiKpProb->Fill(fCandidateVars[0],invMassLcpKpi);
1459  }
1460  else fhPtCorrIdProb->Fill(fCandidateVars[0]);
1461 
1462  }
1463  }
1464  //Bkg
1465  if(!fReadMC || (fIsLc==0 && (!IsInjected || fSyst ==0))) { //data or non-injected background or pp background
1466  //MC PID
1467  if(fReadMC) fhMCmassLcPt->Fill(d->Pt(),ispKpiMC ? invMassLcpKpi : invMassLcpiKp);
1468  //Real PID
1469  if(selection==1){
1470  fhPIDmassLcPt->Fill(d->Pt(),invMassLcpKpi);
1471  }
1472  else if(selection==2){
1473  fhPIDmassLcPt->Fill(d->Pt(),invMassLcpiKp);
1474  }
1475  else if(selection==3){
1476  fhPIDmassLcPt->Fill(d->Pt(),invMassLcpiKp,0.5);
1477  fhPIDmassLcPt->Fill(d->Pt(),invMassLcpKpi,0.5);
1478  }
1479  //max prob PID
1480  if(selectionProb==1) fhProbmassLcPt->Fill(d->Pt(),invMassLcpKpi);
1481  else if(selectionProb==2) fhProbmassLcPt->Fill(d->Pt(),invMassLcpiKp);
1482  }
1483 }
1484 
1485 //---------------------------
1486 
1488  TClonesArray *arrayMC, Int_t selection)
1489 {
1490  //
1492  //
1493 
1494  if(fReadMC && !fKeepBkgNt && fIsLc==0) return; //don't continue if bkg and only want signal
1495 
1496  Bool_t IsInjected = 0;
1497  Bool_t IsLc = 0;
1498  Bool_t IsLcfromLb = 0;
1499 
1500  if(fReadMC){
1501  AliAODMCHeader *mcHeader3 = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1502  if(!fIsHijing) IsInjected = fVertUtil->IsCandidateInjected(part,mcHeader3,arrayMC); //for dedicated MC set to 0
1503  }
1504  if(fIsLc>=1 && fIsLc<=2) IsLc=kTRUE;
1505  if(fIsLc==2) IsLcfromLb=kTRUE;
1506  if(fReadMC && IsInjected && !IsLc && fSyst >=1 ) return; //dont fill if injected bkg, pPb or PbPb
1507 
1508  Double_t invMasspKpi=-1.;
1509  Double_t invMasspiKp=-1.;
1510  //apply MC PID
1511  if(fReadMC && fMCPid){
1512  if(IspKpiMC(part,arrayMC)) invMasspKpi=part->InvMassLcpKpi();
1513  else if(IspiKpMC(part,arrayMC)) invMasspiKp=part->InvMassLcpiKp();
1514  //else return;
1515  }
1516  // apply realistic PID
1517  if(fRealPid){
1518  if(selection==1 || selection==3) invMasspKpi=part->InvMassLcpKpi();
1519  else if(selection>=2) invMasspiKp=part->InvMassLcpiKp();
1520  }
1521  // Float_t centrality=fRDCutsAnalysis->GetCentrality(aod);
1522  // Int_t runNumber=aod->GetRunNumber();
1523 
1524  //fill ntuple
1525  // 1 - loose pid
1526  // 2 - bayesian pid
1527  Float_t tmp[48];
1528  //Is Lc
1529  if(!IsInjected && IsLc==0) tmp[0]=0; //non-injected bkg
1530  else if(IsLc==1 && !IsLcfromLb) tmp[0]=1; //prompt Lc
1531  else if(IsLc==1 && IsLcfromLb) tmp[0]=2; //non-prompt Lc
1532  else if(IsInjected && IsLc==0) tmp[0]=3; //injected bkg
1533  else tmp[0]=-99; //should not happen
1534 
1535  //invariant mass
1536  tmp[2]=part->InvMassLcpiKp();
1537  tmp[1]=part->InvMassLcpKpi();
1538  tmp[3]=part->Charge();
1539  //pt of decay products
1540  tmp[4]=part->PtProng(0);
1541  tmp[5]=part->PtProng(1); //pt kaon
1542  tmp[6]=part->PtProng(2);
1543  tmp[7]=part->Pt();
1544  tmp[8]=part->CosPointingAngle();
1545  tmp[9]=part->DecayLength();
1546  tmp[10]=part->NormalizedDecayLength();
1547  tmp[11]=TMath::Min(part->GetDist12toPrim(),part->GetDist23toPrim());
1548  tmp[12]=part->GetSigmaVert();
1549  Double_t dcas[3]={0};
1550  part->GetDCAs(dcas);
1551  tmp[13]=TMath::Max(dcas[0],TMath::Max(dcas[1],dcas[2]));
1552  tmp[14]=part->DecayLengthXY();
1553  tmp[15]=part->NormalizedDecayLengthXY();
1554 
1555  //Check resonant decays for efficiencies
1556  tmp[16]=fIsLcResonant; // bkg
1557  //PID selection
1558  tmp[17]=selection;
1559 
1560  AliVTrack *track0=dynamic_cast<AliVTrack*>(part->GetDaughter(0));
1561  AliVTrack *track1=dynamic_cast<AliVTrack*>(part->GetDaughter(1));
1562  AliVTrack *track2=dynamic_cast<AliVTrack*>(part->GetDaughter(2));
1563  if(fFillNtuple>=1) {
1564  if(fRDCutsAnalysis->GetPidHF()->GetUseCombined()) {//check this
1565  //bayesian probabilities
1566  Double_t prob0[AliPID::kSPECIES];
1567  Double_t prob1[AliPID::kSPECIES];
1568  Double_t prob2[AliPID::kSPECIES];
1569 
1570  if (!track0 || !track1 || !track2) {
1571  AliError("AliVTrack missing - wont fill Ntuple");
1572  return;
1573  }
1574  fRDCutsAnalysis->GetPidHF()->GetPidCombined()->ComputeProbabilities(track0,fRDCutsAnalysis->GetPidHF()->GetPidResponse(),prob0);
1575  fRDCutsAnalysis->GetPidHF()->GetPidCombined()->ComputeProbabilities(track1,fRDCutsAnalysis->GetPidHF()->GetPidResponse(),prob1);
1576  fRDCutsAnalysis->GetPidHF()->GetPidCombined()->ComputeProbabilities(track2,fRDCutsAnalysis->GetPidHF()->GetPidResponse(),prob2);
1577  //if(prob0[AliPID::kPion] < 0.3 && prob0[AliPID::kProton] < 0.3) return;
1578  //if(prob1[AliPID::kKaon] < 0.3) return;
1579  //if(prob2[AliPID::kPion] < 0.3 && prob2[AliPID::kProton] < 0.3) return;
1580  tmp[18]=prob0[AliPID::kPion]; //track 0, pion
1581  tmp[19]=prob0[AliPID::kKaon]; //kaon
1582  tmp[20]=prob0[AliPID::kProton]; //proton
1583  tmp[21]=prob1[AliPID::kPion]; //track 1, pion
1584  tmp[22]=prob1[AliPID::kKaon]; //kaon
1585  tmp[23]=prob1[AliPID::kProton]; //proton
1586  tmp[24]=prob2[AliPID::kPion]; //track 2, pion
1587  tmp[25]=prob2[AliPID::kKaon]; //kaon
1588  tmp[26]=prob2[AliPID::kProton]; //proton
1589  }
1590  else {
1591  //fill w 0
1592  for(Int_t iprob=18;iprob<=26;iprob++) {
1593  tmp[iprob]=-1;
1594  }
1595  }
1596  }
1597  if(fFillNtuple>=2) {
1598  Double_t d00 = part->Getd0Prong(0);
1599  Double_t d01 = part->Getd0Prong(1);
1600  Double_t d02 = part->Getd0Prong(2);
1601  Double_t d0err0 = part->Getd0errProng(0);
1602  Double_t d0err1 = part->Getd0errProng(1);
1603  Double_t d0err2 = part->Getd0errProng(2);
1604  tmp[27]=d00;
1605  tmp[28]=d01;
1606  tmp[29]=d02;
1607  tmp[30]=d00*d00 + d01*d01 + d02*d02;
1608  tmp[31]=d00/d0err0;
1609  tmp[32]=d01/d0err1;
1610  tmp[33]=d02/d0err2;
1611  Double_t dd0,edd0;
1612  Double_t dd1,edd1;
1613  Double_t dd2,edd2;
1614  part->Getd0MeasMinusExpProng(0,aod->GetMagneticField(),dd0,edd0);
1615  part->Getd0MeasMinusExpProng(1,aod->GetMagneticField(),dd1,edd1);
1616  part->Getd0MeasMinusExpProng(2,aod->GetMagneticField(),dd2,edd2);
1617  Double_t ns0=dd0/edd0;
1618  Double_t ns1=dd1/edd1;
1619  Double_t ns2=dd2/edd2;
1620  tmp[34]=ns0;
1621  tmp[35]=ns1;
1622  tmp[36]=ns2;
1623  tmp[37]=part->CosPointingAngleXY();
1624  tmp[13]=dcas[0];
1625  tmp[38]=dcas[1];
1626  tmp[39]=dcas[2];
1627  tmp[11]=part->GetDist12toPrim();
1628  tmp[40]=part->GetDist23toPrim();
1629  Int_t runNumber=aod->GetRunNumber();
1630  tmp[41]=(Float_t)runNumber;
1631  }
1632  if(fFillNtuple>=3) {
1633  tmp[42]=part->InvMass2Prongs(1,0,321,2212); //inv mass pK
1634  tmp[43]=part->InvMass2Prongs(2,1,211,321); //inv mass Kpi
1635  tmp[44]=part->InvMass2Prongs(2,0,211,2212);//inv mass ppi
1636  tmp[45]=part->InvMass2Prongs(1,2,321,2212); //inv mass Kp
1637  tmp[46]=part->InvMass2Prongs(0,1,211,321); //inv mass piK
1638  tmp[47]=part->InvMass2Prongs(0,2,211,2212);//inv mass pip
1639  }
1640 
1641  fNtupleLambdac->Fill(tmp);
1642  PostData(5,fNtupleLambdac);
1643 
1644  return;
1645 }
1646 
1647 //---------------------------
1648 
1650 
1651  //
1654  //
1655 
1656  //fill according to kStep - hArray[nSteps]
1657  if(!fIsLc) {
1658  fhNBkgNI[kStep]->Fill(fCandidateVars[0]);
1659  fhPtEtaBkgNI[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1660  fhPtYBkgNI[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1661  fhPtPhiBkgNI[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1662  }
1663 
1664  else{
1665  fhNLc[kStep]->Fill(fCandidateVars[0]);
1666  fhPtEtaLc[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1667  fhPtYLc[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1668  fhPtPhiLc[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1669 
1670  if(fIsLc==1) { //prompt Lc
1671  fhNLcc[kStep]->Fill(fCandidateVars[0]);
1672  fhPtEtaLcc[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1673  fhPtYLcc[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1674  fhPtPhiLcc[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1675  if(fIsLcResonant==1){
1676  fhNLcNonRc[kStep]->Fill(fCandidateVars[0]);
1677  fhPtEtaLcNonRc[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1678  fhPtYLcNonRc[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1679  fhPtPhiLcNonRc[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1680  }
1681  else if(fIsLcResonant==2){
1682  fhNLcL1520c[kStep]->Fill(fCandidateVars[0]);
1683  fhPtEtaLcL1520c[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1684  fhPtYLcL1520c[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1685  fhPtPhiLcL1520c[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1686  }
1687  else if(fIsLcResonant==3){
1688  fhNLcKstarc[kStep]->Fill(fCandidateVars[0]);
1689  fhPtEtaLcKstarc[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1690  fhPtYLcKstarc[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1691  fhPtPhiLcKstarc[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1692  }
1693  else if(fIsLcResonant==4){
1694  fhNLcDeltac[kStep]->Fill(fCandidateVars[0]);
1695  fhPtEtaLcDeltac[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1696  fhPtYLcDeltac[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1697  fhPtPhiLcDeltac[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1698  }
1699  }
1700  else if(fIsLc==2) { //non-prompt Lc
1701  fhNLcb[kStep]->Fill(fCandidateVars[0]);
1702  fhPtEtaLcb[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1703  fhPtYLcb[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1704  fhPtPhiLcb[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1705  if(fIsLcResonant==1){
1706  fhNLcNonRb[kStep]->Fill(fCandidateVars[0]);
1707  fhPtEtaLcNonRb[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1708  fhPtYLcNonRb[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1709  fhPtPhiLcNonRb[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1710  }
1711  else if(fIsLcResonant==2){
1712  fhNLcL1520b[kStep]->Fill(fCandidateVars[0]);
1713  fhPtEtaLcL1520b[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1714  fhPtYLcL1520b[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1715  fhPtPhiLcL1520b[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1716  }
1717  else if(fIsLcResonant==3){
1718  fhNLcKstarb[kStep]->Fill(fCandidateVars[0]);
1719  fhPtEtaLcKstarb[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1720  fhPtYLcKstarb[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1721  fhPtPhiLcKstarb[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1722  }
1723  else if(fIsLcResonant==4){
1724  fhNLcDeltab[kStep]->Fill(fCandidateVars[0]);
1725  fhPtEtaLcDeltab[kStep]->Fill(fCandidateVars[0],fCandidateVars[1]);
1726  fhPtYLcDeltab[kStep]->Fill(fCandidateVars[0],fCandidateVars[2]);
1727  fhPtPhiLcDeltab[kStep]->Fill(fCandidateVars[0],fCandidateVars[3]);
1728  }
1729  }
1730  }
1731 }
1732 
1733 
1734 
1735 //-----------------------------
1737 
1738  //
1740  //
1741 
1742  Int_t lab[3]={0,0,0},pdgs[3]={0,0,0};
1743  for(Int_t i=0;i<3;i++){
1744  AliAODTrack *daugh=(AliAODTrack*)d->GetDaughter(i);
1745  lab[i]=daugh->GetLabel();
1746  if(lab[i]<0) return kFALSE;
1747  AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab[i]);
1748  if(!part) return kFALSE;
1749  pdgs[i]=TMath::Abs(part->GetPdgCode());
1750  }
1751 
1752  if(pdgs[0]==2212 && pdgs[1]==321 && pdgs[2]==211) return kTRUE;
1753 
1754  return kFALSE;
1755 }
1756 //-----------------------------
1758 
1759  //
1761  //
1762 
1763  Int_t lab[3]={0,0,0},pdgs[3]={0,0,0};
1764  for(Int_t i=0;i<3;i++){
1765  AliAODTrack *daugh=(AliAODTrack*)d->GetDaughter(i);
1766  lab[i]=daugh->GetLabel();
1767  if(lab[i]<0) return kFALSE;
1768  AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab[i]);
1769  if(!part) return kFALSE;
1770  pdgs[i]=TMath::Abs(part->GetPdgCode());
1771  }
1772 
1773  if(pdgs[2]==2212 && pdgs[1]==321 && pdgs[0]==211) {return kTRUE;}
1774 
1775  return kFALSE;
1776 }
1777 
1779  if(d->HasSelectionBit(AliRDHFCuts::kD0toKpiCuts)) hSelectionBits->Fill(1,fCandidateVars[0]);
1780  if(d->HasSelectionBit(AliRDHFCuts::kD0toKpiPID)) hSelectionBits->Fill(2,fCandidateVars[0]);
1781  if(d->HasSelectionBit(AliRDHFCuts::kD0fromDstarCuts)) hSelectionBits->Fill(3,fCandidateVars[0]);
1782  if(d->HasSelectionBit(AliRDHFCuts::kD0fromDstarPID)) hSelectionBits->Fill(4,fCandidateVars[0]);
1783  if(d->HasSelectionBit(AliRDHFCuts::kDplusCuts)) hSelectionBits->Fill(5,fCandidateVars[0]);
1784  if(d->HasSelectionBit(AliRDHFCuts::kDplusPID)) hSelectionBits->Fill(6,fCandidateVars[0]);
1785  if(d->HasSelectionBit(AliRDHFCuts::kDsCuts)) hSelectionBits->Fill(7,fCandidateVars[0]);
1786  if(d->HasSelectionBit(AliRDHFCuts::kDsPID)) hSelectionBits->Fill(8,fCandidateVars[0]);
1787  if(d->HasSelectionBit(AliRDHFCuts::kLcCuts)) hSelectionBits->Fill(9,fCandidateVars[0]);
1788  if(d->HasSelectionBit(AliRDHFCuts::kLcPID)) hSelectionBits->Fill(10,fCandidateVars[0]);
1789  if(d->HasSelectionBit(AliRDHFCuts::kDstarCuts)) hSelectionBits->Fill(11,fCandidateVars[0]);
1790  if(d->HasSelectionBit(AliRDHFCuts::kDstarPID)) hSelectionBits->Fill(12,fCandidateVars[0]);
1791 }
1792 
1794 
1795  Int_t selection = 0;
1796 
1797  if(fRDCutsAnalysis->GetPidHF()->GetUseCombined()) {//check this
1798  AliVTrack *track0=dynamic_cast<AliVTrack*>(part->GetDaughter(0));
1799  AliVTrack *track1=dynamic_cast<AliVTrack*>(part->GetDaughter(1));
1800  AliVTrack *track2=dynamic_cast<AliVTrack*>(part->GetDaughter(2));
1801  //bayesian probabilities
1802  Double_t prob0[AliPID::kSPECIES];
1803  Double_t prob1[AliPID::kSPECIES];
1804  Double_t prob2[AliPID::kSPECIES];
1805 
1806  if (!track0 || !track1 || !track2) {
1807  AliError("AliVTrack missing");
1808  return 0;
1809  }
1810  fRDCutsAnalysis->GetPidHF()->GetPidCombined()->ComputeProbabilities(track0,fRDCutsAnalysis->GetPidHF()->GetPidResponse(),prob0);
1811  fRDCutsAnalysis->GetPidHF()->GetPidCombined()->ComputeProbabilities(track1,fRDCutsAnalysis->GetPidHF()->GetPidResponse(),prob1);
1812  fRDCutsAnalysis->GetPidHF()->GetPidCombined()->ComputeProbabilities(track2,fRDCutsAnalysis->GetPidHF()->GetPidResponse(),prob2);
1813  if(prob0[AliPID::kProton] * prob1[AliPID::kKaon] * prob2[AliPID::kPion] > prob2[AliPID::kProton] * prob1[AliPID::kKaon] * prob0[AliPID::kPion]) selection = 1; // pKpi
1814  else selection = 2; // piKp
1815  }
1816  return selection;
1817 }
Double_t NormalizedDecayLengthXY() const
Double_t NormalizedDecayLength() const
Bool_t fLcCut
Vertexer heavy flavour (used to pass the cuts)
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
TH2F * fhMCmassLcPtSig
!Lc signal invariant mass vs pt
TH2F * fhPtYLcNonRb[12]
! hist. for n Lc from b non resonant, pT vs rapidity
Bool_t fRealPid
flag for access to MC
TH2F * fhInvMassMisIdpKpiProb
! hist for inv mass pKpi signal mis id'd as piKp most prob PID
TH1F * fhIsLcGen
!hist for resonant flag gen
TH2F * fhPtPhiLcDeltac[12]
! hist. for n Lc from c Delta++ + K, pT vs phi
TH2F * fhPtEtaLcDeltab[12]
! hist. for n Lc from b Delta++ + K, pT vs eta
TH2F * fhPtPhiLc[12]
! hist. for n Lc tot., pT vs phi
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
void FillSelectionBits(AliAODRecoDecayHF3Prong *d, TH2F *hSelectionBits)
TH2F * fhProbmassLcPtSigb
!Lc from b signal invariant mass vs pt
void Getd0MeasMinusExpProng(Int_t ip, Double_t magf, Double_t &d0diff, Double_t &errd0diff) const
TH2F * fhPtEtaBkgNI[12]
! hist. for n bkg, pT vs eta
Bool_t HasSelectionBit(Int_t i) const
TH1F * fhNLcL1520c[12]
! hist. for n Lc from c L1520 + pi, pT
Bool_t GetUseCombined()
Definition: AliAODPidHF.h:165
TH1F * fhNLcb[12]
! hist. for n Lc tot. from b, pT
TH2F * fhPIDmassLcPtSig
!Lc signal invariant mass vs pt
virtual void Terminate(Option_t *option)
Int_t GetPIDselectionMaxProb(AliAODRecoDecayHF3Prong *part)
TList * fOutput
! list send on output slot 0
void FillNtuple(AliAODEvent *aod, AliAODRecoDecayHF3Prong *part, TClonesArray *arrayMC, Int_t selection)
TH2F * fhInvMassMisIdpKpi
! hist for inv mass pKpi signal mis id'd as piKp
Int_t LambdacDaugh(AliAODMCParticle *part, TClonesArray *arrayMC, Bool_t &isInAcc) const
TH2F * fhPtPhiLcc[12]
! hist. for n Lc tot. from c, pT vs phi
TH2F * fhPIDmassLcPtSigb
!Lc from b signal invariant mass vs pt
TH2F * fhProbmassLcPtSigc
!Lc from c signal invariant mass vs pt
Float_t fUpmasslimit
pt of Lc candidate
Float_t fCandidateVars[4]
is Lc resonant - 1=non resonant, 2=via L1520 + pi, 3=via K* + p, 4=via Delta++ + K ...
TH2F * fhPtYLc[12]
! hist. for n Lc tot., pT vs rapidity
Int_t GetWhyRejection() const
Definition: AliRDHFCuts.h:294
Double_t CosPointingAngleXY() const
ULong_t GetSelectionMap() const
TH1F * fhPtMisIdpiKpProb
! hist for pt pKpi signal mis id'd as piKp most prob PID
void FillMassHists(AliAODEvent *aod, AliAODRecoDecayHF3Prong *d, TClonesArray *arrayMC, Int_t selection, Int_t selectionProb)
TH2F * fhPtYLcNonRc[12]
! hist. for n Lc from c non resonant, pT vs rapidity
TH2F * fhPtYLcc[12]
! hist. for n Lc tot. from c, pT vs rapidity
AliPIDResponse * fPIDResponse
histo with number of entries
TH1F * fhPtCorrId
! hist for correctly id'd pKpi
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
Double_t GetMaxVtxZ() const
Definition: AliRDHFCuts.h:241
Bool_t fKeepLcNotFromQuark
filling ntuple type
TH2F * fhPtEtaLc[12]
! hist. for n Lc tot., pT vs eta
TH2F * fhPtEtaLcKstarc[12]
! hist. for n Lc from c K* + p, pT vs eta
TH2F * fhPtEtaLcL1520c[12]
! hist. for n Lc from c L1520 + pi, pT vs eta
TH2F * fhPtEtaLcNonRc[12]
! hist. for n Lc from c non resonant, pT vs eta
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:231
TH2F * fhPtYLcDeltab[12]
! hist. for n Lc from b Delta++ + K, pT vs rapidity
AliNormalizationCounter * fCounter
!AliNormalizationCounter on output slot 7
void SetLambdacDaugh(AliAODMCParticle *part, TClonesArray *arrayMC, Bool_t &isInAcc)
Bool_t fReadMC
flag for collision system. 0=pp, 1=PbPb, 2=pPb
TH2F * fhPtPhiLcKstarc[12]
! hist. for n Lc from c K* + p, pT vs phi
TH1F * fhNLcDeltac[12]
! hist. for n Lc from c Delta++ + K, pT
Int_t MatchToMCLambdac(AliAODRecoDecayHF3Prong *d, TClonesArray *arrayMC) const
TH2F * fhInvMassMisIdpiKpProb
! hist for inv mass pKpi signal mis id'd as piKp most prob PID
TH2F * fhMCmassLcPt
!Lc Bkg+signal invariant mass vs pt
TH2F * fhPtEtaLcL1520b[12]
! hist. for n Lc from b L1520 + pi, pT vs eta
Int_t fSyst
flag to keep background in
TH2F * fhPtYLcDeltac[12]
! hist. for n Lc from c Delta++ + K, pT vs rapidity
TH2F * fhPIDmassLcPtSigc
!Lc from c signal invariant mass vs pt
TH2F * fhPtYLcL1520b[12]
! hist. for n Lc from b L1520 + pi, pT vs rapidity
TH2F * fhPtPhiLcb[12]
! hist. for n Lc tot. from b, pT vs phi
AliPIDCombined * GetPidCombined() const
Definition: AliAODPidHF.h:161
TH2F * fhProbmassLcPtSig
!Lc signal invariant mass vs pt
TH2F * fhSelectionBits
! hist for ALL Filter bits
TH2F * fhInvMassMisIdpiKp
! hist for inv mass pKpi signal mis id'd as piKp
TNtuple * fNtupleLambdac
! output ntuple
TH2F * fhPtPhiLcL1520c[12]
! hist. for n Lc from c L1520 + pi, pT vs phi
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
TH1F * fhNLcc[12]
! hist. for n Lc tot. from c, pT
TH1F * fhSelectBit
! hist for Filter Bit
TH1F * fhIsLcResonantGen
!hist for resonant flag gen
TH2F * fhSelectionBitsSigb
! hist for ALL Filter bits Lc from b
Bool_t IspiKpMC(AliAODRecoDecayHF3Prong *d, TClonesArray *arrayMC) const
TH2F * fhPtYBkgNI[12]
! hist. for n bkg, pT vs rapidity
AliAODVertex * GetOwnPrimaryVtx() const
TH2F * fhPtPhiLcDeltab[12]
! hist. for n Lc from b Delta++ + K, pT vs phi
Double_t GetSigmaVert(const AliAODEvent *aod=0x0)
AliAODPidHF * GetPidprot() const
TH1F * fhNLcKstarb[12]
! hist. for n Lc from b K* + p, pT
TH1F * fNentries
flag for whether Lc is from Hijing
AliAnalysisVertexingHF * fVHF
apply analysis cuts
Bool_t fKeepBkgNt
flag to keep Lc not from quark
Double_t Getd0errProng(Int_t ip) const
prongs
TH1F * fhNBkgNI[12]
! hist. for n bkg, pT
TH2F * fhPIDmassLcPt
!Lc Bkg+signal invariant mass vs pt
TH2F * fhPtPhiLcNonRb[12]
! hist. for n Lc from b non resonant, pT vs phi
TH2F * fhPtEtaLcc[12]
! hist. for n Lc tot. from c, pT vs eta
TH2F * fhMCmassLcPtSigc
!Lc from c signal invariant mass vs pt
Bool_t IspKpiMC(AliAODRecoDecayHF3Prong *d, TClonesArray *arrayMC) const
AliPIDResponse * GetPidResponse() const
Definition: AliAODPidHF.h:160
Float_t fLowmasslimit
upper inv mass limit for histos
Bool_t IsCandidateInjected(AliAODRecoDecayHF *cand, AliAODMCHeader *header, TClonesArray *arrayMC)
TH2F * fhProbmassLcPt
!Lc Bkg+signal invariant mass vs pt
TH1F * fhPtMisIdpiKp
! hist for pt pKpi signal mis id'd as piKp
void GetDCAs(Double_t dca[3]) const
AliAODPidHF * GetPidpion() const
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Bool_t GetLambdacDaugh(AliAODMCParticle *part, TClonesArray *arrayMC) const
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
Double_t DecayLengthXY() const
virtual void UserExec(Option_t *option)
TH2F * fhPtPhiLcL1520b[12]
! hist. for n Lc from b L1520 + pi, pT vs phi
TH1F * fhSetIsLc
! hist for before/after reco check MC LC
TH2F * fhPtEtaLcDeltac[12]
! hist. for n Lc from c Delta++ + K, pT vs eta
TH2F * fhPtPhiBkgNI[12]
! hist. for n bkg, pT vs phi
TH1F * fHistNEvents
!hist. for No. of events
TH2F * fhPtYLcb[12]
! hist. for n Lc tot. from b, pT vs rapidity
Bool_t IsEventSelected(AliVEvent *event)
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
TH2F * fhPtPhiLcKstarb[12]
! hist. for n Lc from b K* + p, pT vs phi
void SetOldPid(Bool_t oldPid)
Definition: AliAODPidHF.h:108
TH2F * fhPtYLcKstarb[12]
! hist. for n Lc from b K* + p, pT vs rapidity
TH2F * fhPtYLcL1520c[12]
! hist. for n Lc from c L1520 + pi, pT vs rapidity
TH1F * fhNLcL1520b[12]
! hist. for n Lc from b L1520 + pi, pT
TH1F * fhPtMisIdpKpiProb
! hist for pt pKpi signal mis id'd as piKp most prob PID
TH1F * fhNLcNonRc[12]
! hist. for n Lc from c non resonant, pT
TH2F * fhPtEtaLcb[12]
! hist. for n Lc tot. from b, pT vs eta
void SetIsLcReco(AliAODRecoDecayHF3Prong *part, TClonesArray *arrayMC)
TH1F * fhIsLcReco
!hist for resonant flag reco
Bool_t GetIsUsePID() const
Definition: AliRDHFCuts.h:254
TH2F * fhPtPhiLcNonRc[12]
! hist. for n Lc from c non resonant, pT vs phi
TH1F * fhIsLcResonantReco
!hist for resonant flag reco
TH1F * fhNLcNonRb[12]
! hist. for n Lc from b non resonant, pT
TH2F * fhPtYLcKstarc[12]
! hist. for n Lc from c K* + p, pT vs rapidity
TH2F * fhMCmassLcPtSigb
!Lc from b signal invariant mass vs pt
Double_t CosPointingAngle() const
TH1F * fhPtMisIdpKpi
! hist for pt pKpi signal mis id'd as piKp
TH1F * fhNLc[12]
! hist. for n Lc tot., pT
TH1F * fhNLcKstarc[12]
! hist. for n Lc from c K* + p, pT
void SetIsLcGen(AliAODMCParticle *partMC, TClonesArray *arrayMC)
Int_t fIsLcResonant
is MC Lc - 0=not Lc, 1=Lc from c, 2=Lc from b
Int_t PtBin(Double_t pt) const
TH1F * fhNLcDeltab[12]
! hist. for n Lc from b Delta++ + K, pT
Double_t DecayLength() const
TH2F * fhSelectionBitsSigc
! hist for ALL Filter bits Lc from c
TH2F * fhPtEtaLcNonRb[12]
! hist. for n Lc from b non resonant, pT vs eta
TH2F * fhPtEtaLcKstarb[12]
! hist. for n Lc from b K* + p, pT vs eta
Bool_t fIsHijing
flag for Lc filter bit PID
Bool_t fMCPid
flag for access to MC
void SetPidResponse(AliPIDResponse *pidResp)
Definition: AliAODPidHF.h:111
Class with functions useful for different D2H analyses //.
TH1F * fhPtCorrIdProb
! hist for correctly id'd pKpi most prob PID
Bool_t fLcPIDCut
flag for Lc filter bit cut
AliRDHFCutsLctopKpi * fRDCutsAnalysis
lower inv mass limit for histos