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