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