]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/AliRDHFCutsLctopKpi.cxx
Updates in Lc->V0bachelor analysis (Annalisa)
[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;
ef5f00b2 297 case kNSigmaStrong:
298 returnvaluePID = IsSelectedPIDStrong(d);
c1234468 299 }
300 fIsSelectedPID=returnvaluePID;
301 }
302 // if(fUsePID || selectionLevel==AliRDHFCuts::kPID) returnvaluePID = IsSelectedCombinedPID(d); // to test!!
303 if(returnvaluePID==0) return 0;
ba27eecd 304
e3d40058 305 // selection on candidate
306 if(selectionLevel==AliRDHFCuts::kAll ||
307 selectionLevel==AliRDHFCuts::kCandidate) {
308
309 Double_t pt=d->Pt();
310
311 Int_t ptbin=PtBin(pt);
312
313 Double_t mLcpKpi,mLcpiKp;
314 Int_t okLcpKpi=1,okLcpiKp=1;
315
316 Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
317
318 mLcpKpi=d->InvMassLcpKpi();
319 mLcpiKp=d->InvMassLcpiKp();
320
321 if(TMath::Abs(mLcpKpi-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpKpi = 0;
322 if(TMath::Abs(mLcpiKp-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpiKp = 0;
323 if(!okLcpKpi && !okLcpiKp) return 0;
324
c1234468 325 switch (fCutsStrategy) {
326
327 case kStandard:
e3d40058 328 if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;//Kaon
3875c875 329 if(d->Pt()>=3. && d->PProng(1)<0.55) return 0;
a4b982a5 330 if(fUseSpecialCut) {
331 if(TMath::Abs(d->PtProng(0)) < TMath::Abs(d->PtProng(2)) )okLcpKpi=0;
332 if(TMath::Abs(d->PtProng(2)) < TMath::Abs(d->PtProng(0)) )okLcpiKp=0;
333 }
a7b533b7 334 if((TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(12,ptbin)])) okLcpKpi=0;
335 if((TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(12,ptbin)]))okLcpiKp=0;
7ad4b782 336 if(!okLcpKpi && !okLcpiKp) return 0;
e3d40058 337 //2track cuts
338 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) return 0;
3875c875 339 if(d->GetDist12toPrim()>0.5) return 0;
340 if(d->GetDist23toPrim()>0.5) return 0;
43d2fecc 341 if(fUseImpParProdCorrCut){
342 if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.) return 0;
343 }
e0fb900a 344 //sec vert
e3d40058 345 if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
228974b3 346 if(d->DecayLength()>0.5) return 0;
c1234468 347
348 // Double_t sumd0s=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
349 // if(sumd0s<fCutsRD[GetGlobalIndex(10,ptbin)]) return 0;
350 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 351
352 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;
353 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
e0fb900a 354 if(d->GetSigmaVert(aod)>fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
e3d40058 355
356 //DCA
357 for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
358
c1234468 359 break;
360
361 case kKF:
362 Int_t pdgs[3]={0,321,0};
363 Bool_t constraint=kFALSE;
364 if(fCutsRD[GetGlobalIndex(1,ptbin)]>0.) constraint=kTRUE;
365 Double_t field=aod->GetMagneticField();
366 if (returnvaluePID==1 || returnvaluePID==3){
367
82ccd919 368 pdgs[0]=2122;pdgs[2]=211;
369 AliKFParticle *lc1=ReconstructKF(d,pdgs,field,constraint);
370 if(!lc1){
371 okLcpKpi=0;
372 }else{
373 if(lc1->GetChi2()/lc1->GetNDF()>fCutsRD[GetGlobalIndex(2,ptbin)]) okLcpKpi=0;
374 }
c1234468 375 } else if(returnvaluePID>=2){
376
82ccd919 377 pdgs[0]=211;pdgs[2]=2212;
378 AliKFParticle *lc2=ReconstructKF(d,pdgs,field,constraint);
379 if(!lc2){
380 okLcpiKp=0;
381 }else{
382 if(lc2->GetChi2()/lc2->GetNDF()>fCutsRD[GetGlobalIndex(2,ptbin)])okLcpiKp=0;
383 }
c1234468 384 }
385 break;
386
387 }
e3d40058 388
389 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
390 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
391 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
dcc2ade0 392
dcc2ade0 393 }
394
dcc2ade0 395 // selection on daughter tracks
396 if(selectionLevel==AliRDHFCuts::kAll ||
397 selectionLevel==AliRDHFCuts::kTracks) {
398 if(!AreDaughtersSelected(d)) return 0;
e3d40058 399 }
dcc2ade0 400
401
7ad4b782 402 Int_t returnvalueTot=CombinePIDCuts(returnvalue,returnvaluePID);
403 return returnvalueTot;
e3d40058 404}
405//---------------------------------------------------------------------------
7ad4b782 406Int_t AliRDHFCutsLctopKpi::IsSelectedPID(AliAODRecoDecayHF* obj) {
407
408
1a141544 409 if(!fUsePID || !obj) return 3;
7ad4b782 410 Int_t okLcpKpi=0,okLcpiKp=0;
411 Int_t returnvalue=0;
412 Bool_t isPeriodd=fPidHF->GetOnePad();
a7b533b7 413 Bool_t isMC=fPidHF->GetMC();
7ad4b782 414 Bool_t ispion0=kTRUE,ispion2=kTRUE;
415 Bool_t isproton0=kFALSE,isproton2=kFALSE;
416 Bool_t iskaon1=kFALSE;
a7b533b7 417 if(isPeriodd) {
418 fPidObjprot->SetOnePad(kTRUE);
419 fPidObjpion->SetOnePad(kTRUE);
420 }
421 if(isMC) {
422 fPidObjprot->SetMC(kTRUE);
423 fPidObjpion->SetMC(kTRUE);
424 }
7ad4b782 425
4f3d14ec 426 if(fPidObjprot->GetPidResponse()==0x0){
427 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
428 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
429 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
430 fPidObjprot->SetPidResponse(pidResp);
431 }
432 if(fPidObjpion->GetPidResponse()==0x0){
433 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
434 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
435 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
436 fPidObjpion->SetPidResponse(pidResp);
437 }
438 if(fPidHF->GetPidResponse()==0x0){
439 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
440 AliInputEventHandler *inputHandler=(AliInputEventHandler*)mgr->GetInputEventHandler();
441 AliPIDResponse *pidResp=inputHandler->GetPIDResponse();
442 fPidHF->SetPidResponse(pidResp);
443 }
444
7ad4b782 445 for(Int_t i=0;i<3;i++){
446 AliAODTrack *track=(AliAODTrack*)obj->GetDaughter(i);
447 if(!track) return 0;
448 // identify kaon
3875c875 449 if(track->P()<0.55){
450 fPidHF->SetTOF(kFALSE);
451 fPidHF->SetTOFdecide(kFALSE);
452 }
7ad4b782 453 if(i==1) {
454 Int_t isKaon=fPidHF->MakeRawPid(track,3);
a4b982a5 455 if(isKaon>=1) iskaon1=kTRUE;
456 if(track->P()<0.55){
457 fPidHF->SetTOF(kTRUE);
458 fPidHF->SetTOFdecide(kTRUE);
7ad4b782 459 }
a4b982a5 460
47aa3d55 461 if(!iskaon1) return 0;
7ad4b782 462
463 }else{
464 //pion or proton
3875c875 465 if(track->P()<1.){
466 fPidObjprot->SetTOF(kFALSE);
467 fPidObjprot->SetTOFdecide(kFALSE);
468 }
7ad4b782 469
470 Int_t isProton=fPidObjprot->MakeRawPid(track,4);
a4b982a5 471
7ad4b782 472
473 Int_t isPion=fPidObjpion->MakeRawPid(track,2);
a4b982a5 474
3875c875 475 if(track->P()<1.){
476 fPidObjprot->SetTOF(kTRUE);
477 fPidObjprot->SetTOFdecide(kTRUE);
478 }
a4b982a5 479
7ad4b782 480
481 if(i==0) {
482 if(isPion<0) ispion0=kFALSE;
483 if(isProton>=1) isproton0=kTRUE;
484
485 }
47aa3d55 486 if(!ispion0 && !isproton0) return 0;
7ad4b782 487 if(i==2) {
488 if(isPion<0) ispion2=kFALSE;
489 if(isProton>=1) isproton2=kTRUE;
490 }
491
492 }
493 }
494
495 if(ispion2 && isproton0 && iskaon1) okLcpKpi=1;
496 if(ispion0 && isproton2 && iskaon1) okLcpiKp=1;
497 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
498 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
499 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
500
501 return returnvalue;
502}
11690a06 503//---------------------------------------------------------------------------
504Int_t AliRDHFCutsLctopKpi::IsSelectedCombinedPID(AliAODRecoDecayHF* obj) {
505
506 // Printf(" -------- IsSelectedCombinedPID --------------");
507
c1234468 508
509 if(!fUsePID || !obj) {return 3;}
11690a06 510 Int_t okLcpKpi=0,okLcpiKp=0;
511 Int_t returnvalue=0;
512 Bool_t isPeriodd=fPidHF->GetOnePad();
513 Bool_t isMC=fPidHF->GetMC();
11690a06 514
515 if(isPeriodd) {
516 fPidObjprot->SetOnePad(kTRUE);
517 fPidObjpion->SetOnePad(kTRUE);
518 }
519 if(isMC) {
520 fPidObjprot->SetMC(kTRUE);
521 fPidObjpion->SetMC(kTRUE);
522 }
523
c1234468 524 AliVTrack *track0=dynamic_cast<AliVTrack*>(obj->GetDaughter(0));
525 AliVTrack *track1=dynamic_cast<AliVTrack*>(obj->GetDaughter(1));
526 AliVTrack *track2=dynamic_cast<AliVTrack*>(obj->GetDaughter(2));
527 if (!track0 || !track1 || !track2) return 0;
528 Double_t prob0[AliPID::kSPECIES];
529 Double_t prob1[AliPID::kSPECIES];
530 Double_t prob2[AliPID::kSPECIES];
3875c875 531 if(obj->Pt()<3. && track0->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
c1234468 532 fPidHF->GetPidCombined()->ComputeProbabilities(track0,fPidHF->GetPidResponse(),prob0);
3875c875 533 if(obj->Pt()<3. && track0->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
534
535 if(obj->Pt()<3. && track1->P()<0.55) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
c1234468 536 fPidHF->GetPidCombined()->ComputeProbabilities(track1,fPidHF->GetPidResponse(),prob1);
3875c875 537 if(obj->Pt()<3. && track1->P()<0.55) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
538
539 if(obj->Pt()<3. && track2->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
c1234468 540 fPidHF->GetPidCombined()->ComputeProbabilities(track2,fPidHF->GetPidResponse(),prob2);
3875c875 541 if(obj->Pt()<3. && track2->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
542
c1234468 543 if(fPIDThreshold[AliPID::kPion]>0. && fPIDThreshold[AliPID::kKaon]>0. && fPIDThreshold[AliPID::kProton]>0.){
544 okLcpiKp= (prob0[AliPID::kPion ]>fPIDThreshold[AliPID::kPion ])
545 &&(prob1[AliPID::kKaon ]>fPIDThreshold[AliPID::kKaon ])
546 &&(prob2[AliPID::kProton]>fPIDThreshold[AliPID::kProton]);
547 okLcpKpi= (prob0[AliPID::kProton]>fPIDThreshold[AliPID::kProton])
548 &&(prob1[AliPID::kKaon ]>fPIDThreshold[AliPID::kKaon ])
549 &&(prob2[AliPID::kPion ]>fPIDThreshold[AliPID::kPion ]);
550 }else{
11690a06 551 //pion or proton
552
11690a06 553
c1234468 554 if(TMath::MaxElement(AliPID::kSPECIES,prob1) == prob1[AliPID::kKaon]){
555 if(TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kPion]) okLcpKpi = 1;
556 if(TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kPion]) okLcpiKp = 1;
11690a06 557 }
c1234468 558 }
11690a06 559
560 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
561 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
562 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
563
564 return returnvalue;
565}
7ad4b782 566//-----------------------
567Int_t AliRDHFCutsLctopKpi::CombinePIDCuts(Int_t returnvalue, Int_t returnvaluePID) const {
568
569 Int_t returnvalueTot=0;
570 Int_t okLcpKpi=0,okLcpiKp=0;
571 if(returnvaluePID==1){
572 if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
573 }
574 if(returnvaluePID==2){
575 if(returnvalue>=2) okLcpiKp=1;
576 }
577 if(returnvaluePID==3 && returnvalue>0){
578 if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
579 if(returnvalue>=2) okLcpiKp=1;
580 }
581
582 if(okLcpKpi) returnvalueTot=1; //cuts passed as Lc->pKpi
583 if(okLcpiKp) returnvalueTot=2; //cuts passed as Lc->piKp
584 if(okLcpKpi && okLcpiKp) returnvalueTot=3; //cuts passed as both pKpi and piKp
585 return returnvalueTot;
586}
587//----------------------------------
588void AliRDHFCutsLctopKpi::SetStandardCutsPP2010() {
589
590 SetName("LctopKpiProdCuts");
591 SetTitle("Production cuts for Lc analysis");
592
593 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
594 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
595 esdTrackCuts->SetRequireTPCRefit(kTRUE);
596 esdTrackCuts->SetMinNClustersTPC(70);
597 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
598 AliESDtrackCuts::kAny);
599 esdTrackCuts->SetRequireITSRefit(kTRUE);
600 esdTrackCuts->SetMinNClustersITS(4);
601 esdTrackCuts->SetMinDCAToVertexXY(0.);
602 esdTrackCuts->SetEtaRange(-0.8,0.8);
603 esdTrackCuts->SetPtRange(0.3,1.e10);
604 AddTrackCuts(esdTrackCuts);
605
606 const Int_t nptbins=4;
a7b533b7 607 const Int_t nvars=13;
7ad4b782 608 Float_t* ptbins;
609 ptbins=new Float_t[nptbins+1];
610
611 ptbins[0]=0.;
612 ptbins[1]=2.;
613 ptbins[2]=3.;
614 ptbins[3]=4.;
615 ptbins[4]=9999.;
616
617 SetGlobalIndex(nvars,nptbins);
618 SetPtBins(nptbins+1,ptbins);
619
620 Float_t** prodcutsval;
621 prodcutsval=new Float_t*[nvars];
622 for(Int_t iv=0;iv<nvars;iv++){
623 prodcutsval[iv]=new Float_t[nptbins];
624 }
e11ae259 625
7ad4b782 626 for(Int_t ipt=0;ipt<nptbins;ipt++){
627 prodcutsval[0][ipt]=0.18;
628 prodcutsval[1][ipt]=0.4;
629 prodcutsval[2][ipt]=0.5;
630 prodcutsval[3][ipt]=0.;
631 prodcutsval[4][ipt]=0.;
632 prodcutsval[5][ipt]=0.01;
633 prodcutsval[6][ipt]=0.06;
634 prodcutsval[7][ipt]=0.005;
635 prodcutsval[8][ipt]=0.;
636 prodcutsval[9][ipt]=0.;
637 prodcutsval[10][ipt]=0.;
638 prodcutsval[11][ipt]=0.05;
a7b533b7 639 prodcutsval[12][ipt]=0.4;
7ad4b782 640 }
641 SetCuts(nvars,nptbins,prodcutsval);
642
643 AliAODPidHF* pidObjK=new AliAODPidHF();
644 Double_t sigmasK[5]={3.,1.,1.,3.,2.};
645 pidObjK->SetSigma(sigmasK);
646 pidObjK->SetAsym(kTRUE);
647 pidObjK->SetMatch(1);
648 pidObjK->SetTPC(kTRUE);
649 pidObjK->SetTOF(kTRUE);
650 pidObjK->SetITS(kTRUE);
651 Double_t plimK[2]={0.5,0.8};
652 pidObjK->SetPLimit(plimK,2);
a7b533b7 653 pidObjK->SetTOFdecide(kTRUE);
7ad4b782 654
655 SetPidHF(pidObjK);
656
657 AliAODPidHF* pidObjpi=new AliAODPidHF();
658 pidObjpi->SetTPC(kTRUE);
659 Double_t sigmaspi[5]={3.,0.,0.,0.,0.};
660 pidObjpi->SetSigma(sigmaspi);
a7b533b7 661 pidObjpi->SetTOFdecide(kTRUE);
7ad4b782 662 SetPidpion(pidObjpi);
663
664 AliAODPidHF* pidObjp=new AliAODPidHF();
665 Double_t sigmasp[5]={3.,1.,1.,3.,2.};
666 pidObjp->SetSigma(sigmasp);
667 pidObjp->SetAsym(kTRUE);
668 pidObjp->SetMatch(1);
669 pidObjp->SetTPC(kTRUE);
670 pidObjp->SetTOF(kTRUE);
671 pidObjp->SetITS(kTRUE);
672 Double_t plimp[2]={1.,2.};
673 pidObjp->SetPLimit(plimp,2);
a7b533b7 674 pidObjp->SetTOFdecide(kTRUE);
7ad4b782 675
676 SetPidprot(pidObjp);
677
678 SetUsePID(kTRUE);
679
680 PrintAll();
681
e11ae259 682 for(Int_t iiv=0;iiv<nvars;iiv++){
683 delete [] prodcutsval[iiv];
684 }
685 delete [] prodcutsval;
686 prodcutsval=NULL;
687 delete [] ptbins;
688 ptbins=NULL;
689
690 delete pidObjp;
691 pidObjp=NULL;
692
7ad4b782 693 return;
694}
a8b8e864 695//------------------
696void AliRDHFCutsLctopKpi::SetStandardCutsPbPb2010() {
697
698 SetName("LctopKpiProdCuts");
699 SetTitle("Production cuts for Lc analysis");
700
701 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
702
703 esdTrackCuts->SetRequireTPCRefit(kTRUE);
704 esdTrackCuts->SetMinNClustersTPC(70);
705 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
706 AliESDtrackCuts::kAny);
707 esdTrackCuts->SetRequireITSRefit(kTRUE);
708 esdTrackCuts->SetMinNClustersITS(4);
709 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0100*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
710 esdTrackCuts->SetEtaRange(-0.8,0.8);
711 esdTrackCuts->SetMaxDCAToVertexXY(1.);
712 esdTrackCuts->SetMaxDCAToVertexZ(1.);
713 esdTrackCuts->SetPtRange(0.8,1.e10);
714 AddTrackCuts(esdTrackCuts);
715
716 const Int_t nptbins=4;
a7b533b7 717 const Int_t nvars=13;
a8b8e864 718 Float_t* ptbins;
719 ptbins=new Float_t[nptbins+1];
720
721 ptbins[0]=0.;
722 ptbins[1]=2.;
723 ptbins[2]=3.;
724 ptbins[3]=4.;
725 ptbins[4]=9999.;
726
727 SetGlobalIndex(nvars,nptbins);
728 SetPtBins(nptbins+1,ptbins);
729
730 Float_t** prodcutsval;
731 prodcutsval=new Float_t*[nvars];
732 for(Int_t iv=0;iv<nvars;iv++){
733 prodcutsval[iv]=new Float_t[nptbins];
734 }
735
736 for(Int_t ipt=0;ipt<nptbins;ipt++){
737 prodcutsval[0][ipt]=0.13;
738 prodcutsval[1][ipt]=0.5;
739 prodcutsval[2][ipt]=0.6;
740 prodcutsval[3][ipt]=0.;
741 prodcutsval[4][ipt]=0.;
742 prodcutsval[5][ipt]=0.01;
743 prodcutsval[6][ipt]=0.04;
744 prodcutsval[7][ipt]=0.006;
745 prodcutsval[8][ipt]=0.8;
746 prodcutsval[9][ipt]=0.3;
747 prodcutsval[10][ipt]=0.;
748 prodcutsval[11][ipt]=0.05;
a7b533b7 749 prodcutsval[12][ipt]=0.4;
a8b8e864 750 }
751 SetCuts(nvars,nptbins,prodcutsval);
752
753 AliAODPidHF* pidObjK=new AliAODPidHF();
754 Double_t sigmasK[5]={3.,1.,1.,3.,2.};
755 pidObjK->SetSigma(sigmasK);
756 pidObjK->SetAsym(kTRUE);
757 pidObjK->SetMatch(1);
758 pidObjK->SetTPC(kTRUE);
759 pidObjK->SetTOF(kTRUE);
760 pidObjK->SetITS(kTRUE);
761 Double_t plimK[2]={0.5,0.8};
762 pidObjK->SetPLimit(plimK,2);
763
764 SetPidHF(pidObjK);
765
766 AliAODPidHF* pidObjpi=new AliAODPidHF();
767 pidObjpi->SetTPC(kTRUE);
768 Double_t sigmaspi[5]={3.,0.,0.,0.,0.};
769 pidObjpi->SetSigma(sigmaspi);
770 SetPidpion(pidObjpi);
7ad4b782 771
a8b8e864 772 AliAODPidHF* pidObjp=new AliAODPidHF();
773 Double_t sigmasp[5]={3.,1.,1.,3.,2.};
774 pidObjp->SetSigma(sigmasp);
775 pidObjp->SetAsym(kTRUE);
776 pidObjp->SetMatch(1);
777 pidObjp->SetTPC(kTRUE);
778 pidObjp->SetTOF(kTRUE);
779 pidObjp->SetITS(kTRUE);
780 Double_t plimp[2]={1.,2.};
781 pidObjp->SetPLimit(plimp,2);
782
783 SetPidprot(pidObjp);
784
785 SetUsePID(kTRUE);
786
787 PrintAll();
788
789 for(Int_t iiv=0;iiv<nvars;iiv++){
790 delete [] prodcutsval[iiv];
791 }
792 delete [] prodcutsval;
793 prodcutsval=NULL;
794 delete [] ptbins;
795 ptbins=NULL;
796
797 delete pidObjp;
798 pidObjp=NULL;
799
800 return;
801}
7ad4b782 802//------------------
c1234468 803AliKFParticle* AliRDHFCutsLctopKpi::ReconstructKF(AliAODRecoDecayHF3Prong *d,Int_t *pdgs,Double_t field,Bool_t constraint) const{
cc4bd7b4 804 // Method to construct the KF particle from the candidate
16d0e822 805
c1234468 806 const Int_t nprongs=d->GetNProngs();
5da7eaa9 807 if(nprongs<=0) return 0x0;
82ccd919 808
7ad4b782 809 Int_t iprongs[nprongs];
810 for(Int_t i=0;i<nprongs;i++) iprongs[i]=i;
811
812 Double_t mass[2]={0.,0.};
813
c1234468 814 AliKFParticle *decay=d->ApplyVertexingKF(iprongs,nprongs,pdgs,constraint,field,mass);
815 if(!decay) return 0x0;
7ad4b782 816 AliESDVertex *vertexESD = new AliESDVertex(decay->Parameters(),
817 decay->CovarianceMatrix(),
818 decay->GetChi2(),
819 nprongs);
820 Double_t pos[3],cov[6],chi2perNDF;
821 vertexESD->GetXYZ(pos);
822 vertexESD->GetCovMatrix(cov);
823 chi2perNDF = vertexESD->GetChi2toNDF();
824 delete vertexESD; vertexESD=NULL;
825 AliAODVertex *vertexAOD = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,nprongs);
826 d->SetSecondaryVtx(vertexAOD);
c1234468 827 return decay;
828}
829
0c22e2ac 830//------------------
831void AliRDHFCutsLctopKpi::SetStandardCutsPbPb2011() {
832
833 // Default 2010 PbPb cut object
834 SetStandardCutsPbPb2010();
835
836 //
837 // Enable all 2011 PbPb run triggers
838 //
839 SetTriggerClass("");
840 ResetMaskAndEnableMBTrigger();
841 EnableCentralTrigger();
842 EnableSemiCentralTrigger();
843}
c1234468 844//-----------------
845
846Bool_t AliRDHFCutsLctopKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
847{
848 //
af5d687e 849 // // Checking if Lc is in fiducial acceptance region
c1234468 850 // //
851 //
af5d687e 852 if(fMaxRapidityCand>-998.){
853 if(TMath::Abs(y) > fMaxRapidityCand) return kFALSE;
854 else return kTRUE;
855 }
856
c1234468 857 if(pt > 5.) {
858 // applying cut for pt > 5 GeV
af5d687e 859 AliDebug(2,Form("pt of Lc = %f (> 5), cutting at |y| < 0.8",pt));
c1234468 860 if (TMath::Abs(y) > 0.8) return kFALSE;
861
862 } else {
863 // appliying smooth cut for pt < 5 GeV
864 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
865 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
af5d687e 866 AliDebug(2,Form("pt of Lc = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
c1234468 867 if (y < minFiducialY || y > maxFiducialY) return kFALSE;
868 }
869 //
870 return kTRUE;
7ad4b782 871}
a4b982a5 872//--------------------------------------------------------
873Int_t AliRDHFCutsLctopKpi::IsSelectedCombinedPIDSoft(AliAODRecoDecayHF* obj) {
874 if(!fUsePID || !obj) {return 3;}
875 Int_t okLcpKpi=0,okLcpiKp=0;
876 Int_t returnvalue=0;
877
878 AliVTrack *track0=dynamic_cast<AliVTrack*>(obj->GetDaughter(0));
879 AliVTrack *track1=dynamic_cast<AliVTrack*>(obj->GetDaughter(1));
880 AliVTrack *track2=dynamic_cast<AliVTrack*>(obj->GetDaughter(2));
881 if (!track0 || !track1 || !track2) return 0;
882 Double_t prob0[AliPID::kSPECIES];
883 Double_t prob1[AliPID::kSPECIES];
884 Double_t prob2[AliPID::kSPECIES];
885
886 Bool_t isTOF0=fPidHF->CheckTOFPIDStatus((AliAODTrack*)obj->GetDaughter(0));
887 Bool_t isTOF1=fPidHF->CheckTOFPIDStatus((AliAODTrack*)obj->GetDaughter(1));
888 Bool_t isTOF2=fPidHF->CheckTOFPIDStatus((AliAODTrack*)obj->GetDaughter(2));
889
890Bool_t isK1=kFALSE;
891 if(isTOF1){ //kaon
892 if(track1->P()<1.8) {
893 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
894 if(obj->Pt()<3. && track1->P()<0.55) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
895 fPidHF->GetPidCombined()->ComputeProbabilities(track1,fPidHF->GetPidResponse(),prob1);
896
897 }else{
898 AliAODTrack *trackaod1=(AliAODTrack*)(obj->GetDaughter(1));
899 if(trackaod1->P()<0.55){
900 fPidHF->SetTOF(kFALSE);
901 fPidHF->SetTOFdecide(kFALSE);
902 }
903 Int_t isKaon=fPidHF->MakeRawPid(trackaod1,3);
904 if(isKaon>=1) isK1=kTRUE;
905 if(trackaod1->P()<0.55){
906 fPidHF->SetTOF(kTRUE);
907 fPidHF->SetTOFdecide(kTRUE);
908 }
909 }
910 }else{
911 if(track1->P()<0.8){
912 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
913 fPidHF->GetPidCombined()->ComputeProbabilities(track1,fPidHF->GetPidResponse(),prob0);
914 }else{
915 AliAODTrack *trackaod1=(AliAODTrack*)(obj->GetDaughter(1));
916 if(trackaod1->P()<0.55){
917 fPidHF->SetTOF(kFALSE);
918 fPidHF->SetTOFdecide(kFALSE);
919 }
920 Int_t isKaon=fPidHF->MakeRawPid(trackaod1,3);
921 if(isKaon>=1) isK1=kTRUE;
922 if(trackaod1->P()<0.55){
923 fPidHF->SetTOF(kTRUE);
924 fPidHF->SetTOFdecide(kTRUE);
925 }
926 }
927 }
928
929 Bool_t ispi0=kFALSE;
930 Bool_t isp0=kFALSE;
931 Bool_t ispi2=kFALSE;
932 Bool_t isp2=kFALSE;
933
934 if(isTOF0){ //proton
935 if(track0->P()<2.2) {
936 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
937 if(obj->Pt()<3. && track0->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
938 fPidHF->GetPidCombined()->ComputeProbabilities(track0,fPidHF->GetPidResponse(),prob0);
939 }else{
940 AliAODTrack *trackaod0=(AliAODTrack*)(obj->GetDaughter(0));
941 if(trackaod0->P()<1.){
942 fPidObjprot->SetTOF(kFALSE);
943 fPidObjprot->SetTOFdecide(kFALSE);
944 }
945 Int_t isProton=fPidObjprot->MakeRawPid(trackaod0,4);
946 if(isProton>=1) isp0=kTRUE;
947 if(trackaod0->P()<1.){
948 fPidObjprot->SetTOF(kTRUE);
949 fPidObjprot->SetTOFdecide(kTRUE);
950 }
951 }
952 }else{
953 if(track0->P()<1.2){
954 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
955 fPidHF->GetPidCombined()->ComputeProbabilities(track0,fPidHF->GetPidResponse(),prob0);
956 }else{
957 AliAODTrack *trackaod0=(AliAODTrack*)(obj->GetDaughter(0));
958 if(trackaod0->P()<1.){
959 fPidObjprot->SetTOF(kFALSE);
960 fPidObjprot->SetTOFdecide(kFALSE);
961 }
962 Int_t isProton=fPidObjprot->MakeRawPid(trackaod0,4);
963 if(isProton>=1) isp0=kTRUE;
964 if(trackaod0->P()<1.){
965 fPidObjprot->SetTOF(kTRUE);
966 fPidObjprot->SetTOFdecide(kTRUE);
967 }
968 }
969 }
970
971 if(isTOF2){ //proton
972 if(track2->P()<2.2) {
973 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
974 if(obj->Pt()<3. && track2->P()<1.) fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
975 fPidHF->GetPidCombined()->ComputeProbabilities(track2,fPidHF->GetPidResponse(),prob2);
976 }else{
977 AliAODTrack *trackaod2=(AliAODTrack*)(obj->GetDaughter(2));
978 if(trackaod2->P()<1.){
979 fPidObjprot->SetTOF(kFALSE);
980 fPidObjprot->SetTOFdecide(kFALSE);
981 }
982 Int_t isProton=fPidObjprot->MakeRawPid(trackaod2,4);
983 if(isProton>=1) isp2=kTRUE;
984 if(trackaod2->P()<1.){
985 fPidObjprot->SetTOF(kTRUE);
986 fPidObjprot->SetTOFdecide(kTRUE);
987 }
988 }
989 }else{
990 if(track2->P()<1.2){
991 fPidHF->GetPidCombined()->SetDetectorMask(AliPIDResponse::kDetTPC);
992 fPidHF->GetPidCombined()->ComputeProbabilities(track2,fPidHF->GetPidResponse(),prob2);
993 }else{
994 AliAODTrack *trackaod2=(AliAODTrack*)(obj->GetDaughter(2));
995 if(trackaod2->P()<1.){
996 fPidObjprot->SetTOF(kFALSE);
997 fPidObjprot->SetTOFdecide(kFALSE);
998 }
999 Int_t isProton=fPidObjprot->MakeRawPid(trackaod2,4);
1000 if(isProton>=1) isp2=kTRUE;
1001 if(trackaod2->P()<1.){
1002 fPidObjprot->SetTOF(kTRUE);
1003 fPidObjprot->SetTOFdecide(kTRUE);
1004 }
1005 }
1006 }
1007 AliAODTrack *trackaod2=(AliAODTrack*)(obj->GetDaughter(2));
1008 if(fPidObjpion->MakeRawPid(trackaod2,2)>=1)ispi2=kTRUE;
1009 AliAODTrack *trackaod0=(AliAODTrack*)(obj->GetDaughter(2));
1010 if(fPidObjpion->MakeRawPid(trackaod0,2)>=1)ispi0=kTRUE;
1011
1012 if(TMath::MaxElement(AliPID::kSPECIES,prob1) == prob1[AliPID::kKaon]){
a8b8e864 1013
a4b982a5 1014 if(TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kPion]) okLcpKpi = 1;
1015 if(TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kPion]) okLcpiKp = 1;
1016 }
1017
1018 if(!isK1 && TMath::MaxElement(AliPID::kSPECIES,prob1) == prob1[AliPID::kKaon]) isK1=kTRUE;
1019 if(!ispi0 && TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kPion]) ispi0=kTRUE;
1020 if(!ispi2 && TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kPion]) ispi2=kTRUE;
1021 if(!isp0 && TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kProton]) isp0=kTRUE;
1022 if(!isp2 && TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kProton]) isp2=kTRUE;
1023 if(isK1 && ispi0 && isp2) okLcpiKp = 1;
1024 if(isK1 && isp0 && ispi2) okLcpKpi = 1;
1025
1026 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
1027 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
1028 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
1029
1030 return returnvalue;
1031
1032
1033}
ef5f00b2 1034//----------------------------------------------------------
1035Int_t AliRDHFCutsLctopKpi::IsSelectedPIDStrong(AliAODRecoDecayHF* obj) {
1036
1037
1038 if(!fUsePID || !obj) return 3;
1039 Int_t okLcpKpi=0,okLcpiKp=0;
1040 Int_t returnvalue=0;
1041 Bool_t isPeriodd=fPidHF->GetOnePad();
1042 Bool_t isMC=fPidHF->GetMC();
1043 Bool_t ispion0=kTRUE,ispion2=kTRUE;
1044 Bool_t isproton0=kFALSE,isproton2=kFALSE;
1045 Bool_t iskaon1=kFALSE;
1046 if(isPeriodd) {
1047 fPidObjprot->SetOnePad(kTRUE);
1048 fPidObjpion->SetOnePad(kTRUE);
1049 }
1050 if(isMC) {
1051 fPidObjprot->SetMC(kTRUE);
1052 fPidObjpion->SetMC(kTRUE);
1053 }
1054
1055 for(Int_t i=0;i<3;i++){
1056 AliAODTrack *track=(AliAODTrack*)obj->GetDaughter(i);
1057 if(!track) return 0;
1058 // identify kaon
1059 if(i==1) {
1060 Int_t isKaon=fPidHF->MakeRawPid(track,3);
1061 if(isKaon>=1) {
1062 iskaon1=kTRUE;
1063 if(fPidHF->MakeRawPid(track,2)>=1) iskaon1=kFALSE;
1064 }
1065 if(!iskaon1) return 0;
1066
1067 }else{
1068 //pion or proton
1069
1070 Int_t isProton=fPidObjprot->MakeRawPid(track,4);
1071 if(isProton>=1){
1072 if(fPidHF->MakeRawPid(track,2)>=1) isProton=-1;
1073 if(fPidHF->MakeRawPid(track,3)>=1) isProton=-1;
1074 }
1075
1076 Int_t isPion=fPidObjpion->MakeRawPid(track,2);
1077 if(fPidHF->MakeRawPid(track,3)>=1) isPion=-1;
1078 if(fPidObjprot->MakeRawPid(track,4)>=1) isPion=-1;
1079
1080
1081 if(i==0) {
1082 if(isPion<0) ispion0=kFALSE;
1083 if(isProton>=1) isproton0=kTRUE;
1084
1085 }
1086 if(!ispion0 && !isproton0) return 0;
1087 if(i==2) {
1088 if(isPion<0) ispion2=kFALSE;
1089 if(isProton>=1) isproton2=kTRUE;
1090 }
1091
1092 }
1093 }
1094
1095 if(ispion2 && isproton0 && iskaon1) okLcpKpi=1;
1096 if(ispion0 && isproton2 && iskaon1) okLcpiKp=1;
1097 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
1098 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
1099 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
1100
1101 return returnvalue;
1102}