]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/AliRDHFCutsLctopKpi.cxx
Coverity
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliRDHFCutsLctopKpi.cxx
CommitLineData
e3d40058 1/**************************************************************************
2 * Copyright(c) 1998-2010, 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
e3d40058 18/////////////////////////////////////////////////////////////
19//
20// Class for cuts on AOD reconstructed Lc->pKpi
21//
22// Author: A.Dainese, andrea.dainese@pd.infn.it
23/////////////////////////////////////////////////////////////
24
25#include <TDatabasePDG.h>
26#include <Riostream.h>
4f3d14ec 27#include <AliAnalysisManager.h>
28#include <AliInputEventHandler.h>
29#include <AliPIDResponse.h>
e3d40058 30
31#include "AliRDHFCutsLctopKpi.h"
32#include "AliAODRecoDecayHF3Prong.h"
7ad4b782 33#include "AliRDHFCuts.h"
e3d40058 34#include "AliAODTrack.h"
35#include "AliESDtrack.h"
7ad4b782 36#include "AliKFParticle.h"
37#include "AliESDVertex.h"
e3d40058 38
c64cb1f6 39using std::cout;
40using std::endl;
41
e3d40058 42ClassImp(AliRDHFCutsLctopKpi)
43
44//--------------------------------------------------------------------------
a9b75906 45AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const char* name) :
7ad4b782 46AliRDHFCuts(name),
47fPidObjprot(0),
48fPidObjpion(0),
c1234468 49fUseImpParProdCorrCut(kFALSE),
50fPIDStrategy(kNSigma),
a4b982a5 51fCutsStrategy(kStandard),
52fUseSpecialCut(kFALSE)
e3d40058 53{
54 //
55 // Default Constructor
56 //
a7b533b7 57 Int_t nvars=13;
e3d40058 58 SetNVars(nvars);
a7b533b7 59 TString varNames[13]={"inv. mass [GeV]",
a8b8e864 60 "pTK [GeV/c]",
a7b533b7 61 "pTP [GeV/c]",
a8b8e864 62 "d0K [cm] lower limit!",
e3d40058 63 "d0Pi [cm] lower limit!",
64 "dist12 (cm)",
65 "sigmavert (cm)",
66 "dist prim-sec (cm)",
67 "pM=Max{pT1,pT2,pT3} (GeV/c)",
68 "cosThetaPoint",
69 "Sum d0^2 (cm^2)",
a7b533b7 70 "dca cut (cm)",
71 "cut on pTpion [GeV/c]"};
72 Bool_t isUpperCut[13]={kTRUE,
e3d40058 73 kFALSE,
74 kFALSE,
75 kFALSE,
76 kFALSE,
77 kFALSE,
78 kTRUE,
79 kFALSE,
80 kFALSE,
81 kFALSE,
82 kFALSE,
a7b533b7 83 kTRUE,
84 kFALSE
85 };
e3d40058 86 SetVarNames(nvars,varNames,isUpperCut);
a7b533b7 87 Bool_t forOpt[13]={kFALSE,
88 kTRUE,
89 kTRUE,
e3d40058 90 kFALSE,
91 kFALSE,
92 kFALSE,
93 kFALSE,
94 kTRUE,
a7b533b7 95 kFALSE,
96 kFALSE,
97 kFALSE,
98 kFALSE,
99 kTRUE};
100 SetVarsForOpt(4,forOpt);
e3d40058 101 Float_t limits[2]={0,999999999.};
102 SetPtBins(2,limits);
c1234468 103 for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies)
104 fPIDThreshold[ispecies]=0.;
e3d40058 105}
106//--------------------------------------------------------------------------
107AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const AliRDHFCutsLctopKpi &source) :
7ad4b782 108 AliRDHFCuts(source),
6572e7ce 109 fPidObjprot(0x0),
110 fPidObjpion(0x0),
c1234468 111 fUseImpParProdCorrCut(source.fUseImpParProdCorrCut),
112 fPIDStrategy(source.fPIDStrategy),
a4b982a5 113 fCutsStrategy(source.fCutsStrategy),
114 fUseSpecialCut(source.fUseSpecialCut)
e3d40058 115{
116 //
117 // Copy constructor
118 //
6572e7ce 119 if (source.fPidObjprot) fPidObjprot = new AliAODPidHF(*(source.fPidObjprot));
120 else fPidObjprot = new AliAODPidHF();
121 if (source.fPidObjpion) fPidObjpion = new AliAODPidHF(*(source.fPidObjpion));
122 else fPidObjpion = new AliAODPidHF();
f5e92b8a 123 memcpy(fPIDThreshold,source.fPIDThreshold,AliPID::kSPECIES*sizeof(Double_t));
e3d40058 124}
125//--------------------------------------------------------------------------
126AliRDHFCutsLctopKpi &AliRDHFCutsLctopKpi::operator=(const AliRDHFCutsLctopKpi &source)
127{
128 //
129 // assignment operator
130 //
f5e92b8a 131 if(this != &source) {
132
133 AliRDHFCuts::operator=(source);
134 delete fPidObjprot;
135 fPidObjprot = new AliAODPidHF(*(source.fPidObjprot));
136 delete fPidObjpion;
137 fPidObjpion = new AliAODPidHF(*(source.fPidObjpion));
138 fPIDStrategy=source.fPIDStrategy;
139 fCutsStrategy=source.fCutsStrategy;
140 memcpy(fPIDThreshold,source.fPIDThreshold,AliPID::kSPECIES*sizeof(Double_t));
141 }
142
e3d40058 143 return *this;
144}
7ad4b782 145//---------------------------------------------------------------------------
146AliRDHFCutsLctopKpi::~AliRDHFCutsLctopKpi() {
147 //
148 // // Default Destructor
149 //
150 if(fPidObjpion){
151 delete fPidObjpion;
152 fPidObjpion=0;
153 }
154 if(fPidObjprot){
155 delete fPidObjprot;
156 fPidObjprot=0;
157 }
e3d40058 158
7ad4b782 159}
e3d40058 160
161//---------------------------------------------------------------------------
e0fb900a 162void AliRDHFCutsLctopKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters, AliAODEvent *aod) {
e3d40058 163 //
164 // Fills in vars the values of the variables
165 //
166
167 if(nvars!=fnVarsForOpt) {
168 printf("AliRDHFCutsLctopKpi::GetCutsVarsForOpt: wrong number of variables\n");
169 return;
170 }
171
172 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
173
174 Int_t iter=-1;
175 if(fVarsForOpt[0]){
176 iter++;
177 vars[iter]=dd->InvMassLcpKpi();
178 }
179 if(fVarsForOpt[1]){
180 iter++;
181 for(Int_t iprong=0;iprong<3;iprong++){
a7b533b7 182 if(TMath::Abs(pdgdaughters[iprong])==321) {
e3d40058 183 vars[iter]=dd->PtProng(iprong);
184 }
185 }
186 }
187 if(fVarsForOpt[2]){
188 iter++;
189 for(Int_t iprong=0;iprong<3;iprong++){
a7b533b7 190 if(TMath::Abs(pdgdaughters[iprong])==2212) {
e3d40058 191 vars[iter]=dd->PtProng(iprong);
192 }
193 }
194 }
195 if(fVarsForOpt[3]){
196 iter++;
197 for(Int_t iprong=0;iprong<3;iprong++){
198 if(TMath::Abs(pdgdaughters[iprong])==2212) {
199 vars[iter]=dd->Getd0Prong(iprong);
200 }
201 }
202 }
203 if(fVarsForOpt[4]){
204 iter++;
205 for(Int_t iprong=0;iprong<3;iprong++){
206 if(TMath::Abs(pdgdaughters[iprong])==211) {
207 vars[iter]=dd->Getd0Prong(iprong);
208 }
209 }
210 }
211 if(fVarsForOpt[5]){
212 iter++;
213 vars[iter]=dd->GetDist12toPrim();
214 }
215 if(fVarsForOpt[6]){
216 iter++;
e0fb900a 217 vars[iter]=dd->GetSigmaVert(aod);
e3d40058 218 }
219 if(fVarsForOpt[7]){
220 iter++;
221 vars[iter] = dd->DecayLength();
222 }
223 if(fVarsForOpt[8]){
224 iter++;
225 Float_t ptmax=0;
226 for(Int_t i=0;i<3;i++){
227 if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
228 }
229 vars[iter]=ptmax;
230 }
231 if(fVarsForOpt[9]){
232 iter++;
233 vars[iter]=dd->CosPointingAngle();
234 }
235 if(fVarsForOpt[10]){
236 iter++;
237 vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
238 }
239 if(fVarsForOpt[11]){
240 iter++;
241 vars[iter]=dd->GetDCA();
242 }
a7b533b7 243 if(fVarsForOpt[12]){
244 iter++;
245 for(Int_t iprong=0;iprong<3;iprong++){
246 if(TMath::Abs(pdgdaughters[iprong])==211) {
247 vars[iter]=dd->PtProng(iprong);
248 }
249 }
250 }
e3d40058 251
252 return;
253}
254//---------------------------------------------------------------------------
7ad4b782 255Int_t AliRDHFCutsLctopKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent *aod) {
e3d40058 256 //
257 // Apply selection
258 //
259
260 if(!fCutsRD){
261 cout<<"Cut matrice not inizialized. Exit..."<<endl;
262 return 0;
263 }
264 //PrintAll();
265 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
266
267 if(!d){
268 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
269 return 0;
270 }
271
272
5e938293 273 if(fKeepSignalMC) if(IsSignalMC(d,aod,4122)) return 3;
e3d40058 274
228974b3 275 Int_t returnvalue=3;
7ad4b782 276 Int_t returnvaluePID=3;
277
47aa3d55 278 if(d->Pt()<fMinPtCand) return 0;
279 if(d->Pt()>fMaxPtCand) return 0;
e3d40058 280
3e075b37 281 if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
ba27eecd 282
c1234468 283 if(selectionLevel==AliRDHFCuts::kAll ||
284 selectionLevel==AliRDHFCuts::kCandidate||
285 selectionLevel==AliRDHFCuts::kPID) {
286 switch (fPIDStrategy) {
287 case kNSigma:
288 returnvaluePID = IsSelectedPID(d);
289
290 break;
291 case kCombined:
292 returnvaluePID = IsSelectedCombinedPID(d);
293 break;
a4b982a5 294 case kCombinedSoft:
295 returnvaluePID = IsSelectedCombinedPIDSoft(d);
296 break;
c1234468 297 }
298 fIsSelectedPID=returnvaluePID;
299 }
300 // if(fUsePID || selectionLevel==AliRDHFCuts::kPID) returnvaluePID = IsSelectedCombinedPID(d); // to test!!
301 if(returnvaluePID==0) return 0;
ba27eecd 302
e3d40058 303 // selection on candidate
304 if(selectionLevel==AliRDHFCuts::kAll ||
305 selectionLevel==AliRDHFCuts::kCandidate) {
306
307 Double_t pt=d->Pt();
308
309 Int_t ptbin=PtBin(pt);
310
311 Double_t mLcpKpi,mLcpiKp;
312 Int_t okLcpKpi=1,okLcpiKp=1;
313
314 Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
315
316 mLcpKpi=d->InvMassLcpKpi();
317 mLcpiKp=d->InvMassLcpiKp();
318
319 if(TMath::Abs(mLcpKpi-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpKpi = 0;
320 if(TMath::Abs(mLcpiKp-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpiKp = 0;
321 if(!okLcpKpi && !okLcpiKp) return 0;
322
c1234468 323 switch (fCutsStrategy) {
324
325 case kStandard:
e3d40058 326 if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;//Kaon
3875c875 327 if(d->Pt()>=3. && d->PProng(1)<0.55) return 0;
a4b982a5 328 if(fUseSpecialCut) {
329 if(TMath::Abs(d->PtProng(0)) < TMath::Abs(d->PtProng(2)) )okLcpKpi=0;
330 if(TMath::Abs(d->PtProng(2)) < TMath::Abs(d->PtProng(0)) )okLcpiKp=0;
331 }
a7b533b7 332 if((TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(12,ptbin)])) okLcpKpi=0;
333 if((TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(12,ptbin)]))okLcpiKp=0;
7ad4b782 334 if(!okLcpKpi && !okLcpiKp) return 0;
e3d40058 335 //2track cuts
336 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) return 0;
3875c875 337 if(d->GetDist12toPrim()>0.5) return 0;
338 if(d->GetDist23toPrim()>0.5) return 0;
43d2fecc 339 if(fUseImpParProdCorrCut){
340 if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.) return 0;
341 }
e0fb900a 342 //sec vert
e3d40058 343 if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
228974b3 344 if(d->DecayLength()>0.5) return 0;
c1234468 345
346 // Double_t sumd0s=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
347 // if(sumd0s<fCutsRD[GetGlobalIndex(10,ptbin)]) return 0;
348 if((d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(10,ptbin)]) return 0;
e3d40058 349
350 if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
351 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
e0fb900a 352 if(d->GetSigmaVert(aod)>fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
e3d40058 353
354 //DCA
355 for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
356
c1234468 357 break;
358
359 case kKF:
360 Int_t pdgs[3]={0,321,0};
361 Bool_t constraint=kFALSE;
362 if(fCutsRD[GetGlobalIndex(1,ptbin)]>0.) constraint=kTRUE;
363 Double_t field=aod->GetMagneticField();
364 if (returnvaluePID==1 || returnvaluePID==3){
365
82ccd919 366 pdgs[0]=2122;pdgs[2]=211;
367 AliKFParticle *lc1=ReconstructKF(d,pdgs,field,constraint);
368 if(!lc1){
369 okLcpKpi=0;
370 }else{
371 if(lc1->GetChi2()/lc1->GetNDF()>fCutsRD[GetGlobalIndex(2,ptbin)]) okLcpKpi=0;
372 }
c1234468 373 } else if(returnvaluePID>=2){
374
82ccd919 375 pdgs[0]=211;pdgs[2]=2212;
376 AliKFParticle *lc2=ReconstructKF(d,pdgs,field,constraint);
377 if(!lc2){
378 okLcpiKp=0;
379 }else{
380 if(lc2->GetChi2()/lc2->GetNDF()>fCutsRD[GetGlobalIndex(2,ptbin)])okLcpiKp=0;
381 }
c1234468 382 }
383 break;
384
385 }
e3d40058 386
387 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
388 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
389 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
dcc2ade0 390
dcc2ade0 391 }
392
dcc2ade0 393 // selection on daughter tracks
394 if(selectionLevel==AliRDHFCuts::kAll ||
395 selectionLevel==AliRDHFCuts::kTracks) {
396 if(!AreDaughtersSelected(d)) return 0;
e3d40058 397 }
dcc2ade0 398
399
7ad4b782 400 Int_t returnvalueTot=CombinePIDCuts(returnvalue,returnvaluePID);
401 return returnvalueTot;
e3d40058 402}
403//---------------------------------------------------------------------------
7ad4b782 404Int_t AliRDHFCutsLctopKpi::IsSelectedPID(AliAODRecoDecayHF* obj) {
405
406
1a141544 407 if(!fUsePID || !obj) return 3;
7ad4b782 408 Int_t okLcpKpi=0,okLcpiKp=0;
409 Int_t returnvalue=0;
410 Bool_t isPeriodd=fPidHF->GetOnePad();
a7b533b7 411 Bool_t isMC=fPidHF->GetMC();
7ad4b782 412 Bool_t ispion0=kTRUE,ispion2=kTRUE;
413 Bool_t isproton0=kFALSE,isproton2=kFALSE;
414 Bool_t iskaon1=kFALSE;
a7b533b7 415 if(isPeriodd) {
416 fPidObjprot->SetOnePad(kTRUE);
417 fPidObjpion->SetOnePad(kTRUE);
418 }
419 if(isMC) {
420 fPidObjprot->SetMC(kTRUE);
421 fPidObjpion->SetMC(kTRUE);
422 }
7ad4b782 423
4f3d14ec 424 if(fPidObjprot->GetPidResponse()==0x0){
425 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
426 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
427 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
428 fPidObjprot->SetPidResponse(pidResp);
429 }
430 if(fPidObjpion->GetPidResponse()==0x0){
431 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
432 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
433 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
434 fPidObjpion->SetPidResponse(pidResp);
435 }
436 if(fPidHF->GetPidResponse()==0x0){
437 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
438 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
439 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
440 fPidHF->SetPidResponse(pidResp);
441 }
442
7ad4b782 443 for(Int_t i=0;i<3;i++){
444 AliAODTrack *track=(AliAODTrack*)obj->GetDaughter(i);
445 if(!track) return 0;
446 // identify kaon
3875c875 447 if(track->P()<0.55){
448 fPidHF->SetTOF(kFALSE);
449 fPidHF->SetTOFdecide(kFALSE);
450 }
7ad4b782 451 if(i==1) {
452 Int_t isKaon=fPidHF->MakeRawPid(track,3);
a4b982a5 453 if(isKaon>=1) iskaon1=kTRUE;
454 if(track->P()<0.55){
455 fPidHF->SetTOF(kTRUE);
456 fPidHF->SetTOFdecide(kTRUE);
7ad4b782 457 }
a4b982a5 458
47aa3d55 459 if(!iskaon1) return 0;
7ad4b782 460
461 }else{
462 //pion or proton
3875c875 463 if(track->P()<1.){
464 fPidObjprot->SetTOF(kFALSE);
465 fPidObjprot->SetTOFdecide(kFALSE);
466 }
7ad4b782 467
468 Int_t isProton=fPidObjprot->MakeRawPid(track,4);
a4b982a5 469
7ad4b782 470
471 Int_t isPion=fPidObjpion->MakeRawPid(track,2);
a4b982a5 472
3875c875 473 if(track->P()<1.){
474 fPidObjprot->SetTOF(kTRUE);
475 fPidObjprot->SetTOFdecide(kTRUE);
476 }
a4b982a5 477
7ad4b782 478
479 if(i==0) {
480 if(isPion<0) ispion0=kFALSE;
481 if(isProton>=1) isproton0=kTRUE;
482
483 }
47aa3d55 484 if(!ispion0 && !isproton0) return 0;
7ad4b782 485 if(i==2) {
486 if(isPion<0) ispion2=kFALSE;
487 if(isProton>=1) isproton2=kTRUE;
488 }
489
490 }
491 }
492
493 if(ispion2 && isproton0 && iskaon1) okLcpKpi=1;
494 if(ispion0 && isproton2 && iskaon1) okLcpiKp=1;
495 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
496 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
497 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
498
499 return returnvalue;
500}
11690a06 501//---------------------------------------------------------------------------
502Int_t AliRDHFCutsLctopKpi::IsSelectedCombinedPID(AliAODRecoDecayHF* obj) {
503
504 // Printf(" -------- IsSelectedCombinedPID --------------");
505
c1234468 506
507 if(!fUsePID || !obj) {return 3;}
11690a06 508 Int_t okLcpKpi=0,okLcpiKp=0;
509 Int_t returnvalue=0;
510 Bool_t isPeriodd=fPidHF->GetOnePad();
511 Bool_t isMC=fPidHF->GetMC();
11690a06 512
513 if(isPeriodd) {
514 fPidObjprot->SetOnePad(kTRUE);
515 fPidObjpion->SetOnePad(kTRUE);
516 }
517 if(isMC) {
518 fPidObjprot->SetMC(kTRUE);
519 fPidObjpion->SetMC(kTRUE);
520 }
521
c1234468 522 AliVTrack *track0=dynamic_cast<AliVTrack*>(obj->GetDaughter(0));
523 AliVTrack *track1=dynamic_cast<AliVTrack*>(obj->GetDaughter(1));
524 AliVTrack *track2=dynamic_cast<AliVTrack*>(obj->GetDaughter(2));
525 if (!track0 || !track1 || !track2) return 0;
526 Double_t prob0[AliPID::kSPECIES];
527 Double_t prob1[AliPID::kSPECIES];
528 Double_t prob2[AliPID::kSPECIES];
3875c875 529 if(obj->Pt()<3. && track0->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
c1234468 530 fPidHF->GetPidCombined()->ComputeProbabilities(track0,fPidHF->GetPidResponse(),prob0);
3875c875 531 if(obj->Pt()<3. && track0->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
532
533 if(obj->Pt()<3. && track1->P()<0.55) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
c1234468 534 fPidHF->GetPidCombined()->ComputeProbabilities(track1,fPidHF->GetPidResponse(),prob1);
3875c875 535 if(obj->Pt()<3. && track1->P()<0.55) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
536
537 if(obj->Pt()<3. && track2->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
c1234468 538 fPidHF->GetPidCombined()->ComputeProbabilities(track2,fPidHF->GetPidResponse(),prob2);
3875c875 539 if(obj->Pt()<3. && track2->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
540
c1234468 541 if(fPIDThreshold[AliPID::kPion]>0. && fPIDThreshold[AliPID::kKaon]>0. && fPIDThreshold[AliPID::kProton]>0.){
542 okLcpiKp= (prob0[AliPID::kPion ]>fPIDThreshold[AliPID::kPion ])
543 &&(prob1[AliPID::kKaon ]>fPIDThreshold[AliPID::kKaon ])
544 &&(prob2[AliPID::kProton]>fPIDThreshold[AliPID::kProton]);
545 okLcpKpi= (prob0[AliPID::kProton]>fPIDThreshold[AliPID::kProton])
546 &&(prob1[AliPID::kKaon ]>fPIDThreshold[AliPID::kKaon ])
547 &&(prob2[AliPID::kPion ]>fPIDThreshold[AliPID::kPion ]);
548 }else{
11690a06 549 //pion or proton
550
11690a06 551
c1234468 552 if(TMath::MaxElement(AliPID::kSPECIES,prob1) == prob1[AliPID::kKaon]){
553 if(TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kPion]) okLcpKpi = 1;
554 if(TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kPion]) okLcpiKp = 1;
11690a06 555 }
c1234468 556 }
11690a06 557
558 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
559 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
560 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
561
562 return returnvalue;
563}
7ad4b782 564//-----------------------
565Int_t AliRDHFCutsLctopKpi::CombinePIDCuts(Int_t returnvalue, Int_t returnvaluePID) const {
566
567 Int_t returnvalueTot=0;
568 Int_t okLcpKpi=0,okLcpiKp=0;
569 if(returnvaluePID==1){
570 if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
571 }
572 if(returnvaluePID==2){
573 if(returnvalue>=2) okLcpiKp=1;
574 }
575 if(returnvaluePID==3 && returnvalue>0){
576 if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
577 if(returnvalue>=2) okLcpiKp=1;
578 }
579
580 if(okLcpKpi) returnvalueTot=1; //cuts passed as Lc->pKpi
581 if(okLcpiKp) returnvalueTot=2; //cuts passed as Lc->piKp
582 if(okLcpKpi && okLcpiKp) returnvalueTot=3; //cuts passed as both pKpi and piKp
583 return returnvalueTot;
584}
585//----------------------------------
586void AliRDHFCutsLctopKpi::SetStandardCutsPP2010() {
587
588 SetName("LctopKpiProdCuts");
589 SetTitle("Production cuts for Lc analysis");
590
591 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
592 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
593 esdTrackCuts->SetRequireTPCRefit(kTRUE);
594 esdTrackCuts->SetMinNClustersTPC(70);
595 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
596 AliESDtrackCuts::kAny);
597 esdTrackCuts->SetRequireITSRefit(kTRUE);
598 esdTrackCuts->SetMinNClustersITS(4);
599 esdTrackCuts->SetMinDCAToVertexXY(0.);
600 esdTrackCuts->SetEtaRange(-0.8,0.8);
601 esdTrackCuts->SetPtRange(0.3,1.e10);
602 AddTrackCuts(esdTrackCuts);
603
604 const Int_t nptbins=4;
a7b533b7 605 const Int_t nvars=13;
7ad4b782 606 Float_t* ptbins;
607 ptbins=new Float_t[nptbins+1];
608
609 ptbins[0]=0.;
610 ptbins[1]=2.;
611 ptbins[2]=3.;
612 ptbins[3]=4.;
613 ptbins[4]=9999.;
614
615 SetGlobalIndex(nvars,nptbins);
616 SetPtBins(nptbins+1,ptbins);
617
618 Float_t** prodcutsval;
619 prodcutsval=new Float_t*[nvars];
620 for(Int_t iv=0;iv<nvars;iv++){
621 prodcutsval[iv]=new Float_t[nptbins];
622 }
e11ae259 623
7ad4b782 624 for(Int_t ipt=0;ipt<nptbins;ipt++){
625 prodcutsval[0][ipt]=0.18;
626 prodcutsval[1][ipt]=0.4;
627 prodcutsval[2][ipt]=0.5;
628 prodcutsval[3][ipt]=0.;
629 prodcutsval[4][ipt]=0.;
630 prodcutsval[5][ipt]=0.01;
631 prodcutsval[6][ipt]=0.06;
632 prodcutsval[7][ipt]=0.005;
633 prodcutsval[8][ipt]=0.;
634 prodcutsval[9][ipt]=0.;
635 prodcutsval[10][ipt]=0.;
636 prodcutsval[11][ipt]=0.05;
a7b533b7 637 prodcutsval[12][ipt]=0.4;
7ad4b782 638 }
639 SetCuts(nvars,nptbins,prodcutsval);
640
641 AliAODPidHF* pidObjK=new AliAODPidHF();
642 Double_t sigmasK[5]={3.,1.,1.,3.,2.};
643 pidObjK->SetSigma(sigmasK);
644 pidObjK->SetAsym(kTRUE);
645 pidObjK->SetMatch(1);
646 pidObjK->SetTPC(kTRUE);
647 pidObjK->SetTOF(kTRUE);
648 pidObjK->SetITS(kTRUE);
649 Double_t plimK[2]={0.5,0.8};
650 pidObjK->SetPLimit(plimK,2);
a7b533b7 651 pidObjK->SetTOFdecide(kTRUE);
7ad4b782 652
653 SetPidHF(pidObjK);
654
655 AliAODPidHF* pidObjpi=new AliAODPidHF();
656 pidObjpi->SetTPC(kTRUE);
657 Double_t sigmaspi[5]={3.,0.,0.,0.,0.};
658 pidObjpi->SetSigma(sigmaspi);
a7b533b7 659 pidObjpi->SetTOFdecide(kTRUE);
7ad4b782 660 SetPidpion(pidObjpi);
661
662 AliAODPidHF* pidObjp=new AliAODPidHF();
663 Double_t sigmasp[5]={3.,1.,1.,3.,2.};
664 pidObjp->SetSigma(sigmasp);
665 pidObjp->SetAsym(kTRUE);
666 pidObjp->SetMatch(1);
667 pidObjp->SetTPC(kTRUE);
668 pidObjp->SetTOF(kTRUE);
669 pidObjp->SetITS(kTRUE);
670 Double_t plimp[2]={1.,2.};
671 pidObjp->SetPLimit(plimp,2);
a7b533b7 672 pidObjp->SetTOFdecide(kTRUE);
7ad4b782 673
674 SetPidprot(pidObjp);
675
676 SetUsePID(kTRUE);
677
678 PrintAll();
679
e11ae259 680 for(Int_t iiv=0;iiv<nvars;iiv++){
681 delete [] prodcutsval[iiv];
682 }
683 delete [] prodcutsval;
684 prodcutsval=NULL;
685 delete [] ptbins;
686 ptbins=NULL;
687
688 delete pidObjp;
689 pidObjp=NULL;
690
7ad4b782 691 return;
692}
a8b8e864 693//------------------
694void AliRDHFCutsLctopKpi::SetStandardCutsPbPb2010() {
695
696 SetName("LctopKpiProdCuts");
697 SetTitle("Production cuts for Lc analysis");
698
699 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
700
701 esdTrackCuts->SetRequireTPCRefit(kTRUE);
702 esdTrackCuts->SetMinNClustersTPC(70);
703 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
704 AliESDtrackCuts::kAny);
705 esdTrackCuts->SetRequireITSRefit(kTRUE);
706 esdTrackCuts->SetMinNClustersITS(4);
707 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0100*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
708 esdTrackCuts->SetEtaRange(-0.8,0.8);
709 esdTrackCuts->SetMaxDCAToVertexXY(1.);
710 esdTrackCuts->SetMaxDCAToVertexZ(1.);
711 esdTrackCuts->SetPtRange(0.8,1.e10);
712 AddTrackCuts(esdTrackCuts);
713
714 const Int_t nptbins=4;
a7b533b7 715 const Int_t nvars=13;
a8b8e864 716 Float_t* ptbins;
717 ptbins=new Float_t[nptbins+1];
718
719 ptbins[0]=0.;
720 ptbins[1]=2.;
721 ptbins[2]=3.;
722 ptbins[3]=4.;
723 ptbins[4]=9999.;
724
725 SetGlobalIndex(nvars,nptbins);
726 SetPtBins(nptbins+1,ptbins);
727
728 Float_t** prodcutsval;
729 prodcutsval=new Float_t*[nvars];
730 for(Int_t iv=0;iv<nvars;iv++){
731 prodcutsval[iv]=new Float_t[nptbins];
732 }
733
734 for(Int_t ipt=0;ipt<nptbins;ipt++){
735 prodcutsval[0][ipt]=0.13;
736 prodcutsval[1][ipt]=0.5;
737 prodcutsval[2][ipt]=0.6;
738 prodcutsval[3][ipt]=0.;
739 prodcutsval[4][ipt]=0.;
740 prodcutsval[5][ipt]=0.01;
741 prodcutsval[6][ipt]=0.04;
742 prodcutsval[7][ipt]=0.006;
743 prodcutsval[8][ipt]=0.8;
744 prodcutsval[9][ipt]=0.3;
745 prodcutsval[10][ipt]=0.;
746 prodcutsval[11][ipt]=0.05;
a7b533b7 747 prodcutsval[12][ipt]=0.4;
a8b8e864 748 }
749 SetCuts(nvars,nptbins,prodcutsval);
750
751 AliAODPidHF* pidObjK=new AliAODPidHF();
752 Double_t sigmasK[5]={3.,1.,1.,3.,2.};
753 pidObjK->SetSigma(sigmasK);
754 pidObjK->SetAsym(kTRUE);
755 pidObjK->SetMatch(1);
756 pidObjK->SetTPC(kTRUE);
757 pidObjK->SetTOF(kTRUE);
758 pidObjK->SetITS(kTRUE);
759 Double_t plimK[2]={0.5,0.8};
760 pidObjK->SetPLimit(plimK,2);
761
762 SetPidHF(pidObjK);
763
764 AliAODPidHF* pidObjpi=new AliAODPidHF();
765 pidObjpi->SetTPC(kTRUE);
766 Double_t sigmaspi[5]={3.,0.,0.,0.,0.};
767 pidObjpi->SetSigma(sigmaspi);
768 SetPidpion(pidObjpi);
7ad4b782 769
a8b8e864 770 AliAODPidHF* pidObjp=new AliAODPidHF();
771 Double_t sigmasp[5]={3.,1.,1.,3.,2.};
772 pidObjp->SetSigma(sigmasp);
773 pidObjp->SetAsym(kTRUE);
774 pidObjp->SetMatch(1);
775 pidObjp->SetTPC(kTRUE);
776 pidObjp->SetTOF(kTRUE);
777 pidObjp->SetITS(kTRUE);
778 Double_t plimp[2]={1.,2.};
779 pidObjp->SetPLimit(plimp,2);
780
781 SetPidprot(pidObjp);
782
783 SetUsePID(kTRUE);
784
785 PrintAll();
786
787 for(Int_t iiv=0;iiv<nvars;iiv++){
788 delete [] prodcutsval[iiv];
789 }
790 delete [] prodcutsval;
791 prodcutsval=NULL;
792 delete [] ptbins;
793 ptbins=NULL;
794
795 delete pidObjp;
796 pidObjp=NULL;
797
798 return;
799}
7ad4b782 800//------------------
c1234468 801AliKFParticle* AliRDHFCutsLctopKpi::ReconstructKF(AliAODRecoDecayHF3Prong *d,Int_t *pdgs,Double_t field,Bool_t constraint) const{
cc4bd7b4 802 // Method to construct the KF particle from the candidate
16d0e822 803
c1234468 804 const Int_t nprongs=d->GetNProngs();
5da7eaa9 805 if(nprongs<=0) return 0x0;
82ccd919 806
7ad4b782 807 Int_t iprongs[nprongs];
808 for(Int_t i=0;i<nprongs;i++) iprongs[i]=i;
809
810 Double_t mass[2]={0.,0.};
811
c1234468 812 AliKFParticle *decay=d->ApplyVertexingKF(iprongs,nprongs,pdgs,constraint,field,mass);
813 if(!decay) return 0x0;
7ad4b782 814 AliESDVertex *vertexESD = new AliESDVertex(decay->Parameters(),
815 decay->CovarianceMatrix(),
816 decay->GetChi2(),
817 nprongs);
818 Double_t pos[3],cov[6],chi2perNDF;
819 vertexESD->GetXYZ(pos);
820 vertexESD->GetCovMatrix(cov);
821 chi2perNDF = vertexESD->GetChi2toNDF();
822 delete vertexESD; vertexESD=NULL;
823 AliAODVertex *vertexAOD = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,nprongs);
824 d->SetSecondaryVtx(vertexAOD);
c1234468 825 return decay;
826}
827
0c22e2ac 828//------------------
829void AliRDHFCutsLctopKpi::SetStandardCutsPbPb2011() {
830
831 // Default 2010 PbPb cut object
832 SetStandardCutsPbPb2010();
833
834 //
835 // Enable all 2011 PbPb run triggers
836 //
837 SetTriggerClass("");
838 ResetMaskAndEnableMBTrigger();
839 EnableCentralTrigger();
840 EnableSemiCentralTrigger();
841}
c1234468 842//-----------------
843
844Bool_t AliRDHFCutsLctopKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
845{
846 //
847 // // Checking if Dplus is in fiducial acceptance region
848 // //
849 //
850 if(pt > 5.) {
851 // applying cut for pt > 5 GeV
852 AliDebug(2,Form("pt of D+ = %f (> 5), cutting at |y| < 0.8",pt));
853 if (TMath::Abs(y) > 0.8) return kFALSE;
854
855 } else {
856 // appliying smooth cut for pt < 5 GeV
857 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
858 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
859 AliDebug(2,Form("pt of D+ = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
860 if (y < minFiducialY || y > maxFiducialY) return kFALSE;
861 }
862 //
863 return kTRUE;
7ad4b782 864}
a4b982a5 865//--------------------------------------------------------
866Int_t AliRDHFCutsLctopKpi::IsSelectedCombinedPIDSoft(AliAODRecoDecayHF* obj) {
867 if(!fUsePID || !obj) {return 3;}
868 Int_t okLcpKpi=0,okLcpiKp=0;
869 Int_t returnvalue=0;
870
871 AliVTrack *track0=dynamic_cast<AliVTrack*>(obj->GetDaughter(0));
872 AliVTrack *track1=dynamic_cast<AliVTrack*>(obj->GetDaughter(1));
873 AliVTrack *track2=dynamic_cast<AliVTrack*>(obj->GetDaughter(2));
874 if (!track0 || !track1 || !track2) return 0;
875 Double_t prob0[AliPID::kSPECIES];
876 Double_t prob1[AliPID::kSPECIES];
877 Double_t prob2[AliPID::kSPECIES];
878
879 Bool_t isTOF0=fPidHF->CheckTOFPIDStatus((AliAODTrack*)obj->GetDaughter(0));
880 Bool_t isTOF1=fPidHF->CheckTOFPIDStatus((AliAODTrack*)obj->GetDaughter(1));
881 Bool_t isTOF2=fPidHF->CheckTOFPIDStatus((AliAODTrack*)obj->GetDaughter(2));
882
883Bool_t isK1=kFALSE;
884 if(isTOF1){ //kaon
885 if(track1->P()<1.8) {
886 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
887 if(obj->Pt()<3. && track1->P()<0.55) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
888 fPidHF->GetPidCombined()->ComputeProbabilities(track1,fPidHF->GetPidResponse(),prob1);
889
890 }else{
891 AliAODTrack *trackaod1=(AliAODTrack*)(obj->GetDaughter(1));
892 if(trackaod1->P()<0.55){
893 fPidHF->SetTOF(kFALSE);
894 fPidHF->SetTOFdecide(kFALSE);
895 }
896 Int_t isKaon=fPidHF->MakeRawPid(trackaod1,3);
897 if(isKaon>=1) isK1=kTRUE;
898 if(trackaod1->P()<0.55){
899 fPidHF->SetTOF(kTRUE);
900 fPidHF->SetTOFdecide(kTRUE);
901 }
902 }
903 }else{
904 if(track1->P()<0.8){
905 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
906 fPidHF->GetPidCombined()->ComputeProbabilities(track1,fPidHF->GetPidResponse(),prob0);
907 }else{
908 AliAODTrack *trackaod1=(AliAODTrack*)(obj->GetDaughter(1));
909 if(trackaod1->P()<0.55){
910 fPidHF->SetTOF(kFALSE);
911 fPidHF->SetTOFdecide(kFALSE);
912 }
913 Int_t isKaon=fPidHF->MakeRawPid(trackaod1,3);
914 if(isKaon>=1) isK1=kTRUE;
915 if(trackaod1->P()<0.55){
916 fPidHF->SetTOF(kTRUE);
917 fPidHF->SetTOFdecide(kTRUE);
918 }
919 }
920 }
921
922 Bool_t ispi0=kFALSE;
923 Bool_t isp0=kFALSE;
924 Bool_t ispi2=kFALSE;
925 Bool_t isp2=kFALSE;
926
927 if(isTOF0){ //proton
928 if(track0->P()<2.2) {
929 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
930 if(obj->Pt()<3. && track0->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
931 fPidHF->GetPidCombined()->ComputeProbabilities(track0,fPidHF->GetPidResponse(),prob0);
932 }else{
933 AliAODTrack *trackaod0=(AliAODTrack*)(obj->GetDaughter(0));
934 if(trackaod0->P()<1.){
935 fPidObjprot->SetTOF(kFALSE);
936 fPidObjprot->SetTOFdecide(kFALSE);
937 }
938 Int_t isProton=fPidObjprot->MakeRawPid(trackaod0,4);
939 if(isProton>=1) isp0=kTRUE;
940 if(trackaod0->P()<1.){
941 fPidObjprot->SetTOF(kTRUE);
942 fPidObjprot->SetTOFdecide(kTRUE);
943 }
944 }
945 }else{
946 if(track0->P()<1.2){
947 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
948 fPidHF->GetPidCombined()->ComputeProbabilities(track0,fPidHF->GetPidResponse(),prob0);
949 }else{
950 AliAODTrack *trackaod0=(AliAODTrack*)(obj->GetDaughter(0));
951 if(trackaod0->P()<1.){
952 fPidObjprot->SetTOF(kFALSE);
953 fPidObjprot->SetTOFdecide(kFALSE);
954 }
955 Int_t isProton=fPidObjprot->MakeRawPid(trackaod0,4);
956 if(isProton>=1) isp0=kTRUE;
957 if(trackaod0->P()<1.){
958 fPidObjprot->SetTOF(kTRUE);
959 fPidObjprot->SetTOFdecide(kTRUE);
960 }
961 }
962 }
963
964 if(isTOF2){ //proton
965 if(track2->P()<2.2) {
966 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
967 if(obj->Pt()<3. && track2->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
968 fPidHF->GetPidCombined()->ComputeProbabilities(track2,fPidHF->GetPidResponse(),prob2);
969 }else{
970 AliAODTrack *trackaod2=(AliAODTrack*)(obj->GetDaughter(2));
971 if(trackaod2->P()<1.){
972 fPidObjprot->SetTOF(kFALSE);
973 fPidObjprot->SetTOFdecide(kFALSE);
974 }
975 Int_t isProton=fPidObjprot->MakeRawPid(trackaod2,4);
976 if(isProton>=1) isp2=kTRUE;
977 if(trackaod2->P()<1.){
978 fPidObjprot->SetTOF(kTRUE);
979 fPidObjprot->SetTOFdecide(kTRUE);
980 }
981 }
982 }else{
983 if(track2->P()<1.2){
984 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
985 fPidHF->GetPidCombined()->ComputeProbabilities(track2,fPidHF->GetPidResponse(),prob2);
986 }else{
987 AliAODTrack *trackaod2=(AliAODTrack*)(obj->GetDaughter(2));
988 if(trackaod2->P()<1.){
989 fPidObjprot->SetTOF(kFALSE);
990 fPidObjprot->SetTOFdecide(kFALSE);
991 }
992 Int_t isProton=fPidObjprot->MakeRawPid(trackaod2,4);
993 if(isProton>=1) isp2=kTRUE;
994 if(trackaod2->P()<1.){
995 fPidObjprot->SetTOF(kTRUE);
996 fPidObjprot->SetTOFdecide(kTRUE);
997 }
998 }
999 }
1000 AliAODTrack *trackaod2=(AliAODTrack*)(obj->GetDaughter(2));
1001 if(fPidObjpion->MakeRawPid(trackaod2,2)>=1)ispi2=kTRUE;
1002 AliAODTrack *trackaod0=(AliAODTrack*)(obj->GetDaughter(2));
1003 if(fPidObjpion->MakeRawPid(trackaod0,2)>=1)ispi0=kTRUE;
1004
1005 if(TMath::MaxElement(AliPID::kSPECIES,prob1) == prob1[AliPID::kKaon]){
a8b8e864 1006
a4b982a5 1007 if(TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kPion]) okLcpKpi = 1;
1008 if(TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kPion]) okLcpiKp = 1;
1009 }
1010
1011 if(!isK1 && TMath::MaxElement(AliPID::kSPECIES,prob1) == prob1[AliPID::kKaon]) isK1=kTRUE;
1012 if(!ispi0 && TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kPion]) ispi0=kTRUE;
1013 if(!ispi2 && TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kPion]) ispi2=kTRUE;
1014 if(!isp0 && TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kProton]) isp0=kTRUE;
1015 if(!isp2 && TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kProton]) isp2=kTRUE;
1016 if(isK1 && ispi0 && isp2) okLcpiKp = 1;
1017 if(isK1 && isp0 && ispi2) okLcpKpi = 1;
1018
1019 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
1020 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
1021 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
1022
1023 return returnvalue;
1024
1025
1026}