AliPhysics  59e0e03 (59e0e03)
AliAnalysisTaskSELambdac.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: AliAnalysisTaskSELambdac.cxx 63644 2013-07-23 09:04:11Z zconesa $ */
17 
19 //
20 // AliAnalysisTaskSE for the extraction of signal(e.g Lambdac) of heavy flavor
21 // decay candidates with the MC truth.
22 // Authors: r.romita@gsi.de
24 
25 #include <TClonesArray.h>
26 #include <TNtuple.h>
27 #include <TCanvas.h>
28 #include <TList.h>
29 #include <TString.h>
30 #include <TH1F.h>
31 #include <TH2F.h>
32 #include <TDatabasePDG.h>
33 
34 #include <AliAnalysisDataSlot.h>
35 #include <AliAnalysisDataContainer.h>
36 #include "AliAnalysisManager.h"
37 #include "AliAODHandler.h"
38 #include "AliAODEvent.h"
39 #include "AliAODVertex.h"
40 #include "AliAODTrack.h"
41 #include "AliAODMCHeader.h"
42 #include "AliAODMCParticle.h"
44 #include "AliAnalysisVertexingHF.h"
45 #include "AliAnalysisTaskSE.h"
47 #include "AliKFParticle.h"
48 #include "AliAODPidHF.h"
49 #include "AliRDHFCutsLctopKpi.h"
50 #include "AliRDHFCuts.h"
51 #include "AliKFVertex.h"
52 #include "AliESDVertex.h"
53 //#include "AliAODpidUtil.h"
54 #include "AliAODPid.h"
55 #include "AliInputEventHandler.h"
56 #include "AliPID.h"
58 #include "AliVertexingHFUtils.h"
59 
60 
62 ClassImp(AliAnalysisTaskSELambdac);
64 
65 //________________________________________________________________________
68  fOutput(0),
69  fHistNEvents(0),
70  fhChi2(0),
71  fhMassPtGreater3(0),
72  fhMassPtGreater3TC(0),
73  fhMassPtGreater3Kp(0),
74  fhMassPtGreater3KpTC(0),
75  fhMassPtGreater3Lpi(0),
76  fhMassPtGreater3LpiTC(0),
77  fhMassPtGreater3Dk(0),
78  fhMassPtGreater3DkTC(0),
79  fhMassPtGreater33Pr(0),
80  fhMassPtGreater33PrTC(0),
81  fhMassPtGreater2(0),
82  fhMassPtGreater2TC(0),
83  fhMassPtGreater2Kp(0),
84  fhMassPtGreater2KpTC(0),
85  fhMassPtGreater2Lpi(0),
86  fhMassPtGreater2LpiTC(0),
87  fhMassPtGreater2Dk(0),
88  fhMassPtGreater2DkTC(0),
89  fhMassPtGreater23Pr(0),
90  fhMassPtGreater23PrTC(0),
91  fhMassLcPt(0),
92  fhMassLcplusPt(0),
93  fhMassLcminusPt(0),
94  fhEta3Prong(0),
95  fhEta3ProngAcc(0),
96  fhEta3ProngProd(0),
97  fhEta3ProngAn(0),
98  fhRap3Prong(0),
99  fhRap3ProngAcc(0),
100  fhRap3ProngProd(0),
101  fhRap3ProngAn(0),
102  fhSelectBit(0),
103  fhProtonPtProngLcPt(0),
104  fhBProtonPtProngLcPt(0),
105  fhProtond0ProngLcPt(0),
106  fhBProtond0ProngLcPt(0),
107  fhKaonPtProngLcPt(0),
108  fhBKaonPtProngLcPt(0),
109  fhKaond0ProngLcPt(0),
110  fhBKaond0ProngLcPt(0),
111  fhPionPtProngLcPt(0),
112  fhBPionPtProngLcPt(0),
113  fhPiond0ProngLcPt(0),
114  fhBPiond0ProngLcPt(0),
115  fhDist12PrimLcPt(0),
116  fhBDist12PrimLcPt(0),
117  fhSigmaVertLcPt(0),
118  fhBSigmaVertLcPt(0),
119  fhdcasLcPt(0),
120  fhBdcasLcPt(0),
121  fhCosPointingAngleLcPt(0),
122  fhBCosPointingAngleLcPt(0),
123  fhDecayLengthLcPt(0),
124  fhBDecayLengthLcPt(0),
125  fhSum2LcPt(0),
126  fhBSum2LcPt(0),
127  fhPtMaxLcPt(0),
128  fhBPtMaxLcPt(0),
129  fNtupleLambdac(0),
130  fUpmasslimit(2.486),
131  fLowmasslimit(2.086),
132  fNPtBins(0),
133  fRDCutsAnalysis(0),
134  fRDCutsProduction(0),
135  fListCuts(0),
136  fFillNtuple(kFALSE),
137  fReadMC(kFALSE),
138  fMCPid(kFALSE),
139  fRealPid(kFALSE),
140  fResPid(kTRUE),
141  fUseKF(kFALSE),
142  fAnalysis(kFALSE),
143  fVHF(0),
144  fFillVarHists(kFALSE),
145  fMultiplicityHists(kFALSE),
146  fPriorsHists(kFALSE),
147  fLcCut(kFALSE),
148  fLcPIDCut(kFALSE),
149  fNentries(0),
150  fOutputMC(0),
151  fAPriori(0),
152  fMultiplicity(0),
153 //fUtilPid(0),
154  fPIDResponse(0),
155  fCounter(0)
156 {
157  // Default constructor
158  Float_t ptlims[7]={0.,2.,4.,6.,8.,12.,24.};
159  SetPtBinLimit(7,ptlims);
160  for(Int_t icut=0; icut<2; icut++) fCutsKF[icut]=0.;
161  for(Int_t j=0; j<3*kMaxPtBins; j++){
162  fMassHist[j]=0x0;
163  fMassHistTC[j]=0x0;
164  fMassHistLpi[j]=0x0;
165  fMassHistLpiTC[j]=0x0;
166  fMassHistKp[j]=0x0;
167  fMassHistKpTC[j]=0x0;
168  fMassHistDk[j]=0x0;
169  fMassHistDkTC[j]=0x0;
170  fMassHist3Pr[j]=0x0;
171  fMassHist3PrTC[j]=0x0;
172  }
173 }
174 
175 //________________________________________________________________________
177  AliAnalysisTaskSE(name),
178  fOutput(0),
179  fHistNEvents(0),
180  fhChi2(0),
181  fhMassPtGreater3(0),
191  fhMassPtGreater2(0),
201  fhMassLcPt(0),
202  fhMassLcplusPt(0),
203  fhMassLcminusPt(0),
204  fhEta3Prong(0),
205  fhEta3ProngAcc(0),
206  fhEta3ProngProd(0),
207  fhEta3ProngAn(0),
208  fhRap3Prong(0),
209  fhRap3ProngAcc(0),
210  fhRap3ProngProd(0),
211  fhRap3ProngAn(0),
212  fhSelectBit(0),
225  fhDist12PrimLcPt(0),
227  fhSigmaVertLcPt(0),
228  fhBSigmaVertLcPt(0),
229  fhdcasLcPt(0),
230  fhBdcasLcPt(0),
235  fhSum2LcPt(0),
236  fhBSum2LcPt(0),
237  fhPtMaxLcPt(0),
238  fhBPtMaxLcPt(0),
239  fNtupleLambdac(0),
240  fUpmasslimit(2.486),
241  fLowmasslimit(2.086),
242  fNPtBins(0),
243  fRDCutsAnalysis(lccutsana),
244  fRDCutsProduction(lccutsprod),
245  fListCuts(0),
246  fFillNtuple(fillNtuple),
247  fReadMC(kFALSE),
248  fMCPid(kFALSE),
249  fRealPid(kTRUE),
250  fResPid(kFALSE),
251  fUseKF(kFALSE),
252  fAnalysis(kFALSE),
253  fVHF(0),
254  fFillVarHists(kFALSE),
255  fMultiplicityHists(kFALSE),
256  fPriorsHists(kFALSE),
257  fLcCut(kFALSE),
258  fLcPIDCut(kFALSE),
259  fNentries(0),
260  fOutputMC(0),
261  fAPriori(0),
262  fMultiplicity(0),
263  //fUtilPid(0),
264  fPIDResponse(0),
265  fCounter(0)
266 {
269  for(Int_t icut=0; icut<2; icut++) fCutsKF[icut]=0.;
270  for(Int_t j=0; j<3*kMaxPtBins; j++){
271  fMassHist[j]=0x0;
272  fMassHistTC[j]=0x0;
273  fMassHistLpi[j]=0x0;
274  fMassHistLpiTC[j]=0x0;
275  fMassHistKp[j]=0x0;
276  fMassHistKpTC[j]=0x0;
277  fMassHistDk[j]=0x0;
278  fMassHistDkTC[j]=0x0;
279  fMassHist3Pr[j]=0x0;
280  fMassHist3PrTC[j]=0x0;
281  }
282  // Default constructor
283  // Output slot #1 writes into a TList container
284  DefineOutput(1,TList::Class()); //My private output
285  DefineOutput(2,TList::Class());
286  DefineOutput(3,TList::Class());
287  DefineOutput(4,TH1F::Class());
288  DefineOutput(5,TList::Class());
289  DefineOutput(6,TList::Class());
290  DefineOutput(7,AliNormalizationCounter::Class());
291  if (fFillNtuple) {
292  // Output slot #2 writes into a TNtuple container
293  DefineOutput(8,TNtuple::Class()); //My private output
294  }
295 }
296 
297 //________________________________________________________________________
299 {
300  // Destructor
301  if (fOutput) {
302  delete fOutput;
303  fOutput = 0;
304  }
305  if (fOutputMC) {
306  delete fOutputMC;
307  fOutputMC = 0;
308  }
309  if (fAPriori) {
310  delete fAPriori;
311  fAPriori = 0;
312  }
313  if (fMultiplicity) {
314  delete fMultiplicity;
315  fMultiplicity = 0;
316  }
317 
318  if (fVHF) {
319  delete fVHF;
320  fVHF = 0;
321  }
322 
323  if(fRDCutsAnalysis){
324  delete fRDCutsAnalysis;
325  fRDCutsAnalysis = 0;
326  }
327  if(fRDCutsProduction){
328  delete fRDCutsProduction;
329  fRDCutsProduction = 0;
330  }
331 
332  if (fListCuts) {
333  delete fListCuts;
334  fListCuts = 0;
335  }
336  if (fNentries){
337  delete fNentries;
338  fNentries = 0;
339  }
340  /*
341  if (fUtilPid){
342  delete fUtilPid;
343  fUtilPid = 0;
344  }
345  */
346  if (fPIDResponse) {
347  delete fPIDResponse;
348  }
349  if(fCounter){
350  delete fCounter;
351  fCounter = 0;
352  }
353 
354 }
355 //_________________________________________________________________
357  fUpmasslimit = 2.286+range;
358  fLowmasslimit = 2.286-range;
359 }
360 //_________________________________________________________________
362  if(uplimit>lowlimit)
363  {
364  fUpmasslimit = lowlimit;
365  fLowmasslimit = uplimit;
366  }
367 }
368 
369 
370 //________________________________________________________________________
372  // define pt bins for analysis
373  if(n>kMaxPtBins){
374  printf("Max. number of Pt bins = %d\n",kMaxPtBins);
376  fArrayBinLimits[0]=0.;
377  fArrayBinLimits[1]=2.;
378  fArrayBinLimits[2]=3.;
379  fArrayBinLimits[3]=4.;
380  for(Int_t i=4; i<kMaxPtBins+1; i++) fArrayBinLimits[i]=99999999.;
381  }else{
382  fNPtBins=n-1;
383  fArrayBinLimits[0]=lim[0];
384  for(Int_t i=1; i<fNPtBins+1; i++)
385  if(lim[i]>fArrayBinLimits[i-1]){
386  fArrayBinLimits[i]=lim[i];
387  }
388  else {
390  }
391  for(Int_t i=fNPtBins; i<kMaxPtBins+1; i++) fArrayBinLimits[i]=99999999.;
392  }
393  if(fDebug > 1){
394  printf("Number of Pt bins = %d\n",fNPtBins);
395  for(Int_t i=0; i<fNPtBins; i++) printf(" Bin%d = %8.2f-%8.2f\n",i,fArrayBinLimits[i],fArrayBinLimits[i+1]);
396  }
397 }
398 //_________________________________________________________________
400  if(ibin>fNPtBins)return -1;
401  return fArrayBinLimits[ibin];
402 }
403 
404 //_________________________________________________________________
406 {
407  // Initialization
408 
409  if (fDebug > 1) printf("AnalysisTaskSELambdac::Init() \n");
410 
411  fListCuts=new TList();
412  fListCuts->SetOwner();
413 
416  PostData(2,fListCuts);
417  return;
418 }
419 
420 //________________________________________________________________________
422 {
423  // Create the output container
424  //
425  if (fDebug > 1) printf("AnalysisTaskSELambdac::UserCreateOutputObjects() \n");
426 
427  // Several histograms are more conveniently managed in a TList
428  fOutput = new TList();
429  fOutput->SetOwner();
430  fOutput->SetName("OutputHistos");
431 
432  TString hisname;
433  Int_t index=0;
434  // Int_t indexLS=0;
435  for(Int_t i=0;i<fNPtBins;i++){
436 
437  index=GetHistoIndex(i);
438  // indexLS=GetLSHistoIndex(i);
439 
440  hisname.Form("hMassPt%d",i);
441  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
442  fMassHist[index]->Sumw2();
443  hisname.Form("hMassPt%dTC",i);
444  fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
445  fMassHistTC[index]->Sumw2();
446 
447  hisname.Form("hMassPtLpi%d",i);
448  fMassHistLpi[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
449  fMassHistLpi[index]->Sumw2();
450  hisname.Form("hMassPtLpi%dTC",i);
451  fMassHistLpiTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
452  fMassHistLpiTC[index]->Sumw2();
453 
454  hisname.Form("hMassPtKp%d",i);
455  fMassHistKp[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
456  fMassHistKp[index]->Sumw2();
457  hisname.Form("hMassPtKp%dTC",i);
458  fMassHistKpTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
459  fMassHistKpTC[index]->Sumw2();
460  hisname.Form("hMassPtDk%d",i);
461  fMassHistDk[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
462  fMassHistDk[index]->Sumw2();
463  hisname.Form("hMassPtDk%dTC",i);
464  fMassHistDkTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
465  fMassHistDkTC[index]->Sumw2();
466 
467  hisname.Form("hMassPt3Pr%d",i);
468  fMassHist3Pr[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
469  fMassHist3Pr[index]->Sumw2();
470  hisname.Form("hMassPt3Pr%dTC",i);
471  fMassHist3PrTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
472  fMassHist3PrTC[index]->Sumw2();
473  //signal
474  index=GetSignalHistoIndex(i);
475  hisname.Form("hSigPt%d",i);
476  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
477  fMassHist[index]->Sumw2();
478  hisname.Form("hSigPt%dTC",i);
479  fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
480  fMassHistTC[index]->Sumw2();
481  hisname.Form("hSigPtLpi%d",i);
482  fMassHistLpi[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
483  fMassHistLpi[index]->Sumw2();
484  hisname.Form("hSigPtLpi%dTC",i);
485  fMassHistLpiTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
486  fMassHistLpiTC[index]->Sumw2();
487 
488  hisname.Form("hSigPtKp%d",i);
489  fMassHistKp[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
490  fMassHistKp[index]->Sumw2();
491  hisname.Form("hSigPtKp%dTC",i);
492  fMassHistKpTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
493  fMassHistKpTC[index]->Sumw2();
494 
495  hisname.Form("hSigPtDk%d",i);
496  fMassHistDk[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
497  fMassHistDk[index]->Sumw2();
498  hisname.Form("hSigPtDk%dTC",i);
499  fMassHistDkTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
500  fMassHistDkTC[index]->Sumw2();
501 
502  hisname.Form("hSigPt3Pr%d",i);
503  fMassHist3Pr[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
504  fMassHist3Pr[index]->Sumw2();
505  hisname.Form("hSigPt3Pr%dTC",i);
506  fMassHist3PrTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
507  fMassHist3PrTC[index]->Sumw2();
508 
509  index=GetLbHistoIndex(i);
510  hisname.Form("hSigLbPt%d",i);
511  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
512  fMassHist[index]->Sumw2();
513  hisname.Form("hSigLbPt%dTC",i);
514  fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
515  fMassHistTC[index]->Sumw2();
516 
517  index=GetcOnlyHistoIndex(i);
518  hisname.Form("hSigcOnlyPt%d",i);
519  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
520  fMassHist[index]->Sumw2();
521  hisname.Form("hSigcOnlyPt%dTC",i);
522  fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
523  fMassHistTC[index]->Sumw2();
524 
525  index=GetNoQuarkHistoIndex(i);
526  hisname.Form("hSigNoQuarkPt%d",i);
527  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
528  fMassHist[index]->Sumw2();
529  hisname.Form("hSigNoQuarkPt%dTC",i);
530  fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
531  fMassHistTC[index]->Sumw2();
532 
533  index=GetBackgroundHistoIndex(i);
534  hisname.Form("hBkgPt%d",i);
535  fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
536  fMassHist[index]->Sumw2();
537  hisname.Form("hBkgPt%dTC",i);
538  fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
539  fMassHistTC[index]->Sumw2();
540  hisname.Form("hBkgPtLpi%d",i);
541  fMassHistLpi[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
542  fMassHistLpi[index]->Sumw2();
543  hisname.Form("hBkgPtLpi%dTC",i);
544  fMassHistLpiTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
545  fMassHistLpiTC[index]->Sumw2();
546 
547  hisname.Form("hBkgPtKp%d",i);
548  fMassHistKp[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
549  fMassHistKp[index]->Sumw2();
550  hisname.Form("hBkgPtKp%dTC",i);
551  fMassHistKpTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
552  fMassHistKpTC[index]->Sumw2();
553 
554  hisname.Form("hBkgPtDk%d",i);
555  fMassHistDk[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
556  fMassHistDk[index]->Sumw2();
557  hisname.Form("hBkgPtDk%dTC",i);
558  fMassHistDkTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
559  fMassHistDkTC[index]->Sumw2();
560 
561  hisname.Form("hBkgPt3Pr%d",i);
562  fMassHist3Pr[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
563  fMassHist3Pr[index]->Sumw2();
564  hisname.Form("hBkgPt3Pr%dTC",i);
565  fMassHist3PrTC[index]=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
566  fMassHist3PrTC[index]->Sumw2();
567  }
568 
569  for(Int_t ii=0; ii<6*fNPtBins; ii++){
570  fOutput->Add(fMassHist[ii]);
571  fOutput->Add(fMassHistTC[ii]);
572  }
573  for(Int_t i=0; i<3*fNPtBins; i++){
574  fOutput->Add(fMassHistLpi[i]);
575  fOutput->Add(fMassHistLpiTC[i]);
576  fOutput->Add(fMassHistKp[i]);
577  fOutput->Add(fMassHistKpTC[i]);
578  fOutput->Add(fMassHistDk[i]);
579  fOutput->Add(fMassHistDkTC[i]);
580  fOutput->Add(fMassHist3Pr[i]);
581  fOutput->Add(fMassHist3PrTC[i]);
582  }
583 
584  fhMassLcPt = new TH2F("hMassLcPt","hMassLcPt;3-Prong p_{T} GeV/c;3-Prong Mass GeV/c^2",150,0.,15.,200,fLowmasslimit,fUpmasslimit);
585  fhMassLcplusPt = new TH2F("hMassLcplusPt","hMassLcplusPt;3-Prong p_{T} GeV/c;3-Prong Mass GeV/c^2",150,0.,15.,200,fLowmasslimit,fUpmasslimit);
586  fhMassLcminusPt = new TH2F("hMassLcminusPt","hMassLcminusPt;3-Prong p_{T} GeV/c;3-Prong Mass GeV/c^2",150,0.,15.,200,fLowmasslimit,fUpmasslimit);
587  fOutput->Add(fhMassLcPt);
588  fOutput->Add(fhMassLcplusPt);
589  fOutput->Add(fhMassLcminusPt);
590 
591  fhEta3Prong = new TH2F("hEta3Prong","hEta3Prong;3-Prong p_{T} GeV/c;3-Prong #eta",75,0.,15.,50,-2.0,2.0);
592  fhEta3ProngAcc = new TH2F("hEta3ProngAcc","hEta3ProngAcc;3-Prong p_{T} GeV/c;3-Prong #eta",75,0.,15.,50,-2.0,2.0);
593  fhEta3ProngProd = new TH2F("hEta3ProngProd","hEta3ProngProd;3-Prong p_{T} GeV/c;3-Prong #eta",75,0.,15.,50,-2.0,2.0);
594  fhEta3ProngAn = new TH2F("hEta3ProngAn","hEta3ProngAn;3-Prong p_{T} GeV/c;3-Prong #eta",75,0.,15.,50,-2.0,2.0);
595  fhRap3Prong = new TH2F("hRap3Prong","hRap3Prong;3-Prong p_{T} GeV/c;3-Prong y",75,0.,15.,50,-2.0,2.0);
596  fhRap3ProngAcc = new TH2F("hRap3ProngAcc","hRap3ProngAcc;3-Prong p_{T} GeV/c;3-Prong y",75,0.,15.,50,-2.0,2.0);
597  fhRap3ProngProd = new TH2F("hRap3ProngProd","hRap3ProngProd;3-Prong p_{T} GeV/c;3-Prong y",75,0.,15.,50,-2.0,2.0);
598  fhRap3ProngAn = new TH2F("hRap3ProngAn","hRap3ProngAn;3-Prong p_{T} GeV/c;3-Prong y",75,0.,15.,50,-2.0,2.0);
599 
600  fhSelectBit = new TH1F("hSelectBit","hSelectBit",5,-0.5,5.5);
601  fhSelectBit->GetXaxis()->SetBinLabel(2,"All");
602  fhSelectBit->GetXaxis()->SetBinLabel(3,"SelectionMap");
603  fhSelectBit->GetXaxis()->SetBinLabel(4,"!LcCut");
604  fhSelectBit->GetXaxis()->SetBinLabel(5,"!LcPID");
605 
606  fOutput->Add(fhEta3Prong);
607  fOutput->Add(fhEta3ProngAcc);
608  fOutput->Add(fhEta3ProngProd);
609  fOutput->Add(fhEta3ProngAn);
610  fOutput->Add(fhRap3Prong);
611  fOutput->Add(fhRap3ProngAcc);
612  fOutput->Add(fhRap3ProngProd);
613  fOutput->Add(fhRap3ProngAn);
614  fOutput->Add(fhSelectBit);
615 
616  fHistNEvents = new TH1F("fHistNEvents", "Number of processed events; ; Events",3,-1.5,1.5);
617  fHistNEvents->Sumw2();
618  fHistNEvents->SetMinimum(0);
619  fOutput->Add(fHistNEvents);
620 
621  fhChi2 = new TH1F("fhChi2", "Chi2",100,0.,10.);
622  fhChi2->Sumw2();
623  fOutput->Add(fhChi2);
624 
625  fhMassPtGreater3=new TH1F("fhMassPtGreater3","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
626  fhMassPtGreater3->Sumw2();
628  fhMassPtGreater3TC=new TH1F("fhMassPtGreater3TC","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
629  fhMassPtGreater3TC->Sumw2();
631  fhMassPtGreater3Kp=new TH1F("fhMassPtGreater3Kp","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
632  fhMassPtGreater3Kp->Sumw2();
634  fhMassPtGreater3KpTC=new TH1F("fhMassPtGreater3KpTC","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
635  fhMassPtGreater3KpTC->Sumw2();
637  fhMassPtGreater3Lpi=new TH1F("fhMassPtGreater3Lpi","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
638  fhMassPtGreater3Lpi->Sumw2();
640  fhMassPtGreater3LpiTC=new TH1F("fhMassPtGreater3LpiTC","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
641  fhMassPtGreater3LpiTC->Sumw2();
643  fhMassPtGreater3Dk=new TH1F("fhMassPtGreater3Dk","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
644  fhMassPtGreater3Dk->Sumw2();
646  fhMassPtGreater3DkTC=new TH1F("fhMassPtGreater3DkTC","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
647  fhMassPtGreater3DkTC->Sumw2();
649 
650  fhMassPtGreater33Pr=new TH1F("fhMassPtGreater33Pr","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
651  fhMassPtGreater33Pr->Sumw2();
653  fhMassPtGreater33PrTC=new TH1F("fhMassPtGreater33PrTC","Pt > 3 GeV/c",200,fLowmasslimit,fUpmasslimit);
654  fhMassPtGreater33PrTC->Sumw2();
656 
657 
658  fhMassPtGreater2=new TH1F("fhMassPtGreater2","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
659  fhMassPtGreater2->Sumw2();
661  fhMassPtGreater2TC=new TH1F("fhMassPtGreater2TC","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
662  fhMassPtGreater2TC->Sumw2();
664  fhMassPtGreater2Kp=new TH1F("fhMassPtGreater2Kp","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
665  fhMassPtGreater2Kp->Sumw2();
667  fhMassPtGreater2KpTC=new TH1F("fhMassPtGreater2KpTC","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
668  fhMassPtGreater2KpTC->Sumw2();
670  fhMassPtGreater2Lpi=new TH1F("fhMassPtGreater2Lpi","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
671  fhMassPtGreater2Lpi->Sumw2();
673  fhMassPtGreater2LpiTC=new TH1F("fhMassPtGreater2LpiTC","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
674  fhMassPtGreater2LpiTC->Sumw2();
676  fhMassPtGreater2Dk=new TH1F("fhMassPtGreater2Dk","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
677  fhMassPtGreater2Dk->Sumw2();
679  fhMassPtGreater2DkTC=new TH1F("fhMassPtGreater2DkTC","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
680  fhMassPtGreater2DkTC->Sumw2();
682  fhMassPtGreater23Pr=new TH1F("fhMassPtGreater23Pr","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
683  fhMassPtGreater23Pr->Sumw2();
685  fhMassPtGreater23PrTC=new TH1F("fhMassPtGreater23PrTC","Pt > 2 GeV/c",200,fLowmasslimit,fUpmasslimit);
686  fhMassPtGreater23PrTC->Sumw2();
688 
689  fOutputMC = new TList();
690  fOutputMC->SetOwner();
691  fOutputMC->SetName("QAMCHistos");
692 
693  // const char* nameoutput=GetOutputSlot(4)->GetContainer()->GetName();
694 
695  fNentries=new TH1F("fNentries", "Integral(1,2) = number of AODs *** Integral(2,3) = number of candidates selected with cuts *** Integral(3,4) = number of Lc selected with cuts *** Integral(4,5) = events with good vertex *** Integral(5,6) = pt out of bounds", 12,-0.5,14.5);
696 
697  //ROS: qui il bin assignment e' modellato su D0 ma sicuramente iv arie
698  fNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
699  fNentries->GetXaxis()->SetBinLabel(2,"nCandSel(Cuts)");
700  fNentries->GetXaxis()->SetBinLabel(3,"nLcSelected");
701  fNentries->GetXaxis()->SetBinLabel(4,"nEventsGoodVtxS");
702  fNentries->GetXaxis()->SetBinLabel(5,"ptbin = -1");
703  fNentries->GetXaxis()->SetBinLabel(6,"no daughter");
704  fNentries->GetXaxis()->SetBinLabel(7,"nCandSel(Tr)");
705  fNentries->GetXaxis()->SetBinLabel(8,"PID=0");
706  fNentries->GetXaxis()->SetBinLabel(9,"PID=1");
707  fNentries->GetXaxis()->SetBinLabel(10,"PID=2");
708  fNentries->GetXaxis()->SetBinLabel(11,"PID=3");
709  fNentries->GetXaxis()->SetBinLabel(15,"no. of not on-the-fly rec Lc");
710  fNentries->GetXaxis()->SetNdivisions(1,kFALSE);
711 
712  hisname.Form("hMass");
713  TH1F *hMassInv=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
714  fOutputMC->Add(hMassInv);
715  hisname.Form("hbMass");
716  TH1F *hBMassInv=new TH1F(hisname.Data(),hisname.Data(),200,fLowmasslimit,fUpmasslimit);
717  fOutputMC->Add(hBMassInv);
718 
719  // proton specific
720  hisname.Form("hpTOFSignal");
721  TH1F *hProtonTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
722  fOutputMC->Add(hProtonTOFSignal);
723  hisname.Form("hbpTOFSignal");
724  TH1F *hBProtonTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
725  fOutputMC->Add(hBProtonTOFSignal);
726 
727  hisname.Form("hpTPCSignal");
728  TH1F *hProtonTPCSignal=new TH1F(hisname.Data(),hisname.Data(),150,0.,150.0);
729  fOutputMC->Add(hProtonTPCSignal);
730  hisname.Form("hbpTPCSignal");
731  TH1F *hBProtonTPCSignal=new TH1F(hisname.Data(),hisname.Data(),150,0.,150.0);
732  fOutputMC->Add(hBProtonTPCSignal);
733 
734  hisname.Form("hpptProng");
735  TH1F *hProtonPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
736  fOutputMC->Add(hProtonPtProng);
737  hisname.Form("hbpptProng");
738  TH1F *hBProtonPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
739  fOutputMC->Add(hBProtonPtProng);
740 
741  hisname.Form("hpRealTot");
742  TH1F *hProtonRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
743  fOutputMC->Add(hProtonRealTot);
744  hisname.Form("hbpRealTot");
745  TH1F *hBProtonRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
746  fOutputMC->Add(hBProtonRealTot);
747  hisname.Form("hpIDTot");
748  TH1F *hProtonIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
749  fOutputMC->Add(hProtonIDTot);
750  hisname.Form("hpIDGood");
751  TH1F *hProtonIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
752  fOutputMC->Add(hProtonIDGood);
753  hisname.Form("hbpIDGood");
754  TH1F *hBProtonIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
755  fOutputMC->Add(hBProtonIDGood);
756  hisname.Form("hbpIDTot");
757  TH1F *hBProtonIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
758  fOutputMC->Add(hBProtonIDTot);
759  hisname.Form("hnopIDp");
760  TH1F *hnoProtonIDpTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
761  fOutputMC->Add(hnoProtonIDpTot);
762  hisname.Form("hbnopIDp");
763  TH1F *hBnoProtonIDpTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
764  fOutputMC->Add(hBnoProtonIDpTot);
765 
766  hisname.Form("hpd0Prong");
767  TH1F *hProtond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
768  fOutputMC->Add(hProtond0Prong);
769  hisname.Form("hbpd0Prong");
770  TH1F *hBProtond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
771  fOutputMC->Add(hBProtond0Prong);
772  hisname.Form("hbpSignalVspTOF");
773  TH2F *hBpSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
774  fOutputMC->Add(hBpSignalVspTOF);
775  hisname.Form("hbpSignalVspTPC");
776  TH2F *hBpSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
777  fOutputMC->Add(hBpSignalVspTPC);
778  hisname.Form("hpSignalVspTOF");
779  TH2F *hpSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
780  fOutputMC->Add(hpSignalVspTOF);
781  hisname.Form("hpSignalVspTPC");
782  TH2F *hpSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
783  fOutputMC->Add(hpSignalVspTPC);
784 
785  hisname.Form("hpSigmaVspTOF");
786  TH2F *hpSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
787  fOutputMC->Add(hpSigmaVspTOF);
788  hisname.Form("hpSigmaVspTPC");
789  TH2F *hpSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
790  fOutputMC->Add(hpSigmaVspTPC);
791  hisname.Form("hbpSigmaVspTOF");
792  TH2F *hBpSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
793  fOutputMC->Add(hBpSigmaVspTOF);
794  hisname.Form("hbpSigmaVspTPC");
795  TH2F *hBpSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
796  fOutputMC->Add(hBpSigmaVspTPC);
797 
798 
799  //kaon specific
800  hisname.Form("hKTOFSignal");
801  TH1F *hKaonTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
802  fOutputMC->Add(hKaonTOFSignal);
803  hisname.Form("hbKTOFSignal");
804  TH1F *hBKaonTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
805  fOutputMC->Add(hBKaonTOFSignal);
806  hisname.Form("hKTPCSignal");
807  TH1F *hKaonTPCSignal=new TH1F(hisname.Data(),hisname.Data(),150,0.,150.0);
808  fOutputMC->Add(hKaonTPCSignal);
809  hisname.Form("hbKTPCSignal");
810  TH1F *hBKaonTPCSignal=new TH1F(hisname.Data(),hisname.Data(),150,0.,150.0);
811  fOutputMC->Add(hBKaonTPCSignal);
812 
813  hisname.Form("hKptProng");
814  TH1F *hKaonPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
815  fOutputMC->Add(hKaonPtProng);
816  hisname.Form("hbKptProng");
817  TH1F *hBKaonPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
818  fOutputMC->Add(hBKaonPtProng);
819  hisname.Form("hKRealTot");
820  TH1F *hKaonRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
821  fOutputMC->Add(hKaonRealTot);
822  hisname.Form("hbKRealTot");
823  TH1F *hBKaonRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
824  fOutputMC->Add(hBKaonRealTot);
825  hisname.Form("hKIDGood");
826  TH1F *hKaonIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
827  fOutputMC->Add(hKaonIDGood);
828  hisname.Form("hKIDTot");
829  TH1F *hKaonIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
830  fOutputMC->Add(hKaonIDTot);
831  hisname.Form("hbKIDGood");
832  TH1F *hBKaonIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
833  fOutputMC->Add(hBKaonIDGood);
834  hisname.Form("hbKIDTot");
835  TH1F *hBKaonIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
836  fOutputMC->Add(hBKaonIDTot);
837  hisname.Form("hnokIDk");
838  TH1F *hnoKaonIDkTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
839  fOutputMC->Add(hnoKaonIDkTot);
840  hisname.Form("hbnokIDk");
841  TH1F *hBnoKaonIDkTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
842  fOutputMC->Add(hBnoKaonIDkTot);
843 
844 
845  hisname.Form("hKd0Prong");
846  TH1F *hKaond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
847  fOutputMC->Add(hKaond0Prong);
848  hisname.Form("hbKd0Prong");
849  TH1F *hBKaond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
850  fOutputMC->Add(hBKaond0Prong);
851  hisname.Form("hbKSignalVspTOF");
852  TH2F *hbKSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
853  fOutputMC->Add(hbKSignalVspTOF);
854  hisname.Form("hbKSignalVspTPC");
855  TH2F *hbKSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
856  fOutputMC->Add(hbKSignalVspTPC);
857  hisname.Form("hKSignalVspTOF");
858  TH2F *hKSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
859  fOutputMC->Add(hKSignalVspTOF);
860  hisname.Form("hKSignalVspTPC");
861  TH2F *hKSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
862  fOutputMC->Add(hKSignalVspTPC);
863  hisname.Form("hKSigmaVspTOF");
864  TH2F *hKSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
865  fOutputMC->Add(hKSigmaVspTOF);
866  hisname.Form("hKSigmaVspTPC");
867  TH2F *hKSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
868  fOutputMC->Add(hKSigmaVspTPC);
869  hisname.Form("hbKSigmaVspTOF");
870  TH2F *hBKSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
871  fOutputMC->Add(hBKSigmaVspTOF);
872  hisname.Form("hbKSigmaVspTPC");
873  TH2F *hBKSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
874  fOutputMC->Add(hBKSigmaVspTPC);
875 
876 
877  // pion specific
878  hisname.Form("hpiTOFSignal");
879  TH1F *hPionTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
880  fOutputMC->Add(hPionTOFSignal);
881  hisname.Form("hbpiTOFSignal");
882  TH1F *hBPionTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
883  fOutputMC->Add(hBPionTOFSignal);
884  hisname.Form("hpiTPCSignal");
885  TH1F *hPionTPCSignal=new TH1F(hisname.Data(),hisname.Data(),100,30.,100.0);
886  fOutputMC->Add(hPionTPCSignal);
887  hisname.Form("hbpiTPCSignal");
888  TH1F *hBPionTPCSignal=new TH1F(hisname.Data(),hisname.Data(),100,30.,100.0);
889  fOutputMC->Add(hBPionTPCSignal);
890 
891  hisname.Form("hpiptProng");
892  TH1F *hPionPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
893  fOutputMC->Add(hPionPtProng);
894  hisname.Form("hbpiptProng");
895  TH1F *hBPionPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
896  fOutputMC->Add(hBPionPtProng);
897 
898  hisname.Form("hpiRealTot");
899  TH1F *hPionRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
900  fOutputMC->Add(hPionRealTot);
901  hisname.Form("hbpiRealTot");
902  TH1F *hBPionRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
903  fOutputMC->Add(hBPionRealTot);
904  hisname.Form("hpiIDGood");
905  TH1F *hPionIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
906  fOutputMC->Add(hPionIDGood);
907  hisname.Form("hpiIDTot");
908  TH1F *hPionIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
909  fOutputMC->Add(hPionIDTot);
910  hisname.Form("hbpiIDTot");
911  TH1F *hBPionIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
912  fOutputMC->Add(hBPionIDTot);
913  hisname.Form("hbpiIDGood");
914  TH1F *hBPionIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
915  fOutputMC->Add(hBPionIDGood);
916  hisname.Form("hnopiIDpi");
917  TH1F *hnoPionIDpiTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
918  fOutputMC->Add(hnoPionIDpiTot);
919  hisname.Form("hbnopiIDpi");
920  TH1F *hBnoPionIDpiTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
921  fOutputMC->Add(hBnoPionIDpiTot);
922 
923  hisname.Form("hpid0Prong");
924  TH1F *hPiond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,-0.1);
925  fOutputMC->Add(hPiond0Prong);
926  hisname.Form("hbpid0Prong");
927  TH1F *hBPiond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
928  fOutputMC->Add(hBPiond0Prong);
929 
930  hisname.Form("hpiSignalVspTOF");
931  TH2F *hpiSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
932  fOutputMC->Add(hpiSignalVspTOF);
933  hisname.Form("hpiSignalVspTPC");
934  TH2F *hpiSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
935  fOutputMC->Add(hpiSignalVspTPC);
936  hisname.Form("hbpiSignalVspTOF");
937  TH2F *hbpiSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
938  fOutputMC->Add(hbpiSignalVspTOF);
939  hisname.Form("hbpiSignalVspTPC");
940  TH2F *hbpiSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
941  fOutputMC->Add(hbpiSignalVspTPC);
942  hisname.Form("hpiSigmaVspTOF");
943  TH2F *hpiSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
944  fOutputMC->Add(hpiSigmaVspTOF);
945  hisname.Form("hpiSigmaVspTPC");
946  TH2F *hpiSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
947  fOutputMC->Add(hpiSigmaVspTPC);
948  hisname.Form("hbpiSigmaVspTOF");
949  TH2F *hBpiSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
950  fOutputMC->Add(hBpiSigmaVspTOF);
951  hisname.Form("hbpiSigmaVspTPC");
952  TH2F *hBpiSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
953  fOutputMC->Add(hBpiSigmaVspTPC);
954 
955  //Jaime Lc specific
956  hisname.Form("hLcRealTot");
957  TH1F *hLambdaRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,15.0);
958  fOutputMC->Add(hLambdaRealTot);
959  hisname.Form("hbLcRealTot");
960  TH1F *hbLambdaRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,15.0);
961  fOutputMC->Add(hbLambdaRealTot);
962  hisname.Form("hLcIDTot");
963  TH1F *hLambdaIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,15.0);
964  fOutputMC->Add(hLambdaIDTot);
965  hisname.Form("hbLcIDTot");
966  TH1F *hbLambdaIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,15.0);
967  fOutputMC->Add(hbLambdaIDTot);
968  hisname.Form("hLcIDGood");
969  TH1F *hLambdaIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,15.0);
970  fOutputMC->Add(hLambdaIDGood);
971  hisname.Form("hbLcIDGood");
972  TH1F *hbLambdaIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,15.0);
973  fOutputMC->Add(hbLambdaIDGood);
974  hisname.Form("hLcnoID");
975  TH1F *hLambdanoID=new TH1F(hisname.Data(),hisname.Data(),100,0.,15.0);
976  fOutputMC->Add(hLambdanoID);
977  hisname.Form("hbLcnoID");
978  TH1F *hbLambdanoID=new TH1F(hisname.Data(),hisname.Data(),100,0.,15.0);
979  fOutputMC->Add(hbLambdanoID);
980 
981  // other generic
982  hisname.Form("hLcpt");
983  TH1F *hLcPt=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
984  fOutputMC->Add(hLcPt);
985  hisname.Form("hbLcpt");
986  TH1F *hBLcPt=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
987  fOutputMC->Add(hBLcPt);
988  hisname.Form("hDist12toPrim");
989  TH1F *hDist12Prim=new TH1F(hisname.Data(),hisname.Data(),100,0.,1.0);
990  fOutputMC->Add(hDist12Prim);
991  hisname.Form("hbDist12toPrim");
992  TH1F *hBDist12Prim=new TH1F(hisname.Data(),hisname.Data(),100,0.,1.0);
993  fOutputMC->Add(hBDist12Prim);
994 
995  hisname.Form("hSigmaVert");
996  TH1F *hSigmaVert=new TH1F(hisname.Data(),hisname.Data(),60,0.,0.06);
997  fOutputMC->Add(hSigmaVert);
998  hisname.Form("hbSigmaVert");
999  TH1F *hBSigmaVert=new TH1F(hisname.Data(),hisname.Data(),60,0.,0.06);
1000  fOutputMC->Add(hBSigmaVert);
1001 
1002  hisname.Form("hDCAs");
1003  TH1F *hdcas=new TH1F(hisname.Data(),hisname.Data(),200,0.,0.1);
1004  fOutputMC->Add(hdcas);
1005  hisname.Form("hbDCAs");
1006  TH1F *hBdcas=new TH1F(hisname.Data(),hisname.Data(),200,0.,0.1);
1007  fOutputMC->Add(hBdcas);
1008 
1009  hisname.Form("hCosPointingAngle");
1010  TH1F *hCosPointingAngle=new TH1F(hisname.Data(),hisname.Data(),40,0.,1.);
1011  fOutputMC->Add(hCosPointingAngle);
1012  hisname.Form("hbCosPointingAngle");
1013  TH1F *hBCosPointingAngle=new TH1F(hisname.Data(),hisname.Data(),40,0.,1.);
1014  fOutputMC->Add(hBCosPointingAngle);
1015 
1016  hisname.Form("hDecayLength");
1017  TH1F *hDecayLength=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
1018  fOutputMC->Add(hDecayLength);
1019  hisname.Form("hbDecayLength");
1020  TH1F *hBDecayLength=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
1021  fOutputMC->Add(hBDecayLength);
1022 
1023  hisname.Form("hSum2");
1024  TH1F *hSum2=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
1025  fOutputMC->Add(hSum2);
1026  hisname.Form("hbSum2");
1027  TH1F *hBSum2=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
1028  fOutputMC->Add(hBSum2);
1029 
1030  hisname.Form("hptmax");
1031  TH1F *hPtMax=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1032  fOutputMC->Add(hPtMax);
1033  hisname.Form("hbptmax");
1034  TH1F *hBPtMax=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1035  fOutputMC->Add(hBPtMax);
1036 
1037 //2D Var x Lc Pt
1038  hisname.Form("hpptProngLcPt");
1039  fhProtonPtProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,5.0);
1041  hisname.Form("hbpptProngLcPt");
1042  fhBProtonPtProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,5.0);
1044 
1045  hisname.Form("hpd0ProngLcPt");
1046  fhProtond0ProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,-0.1,0.1);
1048  hisname.Form("hbpd0ProngLcPt");
1049  fhBProtond0ProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,-0.1,0.1);
1051 
1052  hisname.Form("hKptProngLcPt");
1053  fhKaonPtProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,5.0);
1055  hisname.Form("hbKptProngLcPt");
1056  fhBKaonPtProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,5.0);
1058 
1059  hisname.Form("hKd0ProngLcPt");
1060  fhKaond0ProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,-0.1,0.1);
1062  hisname.Form("hbKd0ProngLcPt");
1063  fhBKaond0ProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,-0.1,0.1);
1065 
1066  hisname.Form("hpiptProngLcPt");
1067  fhPionPtProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,5.0);
1069  hisname.Form("hbpiptProngLcPt");
1070  fhBPionPtProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,5.0);
1072 
1073  hisname.Form("hpid0ProngLcPt");
1074  fhPiond0ProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,-0.1,-0.1);
1076  hisname.Form("hbpid0ProngLcPt");
1077  fhBPiond0ProngLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,-0.1,0.1);
1079 
1080  hisname.Form("hDist12toPrimLcPt");
1081  fhDist12PrimLcPt = new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,1.0);
1083  hisname.Form("hbDist12toPrimLcPt");
1084  fhBDist12PrimLcPt = new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,1.0);
1086 
1087  hisname.Form("hSigmaVertLcPt");
1088  fhSigmaVertLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,60,0.,0.06);
1089  fOutputMC->Add(fhSigmaVertLcPt);
1090  hisname.Form("hbSigmaVertLcPt");
1091  fhBSigmaVertLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,60,0.,0.06);
1093 
1094  hisname.Form("hDCAsLcPt");
1095  fhdcasLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,200,0.,0.1);
1096  fOutputMC->Add(fhdcasLcPt);
1097  hisname.Form("hbDCAsLcPt");
1098  fhBdcasLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,200,0.,0.1);
1099  fOutputMC->Add(fhBdcasLcPt);
1100 
1101  hisname.Form("hCosPointingAngleLcPt");
1102  fhCosPointingAngleLcPt = new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,40,0.,1.);
1104  hisname.Form("hbCosPointingAngleLcPt");
1105  fhBCosPointingAngleLcPt = new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,40,0.,1.);
1107 
1108  hisname.Form("hDecayLengthLcPt");
1109  fhDecayLengthLcPt = new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,0.1);
1111  hisname.Form("hbDecayLengthLcPt");
1112  fhBDecayLengthLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,0.1);
1114 
1115  hisname.Form("hSum2LcPt");
1116  fhSum2LcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,0.1);
1117  fOutputMC->Add(fhSum2LcPt);
1118  hisname.Form("hbSum2LcPt");
1119  fhBSum2LcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,0.1);
1120  fOutputMC->Add(fhBSum2LcPt);
1121 
1122  hisname.Form("hptmaxLcPt");
1123  fhPtMaxLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,5.);
1124  fOutputMC->Add(fhPtMaxLcPt);
1125  hisname.Form("hbptmaxLcPt");
1126  fhBPtMaxLcPt=new TH2F(hisname.Data(),hisname.Data(),75,0.,15.,100,0.,5.);
1127  fOutputMC->Add(fhBPtMaxLcPt);
1128 
1129  fAPriori = new TList(); // AdC
1130  fAPriori->SetOwner(); // AdC
1131  fAPriori->SetName("APrioriMCHistos"); // AdC
1132 
1133  hisname.Form("hElIn3Prong");
1134  TH1F *hElIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1135  fAPriori->Add(hElIn3Prong);
1136  hisname.Form("hMuIn3Prong");
1137  TH1F *hMuIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1138  fAPriori->Add(hMuIn3Prong);
1139  hisname.Form("hPiIn3Prong");
1140  TH1F *hPiIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1141  fAPriori->Add(hPiIn3Prong);
1142  hisname.Form("hKaIn3Prong");
1143  TH1F *hKaIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1144  fAPriori->Add(hKaIn3Prong);
1145  hisname.Form("hPrIn3Prong");
1146  TH1F *hPrIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1147  fAPriori->Add(hPrIn3Prong);
1148 
1149  hisname.Form("hElIn3Prong1");
1150  TH1F *hElIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1151  fAPriori->Add(hElIn3Prong1);
1152  hisname.Form("hMuIn3Prong1");
1153  TH1F *hMuIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1154  fAPriori->Add(hMuIn3Prong1);
1155  hisname.Form("hPiIn3Prong1");
1156  TH1F *hPiIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1157  fAPriori->Add(hPiIn3Prong1);
1158  hisname.Form("hKaIn3Prong1");
1159  TH1F *hKaIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1160  fAPriori->Add(hKaIn3Prong1);
1161  hisname.Form("hPrIn3Prong1");
1162  TH1F *hPrIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1163  fAPriori->Add(hPrIn3Prong1);
1164 
1165  hisname.Form("hElIn3Prong2");
1166  TH1F *hElIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1167  fAPriori->Add(hElIn3Prong2);
1168  hisname.Form("hMuIn3Prong2");
1169  TH1F *hMuIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1170  fAPriori->Add(hMuIn3Prong2);
1171  hisname.Form("hPiIn3Prong2");
1172  TH1F *hPiIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1173  fAPriori->Add(hPiIn3Prong2);
1174  hisname.Form("hKaIn3Prong2");
1175  TH1F *hKaIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1176  fAPriori->Add(hKaIn3Prong2);
1177  hisname.Form("hPrIn3Prong2");
1178  TH1F *hPrIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1179  fAPriori->Add(hPrIn3Prong2);
1180 
1181  hisname.Form("hElIn3Prong3");
1182  TH1F *hElIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1183  fAPriori->Add(hElIn3Prong3);
1184  hisname.Form("hMuIn3Prong3");
1185  TH1F *hMuIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1186  fAPriori->Add(hMuIn3Prong3);
1187  hisname.Form("hPiIn3Prong3");
1188  TH1F *hPiIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1189  fAPriori->Add(hPiIn3Prong3);
1190  hisname.Form("hKaIn3Prong3");
1191  TH1F *hKaIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1192  fAPriori->Add(hKaIn3Prong3);
1193  hisname.Form("hPrIn3Prong3");
1194  TH1F *hPrIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1195  fAPriori->Add(hPrIn3Prong3);
1196 
1197  hisname.Form("hElIn3Prong4");
1198  TH1F *hElIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1199  fAPriori->Add(hElIn3Prong4);
1200  hisname.Form("hMuIn3Prong4");
1201  TH1F *hMuIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1202  fAPriori->Add(hMuIn3Prong4);
1203  hisname.Form("hPiIn3Prong4");
1204  TH1F *hPiIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1205  fAPriori->Add(hPiIn3Prong4);
1206  hisname.Form("hKaIn3Prong4");
1207  TH1F *hKaIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1208  fAPriori->Add(hKaIn3Prong4);
1209  hisname.Form("hPrIn3Prong4");
1210  TH1F *hPrIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1211  fAPriori->Add(hPrIn3Prong4);
1212 
1213  hisname.Form("hElIn3Prong5");
1214  TH1F *hElIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1215  fAPriori->Add(hElIn3Prong5);
1216  hisname.Form("hMuIn3Prong5");
1217  TH1F *hMuIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1218  fAPriori->Add(hMuIn3Prong5);
1219  hisname.Form("hPiIn3Prong5");
1220  TH1F *hPiIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1221  fAPriori->Add(hPiIn3Prong5);
1222  hisname.Form("hKaIn3Prong5");
1223  TH1F *hKaIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1224  fAPriori->Add(hKaIn3Prong5);
1225  hisname.Form("hPrIn3Prong5");
1226  TH1F *hPrIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1227  fAPriori->Add(hPrIn3Prong5);
1228 
1229  hisname.Form("hElIn3Prong6");
1230  TH1F *hElIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1231  fAPriori->Add(hElIn3Prong6);
1232  hisname.Form("hMuIn3Prong6");
1233  TH1F *hMuIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1234  fAPriori->Add(hMuIn3Prong6);
1235  hisname.Form("hPiIn3Prong6");
1236  TH1F *hPiIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1237  fAPriori->Add(hPiIn3Prong6);
1238  hisname.Form("hKaIn3Prong6");
1239  TH1F *hKaIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1240  fAPriori->Add(hKaIn3Prong6);
1241  hisname.Form("hPrIn3Prong6");
1242  TH1F *hPrIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
1243  fAPriori->Add(hPrIn3Prong6);
1244 
1245 
1246  fMultiplicity = new TList(); // AdC
1247  fMultiplicity->SetOwner(); // AdC
1248  fMultiplicity->SetName("MultiplicityMCHistos"); // AdC
1249 
1250  hisname.Form("hLcinEvent");
1251  TH1I*hLcinEvent=new TH1I(hisname.Data(),hisname.Data(),3,-1,2);
1252  fMultiplicity->Add(hLcinEvent);
1253 
1254  hisname.Form("hPrimariesvsAOD");
1255  TH2I *hPrimariesvsAOD=new TH2I(hisname.Data(),hisname.Data(),300,0,300,300,0,300);
1256  fMultiplicity->Add(hPrimariesvsAOD);
1257 
1258  hisname.Form("hMultiplicityInLcEvent");
1259  TH1I *hMultiplicityInLcEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1260  fMultiplicity->Add(hMultiplicityInLcEvent);
1261  hisname.Form("h2MultiplicityInLcEvent");
1262  TH1I *h2MultiplicityInLcEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1263  fMultiplicity->Add(h2MultiplicityInLcEvent);
1264  hisname.Form("hAll2MultiplicityInEvent");
1265  TH1I *hAll2MultiplicityInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1266  fMultiplicity->Add(hAll2MultiplicityInEvent);
1267  hisname.Form("hAllMultiplicityInEvent");
1268  TH1I *hAllMultiplicityInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1269  fMultiplicity->Add(hAllMultiplicityInEvent);
1270  hisname.Form("hAllMultiplicityPrimaryInEvent");
1271  TH1I *hAllMultiplicityPrimaryInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1272  fMultiplicity->Add(hAllMultiplicityPrimaryInEvent);
1273  hisname.Form("hAll2MultiplicityPrimaryInEvent");
1274  TH1I *hAll2MultiplicityPrimaryInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1275  fMultiplicity->Add(hAll2MultiplicityPrimaryInEvent);
1276  hisname.Form("hMultiplicityInEvent");
1277  TH1I *hMultiplicityInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0.,300);
1278  fMultiplicity->Add(hMultiplicityInEvent);
1279  hisname.Form("hMultiplicityIn3ProngLC");
1280  TH1I *hMultiplicityIn3ProngLC=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1281  fMultiplicity->Add(hMultiplicityIn3ProngLC);
1282  hisname.Form("hMultiplicityInLCpid");
1283  TH1I *hMultiplicityInLCpid=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1284  fMultiplicity->Add(hMultiplicityInLCpid);
1285  hisname.Form("hMultiplicityInLCmc");
1286  TH1I *hMultiplicityInLCmc=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1287  fMultiplicity->Add(hMultiplicityInLCmc);
1288  hisname.Form("hMultiplicityInLCNomc");
1289  TH1I *hMultiplicityInLCNomc=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1290  fMultiplicity->Add(hMultiplicityInLCNomc);
1291  hisname.Form("hMultiplicityYesC");
1292  TH1I *hMultiplicityYesC=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1293  fMultiplicity->Add(hMultiplicityYesC);
1294  hisname.Form("hMultiplicityYesB");
1295  TH1I *hMultiplicityYesB=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1296  fMultiplicity->Add(hMultiplicityYesB);
1297  hisname.Form("hMultiplicityJPsi");
1298  TH1I *hMultiplicityJPsi=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
1299  fMultiplicity->Add(hMultiplicityJPsi);
1300 
1301 
1302  AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
1303  AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
1304  fPIDResponse = inputHandler->GetPIDResponse();
1305 
1310  //fUtilPid=new AliAODpidUtil(fPIDResponse);
1311  fRDCutsProduction->GetPidHF()->SetOldPid(kFALSE);
1314  }
1319  fRDCutsAnalysis->GetPidHF()->SetOldPid(kFALSE);
1320  fRDCutsAnalysis->GetPidpion()->SetOldPid(kFALSE);
1321  fRDCutsAnalysis->GetPidprot()->SetOldPid(kFALSE);
1322  }
1323 
1324  PostData(1,fOutput);
1325  if (fFillVarHists) PostData(3,fOutputMC);
1326  PostData(4,fNentries);
1327  if (fPriorsHists) PostData(5,fAPriori);
1328  if (fMultiplicityHists) PostData(6,fMultiplicity);
1329  TString normName="NormalizationCounter";
1330  AliAnalysisDataContainer *cont = GetOutputSlot(7)->GetContainer();
1331  if(cont)normName=(TString)cont->GetName();
1332  fCounter = new AliNormalizationCounter(normName.Data());
1333  fCounter->Init();
1334  PostData(7,fCounter);
1335  if (fFillNtuple) {
1336  //OpenFile(3); // 2 is the slot number of the ntuple
1337  fNtupleLambdac = new TNtuple("fNtupleLambdac","D +",
1338  "pdg:Px:Py:Pz:PtTrue:VxTrue:VyTrue:VzTrue:Ptpi:PtK:Ptpi2:PtRec:PointingAngle:DecLeng:VxRec:VyRec:VzRec:InvMass:sigvert:d0Pi:d0K:d0Pi2:dca:d0square");
1339  PostData(8,fNtupleLambdac);
1340  }
1341 
1342  return;
1343 }
1344 
1345 //________________________________________________________________________
1347 {
1348  // Execute analysis for current event:
1349  // heavy flavor candidates association to MC truth
1350 
1351  AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
1352  //tmp
1353  fHistNEvents->Fill(0); // count event
1354  // Post the data already here
1355 
1356  TClonesArray *array3Prong = 0;
1357  TClonesArray *arrayLikeSign =0;
1358  if(!aod && AODEvent() && IsStandardAOD()) {
1359  // In case there is an AOD handler writing a standard AOD, use the AOD
1360  // event in memory rather than the input (ESD) event.
1361  aod = dynamic_cast<AliAODEvent*> (AODEvent());
1362  // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
1363  // have to taken from the AOD event hold by the AliAODExtension
1364  AliAODHandler* aodHandler = (AliAODHandler*)
1365  ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
1366  if(aodHandler->GetExtensions()) {
1367  AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
1368  AliAODEvent *aodFromExt = ext->GetAOD();
1369  array3Prong=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
1370  arrayLikeSign=(TClonesArray*)aodFromExt->GetList()->FindObject("LikeSign3Prong");
1371  }
1372  } else if(aod) {
1373  array3Prong=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
1374  arrayLikeSign=(TClonesArray*)aod->GetList()->FindObject("LikeSign3Prong");
1375  }
1376 
1377  if(!aod) return;
1378 
1379  TClonesArray *arrayMC=0;
1380  AliAODMCHeader *mcHeader=0;
1381 
1382  // load MC particles
1383  if(fReadMC){
1384 
1385  arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
1386  if(!arrayMC) {
1387  AliError("AliAnalysisTaskSELambdac::UserExec: MC particles branch not found!\n");
1388  return;
1389  }
1390 
1391 
1392  // load MC header
1393  mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1394  if(!mcHeader) {
1395  AliError("AliAnalysisTaskSELambdac::UserExec: MC header branch not found!\n");
1396  return;
1397  }
1398  }
1399 
1400  TString fillthis="";
1401  Int_t numberOfPrimaries= NumberPrimaries(aod);
1402 
1403  if (fMultiplicityHists && fReadMC) {
1404  fillthis="hPrimariesvsAOD";
1405  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(aod->GetNumberOfTracks(),numberOfPrimaries);
1406 
1407  fillthis="hAll2MultiplicityInEvent";
1408  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(aod->GetNumberOfTracks());
1409 
1410  fillthis="hAll2MultiplicityPrimaryInEvent";
1411  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1412 
1413  if (IsThereAGeneratedLc(arrayMC)) {
1414  fillthis="h2MultiplicityInLcEvent";
1415  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1416  }
1417 
1418  }
1419 
1420  if(!array3Prong || !aod) {
1421  AliError("AliAnalysisTaskSELambdac::UserExec: Charm3Prong branch not found!\n");
1422  return;
1423  }
1424  if(!arrayLikeSign) {
1425  AliDebug(2,"AliAnalysisTaskSELambdac::UserExec: LikeSign3Prong branch not found!\n");
1426  // return;
1427  }
1428 
1429  // fix for temporary bug in ESDfilter
1430  // the AODs with null vertex pointer didn't pass the PhysSel
1431  AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
1432  if(!vtx1 || TMath::Abs(aod->GetMagneticField())<0.001) return;
1433 
1434  fNentries->Fill(0);
1436  TString trigclass=aod->GetFiredTriggerClasses();
1437  if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNentries->Fill(14);
1438  Bool_t isEvSelProdCuts=fRDCutsProduction->IsEventSelected(aod);
1439  Bool_t isEvSelAnCuts=fRDCutsAnalysis->IsEventSelected(aod);
1440  if(!isEvSelProdCuts || !isEvSelAnCuts){
1441  if(fRDCutsProduction->GetWhyRejection()==1) // rejected for pileup
1442  fNentries->Fill(13);
1443  return;
1444  }
1445 
1446  Bool_t isThereA3prongWithGoodTracks = kFALSE;
1447  Bool_t isThereA3ProngLcKine = kFALSE;
1448  Bool_t isThereA3ProngLcKineANDpid = kFALSE;
1449  Bool_t isThereA3ProngLcMC = kFALSE;
1450  Bool_t isThereA3ProngCyes = kFALSE;
1451  Bool_t isThereA3ProngByes = kFALSE;
1452  Bool_t isThereA3ProngJPsi = kFALSE;
1453 
1454  Int_t n3Prong = array3Prong->GetEntriesFast();
1455  Int_t nSelectedloose[1]={0};
1456  Int_t nSelectedtight[1]={0};
1457 
1458  // vHF object is needed to call the method that refills the missing info of the candidates
1459  // if they have been deleted in dAOD reconstruction phase
1460  // in order to reduce the size of the file
1462  for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
1463  AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
1464 
1465  //Filter bit selection and QA:
1466  fhSelectBit->Fill(1);
1467  if(d->GetSelectionMap()){
1468  fhSelectBit->Fill(2);
1471  if(fLcCut&&!d->HasSelectionBit(AliRDHFCuts::kLcCuts)) continue;
1472  if(fLcPIDCut&&!d->HasSelectionBit(AliRDHFCuts::kLcPID)) continue;
1473  }
1474 
1475  if(!(vHF->FillRecoCand(aod,d))) {
1476  fNentries->Fill(15); //monitor how often this fails
1477  continue;
1478  }
1479  Bool_t unsetvtx=kFALSE;
1480  if(!d->GetOwnPrimaryVtx()){
1481  d->SetOwnPrimaryVtx(vtx1);
1482  unsetvtx=kTRUE;
1483  }
1484 
1485 
1486  Int_t isSelectedTracks = fRDCutsProduction->IsSelected(d,AliRDHFCuts::kTracks,aod);
1487  if(!isSelectedTracks) continue;
1488  fhEta3Prong->Fill(d->Pt(),d->Eta());
1489  fhRap3Prong->Fill(d->Pt(),d->Y(4122));
1490 
1491  isThereA3prongWithGoodTracks=kTRUE;
1492 
1493  if (fRDCutsProduction->IsInFiducialAcceptance(d->Pt(),d->Y(4122))) {fNentries->Fill(6);}else{continue;}
1494  fhEta3ProngAcc->Fill(d->Pt(),d->Eta());
1495  fhRap3ProngAcc->Fill(d->Pt(),d->Y(4122));
1496 
1497  Int_t ptbin=fRDCutsProduction->PtBin(d->Pt());
1498  if(ptbin==-1) {fNentries->Fill(4); continue;} //out of bounds
1499 
1500  FillMassHists(aod,d,arrayMC,fRDCutsProduction,nSelectedloose,nSelectedtight);
1501  if(fFillVarHists) FillVarHists(d,arrayMC,fRDCutsProduction,/*fOutputMC,*/aod);
1502 
1503  if (fPriorsHists && fReadMC)
1504  FillAPrioriConcentrations(d, fRDCutsProduction, aod, arrayMC);
1505  if (fMultiplicityHists && fReadMC)
1506  MultiplicityStudies(d, fRDCutsProduction, aod, arrayMC,
1507  isThereA3ProngLcKine,isThereA3ProngLcKineANDpid,isThereA3ProngLcMC,
1508  isThereA3ProngCyes,isThereA3ProngByes,isThereA3ProngJPsi);
1509 
1510  /*
1511  //start OS analysis
1512  if(labDp<0)fHistOSbkg->Fill(d->InvMassDplus());
1513  fHistOS->Fill(d->InvMassDplus());
1514  */
1515 
1516  if(unsetvtx) d->UnsetOwnPrimaryVtx();
1517  }
1518  fCounter->StoreCandidates(aod,nSelectedloose[0],kTRUE);
1519  fCounter->StoreCandidates(aod,nSelectedtight[0],kFALSE);
1520 
1521  if (fMultiplicityHists && fReadMC) {
1522  fillthis="hAllMultiplicityInEvent";
1523  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(aod->GetNumberOfTracks());
1524 
1525  fillthis="hAllMultiplicityPrimaryInEvent";
1526  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1527 
1528  if (IsThereAGeneratedLc(arrayMC)) {
1529  fillthis="hMultiplicityInLcEvent";
1530  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1531  }
1532 
1533  if (isThereA3prongWithGoodTracks) {
1534  fillthis="hMultiplicityInEvent";
1535  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1536  }
1537  if (isThereA3ProngLcKine) {
1538  fillthis="hMultiplicityIn3ProngLC";
1539  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1540  }
1541  if (isThereA3ProngLcKineANDpid) {
1542  fillthis="hMultiplicityInLCpid";
1543  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1544  }
1545  if (isThereA3ProngLcMC) {
1546  fillthis="hMultiplicityInLCmc";
1547  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1548  }
1549  if (isThereA3ProngLcKine && !isThereA3ProngLcMC) {
1550  fillthis="hMultiplicityInLCNomc";
1551  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1552  }
1553 
1554  if (isThereA3ProngCyes) {
1555  fillthis="hMultiplicityYesC";
1556  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1557  }
1558  if (isThereA3ProngByes) {
1559  fillthis="hMultiplicityYesB";
1560  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1561  }
1562  if (isThereA3ProngJPsi) {
1563  fillthis="hMultiplicityJPsi";
1564  ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1565  }
1566 
1567  }
1568 
1569  delete vHF;
1570 
1571  PostData(1,fOutput);
1572  if (fFillVarHists) PostData(3,fOutputMC);
1573  if (fPriorsHists) PostData(5,fAPriori);
1574  if (fMultiplicityHists) PostData(6,fMultiplicity);
1575 
1576  PostData(4,fNentries);
1577  PostData(7,fCounter);
1578 
1579  return;
1580 }
1581 
1582 
1583 
1584 //________________________________________________________________________
1586 {
1587  // Terminate analysis
1588  //
1589  if (fDebug > 1) printf("AnalysisTaskSELambdac: Terminate() \n");
1590 
1591  fOutput = dynamic_cast<TList*> (GetOutputData(1));
1592  if (!fOutput) {
1593  AliError("ERROR: fOutput not available\n");
1594  return;
1595  }
1596  //fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents"));
1597 
1598  if(fFillNtuple){
1599  fNtupleLambdac = dynamic_cast<TNtuple*>(GetOutputData(3));
1600  }
1601 
1602 
1603  return;
1604 }
1605 
1606 //________________________________________________________________________
1608  // check if the candidate is a Lambdac decaying in pKpi or in the resonant channels
1609  Int_t lambdacLab[3]={0,0,0};
1610  // Int_t pdgs[3]={0,0,0};
1611  for(Int_t i=0;i<3;i++){
1612  AliAODTrack *daugh=(AliAODTrack*)d->GetDaughter(i);
1613  Int_t lab=daugh->GetLabel();
1614  if(lab<0) return 0;
1615  AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab);
1616  if(!part) continue;
1617  // pdgs[i]=part->GetPdgCode();
1618  Int_t partPdgcode = TMath::Abs(part->GetPdgCode());
1619  if(partPdgcode==211 || partPdgcode==321 || partPdgcode==2212){
1620  Int_t motherLabel=part->GetMother();
1621  if(motherLabel<0) return 0;
1622  AliAODMCParticle *motherPart = (AliAODMCParticle*)arrayMC->At(motherLabel);
1623  if(!motherPart) continue;
1624  Int_t motherPdg = TMath::Abs(motherPart->GetPdgCode());
1625  if(motherPdg==4122) {
1626  if(GetLambdacDaugh(motherPart,arrayMC)){lambdacLab[i]=motherLabel;continue;}
1627  }
1628  if(motherPdg==313 || motherPdg==2224 || motherPdg==3124){
1629  Int_t granMotherLabel=motherPart->GetMother();
1630  if(granMotherLabel<0) return 0;
1631  AliAODMCParticle *granMotherPart = (AliAODMCParticle*)arrayMC->At(granMotherLabel);
1632  if(!granMotherPart) continue;
1633  Int_t granMotherPdg = TMath::Abs(granMotherPart->GetPdgCode());
1634  if(granMotherPdg ==4122) {
1635  if(GetLambdacDaugh(granMotherPart,arrayMC)) {lambdacLab[i]=granMotherLabel;continue;}
1636  }
1637  }
1638  }
1639  }
1640 
1641  if(lambdacLab[0]==lambdacLab[1] && lambdacLab[1]==lambdacLab[2]) {return lambdacLab[0];}
1642  return 0;
1643 
1644 }
1645 //------------------------
1646 Bool_t AliAnalysisTaskSELambdac::GetLambdacDaugh(AliAODMCParticle *part,TClonesArray *arrayMC) const{
1647  // check if the particle is a lambdac and if its decay mode is the correct one
1648  Int_t numberOfLambdac=0;
1649  if(TMath::Abs(part->GetPdgCode())!=4122) return kFALSE;
1650  // Int_t daughTmp[2];
1651  // daughTmp[0]=part->GetDaughter(0);
1652  // daughTmp[1]=part->GetDaughter(1);
1653  Int_t nDaugh = (Int_t)part->GetNDaughters();
1654  if(nDaugh<2) return kFALSE;
1655  if(nDaugh>3) return kFALSE;
1656  AliAODMCParticle* pdaugh1 = (AliAODMCParticle*)arrayMC->At(part->GetDaughter(0));
1657  if(!pdaugh1) {return kFALSE;}
1658  Int_t number1 = TMath::Abs(pdaugh1->GetPdgCode());
1659  AliAODMCParticle* pdaugh2 = (AliAODMCParticle*)arrayMC->At(part->GetDaughter(1));
1660  if(!pdaugh2) {return kFALSE;}
1661  Int_t number2 = TMath::Abs(pdaugh2->GetPdgCode());
1662 
1663  if(nDaugh==3){
1664  Int_t thirdDaugh=part->GetDaughter(1)-1;
1665  AliAODMCParticle* pdaugh3 = (AliAODMCParticle*)arrayMC->At(thirdDaugh);
1666  Int_t number3 = TMath::Abs(pdaugh3->GetPdgCode());
1667  if((number1==321 && number2==211 && number3==2212) ||
1668  (number1==211 && number2==321 && number3==2212) ||
1669  (number1==211 && number2==2212 && number3==321) ||
1670  (number1==321 && number2==2212 && number3==211) ||
1671  (number1==2212 && number2==321 && number3==211) ||
1672  (number1==2212 && number2==211 && number3==321)) {
1673  numberOfLambdac++;
1674  }
1675  }
1676 
1677  if(nDaugh==2){
1678 
1679  //Lambda resonant
1680 
1681  //Lambda -> p K*0
1682  //
1683  Int_t nfiglieK=0;
1684 
1685  if((number1==2212 && number2==313)){
1686  nfiglieK=pdaugh2->GetNDaughters();
1687  if(nfiglieK!=2) return kFALSE;
1688  AliAODMCParticle* pdaughK1 = (AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(0));
1689  AliAODMCParticle* pdaughK2 = (AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(1));
1690  if(!pdaughK1) return kFALSE;
1691  if(!pdaughK2) return kFALSE;
1692  if((TMath::Abs(pdaughK1->GetPdgCode())==211 && TMath::Abs(pdaughK2->GetPdgCode())==321) || (TMath::Abs(pdaughK1->GetPdgCode())==321 && TMath::Abs(pdaughK2->GetPdgCode())==211)) numberOfLambdac++;
1693  }
1694 
1695  if((number1==313 && number2==2212)){
1696  nfiglieK=pdaugh1->GetNDaughters();
1697  if(nfiglieK!=2) return kFALSE;
1698  AliAODMCParticle* pdaughK1 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(0));
1699  AliAODMCParticle* pdaughK2 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(1));
1700  if(!pdaughK1) return kFALSE;
1701  if(!pdaughK2) return kFALSE;
1702  if((TMath::Abs(pdaughK1->GetPdgCode())==211 && TMath::Abs(pdaughK2->GetPdgCode())==321) || (TMath::Abs(pdaughK1->GetPdgCode())==321 && TMath::Abs(pdaughK2->GetPdgCode())==211)) numberOfLambdac++;
1703  }
1704 
1705  //Lambda -> Delta++ k
1706  Int_t nfiglieDelta=0;
1707  if(number1==321 && number2==2224){
1708  nfiglieDelta=pdaugh2->GetNDaughters();
1709  if(nfiglieDelta!=2) return kFALSE;
1710  AliAODMCParticle *pdaughD1=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(0));
1711  AliAODMCParticle *pdaughD2=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(1));
1712  if(!pdaughD1) return kFALSE;
1713  if(!pdaughD2) return kFALSE;
1714  if((TMath::Abs(pdaughD1->GetPdgCode())==211 && TMath::Abs(pdaughD2->GetPdgCode())==2212) || (TMath::Abs(pdaughD1->GetPdgCode())==2212 && TMath::Abs(pdaughD2->GetPdgCode())==211)) numberOfLambdac++;
1715  }
1716  if(number1==2224 && number2==321){
1717  nfiglieDelta=pdaugh1->GetNDaughters();
1718  if(nfiglieDelta!=2) return kFALSE;
1719  AliAODMCParticle* pdaughD1 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(0));
1720  AliAODMCParticle* pdaughD2 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(1));
1721  if(!pdaughD1) return kFALSE;
1722  if(!pdaughD2) return kFALSE;
1723  if((TMath::Abs(pdaughD1->GetPdgCode())==211 && TMath::Abs(pdaughD2->GetPdgCode())==2212) || (TMath::Abs(pdaughD1->GetPdgCode())==2212 && TMath::Abs(pdaughD2->GetPdgCode())==211)) numberOfLambdac++;
1724  }
1725 
1726 
1727  //Lambdac -> Lambda(1520) pi
1728  Int_t nfiglieLa=0;
1729  if(number1==3124 && number2==211){
1730  nfiglieLa=pdaugh1->GetNDaughters();
1731  if(nfiglieLa!=2) return kFALSE;
1732  AliAODMCParticle *pdaughL1=(AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(0));
1733  AliAODMCParticle *pdaughL2=(AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(1));
1734  if(!pdaughL1) return kFALSE;
1735  if(!pdaughL2) return kFALSE;
1736  if((TMath::Abs(pdaughL1->GetPdgCode())==321 && TMath::Abs(pdaughL2->GetPdgCode())==2212) || (TMath::Abs(pdaughL1->GetPdgCode())==2212 && TMath::Abs(pdaughL2->GetPdgCode())==321)) numberOfLambdac++;
1737  }
1738  if(number1==211 && number2==3124){
1739  nfiglieLa=pdaugh2->GetNDaughters();
1740  if(nfiglieLa!=2) return kFALSE;
1741  AliAODMCParticle *pdaughL1=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(0));
1742  AliAODMCParticle *pdaughL2=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(1));
1743  if(!pdaughL1) return kFALSE;
1744  if(!pdaughL2) return kFALSE;
1745  if((TMath::Abs(pdaughL1->GetPdgCode())==321 && TMath::Abs(pdaughL2->GetPdgCode())==2212) || (TMath::Abs(pdaughL1->GetPdgCode())==2212 && TMath::Abs(pdaughL2->GetPdgCode())==321)) numberOfLambdac++;
1746 
1747  }
1748  }
1749 
1750  if(numberOfLambdac>0) {return kTRUE;}
1751  return kFALSE;
1752 }
1753 //-----------------------------
1755  // Apply MC PID
1756  Int_t lab[3]={0,0,0},pdgs[3]={0,0,0};
1757  for(Int_t i=0;i<3;i++){
1758  AliAODTrack *daugh=(AliAODTrack*)d->GetDaughter(i);
1759  lab[i]=daugh->GetLabel();
1760  if(lab[i]<0) return kFALSE;
1761  AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab[i]);
1762  if(!part) return kFALSE;
1763  pdgs[i]=TMath::Abs(part->GetPdgCode());
1764  }
1765 
1766  if(pdgs[0]==2212 && pdgs[1]==321 && pdgs[2]==211) return kTRUE;
1767 
1768  return kFALSE;
1769 }
1770 //-----------------------------
1772 
1773  // Apply MC PID
1774  Int_t lab[3]={0,0,0},pdgs[3]={0,0,0};
1775  for(Int_t i=0;i<3;i++){
1776  AliAODTrack *daugh=(AliAODTrack*)d->GetDaughter(i);
1777  lab[i]=daugh->GetLabel();
1778  if(lab[i]<0) return kFALSE;
1779  AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab[i]);
1780  if(!part) return kFALSE;
1781  pdgs[i]=TMath::Abs(part->GetPdgCode());
1782  }
1783 
1784  if(pdgs[2]==2212 && pdgs[1]==321 && pdgs[0]==211) {return kTRUE;}
1785 
1786  return kFALSE;
1787 }
1788 //--------------------------------------
1790  // apply vertexing KF
1791  Int_t iprongs[3]={0,1,2};
1792  Double_t mass[2]={0.,0.};
1793  Bool_t constraint=kFALSE;
1794  if(fCutsKF[0]>0.)constraint=kTRUE;
1795  //topological constr
1796  AliKFParticle *lambdac=d->ApplyVertexingKF(iprongs,3,pdgs,constraint,field,mass);
1797  if(!lambdac) return kFALSE;
1798  if(lambdac->GetChi2()/lambdac->GetNDF()>fCutsKF[1]) return kFALSE;
1799  return kTRUE;
1800 }
1801 //-------------------------------------
1803 
1804  // apply PID using the resonant channels
1805  //if lambda* -> pk
1806  Double_t mass[2]={1.520,0.005};
1807  Int_t ipRes[2]={1,2};
1808  Int_t pdgres[2]={321,2212};
1809  AliKFParticle *lambda1520=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1810  Double_t probLa=TMath::Prob(lambda1520->GetChi2(),lambda1520->GetNDF());
1811  if(probLa>0.1) resNumber[0]=1;
1812  //K* -> kpi
1813  mass[0]=0.8961;mass[1]=0.03;
1814  ipRes[0]=0;ipRes[1]=1;
1815  pdgres[0]=211;pdgres[1]=321;
1816  AliKFParticle *kstar=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1817  Double_t probKa=TMath::Prob(kstar->GetChi2(),kstar->GetNDF());
1818  if(probKa>0.1) resNumber[1]=1;
1819 
1820  // Delta++
1821  mass[0]=1.232;mass[1]=0.15;
1822  ipRes[0]=0;ipRes[1]=2;
1823  pdgres[0]=211;pdgres[1]=2122;
1824  AliKFParticle *delta=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1825  Double_t probDe=TMath::Prob(delta->GetChi2(),delta->GetNDF());
1826  if(probDe>0.1) resNumber[2]=1;
1827 
1828  return ;
1829 
1830 }
1831 //-------------------------------------
1833 
1834  // apply PID using the resonant channels
1835  //if lambda* -> pk
1836  Double_t mass[2]={1.520,0.005};
1837  Int_t ipRes[2]={0,1};
1838  Int_t pdgres[2]={2212,321};
1839  AliKFParticle *lambda1520=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1840  Double_t probLa=TMath::Prob(lambda1520->GetChi2(),lambda1520->GetNDF());
1841  if(probLa>0.1) resNumber[0]=1;
1842  //K* -> kpi
1843  mass[0]=0.8961;mass[1]=0.03;
1844  ipRes[0]=1;ipRes[1]=2;
1845  pdgres[1]=211;pdgres[0]=321;
1846  AliKFParticle *kstar=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1847  Double_t probKa=TMath::Prob(kstar->GetChi2(),kstar->GetNDF());
1848  if(probKa>0.1) resNumber[1]=1;
1849 
1850  // Delta++
1851  mass[0]=1.232;mass[1]=0.15;
1852  ipRes[0]=0;ipRes[1]=2;
1853  pdgres[0]=2122;pdgres[1]=211;
1854  AliKFParticle *delta=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1855  Double_t probDe=TMath::Prob(delta->GetChi2(),delta->GetNDF());
1856  if(probDe>0.1) resNumber[2]=1;
1857 
1858  return ;
1859 
1860 }
1861 //---------------------------
1863  TClonesArray *arrayMC, AliRDHFCutsLctopKpi *cuts,Int_t *nSelectedloose,Int_t *nSelectedtight)
1864 {
1865 
1866  //if MC PID or no PID, unset PID
1867  //if(!fRealPid) cuts->SetUsePID(kFALSE);
1868  Int_t selection=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
1869  if(selection>0){
1870  nSelectedloose[0]=nSelectedloose[0]+1;
1871  Int_t iPtBin = -1;
1872  Double_t ptCand = part->Pt();
1873  Int_t index=0;
1874 
1875  for(Int_t ibin=0;ibin<fNPtBins&&iPtBin<0&&ptCand>fArrayBinLimits[0]&&ptCand<fArrayBinLimits[fNPtBins];ibin++){
1876  if(ptCand<fArrayBinLimits[ibin+1])iPtBin=ibin;
1877  }
1878 
1879  Float_t pdgCode=-2;
1880  Float_t pdgCode1=-1;
1881  Float_t pdgCode2=-1;
1882  Int_t labDp=-1;
1883  Float_t deltaPx=0.;
1884  Float_t deltaPy=0.;
1885  Float_t deltaPz=0.;
1886  Float_t truePt=0.;
1887  Float_t xDecay=0.;
1888  Float_t yDecay=0.;
1889  Float_t zDecay=0.;
1890  // Bool_t IsInjected = -1;
1891  Bool_t IsLc = 0;
1892  Bool_t IsLcfromLb = 0;
1893  Bool_t IsLcfromc = 0;
1894  Bool_t IsLcFromq = 0;
1895 
1896  if(fReadMC){
1897  // AliAODMCHeader *mcHeader2 = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1899  // IsInjected = util->IsCandidateInjected(part,mcHeader2,arrayMC)?1:0;
1900 
1901  Int_t pdgCand =4122;
1902  Int_t pdgDaughter[3]={-1,-1,-1};
1903  pdgDaughter[0]=2212;
1904  pdgDaughter[1]=321;
1905  pdgDaughter[2]=211;
1906  //labDp = MatchToMCLambdac(part,arrayMC);
1907  labDp = part->MatchToMC(pdgCand,arrayMC,3,pdgDaughter);
1908  if(labDp>=0){
1909  IsLc = 1;
1910  AliAODMCParticle *partDp = (AliAODMCParticle*)arrayMC->At(labDp);
1911  AliAODMCParticle *dg0 = (AliAODMCParticle*)arrayMC->At(partDp->GetDaughter(0));
1912  AliAODMCParticle *dg1 = (AliAODMCParticle*)arrayMC->At(partDp->GetDaughter(1));
1913  deltaPx=partDp->Px()-part->Px();
1914  deltaPy=partDp->Py()-part->Py();
1915  deltaPz=partDp->Pz()-part->Pz();
1916  truePt=partDp->Pt();
1917  xDecay=dg0->Xv();
1918  yDecay=dg0->Yv();
1919  zDecay=dg0->Zv();
1920  pdgCode=TMath::Abs(partDp->GetPdgCode());
1921  pdgCode1=TMath::Abs(dg0->GetPdgCode());
1922  pdgCode2=TMath::Abs(dg1->GetPdgCode());
1923  Int_t pdgMom=util->CheckOrigin(arrayMC,partDp,kFALSE);
1924  if(pdgMom == 5) IsLcfromLb =1;
1925  if(pdgMom == 4) IsLcfromc =1;
1926  Int_t isThereaQuark=util->CheckOrigin(arrayMC,partDp,kTRUE);
1927  if(isThereaQuark>0) IsLcFromq = 1;
1928 
1929 
1930  }else{
1931  pdgCode=-1;
1932  }
1933  delete util;
1934  }
1935 
1936  Double_t invMasspKpi=-1.;
1937  Double_t invMasspiKp=-1.;
1938  Double_t invMasspKpiLpi=-1.;
1939  Double_t invMasspiKpLpi=-1.;
1940  Double_t invMasspKpiKp=-1.;
1941  Double_t invMasspiKpKp=-1.;
1942  Double_t invMasspiKpDk=-1.;
1943  Double_t invMasspKpiDk=-1.;
1944  Double_t invMasspiKp3Pr=-1.;
1945  Double_t invMasspKpi3Pr=-1.;
1946  Double_t field=aod->GetMagneticField();
1947  //apply MC PID
1948  if(fReadMC && fMCPid){
1949  if(IspKpiMC(part,arrayMC)) invMasspKpi=part->InvMassLcpKpi();
1950  if(IspiKpMC(part,arrayMC)) invMasspiKp=part->InvMassLcpiKp();
1951  }
1952 
1953  // apply realistic PID
1954  if(fRealPid){
1955  if(selection==1 || selection==3) invMasspKpi=part->InvMassLcpKpi();
1956  if(selection>=2) invMasspiKp=part->InvMassLcpiKp();
1957  }
1958  //apply PID using resonances
1959  if (fResPid && fRealPid) {
1960  Int_t ispKpi[3]={0,0,0};
1961  IspKpiResonant(part,field,ispKpi);
1962  Int_t ispiKp[3]={0,0,0};
1963  IspiKpResonant(part,field,ispiKp);
1964  if (selection==3 || selection==1) {
1965  if(ispKpi[0]==1){
1966  invMasspKpiLpi=part->InvMassLcpKpi();
1967  }
1968  if(ispKpi[1]==1){
1969  invMasspKpiKp=part->InvMassLcpKpi();
1970  }
1971  if(ispKpi[2]==1){
1972  invMasspKpiDk=part->InvMassLcpKpi();
1973  }
1974  if(ispKpi[2]==0 && ispKpi[1]==0 && ispKpi[0]==0){
1975  invMasspKpi3Pr=part->InvMassLcpKpi();
1976  }
1977  }
1978  if(selection>=2) {
1979  if(ispiKp[0]==1){
1980  invMasspiKpLpi=part->InvMassLcpiKp();
1981  }
1982  if(ispiKp[1]==1){
1983  invMasspiKpKp=part->InvMassLcpiKp();
1984  }
1985  if(ispiKp[2]==1){
1986  invMasspiKpDk=part->InvMassLcpiKp();
1987  }
1988  if(ispiKp[2]==0 && ispiKp[1]==0 && ispiKp[0]==0){
1989  invMasspiKp3Pr=part->InvMassLcpiKp();
1990  }
1991  }
1992 
1993  }
1994 
1995 
1996  if(invMasspiKp<0. && invMasspKpi<0.) return;
1997 
1998  Int_t passTightCuts=0;
1999  if(fAnalysis) {
2000  passTightCuts=fRDCutsAnalysis->IsSelected(part,AliRDHFCuts::kCandidate,aod);
2001  if(fUseKF){
2002  Int_t pdgs[3]={0,0,0};
2003  if(invMasspKpi>0.){
2004  pdgs[0]=2212;pdgs[1]=321;pdgs[2]=211;
2005  if(!VertexingKF(part,pdgs,field)) {
2006  invMasspKpi=-1.;
2007  invMasspKpi3Pr=-1.;
2008  invMasspKpiDk=-1.;
2009  invMasspKpiLpi=-1.;
2010  invMasspKpiKp=-1.;
2011  }
2012  }
2013  if(invMasspiKp>0.){
2014  pdgs[0]=211;pdgs[1]=321;pdgs[2]=2212;
2015  if(!VertexingKF(part,pdgs,field)) {
2016  invMasspiKp=-1.;
2017  invMasspiKp3Pr=-1.;
2018  invMasspiKpDk=-1.;
2019  invMasspiKpLpi=-1.;
2020  invMasspiKpKp=-1.;
2021  }
2022  }
2023  }
2024  if(passTightCuts>0) nSelectedtight[0]=nSelectedtight[0]+1;
2025  }
2026  // Eta and y plots:
2027  fhEta3ProngProd->Fill(part->Pt(),part->Eta());
2028  fhRap3ProngProd->Fill(part->Pt(),part->Y(4122));
2029  if(passTightCuts>0){
2030  fhEta3ProngAn->Fill(part->Pt(),part->Eta());
2031  fhRap3ProngAn->Fill(part->Pt(),part->Y(4122));
2032  if(invMasspiKp>0. && invMasspKpi>0.){
2033  fhMassLcPt->Fill(part->Pt(),invMasspKpi,0.5);
2034  fhMassLcPt->Fill(part->Pt(),invMasspiKp,0.5);
2035  if(part->Charge()==1){
2036  fhMassLcplusPt->Fill(part->Pt(),invMasspKpi,0.5);
2037  fhMassLcplusPt->Fill(part->Pt(),invMasspiKp,0.5);
2038  }
2039  else if(part->Charge()==-1){
2040  fhMassLcminusPt->Fill(part->Pt(),invMasspKpi,0.5);
2041  fhMassLcminusPt->Fill(part->Pt(),invMasspiKp,0.5);
2042  }
2043  }
2044  else if(invMasspiKp>0.){
2045  fhMassLcPt->Fill(part->Pt(),invMasspiKp);
2046  if(part->Charge()==1) fhMassLcplusPt->Fill(part->Pt(),invMasspiKp);
2047  else if(part->Charge()==-1) fhMassLcminusPt->Fill(part->Pt(),invMasspiKp);
2048  }
2049  else if(invMasspKpi>0.){
2050  fhMassLcPt->Fill(part->Pt(),invMasspKpi);
2051  if(part->Charge()==1) fhMassLcplusPt->Fill(part->Pt(),invMasspKpi);
2052  else if(part->Charge()==-1) fhMassLcminusPt->Fill(part->Pt(),invMasspKpi);
2053  }
2054 
2055  }
2056  Float_t tmp[24];
2057  if (fFillNtuple) {
2058  tmp[0]=pdgCode;
2059  tmp[1]=deltaPx;
2060  tmp[2]=deltaPy;
2061  tmp[3]=deltaPz;
2062  tmp[4]=truePt;
2063  tmp[5]=xDecay;
2064  tmp[6]=yDecay;
2065  tmp[7]=zDecay;
2066  if(pdgCode1==2212) {tmp[8]=part->PtProng(0);}else{tmp[8]=0.;}
2067  if(pdgCode1==211) {tmp[10]=part->PtProng(0);}else{tmp[10]=0.;}
2068  tmp[9]=part->PtProng(1);
2069  if(pdgCode2==211) {tmp[10]=part->PtProng(2);}else{tmp[10]=0.;}
2070  tmp[11]=part->Pt();
2071  tmp[12]=part->CosPointingAngle();
2072  tmp[13]=part->DecayLength();
2073  tmp[14]=part->Xv();
2074  tmp[15]=part->Yv();
2075  tmp[16]=part->Zv();
2076  if(invMasspiKp>0.) tmp[17]=invMasspiKp;
2077  if(invMasspKpi>0.) tmp[17]=invMasspKpi;
2078  tmp[18]=part->GetSigmaVert();
2079  tmp[19]=part->Getd0Prong(0);
2080  tmp[20]=part->Getd0Prong(1);
2081  tmp[21]=part->Getd0Prong(2);
2082  tmp[22]=part->GetDCA();
2083  tmp[23]=part->Prodd0d0();
2084  fNtupleLambdac->Fill(tmp);
2085  PostData(7,fNtupleLambdac);
2086  }
2087 
2088 
2089 
2090  if(part->Pt()>3.&& part->Pt()<=6.){
2091  if(invMasspiKp>0. && invMasspKpi>0.){
2092  if(invMasspiKp>0.) fhMassPtGreater3->Fill(invMasspiKp,0.5);
2093  if(invMasspKpi>0.) fhMassPtGreater3->Fill(invMasspKpi,0.5);
2094  }else{
2095  if(invMasspiKp>0.) fhMassPtGreater3->Fill(invMasspiKp);
2096  if(invMasspKpi>0.) fhMassPtGreater3->Fill(invMasspKpi);
2097  }
2098  if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
2099  if(invMasspiKpLpi>0.) fhMassPtGreater3Lpi->Fill(invMasspiKpLpi,0.5);
2100  if(invMasspKpiLpi>0.) fhMassPtGreater3Lpi->Fill(invMasspKpiLpi,0.5);
2101  }else{
2102  if(invMasspiKpLpi>0.) fhMassPtGreater3Lpi->Fill(invMasspiKpLpi);
2103  if(invMasspKpiLpi>0.) fhMassPtGreater3Lpi->Fill(invMasspKpiLpi);
2104  }
2105  if(invMasspiKpKp>0. && invMasspKpiKp>0.){
2106  if(invMasspiKpKp>0.) fhMassPtGreater3Kp->Fill(invMasspiKpKp,0.5);
2107  if(invMasspKpiKp>0.) fhMassPtGreater3Kp->Fill(invMasspKpiKp,0.5);
2108  }else{
2109  if(invMasspiKpKp>0.) fhMassPtGreater3Kp->Fill(invMasspiKpKp);
2110  if(invMasspKpiKp>0.) fhMassPtGreater3Kp->Fill(invMasspKpiKp);
2111  }
2112  if(invMasspiKpDk>0. && invMasspKpiDk>0.){
2113  if(invMasspiKpDk>0.) fhMassPtGreater3Dk->Fill(invMasspiKpDk,0.5);
2114  if(invMasspKpiDk>0.) fhMassPtGreater3Dk->Fill(invMasspKpiDk,0.5);
2115  }else{
2116  if(invMasspiKpDk>0.) fhMassPtGreater3Dk->Fill(invMasspiKpDk);
2117  if(invMasspKpiDk>0.) fhMassPtGreater3Dk->Fill(invMasspKpiDk);
2118  }
2119  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0.){
2120  if(invMasspiKp3Pr>0.) fhMassPtGreater33Pr->Fill(invMasspiKp3Pr,0.5);
2121  if(invMasspKpi3Pr>0.) fhMassPtGreater33Pr->Fill(invMasspKpi3Pr,0.5);
2122  }else{
2123  if(invMasspiKp3Pr>0.) fhMassPtGreater33Pr->Fill(invMasspiKp3Pr);
2124  if(invMasspKpi3Pr>0.) fhMassPtGreater33Pr->Fill(invMasspKpi3Pr);
2125  }
2126 
2127  if(passTightCuts>0){
2128  if(invMasspiKp>0. && invMasspKpi>0.){
2129  if(invMasspiKp>0.) fhMassPtGreater3TC->Fill(invMasspiKp,0.5);
2130  if(invMasspKpi>0.) fhMassPtGreater3TC->Fill(invMasspKpi,0.5);
2131  }else{
2132  if(invMasspiKp>0.) fhMassPtGreater3TC->Fill(invMasspiKp);
2133  if(invMasspKpi>0.) fhMassPtGreater3TC->Fill(invMasspKpi);
2134  }
2135  if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
2136  if(invMasspiKpLpi>0.) fhMassPtGreater3LpiTC->Fill(invMasspiKpLpi,0.5);
2137  if(invMasspKpiLpi>0.) fhMassPtGreater3LpiTC->Fill(invMasspKpiLpi,0.5);
2138  }else{
2139  if(invMasspiKpLpi>0.) fhMassPtGreater3LpiTC->Fill(invMasspiKpLpi);
2140  if(invMasspKpiLpi>0.) fhMassPtGreater3LpiTC->Fill(invMasspKpiLpi);
2141  }
2142  if(invMasspiKpKp>0. && invMasspKpiKp>0.){
2143  if(invMasspiKpKp>0.) fhMassPtGreater3KpTC->Fill(invMasspiKpKp,0.5);
2144  if(invMasspKpiKp>0.) fhMassPtGreater3KpTC->Fill(invMasspKpiKp,0.5);
2145  }else{
2146  if(invMasspiKpKp>0.) fhMassPtGreater3KpTC->Fill(invMasspiKpKp);
2147  if(invMasspKpiKp>0.) fhMassPtGreater3KpTC->Fill(invMasspKpiKp);
2148  }
2149 
2150  if(invMasspiKpDk>0. && invMasspKpiDk>0.){
2151  if(invMasspiKpDk>0.) fhMassPtGreater3DkTC->Fill(invMasspiKpDk,0.5);
2152  if(invMasspKpiDk>0.) fhMassPtGreater3DkTC->Fill(invMasspKpiDk,0.5);
2153  }else{
2154  if(invMasspiKpDk>0.) fhMassPtGreater3DkTC->Fill(invMasspiKpDk);
2155  if(invMasspKpiDk>0.) fhMassPtGreater3DkTC->Fill(invMasspKpiDk);
2156  }
2157  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0.){
2158  if(invMasspiKp3Pr>0.) fhMassPtGreater33PrTC->Fill(invMasspiKp3Pr,0.5);
2159  if(invMasspKpi3Pr>0.) fhMassPtGreater33PrTC->Fill(invMasspKpi3Pr,0.5);
2160  }else{
2161  if(invMasspiKp3Pr>0.) fhMassPtGreater33PrTC->Fill(invMasspiKp3Pr);
2162  if(invMasspKpi3Pr>0.) fhMassPtGreater33PrTC->Fill(invMasspKpi3Pr);
2163  }
2164 
2165  }
2166  }
2167  if(part->Pt()>2.&& part->Pt()<=6.){
2168  if(invMasspiKp>0. && invMasspKpi>0.){
2169  if(invMasspiKp>0.) fhMassPtGreater2->Fill(invMasspiKp,0.5);
2170  if(invMasspKpi>0.) fhMassPtGreater2->Fill(invMasspKpi,0.5);
2171  }else{
2172  if(invMasspiKp>0.) fhMassPtGreater2->Fill(invMasspiKp);
2173  if(invMasspKpi>0.) fhMassPtGreater2->Fill(invMasspKpi);
2174  }
2175  if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
2176  if(invMasspiKpLpi>0.) fhMassPtGreater2Lpi->Fill(invMasspiKpLpi,0.5);
2177  if(invMasspKpiLpi>0.) fhMassPtGreater2Lpi->Fill(invMasspKpiLpi,0.5);
2178  }else{
2179  if(invMasspiKpLpi>0.) fhMassPtGreater2Lpi->Fill(invMasspiKpLpi);
2180  if(invMasspKpiLpi>0.) fhMassPtGreater2Lpi->Fill(invMasspKpiLpi);
2181  }
2182  if(invMasspiKpKp>0. && invMasspKpiKp>0.){
2183  if(invMasspiKpKp>0.) fhMassPtGreater2Kp->Fill(invMasspiKpKp,0.5);
2184  if(invMasspKpiKp>0.) fhMassPtGreater2Kp->Fill(invMasspKpiKp,0.5);
2185  }else{
2186  if(invMasspiKpKp>0.) fhMassPtGreater2Kp->Fill(invMasspiKpKp);
2187  if(invMasspKpiKp>0.) fhMassPtGreater2Kp->Fill(invMasspKpiKp);
2188  }
2189  if(invMasspiKpDk>0. && invMasspKpiDk>0.){
2190  if(invMasspiKpDk>0.) fhMassPtGreater2Dk->Fill(invMasspiKpDk,0.5);
2191  if(invMasspKpiDk>0.) fhMassPtGreater2Dk->Fill(invMasspKpiDk,0.5);
2192  }else{
2193  if(invMasspiKpDk>0.) fhMassPtGreater2Dk->Fill(invMasspiKpDk);
2194  if(invMasspKpiDk>0.) fhMassPtGreater2Dk->Fill(invMasspKpiDk);
2195  }
2196  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0.){
2197  if(invMasspiKp3Pr>0.) fhMassPtGreater23Pr->Fill(invMasspiKp3Pr,0.5);
2198  if(invMasspKpi3Pr>0.) fhMassPtGreater23Pr->Fill(invMasspKpi3Pr,0.5);
2199  }else{
2200  if(invMasspiKp3Pr>0.) fhMassPtGreater23Pr->Fill(invMasspiKp3Pr);
2201  if(invMasspKpi3Pr>0.) fhMassPtGreater23Pr->Fill(invMasspKpi3Pr);
2202  }
2203 
2204  if(passTightCuts>0){
2205  if(invMasspiKp>0. && invMasspKpi>0.){
2206  if(invMasspiKp>0.) fhMassPtGreater2TC->Fill(invMasspiKp,0.5);
2207  if(invMasspKpi>0.) fhMassPtGreater2TC->Fill(invMasspKpi,0.5);
2208  }else{
2209  if(invMasspiKp>0.) fhMassPtGreater2TC->Fill(invMasspiKp);
2210  if(invMasspKpi>0.) fhMassPtGreater2TC->Fill(invMasspKpi);
2211  }
2212  if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
2213  if(invMasspiKpLpi>0.) fhMassPtGreater2LpiTC->Fill(invMasspiKpLpi,0.5);
2214  if(invMasspKpiLpi>0.) fhMassPtGreater2LpiTC->Fill(invMasspKpiLpi,0.5);
2215  }else{
2216  if(invMasspiKpLpi>0.) fhMassPtGreater2LpiTC->Fill(invMasspiKpLpi);
2217  if(invMasspKpiLpi>0.) fhMassPtGreater2LpiTC->Fill(invMasspKpiLpi);
2218  }
2219  if(invMasspiKpKp>0. && invMasspKpiKp>0.){
2220  if(invMasspiKpKp>0.) fhMassPtGreater2KpTC->Fill(invMasspiKpKp,0.5);
2221  if(invMasspKpiKp>0.) fhMassPtGreater2KpTC->Fill(invMasspKpiKp,0.5);
2222  }else{
2223  if(invMasspiKpKp>0.) fhMassPtGreater2KpTC->Fill(invMasspiKpKp);
2224  if(invMasspKpiKp>0.) fhMassPtGreater2KpTC->Fill(invMasspKpiKp);
2225  }
2226  if(invMasspiKpDk>0. && invMasspKpiDk>0.){
2227  if(invMasspiKpDk>0.) fhMassPtGreater2DkTC->Fill(invMasspiKpDk,0.5);
2228  if(invMasspKpiDk>0.) fhMassPtGreater2DkTC->Fill(invMasspKpiDk,0.5);
2229  }else{
2230  if(invMasspiKpDk>0.) fhMassPtGreater2DkTC->Fill(invMasspiKpDk);
2231  if(invMasspKpiDk>0.) fhMassPtGreater2DkTC->Fill(invMasspKpiDk);
2232  }
2233  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0.){
2234  if(invMasspiKp3Pr>0.) fhMassPtGreater23PrTC->Fill(invMasspiKp3Pr,0.5);
2235  if(invMasspKpi3Pr>0.) fhMassPtGreater23PrTC->Fill(invMasspKpi3Pr,0.5);
2236  }else{
2237  if(invMasspiKp3Pr>0.) fhMassPtGreater23PrTC->Fill(invMasspiKp3Pr);
2238  if(invMasspKpi3Pr>0.) fhMassPtGreater23PrTC->Fill(invMasspKpi3Pr);
2239  }
2240 
2241  }
2242  }
2243 
2244  if(iPtBin>=0){
2245  index=GetHistoIndex(iPtBin);
2246  if(invMasspiKp>0. && invMasspKpi>0.){
2247  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp,0.5);
2248  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi,0.5);
2249  }else{
2250  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp);
2251  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi);
2252  }
2253  if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
2254  if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi,0.5);
2255  if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi,0.5);
2256  }else{
2257  if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi);
2258  if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi);
2259  }
2260  if(invMasspiKpKp>0. && invMasspKpiKp>0.){
2261  if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp,0.5);
2262  if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp,0.5);
2263  }else{
2264  if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp);
2265  if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp);
2266  }
2267  if(invMasspiKpDk>0. && invMasspKpiDk>0.){
2268  if(invMasspiKpDk>0.) fMassHistDk[index]->Fill(invMasspiKpDk,0.5);
2269  if(invMasspKpiDk>0.) fMassHistDk[index]->Fill(invMasspKpiDk,0.5);
2270  }else{
2271  if(invMasspiKpDk>0.) fMassHistDk[index]->Fill(invMasspiKpDk);
2272  if(invMasspKpiDk>0.) fMassHistDk[index]->Fill(invMasspKpiDk);
2273  }
2274  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0.){
2275  if(invMasspiKp3Pr>0.) fMassHist3Pr[index]->Fill(invMasspiKp3Pr,0.5);
2276  if(invMasspKpi3Pr>0.) fMassHist3Pr[index]->Fill(invMasspKpi3Pr,0.5);
2277  }else{
2278  if(invMasspiKp3Pr>0.) fMassHist3Pr[index]->Fill(invMasspiKp3Pr);
2279  if(invMasspKpi3Pr>0.) fMassHist3Pr[index]->Fill(invMasspKpi3Pr);
2280  }
2281 
2282  if(passTightCuts>0){
2283  if(invMasspiKp>0. && invMasspKpi>0. && passTightCuts==3){
2284  if(invMasspiKp>0.) fMassHistTC[index]->Fill(invMasspiKp,0.5);
2285  if(invMasspKpi>0.) fMassHistTC[index]->Fill(invMasspKpi,0.5);
2286  }else{
2287  if(invMasspiKp>0. && passTightCuts==2) fMassHistTC[index]->Fill(invMasspiKp);
2288  if(invMasspKpi>0. && passTightCuts==1) fMassHistTC[index]->Fill(invMasspKpi);
2289  }
2290  if(invMasspiKpLpi>0. && invMasspKpiLpi>0. && passTightCuts==3){
2291  if(invMasspiKpLpi>0.) fMassHistLpiTC[index]->Fill(invMasspiKpLpi,0.5);
2292  if(invMasspKpiLpi>0.) fMassHistLpiTC[index]->Fill(invMasspKpiLpi,0.5);
2293  }else{
2294  if(invMasspiKpLpi>0. && passTightCuts==2) fMassHistLpiTC[index]->Fill(invMasspiKpLpi);
2295  if(invMasspKpiLpi>0.&& passTightCuts==1) fMassHistLpiTC[index]->Fill(invMasspKpiLpi);
2296  }
2297  if(invMasspiKpKp>0. && invMasspKpiKp>0. && passTightCuts==3){
2298  if(invMasspiKpKp>0.) fMassHistKpTC[index]->Fill(invMasspiKpKp,0.5);
2299  if(invMasspKpiKp>0.) fMassHistKpTC[index]->Fill(invMasspKpiKp,0.5);
2300  }else{
2301  if(invMasspiKpKp>0. && passTightCuts==2) fMassHistKpTC[index]->Fill(invMasspiKpKp);
2302  if(invMasspKpiKp>0.&& passTightCuts==1) fMassHistKpTC[index]->Fill(invMasspKpiKp);
2303  }
2304  if(invMasspiKpDk>0. && invMasspKpiDk>0. && passTightCuts==3){
2305  if(invMasspiKpDk>0.) fMassHistDkTC[index]->Fill(invMasspiKpDk,0.5);
2306  if(invMasspKpiDk>0.) fMassHistDkTC[index]->Fill(invMasspKpiDk,0.5);
2307  }else{
2308  if(invMasspiKpDk>0. && passTightCuts==2) fMassHistDkTC[index]->Fill(invMasspiKpDk);
2309  if(invMasspKpiDk>0.&& passTightCuts==1) fMassHistDkTC[index]->Fill(invMasspKpiDk);
2310  }
2311  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0. && passTightCuts==3){
2312  if(invMasspiKp3Pr>0.) fMassHist3PrTC[index]->Fill(invMasspiKp3Pr,0.5);
2313  if(invMasspKpi3Pr>0.) fMassHist3PrTC[index]->Fill(invMasspKpi3Pr,0.5);
2314  }else{
2315  if(invMasspiKp3Pr>0. && passTightCuts==2) fMassHist3PrTC[index]->Fill(invMasspiKp3Pr);
2316  if(invMasspKpi3Pr>0.&& passTightCuts==1) fMassHist3PrTC[index]->Fill(invMasspKpi3Pr);
2317  }
2318 
2319  }
2320 
2321  if(fReadMC){
2322  if(labDp>=0) {
2323  index=GetSignalHistoIndex(iPtBin);
2324  if(invMasspiKp>0. && invMasspKpi>0.){
2325  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp,0.5);
2326  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi,0.5);
2327  }else{
2328  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp);
2329  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi);
2330  }
2331  if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
2332  if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi,0.5);
2333  if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi,0.5);
2334  }else{
2335  if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi);
2336  if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi);
2337  }
2338  if(invMasspiKpKp>0. && invMasspKpiKp>0.){
2339  if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp,0.5);
2340  if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp,0.5);
2341  }else{
2342  if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp);
2343  if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp);
2344  }
2345  if(invMasspiKpDk>0. && invMasspKpiDk>0.){
2346  if(invMasspiKpDk>0.) fMassHistDk[index]->Fill(invMasspiKpDk,0.5);
2347  if(invMasspKpiDk>0.) fMassHistDk[index]->Fill(invMasspKpiDk,0.5);
2348  }else{
2349  if(invMasspiKpDk>0.) fMassHistDk[index]->Fill(invMasspiKpDk);
2350  if(invMasspKpiDk>0.) fMassHistDk[index]->Fill(invMasspKpiDk);
2351  }
2352  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0.){
2353  if(invMasspiKp3Pr>0.) fMassHist3Pr[index]->Fill(invMasspiKp3Pr,0.5);
2354  if(invMasspKpi3Pr>0.) fMassHist3Pr[index]->Fill(invMasspKpi3Pr,0.5);
2355  }else{
2356  if(invMasspiKp3Pr>0.) fMassHist3Pr[index]->Fill(invMasspiKp3Pr);
2357  if(invMasspKpi3Pr>0.) fMassHistDk[index]->Fill(invMasspKpi3Pr);
2358  }
2359 
2360  if(passTightCuts>0){
2361  if(invMasspiKp>0. && invMasspKpi>0. && passTightCuts==3){
2362  if(invMasspiKp>0.) fMassHistTC[index]->Fill(invMasspiKp,0.5);
2363  if(invMasspKpi>0.) fMassHistTC[index]->Fill(invMasspKpi,0.5);
2364  }else{
2365  if(invMasspiKp>0. && passTightCuts==2) fMassHistTC[index]->Fill(invMasspiKp);
2366  if(invMasspKpi>0.&& passTightCuts==1) fMassHistTC[index]->Fill(invMasspKpi);
2367  }
2368  if(invMasspiKpLpi>0. && invMasspKpiLpi>0. && passTightCuts==3){
2369  if(invMasspiKpLpi>0.) fMassHistLpiTC[index]->Fill(invMasspiKpLpi,0.5);
2370  if(invMasspKpiLpi>0.) fMassHistLpiTC[index]->Fill(invMasspKpiLpi,0.5);
2371  }else{
2372  if(invMasspiKpLpi>0. && passTightCuts==2) fMassHistLpiTC[index]->Fill(invMasspiKpLpi);
2373  if(invMasspKpiLpi>0.&& passTightCuts==1) fMassHistLpiTC[index]->Fill(invMasspKpiLpi);
2374  }
2375  if(invMasspiKpKp>0. && invMasspKpiKp>0. && passTightCuts==3){
2376  if(invMasspiKpKp>0.) fMassHistKpTC[index]->Fill(invMasspiKpKp,0.5);
2377  if(invMasspKpiKp>0.) fMassHistKpTC[index]->Fill(invMasspKpiKp,0.5);
2378  }else{
2379  if(invMasspiKpKp>0. && passTightCuts==2) fMassHistKpTC[index]->Fill(invMasspiKpKp);
2380  if(invMasspKpiKp>0.&& passTightCuts==1) fMassHistKpTC[index]->Fill(invMasspKpiKp);
2381  }
2382  if(invMasspiKpDk>0. && invMasspKpiDk>0. && passTightCuts==3){
2383  if(invMasspiKpDk>0.) fMassHistDkTC[index]->Fill(invMasspiKpDk,0.5);
2384  if(invMasspKpiDk>0.) fMassHistDkTC[index]->Fill(invMasspKpiDk,0.5);
2385  }else{
2386  if(invMasspiKpDk>0. && passTightCuts==2) fMassHistDkTC[index]->Fill(invMasspiKpDk);
2387  if(invMasspKpiDk>0.&& passTightCuts==1) fMassHistDkTC[index]->Fill(invMasspKpiDk);
2388  }
2389  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0. && passTightCuts==3){
2390  if(invMasspiKp3Pr>0.) fMassHist3PrTC[index]->Fill(invMasspiKp3Pr,0.5);
2391  if(invMasspKpi3Pr>0.) fMassHist3PrTC[index]->Fill(invMasspKpi3Pr,0.5);
2392  }else{
2393  if(invMasspiKp3Pr>0. && passTightCuts==2) fMassHist3PrTC[index]->Fill(invMasspiKp3Pr);
2394  if(invMasspKpi3Pr>0.&& passTightCuts==1) fMassHist3PrTC[index]->Fill(invMasspKpi3Pr);
2395  }
2396  }
2397 
2398  if(IsLc && IsLcfromLb){
2399  index=GetLbHistoIndex(iPtBin);
2400  if(invMasspiKp>0. && invMasspKpi>0.){
2401  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp,0.5);
2402  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi,0.5);
2403  }else{
2404  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp);
2405  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi);
2406  }
2407  if(passTightCuts>0){
2408  if(invMasspiKp>0. && invMasspKpi>0. && passTightCuts==3){
2409  if(invMasspiKp>0.) fMassHistTC[index]->Fill(invMasspiKp,0.5);
2410  if(invMasspKpi>0.) fMassHistTC[index]->Fill(invMasspKpi,0.5);
2411  }else{
2412  if(invMasspiKp>0. && passTightCuts==2) fMassHistTC[index]->Fill(invMasspiKp);
2413  if(invMasspKpi>0.&& passTightCuts==1) fMassHistTC[index]->Fill(invMasspKpi);
2414  }
2415  }
2416  }
2417  if(IsLc && !IsLcfromLb && IsLcfromc) {
2418  index=GetcOnlyHistoIndex(iPtBin);
2419  if(invMasspiKp>0. && invMasspKpi>0.){
2420  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp,0.5);
2421  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi,0.5);
2422  }else{
2423  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp);
2424  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi);
2425  }
2426  if(passTightCuts>0){
2427  if(invMasspiKp>0. && invMasspKpi>0. && passTightCuts==3){
2428  if(invMasspiKp>0.) fMassHistTC[index]->Fill(invMasspiKp,0.5);
2429  if(invMasspKpi>0.) fMassHistTC[index]->Fill(invMasspKpi,0.5);
2430  }else{
2431  if(invMasspiKp>0. && passTightCuts==2) fMassHistTC[index]->Fill(invMasspiKp);
2432  if(invMasspKpi>0.&& passTightCuts==1) fMassHistTC[index]->Fill(invMasspKpi);
2433  }
2434  }
2435 
2436  }
2437 
2438  if(IsLc && !IsLcFromq) {
2439  index=GetNoQuarkHistoIndex(iPtBin);
2440  if(invMasspiKp>0. && invMasspKpi>0.){
2441  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp,0.5);
2442  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi,0.5);
2443  }else{
2444  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp);
2445  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi);
2446  }
2447  if(passTightCuts>0){
2448  if(invMasspiKp>0. && invMasspKpi>0. && passTightCuts==3){
2449  if(invMasspiKp>0.) fMassHistTC[index]->Fill(invMasspiKp,0.5);
2450  if(invMasspKpi>0.) fMassHistTC[index]->Fill(invMasspKpi,0.5);
2451  }else{
2452  if(invMasspiKp>0. && passTightCuts==2) fMassHistTC[index]->Fill(invMasspiKp);
2453  if(invMasspKpi>0.&& passTightCuts==1) fMassHistTC[index]->Fill(invMasspKpi);
2454  }
2455  }
2456 
2457  }
2458 
2459  }else{
2460  index=GetBackgroundHistoIndex(iPtBin);
2461  if(invMasspiKp>0. && invMasspKpi>0.){
2462  fMassHist[index]->Fill(invMasspiKp,0.5);
2463  fMassHist[index]->Fill(invMasspKpi,0.5);
2464  }else{
2465  if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp);
2466  if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi);
2467  }
2468  if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
2469  if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi,0.5);
2470  if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi,0.5);
2471  }else{
2472  if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi);
2473  if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi);
2474  }
2475  if(invMasspiKpKp>0. && invMasspKpiKp>0.){
2476  if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp,0.5);
2477  if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp,0.5);
2478  }else{
2479  if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp);
2480  if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp);
2481  }
2482  if(invMasspiKpDk>0. && invMasspKpiDk>0.){
2483  if(invMasspiKpDk>0.) fMassHistDk[index]->Fill(invMasspiKpDk,0.5);
2484  if(invMasspKpiDk>0.) fMassHistDk[index]->Fill(invMasspKpiDk,0.5);
2485  }else{
2486  if(invMasspiKpDk>0.) fMassHistDk[index]->Fill(invMasspiKpDk);
2487  if(invMasspKpiDk>0.) fMassHistDk[index]->Fill(invMasspKpiDk);
2488  }
2489  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0.){
2490  if(invMasspiKp3Pr>0.) fMassHist3Pr[index]->Fill(invMasspiKp3Pr,0.5);
2491  if(invMasspKpi3Pr>0.) fMassHist3Pr[index]->Fill(invMasspKpi3Pr,0.5);
2492  }else{
2493  if(invMasspiKp3Pr>0.) fMassHist3Pr[index]->Fill(invMasspiKp3Pr);
2494  if(invMasspKpi3Pr>0.) fMassHistDk[index]->Fill(invMasspKpi3Pr);
2495  }
2496  if(invMasspiKp>0. && invMasspKpi>0. && passTightCuts==3){
2497  fMassHistTC[index]->Fill(invMasspiKp,0.5);
2498  fMassHistTC[index]->Fill(invMasspKpi,0.5);
2499  }else{
2500  if(invMasspiKp>0. && passTightCuts==2) fMassHistTC[index]->Fill(invMasspiKp);
2501  if(invMasspKpi>0. && passTightCuts==1) fMassHistTC[index]->Fill(invMasspKpi);
2502  }
2503  if(invMasspiKpLpi>0. && invMasspKpiLpi>0. && passTightCuts==3){
2504  if(invMasspiKpLpi>0.) fMassHistLpiTC[index]->Fill(invMasspiKpLpi,0.5);
2505  if(invMasspKpiLpi>0.) fMassHistLpiTC[index]->Fill(invMasspKpiLpi,0.5);
2506  }else{
2507  if(invMasspiKpLpi>0. && passTightCuts==2) fMassHistLpiTC[index]->Fill(invMasspiKpLpi);
2508  if(invMasspKpiLpi>0.&& passTightCuts==1) fMassHistLpiTC[index]->Fill(invMasspKpiLpi);
2509  }
2510  if(invMasspiKpKp>0. && invMasspKpiKp>0. && passTightCuts==3){
2511  if(invMasspiKpKp>0.) fMassHistKpTC[index]->Fill(invMasspiKpKp,0.5);
2512  if(invMasspKpiKp>0.) fMassHistKpTC[index]->Fill(invMasspKpiKp,0.5);
2513  }else{
2514  if(invMasspiKpKp>0. && passTightCuts==2) fMassHistKpTC[index]->Fill(invMasspiKpKp);
2515  if(invMasspKpiKp>0.&& passTightCuts==1) fMassHistKpTC[index]->Fill(invMasspKpiKp);
2516  }
2517  if(invMasspiKpDk>0. && invMasspKpiDk>0. && passTightCuts==3){
2518  if(invMasspiKpDk>0.) fMassHistDkTC[index]->Fill(invMasspiKpDk,0.5);
2519  if(invMasspKpiDk>0.) fMassHistDkTC[index]->Fill(invMasspKpiDk,0.5);
2520  }else{
2521  if(invMasspiKpDk>0. && passTightCuts==2) fMassHistDkTC[index]->Fill(invMasspiKpDk);
2522  if(invMasspKpiDk>0.&& passTightCuts==1) fMassHistDkTC[index]->Fill(invMasspKpiDk);
2523  }
2524  if(invMasspiKp3Pr>0. && invMasspKpi3Pr>0. && passTightCuts==3){
2525  if(invMasspiKp3Pr>0.) fMassHist3PrTC[index]->Fill(invMasspiKp3Pr,0.5);
2526  if(invMasspKpi3Pr>0.) fMassHist3PrTC[index]->Fill(invMasspKpi3Pr,0.5);
2527  }else{
2528  if(invMasspiKp3Pr>0. && passTightCuts==2) fMassHist3PrTC[index]->Fill(invMasspiKp3Pr);
2529  if(invMasspKpi3Pr>0.&& passTightCuts==1) fMassHist3PrTC[index]->Fill(invMasspKpi3Pr);
2530  }
2531  }
2532 
2533  }
2534  }
2535  }
2536  return;
2537 }
2538 //-----------------------
2540  TClonesArray *arrMC,
2541  AliRDHFCutsLctopKpi *cuts,
2542  /* TList *listout,*/
2543  AliAODEvent* aod) {
2544  //
2545  // function used in UserExec to fill variable histograms analysing MC
2546  //
2547 
2548  TString fillthis="";
2549 
2550  Double_t mPDG=TDatabasePDG::Instance()->GetParticle(4122)->Mass();
2551  Double_t invmasscut=0.05;
2552 
2553  Int_t pdgDgLctopKpi[3]={2212,321,211};
2554  Int_t lab=-9999;
2555  // Bool_t IsLcfromLb=0;
2556  Bool_t IsLcfromc=0;
2557  if(fReadMC){
2558  lab=part->MatchToMC(4122,arrMC,3,pdgDgLctopKpi); //return MC particle label if the array corresponds to a Lc, -1 if not (cf. AliAODRecoDecay.cxx)
2559  if(lab>=0){
2560  AliAODMCParticle *partDp = (AliAODMCParticle*)arrMC->At(lab);
2562  Int_t pdgMom=util->CheckOrigin(arrMC,partDp,kFALSE);
2563  // if(pdgMom == 5) IsLcfromLb =1;
2564  if(pdgMom == 4) IsLcfromc =1;
2565  delete util;
2566  }
2567  }
2568  // Int_t isSelectedPID=cuts->IsSelectedPID(part); // 0 rejected, 1 Lc -> p K- pi+ (K at center because different sign is there),
2569  // 2 Lc -> pi+ K- p (K at center because different sign is there),
2570  // 3 both (it should never happen...)
2571  Int_t isSelectedPID=cuts->IsSelected(part,AliRDHFCuts::kPID,aod); // 0 rejected, 1 Lc -> p K- pi+ (K at center because different sign is there),
2572  // 2 Lc -> pi+ K- p (K at center because different sign is there),
2573  // 3 both (it should never happen...)
2574 
2575  if (isSelectedPID==0)fNentries->Fill(7);
2576  if (isSelectedPID==1)fNentries->Fill(8);
2577  if (isSelectedPID==2)fNentries->Fill(9);
2578  if (isSelectedPID==3)fNentries->Fill(10);
2579 
2580  AliAODTrack *prong0=(AliAODTrack*)part->GetDaughter(0);
2581  AliAODTrack *prong1=(AliAODTrack*)part->GetDaughter(1);
2582  AliAODTrack *prong2=(AliAODTrack*)part->GetDaughter(2);
2583  if (!prong0 || !prong1 || !prong2) {
2584  fNentries->Fill(5);
2585  return;
2586  }
2587 
2588  Double_t minvLcpKpi = part->InvMassLcpKpi();
2589  Double_t minvLcpiKp = part->InvMassLcpiKp();
2590 
2591 
2592  //check pdg of the prongs
2593  Int_t labprong[3]={-1,-1,-1};
2594  if(fReadMC){
2595  labprong[0]=prong0->GetLabel();
2596  labprong[1]=prong1->GetLabel();
2597  labprong[2]=prong2->GetLabel();
2598  }
2599 
2600  AliAODMCParticle *mcprong=0;
2601  Int_t pdgProngMC[3]={-1,-1,-1};
2602  if(fReadMC) {
2603  for (Int_t iprong=0;iprong<3;iprong++){
2604  if(labprong[iprong]<0) continue;
2605  mcprong = (AliAODMCParticle*)arrMC->At(labprong[iprong]);
2606  pdgProngMC[iprong]=TMath::Abs(mcprong->GetPdgCode());
2607  }
2608  }
2609 
2610  Int_t pdgProngPID[3]={-1,-1,-1};
2611  if(isSelectedPID>0){
2612  pdgProngPID[1]=321;
2613  if(isSelectedPID==1) {pdgProngPID[0]=2212;pdgProngPID[2]=211;}
2614  if(isSelectedPID==2) {pdgProngPID[0]=211;pdgProngPID[2]=2212;}
2615  }
2616 
2617  //fill hRealTot ---> PID efficiency denominators
2618  //cuts->SetUsePID(kFALSE); //PAOLA
2619  Int_t selectionTrack = cuts->IsSelected(part,AliRDHFCuts::kTracks,aod);
2620 
2621  //IsInjected check
2622  Bool_t IsInjected = 0;
2623  if(fReadMC){
2624  AliAODMCHeader *mcHeader2 = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
2626  IsInjected = util->IsCandidateInjected(part,mcHeader2,arrMC)?1:0;
2627  delete util;
2628  }
2629  if(fReadMC && selectionTrack>0) { // 3prongs candidate x Lc (only track selection) Jaime
2630  Int_t isReal=0;
2631  if(lab>=0 && IsLcfromc){ // Signal
2632  for (Int_t iprong=0; iprong<3; iprong++) {
2633  switch (pdgProngMC[iprong]) {
2634  case 2212:
2635  fillthis="hpRealTot";
2636  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2637  isReal++;
2638  break;
2639  case 321:
2640  fillthis="hKRealTot";
2641  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2642  isReal++;
2643  break;
2644  case 211:
2645  fillthis="hpiRealTot";
2646  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2647  isReal++;
2648  break;
2649  default:
2650  break;
2651  }
2652  }
2653  fillthis="hLcRealTot";
2654  if(isReal==3) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
2655  //Marcel: Should we zero isReal
2656  } else if(!IsInjected) { // bkg // bkg
2657  for (Int_t iprong=0; iprong<3; iprong++) {
2658  switch (pdgProngMC[iprong]) {
2659  case 2212:
2660  fillthis="hbpRealTot";
2661  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2662  isReal++;
2663  break;
2664  case 321:
2665  fillthis="hbKRealTot";
2666  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2667  isReal++;
2668  break;
2669  case 211:
2670  fillthis="hbpiRealTot";
2671  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2672  isReal++;
2673  break;
2674  default:
2675  break;
2676  }
2677  }
2678  fillthis="hbLcRealTot";
2679  if(isReal==3) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
2680  }
2681  }
2682 
2683 
2684  //cuts->SetUsePID(kTRUE); //PAOLA
2685  Int_t selection=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
2686 
2687  if ( (lab>=0 && fReadMC && IsLcfromc) || // signal X MC
2688  (isSelectedPID>0 && !fReadMC) ) { // signal+bkg X real data
2689 
2690  fillthis="hMass";
2691  if ( (fReadMC && ((AliAODMCParticle*)arrMC->At(lab))->GetPdgCode() == 4122) ||
2692  (!fReadMC && (isSelectedPID>0 && part->Charge()>0)) ) { // Lc
2693  if ( (pdgProngPID[0]==2212) && (pdgProngPID[1]==321) && (pdgProngPID[2]==211) )
2694  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpKpi); // signal+bkg X MC and real data
2695  else if ( (pdgProngPID[0]==211) && (pdgProngPID[1]==321) && (pdgProngPID[2]==2212) )
2696  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpiKp); // signal+bkg X MC and real data
2697  }
2698  else if ( (fReadMC && ((AliAODMCParticle*)arrMC->At(lab))->GetPdgCode() == -4122) ||
2699  (!fReadMC && (isSelectedPID>0 && part->Charge()<0)) ) { // anti-Lc
2700  if ( (pdgProngPID[0]==2212) && (pdgProngPID[1]==321) && (pdgProngPID[2]==211) )
2701  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpKpi); // signal+bkg X MC and real data
2702  else if ( (pdgProngPID[0]==211) && (pdgProngPID[1]==321) && (pdgProngPID[2]==2212) )
2703  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpiKp); // signal+bkg X MC and real data
2704  }
2705 
2706  if (selection>0) { // 3prongs candidate x Lc (yes PID)
2707 
2708  Double_t ptmax=0.;
2709  Int_t isID=0;
2710  Int_t isCorrect=0;
2711  for (Int_t iprong=0; iprong<3; iprong++) {
2712  if (part->PtProng(iprong)>ptmax) ptmax=part->PtProng(iprong);
2713 
2714  AliAODTrack *prong = (AliAODTrack*)part->GetDaughter(iprong);
2715  AliAODPid *pidObjtrk = (AliAODPid*)prong->GetDetPid();
2716  AliAODPidHF *pidObj = (AliAODPidHF*)cuts->GetPidHF();
2717  Bool_t hasTOF=pidObj->CheckStatus(prong,"TOF");
2718  Bool_t hasTPC=pidObj->CheckStatus(prong,"TPC");
2719  Double_t tofSignal=0.;
2720  Double_t dedxTPC=0.;
2721  Double_t momTOF=0.;
2722  Double_t momTPC=0.;
2723  if(hasTOF) {
2724  momTOF = prong->P();
2725  tofSignal=pidObjtrk->GetTOFsignal();
2726  }
2727  if(hasTPC) {
2728  momTPC = pidObjtrk->GetTPCmomentum();
2729  dedxTPC=pidObjtrk->GetTPCsignal();
2730  }
2731  switch (pdgProngPID[iprong]) {
2732  case 2212:
2733  fillthis="hpTOFSignal";
2734  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
2735  fillthis="hpTPCSignal";
2736  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
2737  fillthis="hpptProng";
2738  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2739  fillthis="hpptProngLcPt";
2740  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->PtProng(iprong));
2741  fillthis="hpd0Prong";
2742  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
2743  fillthis="hpd0ProngLcPt";
2744  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->Getd0Prong(iprong));
2745  fillthis="hpSignalVspTPC";
2746  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
2747  fillthis="hpSignalVspTOF";
2748  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
2749  AliPID::EParticleType typep;
2750  typep=AliPID::EParticleType(4);
2751  if(hasTPC) {
2752  //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typep);
2753  Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typep);
2754  fillthis="hpSigmaVspTPC";
2755  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
2756  }
2757  if(hasTOF){
2758  //Double_t nsigma=fUtilPid->NumberOfSigmasTOF(prong,typep);
2759  Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typep);
2760  fillthis="hpSigmaVspTOF";
2761  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
2762  }
2763 
2764  if (fReadMC) { // fill hpIDTot ---> PID contamination denominator
2765  // hIDGood, hnoID ---> PID numerators
2766  fillthis="hpIDTot";
2767  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2768  isID++;
2769  if(pdgProngMC[iprong]==2212) { // id protons
2770  fillthis="hpIDGood";
2771  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2772  isCorrect++;
2773  }
2774  else { // misidentified electrons, muons, pions and kaons
2775  fillthis="hnopIDp";
2776  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2777  }
2778  }
2779  break;
2780 
2781  case 321:
2782  fillthis="hKTOFSignal";
2783  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
2784  fillthis="hKTPCSignal";
2785  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
2786  fillthis="hKptProng";
2787  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2788  fillthis="hKptProngLcPt";
2789  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->PtProng(iprong));
2790  fillthis="hKd0Prong";
2791  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
2792  fillthis="hKd0ProngLcPt";
2793  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->Getd0Prong(iprong));
2794  fillthis="hKSignalVspTPC";
2795  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
2796  fillthis="hKSignalVspTOF";
2797  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
2798  AliPID::EParticleType typek;
2799  typek=AliPID::EParticleType(3);
2800  if(hasTPC) {
2801  //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typek);
2802  Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typek);
2803  fillthis="hKSigmaVspTPC";
2804  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
2805  }
2806  if(hasTOF){
2807  //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typek);
2808  Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typek); // protection against 'old' AODs...
2809  fillthis="hKSigmaVspTOF";
2810  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
2811  }
2812 
2813  if (fReadMC) { // fill hKIDTot ---> PID contamination denominator
2814  // hIDGood, hnoID ---> PID numerators
2815  fillthis="hKIDTot";
2816  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2817  isID++;
2818  if(pdgProngMC[iprong]==321) { // id kaons
2819  fillthis="hKIDGood";
2820  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2821  isCorrect++;
2822  }
2823  else { // misidentified electrons, muons, pions and protons
2824  fillthis="hnokIDk";
2825  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2826  }
2827  }
2828  break;
2829 
2830  case 211:
2831  fillthis="hpiTOFSignal";
2832  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
2833  fillthis="hpiTPCSignal";
2834  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
2835  fillthis="hpiptProng";
2836  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2837  fillthis="hpiptProngLcPt";
2838  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->PtProng(iprong));
2839  fillthis="hpid0Prong";
2840  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
2841  fillthis="hpid0ProngLcPt";
2842  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->Getd0Prong(iprong));
2843 
2844  fillthis="hpiSignalVspTPC";
2845  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
2846  fillthis="hpiSignalVspTOF";
2847  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
2848  AliPID::EParticleType typepi;
2849  typepi=AliPID::EParticleType(2);
2850  if(hasTPC) {
2851  //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typepi);
2852  Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typepi);
2853  fillthis="hpiSigmaVspTPC";
2854  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
2855  }
2856  if(hasTOF){
2857  //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typepi);
2858  Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typepi); // protection against 'old' AODs...
2859  fillthis="hpiSigmaVspTOF";
2860  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
2861  }
2862 
2863  if (fReadMC) { // fill hpiIDTot ---> PID contamination denominator
2864  // hIDGood, hnoID ---> PID numerators
2865  fillthis="hpiIDTot";
2866  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2867  isID++;
2868  if(pdgProngMC[iprong]==211) { // id pions
2869  fillthis="hpiIDGood";
2870  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2871  isCorrect++;
2872  }
2873  else { // misidentified electrons, muons, kaons and protons
2874  fillthis="hnopiIDpi";
2875  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2876  }
2877  }
2878  break;
2879 
2880  default:
2881  break;
2882  }
2883 
2884  }//end loop on prongs
2885 
2886  //Jaime Lc checks
2887  fillthis="hLcIDTot";
2888  if(isID==3) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
2889  fillthis="hLcIDGood";
2890  if(isCorrect==3) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
2891  fillthis="hLcnoID";
2892  if(isCorrect<3) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
2893 
2894  //now histograms where we don't need to check identity
2895  fillthis="hLcpt";
2896  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
2897  fillthis = "hDist12toPrim";
2898  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetDist12toPrim());
2899  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetDist23toPrim());
2900  fillthis = "hDist12toPrimLcPt";
2901  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->GetDist12toPrim());
2902  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->GetDist23toPrim());
2903  fillthis = "hSigmaVert";
2904  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetSigmaVert());
2905  fillthis = "hSigmaVertLcPt";
2906  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->GetSigmaVert());
2907  fillthis = "hDCAs";
2908  Double_t dcas[3];
2909  part->GetDCAs(dcas);
2910  for (Int_t idca=0;idca<3;idca++) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dcas[idca]);
2911  fillthis = "hDCAsLcPt";
2912  for (Int_t idca=0;idca<3;idca++) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),dcas[idca]);
2913  fillthis = "hCosPointingAngle";
2914  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->CosPointingAngle());
2915  fillthis = "hCosPointingAngleLcPt";
2916  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->CosPointingAngle());
2917  fillthis = "hDecayLength";
2918  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->DecayLength());
2919  fillthis = "hDecayLengthLcPt";
2920  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->DecayLength());
2921  Double_t sum2=part->Getd0Prong(0)*part->Getd0Prong(0)+
2922  part->Getd0Prong(1)*part->Getd0Prong(1)+
2923  part->Getd0Prong(2)*part->Getd0Prong(2);
2924  fillthis = "hSum2";
2925  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(sum2);
2926  fillthis = "hSum2LcPt";
2927  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),sum2);
2928  fillthis = "hptmax";
2929  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(ptmax);
2930  fillthis = "hptmaxLcPt";
2931  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),ptmax);
2932 
2933 
2934  } // end if (selection)
2935 
2936  }else if( lab<0 && fReadMC && !IsInjected ) { // bkg x MC
2937 
2938  fillthis="hbMass";
2939 
2940  if (part->Charge()>0) { //Lc background
2941  if ( (pdgProngPID[0]==2212) && (pdgProngPID[1]==321) && (pdgProngPID[2]==211) )
2942  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpKpi); // bkg X MC
2943  else if ( (pdgProngPID[0]==211) && (pdgProngPID[1]==321) && (pdgProngPID[2]==2212) )
2944  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpiKp); // bkg X MC
2945  }
2946  else if (part->Charge()<0){ //anti-Lc background
2947  if ( (pdgProngPID[0]==2212) && (pdgProngPID[1]==321) && (pdgProngPID[2]==211) )
2948  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpKpi); // bkg X MC
2949  else if ( (pdgProngPID[0]==211) && (pdgProngPID[1]==321) && (pdgProngPID[2]==2212) )
2950  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpiKp); // bkg X MC
2951  }
2952 
2953 
2954  //apply cut on invariant mass on the pair
2955  if (TMath::Abs(minvLcpKpi-mPDG)<invmasscut || TMath::Abs(minvLcpiKp-mPDG)<invmasscut) {
2956 
2957  if (selection>0) { // 3prongs candidate x Lc (yes PID)
2958 
2959  Double_t ptmax=0.;
2960  Int_t isID=0;
2961  Int_t isCorrect=0;
2962  for (Int_t iprong=0; iprong<3; iprong++) {
2963  if(part->PtProng(iprong)>ptmax)ptmax=part->PtProng(iprong);
2964 
2965  AliAODTrack *prong = (AliAODTrack*)part->GetDaughter(iprong);
2966  AliAODPid *pidObjtrk = (AliAODPid*)prong->GetDetPid();
2967  AliAODPidHF *pidObj = (AliAODPidHF*)cuts->GetPidHF();
2968  Bool_t hasTOF=pidObj->CheckStatus(prong,"TOF");
2969  Bool_t hasTPC=pidObj->CheckStatus(prong,"TPC");
2970  Double_t tofSignal=0.;
2971  Double_t dedxTPC=0.;
2972  Double_t momTOF=0.;
2973  Double_t momTPC=0.;
2974  if(hasTOF) {
2975  momTOF = prong->P();
2976  tofSignal=pidObjtrk->GetTOFsignal();
2977  }
2978  if(hasTPC) {
2979  momTPC = pidObjtrk->GetTPCmomentum();
2980  dedxTPC=pidObjtrk->GetTPCsignal();
2981  }
2982 
2983  switch (pdgProngPID[iprong]) {
2984  case 2212:
2985  fillthis="hbpTOFSignal";
2986  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
2987  fillthis="hbpTPCSignal";
2988  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
2989  fillthis="hbpptProng";
2990  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2991  fillthis="hbpptProngLcPt";
2992  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->PtProng(iprong));
2993  fillthis="hbpd0Prong";
2994  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
2995  fillthis="hbpd0ProngLcPt";
2996  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->Getd0Prong(iprong));
2997  fillthis="hbpSignalVspTPC";
2998  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
2999  fillthis="hbpSignalVspTOF";
3000  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
3001  AliPID::EParticleType typep;
3002  typep=AliPID::EParticleType(4);
3003  if(hasTPC) {
3004  //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typep);
3005  Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typep);
3006  fillthis="hbpSigmaVspTPC";
3007  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
3008  }
3009  if(hasTOF){
3010  //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typep);
3011  Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typep); // protection against 'old' AODs...
3012  fillthis="hbpSigmaVspTOF";
3013  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
3014  }
3015  if(fReadMC){ // fill hbpIDTot ---> PID contamination denominator
3016  // hbIDGood, hbnoID ---> PID numerators
3017  fillthis="hbpIDTot";
3018  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3019  isID++;
3020  if(pdgProngMC[iprong]==2212) { // id protons
3021  fillthis="hbpIDGood";
3022  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3023  isCorrect++;
3024  }
3025  else { // misidentified electrons, muons, pions and kaons
3026  fillthis="hbnopIDp";
3027  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3028  }
3029  }
3030  break;
3031 
3032  case 321:
3033  fillthis="hbKTOFSignal";
3034  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
3035  fillthis="hbKTPCSignal";
3036  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
3037  fillthis="hbKptProng";
3038  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3039  fillthis="hbKptProngLcPt";
3040  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->PtProng(iprong));
3041  fillthis="hbKd0Prong";
3042  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
3043  fillthis="hbKd0ProngLcPt";
3044  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->Getd0Prong(iprong));
3045  fillthis="hbKSignalVspTPC";
3046  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
3047  fillthis="hbKSignalVspTOF";
3048  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
3049  AliPID::EParticleType typek;
3050  typek=AliPID::EParticleType(3);
3051  if(hasTPC) {
3052  //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typek);
3053  Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typek);
3054  fillthis="hbKSigmaVspTPC";
3055  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
3056  }
3057  if(hasTOF){
3058  //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typek);
3059  Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typek); // protection against 'old' AODs...
3060  fillthis="hbKSigmaVspTOF";
3061  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
3062  }
3063  if (fReadMC) { // fill hbKIDTot ---> PID contamination denominator
3064  // hIDGood, hnoID ---> PID numerators
3065  fillthis="hbKIDTot";
3066  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3067  isID++;
3068  if(pdgProngMC[iprong]==321) { // id kaons
3069  fillthis="hbKIDGood";
3070  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3071  isCorrect++;
3072  }
3073  else { // misidentified electrons, muons, pions and protons
3074  fillthis="hbnokIDk";
3075  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3076  }
3077  }
3078  break;
3079 
3080  case 211:
3081  fillthis="hbpiTOFSignal";
3082  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
3083  fillthis="hbpiTPCSignal";
3084  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
3085  fillthis="hbpiptProng";
3086  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3087  fillthis="hbpiptProngLcPt";
3088  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3089  fillthis="hbpid0Prong";
3090  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
3091  fillthis="hbpid0ProngLcPt";
3092  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->Getd0Prong(iprong));
3093  fillthis="hbpiSignalVspTPC";
3094  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
3095  fillthis="hbpiSignalVspTOF";
3096  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
3097  AliPID::EParticleType typepi;
3098  typepi=AliPID::EParticleType(2);
3099  if(hasTPC) {
3100  //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typepi);
3101  Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typepi);
3102  fillthis="hbpiSigmaVspTPC";
3103  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
3104  }
3105  if(hasTOF){
3106  //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typepi);
3107  Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typepi); // protection against 'old' AODs...
3108  fillthis="hbpiSigmaVspTOF";
3109  ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
3110  }
3111  if (fReadMC) { // fill hbpiIDTot ---> PID contamination denominator
3112  // hIDGood, hnonIDTot ---> PID numerators
3113  fillthis="hbpiIDTot";
3114  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3115  isID++;
3116  if(pdgProngMC[iprong]==211) { // id pions
3117  fillthis="hbpiIDGood";
3118  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3119  isCorrect++;
3120  }
3121  else { // misidentified electrons, muons, kaons and protons
3122  fillthis="hbnopiIDpi";
3123  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
3124  }
3125  }
3126  break;
3127 
3128  default:
3129  break;
3130  }
3131 
3132  } //end loop on prongs
3133 
3134  fillthis="hbLcIDTot";
3135  if(isID==3) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
3136  fillthis="hbLcIDGood";
3137  if(isCorrect==3) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
3138  fillthis="hbLcnoID";
3139  if(isCorrect<3) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
3140 
3141  //now histograms where we don't need to check identity
3142  fillthis="hbLcpt";
3143  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
3144 
3145  fillthis = "hbDist12toPrim";
3146  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetDist12toPrim());
3147  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetDist23toPrim());
3148  fillthis = "hbDist12toPrimLcPt";
3149  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->GetDist12toPrim());
3150  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->GetDist23toPrim());
3151  fillthis = "hbSigmaVert";
3152  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetSigmaVert());
3153  fillthis = "hbSigmaVertLcPt";
3154  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->GetSigmaVert());
3155  fillthis = "hbDCAs";
3156  Double_t dcas[3];
3157  part->GetDCAs(dcas);
3158  for (Int_t idca=0;idca<3;idca++) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dcas[idca]);
3159  fillthis = "hbDCAsLcPt";
3160  for (Int_t idca=0;idca<3;idca++) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),dcas[idca]);
3161  fillthis = "hbCosPointingAngle";
3162  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->CosPointingAngle());
3163  fillthis = "hbCosPointingAngleLcPt";
3164  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->CosPointingAngle());
3165  fillthis = "hbDecayLength";
3166  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->DecayLength());
3167  fillthis = "hbDecayLengthLcPt";
3168  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),part->DecayLength());
3169  Double_t sum2=part->Getd0Prong(0)*part->Getd0Prong(0)+
3170  part->Getd0Prong(1)*part->Getd0Prong(1)+
3171  part->Getd0Prong(2)*part->Getd0Prong(2);
3172  fillthis = "hbSum2";
3173  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(sum2);
3174  fillthis = "hbSum2LcPt";
3175  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),sum2);
3176  fillthis = "hbptmax";
3177  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(ptmax);
3178  fillthis = "hbptmaxLcPt";
3179  ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt(),ptmax);
3180 
3181  } // end if (selection)
3182 
3183  } // end mass cut
3184 
3185  } // end background case
3186 
3187  return;
3188 
3189 }
3190 
3191 //-------------------------
3193  AliRDHFCutsLctopKpi *cuts,
3194  AliAODEvent* aod,
3195  TClonesArray *arrMC)
3196 {
3197 
3198  // FillAPrioriConcentrations
3199  //cuts->SetUsePID(kFALSE); //Annalisa
3200  Int_t isSelected3ProngByLc=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
3201 
3202  TString fillthis="";
3203 
3204  if(isSelected3ProngByLc>0 && fReadMC) {
3205 
3206  for (Int_t ii=0; ii<3; ii++) {
3207  AliAODTrack *prongTest=(AliAODTrack*)part->GetDaughter(ii);
3208  if (!prongTest) continue;
3209  Int_t labprongTest = prongTest->GetLabel();
3210  if(labprongTest<0) continue;
3211  AliAODMCParticle *mcprongTest = (AliAODMCParticle*)arrMC->At(labprongTest);
3212 
3213  switch (TMath::Abs(mcprongTest->GetPdgCode())) {
3214  case 11:
3215  fillthis="hElIn3Prong";
3216  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3217  break;
3218  case 13:
3219  fillthis="hMuIn3Prong";
3220  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3221  break;
3222  case 211:
3223  fillthis="hPiIn3Prong";
3224  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3225  break;
3226  case 321:
3227  fillthis="hKaIn3Prong";
3228  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3229  break;
3230  case 2212:
3231  fillthis="hPrIn3Prong";
3232  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3233  break;
3234  default:
3235  break;
3236  }
3237  }
3238  }
3239 
3240  //cuts->SetUsePID(kTRUE); //Annalisa
3241 
3242 }
3243 
3244 //-----------------------
3246  TClonesArray *arrayMC,
3247  Int_t pdgToBeCompared)
3248 {
3249  //
3250  // Returs kTRUE if at least one of tracks in the current 3prong
3251  // cames from particle with pdgCode=pdgToBeCompared
3252  //
3253 
3254  Bool_t localFlag = kFALSE;
3255 
3256  for (Int_t ii=0;ii<3;ii++) {
3257  AliAODTrack *daugh = (AliAODTrack*)d->GetDaughter(ii);
3258 
3259  Int_t lab = daugh->GetLabel();
3260  if(lab<0) continue;
3261  AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab);
3262  //Int_t partPdg = part->GetPdgCode();
3263  //printf(" -------------------------------------- partLab=%d partPdg=%d ---\n", lab, partPdg);
3264 
3265  Int_t motherLabel = part->GetMother();
3266  if(motherLabel<0) continue;
3267 
3268  AliAODMCParticle *motherPart = 0;
3269  Int_t motherPdg = 0;
3270  while (!localFlag && motherLabel>=0) {
3271  motherPart = (AliAODMCParticle*)arrayMC->At(motherLabel);
3272  motherPdg = motherPart->GetPdgCode();
3273  //printf(" ------------- motherLab=%d motherPdg=%d ---\n", motherLabel, motherPdg);
3274  if (TMath::Abs(motherPdg)==pdgToBeCompared) {
3275  //printf("-------------------------- trovato quark c/cbar\n");
3276  localFlag = kTRUE;
3277  }
3278  else {
3279  motherLabel = motherPart->GetMother();
3280  }
3281  }
3282 
3283  }
3284 
3285  return localFlag;
3286 
3287 }
3288 
3289 //-----------------------
3291  TClonesArray *arrayMC,
3292  Int_t pdgToBeCompared)
3293 {
3294  //
3295  // Returs kTRUE if at the tracks comes
3296  // from particle with pdgCode=pdgToBeCompared
3297  //
3298 
3299  Bool_t localFlag = kFALSE;
3300 
3301  Int_t lab = daugh->GetLabel();
3302  if(lab<0) return localFlag;
3303  AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab);
3304  //Int_t partPdg = part->GetPdgCode();
3305  //printf(" -------------------------------------- partLab=%d partPdg=%d ---\n", lab, partPdg);
3306 
3307  Int_t motherLabel = part->GetMother();
3308  if(motherLabel<0) return localFlag;
3309 
3310  AliAODMCParticle *motherPart = 0;
3311  Int_t motherPdg = 0;
3312  while (!localFlag && motherLabel>=0) {
3313  motherPart = (AliAODMCParticle*)arrayMC->At(motherLabel);
3314  motherPdg = motherPart->GetPdgCode();
3315  //printf(" ------------- motherLab=%d motherPdg=%d ---\n", motherLabel, motherPdg);
3316  if (TMath::Abs(motherPdg)==pdgToBeCompared) {
3317  //printf("-------------------------- trovato quark c/cbar\n");
3318  localFlag = kTRUE;
3319  }
3320  else {
3321  motherLabel = motherPart->GetMother();
3322  }
3323  }
3324 
3325  return localFlag;
3326 
3327 }
3328 
3329 
3330 
3331 
3332 //-----------------------
3334 {
3335  //
3336  // Returs kTRUE if there is a lepton related to the LambdaC
3337  //
3338 
3339  Bool_t localFlag = kFALSE;
3340 
3341  AliAODMCParticle *searchLc;
3342 
3343  for (Int_t iii=0; iii<arrayMC->GetEntries(); iii++) {
3344  searchLc = (AliAODMCParticle*)arrayMC->At(iii);
3345  Int_t searchLcpdg = searchLc->GetPdgCode();
3346  if (TMath::Abs(searchLcpdg) == 4122){
3347  localFlag = kTRUE;
3348  break;
3349  }
3350  }
3351 
3352 
3353  return localFlag;
3354 
3355 }
3356 //_________________________________
3358 {
3360  Int_t counter=0;
3361 
3362 
3363  TClonesArray *aodtracks=(TClonesArray *)aods->GetTracks();
3364 
3365  // for(Int_t ji=0;ji<aods->GetNumberOfTracks();ji++)
3366  for(Int_t ji=0;ji<aodtracks->GetEntriesFast();ji++)
3367  {
3368  AliAODTrack*aodTrack=(AliAODTrack*)aodtracks->UncheckedAt(ji);
3369  if(aodTrack->IsPrimaryCandidate()) counter++;
3370  }
3371  return counter;
3372 
3373 }
3374 //_________________________________
3375 
3377  AliRDHFCutsLctopKpi *cuts,
3378  AliAODEvent* aod,
3379  TClonesArray *arrMC,
3380  Bool_t &flag1,Bool_t &flag2,Bool_t &flag3,
3381  Bool_t &flag4, Bool_t &flag5, Bool_t &flag6)
3382 {
3383 
3384 
3385 // Multiplicity studies
3386 
3387  TString fillthis="";
3388 
3389  Int_t pdgDgLctopKpi[3]={2212,321,211};
3390  Int_t lab=-9999;
3391  if(fReadMC)
3392  lab=part->MatchToMC(4122,arrMC,3,pdgDgLctopKpi); //return MC particle label if the array corresponds to a Lc, -1 if not (cf. AliAODRecoDecay.cxx)
3393 
3394  //cuts->SetUsePID(kFALSE); //Annalisa
3395  Int_t isSelected3ProngByLc=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
3396 
3397  if(isSelected3ProngByLc>0 && fReadMC) {
3398  flag1 = kTRUE;
3399  if (lab>=0) {
3400  flag3 = kTRUE;
3401  }
3402 
3403  Bool_t is3ProngFromJPsi = Is3ProngFromPDG(part,arrMC,443);
3404  if (is3ProngFromJPsi) flag6=is3ProngFromJPsi;
3405 
3406  Bool_t is3ProngFromC = Is3ProngFromPDG(part,arrMC,4);
3407  if (is3ProngFromC) flag4=is3ProngFromC;
3408 
3409  Bool_t is3ProngFromB = Is3ProngFromPDG(part,arrMC,5);
3410  if (is3ProngFromB) flag5=is3ProngFromB;
3411 
3412  for (Int_t ii=0; ii<3; ii++) {
3413  AliAODTrack *prongTest=(AliAODTrack*)part->GetDaughter(ii);
3414  if (!prongTest) continue;
3415  Int_t labprongTest = prongTest->GetLabel();
3416  if(labprongTest<0) continue;
3417  AliAODMCParticle *mcprongTest = (AliAODMCParticle*)arrMC->At(labprongTest);
3418 
3419  switch (TMath::Abs(mcprongTest->GetPdgCode())) {
3420  case 11:
3421  fillthis="hElIn3Prong";
3422  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3423  if (IsTrackFromPDG(prongTest,arrMC,443)) {
3424  fillthis="hElIn3Prong6";
3425  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3426  }
3427  break;
3428  case 13:
3429  fillthis="hMuIn3Prong";
3430  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3431  if (IsTrackFromPDG(prongTest,arrMC,443)) {
3432  fillthis="hMuIn3Prong6";
3433  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3434  }
3435  break;
3436  case 211:
3437  fillthis="hPiIn3Prong";
3438  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3439  if (IsTrackFromPDG(prongTest,arrMC,443)) {
3440  fillthis="hPiIn3Prong6";
3441  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3442  }
3443  break;
3444  case 321:
3445  fillthis="hKaIn3Prong";
3446  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3447  if (IsTrackFromPDG(prongTest,arrMC,443)) {
3448  fillthis="hKaIn3Prong6";
3449  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3450  }
3451  break;
3452  case 2212:
3453  fillthis="hPrIn3Prong";
3454  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3455  if (IsTrackFromPDG(prongTest,arrMC,443)) {
3456  fillthis="hPrIn3Prong6";
3457  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3458  }
3459  break;
3460  default:
3461  break;
3462  }
3463 
3464  if (lab>=0) {
3465  switch (TMath::Abs(mcprongTest->GetPdgCode())) {
3466  case 11:
3467  fillthis="hElIn3Prong1";
3468  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3469  break;
3470  case 13:
3471  fillthis="hMuIn3Prong1";
3472  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3473  break;
3474  case 211:
3475  fillthis="hPiIn3Prong1";
3476  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3477  break;
3478  case 321:
3479  fillthis="hKaIn3Prong1";
3480  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3481  break;
3482  case 2212:
3483  fillthis="hPrIn3Prong1";
3484  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3485  break;
3486  default:
3487  break;
3488  }
3489  } else {
3490  switch (TMath::Abs(mcprongTest->GetPdgCode())) {
3491  case 11:
3492  fillthis="hElIn3Prong2";
3493  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3494  if (IsTrackFromPDG(prongTest,arrMC,4)) {
3495  fillthis="hElIn3Prong3";
3496  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3497  }
3498  if (IsTrackFromPDG(prongTest,arrMC,5)) {
3499  fillthis="hElIn3Prong4";
3500  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3501  }
3502  if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
3503  fillthis="hElIn3Prong5";
3504  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3505  }
3506  break;
3507  case 13:
3508  fillthis="hMuIn3Prong2";
3509  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3510  if (IsTrackFromPDG(prongTest,arrMC,4)) {
3511  fillthis="hMuIn3Prong3";
3512  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3513  }
3514  if (IsTrackFromPDG(prongTest,arrMC,5)) {
3515  fillthis="hMuIn3Prong4";
3516  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3517  }
3518  if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
3519  fillthis="hMuIn3Prong5";
3520  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3521  }
3522  break;
3523  case 211:
3524  fillthis="hPiIn3Prong2";
3525  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3526  if (IsTrackFromPDG(prongTest,arrMC,4)) {
3527  fillthis="hPiIn3Prong3";
3528  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3529  }
3530  if (IsTrackFromPDG(prongTest,arrMC,5)) {
3531  fillthis="hPiIn3Prong4";
3532  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3533  }
3534  if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
3535  fillthis="hPiIn3Prong5";
3536  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3537  }
3538  break;
3539  case 321:
3540  fillthis="hKaIn3Prong2";
3541  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3542  if (IsTrackFromPDG(prongTest,arrMC,4)) {
3543  fillthis="hKaIn3Prong3";
3544  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3545  }
3546  if (IsTrackFromPDG(prongTest,arrMC,5)) {
3547  fillthis="hKaIn3Prong4";
3548  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3549  }
3550  if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
3551  fillthis="hKaIn3Prong5";
3552  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3553  }
3554  break;
3555  case 2212:
3556  fillthis="hPrIn3Prong2";
3557  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3558  if (IsTrackFromPDG(prongTest,arrMC,4)) {
3559  fillthis="hPrIn3Prong3";
3560  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3561  }
3562  if (IsTrackFromPDG(prongTest,arrMC,5)) {
3563  fillthis="hPrIn3Prong4";
3564  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3565  }
3566  if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
3567  fillthis="hPrIn3Prong5";
3568  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3569  }
3570  break;
3571  default:
3572  break;
3573  }
3574  }
3575  /*
3576  if (is3ProngFromC) {
3577  switch (TMath::Abs(mcprongTest->GetPdgCode())) {
3578  case 11:
3579  fillthis="hElIn3Prong3";
3580  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3581  break;
3582  case 13:
3583  fillthis="hMuIn3Prong3";
3584  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3585  break;
3586  case 211:
3587  fillthis="hPiIn3Prong3";
3588  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3589  break;
3590  case 321:
3591  fillthis="hKaIn3Prong3";
3592  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3593  break;
3594  case 2212:
3595  fillthis="hPrIn3Prong3";
3596  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3597  break;
3598  default:
3599  break;
3600  }
3601  } else { // !is3ProngFromC
3602  if (is3ProngFromB) {
3603  switch (TMath::Abs(mcprongTest->GetPdgCode())) {
3604  case 11:
3605  fillthis="hElIn3Prong4";
3606  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3607  break;
3608  case 13:
3609  fillthis="hMuIn3Prong4";
3610  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3611  break;
3612  case 211:
3613  fillthis="hPiIn3Prong4";
3614  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3615  break;
3616  case 321:
3617  fillthis="hKaIn3Prong4";
3618  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3619  break;
3620  case 2212:
3621  fillthis="hPrIn3Prong4";
3622  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3623  break;
3624  default:
3625  break;
3626  }
3627  } else {//!is3ProngFromB
3628  switch (TMath::Abs(mcprongTest->GetPdgCode())) {
3629  case 11:
3630  fillthis="hElIn3Prong5";
3631  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3632  break;
3633  case 13:
3634  fillthis="hMuIn3Prong5";
3635  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3636  break;
3637  case 211:
3638  fillthis="hPiIn3Prong5";
3639  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3640  break;
3641  case 321:
3642  fillthis="hKaIn3Prong5";
3643  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3644  break;
3645  case 2212:
3646  fillthis="hPrIn3Prong5";
3647  ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
3648  break;
3649  default:
3650  break;
3651  }
3652  }
3653  }
3654  */
3655  }
3656  }
3657 
3658  Double_t mPDG=TDatabasePDG::Instance()->GetParticle(4122)->Mass();
3659  Double_t invmasscut=0.05;
3660 
3661  Double_t minvLcpKpi = part->InvMassLcpKpi();
3662  Double_t minvLcpiKp = part->InvMassLcpiKp();
3663 
3664  //cuts->SetUsePID(kTRUE); //Annalisa
3665  Int_t isSelected3ProngByLcPID=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
3666  if (isSelected3ProngByLcPID>0) {
3667  if (TMath::Abs(minvLcpKpi-mPDG)<invmasscut || TMath::Abs(minvLcpiKp-mPDG)<invmasscut) {
3668  flag2 = kTRUE;
3669  }
3670  }
3671 
3672 
3673 }
TH2F * fhPiond0ProngLcPt
!hist for var_LcPt
TH1F * fMassHistTC[6 *kMaxPtBins]
!hist. for inv mass (TC)
TH1F * fhMassPtGreater33Pr
!hist. for No. of events
TH1F * fMassHistDk[3 *kMaxPtBins]
!hist. for inv mass (LC)
TH1F * fMassHist3Pr[3 *kMaxPtBins]
!hist. for inv mass (LC)
TH1F * fhMassPtGreater2TC
!hist. for No. of events
TH1F * fhMassPtGreater3DkTC
!hist. for No. of events
AliAnalysisVertexingHF * fVHF
apply analysis cuts
double Double_t
Definition: External.C:58
TH2F * fhEta3ProngAn
!hist. for 3-prong Eta fiducial An Cuts
Double_t GetPtBinLimit(Int_t ibin) const
void StoreCandidates(AliVEvent *, Int_t nCand=0, Bool_t flagFilter=kTRUE)
Definition: External.C:236
TH2F * fhPtMaxLcPt
!hist for var_LcPt
TH2F * fhCosPointingAngleLcPt
!hist for var_LcPt
TH2F * fhdcasLcPt
!hist for var_LcPt
TH1F * fMassHistDkTC[3 *kMaxPtBins]
!hist. for inv mass (TC)
Bool_t HasSelectionBit(Int_t i) const
Double_t fArrayBinLimits[kMaxPtBins+1]
list of cuts
TH1F * fhMassPtGreater2KpTC
!hist. for No. of events
TH2F * fhBdcasLcPt
!hist for var_LcPt
TH2F * fhRap3ProngAn
!hist. for 3-prong Eta fiducial An cuts
Double_t mass
TH1F * fMassHist[6 *kMaxPtBins]
!hist. for inv mass (LC)
Bool_t Is3ProngFromPDG(AliAODRecoDecayHF3Prong *part, TClonesArray *arrMC, Int_t pdgToBeCompared=4)
TH2F * fhDecayLengthLcPt
!hist for var_LcPt
TH1F * fhMassPtGreater3Kp
!hist. for No. of events
Double_t ptlims[nPtBins+1]
AliPIDResponse * fPIDResponse
output3
Bool_t IsThereAGeneratedLc(TClonesArray *arrayMC)
TH2F * fhBSigmaVertLcPt
!hist for var_LcPt
TH1F * fMassHistKpTC[3 *kMaxPtBins]
!hist. for inv mass (TC)
TH1F * fhMassPtGreater23PrTC
!hist. for No. of events
TH1F * fMassHistKp[3 *kMaxPtBins]
!hist. for inv mass (LC)
Int_t GetSignalHistoIndex(Int_t iPtBin) const
Int_t GetWhyRejection() const
Definition: AliRDHFCuts.h:315
TH2F * fhBCosPointingAngleLcPt
!hist for var_LcPt
Bool_t FillRecoCand(AliVEvent *event, AliAODRecoDecayHF3Prong *rd3)
TH2F * fhSum2LcPt
!hist for var_LcPt
TH2F * fhBDecayLengthLcPt
!hist for var_LcPt
Int_t fNPtBins
cuts with KF vertexer
ULong_t GetSelectionMap() const
Bool_t fFillVarHists
Vertexer heavy flavour (used to pass the cuts)
TH1F * fMassHistLpi[3 *kMaxPtBins]
!hist. for inv mass (LC)
static Int_t CheckOrigin(TClonesArray *arrayMC, AliAODMCParticle *mcPart, Bool_t searchUpToQuark=kTRUE)
Functions to check the decay tree.
TH1F * fhMassPtGreater2LpiTC
!hist. for No. of events
void MultiplicityStudies(AliAODRecoDecayHF3Prong *part, AliRDHFCutsLctopKpi *cuts, AliAODEvent *aod, TClonesArray *arrMC, Bool_t &flag1, Bool_t &flag2, Bool_t &flag3, Bool_t &flag4, Bool_t &flag5, Bool_t &flag6)
TNtuple * fNtupleLambdac
! output ntuple
TH2F * fhBProtond0ProngLcPt
!hist for var_LcPt
AliAODPidHF * GetPidHF() const
Definition: AliRDHFCuts.h:247
TH1F * fhMassPtGreater33PrTC
!hist. for No. of events
Bool_t VertexingKF(AliAODRecoDecayHF3Prong *d, Int_t *pdgs, Double_t field) const
TH2F * fhEta3Prong
!hist. for 3-prong Eta
TList * fListCuts
Production Cuts.
TH1F * fhMassPtGreater3TC
!hist. for No. of events
TH2F * fhBSum2LcPt
!hist for var_LcPt
virtual void Terminate(Option_t *option)
TH1F * fhMassPtGreater2Lpi
!hist. for No. of events
int Int_t
Definition: External.C:63
Definition: External.C:204
TH2F * fhRap3Prong
!hist. for 3-prong y
TH1F * fNentries
flag for Lc filter bit PID
void FillAPrioriConcentrations(AliAODRecoDecayHF3Prong *part, AliRDHFCutsLctopKpi *cuts, AliAODEvent *aod, TClonesArray *arrMC)
float Float_t
Definition: External.C:68
TH1F * fhMassPtGreater2DkTC
!hist. for No. of events
const Double_t ptmax
Bool_t fAnalysis
flag to cut with KF vertexer
TH1F * fhMassPtGreater3Dk
!hist. for No. of events
virtual Bool_t IsInFiducialAcceptance(Double_t pt, Double_t y) const
TH2F * fhBKaonPtProngLcPt
!hist for var_LcPt
TH2F * fhMassLcPt
!hist Mass x pt
Bool_t fPriorsHists
flag for activation of multiplcity histos
Int_t MatchToMCLambdac(AliAODRecoDecayHF3Prong *d, TClonesArray *arrayMC) const
Bool_t CheckStatus(AliAODTrack *track, TString detectors) const
AliAODVertex * GetOwnPrimaryVtx() const
TH2F * fhBDist12PrimLcPt
!hist for var_LcPt
TH2F * fhBProtonPtProngLcPt
!hist for var_LcPt
Double_t GetSigmaVert(const AliAODEvent *aod=0x0)
virtual void UserExec(Option_t *option)
AliAODPidHF * GetPidprot() const
TH2F * fhKaonPtProngLcPt
!hist for var_LcPt
TH2F * fhEta3ProngAcc
!hist. for 3-prong Eta fiducial acc
Double_t nsigma
TH2F * fhProtonPtProngLcPt
!hist for var_LcPt
Int_t GetHistoIndex(Int_t iPtBin) const
TH1F * fhMassPtGreater23Pr
!hist. for No. of events
Bool_t IsCandidateInjected(AliAODRecoDecayHF *cand, AliAODMCHeader *header, TClonesArray *arrayMC)
void GetDCAs(Double_t dca[3]) const
AliAODPidHF * GetPidpion() const
TH1F * fhMassPtGreater3KpTC
!hist. for No. of events
Bool_t fMultiplicityHists
flag for creation and fill of histograms with vars
Bool_t fRealPid
flag for access to MC
Bool_t fReadMC
flag for filling ntuple
Bool_t fMCPid
flag for access to MC
Int_t GetNoQuarkHistoIndex(Int_t iPtBin) const
void SetOwnPrimaryVtx(const AliAODVertex *vtx)
TList * fOutputMC
histo with number of entries
TH2F * fhEta3ProngProd
!hist. for 3-prong Eta fiducial Prod Cuts
TH1F * fMassHist3PrTC[3 *kMaxPtBins]
!hist. for inv mass (TC)
Float_t fLowmasslimit
upper inv mass limit for histos
void FillMassHists(AliAODEvent *aod, AliAODRecoDecayHF3Prong *part, TClonesArray *arrayMC, AliRDHFCutsLctopKpi *cuts, Int_t *nSelectedloose, Int_t *nSelectedtight)
void FillVarHists(AliAODRecoDecayHF3Prong *part, TClonesArray *arrMC, AliRDHFCutsLctopKpi *cuts, AliAODEvent *aod)
Bool_t GetLambdacDaugh(AliAODMCParticle *part, TClonesArray *arrayMC) const
Bool_t IsEventSelected(AliVEvent *event)
Int_t NumberPrimaries(const AliAODEvent *aods)
TH2F * fhBPtMaxLcPt
!hist for var_LcPt
virtual Int_t IsSelected(TObject *obj, Int_t selectionLevel)
void StoreEvent(AliVEvent *, AliRDHFCuts *, Bool_t mc=kFALSE, Int_t multiplicity=-9999, Double_t spherocity=-99.)
TH1F * fhMassPtGreater3Lpi
!hist. for No. of events
Bool_t fLcCut
flag for histos with priors
TH2F * fhProtond0ProngLcPt
!hist for var_LcPt
virtual void UserCreateOutputObjects()
Implementation of interface methods.
void SetPtBinLimit(Int_t n, Float_t *limitarray)
Bool_t fUseKF
flag for PID with resonant channels
TH1F * fMassHistLpiTC[3 *kMaxPtBins]
!hist. for inv mass (TC)
Float_t * GetPtBinLimits() const
Definition: AliRDHFCuts.h:248
void SetOldPid(Bool_t oldPid)
Definition: AliAODPidHF.h:108
TH2F * fhKaond0ProngLcPt
!hist for var_LcPt
AliNormalizationCounter * fCounter
!AliNormalizationCounter on output slot 7
TH1F * fhMassPtGreater3
!hist. for No. of events
TH1F * fHistNEvents
!hist. for No. of events
Int_t GetcOnlyHistoIndex(Int_t iPtBin) const
TH1F * fhMassPtGreater3LpiTC
!hist. for No. of events
TH2F * fhPionPtProngLcPt
!hist for var_LcPt
TH2F * fhBPionPtProngLcPt
!hist for var_LcPt
TH2F * fhRap3ProngProd
!hist. for 3-prong Eta fiducial Prod cuts
TH2F * fhMassLcminusPt
!hist Mass x pt Lcminu
TH1F * fhMassPtGreater2Dk
!hist. for No. of events
TH2F * fhMassLcplusPt
!hist Mass x pt Lcplus
TH2F * fhSigmaVertLcPt
!hist for var_LcPt
Bool_t GetIsUsePID() const
Definition: AliRDHFCuts.h:270
const char Option_t
Definition: External.C:48
Int_t GetNPtBins() const
Definition: AliRDHFCuts.h:249
TList * fOutput
! list send on output slot 0
Bool_t IspiKpMC(AliAODRecoDecayHF3Prong *d, TClonesArray *arrayMC) const
Bool_t fFillNtuple
limits for the Pt bins
AliKFParticle * ApplyVertexingKF(Int_t *iprongs, Int_t nprongs, Int_t *pdgs, Bool_t topoCostraint, Double_t bzkG, Double_t *mass) const
vertexing KF:
Bool_t IsTrackFromPDG(const AliAODTrack *daugh, TClonesArray *arrayMC, Int_t pdgToBeCompared)
bool Bool_t
Definition: External.C:53
TH1F * fhMassPtGreater2
!hist. for No. of events
Double_t CosPointingAngle() const
Bool_t fResPid
flag for real PID
void IspKpiResonant(AliAODRecoDecayHF3Prong *d, Double_t field, Int_t *resNumber) const
TH2F * fhRap3ProngAcc
!hist. for 3-prong Eta fiducial acc
AliRDHFCutsLctopKpi * fRDCutsAnalysis
number of bins in Pt for histograms
Bool_t IspKpiMC(AliAODRecoDecayHF3Prong *d, TClonesArray *arrayMC) const
Int_t PtBin(Double_t pt) const
TH2F * fhBKaond0ProngLcPt
!hist for var_LcPt
Float_t fCutsKF[2]
lower inv mass limit for histos
Double_t DecayLength() const
Bool_t fLcPIDCut
flag for Lc filter bit cut
void IspiKpResonant(AliAODRecoDecayHF3Prong *d, Double_t field, Int_t *resNumber) const
TH1F * fhMassPtGreater2Kp
!hist. for No. of events
Int_t GetLbHistoIndex(Int_t iPtBin) const
TH2F * fhBPiond0ProngLcPt
!hist for var_LcPt
AliRDHFCutsLctopKpi * fRDCutsProduction
Cuts for Analysis.
Int_t GetBackgroundHistoIndex(Int_t iPtBin) const
TH1F * fhChi2
!hist. for No. of events
void SetPidResponse(AliPIDResponse *pidResp)
Definition: AliAODPidHF.h:111
TH1F * fhSelectBit
! hist for Filter Bit
TH2F * fhDist12PrimLcPt
!hist for var_LcPt
Class with functions useful for different D2H analyses //.