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