]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliAnalysisTaskSELambdac.cxx
Fix in Dplus filtering parameters
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAnalysisTaskSELambdac.cxx
CommitLineData
7eb0cc73 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
27de2dfb 16/* $Id$ */
17
7eb0cc73 18/////////////////////////////////////////////////////////////
19//
4c7fd068 20// AliAnalysisTaskSE for the extraction of signal(e.g Lambdac) of heavy flavor
7eb0cc73 21// decay candidates with the MC truth.
4c7fd068 22// Authors: r.romita@gsi.de
7eb0cc73 23/////////////////////////////////////////////////////////////
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
029ed93a 34#include <AliAnalysisDataSlot.h>
35#include <AliAnalysisDataContainer.h>
7eb0cc73 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"
43#include "AliAODRecoDecayHF3Prong.h"
44#include "AliAnalysisVertexingHF.h"
45#include "AliAnalysisTaskSE.h"
46#include "AliAnalysisTaskSELambdac.h"
47#include "AliKFParticle.h"
48#include "AliAODPidHF.h"
49#include "AliRDHFCutsLctopKpi.h"
50#include "AliRDHFCuts.h"
7ad4b782 51#include "AliKFVertex.h"
52#include "AliESDVertex.h"
60eac73d 53//#include "AliAODpidUtil.h"
029ed93a 54#include "AliAODPid.h"
55#include "AliInputEventHandler.h"
60eac73d 56#include "AliPID.h"
7eb0cc73 57
58ClassImp(AliAnalysisTaskSELambdac)
59
60
61//________________________________________________________________________
60eac73d 62 AliAnalysisTaskSELambdac::AliAnalysisTaskSELambdac():
63 AliAnalysisTaskSE(),
64 fOutput(0),
65 fHistNEvents(0),
66 fhChi2(0),
67 fhMassPtGreater3(0),
68 fhMassPtGreater3TC(0),
69 fhMassPtGreater3Kp(0),
70 fhMassPtGreater3KpTC(0),
71 fhMassPtGreater3Lpi(0),
72 fhMassPtGreater3LpiTC(0),
73 fhMassPtGreater2(0),
74 fhMassPtGreater2TC(0),
75 fhMassPtGreater2Kp(0),
76 fhMassPtGreater2KpTC(0),
77 fhMassPtGreater2Lpi(0),
78 fhMassPtGreater2LpiTC(0),
79 fNtupleLambdac(0),
80 fUpmasslimit(2.486),
81 fLowmasslimit(2.086),
82 fNPtBins(0),
83 fRDCutsAnalysis(0),
84 fRDCutsProduction(0),
85 fListCuts(0),
86 fFillNtuple(kFALSE),
87 fReadMC(kFALSE),
88 fMCPid(kFALSE),
89 fRealPid(kFALSE),
90 fResPid(kTRUE),
91 fUseKF(kFALSE),
92 fAnalysis(kFALSE),
93 fVHF(0),
94 fFillVarHists(kFALSE),
95 fMultiplicityHists(kFALSE),
96 fPriorsHists(kFALSE),
97 fNentries(0),
98 fOutputMC(0),
99 fAPriori(0),
100 fMultiplicity(0),
101 //fUtilPid(0),
102 fPIDResponse(0)
7eb0cc73 103{
60eac73d 104 // Default constructor
c0d01d9d 105 Float_t ptlims[7]={0.,2.,4.,6.,8.,12.,24.};
106 SetPtBinLimit(7,ptlims);
7eb0cc73 107}
108
109//________________________________________________________________________
110AliAnalysisTaskSELambdac::AliAnalysisTaskSELambdac(const char *name,Bool_t fillNtuple,AliRDHFCutsLctopKpi *lccutsana,AliRDHFCutsLctopKpi *lccutsprod):
60eac73d 111 AliAnalysisTaskSE(name),
112 fOutput(0),
113 fHistNEvents(0),
114 fhChi2(0),
115 fhMassPtGreater3(0),
116 fhMassPtGreater3TC(0),
117 fhMassPtGreater3Kp(0),
118 fhMassPtGreater3KpTC(0),
119 fhMassPtGreater3Lpi(0),
120 fhMassPtGreater3LpiTC(0),
121 fhMassPtGreater2(0),
122 fhMassPtGreater2TC(0),
123 fhMassPtGreater2Kp(0),
124 fhMassPtGreater2KpTC(0),
125 fhMassPtGreater2Lpi(0),
126 fhMassPtGreater2LpiTC(0),
127 fNtupleLambdac(0),
128 fUpmasslimit(2.486),
129 fLowmasslimit(2.086),
130 fNPtBins(0),
131 fRDCutsAnalysis(lccutsana),
132 fRDCutsProduction(lccutsprod),
133 fListCuts(0),
134 fFillNtuple(fillNtuple),
135 fReadMC(kFALSE),
136 fMCPid(kFALSE),
137 fRealPid(kTRUE),
138 fResPid(kFALSE),
139 fUseKF(kFALSE),
140 fAnalysis(kFALSE),
141 fVHF(0),
142 fFillVarHists(kFALSE),
143 fMultiplicityHists(kFALSE),
144 fPriorsHists(kFALSE),
145 fNentries(0),
146 fOutputMC(0),
147 fAPriori(0),
148 fMultiplicity(0),
149 //fUtilPid(0),
150 fPIDResponse(0)
7eb0cc73 151{
60eac73d 152 SetPtBinLimit(fRDCutsAnalysis->GetNPtBins()+1,
153 fRDCutsAnalysis->GetPtBinLimits());
7eb0cc73 154 // Default constructor
60eac73d 155 // Output slot #1 writes into a TList container
7eb0cc73 156 DefineOutput(1,TList::Class()); //My private output
157 DefineOutput(2,TList::Class());
029ed93a 158 DefineOutput(3,TList::Class());
159 DefineOutput(4,TH1F::Class());
60eac73d 160 DefineOutput(5,TList::Class());
161 DefineOutput(6,TList::Class());
162 if (fFillNtuple) {
7eb0cc73 163 // Output slot #2 writes into a TNtuple container
60eac73d 164 DefineOutput(7,TNtuple::Class()); //My private output
7eb0cc73 165 }
60eac73d 166
7eb0cc73 167}
168
169//________________________________________________________________________
170AliAnalysisTaskSELambdac::~AliAnalysisTaskSELambdac()
171{
172 // Destructor
173 if (fOutput) {
174 delete fOutput;
175 fOutput = 0;
176 }
029ed93a 177 if (fOutputMC) {
178 delete fOutputMC;
179 fOutputMC = 0;
180 }
60eac73d 181 if (fAPriori) {
182 delete fAPriori;
183 fAPriori = 0;
184 }
185 if (fMultiplicity) {
186 delete fMultiplicity;
187 fMultiplicity = 0;
188 }
029ed93a 189
7eb0cc73 190 if (fVHF) {
191 delete fVHF;
192 fVHF = 0;
193 }
194
60eac73d 195 if(fRDCutsAnalysis){
7eb0cc73 196 delete fRDCutsAnalysis;
197 fRDCutsAnalysis = 0;
60eac73d 198 }
199 if(fRDCutsProduction){
7eb0cc73 200 delete fRDCutsProduction;
201 fRDCutsProduction = 0;
60eac73d 202 }
203
204 if (fListCuts) {
205 delete fListCuts;
206 fListCuts = 0;
207 }
208 if (fNentries){
209 delete fNentries;
210 fNentries = 0;
211 }
212 /*
213 if (fUtilPid){
214 delete fUtilPid;
215 fUtilPid = 0;
216 }
217 */
218 if (fPIDResponse) {
219 delete fPIDResponse;
220 }
221
7eb0cc73 222}
223//_________________________________________________________________
224void AliAnalysisTaskSELambdac::SetMassLimits(Float_t range){
225 fUpmasslimit = 2.286+range;
226 fLowmasslimit = 2.286-range;
227}
228//_________________________________________________________________
229void AliAnalysisTaskSELambdac::SetMassLimits(Float_t lowlimit, Float_t uplimit){
230 if(uplimit>lowlimit)
231 {
232 fUpmasslimit = lowlimit;
233 fLowmasslimit = uplimit;
234 }
235}
236
237
238//________________________________________________________________________
239void AliAnalysisTaskSELambdac::SetPtBinLimit(Int_t n, Float_t* lim){
240 // define pt bins for analysis
241 if(n>kMaxPtBins){
242 printf("Max. number of Pt bins = %d\n",kMaxPtBins);
243 fNPtBins=kMaxPtBins;
244 fArrayBinLimits[0]=0.;
245 fArrayBinLimits[1]=2.;
246 fArrayBinLimits[2]=3.;
7ad4b782 247 fArrayBinLimits[3]=4.;
7eb0cc73 248 for(Int_t i=4; i<kMaxPtBins+1; i++) fArrayBinLimits[i]=99999999.;
249 }else{
250 fNPtBins=n-1;
251 fArrayBinLimits[0]=lim[0];
252 for(Int_t i=1; i<fNPtBins+1; i++)
253 if(lim[i]>fArrayBinLimits[i-1]){
254 fArrayBinLimits[i]=lim[i];
255 }
256 else {
257 fArrayBinLimits[i]=fArrayBinLimits[i-1];
258 }
259 for(Int_t i=fNPtBins; i<kMaxPtBins+1; i++) fArrayBinLimits[i]=99999999.;
260 }
261 if(fDebug > 1){
262 printf("Number of Pt bins = %d\n",fNPtBins);
e11ae259 263 for(Int_t i=0; i<fNPtBins; i++) printf(" Bin%d = %8.2f-%8.2f\n",i,fArrayBinLimits[i],fArrayBinLimits[i+1]);
7eb0cc73 264 }
265}
266//_________________________________________________________________
4c7fd068 267Double_t AliAnalysisTaskSELambdac::GetPtBinLimit(Int_t ibin) const{
7eb0cc73 268 if(ibin>fNPtBins)return -1;
269 return fArrayBinLimits[ibin];
270}
271
272//_________________________________________________________________
273void AliAnalysisTaskSELambdac::Init()
274{
275 // Initialization
276
60eac73d 277 if (fDebug > 1) printf("AnalysisTaskSELambdac::Init() \n");
7eb0cc73 278
279 fListCuts=new TList();
029ed93a 280 fListCuts->SetOwner();
7eb0cc73 281
dc222f77 282 fListCuts->Add(new AliRDHFCutsLctopKpi(*fRDCutsAnalysis));
283 fListCuts->Add(new AliRDHFCutsLctopKpi(*fRDCutsProduction));
284 PostData(2,fListCuts);
7eb0cc73 285 return;
286}
287
288//________________________________________________________________________
289void AliAnalysisTaskSELambdac::UserCreateOutputObjects()
290{
291 // Create the output container
292 //
60eac73d 293 if (fDebug > 1) printf("AnalysisTaskSELambdac::UserCreateOutputObjects() \n");
7eb0cc73 294
295 // Several histograms are more conveniently managed in a TList
296 fOutput = new TList();
297 fOutput->SetOwner();
298 fOutput->SetName("OutputHistos");
299
300 TString hisname;
301 Int_t index=0;
302 Int_t indexLS=0;
303 for(Int_t i=0;i<fNPtBins;i++){
304
305 index=GetHistoIndex(i);
306 indexLS=GetLSHistoIndex(i);
307
308 hisname.Form("hMassPt%d",i);
309 fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
310 fMassHist[index]->Sumw2();
7eb0cc73 311 hisname.Form("hMassPt%dTC",i);
312 fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
313 fMassHistTC[index]->Sumw2();
314
029ed93a 315 hisname.Form("hMassPtLpi%d",i);
316 fMassHistLpi[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
317 fMassHistLpi[index]->Sumw2();
318 hisname.Form("hMassPtLpi%dTC",i);
319 fMassHistLpiTC[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
320 fMassHistLpiTC[index]->Sumw2();
321
322 hisname.Form("hMassPtKp%d",i);
323 fMassHistKp[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
324 fMassHistKp[index]->Sumw2();
325 hisname.Form("hMassPtKp%dTC",i);
326 fMassHistKpTC[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
327 fMassHistKpTC[index]->Sumw2();
60eac73d 328 //signal
7eb0cc73 329 index=GetSignalHistoIndex(i);
7eb0cc73 330 hisname.Form("hSigPt%d",i);
331 fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
332 fMassHist[index]->Sumw2();
7eb0cc73 333 hisname.Form("hSigPt%dTC",i);
334 fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
335 fMassHistTC[index]->Sumw2();
029ed93a 336 hisname.Form("hSigPtLpi%d",i);
337 fMassHistLpi[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
338 fMassHistLpi[index]->Sumw2();
339 hisname.Form("hSigPtLpi%dTC",i);
340 fMassHistLpiTC[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
341 fMassHistLpiTC[index]->Sumw2();
342
343 hisname.Form("hSigPtKp%d",i);
344 fMassHistKp[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
345 fMassHistKp[index]->Sumw2();
346 hisname.Form("hSigPtKp%dTC",i);
347 fMassHistKpTC[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
348 fMassHistKpTC[index]->Sumw2();
7eb0cc73 349
350 index=GetBackgroundHistoIndex(i);
7eb0cc73 351 hisname.Form("hBkgPt%d",i);
352 fMassHist[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
353 fMassHist[index]->Sumw2();
7eb0cc73 354 hisname.Form("hBkgPt%dTC",i);
355 fMassHistTC[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
356 fMassHistTC[index]->Sumw2();
029ed93a 357 hisname.Form("hBkgPtLpi%d",i);
358 fMassHistLpi[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
359 fMassHistLpi[index]->Sumw2();
360 hisname.Form("hBkgPtLpi%dTC",i);
361 fMassHistLpiTC[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
362 fMassHistLpiTC[index]->Sumw2();
363
364 hisname.Form("hBkgPtKp%d",i);
365 fMassHistKp[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
366 fMassHistKp[index]->Sumw2();
367 hisname.Form("hBkgPtKp%dTC",i);
368 fMassHistKpTC[index]=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
369 fMassHistKpTC[index]->Sumw2();
60eac73d 370 }
7eb0cc73 371
372 for(Int_t i=0; i<3*fNPtBins; i++){
373 fOutput->Add(fMassHist[i]);
374 fOutput->Add(fMassHistTC[i]);
029ed93a 375 fOutput->Add(fMassHistLpi[i]);
376 fOutput->Add(fMassHistLpiTC[i]);
377 fOutput->Add(fMassHistKp[i]);
378 fOutput->Add(fMassHistKpTC[i]);
7eb0cc73 379 }
380
7eb0cc73 381 fHistNEvents = new TH1F("fHistNEvents", "Number of processed events; ; Events",3,-1.5,1.5);
382 fHistNEvents->Sumw2();
383 fHistNEvents->SetMinimum(0);
384 fOutput->Add(fHistNEvents);
7ad4b782 385
386 fhChi2 = new TH1F("fhChi2", "Chi2",100,0.,10.);
387 fhChi2->Sumw2();
388 fOutput->Add(fhChi2);
389
390 fhMassPtGreater3=new TH1F("fhMassPtGreater3","Pt > 3 GeV/c",100,fLowmasslimit,fUpmasslimit);
391 fhMassPtGreater3->Sumw2();
392 fOutput->Add(fhMassPtGreater3);
393 fhMassPtGreater3TC=new TH1F("fhMassPtGreater3TC","Pt > 3 GeV/c",100,fLowmasslimit,fUpmasslimit);
394 fhMassPtGreater3TC->Sumw2();
395 fOutput->Add(fhMassPtGreater3TC);
029ed93a 396 fhMassPtGreater3Kp=new TH1F("fhMassPtGreater3Kp","Pt > 3 GeV/c",100,fLowmasslimit,fUpmasslimit);
397 fhMassPtGreater3Kp->Sumw2();
398 fOutput->Add(fhMassPtGreater3Kp);
399 fhMassPtGreater3KpTC=new TH1F("fhMassPtGreater3KpTC","Pt > 3 GeV/c",100,fLowmasslimit,fUpmasslimit);
400 fhMassPtGreater3KpTC->Sumw2();
401 fOutput->Add(fhMassPtGreater3KpTC);
402 fhMassPtGreater3Lpi=new TH1F("fhMassPtGreater3Lpi","Pt > 3 GeV/c",100,fLowmasslimit,fUpmasslimit);
403 fhMassPtGreater3Lpi->Sumw2();
404 fOutput->Add(fhMassPtGreater3Lpi);
405 fhMassPtGreater3LpiTC=new TH1F("fhMassPtGreater3LpiTC","Pt > 3 GeV/c",100,fLowmasslimit,fUpmasslimit);
406 fhMassPtGreater3LpiTC->Sumw2();
407 fOutput->Add(fhMassPtGreater3LpiTC);
408 fhMassPtGreater2=new TH1F("fhMassPtGreater2","Pt > 2 GeV/c",100,fLowmasslimit,fUpmasslimit);
409 fhMassPtGreater2->Sumw2();
410 fOutput->Add(fhMassPtGreater2);
411 fhMassPtGreater2TC=new TH1F("fhMassPtGreater2TC","Pt > 2 GeV/c",100,fLowmasslimit,fUpmasslimit);
412 fhMassPtGreater2TC->Sumw2();
413 fOutput->Add(fhMassPtGreater2TC);
414 fhMassPtGreater2Kp=new TH1F("fhMassPtGreater2Kp","Pt > 2 GeV/c",100,fLowmasslimit,fUpmasslimit);
415 fhMassPtGreater2Kp->Sumw2();
416 fOutput->Add(fhMassPtGreater2Kp);
417 fhMassPtGreater2KpTC=new TH1F("fhMassPtGreater2KpTC","Pt > 2 GeV/c",100,fLowmasslimit,fUpmasslimit);
418 fhMassPtGreater2KpTC->Sumw2();
419 fOutput->Add(fhMassPtGreater2KpTC);
420 fhMassPtGreater2Lpi=new TH1F("fhMassPtGreater2Lpi","Pt > 2 GeV/c",100,fLowmasslimit,fUpmasslimit);
421 fhMassPtGreater2Lpi->Sumw2();
422 fOutput->Add(fhMassPtGreater2Lpi);
423 fhMassPtGreater2LpiTC=new TH1F("fhMassPtGreater2LpiTC","Pt > 2 GeV/c",100,fLowmasslimit,fUpmasslimit);
424 fhMassPtGreater2LpiTC->Sumw2();
425 fOutput->Add(fhMassPtGreater2LpiTC);
426
427 fOutputMC = new TList();
428 fOutputMC->SetOwner();
429 fOutputMC->SetName("QAMCHistos");
430
60eac73d 431 // const char* nameoutput=GetOutputSlot(4)->GetContainer()->GetName();
029ed93a 432
433 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", 11,-0.5,10.5);
434
435 //ROS: qui il bin assignment e' modellato su D0 ma sicuramente iv arie
436 fNentries->GetXaxis()->SetBinLabel(1,"nEventsAnal");
437 fNentries->GetXaxis()->SetBinLabel(2,"nCandSel(Cuts)");
438 fNentries->GetXaxis()->SetBinLabel(3,"nLcSelected");
439 fNentries->GetXaxis()->SetBinLabel(4,"nEventsGoodVtxS");
440 fNentries->GetXaxis()->SetBinLabel(5,"ptbin = -1");
441 fNentries->GetXaxis()->SetBinLabel(6,"no daughter");
442 fNentries->GetXaxis()->SetBinLabel(7,"nCandSel(Tr)");
443 fNentries->GetXaxis()->SetBinLabel(8,"PID=0");
444 fNentries->GetXaxis()->SetBinLabel(9,"PID=1");
445 fNentries->GetXaxis()->SetBinLabel(10,"PID=2");
446 fNentries->GetXaxis()->SetBinLabel(11,"PID=3");
447 fNentries->GetXaxis()->SetNdivisions(1,kFALSE);
448
449 hisname.Form("hMass");
450 TH1F *hMassInv=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
451 fOutputMC->Add(hMassInv);
452 hisname.Form("hbMass");
453 TH1F *hBMassInv=new TH1F(hisname.Data(),hisname.Data(),100,fLowmasslimit,fUpmasslimit);
454 fOutputMC->Add(hBMassInv);
455
456 // proton specific
457 hisname.Form("hpTOFSignal");
458 TH1F *hProtonTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
459 fOutputMC->Add(hProtonTOFSignal);
460 hisname.Form("hbpTOFSignal");
461 TH1F *hBProtonTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
462 fOutputMC->Add(hBProtonTOFSignal);
463
464 hisname.Form("hpTPCSignal");
465 TH1F *hProtonTPCSignal=new TH1F(hisname.Data(),hisname.Data(),150,0.,150.0);
466 fOutputMC->Add(hProtonTPCSignal);
467 hisname.Form("hbpTPCSignal");
468 TH1F *hBProtonTPCSignal=new TH1F(hisname.Data(),hisname.Data(),150,0.,150.0);
469 fOutputMC->Add(hBProtonTPCSignal);
7eb0cc73 470
029ed93a 471 hisname.Form("hpptProng");
472 TH1F *hProtonPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
473 fOutputMC->Add(hProtonPtProng);
474 hisname.Form("hbpptProng");
475 TH1F *hBProtonPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
476 fOutputMC->Add(hBProtonPtProng);
477
478 hisname.Form("hpRealTot");
479 TH1F *hProtonRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
480 fOutputMC->Add(hProtonRealTot);
481 hisname.Form("hbpRealTot");
482 TH1F *hBProtonRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
483 fOutputMC->Add(hBProtonRealTot);
484 hisname.Form("hpIDTot");
485 TH1F *hProtonIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
486 fOutputMC->Add(hProtonIDTot);
487 hisname.Form("hpIDGood");
488 TH1F *hProtonIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
489 fOutputMC->Add(hProtonIDGood);
490 hisname.Form("hbpIDGood");
491 TH1F *hBProtonIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
492 fOutputMC->Add(hBProtonIDGood);
493 hisname.Form("hbpIDTot");
494 TH1F *hBProtonIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
495 fOutputMC->Add(hBProtonIDTot);
60eac73d 496 hisname.Form("hnopIDp");
497 TH1F *hnoProtonIDpTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
498 fOutputMC->Add(hnoProtonIDpTot);
499 hisname.Form("hbnopIDp");
500 TH1F *hBnoProtonIDpTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
501 fOutputMC->Add(hBnoProtonIDpTot);
029ed93a 502
503 hisname.Form("hpd0Prong");
504 TH1F *hProtond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
505 fOutputMC->Add(hProtond0Prong);
506 hisname.Form("hbpd0Prong");
507 TH1F *hBProtond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
508 fOutputMC->Add(hBProtond0Prong);
509 hisname.Form("hbpSignalVspTOF");
510 TH2F *hBpSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
511 fOutputMC->Add(hBpSignalVspTOF);
512 hisname.Form("hbpSignalVspTPC");
513 TH2F *hBpSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
514 fOutputMC->Add(hBpSignalVspTPC);
515 hisname.Form("hpSignalVspTOF");
516 TH2F *hpSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
517 fOutputMC->Add(hpSignalVspTOF);
518 hisname.Form("hpSignalVspTPC");
519 TH2F *hpSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
520 fOutputMC->Add(hpSignalVspTPC);
521
522 hisname.Form("hpSigmaVspTOF");
523 TH2F *hpSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
524 fOutputMC->Add(hpSigmaVspTOF);
525 hisname.Form("hpSigmaVspTPC");
526 TH2F *hpSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
527 fOutputMC->Add(hpSigmaVspTPC);
528 hisname.Form("hbpSigmaVspTOF");
529 TH2F *hBpSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
530 fOutputMC->Add(hBpSigmaVspTOF);
531 hisname.Form("hbpSigmaVspTPC");
532 TH2F *hBpSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
533 fOutputMC->Add(hBpSigmaVspTPC);
534
029ed93a 535
60eac73d 536 //kaon specific
029ed93a 537 hisname.Form("hKTOFSignal");
538 TH1F *hKaonTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
539 fOutputMC->Add(hKaonTOFSignal);
540 hisname.Form("hbKTOFSignal");
541 TH1F *hBKaonTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
542 fOutputMC->Add(hBKaonTOFSignal);
029ed93a 543 hisname.Form("hKTPCSignal");
544 TH1F *hKaonTPCSignal=new TH1F(hisname.Data(),hisname.Data(),150,0.,150.0);
545 fOutputMC->Add(hKaonTPCSignal);
546 hisname.Form("hbKTPCSignal");
547 TH1F *hBKaonTPCSignal=new TH1F(hisname.Data(),hisname.Data(),150,0.,150.0);
548 fOutputMC->Add(hBKaonTPCSignal);
549
550 hisname.Form("hKptProng");
551 TH1F *hKaonPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
552 fOutputMC->Add(hKaonPtProng);
553 hisname.Form("hbKptProng");
554 TH1F *hBKaonPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
555 fOutputMC->Add(hBKaonPtProng);
029ed93a 556 hisname.Form("hKRealTot");
557 TH1F *hKaonRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
558 fOutputMC->Add(hKaonRealTot);
559 hisname.Form("hbKRealTot");
560 TH1F *hBKaonRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
561 fOutputMC->Add(hBKaonRealTot);
562 hisname.Form("hKIDGood");
563 TH1F *hKaonIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
564 fOutputMC->Add(hKaonIDGood);
565 hisname.Form("hKIDTot");
566 TH1F *hKaonIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
567 fOutputMC->Add(hKaonIDTot);
568 hisname.Form("hbKIDGood");
569 TH1F *hBKaonIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
570 fOutputMC->Add(hBKaonIDGood);
571 hisname.Form("hbKIDTot");
572 TH1F *hBKaonIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
573 fOutputMC->Add(hBKaonIDTot);
60eac73d 574 hisname.Form("hnokIDk");
575 TH1F *hnoKaonIDkTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
576 fOutputMC->Add(hnoKaonIDkTot);
577 hisname.Form("hbnokIDk");
578 TH1F *hBnoKaonIDkTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
579 fOutputMC->Add(hBnoKaonIDkTot);
029ed93a 580
581
582 hisname.Form("hKd0Prong");
583 TH1F *hKaond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
584 fOutputMC->Add(hKaond0Prong);
585 hisname.Form("hbKd0Prong");
586 TH1F *hBKaond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
587 fOutputMC->Add(hBKaond0Prong);
588 hisname.Form("hbKSignalVspTOF");
589 TH2F *hbKSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
590 fOutputMC->Add(hbKSignalVspTOF);
591 hisname.Form("hbKSignalVspTPC");
592 TH2F *hbKSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
593 fOutputMC->Add(hbKSignalVspTPC);
594 hisname.Form("hKSignalVspTOF");
595 TH2F *hKSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
596 fOutputMC->Add(hKSignalVspTOF);
597 hisname.Form("hKSignalVspTPC");
598 TH2F *hKSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
599 fOutputMC->Add(hKSignalVspTPC);
029ed93a 600 hisname.Form("hKSigmaVspTOF");
601 TH2F *hKSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
602 fOutputMC->Add(hKSigmaVspTOF);
029ed93a 603 hisname.Form("hKSigmaVspTPC");
604 TH2F *hKSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
605 fOutputMC->Add(hKSigmaVspTPC);
029ed93a 606 hisname.Form("hbKSigmaVspTOF");
607 TH2F *hBKSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
608 fOutputMC->Add(hBKSigmaVspTOF);
609 hisname.Form("hbKSigmaVspTPC");
610 TH2F *hBKSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
611 fOutputMC->Add(hBKSigmaVspTPC);
612
60eac73d 613
029ed93a 614 // pion specific
615 hisname.Form("hpiTOFSignal");
616 TH1F *hPionTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
617 fOutputMC->Add(hPionTOFSignal);
618 hisname.Form("hbpiTOFSignal");
619 TH1F *hBPionTOFSignal=new TH1F(hisname.Data(),hisname.Data(),100,12000.,50000.0);
620 fOutputMC->Add(hBPionTOFSignal);
029ed93a 621 hisname.Form("hpiTPCSignal");
622 TH1F *hPionTPCSignal=new TH1F(hisname.Data(),hisname.Data(),100,30.,100.0);
623 fOutputMC->Add(hPionTPCSignal);
624 hisname.Form("hbpiTPCSignal");
625 TH1F *hBPionTPCSignal=new TH1F(hisname.Data(),hisname.Data(),100,30.,100.0);
626 fOutputMC->Add(hBPionTPCSignal);
7eb0cc73 627
029ed93a 628 hisname.Form("hpiptProng");
629 TH1F *hPionPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
630 fOutputMC->Add(hPionPtProng);
631 hisname.Form("hbpiptProng");
632 TH1F *hBPionPtProng=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
633 fOutputMC->Add(hBPionPtProng);
634
635 hisname.Form("hpiRealTot");
636 TH1F *hPionRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
637 fOutputMC->Add(hPionRealTot);
638 hisname.Form("hbpiRealTot");
639 TH1F *hBPionRealTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
640 fOutputMC->Add(hBPionRealTot);
641 hisname.Form("hpiIDGood");
642 TH1F *hPionIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
643 fOutputMC->Add(hPionIDGood);
644 hisname.Form("hpiIDTot");
645 TH1F *hPionIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
646 fOutputMC->Add(hPionIDTot);
647 hisname.Form("hbpiIDTot");
648 TH1F *hBPionIDTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
649 fOutputMC->Add(hBPionIDTot);
650 hisname.Form("hbpiIDGood");
651 TH1F *hBPionIDGood=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
652 fOutputMC->Add(hBPionIDGood);
60eac73d 653 hisname.Form("hnopiIDpi");
654 TH1F *hnoPionIDpiTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
655 fOutputMC->Add(hnoPionIDpiTot);
656 hisname.Form("hbnopiIDpi");
657 TH1F *hBnoPionIDpiTot=new TH1F(hisname.Data(),hisname.Data(),100,0.,10.0);
658 fOutputMC->Add(hBnoPionIDpiTot);
029ed93a 659
660 hisname.Form("hpid0Prong");
661 TH1F *hPiond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,-0.1);
662 fOutputMC->Add(hPiond0Prong);
663 hisname.Form("hbpid0Prong");
664 TH1F *hBPiond0Prong=new TH1F(hisname.Data(),hisname.Data(),100,-0.1,0.1);
665 fOutputMC->Add(hBPiond0Prong);
029ed93a 666
667 hisname.Form("hpiSignalVspTOF");
668 TH2F *hpiSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
669 fOutputMC->Add(hpiSignalVspTOF);
670 hisname.Form("hpiSignalVspTPC");
671 TH2F *hpiSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
672 fOutputMC->Add(hpiSignalVspTPC);
60eac73d 673 hisname.Form("hbpiSignalVspTOF");
674 TH2F *hbpiSignalVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,12000.,50000.0);
675 fOutputMC->Add(hbpiSignalVspTOF);
676 hisname.Form("hbpiSignalVspTPC");
677 TH2F *hbpiSignalVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,150,0.,150.0);
678 fOutputMC->Add(hbpiSignalVspTPC);
029ed93a 679 hisname.Form("hpiSigmaVspTOF");
680 TH2F *hpiSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
681 fOutputMC->Add(hpiSigmaVspTOF);
029ed93a 682 hisname.Form("hpiSigmaVspTPC");
683 TH2F *hpiSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
684 fOutputMC->Add(hpiSigmaVspTPC);
60eac73d 685 hisname.Form("hbpiSigmaVspTOF");
686 TH2F *hBpiSigmaVspTOF=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
687 fOutputMC->Add(hBpiSigmaVspTOF);
688 hisname.Form("hbpiSigmaVspTPC");
689 TH2F *hBpiSigmaVspTPC=new TH2F(hisname.Data(),hisname.Data(),100,0.,5.0,100,-10.0,10.0);
690 fOutputMC->Add(hBpiSigmaVspTPC);
029ed93a 691
692 // other generic
693 hisname.Form("hLcpt");
694 TH1F *hLcPt=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
695 fOutputMC->Add(hLcPt);
696 hisname.Form("hbLcpt");
697 TH1F *hBLcPt=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.0);
698 fOutputMC->Add(hBLcPt);
699 hisname.Form("hDist12toPrim");
700 TH1F *hDist12Prim=new TH1F(hisname.Data(),hisname.Data(),100,0.,1.0);
701 fOutputMC->Add(hDist12Prim);
702 hisname.Form("hbDist12toPrim");
703 TH1F *hBDist12Prim=new TH1F(hisname.Data(),hisname.Data(),100,0.,1.0);
704 fOutputMC->Add(hBDist12Prim);
705
706 hisname.Form("hSigmaVert");
707 TH1F *hSigmaVert=new TH1F(hisname.Data(),hisname.Data(),60,0.,0.06);
708 fOutputMC->Add(hSigmaVert);
709 hisname.Form("hbSigmaVert");
710 TH1F *hBSigmaVert=new TH1F(hisname.Data(),hisname.Data(),60,0.,0.06);
711 fOutputMC->Add(hBSigmaVert);
712
713 hisname.Form("hDCAs");
714 TH1F *hdcas=new TH1F(hisname.Data(),hisname.Data(),200,0.,0.1);
715 fOutputMC->Add(hdcas);
716 hisname.Form("hbDCAs");
717 TH1F *hBdcas=new TH1F(hisname.Data(),hisname.Data(),200,0.,0.1);
718 fOutputMC->Add(hBdcas);
719
720 hisname.Form("hCosPointingAngle");
721 TH1F *hCosPointingAngle=new TH1F(hisname.Data(),hisname.Data(),40,0.,1.);
722 fOutputMC->Add(hCosPointingAngle);
723 hisname.Form("hbCosPointingAngle");
724 TH1F *hBCosPointingAngle=new TH1F(hisname.Data(),hisname.Data(),40,0.,1.);
725 fOutputMC->Add(hBCosPointingAngle);
726
727 hisname.Form("hDecayLength");
728 TH1F *hDecayLength=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
729 fOutputMC->Add(hDecayLength);
730 hisname.Form("hbDecayLength");
731 TH1F *hBDecayLength=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
732 fOutputMC->Add(hBDecayLength);
733
734 hisname.Form("hSum2");
735 TH1F *hSum2=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
736 fOutputMC->Add(hSum2);
737 hisname.Form("hbSum2");
738 TH1F *hBSum2=new TH1F(hisname.Data(),hisname.Data(),100,0.,0.1);
739 fOutputMC->Add(hBSum2);
740
741 hisname.Form("hptmax");
742 TH1F *hPtMax=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
743 fOutputMC->Add(hPtMax);
744 hisname.Form("hbptmax");
745 TH1F *hBPtMax=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
746 fOutputMC->Add(hBPtMax);
747
748
749
60eac73d 750 fAPriori = new TList(); // AdC
751 fAPriori->SetOwner(); // AdC
752 fAPriori->SetName("APrioriMCHistos"); // AdC
753
754 hisname.Form("hElIn3Prong");
755 TH1F *hElIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
756 fAPriori->Add(hElIn3Prong);
757 hisname.Form("hMuIn3Prong");
758 TH1F *hMuIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
759 fAPriori->Add(hMuIn3Prong);
760 hisname.Form("hPiIn3Prong");
761 TH1F *hPiIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
762 fAPriori->Add(hPiIn3Prong);
763 hisname.Form("hKaIn3Prong");
764 TH1F *hKaIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
765 fAPriori->Add(hKaIn3Prong);
766 hisname.Form("hPrIn3Prong");
767 TH1F *hPrIn3Prong=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
768 fAPriori->Add(hPrIn3Prong);
769
770 hisname.Form("hElIn3Prong1");
771 TH1F *hElIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
772 fAPriori->Add(hElIn3Prong1);
773 hisname.Form("hMuIn3Prong1");
774 TH1F *hMuIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
775 fAPriori->Add(hMuIn3Prong1);
776 hisname.Form("hPiIn3Prong1");
777 TH1F *hPiIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
778 fAPriori->Add(hPiIn3Prong1);
779 hisname.Form("hKaIn3Prong1");
780 TH1F *hKaIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
781 fAPriori->Add(hKaIn3Prong1);
782 hisname.Form("hPrIn3Prong1");
783 TH1F *hPrIn3Prong1=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
784 fAPriori->Add(hPrIn3Prong1);
785
786 hisname.Form("hElIn3Prong2");
787 TH1F *hElIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
788 fAPriori->Add(hElIn3Prong2);
789 hisname.Form("hMuIn3Prong2");
790 TH1F *hMuIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
791 fAPriori->Add(hMuIn3Prong2);
792 hisname.Form("hPiIn3Prong2");
793 TH1F *hPiIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
794 fAPriori->Add(hPiIn3Prong2);
795 hisname.Form("hKaIn3Prong2");
796 TH1F *hKaIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
797 fAPriori->Add(hKaIn3Prong2);
798 hisname.Form("hPrIn3Prong2");
799 TH1F *hPrIn3Prong2=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
800 fAPriori->Add(hPrIn3Prong2);
801
802 hisname.Form("hElIn3Prong3");
803 TH1F *hElIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
804 fAPriori->Add(hElIn3Prong3);
805 hisname.Form("hMuIn3Prong3");
806 TH1F *hMuIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
807 fAPriori->Add(hMuIn3Prong3);
808 hisname.Form("hPiIn3Prong3");
809 TH1F *hPiIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
810 fAPriori->Add(hPiIn3Prong3);
811 hisname.Form("hKaIn3Prong3");
812 TH1F *hKaIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
813 fAPriori->Add(hKaIn3Prong3);
814 hisname.Form("hPrIn3Prong3");
815 TH1F *hPrIn3Prong3=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
816 fAPriori->Add(hPrIn3Prong3);
817
818 hisname.Form("hElIn3Prong4");
819 TH1F *hElIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
820 fAPriori->Add(hElIn3Prong4);
821 hisname.Form("hMuIn3Prong4");
822 TH1F *hMuIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
823 fAPriori->Add(hMuIn3Prong4);
824 hisname.Form("hPiIn3Prong4");
825 TH1F *hPiIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
826 fAPriori->Add(hPiIn3Prong4);
827 hisname.Form("hKaIn3Prong4");
828 TH1F *hKaIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
829 fAPriori->Add(hKaIn3Prong4);
830 hisname.Form("hPrIn3Prong4");
831 TH1F *hPrIn3Prong4=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
832 fAPriori->Add(hPrIn3Prong4);
833
834 hisname.Form("hElIn3Prong5");
835 TH1F *hElIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
836 fAPriori->Add(hElIn3Prong5);
837 hisname.Form("hMuIn3Prong5");
838 TH1F *hMuIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
839 fAPriori->Add(hMuIn3Prong5);
840 hisname.Form("hPiIn3Prong5");
841 TH1F *hPiIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
842 fAPriori->Add(hPiIn3Prong5);
843 hisname.Form("hKaIn3Prong5");
844 TH1F *hKaIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
845 fAPriori->Add(hKaIn3Prong5);
846 hisname.Form("hPrIn3Prong5");
847 TH1F *hPrIn3Prong5=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
848 fAPriori->Add(hPrIn3Prong5);
849
850 hisname.Form("hElIn3Prong6");
851 TH1F *hElIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
852 fAPriori->Add(hElIn3Prong6);
853 hisname.Form("hMuIn3Prong6");
854 TH1F *hMuIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
855 fAPriori->Add(hMuIn3Prong6);
856 hisname.Form("hPiIn3Prong6");
857 TH1F *hPiIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
858 fAPriori->Add(hPiIn3Prong6);
859 hisname.Form("hKaIn3Prong6");
860 TH1F *hKaIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
861 fAPriori->Add(hKaIn3Prong6);
862 hisname.Form("hPrIn3Prong6");
863 TH1F *hPrIn3Prong6=new TH1F(hisname.Data(),hisname.Data(),100,0.,5.);
864 fAPriori->Add(hPrIn3Prong6);
865
866
867 fMultiplicity = new TList(); // AdC
868 fMultiplicity->SetOwner(); // AdC
869 fMultiplicity->SetName("MultiplicityMCHistos"); // AdC
870
871 hisname.Form("hLcinEvent");
872 TH1I*hLcinEvent=new TH1I(hisname.Data(),hisname.Data(),3,-1,2);
873 fMultiplicity->Add(hLcinEvent);
874
875 hisname.Form("hPrimariesvsAOD");
876 TH2I *hPrimariesvsAOD=new TH2I(hisname.Data(),hisname.Data(),300,0,300,300,0,300);
877 fMultiplicity->Add(hPrimariesvsAOD);
878
879 hisname.Form("hMultiplicityInLcEvent");
880 TH1I *hMultiplicityInLcEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
881 fMultiplicity->Add(hMultiplicityInLcEvent);
882 hisname.Form("h2MultiplicityInLcEvent");
883 TH1I *h2MultiplicityInLcEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
884 fMultiplicity->Add(h2MultiplicityInLcEvent);
885 hisname.Form("hAll2MultiplicityInEvent");
886 TH1I *hAll2MultiplicityInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
887 fMultiplicity->Add(hAll2MultiplicityInEvent);
888 hisname.Form("hAllMultiplicityInEvent");
889 TH1I *hAllMultiplicityInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
890 fMultiplicity->Add(hAllMultiplicityInEvent);
891 hisname.Form("hAllMultiplicityPrimaryInEvent");
892 TH1I *hAllMultiplicityPrimaryInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
893 fMultiplicity->Add(hAllMultiplicityPrimaryInEvent);
894 hisname.Form("hAll2MultiplicityPrimaryInEvent");
895 TH1I *hAll2MultiplicityPrimaryInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
896 fMultiplicity->Add(hAll2MultiplicityPrimaryInEvent);
897 hisname.Form("hMultiplicityInEvent");
898 TH1I *hMultiplicityInEvent=new TH1I(hisname.Data(),hisname.Data(),300,0.,300);
899 fMultiplicity->Add(hMultiplicityInEvent);
900 hisname.Form("hMultiplicityIn3ProngLC");
901 TH1I *hMultiplicityIn3ProngLC=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
902 fMultiplicity->Add(hMultiplicityIn3ProngLC);
903 hisname.Form("hMultiplicityInLCpid");
904 TH1I *hMultiplicityInLCpid=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
905 fMultiplicity->Add(hMultiplicityInLCpid);
906 hisname.Form("hMultiplicityInLCmc");
907 TH1I *hMultiplicityInLCmc=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
908 fMultiplicity->Add(hMultiplicityInLCmc);
909 hisname.Form("hMultiplicityInLCNomc");
910 TH1I *hMultiplicityInLCNomc=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
911 fMultiplicity->Add(hMultiplicityInLCNomc);
912 hisname.Form("hMultiplicityYesC");
913 TH1I *hMultiplicityYesC=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
914 fMultiplicity->Add(hMultiplicityYesC);
915 hisname.Form("hMultiplicityYesB");
916 TH1I *hMultiplicityYesB=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
917 fMultiplicity->Add(hMultiplicityYesB);
918 hisname.Form("hMultiplicityJPsi");
919 TH1I *hMultiplicityJPsi=new TH1I(hisname.Data(),hisname.Data(),300,0,300);
920 fMultiplicity->Add(hMultiplicityJPsi);
921
922
923 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
924 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
925 fPIDResponse = inputHandler->GetPIDResponse();
926
029ed93a 927 if(fRDCutsProduction->GetIsUsePID()){
60eac73d 928 fRDCutsProduction->GetPidHF()->SetPidResponse(fPIDResponse);
929 fRDCutsProduction->GetPidpion()->SetPidResponse(fPIDResponse);
930 fRDCutsProduction->GetPidprot()->SetPidResponse(fPIDResponse);
931 //fUtilPid=new AliAODpidUtil(fPIDResponse);
932 fRDCutsProduction->GetPidHF()->SetOldPid(kFALSE);
933 fRDCutsProduction->GetPidpion()->SetOldPid(kFALSE);
934 fRDCutsProduction->GetPidprot()->SetOldPid(kFALSE);
935 }
029ed93a 936 if(fRDCutsAnalysis->GetIsUsePID()){
60eac73d 937 fRDCutsAnalysis->GetPidHF()->SetPidResponse(fPIDResponse);
938 fRDCutsAnalysis->GetPidpion()->SetPidResponse(fPIDResponse);
939 fRDCutsAnalysis->GetPidprot()->SetPidResponse(fPIDResponse);
940 fRDCutsAnalysis->GetPidHF()->SetOldPid(kFALSE);
941 fRDCutsAnalysis->GetPidpion()->SetOldPid(kFALSE);
942 fRDCutsAnalysis->GetPidprot()->SetOldPid(kFALSE);
029ed93a 943 }
944
029ed93a 945 PostData(1,fOutput);
60eac73d 946 if (fFillVarHists) PostData(3,fOutputMC);
029ed93a 947 PostData(4,fNentries);
60eac73d 948 if (fPriorsHists) PostData(5,fAPriori);
949 if (fMultiplicityHists) PostData(6,fMultiplicity);
950 if (fFillNtuple) {
7eb0cc73 951 //OpenFile(3); // 2 is the slot number of the ntuple
60eac73d 952 fNtupleLambdac = new TNtuple("fNtupleLambdac","D +",
953 "pdg:Px:Py:Pz:PtTrue:VxTrue:VyTrue:VzTrue:Ptpi:PtK:Ptpi2:PtRec:PointingAngle:DecLeng:VxRec:VyRec:VzRec:InvMass:sigvert:d0Pi:d0K:d0Pi2:dca:d0square");
954 PostData(7,fNtupleLambdac);
7eb0cc73 955 }
60eac73d 956
7eb0cc73 957 return;
958}
959
960//________________________________________________________________________
961void AliAnalysisTaskSELambdac::UserExec(Option_t */*option*/)
962{
963 // Execute analysis for current event:
964 // heavy flavor candidates association to MC truth
965
60eac73d 966 AliAODEvent *aod = dynamic_cast<AliAODEvent*> (InputEvent());
967 //tmp
968 fHistNEvents->Fill(0); // count event
7ad4b782 969 // Post the data already here
7eb0cc73 970
971 TClonesArray *array3Prong = 0;
972 TClonesArray *arrayLikeSign =0;
973 if(!aod && AODEvent() && IsStandardAOD()) {
974 // In case there is an AOD handler writing a standard AOD, use the AOD
975 // event in memory rather than the input (ESD) event.
976 aod = dynamic_cast<AliAODEvent*> (AODEvent());
977 // in this case the braches in the deltaAOD (AliAOD.VertexingHF.root)
978 // have to taken from the AOD event hold by the AliAODExtension
979 AliAODHandler* aodHandler = (AliAODHandler*)
980 ((AliAnalysisManager::GetAnalysisManager())->GetOutputEventHandler());
981 if(aodHandler->GetExtensions()) {
982 AliAODExtension *ext = (AliAODExtension*)aodHandler->GetExtensions()->FindObject("AliAOD.VertexingHF.root");
983 AliAODEvent *aodFromExt = ext->GetAOD();
984 array3Prong=(TClonesArray*)aodFromExt->GetList()->FindObject("Charm3Prong");
985 arrayLikeSign=(TClonesArray*)aodFromExt->GetList()->FindObject("LikeSign3Prong");
986 }
dc222f77 987 } else if(aod) {
7eb0cc73 988 array3Prong=(TClonesArray*)aod->GetList()->FindObject("Charm3Prong");
989 arrayLikeSign=(TClonesArray*)aod->GetList()->FindObject("LikeSign3Prong");
990 }
991
60eac73d 992 if(!aod) return;
7eb0cc73 993
7eb0cc73 994 TClonesArray *arrayMC=0;
995 AliAODMCHeader *mcHeader=0;
996
7eb0cc73 997 // load MC particles
998 if(fReadMC){
999
1000 arrayMC = (TClonesArray*)aod->GetList()->FindObject(AliAODMCParticle::StdBranchName());
1001 if(!arrayMC) {
1002 printf("AliAnalysisTaskSELambdac::UserExec: MC particles branch not found!\n");
1003 return;
1004 }
60eac73d 1005
1006
1007 // load MC header
7eb0cc73 1008 mcHeader = (AliAODMCHeader*)aod->GetList()->FindObject(AliAODMCHeader::StdBranchName());
1009 if(!mcHeader) {
60eac73d 1010 printf("AliAnalysisTaskSELambdac::UserExec: MC header branch not found!\n");
1011 return;
7eb0cc73 1012 }
1013 }
60eac73d 1014
1015 TString fillthis="";
1016 Int_t numberOfPrimaries= NumberPrimaries(aod);
1017
1018 if (fMultiplicityHists && fReadMC) {
1019 fillthis="hPrimariesvsAOD";
1020 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(aod->GetNTracks(),numberOfPrimaries);
1021
1022 fillthis="hAll2MultiplicityInEvent";
1023 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(aod->GetNTracks());
1024
1025 fillthis="hAll2MultiplicityPrimaryInEvent";
1026 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1027
1028 if (IsThereAGeneratedLc(arrayMC)) {
1029 fillthis="h2MultiplicityInLcEvent";
1030 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1031 }
1032
1033 }
1034
1035 if(!array3Prong || !aod) {
1036 printf("AliAnalysisTaskSELambdac::UserExec: Charm3Prong branch not found!\n");
1037 return;
1038 }
1039 if(!arrayLikeSign) {
1040 printf("AliAnalysisTaskSELambdac::UserExec: LikeSign3Prong branch not found!\n");
1041 // return;
1042 }
1043
1044 fNentries->Fill(0);
1045 TString trigclass=aod->GetFiredTriggerClasses();
1046 if(trigclass.Contains("C0SMH-B-NOPF-ALLNOTRD") || trigclass.Contains("C0SMH-B-NOPF-ALL")) fNentries->Fill(14);
1047 if(!fRDCutsProduction->IsEventSelected(aod)) {
1048 if(fRDCutsProduction->GetWhyRejection()==1) // rejected for pileup
1049 fNentries->Fill(13);
1050 return;
1051 }
1052
1053 // AOD primary vertex
1054 AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
1055 if(!vtx1) return;
1056
1057 Bool_t isThereA3prongWithGoodTracks = kFALSE;
1058 Bool_t isThereA3ProngLcKine = kFALSE;
1059 Bool_t isThereA3ProngLcKineANDpid = kFALSE;
1060 Bool_t isThereA3ProngLcMC = kFALSE;
1061 Bool_t isThereA3ProngCyes = kFALSE;
1062 Bool_t isThereA3ProngByes = kFALSE;
1063 Bool_t isThereA3ProngJPsi = kFALSE;
1064
7eb0cc73 1065 Int_t n3Prong = array3Prong->GetEntriesFast();
7eb0cc73 1066 for (Int_t i3Prong = 0; i3Prong < n3Prong; i3Prong++) {
1067 AliAODRecoDecayHF3Prong *d = (AliAODRecoDecayHF3Prong*)array3Prong->UncheckedAt(i3Prong);
60eac73d 1068
7eb0cc73 1069 Bool_t unsetvtx=kFALSE;
1070 if(!d->GetOwnPrimaryVtx()){
1071 d->SetOwnPrimaryVtx(vtx1);
1072 unsetvtx=kTRUE;
1073 }
1074
60eac73d 1075 //if(d->GetSelectionMap()) {if(!d->HasSelectionBit(AliRDHFCuts::kLcCuts)) continue;}
1076 //if(d->GetSelectionMap()) {if(!d->HasSelectionBit(AliRDHFCuts::kLcPID)) continue;}
7eb0cc73 1077
029ed93a 1078 Int_t isSelectedTracks = fRDCutsProduction->IsSelected(d,AliRDHFCuts::kTracks,aod);
1079 if(!isSelectedTracks) continue;
7ad4b782 1080
60eac73d 1081 isThereA3prongWithGoodTracks=kTRUE;
1082
029ed93a 1083 if (fRDCutsProduction->IsInFiducialAcceptance(d->Pt(),d->Y(4122))) fNentries->Fill(6);
7ad4b782 1084
029ed93a 1085 Int_t ptbin=fRDCutsProduction->PtBin(d->Pt());
1086 if(ptbin==-1) {fNentries->Fill(4); continue;} //out of bounds
7eb0cc73 1087
029ed93a 1088 FillMassHists(aod,d,arrayMC,fRDCutsProduction);
60eac73d 1089 if(fFillVarHists) FillVarHists(d,arrayMC,fRDCutsProduction,/*fOutputMC,*/aod);
1090
1091 if (fPriorsHists && fReadMC)
1092 FillAPrioriConcentrations(d, fRDCutsProduction, aod, arrayMC);
1093 if (fMultiplicityHists && fReadMC)
1094 MultiplicityStudies(d, fRDCutsProduction, aod, arrayMC,
1095 isThereA3ProngLcKine,isThereA3ProngLcKineANDpid,isThereA3ProngLcMC,
1096 isThereA3ProngCyes,isThereA3ProngByes,isThereA3ProngJPsi);
1097
1098 /*
1099 //start OS analysis
1100 if(labDp<0)fHistOSbkg->Fill(d->InvMassDplus());
1101 fHistOS->Fill(d->InvMassDplus());
1102 */
029ed93a 1103
7eb0cc73 1104 if(unsetvtx) d->UnsetOwnPrimaryVtx();
1105 }
029ed93a 1106
60eac73d 1107 if (fMultiplicityHists && fReadMC) {
1108 fillthis="hAllMultiplicityInEvent";
1109 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(aod->GetNTracks());
1110
1111 fillthis="hAllMultiplicityPrimaryInEvent";
1112 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1113
1114 if (IsThereAGeneratedLc(arrayMC)) {
1115 fillthis="hMultiplicityInLcEvent";
1116 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1117 }
1118
1119 if (isThereA3prongWithGoodTracks) {
1120 fillthis="hMultiplicityInEvent";
1121 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1122 }
1123 if (isThereA3ProngLcKine) {
1124 fillthis="hMultiplicityIn3ProngLC";
1125 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1126 }
1127 if (isThereA3ProngLcKineANDpid) {
1128 fillthis="hMultiplicityInLCpid";
1129 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1130 }
1131 if (isThereA3ProngLcMC) {
1132 fillthis="hMultiplicityInLCmc";
1133 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1134 }
1135 if (isThereA3ProngLcKine && !isThereA3ProngLcMC) {
1136 fillthis="hMultiplicityInLCNomc";
1137 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1138 }
1139
1140 if (isThereA3ProngCyes) {
1141 fillthis="hMultiplicityYesC";
1142 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1143 }
1144 if (isThereA3ProngByes) {
1145 fillthis="hMultiplicityYesB";
1146 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1147 }
1148 if (isThereA3ProngJPsi) {
1149 fillthis="hMultiplicityJPsi";
1150 ((TH1I*)fMultiplicity->FindObject(fillthis))->Fill(numberOfPrimaries);
1151 }
1152
1153 }
1154
029ed93a 1155 PostData(1,fOutput);
60eac73d 1156 if (fFillVarHists) PostData(3,fOutputMC);
1157 if (fPriorsHists) PostData(5,fAPriori);
1158 if (fMultiplicityHists) PostData(6,fMultiplicity);
1159
029ed93a 1160 PostData(4,fNentries);
1161
7eb0cc73 1162 return;
1163}
1164
1165
1166
1167//________________________________________________________________________
1168void AliAnalysisTaskSELambdac::Terminate(Option_t */*option*/)
1169{
1170 // Terminate analysis
1171 //
60eac73d 1172 if (fDebug > 1) printf("AnalysisTaskSELambdac: Terminate() \n");
7eb0cc73 1173
1174 fOutput = dynamic_cast<TList*> (GetOutputData(1));
1175 if (!fOutput) {
1176 printf("ERROR: fOutput not available\n");
1177 return;
1178 }
60eac73d 1179 //fHistNEvents = dynamic_cast<TH1F*>(fOutput->FindObject("fHistNEvents"));
7eb0cc73 1180
7eb0cc73 1181 if(fFillNtuple){
1182 fNtupleLambdac = dynamic_cast<TNtuple*>(GetOutputData(3));
1183 }
1184
7eb0cc73 1185
60eac73d 1186 return;
7eb0cc73 1187}
1188
1189//________________________________________________________________________
4c7fd068 1190Int_t AliAnalysisTaskSELambdac::MatchToMCLambdac(AliAODRecoDecayHF3Prong *d,TClonesArray *arrayMC) const{
1191 // check if the candidate is a Lambdac decaying in pKpi or in the resonant channels
7eb0cc73 1192 Int_t lambdacLab[3]={0,0,0};
1193 Int_t pdgs[3]={0,0,0};
1194 for(Int_t i=0;i<3;i++){
60eac73d 1195 AliAODTrack *daugh=(AliAODTrack*)d->GetDaughter(i);
1196 Int_t lab=daugh->GetLabel();
1197 if(lab<0) return 0;
1198 AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab);
1199 if(!part) continue;
1200 pdgs[i]=part->GetPdgCode();
1201 Int_t partPdgcode = TMath::Abs(part->GetPdgCode());
1202 if(partPdgcode==211 || partPdgcode==321 || partPdgcode==2212){
1203 Int_t motherLabel=part->GetMother();
1204 if(motherLabel<0) return 0;
1205 AliAODMCParticle *motherPart = (AliAODMCParticle*)arrayMC->At(motherLabel);
1206 if(!motherPart) continue;
1207 Int_t motherPdg = TMath::Abs(motherPart->GetPdgCode());
1208 if(motherPdg==4122) {
7eb0cc73 1209 if(GetLambdacDaugh(motherPart,arrayMC)){lambdacLab[i]=motherLabel;continue;}
60eac73d 1210 }
1211 if(motherPdg==313 || motherPdg==2224 || motherPdg==3124){
1212 Int_t GmotherLabel=motherPart->GetMother();
1213 if(GmotherLabel<0) return 0;
1214 AliAODMCParticle *GmotherPart = (AliAODMCParticle*)arrayMC->At(GmotherLabel);
1215 if(!GmotherPart) continue;
1216 Int_t GmotherPdg = TMath::Abs(GmotherPart->GetPdgCode());
1217 if(GmotherPdg==4122) {
1218 if(GetLambdacDaugh(GmotherPart,arrayMC)) {lambdacLab[i]=GmotherLabel;continue;}
7eb0cc73 1219 }
60eac73d 1220 }
1221 }
7eb0cc73 1222 }
1223
60eac73d 1224 if(lambdacLab[0]==lambdacLab[1] && lambdacLab[1]==lambdacLab[2]) {return lambdacLab[0];}
1225 return 0;
7eb0cc73 1226
1227}
1228//------------------------
4c7fd068 1229Bool_t AliAnalysisTaskSELambdac::GetLambdacDaugh(AliAODMCParticle *part,TClonesArray *arrayMC) const{
60eac73d 1230 // check if the particle is a lambdac and if its decay mode is the correct one
1231 Int_t numberOfLambdac=0;
1232 if(TMath::Abs(part->GetPdgCode())!=4122) return kFALSE;
1233 Int_t daugh_tmp[2];
1234 daugh_tmp[0]=part->GetDaughter(0);
1235 daugh_tmp[1]=part->GetDaughter(1);
1236 Int_t nDaugh = (Int_t)part->GetNDaughters();
1237 if(nDaugh<2) return kFALSE;
1238 if(nDaugh>3) return kFALSE;
1239 AliAODMCParticle* pdaugh1 = (AliAODMCParticle*)arrayMC->At(part->GetDaughter(0));
1240 if(!pdaugh1) {return kFALSE;}
1241 Int_t number1 = TMath::Abs(pdaugh1->GetPdgCode());
1242 AliAODMCParticle* pdaugh2 = (AliAODMCParticle*)arrayMC->At(part->GetDaughter(1));
1243 if(!pdaugh2) {return kFALSE;}
7eb0cc73 1244 Int_t number2 = TMath::Abs(pdaugh2->GetPdgCode());
1245
1246 if(nDaugh==3){
60eac73d 1247 Int_t thirdDaugh=part->GetDaughter(1)-1;
1248 AliAODMCParticle* pdaugh3 = (AliAODMCParticle*)arrayMC->At(thirdDaugh);
1249 Int_t number3 = TMath::Abs(pdaugh3->GetPdgCode());
1250 if((number1==321 && number2==211 && number3==2212) ||
1251 (number1==211 && number2==321 && number3==2212) ||
1252 (number1==211 && number2==2212 && number3==321) ||
1253 (number1==321 && number2==2212 && number3==211) ||
1254 (number1==2212 && number2==321 && number3==211) ||
1255 (number1==2212 && number2==211 && number3==321)) {
1256 numberOfLambdac++;
1257 }
7eb0cc73 1258 }
1259
60eac73d 1260 if(nDaugh==2){
7eb0cc73 1261
60eac73d 1262 //Lambda resonant
7eb0cc73 1263
60eac73d 1264 //Lambda -> p K*0
1265 //
1266 Int_t nfiglieK=0;
1267
1268 if((number1==2212 && number2==313)){
1269 nfiglieK=pdaugh2->GetNDaughters();
1270 if(nfiglieK!=2) return kFALSE;
1271 AliAODMCParticle* pdaughK1 = (AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(0));
1272 AliAODMCParticle* pdaughK2 = (AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(1));
1273 if(!pdaughK1) return kFALSE;
1274 if(!pdaughK2) return kFALSE;
1275 if((TMath::Abs(pdaughK1->GetPdgCode())==211 && TMath::Abs(pdaughK2->GetPdgCode())==321) || (TMath::Abs(pdaughK1->GetPdgCode())==321 && TMath::Abs(pdaughK2->GetPdgCode())==211)) numberOfLambdac++;
1276 }
1277
1278 if((number1==313 && number2==2212)){
1279 nfiglieK=pdaugh1->GetNDaughters();
1280 if(nfiglieK!=2) return kFALSE;
1281 AliAODMCParticle* pdaughK1 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(0));
1282 AliAODMCParticle* pdaughK2 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(1));
1283 if(!pdaughK1) return kFALSE;
1284 if(!pdaughK2) return kFALSE;
1285 if((TMath::Abs(pdaughK1->GetPdgCode())==211 && TMath::Abs(pdaughK2->GetPdgCode())==321) || (TMath::Abs(pdaughK1->GetPdgCode())==321 && TMath::Abs(pdaughK2->GetPdgCode())==211)) numberOfLambdac++;
7eb0cc73 1286 }
1287
60eac73d 1288 //Lambda -> Delta++ k
1289 Int_t nfiglieDelta=0;
1290 if(number1==321 && number2==2224){
1291 nfiglieDelta=pdaugh2->GetNDaughters();
1292 if(nfiglieDelta!=2) return kFALSE;
1293 AliAODMCParticle *pdaughD1=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(0));
1294 AliAODMCParticle *pdaughD2=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(1));
1295 if(!pdaughD1) return kFALSE;
1296 if(!pdaughD2) return kFALSE;
1297 if((TMath::Abs(pdaughD1->GetPdgCode())==211 && TMath::Abs(pdaughD2->GetPdgCode())==2212) || (TMath::Abs(pdaughD1->GetPdgCode())==2212 && TMath::Abs(pdaughD2->GetPdgCode())==211)) numberOfLambdac++;
1298 }
1299 if(number1==2224 && number2==321){
1300 nfiglieDelta=pdaugh1->GetNDaughters();
1301 if(nfiglieDelta!=2) return kFALSE;
1302 AliAODMCParticle* pdaughD1 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(0));
1303 AliAODMCParticle* pdaughD2 = (AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(1));
1304 if(!pdaughD1) return kFALSE;
1305 if(!pdaughD2) return kFALSE;
1306 if((TMath::Abs(pdaughD1->GetPdgCode())==211 && TMath::Abs(pdaughD2->GetPdgCode())==2212) || (TMath::Abs(pdaughD1->GetPdgCode())==2212 && TMath::Abs(pdaughD2->GetPdgCode())==211)) numberOfLambdac++;
1307 }
7eb0cc73 1308
1309
60eac73d 1310 //Lambdac -> Lambda(1520) pi
1311 Int_t nfiglieLa=0;
1312 if(number1==3124 && number2==211){
1313 nfiglieLa=pdaugh1->GetNDaughters();
1314 if(nfiglieLa!=2) return kFALSE;
1315 AliAODMCParticle *pdaughL1=(AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(0));
1316 AliAODMCParticle *pdaughL2=(AliAODMCParticle*)arrayMC->At(pdaugh1->GetDaughter(1));
1317 if(!pdaughL1) return kFALSE;
1318 if(!pdaughL2) return kFALSE;
1319 if((TMath::Abs(pdaughL1->GetPdgCode())==321 && TMath::Abs(pdaughL2->GetPdgCode())==2212) || (TMath::Abs(pdaughL1->GetPdgCode())==2212 && TMath::Abs(pdaughL2->GetPdgCode())==321)) numberOfLambdac++;
1320 }
1321 if(number1==211 && number2==3124){
1322 nfiglieLa=pdaugh2->GetNDaughters();
1323 if(nfiglieLa!=2) return kFALSE;
1324 AliAODMCParticle *pdaughL1=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(0));
1325 AliAODMCParticle *pdaughL2=(AliAODMCParticle*)arrayMC->At(pdaugh2->GetDaughter(1));
1326 if(!pdaughL1) return kFALSE;
1327 if(!pdaughL2) return kFALSE;
1328 if((TMath::Abs(pdaughL1->GetPdgCode())==321 && TMath::Abs(pdaughL2->GetPdgCode())==2212) || (TMath::Abs(pdaughL1->GetPdgCode())==2212 && TMath::Abs(pdaughL2->GetPdgCode())==321)) numberOfLambdac++;
7eb0cc73 1329
60eac73d 1330 }
1331 }
7eb0cc73 1332
60eac73d 1333 if(numberOfLambdac>0) {return kTRUE;}
1334 return kFALSE;
7eb0cc73 1335}
1336//-----------------------------
7ad4b782 1337Bool_t AliAnalysisTaskSELambdac::IspKpiMC(AliAODRecoDecayHF3Prong *d,TClonesArray *arrayMC) const{
4c7fd068 1338 // Apply MC PID
60eac73d 1339 Int_t lab[3]={0,0,0},pdgs[3]={0,0,0};
1340 for(Int_t i=0;i<3;i++){
7eb0cc73 1341 AliAODTrack *daugh=(AliAODTrack*)d->GetDaughter(i);
1342 lab[i]=daugh->GetLabel();
1343 if(lab[i]<0) return kFALSE;
1344 AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab[i]);
1345 if(!part) return kFALSE;
1346 pdgs[i]=TMath::Abs(part->GetPdgCode());
60eac73d 1347 }
7eb0cc73 1348
60eac73d 1349 if(pdgs[0]==2212 && pdgs[1]==321 && pdgs[2]==211) return kTRUE;
7eb0cc73 1350
60eac73d 1351 return kFALSE;
7eb0cc73 1352}
1353//-----------------------------
4c7fd068 1354Bool_t AliAnalysisTaskSELambdac::IspiKpMC(AliAODRecoDecayHF3Prong *d,TClonesArray *arrayMC) const{
7eb0cc73 1355
4c7fd068 1356 // Apply MC PID
60eac73d 1357 Int_t lab[3]={0,0,0},pdgs[3]={0,0,0};
1358 for(Int_t i=0;i<3;i++){
7eb0cc73 1359 AliAODTrack *daugh=(AliAODTrack*)d->GetDaughter(i);
1360 lab[i]=daugh->GetLabel();
1361 if(lab[i]<0) return kFALSE;
1362 AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab[i]);
1363 if(!part) return kFALSE;
1364 pdgs[i]=TMath::Abs(part->GetPdgCode());
60eac73d 1365 }
7eb0cc73 1366
60eac73d 1367 if(pdgs[2]==2212 && pdgs[1]==321 && pdgs[0]==211) {return kTRUE;}
7eb0cc73 1368
60eac73d 1369 return kFALSE;
7eb0cc73 1370}
1371//--------------------------------------
4c7fd068 1372Bool_t AliAnalysisTaskSELambdac::VertexingKF(AliAODRecoDecayHF3Prong *d,Int_t *pdgs,Double_t field) const{
60eac73d 1373 // apply vertexing KF
1374 Int_t iprongs[3]={0,1,2};
1375 Double_t mass[2]={0.,0.};
1376 //topological constr
1377 AliKFParticle *lambdac=d->ApplyVertexingKF(iprongs,3,pdgs,kTRUE,field,mass);
1378 if(!lambdac) return kFALSE;
1379 // Double_t probTot=TMath::Prob(Lambdac->GetChi2(),Lambdac->GetNDF());
1380 // if(probTot<fCutsKF[0]) return kFALSE;
e11ae259 1381 if(lambdac->GetChi2()>fCutsKF[0]) return kFALSE;
60eac73d 1382 //mass constr for K*
1383 Int_t ipRes[2];
1384 Int_t pdgres[2];
1385 mass[0]=0.8961;mass[1]=0.03;
1386 if(TMath::Abs(pdgs[0])==211){
7eb0cc73 1387 ipRes[0]=0;ipRes[1]=1;
1388 pdgres[0]=pdgs[0];pdgres[1]=321;
c0d01d9d 1389 }else if(TMath::Abs(pdgs[2])==211){
7eb0cc73 1390 ipRes[0]=2;ipRes[1]=1;
1391 pdgres[0]=pdgs[2];pdgres[1]=321;
c0d01d9d 1392 }else{
1393 return kFALSE;
60eac73d 1394 }
1395 AliKFParticle *kappaStar=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
7eb0cc73 1396
e11ae259 1397 Double_t probKstar=TMath::Prob(kappaStar->GetChi2(),kappaStar->GetNDF());
7eb0cc73 1398 if(probKstar>fCutsKF[1]) {
1399 AliAODTrack *esdProng1=(AliAODTrack*)d->GetDaughter(ipRes[0]);
1400 AliAODTrack *esdProng2=(AliAODTrack*)d->GetDaughter(ipRes[1]);
1401 AliKFParticle prong1(*esdProng1,pdgres[0]);
1402 AliKFParticle prong2(*esdProng2,pdgres[1]);
e11ae259 1403 if(kappaStar->GetPt()<fCutsKF[2] && prong1.GetAngle(prong2)>fCutsKF[3]) return kFALSE;
7eb0cc73 1404 }
60eac73d 1405 //mass constr for Lambda
1406 mass[0]=1.520;mass[1]=0.005;
1407 if(TMath::Abs(pdgs[0])==2212){
7eb0cc73 1408 ipRes[0]=0;ipRes[1]=1;
1409 pdgres[0]=pdgs[0];pdgres[1]=pdgs[1];
60eac73d 1410 }
1411 if(TMath::Abs(pdgs[2])==2212){
7eb0cc73 1412 ipRes[0]=2;ipRes[1]=1;
1413 pdgres[0]=pdgs[2];pdgres[1]=pdgs[1];
60eac73d 1414 }
1415 AliKFParticle *lambda1520=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
e11ae259 1416 Double_t probLa=TMath::Prob(lambda1520->GetChi2(),lambda1520->GetNDF());
7eb0cc73 1417 if(probLa>fCutsKF[4]) {
1418 AliAODTrack *esdProng1=(AliAODTrack*)d->GetDaughter(ipRes[0]);
1419 AliAODTrack *esdProng2=(AliAODTrack*)d->GetDaughter(ipRes[1]);
1420 AliKFParticle prong1(*esdProng1,pdgres[0]);
1421 AliKFParticle prong2(*esdProng2,pdgres[1]);
e11ae259 1422 if(lambda1520->GetPt()<fCutsKF[5] && prong1.GetAngle(prong2)>fCutsKF[6]) return kFALSE;
7eb0cc73 1423 }
60eac73d 1424 //mass constr for Delta
1425 mass[0]=1.2;mass[1]=0.15;
1426 ipRes[0]=0;ipRes[1]=2;
1427 pdgres[0]=pdgs[0];pdgres[1]=pdgs[2];
1428 AliKFParticle *delta=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
e11ae259 1429 Double_t probDelta=TMath::Prob(delta->GetChi2(),delta->GetNDF());
7eb0cc73 1430 if(probDelta>fCutsKF[7]) {
1431 AliAODTrack *esdProng1=(AliAODTrack*)d->GetDaughter(ipRes[0]);
1432 AliAODTrack *esdProng2=(AliAODTrack*)d->GetDaughter(ipRes[1]);
1433 AliKFParticle prong1(*esdProng1,pdgres[0]);
1434 AliKFParticle prong2(*esdProng2,pdgres[1]);
e11ae259 1435 if(delta->GetPt()<fCutsKF[8] && prong1.GetAngle(prong2)>fCutsKF[9]) return kFALSE;
7eb0cc73 1436 }
60eac73d 1437 return kTRUE;
7eb0cc73 1438}
1439//-------------------------------------
029ed93a 1440Int_t AliAnalysisTaskSELambdac::IspiKpResonant(AliAODRecoDecayHF3Prong *d,Double_t field) const{
7eb0cc73 1441
60eac73d 1442 // apply PID using the resonant channels
1443 //if lambda* -> pk
1444 Double_t mass[2]={1.520,0.005};
1445 Int_t ipRes[2]={1,2};
1446 Int_t pdgres[2]={321,2212};
1447 AliKFParticle *lambda1520=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1448 Double_t probLa=TMath::Prob(lambda1520->GetChi2(),lambda1520->GetNDF());
1449 if(probLa>0.1) return 1;
1450 //K* -> kpi
1451 mass[0]=0.8961;mass[1]=0.03;
1452 ipRes[0]=0;ipRes[1]=1;
1453 pdgres[0]=211;pdgres[1]=321;
1454 AliKFParticle *kstar=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1455 Double_t probKa=TMath::Prob(kstar->GetChi2(),kstar->GetNDF());
1456 if(probKa>0.1) return 2;
1457
1458 return 0;
7eb0cc73 1459
1460}
1461//-------------------------------------
029ed93a 1462Int_t AliAnalysisTaskSELambdac::IspKpiResonant(AliAODRecoDecayHF3Prong *d,Double_t field) const{
4c7fd068 1463
60eac73d 1464 // apply PID using the resonant channels
1465 //if lambda* -> pk
1466 Double_t mass[2]={1.520,0.005};
1467 Int_t ipRes[2]={0,1};
1468 Int_t pdgres[2]={2212,321};
1469 AliKFParticle *lambda1520=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1470 Double_t probLa=TMath::Prob(lambda1520->GetChi2(),lambda1520->GetNDF());
1471 if(probLa>0.1) return 1;
1472 //K* -> kpi
1473 mass[0]=0.8961;mass[1]=0.03;
1474 ipRes[0]=1;ipRes[1]=2;
1475 pdgres[1]=211;pdgres[0]=321;
1476 AliKFParticle *kstar=d->ApplyVertexingKF(ipRes,2,pdgres,kFALSE,field,mass);
1477 Double_t probKa=TMath::Prob(kstar->GetChi2(),kstar->GetNDF());
1478 if(probKa>0.1) return 2;
1479
1480 return 0;
029ed93a 1481
1482}
1483//---------------------------
60eac73d 1484void AliAnalysisTaskSELambdac::FillMassHists(AliAODEvent *aod,AliAODRecoDecayHF3Prong *part,
1485 TClonesArray *arrayMC, AliRDHFCutsLctopKpi *cuts)
1486{
029ed93a 1487
60eac73d 1488 //if MC PID or no PID, unset PID
1489 if(!fRealPid) cuts->SetUsePID(kFALSE);
1490 Int_t selection=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
1491 if(selection>0){
1492 Int_t iPtBin = -1;
1493 Double_t ptCand = part->Pt();
1494 Int_t index=0;
1495
1496 for(Int_t ibin=0;ibin<fNPtBins&&iPtBin<0&&ptCand>fArrayBinLimits[0]&&ptCand<fArrayBinLimits[fNPtBins];ibin++){
1497 if(ptCand<fArrayBinLimits[ibin+1])iPtBin=ibin;
029ed93a 1498 }
60eac73d 1499
1500 Float_t pdgCode=-2;
1501 Float_t pdgCode1=-1;
1502 Float_t pdgCode2=-1;
1503 Int_t labDp=-1;
1504 Float_t deltaPx=0.;
1505 Float_t deltaPy=0.;
1506 Float_t deltaPz=0.;
1507 Float_t truePt=0.;
1508 Float_t xDecay=0.;
1509 Float_t yDecay=0.;
1510 Float_t zDecay=0.;
1511
1512 if(fReadMC){
1513 labDp = MatchToMCLambdac(part,arrayMC);
1514 if(labDp>0){
1515 AliAODMCParticle *partDp = (AliAODMCParticle*)arrayMC->At(labDp);
1516 AliAODMCParticle *dg0 = (AliAODMCParticle*)arrayMC->At(partDp->GetDaughter(0));
1517 AliAODMCParticle *dg1 = (AliAODMCParticle*)arrayMC->At(partDp->GetDaughter(1));
1518 deltaPx=partDp->Px()-part->Px();
1519 deltaPy=partDp->Py()-part->Py();
1520 deltaPz=partDp->Pz()-part->Pz();
1521 truePt=partDp->Pt();
1522 xDecay=dg0->Xv();
1523 yDecay=dg0->Yv();
1524 zDecay=dg0->Zv();
1525 pdgCode=TMath::Abs(partDp->GetPdgCode());
1526 pdgCode1=TMath::Abs(dg0->GetPdgCode());
1527 pdgCode2=TMath::Abs(dg1->GetPdgCode());
1528
1529 }else{
1530 pdgCode=-1;
1531 }
029ed93a 1532 }
60eac73d 1533
1534 Double_t invMasspKpi=-1.;
1535 Double_t invMasspiKp=-1.;
1536 Double_t invMasspKpiLpi=-1.;
1537 Double_t invMasspiKpLpi=-1.;
1538 Double_t invMasspKpiKp=-1.;
1539 Double_t invMasspiKpKp=-1.;
1540 Int_t pdgs[3]={0,0,0};
1541 Double_t field=aod->GetMagneticField();
1542 //apply MC PID
1543 if(fReadMC && fMCPid){
1544
1545 if(IspKpiMC(part,arrayMC)) {
1546 invMasspKpi=part->InvMassLcpKpi();
1547 if(fUseKF){
1548 pdgs[0]=2212;pdgs[1]=321;pdgs[2]=211;
1549 if(!VertexingKF(part,pdgs,field)) invMasspKpi=-1.;
1550 }
1551 }
1552 if(IspiKpMC(part,arrayMC)) {
1553 invMasspiKp=part->InvMassLcpiKp();
1554 if(fUseKF){
1555 pdgs[0]=211;pdgs[1]=321;pdgs[2]=2212;
1556 if(!VertexingKF(part,pdgs,field)) invMasspiKp=-1.;
1557 }
1558 }
029ed93a 1559 }
60eac73d 1560
1561 // apply realistic PID
1562 if(fRealPid){
1563 if(selection==1 || selection==3) {
1564 invMasspKpi=part->InvMassLcpKpi();
1565 pdgs[0]=2212;pdgs[1]=321;pdgs[2]=211;
1566 if(fUseKF){
1567 pdgs[0]=2212;pdgs[1]=321;pdgs[2]=211;
1568 if(!VertexingKF(part,pdgs,field)) invMasspKpi=-1.;
1569 }
1570 }
1571 if(selection>=2) {
1572 invMasspiKp=part->InvMassLcpiKp();
1573 pdgs[0]=211;pdgs[1]=321;pdgs[2]=2212;
1574 if(fUseKF){
1575 pdgs[0]=211;pdgs[1]=321;pdgs[2]=2212;
1576 if(!VertexingKF(part,pdgs,field)) invMasspiKp=-1.;
1577 }
1578 }
1579 }
1580 //apply PID using resonances
1581 if (fResPid && fRealPid) {
1582 if (selection==3 || selection==1) {
1583 if (IspKpiResonant(part,field)==1) {
1584 invMasspKpiLpi=part->InvMassLcpKpi();
1585 }
1586 if(IspKpiResonant(part,field)==2){
1587 invMasspKpiKp=part->InvMassLcpKpi();
1588 }
1589 }
1590 if(selection>=2) {
1591 if(IspiKpResonant(part,field)==1){
1592 invMasspiKpLpi=part->InvMassLcpiKp();
1593 }
1594 if(IspiKpResonant(part,field)==2){
1595 invMasspiKpKp=part->InvMassLcpiKp();
1596 }
1597 }
029ed93a 1598 }
029ed93a 1599
60eac73d 1600 // no PID
1601 if(!fResPid && !fRealPid && !fMCPid){
1602 if(selection==2 || selection==3) {
1603 invMasspiKp=part->InvMassLcpiKp();
1604 if(fUseKF){
1605 pdgs[0]=211;pdgs[1]=321;pdgs[2]=2212;
1606 if(!VertexingKF(part,pdgs,field)) invMasspiKp=-1.;
1607 }
1608 }
1609 if(selection==1 || selection==3){
1610 invMasspKpi=part->InvMassLcpKpi();
1611 if(fUseKF){
1612 pdgs[0]=2212;pdgs[1]=321;pdgs[2]=211;
1613 if(!VertexingKF(part,pdgs,field)) invMasspKpi=-1.;
1614 }
1615 }
029ed93a 1616 }
029ed93a 1617
60eac73d 1618 if(invMasspiKp<0. && invMasspKpi<0.) return;
029ed93a 1619
60eac73d 1620 Int_t passTightCuts=0;
1621 if(fAnalysis) passTightCuts=fRDCutsAnalysis->IsSelected(part,AliRDHFCuts::kCandidate,aod);
1622
1623 Float_t tmp[24];
1624 if (fFillNtuple) {
1625 tmp[0]=pdgCode;
1626 tmp[1]=deltaPx;
1627 tmp[2]=deltaPy;
1628 tmp[3]=deltaPz;
1629 tmp[4]=truePt;
1630 tmp[5]=xDecay;
1631 tmp[6]=yDecay;
1632 tmp[7]=zDecay;
1633 if(pdgCode1==2212) {tmp[8]=part->PtProng(0);}else{tmp[8]=0.;}
1634 if(pdgCode1==211) {tmp[10]=part->PtProng(0);}else{tmp[10]=0.;}
1635 tmp[9]=part->PtProng(1);
1636 if(pdgCode2==211) {tmp[10]=part->PtProng(2);}else{tmp[10]=0.;}
1637 tmp[11]=part->Pt();
1638 tmp[12]=part->CosPointingAngle();
1639 tmp[13]=part->DecayLength();
1640 tmp[14]=part->Xv();
1641 tmp[15]=part->Yv();
1642 tmp[16]=part->Zv();
1643 if(invMasspiKp>0.) tmp[17]=invMasspiKp;
1644 if(invMasspKpi>0.) tmp[17]=invMasspKpi;
1645 tmp[18]=part->GetSigmaVert();
1646 tmp[19]=part->Getd0Prong(0);
1647 tmp[20]=part->Getd0Prong(1);
1648 tmp[21]=part->Getd0Prong(2);
1649 tmp[22]=part->GetDCA();
1650 tmp[23]=part->Prodd0d0();
1651 fNtupleLambdac->Fill(tmp);
1652 PostData(7,fNtupleLambdac);
1653 }
029ed93a 1654
1655 if(part->Pt()>3.){
029ed93a 1656 if(invMasspiKp>0. && invMasspKpi>0.){
60eac73d 1657 if(invMasspiKp>0.) fhMassPtGreater3->Fill(invMasspiKp,0.5);
1658 if(invMasspKpi>0.) fhMassPtGreater3->Fill(invMasspKpi,0.5);
1659 }else{
1660 if(invMasspiKp>0.) fhMassPtGreater3->Fill(invMasspiKp);
1661 if(invMasspKpi>0.) fhMassPtGreater3->Fill(invMasspKpi);
1662 }
1663 if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
1664 if(invMasspiKpLpi>0.) fhMassPtGreater3Lpi->Fill(invMasspiKpLpi,0.5);
1665 if(invMasspKpiLpi>0.) fhMassPtGreater3Lpi->Fill(invMasspKpiLpi,0.5);
1666 }else{
1667 if(invMasspiKpLpi>0.) fhMassPtGreater3Lpi->Fill(invMasspiKpLpi);
1668 if(invMasspKpiLpi>0.) fhMassPtGreater3Lpi->Fill(invMasspKpiLpi);
1669 }
1670 if(invMasspiKpKp>0. && invMasspKpiKp>0.){
1671 if(invMasspiKpKp>0.) fhMassPtGreater3Kp->Fill(invMasspiKpKp,0.5);
1672 if(invMasspKpiKp>0.) fhMassPtGreater3Kp->Fill(invMasspKpiKp,0.5);
029ed93a 1673 }else{
60eac73d 1674 if(invMasspiKpKp>0.) fhMassPtGreater3Kp->Fill(invMasspiKpKp);
1675 if(invMasspKpiKp>0.) fhMassPtGreater3Kp->Fill(invMasspKpiKp);
1676 }
1677 if(passTightCuts>0){
1678 if(invMasspiKp>0. && invMasspKpi>0.){
1679 if(invMasspiKp>0.) fhMassPtGreater3TC->Fill(invMasspiKp,0.5);
1680 if(invMasspKpi>0.) fhMassPtGreater3TC->Fill(invMasspKpi,0.5);
1681 }else{
1682 if(invMasspiKp>0.) fhMassPtGreater3TC->Fill(invMasspiKp);
1683 if(invMasspKpi>0.) fhMassPtGreater3TC->Fill(invMasspKpi);
1684 }
1685 if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
1686 if(invMasspiKpLpi>0.) fhMassPtGreater3LpiTC->Fill(invMasspiKpLpi,0.5);
1687 if(invMasspKpiLpi>0.) fhMassPtGreater3LpiTC->Fill(invMasspKpiLpi,0.5);
1688 }else{
1689 if(invMasspiKpLpi>0.) fhMassPtGreater3LpiTC->Fill(invMasspiKpLpi);
1690 if(invMasspKpiLpi>0.) fhMassPtGreater3LpiTC->Fill(invMasspKpiLpi);
1691 }
1692 if(invMasspiKpKp>0. && invMasspKpiKp>0.){
1693 if(invMasspiKpKp>0.) fhMassPtGreater3KpTC->Fill(invMasspiKpKp,0.5);
1694 if(invMasspKpiKp>0.) fhMassPtGreater3KpTC->Fill(invMasspKpiKp,0.5);
1695 }else{
1696 if(invMasspiKpKp>0.) fhMassPtGreater3KpTC->Fill(invMasspiKpKp);
1697 if(invMasspKpiKp>0.) fhMassPtGreater3KpTC->Fill(invMasspKpiKp);
1698 }
029ed93a 1699 }
029ed93a 1700 }
60eac73d 1701 if(part->Pt()>2.){
029ed93a 1702 if(invMasspiKp>0. && invMasspKpi>0.){
60eac73d 1703 if(invMasspiKp>0.) fhMassPtGreater2->Fill(invMasspiKp,0.5);
1704 if(invMasspKpi>0.) fhMassPtGreater2->Fill(invMasspKpi,0.5);
1705 }else{
1706 if(invMasspiKp>0.) fhMassPtGreater2->Fill(invMasspiKp);
1707 if(invMasspKpi>0.) fhMassPtGreater2->Fill(invMasspKpi);
1708 }
1709 if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
1710 if(invMasspiKpLpi>0.) fhMassPtGreater2Lpi->Fill(invMasspiKpLpi,0.5);
1711 if(invMasspKpiLpi>0.) fhMassPtGreater2Lpi->Fill(invMasspKpiLpi,0.5);
1712 }else{
1713 if(invMasspiKpLpi>0.) fhMassPtGreater2Lpi->Fill(invMasspiKpLpi);
1714 if(invMasspKpiLpi>0.) fhMassPtGreater2Lpi->Fill(invMasspKpiLpi);
1715 }
1716 if(invMasspiKpKp>0. && invMasspKpiKp>0.){
1717 if(invMasspiKpKp>0.) fhMassPtGreater2Kp->Fill(invMasspiKpKp,0.5);
1718 if(invMasspKpiKp>0.) fhMassPtGreater2Kp->Fill(invMasspKpiKp,0.5);
029ed93a 1719 }else{
60eac73d 1720 if(invMasspiKpKp>0.) fhMassPtGreater2Kp->Fill(invMasspiKpKp);
1721 if(invMasspKpiKp>0.) fhMassPtGreater2Kp->Fill(invMasspKpiKp);
1722 }
1723 if(passTightCuts>0){
1724 if(invMasspiKp>0. && invMasspKpi>0.){
1725 if(invMasspiKp>0.) fhMassPtGreater2TC->Fill(invMasspiKp,0.5);
1726 if(invMasspKpi>0.) fhMassPtGreater2TC->Fill(invMasspKpi,0.5);
1727 }else{
1728 if(invMasspiKp>0.) fhMassPtGreater2TC->Fill(invMasspiKp);
1729 if(invMasspKpi>0.) fhMassPtGreater2TC->Fill(invMasspKpi);
1730 }
1731 if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
1732 if(invMasspiKpLpi>0.) fhMassPtGreater2LpiTC->Fill(invMasspiKpLpi,0.5);
1733 if(invMasspKpiLpi>0.) fhMassPtGreater2LpiTC->Fill(invMasspKpiLpi,0.5);
1734 }else{
1735 if(invMasspiKpLpi>0.) fhMassPtGreater2LpiTC->Fill(invMasspiKpLpi);
1736 if(invMasspKpiLpi>0.) fhMassPtGreater2LpiTC->Fill(invMasspKpiLpi);
1737 }
1738 if(invMasspiKpKp>0. && invMasspKpiKp>0.){
1739 if(invMasspiKpKp>0.) fhMassPtGreater2KpTC->Fill(invMasspiKpKp,0.5);
1740 if(invMasspKpiKp>0.) fhMassPtGreater2KpTC->Fill(invMasspKpiKp,0.5);
1741 }else{
1742 if(invMasspiKpKp>0.) fhMassPtGreater2KpTC->Fill(invMasspiKpKp);
1743 if(invMasspKpiKp>0.) fhMassPtGreater2KpTC->Fill(invMasspKpiKp);
1744 }
029ed93a 1745 }
029ed93a 1746 }
1747
60eac73d 1748 if(iPtBin>=0){
1749 index=GetHistoIndex(iPtBin);
1750 if(invMasspiKp>0. && invMasspKpi>0.){
1751 if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp,0.5);
1752 if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi,0.5);
029ed93a 1753 }else{
60eac73d 1754 if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp);
1755 if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi);
029ed93a 1756 }
60eac73d 1757 if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
1758 if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi,0.5);
1759 if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi,0.5);
1760 }else{
1761 if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi);
1762 if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi);
1763 }
1764 if(invMasspiKpKp>0. && invMasspKpiKp>0.){
1765 if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp,0.5);
1766 if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp,0.5);
1767 }else{
1768 if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp);
1769 if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp);
1770 }
1771 if(passTightCuts>0){
1772 if(invMasspiKp>0. && invMasspKpi>0. && passTightCuts==3){
1773 if(invMasspiKp>0.) fMassHistTC[index]->Fill(invMasspiKp,0.5);
1774 if(invMasspKpi>0.) fMassHistTC[index]->Fill(invMasspKpi,0.5);
1775 }else{
1776 if(invMasspiKp>0. && passTightCuts==2) fMassHistTC[index]->Fill(invMasspiKp);
1777 if(invMasspKpi>0. && passTightCuts==1) fMassHistTC[index]->Fill(invMasspKpi);
1778 }
1779 if(invMasspiKpLpi>0. && invMasspKpiLpi>0. && passTightCuts==3){
1780 if(invMasspiKpLpi>0.) fMassHistLpiTC[index]->Fill(invMasspiKpLpi,0.5);
1781 if(invMasspKpiLpi>0.) fMassHistLpiTC[index]->Fill(invMasspKpiLpi,0.5);
1782 }else{
1783 if(invMasspiKpLpi>0. && passTightCuts==2) fMassHistLpiTC[index]->Fill(invMasspiKpLpi);
1784 if(invMasspKpiLpi>0.&& passTightCuts==1) fMassHistLpiTC[index]->Fill(invMasspKpiLpi);
1785 }
1786 if(invMasspiKpKp>0. && invMasspKpiKp>0. && passTightCuts==3){
1787 if(invMasspiKpKp>0.) fMassHistKpTC[index]->Fill(invMasspiKpKp,0.5);
1788 if(invMasspKpiKp>0.) fMassHistKpTC[index]->Fill(invMasspKpiKp,0.5);
1789 }else{
1790 if(invMasspiKpKp>0. && passTightCuts==2) fMassHistKpTC[index]->Fill(invMasspiKpKp);
1791 if(invMasspKpiKp>0.&& passTightCuts==1) fMassHistKpTC[index]->Fill(invMasspKpiKp);
1792 }
1793 }
1794 if(fReadMC){
1795 if(labDp>0) {
1796 index=GetSignalHistoIndex(iPtBin);
1797 if(invMasspiKp>0. && invMasspKpi>0.){
1798 if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp,0.5);
1799 if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi,0.5);
1800 }else{
1801 if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp);
1802 if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi);
1803 }
1804 if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
1805 if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi,0.5);
1806 if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi,0.5);
1807 }else{
1808 if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi);
1809 if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi);
1810 }
1811 if(invMasspiKpKp>0. && invMasspKpiKp>0.){
1812 if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp,0.5);
1813 if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp,0.5);
1814 }else{
1815 if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp);
1816 if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp);
1817 }
1818 if(passTightCuts>0){
1819 if(invMasspiKp>0. && invMasspKpi>0. && passTightCuts==3){
1820 if(invMasspiKp>0.) fMassHistTC[index]->Fill(invMasspiKp,0.5);
1821 if(invMasspKpi>0.) fMassHistTC[index]->Fill(invMasspKpi,0.5);
1822 }else{
1823 if(invMasspiKp>0. && passTightCuts==2) fMassHistTC[index]->Fill(invMasspiKp);
1824 if(invMasspKpi>0.&& passTightCuts==1) fMassHistTC[index]->Fill(invMasspKpi);
1825 }
1826 if(invMasspiKpLpi>0. && invMasspKpiLpi>0. && passTightCuts==3){
1827 if(invMasspiKpLpi>0.) fMassHistLpiTC[index]->Fill(invMasspiKpLpi,0.5);
1828 if(invMasspKpiLpi>0.) fMassHistLpiTC[index]->Fill(invMasspKpiLpi,0.5);
1829 }else{
1830 if(invMasspiKpLpi>0. && passTightCuts==2) fMassHistLpiTC[index]->Fill(invMasspiKpLpi);
1831 if(invMasspKpiLpi>0.&& passTightCuts==1) fMassHistLpiTC[index]->Fill(invMasspKpiLpi);
1832 }
1833 if(invMasspiKpKp>0. && invMasspKpiKp>0. && passTightCuts==3){
1834 if(invMasspiKpKp>0.) fMassHistKpTC[index]->Fill(invMasspiKpKp,0.5);
1835 if(invMasspKpiKp>0.) fMassHistKpTC[index]->Fill(invMasspKpiKp,0.5);
1836 }else{
1837 if(invMasspiKpKp>0. && passTightCuts==2) fMassHistKpTC[index]->Fill(invMasspiKpKp);
1838 if(invMasspKpiKp>0.&& passTightCuts==1) fMassHistKpTC[index]->Fill(invMasspKpiKp);
1839 }
1840 }
029ed93a 1841
60eac73d 1842 }else{
1843 index=GetBackgroundHistoIndex(iPtBin);
1844 if(invMasspiKp>0. && invMasspKpi>0.){
1845 fMassHist[index]->Fill(invMasspiKp,0.5);
1846 fMassHist[index]->Fill(invMasspKpi,0.5);
1847 }else{
1848 if(invMasspiKp>0.) fMassHist[index]->Fill(invMasspiKp);
1849 if(invMasspKpi>0.) fMassHist[index]->Fill(invMasspKpi);
1850 }
1851 if(invMasspiKpLpi>0. && invMasspKpiLpi>0.){
1852 if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi,0.5);
1853 if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi,0.5);
1854 }else{
1855 if(invMasspiKpLpi>0.) fMassHistLpi[index]->Fill(invMasspiKpLpi);
1856 if(invMasspKpiLpi>0.) fMassHistLpi[index]->Fill(invMasspKpiLpi);
1857 }
1858 if(invMasspiKpKp>0. && invMasspKpiKp>0.){
1859 if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp,0.5);
1860 if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp,0.5);
1861 }else{
1862 if(invMasspiKpKp>0.) fMassHistKp[index]->Fill(invMasspiKpKp);
1863 if(invMasspKpiKp>0.) fMassHistKp[index]->Fill(invMasspKpiKp);
1864 }
1865 if(invMasspiKp>0. && invMasspKpi>0. && passTightCuts==3){
1866 fMassHistTC[index]->Fill(invMasspiKp,0.5);
1867 fMassHistTC[index]->Fill(invMasspKpi,0.5);
1868 }else{
1869 if(invMasspiKp>0. && passTightCuts==2) fMassHistTC[index]->Fill(invMasspiKp);
1870 if(invMasspKpi>0. && passTightCuts==1) fMassHistTC[index]->Fill(invMasspKpi);
1871 }
1872 if(invMasspiKpLpi>0. && invMasspKpiLpi>0. && passTightCuts==3){
1873 if(invMasspiKpLpi>0.) fMassHistLpiTC[index]->Fill(invMasspiKpLpi,0.5);
1874 if(invMasspKpiLpi>0.) fMassHistLpiTC[index]->Fill(invMasspKpiLpi,0.5);
1875 }else{
1876 if(invMasspiKpLpi>0. && passTightCuts==2) fMassHistLpiTC[index]->Fill(invMasspiKpLpi);
1877 if(invMasspKpiLpi>0.&& passTightCuts==1) fMassHistLpiTC[index]->Fill(invMasspKpiLpi);
1878 }
1879 if(invMasspiKpKp>0. && invMasspKpiKp>0. && passTightCuts==3){
1880 if(invMasspiKpKp>0.) fMassHistKpTC[index]->Fill(invMasspiKpKp,0.5);
1881 if(invMasspKpiKp>0.) fMassHistKpTC[index]->Fill(invMasspKpiKp,0.5);
1882 }else{
1883 if(invMasspiKpKp>0. && passTightCuts==2) fMassHistKpTC[index]->Fill(invMasspiKpKp);
1884 if(invMasspKpiKp>0.&& passTightCuts==1) fMassHistKpTC[index]->Fill(invMasspKpiKp);
1885 }
1886 }
1887
1888 }
029ed93a 1889 }
029ed93a 1890 }
60eac73d 1891 return;
029ed93a 1892}
1893//-----------------------
60eac73d 1894void AliAnalysisTaskSELambdac::FillVarHists(AliAODRecoDecayHF3Prong *part,
1895 TClonesArray *arrMC,
1896 AliRDHFCutsLctopKpi *cuts,
1897 /* TList *listout,*/
1898 AliAODEvent* aod) {
029ed93a 1899 //
1900 // function used in UserExec to fill variable histograms analysing MC
1901 //
1902
60eac73d 1903 TString fillthis="";
1904
1905 Double_t mPDG=TDatabasePDG::Instance()->GetParticle(4122)->Mass();
1906 Double_t invmasscut=0.05;
029ed93a 1907
1908 Int_t pdgDgLctopKpi[3]={2212,321,211};
1909 Int_t lab=-9999;
60eac73d 1910 if(fReadMC)
1911 lab=part->MatchToMC(4122,arrMC,3,pdgDgLctopKpi); //return MC particle label if the array corresponds to a Lc, -1 if not (cf. AliAODRecoDecay.cxx)
1912
1913 Int_t isSelectedPID=cuts->IsSelectedPID(part); // 0 rejected, 1 Lc -> p K- pi+ (K at center because different sign is there),
1914 // 2 Lc -> pi+ K- p (K at center because different sign is there),
1915 // 3 both (it should never happen...)
029ed93a 1916
1917 if (isSelectedPID==0)fNentries->Fill(7);
1918 if (isSelectedPID==1)fNentries->Fill(8);
1919 if (isSelectedPID==2)fNentries->Fill(9);
1920 if (isSelectedPID==3)fNentries->Fill(10);
1921
029ed93a 1922 AliAODTrack *prong0=(AliAODTrack*)part->GetDaughter(0);
1923 AliAODTrack *prong1=(AliAODTrack*)part->GetDaughter(1);
1924 AliAODTrack *prong2=(AliAODTrack*)part->GetDaughter(2);
1925 if (!prong0 || !prong1 || !prong2) {
1926 fNentries->Fill(5);
1927 return;
1928 }
1929
60eac73d 1930 Double_t minvLcpKpi = part->InvMassLcpKpi();
1931 Double_t minvLcpiKp = part->InvMassLcpiKp();
1932
029ed93a 1933 //check pdg of the prongs
60eac73d 1934 Int_t labprong[3]={-1,-1,-1};
029ed93a 1935 if(fReadMC){
1936 labprong[0]=prong0->GetLabel();
1937 labprong[1]=prong1->GetLabel();
1938 labprong[2]=prong2->GetLabel();
1939 }
029ed93a 1940
60eac73d 1941 AliAODMCParticle *mcprong=0;
1942 Int_t pdgProngMC[3]={-1,-1,-1};
1943 if(fReadMC) {
1944 for (Int_t iprong=0;iprong<3;iprong++){
029ed93a 1945 if(labprong[iprong]<0) continue;
60eac73d 1946 mcprong = (AliAODMCParticle*)arrMC->At(labprong[iprong]);
1947 pdgProngMC[iprong]=TMath::Abs(mcprong->GetPdgCode());
1948 }
1949 }
1950
1951 Int_t pdgProngPID[3]={-1,-1,-1};
1952 if(isSelectedPID>0){
1953 pdgProngPID[1]=321;
1954 if(isSelectedPID==1) {pdgProngPID[0]=2212;pdgProngPID[2]=211;}
1955 if(isSelectedPID==2) {pdgProngPID[0]=211;pdgProngPID[2]=2212;}
1956 }
1957
1958 //fill hRealTot ---> PID efficiency denominators
1959 cuts->SetUsePID(kFALSE); //PAOLA
1960 Int_t selectionCandidate=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);//PAOLA
1961 if(fReadMC && selectionCandidate>0) { // 3prongs candidate x Lc (no PID)
1962 if(lab>0){ // Signal
1963 for (Int_t iprong=0; iprong<3; iprong++) {
1964 switch (pdgProngMC[iprong]) {
1965 case 2212:
1966 fillthis="hpRealTot";
1967 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
1968 break;
1969 case 321:
1970 fillthis="hKRealTot";
1971 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
1972 break;
1973 case 211:
1974 fillthis="hpiRealTot";
1975 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
1976 break;
1977 default:
1978 break;
1979 }
1980 }
1981 } else { // bkg
1982 for (Int_t iprong=0; iprong<3; iprong++) {
1983 switch (pdgProngMC[iprong]) {
1984 case 2212:
1985 fillthis="hbpRealTot";
1986 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
1987 break;
1988 case 321:
1989 fillthis="hbKRealTot";
1990 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
1991 break;
1992 case 211:
1993 fillthis="hbpiRealTot";
1994 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
1995 break;
1996 default:
1997 break;
1998 }
029ed93a 1999 }
2000 }
60eac73d 2001 }
029ed93a 2002
029ed93a 2003
60eac73d 2004 cuts->SetUsePID(kTRUE); //PAOLA
2005 Int_t selection=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
029ed93a 2006
60eac73d 2007 if ( (lab>0 && fReadMC) || // signal X MC
2008 (isSelectedPID>0 && !fReadMC) ) { // signal+bkg X real data
029ed93a 2009
60eac73d 2010 fillthis="hMass";
2011 if ( (fReadMC && ((AliAODMCParticle*)arrMC->At(lab))->GetPdgCode() == 4122) ||
2012 (!fReadMC && (isSelectedPID>0 && part->Charge()>0)) ) { // Lc
2013 if ( (pdgProngPID[0]==2212) && (pdgProngPID[1]==321) && (pdgProngPID[2]==211) )
2014 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpKpi); // signal+bkg X MC and real data
2015 else if ( (pdgProngPID[0]==211) && (pdgProngPID[1]==321) && (pdgProngPID[2]==2212) )
2016 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpiKp); // signal+bkg X MC and real data
029ed93a 2017 }
60eac73d 2018 else if ( (fReadMC && ((AliAODMCParticle*)arrMC->At(lab))->GetPdgCode() == -4122) ||
2019 (!fReadMC && (isSelectedPID>0 && part->Charge()<0)) ) { // anti-Lc
2020 if ( (pdgProngPID[0]==2212) && (pdgProngPID[1]==321) && (pdgProngPID[2]==211) )
2021 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpKpi); // signal+bkg X MC and real data
2022 else if ( (pdgProngPID[0]==211) && (pdgProngPID[1]==321) && (pdgProngPID[2]==2212) )
2023 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpiKp); // signal+bkg X MC and real data
029ed93a 2024 }
7eb0cc73 2025
60eac73d 2026 if (selection>0) { // 3prongs candidate x Lc (yes PID)
029ed93a 2027
2028 Double_t ptmax=0.;
60eac73d 2029
029ed93a 2030 for (Int_t iprong=0; iprong<3; iprong++) {
60eac73d 2031 if (part->PtProng(iprong)>ptmax) ptmax=part->PtProng(iprong);
2032
2033 AliAODTrack *prong = (AliAODTrack*)part->GetDaughter(iprong);
2034 AliAODPid *pidObjtrk = (AliAODPid*)prong->GetDetPid();
2035 AliAODPidHF *pidObj = (AliAODPidHF*)cuts->GetPidHF();
029ed93a 2036 Bool_t hasTOF=pidObj->CheckStatus(prong,"TOF");
2037 Bool_t hasTPC=pidObj->CheckStatus(prong,"TPC");
029ed93a 2038 Double_t tofSignal=0.;
2039 Double_t dedxTPC=0.;
2040 Double_t momTOF=0.;
2041 Double_t momTPC=0.;
2042 if(hasTOF) {
60eac73d 2043 momTOF = prong->P();
2044 tofSignal=pidObjtrk->GetTOFsignal();
029ed93a 2045 }
2046 if(hasTPC) {
60eac73d 2047 momTPC = pidObjtrk->GetTPCmomentum();
2048 dedxTPC=pidObjtrk->GetTPCsignal();
029ed93a 2049 }
60eac73d 2050 switch (pdgProngPID[iprong]) {
029ed93a 2051 case 2212:
60eac73d 2052 fillthis="hpTOFSignal";
2053 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
2054 fillthis="hpTPCSignal";
2055 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
2056 fillthis="hpptProng";
2057 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2058 fillthis="hpd0Prong";
2059 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
2060 fillthis="hpSignalVspTPC";
2061 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
2062 fillthis="hpSignalVspTOF";
2063 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
2064 AliPID::EParticleType typep;
2065 typep=AliPID::EParticleType(4);
2066 if(hasTPC) {
2067 //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typep);
2068 Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typep);
2069 fillthis="hpSigmaVspTPC";
2070 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
2071 }
2072 if(hasTOF){
2073 //Double_t nsigma=fUtilPid->NumberOfSigmasTOF(prong,typep);
2074 Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typep);
2075 fillthis="hpSigmaVspTOF";
2076 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
2077 }
2078
2079 if (fReadMC) { // fill hpIDTot ---> PID contamination denominator
2080 // hIDGood, hnoID ---> PID numerators
2081 fillthis="hpIDTot";
2082 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2083 if(pdgProngMC[iprong]==2212) { // id protons
2084 fillthis="hpIDGood";
2085 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2086 }
60eac73d 2087 else { // misidentified electrons, muons, pions and kaons
2088 fillthis="hnopIDp";
2089 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2090 }
60eac73d 2091 }
2092 break;
029ed93a 2093
029ed93a 2094 case 321:
60eac73d 2095 fillthis="hKTOFSignal";
2096 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
2097 fillthis="hKTPCSignal";
2098 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
2099 fillthis="hKptProng";
2100 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2101 fillthis="hKd0Prong";
2102 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
2103 fillthis="hKSignalVspTPC";
2104 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
2105 fillthis="hKSignalVspTOF";
2106 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
2107 AliPID::EParticleType typek;
2108 typek=AliPID::EParticleType(3);
2109 if(hasTPC) {
2110 //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typek);
2111 Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typek);
2112 fillthis="hKSigmaVspTPC";
2113 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
2114 }
2115 if(hasTOF){
2116 //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typek);
2117 Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typek); // protection against 'old' AODs...
2118 fillthis="hKSigmaVspTOF";
2119 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
2120 }
2121
2122 if (fReadMC) { // fill hKIDTot ---> PID contamination denominator
2123 // hIDGood, hnoID ---> PID numerators
2124 fillthis="hKIDTot";
2125 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2126 if(pdgProngMC[iprong]==321) { // id kaons
2127 fillthis="hKIDGood";
2128 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2129 }
60eac73d 2130 else { // misidentified electrons, muons, pions and protons
2131 fillthis="hnokIDk";
2132 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2133 }
60eac73d 2134 }
2135 break;
029ed93a 2136
029ed93a 2137 case 211:
60eac73d 2138 fillthis="hpiTOFSignal";
2139 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
2140 fillthis="hpiTPCSignal";
2141 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
2142 fillthis="hpiptProng";
2143 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2144 fillthis="hpid0Prong";
2145 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
2146 fillthis="hpiSignalVspTPC";
2147 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
2148 fillthis="hpiSignalVspTOF";
2149 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
2150 AliPID::EParticleType typepi;
2151 typepi=AliPID::EParticleType(2);
2152 if(hasTPC) {
2153 //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typepi);
2154 Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typepi);
029ed93a 2155 fillthis="hpiSigmaVspTPC";
60eac73d 2156 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
2157 }
2158 if(hasTOF){
2159 //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typepi);
2160 Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typepi); // protection against 'old' AODs...
2161 fillthis="hpiSigmaVspTOF";
2162 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
2163 }
2164
2165 if (fReadMC) { // fill hpiIDTot ---> PID contamination denominator
2166 // hIDGood, hnoID ---> PID numerators
2167 fillthis="hpiIDTot";
2168 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2169 if(pdgProngMC[iprong]==211) { // id pions
2170 fillthis="hpiIDGood";
2171 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2172 }
60eac73d 2173 else { // misidentified electrons, muons, kaons and protons
2174 fillthis="hnopiIDpi";
2175 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2176 }
60eac73d 2177 }
2178 break;
029ed93a 2179
2180 default:
2181 break;
2182 }
029ed93a 2183
2184 } //end loop on prongs
60eac73d 2185
2186 //now histograms where we don't need to check identity
029ed93a 2187 fillthis = "hDist12toPrim";
60eac73d 2188 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetDist12toPrim());
2189 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetDist23toPrim());
029ed93a 2190 fillthis = "hSigmaVert";
60eac73d 2191 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetSigmaVert());
029ed93a 2192 fillthis = "hDCAs";
2193 Double_t dcas[3];
2194 part->GetDCAs(dcas);
60eac73d 2195 for (Int_t idca=0;idca<3;idca++) ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dcas[idca]);
029ed93a 2196 fillthis = "hCosPointingAngle";
60eac73d 2197 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->CosPointingAngle());
029ed93a 2198 fillthis = "hDecayLength";
60eac73d 2199 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->DecayLength());
2200 Double_t sum2=part->Getd0Prong(0)*part->Getd0Prong(0)+
2201 part->Getd0Prong(1)*part->Getd0Prong(1)+
2202 part->Getd0Prong(2)*part->Getd0Prong(2);
029ed93a 2203 fillthis = "hSum2";
60eac73d 2204 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(sum2);
029ed93a 2205 fillthis = "hptmax";
60eac73d 2206 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(ptmax);
029ed93a 2207 fillthis="hLcpt";
60eac73d 2208 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
029ed93a 2209
60eac73d 2210 } // end if (selection)
029ed93a 2211
60eac73d 2212 } else if( lab<=0 && fReadMC) { // bkg x MC
029ed93a 2213
2214 fillthis="hbMass";
2215
60eac73d 2216 if (part->Charge()>0) { //Lc background
2217 if ( (pdgProngPID[0]==2212) && (pdgProngPID[1]==321) && (pdgProngPID[2]==211) )
2218 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpKpi); // bkg X MC
2219 else if ( (pdgProngPID[0]==211) && (pdgProngPID[1]==321) && (pdgProngPID[2]==2212) )
2220 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpiKp); // bkg X MC
2221 }
2222 else if (part->Charge()<0){ //anti-Lc background
2223 if ( (pdgProngPID[0]==2212) && (pdgProngPID[1]==321) && (pdgProngPID[2]==211) )
2224 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpKpi); // bkg X MC
2225 else if ( (pdgProngPID[0]==211) && (pdgProngPID[1]==321) && (pdgProngPID[2]==2212) )
2226 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(minvLcpiKp); // bkg X MC
029ed93a 2227 }
2228
2229
2230 //apply cut on invariant mass on the pair
60eac73d 2231 if (TMath::Abs(minvLcpKpi-mPDG)<invmasscut || TMath::Abs(minvLcpiKp-mPDG)<invmasscut) {
2232
2233 if (selection>0) { // 3prongs candidate x Lc (yes PID)
2234
2235 Double_t ptmax=0.;
2236 for (Int_t iprong=0; iprong<3; iprong++) {
2237 if(part->PtProng(iprong)>ptmax)ptmax=part->PtProng(iprong);
2238
2239 AliAODTrack *prong = (AliAODTrack*)part->GetDaughter(iprong);
2240 AliAODPid *pidObjtrk = (AliAODPid*)prong->GetDetPid();
2241 AliAODPidHF *pidObj = (AliAODPidHF*)cuts->GetPidHF();
2242 Bool_t hasTOF=pidObj->CheckStatus(prong,"TOF");
2243 Bool_t hasTPC=pidObj->CheckStatus(prong,"TPC");
2244 Double_t tofSignal=0.;
2245 Double_t dedxTPC=0.;
2246 Double_t momTOF=0.;
2247 Double_t momTPC=0.;
2248 if(hasTOF) {
2249 momTOF = prong->P();
2250 tofSignal=pidObjtrk->GetTOFsignal();
2251 }
2252 if(hasTPC) {
2253 momTPC = pidObjtrk->GetTPCmomentum();
2254 dedxTPC=pidObjtrk->GetTPCsignal();
2255 }
2256
2257 switch (pdgProngPID[iprong]) {
2258 case 2212:
029ed93a 2259 fillthis="hbpTOFSignal";
60eac73d 2260 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
029ed93a 2261 fillthis="hbpTPCSignal";
60eac73d 2262 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
029ed93a 2263 fillthis="hbpptProng";
60eac73d 2264 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2265 fillthis="hbpd0Prong";
60eac73d 2266 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
029ed93a 2267 fillthis="hbpSignalVspTPC";
60eac73d 2268 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
029ed93a 2269 fillthis="hbpSignalVspTOF";
60eac73d 2270 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
029ed93a 2271 AliPID::EParticleType typep;
2272 typep=AliPID::EParticleType(4);
2273 if(hasTPC) {
60eac73d 2274 //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typep);
2275 Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typep);
2276 fillthis="hbpSigmaVspTPC";
2277 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
029ed93a 2278 }
2279 if(hasTOF){
60eac73d 2280 //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typep);
2281 Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typep); // protection against 'old' AODs...
2282 fillthis="hbpSigmaVspTOF";
2283 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
029ed93a 2284 }
60eac73d 2285 if(fReadMC){ // fill hbpIDTot ---> PID contamination denominator
2286 // hbIDGood, hbnoID ---> PID numerators
2287 fillthis="hbpIDTot";
2288 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2289 if(pdgProngMC[iprong]==2212) { // id protons
2290 fillthis="hbpIDGood";
2291 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2292 }
60eac73d 2293 else { // misidentified electrons, muons, pions and kaons
2294 fillthis="hbnopIDp";
2295 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2296 }
2297 }
2298 break;
60eac73d 2299
2300 case 321:
029ed93a 2301 fillthis="hbKTOFSignal";
60eac73d 2302 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
029ed93a 2303 fillthis="hbKTPCSignal";
60eac73d 2304 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
029ed93a 2305 fillthis="hbKptProng";
60eac73d 2306 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2307 fillthis="hbKd0Prong";
60eac73d 2308 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
029ed93a 2309 fillthis="hbKSignalVspTPC";
60eac73d 2310 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
029ed93a 2311 fillthis="hbKSignalVspTOF";
60eac73d 2312 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
029ed93a 2313 AliPID::EParticleType typek;
2314 typek=AliPID::EParticleType(3);
2315 if(hasTPC) {
60eac73d 2316 //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typek);
2317 Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typek);
2318 fillthis="hbKSigmaVspTPC";
2319 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
029ed93a 2320 }
2321 if(hasTOF){
60eac73d 2322 //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typek);
2323 Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typek); // protection against 'old' AODs...
2324 fillthis="hbKSigmaVspTOF";
2325 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
029ed93a 2326 }
60eac73d 2327 if (fReadMC) { // fill hbKIDTot ---> PID contamination denominator
2328 // hIDGood, hnoID ---> PID numerators
2329 fillthis="hbKIDTot";
2330 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2331 if(pdgProngMC[iprong]==321) { // id kaons
2332 fillthis="hbKIDGood";
2333 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2334 }
60eac73d 2335 else { // misidentified electrons, muons, pions and protons
2336 fillthis="hbnokIDk";
2337 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2338 }
2339 }
2340 break;
60eac73d 2341
2342 case 211:
029ed93a 2343 fillthis="hbpiTOFSignal";
60eac73d 2344 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(tofSignal);
029ed93a 2345 fillthis="hbpiTPCSignal";
60eac73d 2346 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dedxTPC);
029ed93a 2347 fillthis="hbpiptProng";
60eac73d 2348 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2349 fillthis="hbpid0Prong";
60eac73d 2350 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Getd0Prong(iprong));
029ed93a 2351 fillthis="hbpiSignalVspTPC";
60eac73d 2352 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,dedxTPC);
029ed93a 2353 fillthis="hbpiSignalVspTOF";
60eac73d 2354 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,tofSignal);
029ed93a 2355 AliPID::EParticleType typepi;
2356 typepi=AliPID::EParticleType(2);
2357 if(hasTPC) {
60eac73d 2358 //Double_t nsigmap = fUtilPid->NumberOfSigmasTPC(prong,typepi);
2359 Double_t nsigmap = fPIDResponse->NumberOfSigmasTPC(prong,typepi);
2360 fillthis="hbpiSigmaVspTPC";
2361 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTPC,nsigmap);
029ed93a 2362 }
2363 if(hasTOF){
60eac73d 2364 //Double_t nsigma = fUtilPid->NumberOfSigmasTOF(prong,typepi);
2365 Double_t nsigma=fPIDResponse->NumberOfSigmasTOF(prong,typepi); // protection against 'old' AODs...
2366 fillthis="hbpiSigmaVspTOF";
2367 ((TH2F*)fOutputMC->FindObject(fillthis))->Fill(momTOF,nsigma);
029ed93a 2368 }
60eac73d 2369 if (fReadMC) { // fill hbpiIDTot ---> PID contamination denominator
2370 // hIDGood, hnonIDTot ---> PID numerators
2371 fillthis="hbpiIDTot";
2372 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
2373 if(pdgProngMC[iprong]==211) { // id pions
2374 fillthis="hbpiIDGood";
2375 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2376 }
60eac73d 2377 else { // misidentified electrons, muons, kaons and protons
2378 fillthis="hbnopiIDpi";
2379 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->PtProng(iprong));
029ed93a 2380 }
2381 }
2382 break;
029ed93a 2383
60eac73d 2384 default:
2385 break;
2386 }
2387
2388 } //end loop on prongs
2389
029ed93a 2390 //now histograms where we don't need to check identity
2391 fillthis="hbLcpt";
60eac73d 2392 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->Pt());
2393
029ed93a 2394 fillthis = "hbDist12toPrim";
60eac73d 2395 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetDist12toPrim());
2396 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetDist23toPrim());
029ed93a 2397 fillthis = "hbSigmaVert";
60eac73d 2398 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->GetSigmaVert());
029ed93a 2399 fillthis = "hbDCAs";
2400 Double_t dcas[3];
2401 part->GetDCAs(dcas);
60eac73d 2402 for (Int_t idca=0;idca<3;idca++)
2403 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(dcas[idca]);
029ed93a 2404 fillthis = "hbCosPointingAngle";
60eac73d 2405 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->CosPointingAngle());
029ed93a 2406 fillthis = "hbDecayLength";
60eac73d 2407 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(part->DecayLength());
2408 Double_t sum2=part->Getd0Prong(0)*part->Getd0Prong(0)+
2409 part->Getd0Prong(1)*part->Getd0Prong(1)+
2410 part->Getd0Prong(2)*part->Getd0Prong(2);
2411 fillthis = "hbSum2";
2412 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(sum2);
2413 fillthis = "hbptmax";
2414 ((TH1F*)fOutputMC->FindObject(fillthis))->Fill(ptmax);
029ed93a 2415
60eac73d 2416 } // end if (selection)
029ed93a 2417
60eac73d 2418 } // end mass cut
029ed93a 2419
2420 } // end background case
60eac73d 2421
029ed93a 2422 return;
60eac73d 2423
2424}
2425
2426//-------------------------
2427void AliAnalysisTaskSELambdac::FillAPrioriConcentrations(AliAODRecoDecayHF3Prong *part,
2428 AliRDHFCutsLctopKpi *cuts,
2429 AliAODEvent* aod,
2430 TClonesArray *arrMC)
2431{
2432
2433 cuts->SetUsePID(kFALSE); //Annalisa
2434 Int_t isSelected3ProngByLc=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
2435
2436 TString fillthis="";
2437
2438 if(isSelected3ProngByLc>0 && fReadMC) {
2439
2440 for (Int_t ii=0; ii<3; ii++) {
2441 AliAODTrack *prongTest=(AliAODTrack*)part->GetDaughter(ii);
2442 if (!prongTest) continue;
2443 Int_t labprongTest = prongTest->GetLabel();
2444 if(labprongTest<0) continue;
2445 AliAODMCParticle *mcprongTest = (AliAODMCParticle*)arrMC->At(labprongTest);
2446
2447 switch (TMath::Abs(mcprongTest->GetPdgCode())) {
2448 case 11:
2449 fillthis="hElIn3Prong";
2450 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2451 break;
2452 case 13:
2453 fillthis="hMuIn3Prong";
2454 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2455 break;
2456 case 211:
2457 fillthis="hPiIn3Prong";
2458 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2459 break;
2460 case 321:
2461 fillthis="hKaIn3Prong";
2462 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2463 break;
2464 case 2212:
2465 fillthis="hPrIn3Prong";
2466 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2467 break;
2468 default:
2469 break;
2470 }
2471 }
2472 }
2473
2474 cuts->SetUsePID(kTRUE); //Annalisa
2475
2476}
2477
2478//-----------------------
2479Bool_t AliAnalysisTaskSELambdac::Is3ProngFromPDG(AliAODRecoDecayHF3Prong *d,
2480 TClonesArray *arrayMC,
2481 Int_t pdgToBeCompared)
2482{
2483 //
2484 // Returs kTRUE if at least one of tracks in the current 3prong
2485 // cames from particle with pdgCode=pdgToBeCompared
2486 //
2487
2488 Bool_t localFlag = kFALSE;
2489
2490 for (Int_t ii=0;ii<3;ii++) {
2491 AliAODTrack *daugh = (AliAODTrack*)d->GetDaughter(ii);
2492
2493 Int_t lab = daugh->GetLabel();
2494 if(lab<0) continue;
2495 AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab);
2496 //Int_t partPdg = part->GetPdgCode();
2497 //printf(" -------------------------------------- partLab=%d partPdg=%d ---\n", lab, partPdg);
2498
2499 Int_t motherLabel = part->GetMother();
2500 if(motherLabel<0) continue;
2501
2502 AliAODMCParticle *motherPart = 0;
2503 Int_t motherPdg = 0;
2504 while (!localFlag && motherLabel>=0) {
2505 motherPart = (AliAODMCParticle*)arrayMC->At(motherLabel);
2506 motherPdg = motherPart->GetPdgCode();
2507 //printf(" ------------- motherLab=%d motherPdg=%d ---\n", motherLabel, motherPdg);
2508 if (TMath::Abs(motherPdg)==pdgToBeCompared) {
2509 //printf("-------------------------- trovato quark c/cbar\n");
2510 localFlag = kTRUE;
2511 }
2512 else {
2513 motherLabel = motherPart->GetMother();
2514 }
2515 }
2516
2517 }
2518
2519 return localFlag;
2520
2521}
2522
2523//-----------------------
2524Bool_t AliAnalysisTaskSELambdac::IsTrackFromPDG(AliAODTrack *daugh,
2525 TClonesArray *arrayMC,
2526 Int_t pdgToBeCompared)
2527{
2528 //
2529 // Returs kTRUE if at the tracks comes
2530 // from particle with pdgCode=pdgToBeCompared
2531 //
2532
2533 Bool_t localFlag = kFALSE;
2534
2535 Int_t lab = daugh->GetLabel();
2536 if(lab<0) return localFlag;
2537 AliAODMCParticle *part= (AliAODMCParticle*)arrayMC->At(lab);
2538 //Int_t partPdg = part->GetPdgCode();
2539 //printf(" -------------------------------------- partLab=%d partPdg=%d ---\n", lab, partPdg);
2540
2541 Int_t motherLabel = part->GetMother();
2542 if(motherLabel<0) return localFlag;
2543
2544 AliAODMCParticle *motherPart = 0;
2545 Int_t motherPdg = 0;
2546 while (!localFlag && motherLabel>=0) {
2547 motherPart = (AliAODMCParticle*)arrayMC->At(motherLabel);
2548 motherPdg = motherPart->GetPdgCode();
2549 //printf(" ------------- motherLab=%d motherPdg=%d ---\n", motherLabel, motherPdg);
2550 if (TMath::Abs(motherPdg)==pdgToBeCompared) {
2551 //printf("-------------------------- trovato quark c/cbar\n");
2552 localFlag = kTRUE;
2553 }
2554 else {
2555 motherLabel = motherPart->GetMother();
2556 }
2557 }
2558
2559 return localFlag;
2560
7eb0cc73 2561}
7ad4b782 2562
60eac73d 2563
2564
2565
2566//-----------------------
2567Bool_t AliAnalysisTaskSELambdac::IsThereAGeneratedLc(TClonesArray *arrayMC)
2568{
2569 //
2570 // Returs kTRUE if there is a lepton related to the LambdaC
2571 //
2572
2573 Bool_t localFlag = kFALSE;
2574
2575 AliAODMCParticle *searchLc;
2576
2577 for (Int_t iii=0; iii<arrayMC->GetEntries(); iii++) {
2578 searchLc = (AliAODMCParticle*)arrayMC->At(iii);
2579 Int_t searchLcpdg = searchLc->GetPdgCode();
2580 if (TMath::Abs(searchLcpdg) == 4122){
2581 localFlag = kTRUE;
2582 break;
2583 }
2584 }
2585
2586
2587 return localFlag;
2588
2589}
2590//_________________________________
2591///////////////estimate primaries
2592Int_t AliAnalysisTaskSELambdac::NumberPrimaries(AliAODEvent *aods)
2593{
2594 Int_t counter=0;
2595
2596
2597 TClonesArray *aodtracks=(TClonesArray *)aods->GetTracks();
2598
2599 // for(Int_t ji=0;ji<aods->GetNTracks();ji++)
2600 for(Int_t ji=0;ji<aodtracks->GetEntriesFast();ji++)
2601 {
2602 AliAODTrack*aodTrack=(AliAODTrack*)aodtracks->UncheckedAt(ji);
2603 if(aodTrack->IsPrimaryCandidate()) counter++;
2604 }
2605 return counter;
2606
2607}
2608//_________________________________
2609
2610void AliAnalysisTaskSELambdac::MultiplicityStudies(AliAODRecoDecayHF3Prong *part,
2611 AliRDHFCutsLctopKpi *cuts,
2612 AliAODEvent* aod,
2613 TClonesArray *arrMC,
2614 Bool_t &flag1,Bool_t &flag2,Bool_t &flag3,
2615 Bool_t &flag4, Bool_t &flag5, Bool_t &flag6)
2616{
2617
2618 TString fillthis="";
2619
2620 Int_t pdgDgLctopKpi[3]={2212,321,211};
2621 Int_t lab=-9999;
2622 if(fReadMC)
2623 lab=part->MatchToMC(4122,arrMC,3,pdgDgLctopKpi); //return MC particle label if the array corresponds to a Lc, -1 if not (cf. AliAODRecoDecay.cxx)
2624
2625 cuts->SetUsePID(kFALSE); //Annalisa
2626 Int_t isSelected3ProngByLc=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
2627
2628 if(isSelected3ProngByLc>0 && fReadMC) {
2629 flag1 = kTRUE;
2630 if (lab>0) {
2631 flag3 = kTRUE;
2632 }
2633
2634 Bool_t is3ProngFromJPsi = Is3ProngFromPDG(part,arrMC,443);
2635 if (is3ProngFromJPsi) flag6=is3ProngFromJPsi;
2636
2637 Bool_t is3ProngFromC = Is3ProngFromPDG(part,arrMC,4);
2638 if (is3ProngFromC) flag4=is3ProngFromC;
2639
2640 Bool_t is3ProngFromB = Is3ProngFromPDG(part,arrMC,5);
2641 if (is3ProngFromB) flag5=is3ProngFromB;
2642
2643 for (Int_t ii=0; ii<3; ii++) {
2644 AliAODTrack *prongTest=(AliAODTrack*)part->GetDaughter(ii);
2645 if (!prongTest) continue;
2646 Int_t labprongTest = prongTest->GetLabel();
2647 if(labprongTest<0) continue;
2648 AliAODMCParticle *mcprongTest = (AliAODMCParticle*)arrMC->At(labprongTest);
2649
2650 switch (TMath::Abs(mcprongTest->GetPdgCode())) {
2651 case 11:
2652 fillthis="hElIn3Prong";
2653 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2654 if (IsTrackFromPDG(prongTest,arrMC,443)) {
2655 fillthis="hElIn3Prong6";
2656 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2657 }
2658 break;
2659 case 13:
2660 fillthis="hMuIn3Prong";
2661 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2662 if (IsTrackFromPDG(prongTest,arrMC,443)) {
2663 fillthis="hMuIn3Prong6";
2664 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2665 }
2666 break;
2667 case 211:
2668 fillthis="hPiIn3Prong";
2669 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2670 if (IsTrackFromPDG(prongTest,arrMC,443)) {
2671 fillthis="hPiIn3Prong6";
2672 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2673 }
2674 break;
2675 case 321:
2676 fillthis="hKaIn3Prong";
2677 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2678 if (IsTrackFromPDG(prongTest,arrMC,443)) {
2679 fillthis="hKaIn3Prong6";
2680 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2681 }
2682 break;
2683 case 2212:
2684 fillthis="hPrIn3Prong";
2685 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2686 if (IsTrackFromPDG(prongTest,arrMC,443)) {
2687 fillthis="hPrIn3Prong6";
2688 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2689 }
2690 break;
2691 default:
2692 break;
2693 }
2694
2695 if (lab>0) {
2696 switch (TMath::Abs(mcprongTest->GetPdgCode())) {
2697 case 11:
2698 fillthis="hElIn3Prong1";
2699 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2700 break;
2701 case 13:
2702 fillthis="hMuIn3Prong1";
2703 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2704 break;
2705 case 211:
2706 fillthis="hPiIn3Prong1";
2707 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2708 break;
2709 case 321:
2710 fillthis="hKaIn3Prong1";
2711 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2712 break;
2713 case 2212:
2714 fillthis="hPrIn3Prong1";
2715 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2716 break;
2717 default:
2718 break;
2719 }
2720 } else {
2721 switch (TMath::Abs(mcprongTest->GetPdgCode())) {
2722 case 11:
2723 fillthis="hElIn3Prong2";
2724 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2725 if (IsTrackFromPDG(prongTest,arrMC,4)) {
2726 fillthis="hElIn3Prong3";
2727 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2728 }
2729 if (IsTrackFromPDG(prongTest,arrMC,5)) {
2730 fillthis="hElIn3Prong4";
2731 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2732 }
2733 if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
2734 fillthis="hElIn3Prong5";
2735 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2736 }
2737 break;
2738 case 13:
2739 fillthis="hMuIn3Prong2";
2740 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2741 if (IsTrackFromPDG(prongTest,arrMC,4)) {
2742 fillthis="hMuIn3Prong3";
2743 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2744 }
2745 if (IsTrackFromPDG(prongTest,arrMC,5)) {
2746 fillthis="hMuIn3Prong4";
2747 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2748 }
2749 if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
2750 fillthis="hMuIn3Prong5";
2751 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2752 }
2753 break;
2754 case 211:
2755 fillthis="hPiIn3Prong2";
2756 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2757 if (IsTrackFromPDG(prongTest,arrMC,4)) {
2758 fillthis="hPiIn3Prong3";
2759 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2760 }
2761 if (IsTrackFromPDG(prongTest,arrMC,5)) {
2762 fillthis="hPiIn3Prong4";
2763 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2764 }
2765 if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
2766 fillthis="hPiIn3Prong5";
2767 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2768 }
2769 break;
2770 case 321:
2771 fillthis="hKaIn3Prong2";
2772 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2773 if (IsTrackFromPDG(prongTest,arrMC,4)) {
2774 fillthis="hKaIn3Prong3";
2775 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2776 }
2777 if (IsTrackFromPDG(prongTest,arrMC,5)) {
2778 fillthis="hKaIn3Prong4";
2779 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2780 }
2781 if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
2782 fillthis="hKaIn3Prong5";
2783 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2784 }
2785 break;
2786 case 2212:
2787 fillthis="hPrIn3Prong2";
2788 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2789 if (IsTrackFromPDG(prongTest,arrMC,4)) {
2790 fillthis="hPrIn3Prong3";
2791 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2792 }
2793 if (IsTrackFromPDG(prongTest,arrMC,5)) {
2794 fillthis="hPrIn3Prong4";
2795 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2796 }
2797 if (!IsTrackFromPDG(prongTest,arrMC,4) && !IsTrackFromPDG(prongTest,arrMC,5)) {
2798 fillthis="hPrIn3Prong5";
2799 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2800 }
2801 break;
2802 default:
2803 break;
2804 }
2805 }
2806 /*
2807 if (is3ProngFromC) {
2808 switch (TMath::Abs(mcprongTest->GetPdgCode())) {
2809 case 11:
2810 fillthis="hElIn3Prong3";
2811 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2812 break;
2813 case 13:
2814 fillthis="hMuIn3Prong3";
2815 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2816 break;
2817 case 211:
2818 fillthis="hPiIn3Prong3";
2819 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2820 break;
2821 case 321:
2822 fillthis="hKaIn3Prong3";
2823 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2824 break;
2825 case 2212:
2826 fillthis="hPrIn3Prong3";
2827 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2828 break;
2829 default:
2830 break;
2831 }
2832 } else { // !is3ProngFromC
2833 if (is3ProngFromB) {
2834 switch (TMath::Abs(mcprongTest->GetPdgCode())) {
2835 case 11:
2836 fillthis="hElIn3Prong4";
2837 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2838 break;
2839 case 13:
2840 fillthis="hMuIn3Prong4";
2841 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2842 break;
2843 case 211:
2844 fillthis="hPiIn3Prong4";
2845 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2846 break;
2847 case 321:
2848 fillthis="hKaIn3Prong4";
2849 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2850 break;
2851 case 2212:
2852 fillthis="hPrIn3Prong4";
2853 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2854 break;
2855 default:
2856 break;
2857 }
2858 } else {//!is3ProngFromB
2859 switch (TMath::Abs(mcprongTest->GetPdgCode())) {
2860 case 11:
2861 fillthis="hElIn3Prong5";
2862 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2863 break;
2864 case 13:
2865 fillthis="hMuIn3Prong5";
2866 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2867 break;
2868 case 211:
2869 fillthis="hPiIn3Prong5";
2870 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2871 break;
2872 case 321:
2873 fillthis="hKaIn3Prong5";
2874 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2875 break;
2876 case 2212:
2877 fillthis="hPrIn3Prong5";
2878 ((TH1F*)fAPriori->FindObject(fillthis))->Fill(part->PtProng(ii));
2879 break;
2880 default:
2881 break;
2882 }
2883 }
2884 }
2885 */
2886 }
2887 }
2888
2889 Double_t mPDG=TDatabasePDG::Instance()->GetParticle(4122)->Mass();
2890 Double_t invmasscut=0.05;
2891
2892 Double_t minvLcpKpi = part->InvMassLcpKpi();
2893 Double_t minvLcpiKp = part->InvMassLcpiKp();
2894
2895 cuts->SetUsePID(kTRUE); //Annalisa
2896 Int_t isSelected3ProngByLcPID=cuts->IsSelected(part,AliRDHFCuts::kCandidate,aod);
2897 if (isSelected3ProngByLcPID>0) {
2898 if (TMath::Abs(minvLcpKpi-mPDG)<invmasscut || TMath::Abs(minvLcpiKp-mPDG)<invmasscut) {
2899 flag2 = kTRUE;
2900 }
2901 }
2902
2903
2904}