]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/AliRDHFCutsLctopKpi.cxx
Fix for #90879: Vertexing task crashing in trunk
[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>
27
28#include "AliRDHFCutsLctopKpi.h"
29#include "AliAODRecoDecayHF3Prong.h"
7ad4b782 30#include "AliRDHFCuts.h"
e3d40058 31#include "AliAODTrack.h"
32#include "AliESDtrack.h"
7ad4b782 33#include "AliKFParticle.h"
34#include "AliESDVertex.h"
e3d40058 35
36ClassImp(AliRDHFCutsLctopKpi)
37
38//--------------------------------------------------------------------------
a9b75906 39AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const char* name) :
7ad4b782 40AliRDHFCuts(name),
41fPidObjprot(0),
42fPidObjpion(0),
c1234468 43fUseImpParProdCorrCut(kFALSE),
44fPIDStrategy(kNSigma),
45fCutsStrategy(kStandard)
e3d40058 46{
47 //
48 // Default Constructor
49 //
a7b533b7 50 Int_t nvars=13;
e3d40058 51 SetNVars(nvars);
a7b533b7 52 TString varNames[13]={"inv. mass [GeV]",
a8b8e864 53 "pTK [GeV/c]",
a7b533b7 54 "pTP [GeV/c]",
a8b8e864 55 "d0K [cm] lower limit!",
e3d40058 56 "d0Pi [cm] lower limit!",
57 "dist12 (cm)",
58 "sigmavert (cm)",
59 "dist prim-sec (cm)",
60 "pM=Max{pT1,pT2,pT3} (GeV/c)",
61 "cosThetaPoint",
62 "Sum d0^2 (cm^2)",
a7b533b7 63 "dca cut (cm)",
64 "cut on pTpion [GeV/c]"};
65 Bool_t isUpperCut[13]={kTRUE,
e3d40058 66 kFALSE,
67 kFALSE,
68 kFALSE,
69 kFALSE,
70 kFALSE,
71 kTRUE,
72 kFALSE,
73 kFALSE,
74 kFALSE,
75 kFALSE,
a7b533b7 76 kTRUE,
77 kFALSE
78 };
e3d40058 79 SetVarNames(nvars,varNames,isUpperCut);
a7b533b7 80 Bool_t forOpt[13]={kFALSE,
81 kTRUE,
82 kTRUE,
e3d40058 83 kFALSE,
84 kFALSE,
85 kFALSE,
86 kFALSE,
87 kTRUE,
a7b533b7 88 kFALSE,
89 kFALSE,
90 kFALSE,
91 kFALSE,
92 kTRUE};
93 SetVarsForOpt(4,forOpt);
e3d40058 94 Float_t limits[2]={0,999999999.};
95 SetPtBins(2,limits);
c1234468 96 for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies)
97 fPIDThreshold[ispecies]=0.;
e3d40058 98}
99//--------------------------------------------------------------------------
100AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const AliRDHFCutsLctopKpi &source) :
7ad4b782 101 AliRDHFCuts(source),
6572e7ce 102 fPidObjprot(0x0),
103 fPidObjpion(0x0),
c1234468 104 fUseImpParProdCorrCut(source.fUseImpParProdCorrCut),
105 fPIDStrategy(source.fPIDStrategy),
106 fCutsStrategy(source.fCutsStrategy)
e3d40058 107{
108 //
109 // Copy constructor
110 //
6572e7ce 111 if (source.fPidObjprot) fPidObjprot = new AliAODPidHF(*(source.fPidObjprot));
112 else fPidObjprot = new AliAODPidHF();
113 if (source.fPidObjpion) fPidObjpion = new AliAODPidHF(*(source.fPidObjpion));
114 else fPidObjpion = new AliAODPidHF();
f5e92b8a 115 memcpy(fPIDThreshold,source.fPIDThreshold,AliPID::kSPECIES*sizeof(Double_t));
e3d40058 116}
117//--------------------------------------------------------------------------
118AliRDHFCutsLctopKpi &AliRDHFCutsLctopKpi::operator=(const AliRDHFCutsLctopKpi &source)
119{
120 //
121 // assignment operator
122 //
f5e92b8a 123 if(this != &source) {
124
125 AliRDHFCuts::operator=(source);
126 delete fPidObjprot;
127 fPidObjprot = new AliAODPidHF(*(source.fPidObjprot));
128 delete fPidObjpion;
129 fPidObjpion = new AliAODPidHF(*(source.fPidObjpion));
130 fPIDStrategy=source.fPIDStrategy;
131 fCutsStrategy=source.fCutsStrategy;
132 memcpy(fPIDThreshold,source.fPIDThreshold,AliPID::kSPECIES*sizeof(Double_t));
133 }
134
e3d40058 135 return *this;
136}
7ad4b782 137//---------------------------------------------------------------------------
138AliRDHFCutsLctopKpi::~AliRDHFCutsLctopKpi() {
139 //
140 // // Default Destructor
141 //
142 if(fPidObjpion){
143 delete fPidObjpion;
144 fPidObjpion=0;
145 }
146 if(fPidObjprot){
147 delete fPidObjprot;
148 fPidObjprot=0;
149 }
e3d40058 150
7ad4b782 151}
e3d40058 152
153//---------------------------------------------------------------------------
e0fb900a 154void AliRDHFCutsLctopKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters, AliAODEvent *aod) {
e3d40058 155 //
156 // Fills in vars the values of the variables
157 //
158
159 if(nvars!=fnVarsForOpt) {
160 printf("AliRDHFCutsLctopKpi::GetCutsVarsForOpt: wrong number of variables\n");
161 return;
162 }
163
164 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
165
166 Int_t iter=-1;
167 if(fVarsForOpt[0]){
168 iter++;
169 vars[iter]=dd->InvMassLcpKpi();
170 }
171 if(fVarsForOpt[1]){
172 iter++;
173 for(Int_t iprong=0;iprong<3;iprong++){
a7b533b7 174 if(TMath::Abs(pdgdaughters[iprong])==321) {
e3d40058 175 vars[iter]=dd->PtProng(iprong);
176 }
177 }
178 }
179 if(fVarsForOpt[2]){
180 iter++;
181 for(Int_t iprong=0;iprong<3;iprong++){
a7b533b7 182 if(TMath::Abs(pdgdaughters[iprong])==2212) {
e3d40058 183 vars[iter]=dd->PtProng(iprong);
184 }
185 }
186 }
187 if(fVarsForOpt[3]){
188 iter++;
189 for(Int_t iprong=0;iprong<3;iprong++){
190 if(TMath::Abs(pdgdaughters[iprong])==2212) {
191 vars[iter]=dd->Getd0Prong(iprong);
192 }
193 }
194 }
195 if(fVarsForOpt[4]){
196 iter++;
197 for(Int_t iprong=0;iprong<3;iprong++){
198 if(TMath::Abs(pdgdaughters[iprong])==211) {
199 vars[iter]=dd->Getd0Prong(iprong);
200 }
201 }
202 }
203 if(fVarsForOpt[5]){
204 iter++;
205 vars[iter]=dd->GetDist12toPrim();
206 }
207 if(fVarsForOpt[6]){
208 iter++;
e0fb900a 209 vars[iter]=dd->GetSigmaVert(aod);
e3d40058 210 }
211 if(fVarsForOpt[7]){
212 iter++;
213 vars[iter] = dd->DecayLength();
214 }
215 if(fVarsForOpt[8]){
216 iter++;
217 Float_t ptmax=0;
218 for(Int_t i=0;i<3;i++){
219 if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
220 }
221 vars[iter]=ptmax;
222 }
223 if(fVarsForOpt[9]){
224 iter++;
225 vars[iter]=dd->CosPointingAngle();
226 }
227 if(fVarsForOpt[10]){
228 iter++;
229 vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
230 }
231 if(fVarsForOpt[11]){
232 iter++;
233 vars[iter]=dd->GetDCA();
234 }
a7b533b7 235 if(fVarsForOpt[12]){
236 iter++;
237 for(Int_t iprong=0;iprong<3;iprong++){
238 if(TMath::Abs(pdgdaughters[iprong])==211) {
239 vars[iter]=dd->PtProng(iprong);
240 }
241 }
242 }
e3d40058 243
244 return;
245}
246//---------------------------------------------------------------------------
7ad4b782 247Int_t AliRDHFCutsLctopKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent *aod) {
e3d40058 248 //
249 // Apply selection
250 //
251
252 if(!fCutsRD){
253 cout<<"Cut matrice not inizialized. Exit..."<<endl;
254 return 0;
255 }
256 //PrintAll();
257 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
258
259 if(!d){
260 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
261 return 0;
262 }
263
264
5e938293 265 if(fKeepSignalMC) if(IsSignalMC(d,aod,4122)) return 3;
e3d40058 266
228974b3 267 Int_t returnvalue=3;
7ad4b782 268 Int_t returnvaluePID=3;
269
47aa3d55 270 if(d->Pt()<fMinPtCand) return 0;
271 if(d->Pt()>fMaxPtCand) return 0;
e3d40058 272
ba27eecd 273 if(d->HasBadDaughters()) return 0;
274
c1234468 275 if(selectionLevel==AliRDHFCuts::kAll ||
276 selectionLevel==AliRDHFCuts::kCandidate||
277 selectionLevel==AliRDHFCuts::kPID) {
278 switch (fPIDStrategy) {
279 case kNSigma:
280 returnvaluePID = IsSelectedPID(d);
281
282 break;
283 case kCombined:
284 returnvaluePID = IsSelectedCombinedPID(d);
285 break;
286 }
287 fIsSelectedPID=returnvaluePID;
288 }
289 // if(fUsePID || selectionLevel==AliRDHFCuts::kPID) returnvaluePID = IsSelectedCombinedPID(d); // to test!!
290 if(returnvaluePID==0) return 0;
ba27eecd 291
e3d40058 292 // selection on candidate
293 if(selectionLevel==AliRDHFCuts::kAll ||
294 selectionLevel==AliRDHFCuts::kCandidate) {
295
296 Double_t pt=d->Pt();
297
298 Int_t ptbin=PtBin(pt);
299
300 Double_t mLcpKpi,mLcpiKp;
301 Int_t okLcpKpi=1,okLcpiKp=1;
302
303 Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
304
305 mLcpKpi=d->InvMassLcpKpi();
306 mLcpiKp=d->InvMassLcpiKp();
307
308 if(TMath::Abs(mLcpKpi-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpKpi = 0;
309 if(TMath::Abs(mLcpiKp-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpiKp = 0;
310 if(!okLcpKpi && !okLcpiKp) return 0;
311
c1234468 312 switch (fCutsStrategy) {
313
314 case kStandard:
e3d40058 315 if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;//Kaon
a7b533b7 316 if((TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(12,ptbin)])) okLcpKpi=0;
317 if((TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(12,ptbin)]))okLcpiKp=0;
7ad4b782 318 if(!okLcpKpi && !okLcpiKp) return 0;
e3d40058 319 //2track cuts
320 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) return 0;
228974b3 321 if(d->GetDist12toPrim()>1.) return 0;
322 if(d->GetDist23toPrim()>1.) return 0;
43d2fecc 323 if(fUseImpParProdCorrCut){
324 if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.) return 0;
325 }
e0fb900a 326 //sec vert
e3d40058 327 if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
228974b3 328 if(d->DecayLength()>0.5) return 0;
c1234468 329
330 // Double_t sumd0s=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
331 // if(sumd0s<fCutsRD[GetGlobalIndex(10,ptbin)]) return 0;
332 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 333
334 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;
335 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
e0fb900a 336 if(d->GetSigmaVert(aod)>fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
e3d40058 337
338 //DCA
339 for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
340
c1234468 341 break;
342
343 case kKF:
344 Int_t pdgs[3]={0,321,0};
345 Bool_t constraint=kFALSE;
346 if(fCutsRD[GetGlobalIndex(1,ptbin)]>0.) constraint=kTRUE;
347 Double_t field=aod->GetMagneticField();
348 if (returnvaluePID==1 || returnvaluePID==3){
349
82ccd919 350 pdgs[0]=2122;pdgs[2]=211;
351 AliKFParticle *lc1=ReconstructKF(d,pdgs,field,constraint);
352 if(!lc1){
353 okLcpKpi=0;
354 }else{
355 if(lc1->GetChi2()/lc1->GetNDF()>fCutsRD[GetGlobalIndex(2,ptbin)]) okLcpKpi=0;
356 }
c1234468 357 } else if(returnvaluePID>=2){
358
82ccd919 359 pdgs[0]=211;pdgs[2]=2212;
360 AliKFParticle *lc2=ReconstructKF(d,pdgs,field,constraint);
361 if(!lc2){
362 okLcpiKp=0;
363 }else{
364 if(lc2->GetChi2()/lc2->GetNDF()>fCutsRD[GetGlobalIndex(2,ptbin)])okLcpiKp=0;
365 }
c1234468 366 }
367 break;
368
369 }
e3d40058 370
371 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
372 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
373 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
dcc2ade0 374
dcc2ade0 375 }
376
dcc2ade0 377 // selection on daughter tracks
378 if(selectionLevel==AliRDHFCuts::kAll ||
379 selectionLevel==AliRDHFCuts::kTracks) {
380 if(!AreDaughtersSelected(d)) return 0;
e3d40058 381 }
dcc2ade0 382
383
7ad4b782 384 Int_t returnvalueTot=CombinePIDCuts(returnvalue,returnvaluePID);
385 return returnvalueTot;
e3d40058 386}
387//---------------------------------------------------------------------------
7ad4b782 388Int_t AliRDHFCutsLctopKpi::IsSelectedPID(AliAODRecoDecayHF* obj) {
389
390
1a141544 391 if(!fUsePID || !obj) return 3;
7ad4b782 392 Int_t okLcpKpi=0,okLcpiKp=0;
393 Int_t returnvalue=0;
394 Bool_t isPeriodd=fPidHF->GetOnePad();
a7b533b7 395 Bool_t isMC=fPidHF->GetMC();
7ad4b782 396 Bool_t ispion0=kTRUE,ispion2=kTRUE;
397 Bool_t isproton0=kFALSE,isproton2=kFALSE;
398 Bool_t iskaon1=kFALSE;
a7b533b7 399 if(isPeriodd) {
400 fPidObjprot->SetOnePad(kTRUE);
401 fPidObjpion->SetOnePad(kTRUE);
402 }
403 if(isMC) {
404 fPidObjprot->SetMC(kTRUE);
405 fPidObjpion->SetMC(kTRUE);
406 }
7ad4b782 407
408 for(Int_t i=0;i<3;i++){
409 AliAODTrack *track=(AliAODTrack*)obj->GetDaughter(i);
410 if(!track) return 0;
411 // identify kaon
412 if(i==1) {
413 Int_t isKaon=fPidHF->MakeRawPid(track,3);
414 if(isKaon>=1) {
415 iskaon1=kTRUE;
416 if(fPidHF->MakeRawPid(track,2)>=1) iskaon1=kFALSE;
417 }
47aa3d55 418 if(!iskaon1) return 0;
7ad4b782 419
420 }else{
421 //pion or proton
422
423 Int_t isProton=fPidObjprot->MakeRawPid(track,4);
424 if(isProton>=1){
425 if(fPidHF->MakeRawPid(track,2)>=1) isProton=-1;
426 if(fPidHF->MakeRawPid(track,3)>=1) isProton=-1;
427 }
428
429 Int_t isPion=fPidObjpion->MakeRawPid(track,2);
430 if(fPidHF->MakeRawPid(track,3)>=1) isPion=-1;
431 if(fPidObjprot->MakeRawPid(track,4)>=1) isPion=-1;
432
433
434 if(i==0) {
435 if(isPion<0) ispion0=kFALSE;
436 if(isProton>=1) isproton0=kTRUE;
437
438 }
47aa3d55 439 if(!ispion0 && !isproton0) return 0;
7ad4b782 440 if(i==2) {
441 if(isPion<0) ispion2=kFALSE;
442 if(isProton>=1) isproton2=kTRUE;
443 }
444
445 }
446 }
447
448 if(ispion2 && isproton0 && iskaon1) okLcpKpi=1;
449 if(ispion0 && isproton2 && iskaon1) okLcpiKp=1;
450 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
451 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
452 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
453
454 return returnvalue;
455}
11690a06 456//---------------------------------------------------------------------------
457Int_t AliRDHFCutsLctopKpi::IsSelectedCombinedPID(AliAODRecoDecayHF* obj) {
458
459 // Printf(" -------- IsSelectedCombinedPID --------------");
460
c1234468 461
462 if(!fUsePID || !obj) {return 3;}
11690a06 463 Int_t okLcpKpi=0,okLcpiKp=0;
464 Int_t returnvalue=0;
465 Bool_t isPeriodd=fPidHF->GetOnePad();
466 Bool_t isMC=fPidHF->GetMC();
11690a06 467
468 if(isPeriodd) {
469 fPidObjprot->SetOnePad(kTRUE);
470 fPidObjpion->SetOnePad(kTRUE);
471 }
472 if(isMC) {
473 fPidObjprot->SetMC(kTRUE);
474 fPidObjpion->SetMC(kTRUE);
475 }
476
c1234468 477 AliVTrack *track0=dynamic_cast<AliVTrack*>(obj->GetDaughter(0));
478 AliVTrack *track1=dynamic_cast<AliVTrack*>(obj->GetDaughter(1));
479 AliVTrack *track2=dynamic_cast<AliVTrack*>(obj->GetDaughter(2));
480 if (!track0 || !track1 || !track2) return 0;
481 Double_t prob0[AliPID::kSPECIES];
482 Double_t prob1[AliPID::kSPECIES];
483 Double_t prob2[AliPID::kSPECIES];
484 fPidHF->GetPidCombined()->ComputeProbabilities(track0,fPidHF->GetPidResponse(),prob0);
485 fPidHF->GetPidCombined()->ComputeProbabilities(track1,fPidHF->GetPidResponse(),prob1);
486 fPidHF->GetPidCombined()->ComputeProbabilities(track2,fPidHF->GetPidResponse(),prob2);
487 if(fPIDThreshold[AliPID::kPion]>0. && fPIDThreshold[AliPID::kKaon]>0. && fPIDThreshold[AliPID::kProton]>0.){
488 okLcpiKp= (prob0[AliPID::kPion ]>fPIDThreshold[AliPID::kPion ])
489 &&(prob1[AliPID::kKaon ]>fPIDThreshold[AliPID::kKaon ])
490 &&(prob2[AliPID::kProton]>fPIDThreshold[AliPID::kProton]);
491 okLcpKpi= (prob0[AliPID::kProton]>fPIDThreshold[AliPID::kProton])
492 &&(prob1[AliPID::kKaon ]>fPIDThreshold[AliPID::kKaon ])
493 &&(prob2[AliPID::kPion ]>fPIDThreshold[AliPID::kPion ]);
494 }else{
11690a06 495 //pion or proton
496
11690a06 497
c1234468 498 if(TMath::MaxElement(AliPID::kSPECIES,prob1) == prob1[AliPID::kKaon]){
499 if(TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kPion]) okLcpKpi = 1;
500 if(TMath::MaxElement(AliPID::kSPECIES,prob2) == prob2[AliPID::kProton] && TMath::MaxElement(AliPID::kSPECIES,prob0) == prob0[AliPID::kPion]) okLcpiKp = 1;
11690a06 501 }
c1234468 502 }
11690a06 503
504 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
505 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
506 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
507
508 return returnvalue;
509}
7ad4b782 510//-----------------------
511Int_t AliRDHFCutsLctopKpi::CombinePIDCuts(Int_t returnvalue, Int_t returnvaluePID) const {
512
513 Int_t returnvalueTot=0;
514 Int_t okLcpKpi=0,okLcpiKp=0;
515 if(returnvaluePID==1){
516 if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
517 }
518 if(returnvaluePID==2){
519 if(returnvalue>=2) okLcpiKp=1;
520 }
521 if(returnvaluePID==3 && returnvalue>0){
522 if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
523 if(returnvalue>=2) okLcpiKp=1;
524 }
525
526 if(okLcpKpi) returnvalueTot=1; //cuts passed as Lc->pKpi
527 if(okLcpiKp) returnvalueTot=2; //cuts passed as Lc->piKp
528 if(okLcpKpi && okLcpiKp) returnvalueTot=3; //cuts passed as both pKpi and piKp
529 return returnvalueTot;
530}
531//----------------------------------
532void AliRDHFCutsLctopKpi::SetStandardCutsPP2010() {
533
534 SetName("LctopKpiProdCuts");
535 SetTitle("Production cuts for Lc analysis");
536
537 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
538 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
539 esdTrackCuts->SetRequireTPCRefit(kTRUE);
540 esdTrackCuts->SetMinNClustersTPC(70);
541 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
542 AliESDtrackCuts::kAny);
543 esdTrackCuts->SetRequireITSRefit(kTRUE);
544 esdTrackCuts->SetMinNClustersITS(4);
545 esdTrackCuts->SetMinDCAToVertexXY(0.);
546 esdTrackCuts->SetEtaRange(-0.8,0.8);
547 esdTrackCuts->SetPtRange(0.3,1.e10);
548 AddTrackCuts(esdTrackCuts);
549
550 const Int_t nptbins=4;
a7b533b7 551 const Int_t nvars=13;
7ad4b782 552 Float_t* ptbins;
553 ptbins=new Float_t[nptbins+1];
554
555 ptbins[0]=0.;
556 ptbins[1]=2.;
557 ptbins[2]=3.;
558 ptbins[3]=4.;
559 ptbins[4]=9999.;
560
561 SetGlobalIndex(nvars,nptbins);
562 SetPtBins(nptbins+1,ptbins);
563
564 Float_t** prodcutsval;
565 prodcutsval=new Float_t*[nvars];
566 for(Int_t iv=0;iv<nvars;iv++){
567 prodcutsval[iv]=new Float_t[nptbins];
568 }
e11ae259 569
7ad4b782 570 for(Int_t ipt=0;ipt<nptbins;ipt++){
571 prodcutsval[0][ipt]=0.18;
572 prodcutsval[1][ipt]=0.4;
573 prodcutsval[2][ipt]=0.5;
574 prodcutsval[3][ipt]=0.;
575 prodcutsval[4][ipt]=0.;
576 prodcutsval[5][ipt]=0.01;
577 prodcutsval[6][ipt]=0.06;
578 prodcutsval[7][ipt]=0.005;
579 prodcutsval[8][ipt]=0.;
580 prodcutsval[9][ipt]=0.;
581 prodcutsval[10][ipt]=0.;
582 prodcutsval[11][ipt]=0.05;
a7b533b7 583 prodcutsval[12][ipt]=0.4;
7ad4b782 584 }
585 SetCuts(nvars,nptbins,prodcutsval);
586
587 AliAODPidHF* pidObjK=new AliAODPidHF();
588 Double_t sigmasK[5]={3.,1.,1.,3.,2.};
589 pidObjK->SetSigma(sigmasK);
590 pidObjK->SetAsym(kTRUE);
591 pidObjK->SetMatch(1);
592 pidObjK->SetTPC(kTRUE);
593 pidObjK->SetTOF(kTRUE);
594 pidObjK->SetITS(kTRUE);
595 Double_t plimK[2]={0.5,0.8};
596 pidObjK->SetPLimit(plimK,2);
a7b533b7 597 pidObjK->SetTOFdecide(kTRUE);
7ad4b782 598
599 SetPidHF(pidObjK);
600
601 AliAODPidHF* pidObjpi=new AliAODPidHF();
602 pidObjpi->SetTPC(kTRUE);
603 Double_t sigmaspi[5]={3.,0.,0.,0.,0.};
604 pidObjpi->SetSigma(sigmaspi);
a7b533b7 605 pidObjpi->SetTOFdecide(kTRUE);
7ad4b782 606 SetPidpion(pidObjpi);
607
608 AliAODPidHF* pidObjp=new AliAODPidHF();
609 Double_t sigmasp[5]={3.,1.,1.,3.,2.};
610 pidObjp->SetSigma(sigmasp);
611 pidObjp->SetAsym(kTRUE);
612 pidObjp->SetMatch(1);
613 pidObjp->SetTPC(kTRUE);
614 pidObjp->SetTOF(kTRUE);
615 pidObjp->SetITS(kTRUE);
616 Double_t plimp[2]={1.,2.};
617 pidObjp->SetPLimit(plimp,2);
a7b533b7 618 pidObjp->SetTOFdecide(kTRUE);
7ad4b782 619
620 SetPidprot(pidObjp);
621
622 SetUsePID(kTRUE);
623
624 PrintAll();
625
e11ae259 626 for(Int_t iiv=0;iiv<nvars;iiv++){
627 delete [] prodcutsval[iiv];
628 }
629 delete [] prodcutsval;
630 prodcutsval=NULL;
631 delete [] ptbins;
632 ptbins=NULL;
633
634 delete pidObjp;
635 pidObjp=NULL;
636
7ad4b782 637 return;
638}
a8b8e864 639//------------------
640void AliRDHFCutsLctopKpi::SetStandardCutsPbPb2010() {
641
642 SetName("LctopKpiProdCuts");
643 SetTitle("Production cuts for Lc analysis");
644
645 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
646
647 esdTrackCuts->SetRequireTPCRefit(kTRUE);
648 esdTrackCuts->SetMinNClustersTPC(70);
649 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
650 AliESDtrackCuts::kAny);
651 esdTrackCuts->SetRequireITSRefit(kTRUE);
652 esdTrackCuts->SetMinNClustersITS(4);
653 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0100*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
654 esdTrackCuts->SetEtaRange(-0.8,0.8);
655 esdTrackCuts->SetMaxDCAToVertexXY(1.);
656 esdTrackCuts->SetMaxDCAToVertexZ(1.);
657 esdTrackCuts->SetPtRange(0.8,1.e10);
658 AddTrackCuts(esdTrackCuts);
659
660 const Int_t nptbins=4;
a7b533b7 661 const Int_t nvars=13;
a8b8e864 662 Float_t* ptbins;
663 ptbins=new Float_t[nptbins+1];
664
665 ptbins[0]=0.;
666 ptbins[1]=2.;
667 ptbins[2]=3.;
668 ptbins[3]=4.;
669 ptbins[4]=9999.;
670
671 SetGlobalIndex(nvars,nptbins);
672 SetPtBins(nptbins+1,ptbins);
673
674 Float_t** prodcutsval;
675 prodcutsval=new Float_t*[nvars];
676 for(Int_t iv=0;iv<nvars;iv++){
677 prodcutsval[iv]=new Float_t[nptbins];
678 }
679
680 for(Int_t ipt=0;ipt<nptbins;ipt++){
681 prodcutsval[0][ipt]=0.13;
682 prodcutsval[1][ipt]=0.5;
683 prodcutsval[2][ipt]=0.6;
684 prodcutsval[3][ipt]=0.;
685 prodcutsval[4][ipt]=0.;
686 prodcutsval[5][ipt]=0.01;
687 prodcutsval[6][ipt]=0.04;
688 prodcutsval[7][ipt]=0.006;
689 prodcutsval[8][ipt]=0.8;
690 prodcutsval[9][ipt]=0.3;
691 prodcutsval[10][ipt]=0.;
692 prodcutsval[11][ipt]=0.05;
a7b533b7 693 prodcutsval[12][ipt]=0.4;
a8b8e864 694 }
695 SetCuts(nvars,nptbins,prodcutsval);
696
697 AliAODPidHF* pidObjK=new AliAODPidHF();
698 Double_t sigmasK[5]={3.,1.,1.,3.,2.};
699 pidObjK->SetSigma(sigmasK);
700 pidObjK->SetAsym(kTRUE);
701 pidObjK->SetMatch(1);
702 pidObjK->SetTPC(kTRUE);
703 pidObjK->SetTOF(kTRUE);
704 pidObjK->SetITS(kTRUE);
705 Double_t plimK[2]={0.5,0.8};
706 pidObjK->SetPLimit(plimK,2);
707
708 SetPidHF(pidObjK);
709
710 AliAODPidHF* pidObjpi=new AliAODPidHF();
711 pidObjpi->SetTPC(kTRUE);
712 Double_t sigmaspi[5]={3.,0.,0.,0.,0.};
713 pidObjpi->SetSigma(sigmaspi);
714 SetPidpion(pidObjpi);
7ad4b782 715
a8b8e864 716 AliAODPidHF* pidObjp=new AliAODPidHF();
717 Double_t sigmasp[5]={3.,1.,1.,3.,2.};
718 pidObjp->SetSigma(sigmasp);
719 pidObjp->SetAsym(kTRUE);
720 pidObjp->SetMatch(1);
721 pidObjp->SetTPC(kTRUE);
722 pidObjp->SetTOF(kTRUE);
723 pidObjp->SetITS(kTRUE);
724 Double_t plimp[2]={1.,2.};
725 pidObjp->SetPLimit(plimp,2);
726
727 SetPidprot(pidObjp);
728
729 SetUsePID(kTRUE);
730
731 PrintAll();
732
733 for(Int_t iiv=0;iiv<nvars;iiv++){
734 delete [] prodcutsval[iiv];
735 }
736 delete [] prodcutsval;
737 prodcutsval=NULL;
738 delete [] ptbins;
739 ptbins=NULL;
740
741 delete pidObjp;
742 pidObjp=NULL;
743
744 return;
745}
7ad4b782 746//------------------
c1234468 747AliKFParticle* AliRDHFCutsLctopKpi::ReconstructKF(AliAODRecoDecayHF3Prong *d,Int_t *pdgs,Double_t field,Bool_t constraint) const{
cc4bd7b4 748 // Method to construct the KF particle from the candidate
16d0e822 749
c1234468 750 const Int_t nprongs=d->GetNProngs();
5da7eaa9 751 if(nprongs<=0) return 0x0;
82ccd919 752
7ad4b782 753 Int_t iprongs[nprongs];
754 for(Int_t i=0;i<nprongs;i++) iprongs[i]=i;
755
756 Double_t mass[2]={0.,0.};
757
c1234468 758 AliKFParticle *decay=d->ApplyVertexingKF(iprongs,nprongs,pdgs,constraint,field,mass);
759 if(!decay) return 0x0;
7ad4b782 760 AliESDVertex *vertexESD = new AliESDVertex(decay->Parameters(),
761 decay->CovarianceMatrix(),
762 decay->GetChi2(),
763 nprongs);
764 Double_t pos[3],cov[6],chi2perNDF;
765 vertexESD->GetXYZ(pos);
766 vertexESD->GetCovMatrix(cov);
767 chi2perNDF = vertexESD->GetChi2toNDF();
768 delete vertexESD; vertexESD=NULL;
769 AliAODVertex *vertexAOD = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,nprongs);
770 d->SetSecondaryVtx(vertexAOD);
c1234468 771 return decay;
772}
773
774//-----------------
775
776Bool_t AliRDHFCutsLctopKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
777{
778 //
779 // // Checking if Dplus is in fiducial acceptance region
780 // //
781 //
782 if(pt > 5.) {
783 // applying cut for pt > 5 GeV
784 AliDebug(2,Form("pt of D+ = %f (> 5), cutting at |y| < 0.8",pt));
785 if (TMath::Abs(y) > 0.8) return kFALSE;
786
787 } else {
788 // appliying smooth cut for pt < 5 GeV
789 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
790 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
791 AliDebug(2,Form("pt of D+ = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
792 if (y < minFiducialY || y > maxFiducialY) return kFALSE;
793 }
794 //
795 return kTRUE;
7ad4b782 796}
a8b8e864 797