]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliRDHFCutsD0toKpi.cxx
bug fix
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliRDHFCutsD0toKpi.cxx
CommitLineData
650b3ced 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
650b3ced 18/////////////////////////////////////////////////////////////
19//
20// Class for cuts on AOD reconstructed D0->Kpi
21//
22// Author: A.Dainese, andrea.dainese@pd.infn.it
23/////////////////////////////////////////////////////////////
24
25#include <TDatabasePDG.h>
26#include <Riostream.h>
27
28#include "AliRDHFCutsD0toKpi.h"
29#include "AliAODRecoDecayHF2Prong.h"
30#include "AliAODTrack.h"
31#include "AliESDtrack.h"
937e1290 32#include "AliAODPid.h"
33#include "AliTPCPIDResponse.h"
34#include "AliAODVertex.h"
5f25117b 35#include "AliKFVertex.h"
36#include "AliKFParticle.h"
650b3ced 37
38ClassImp(AliRDHFCutsD0toKpi)
39
40//--------------------------------------------------------------------------
a9b75906 41AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const char* name) :
937e1290 42AliRDHFCuts(name),
08ea5c32 43fUseSpecialCuts(kFALSE),
44fLowPt(kTRUE),
5f25117b 45fDefaultPID(kTRUE),
46fUseKF(kFALSE)
650b3ced 47{
48 //
49 // Default Constructor
50 //
51 Int_t nvars=9;
52 SetNVars(nvars);
53 TString varNames[9]={"inv. mass [GeV]",
54 "dca [cm]",
55 "cosThetaStar",
56 "pTK [GeV/c]",
57 "pTPi [GeV/c]",
58 "d0K [cm]",
59 "d0Pi [cm]",
60 "d0d0 [cm^2]",
61 "cosThetaPoint"};
62 Bool_t isUpperCut[9]={kTRUE,
63 kTRUE,
64 kTRUE,
65 kFALSE,
66 kFALSE,
67 kTRUE,
68 kTRUE,
69 kTRUE,
70 kFALSE};
71 SetVarNames(nvars,varNames,isUpperCut);
72 Bool_t forOpt[9]={kFALSE,
73 kTRUE,
74 kTRUE,
75 kFALSE,
76 kFALSE,
77 kFALSE,
78 kFALSE,
79 kTRUE,
80 kTRUE};
81 SetVarsForOpt(4,forOpt);
82 Float_t limits[2]={0,999999999.};
83 SetPtBins(2,limits);
937e1290 84
650b3ced 85}
86//--------------------------------------------------------------------------
87AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const AliRDHFCutsD0toKpi &source) :
08ea5c32 88 AliRDHFCuts(source),
89 fUseSpecialCuts(source.fUseSpecialCuts),
90 fLowPt(source.fLowPt),
5f25117b 91 fDefaultPID(source.fDefaultPID),
92 fUseKF(source.fUseKF)
650b3ced 93{
94 //
95 // Copy constructor
96 //
97
98}
99//--------------------------------------------------------------------------
100AliRDHFCutsD0toKpi &AliRDHFCutsD0toKpi::operator=(const AliRDHFCutsD0toKpi &source)
101{
102 //
103 // assignment operator
104 //
105 if(&source == this) return *this;
106
08ea5c32 107 AliRDHFCuts::operator=(source);
937e1290 108 fUseSpecialCuts=source.fUseSpecialCuts;
08ea5c32 109 fLowPt=source.fLowPt;
110 fDefaultPID=source.fDefaultPID;
650b3ced 111
112 return *this;
113}
114
115
116//---------------------------------------------------------------------------
117void AliRDHFCutsD0toKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
118 //
119 // Fills in vars the values of the variables
120 //
121
650b3ced 122 if(nvars!=fnVarsForOpt) {
123 printf("AliRDHFCutsD0toKpi::GetCutsVarsForOpt: wrong number of variables\n");
124 return;
125 }
126
127 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
650b3ced 128
650b3ced 129 Int_t iter=-1;
130 if(fVarsForOpt[0]){
131 iter++;
132 if(TMath::Abs(pdgdaughters[0])==211) {
133 vars[iter]=dd->InvMassD0();
134 } else {
135 vars[iter]=dd->InvMassD0bar();
136 }
137 }
138 if(fVarsForOpt[1]){
139 iter++;
140 vars[iter]=dd->GetDCA();
141 }
142 if(fVarsForOpt[2]){
143 iter++;
144 if(TMath::Abs(pdgdaughters[0])==211) {
145 vars[iter] = dd->CosThetaStarD0();
146 } else {
147 vars[iter] = dd->CosThetaStarD0bar();
148 }
149 }
150 if(fVarsForOpt[3]){
151 iter++;
152 if(TMath::Abs(pdgdaughters[0])==321) {
153 vars[iter]=dd->PtProng(0);
154 }
155 else{
156 vars[iter]=dd->PtProng(1);
157 }
158 }
159 if(fVarsForOpt[4]){
160 iter++;
161 if(TMath::Abs(pdgdaughters[0])==211) {
162 vars[iter]=dd->PtProng(0);
163 }
164 else{
165 vars[iter]=dd->PtProng(1);
166 }
167 }
168 if(fVarsForOpt[5]){
169 iter++;
170 if(TMath::Abs(pdgdaughters[0])==321) {
171 vars[iter]=dd->Getd0Prong(0);
172 }
173 else{
174 vars[iter]=dd->Getd0Prong(1);
175 }
176 }
177 if(fVarsForOpt[6]){
178 iter++;
179 if(TMath::Abs(pdgdaughters[0])==211) {
180 vars[iter]=dd->Getd0Prong(0);
181 }
182 else{
183 vars[iter]=dd->Getd0Prong(1);
184 }
185 }
186 if(fVarsForOpt[7]){
187 iter++;
188 vars[iter]= dd->Prodd0d0();
189 }
190 if(fVarsForOpt[8]){
191 iter++;
192 vars[iter]=dd->CosPointingAngle();
193 }
194
195 return;
196}
197//---------------------------------------------------------------------------
937e1290 198Int_t AliRDHFCutsD0toKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent* aod) {
650b3ced 199 //
200 // Apply selection
201 //
47aa3d55 202
203
d7688946 204 fIsSelectedCuts=0;
205 fIsSelectedPID=0;
206
650b3ced 207 if(!fCutsRD){
208 cout<<"Cut matrice not inizialized. Exit..."<<endl;
3cbc09cd 209 return 0;
650b3ced 210 }
211 //PrintAll();
3cbc09cd 212 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
650b3ced 213
650b3ced 214 if(!d){
215 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
216 return 0;
217 }
218
47aa3d55 219 Double_t ptD=d->Pt();
220 if(ptD<fMinPtCand) return 0;
221 if(ptD>fMaxPtCand) return 0;
937e1290 222
c96634a2 223 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
224 Int_t returnvaluePID=3;
225 Int_t returnvalueCuts=3;
c96634a2 226
650b3ced 227 // selection on candidate
228 if(selectionLevel==AliRDHFCuts::kAll ||
229 selectionLevel==AliRDHFCuts::kCandidate) {
937e1290 230
d7688946 231 if(!fUseKF) {
5f25117b 232
233 //recalculate vertex w/o daughters
234 AliAODVertex *origownvtx=0x0;
235 AliAODVertex *recvtx=0x0;
5f25117b 236 if(fRemoveDaughtersFromPrimary) {
d7688946 237 if(!RecalcOwnPrimaryVtx(d,aod,origownvtx,recvtx)) return 0;
5f25117b 238 }
239
240
241 Double_t pt=d->Pt();
242
243 Int_t okD0=0,okD0bar=0;
244
245 Int_t ptbin=PtBin(pt);
246 if (ptbin==-1) {
d7688946 247 CleanOwnPrimaryVtx(d,origownvtx);
937e1290 248 return 0;
249 }
d7688946 250
5f25117b 251 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
252 okD0=1; okD0bar=1;
253
254 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
d7688946 255
256 d->InvMassD0(mD0,mD0bar);
257 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
258 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
259 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
260
261 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
262
5f25117b 263
be9cad0c 264 if(d->Pt2Prong(1) < fCutsRD[GetGlobalIndex(3,ptbin)]*fCutsRD[GetGlobalIndex(3,ptbin)] || d->Pt2Prong(0) < fCutsRD[GetGlobalIndex(4,ptbin)]*fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
265 if(d->Pt2Prong(0) < fCutsRD[GetGlobalIndex(3,ptbin)]*fCutsRD[GetGlobalIndex(3,ptbin)] || d->Pt2Prong(1) < fCutsRD[GetGlobalIndex(4,ptbin)]*fCutsRD[GetGlobalIndex(4,ptbin)]) okD0bar = 0;
d7688946 266 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
5f25117b 267
268
269 if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
270 TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
271 if(TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
272 TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
d7688946 273 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
5f25117b 274
d7688946 275 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
5f25117b 276
650b3ced 277
5f25117b 278 d->CosThetaStarD0(ctsD0,ctsD0bar);
279 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
280 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
d7688946 281 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
5f25117b 282
be9cad0c 283 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
5f25117b 284
285 if (returnvalueCuts!=0) {
286 if (okD0) returnvalueCuts=1; //cuts passed as D0
287 if (okD0bar) returnvalueCuts=2; //cuts passed as D0bar
288 if (okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
289 }
290
291 // call special cuts
292 Int_t special=1;
293 if(fUseSpecialCuts) special=IsSelectedSpecialCuts(d);
d7688946 294 if(!special) {CleanOwnPrimaryVtx(d,origownvtx); return 0;}
5f25117b 295
296 // unset recalculated primary vertex when not needed any more
d7688946 297 CleanOwnPrimaryVtx(d,origownvtx);
650b3ced 298
d7688946 299 } else {
300 // go to selection with Kalman vertexing, if requested
301 returnvalueCuts = IsSelectedKF(d,aod);
302 }
dcc2ade0 303
d7688946 304 fIsSelectedCuts=returnvalueCuts;
dcc2ade0 305 if(!returnvalueCuts) return 0;
5f25117b 306 }
307
650b3ced 308
dcc2ade0 309 // selection on PID
310 if(selectionLevel==AliRDHFCuts::kAll ||
311 selectionLevel==AliRDHFCuts::kCandidate ||
312 selectionLevel==AliRDHFCuts::kPID) {
313 returnvaluePID = IsSelectedPID(d);
d7688946 314 fIsSelectedPID=returnvaluePID;
dcc2ade0 315 if(!returnvaluePID) return 0;
316 }
317
318 Int_t returnvalueComb=CombineSelectionLevels(3,returnvalueCuts,returnvaluePID);
319
320 if(!returnvalueComb) return 0;
321
322 // selection on daughter tracks
323 if(selectionLevel==AliRDHFCuts::kAll ||
324 selectionLevel==AliRDHFCuts::kTracks) {
325 if(!AreDaughtersSelected(d)) return 0;
326 }
327
5f25117b 328 // cout<<"Pid = "<<returnvaluePID<<endl;
e2b51a19 329 return returnvalueComb;
5f25117b 330}
331
332//------------------------------------------------------------------------------------------
333Int_t AliRDHFCutsD0toKpi::IsSelectedKF(AliAODRecoDecayHF2Prong *d,
334 AliAODEvent* aod) const {
335 //
336 // Apply selection using KF-vertexing
337 //
338
339 AliAODTrack *track0 = (AliAODTrack*)d->GetDaughter(0);
340 AliAODTrack *track1 = (AliAODTrack*)d->GetDaughter(1);
341
342 if(!track0 || !track1) {
343 cout<<"one or two D0 daughters missing!"<<endl;
344 return 0;
345 }
346
347 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
348 Int_t returnvalueCuts=3;
349
350 // candidate selection with AliKF
351 AliKFParticle::SetField(aod->GetMagneticField()); // set the magnetic field
937e1290 352
5f25117b 353 Int_t okD0=0,okD0bar=0;
354 okD0=1; okD0bar=1;
355
356 // convert tracks into AliKFParticles
357
358 AliKFParticle negPiKF(*track1,-211); // neg pion kandidate
359 AliKFParticle negKKF(*track1,-321); // neg kaon kandidate
360 AliKFParticle posPiKF(*track0,211); // pos pion kandidate
361 AliKFParticle posKKF(*track0,321); // pos kaon kandidate
362
363 // build D0 candidates
364
365 AliKFParticle d0c(negKKF,posPiKF); // D0 candidate
366 AliKFParticle ad0c(posKKF,negPiKF); // D0bar candidate
367
368 // create kf primary vertices
369
370 AliAODVertex *vtx1 = aod->GetPrimaryVertex();
371 AliKFVertex primVtx(*vtx1);
372 AliKFVertex aprimVtx(*vtx1);
373
374 if(primVtx.GetNContributors()<=0) okD0 = 0;
375 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
376 if(!okD0 && !okD0bar) returnvalueCuts=0;
377
378 // calculate mass
379
380 Double_t d0mass = d0c.GetMass();
381 Double_t ad0mass = ad0c.GetMass();
382
383 // calculate P of D0 and D0bar
384 Double_t d0P = d0c.GetP();
385 Double_t d0Px = d0c.GetPx();
386 Double_t d0Py = d0c.GetPy();
387 Double_t d0Pz = d0c.GetPz();
388 Double_t ad0P = ad0c.GetP();
389 Double_t ad0Px = ad0c.GetPx();
390 Double_t ad0Py = ad0c.GetPy();
391 Double_t ad0Pz = ad0c.GetPz();
392
393 //calculate Pt of D0 and D0bar
394
395 Double_t pt=d0c.GetPt();
396 Double_t apt=ad0c.GetPt();
397
398 // remove D0 daughters from primary vertices (if used in vertex fit) and add D0-candidates
399
400 if(track0->GetUsedForPrimVtxFit()) {
401 primVtx -= posPiKF;
402 aprimVtx -= posKKF;
403 }
404
405 if(track1->GetUsedForPrimVtxFit()) {
406 primVtx -= negKKF;
407 aprimVtx -= negPiKF;
408 }
409
410 primVtx += d0c;
411 aprimVtx += ad0c;
412
413 if(primVtx.GetNContributors()<=0) okD0 = 0;
414 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
415 if(!okD0 && !okD0bar) returnvalueCuts=0;
416
417 //calculate cut variables
418
419 // calculate impact params of daughters w.r.t recalculated vertices
420
421 Double_t impactPi = posPiKF.GetDistanceFromVertexXY(primVtx);
422 Double_t aimpactPi = negPiKF.GetDistanceFromVertexXY(aprimVtx);
423 Double_t impactKa = negKKF.GetDistanceFromVertexXY(primVtx);
424 Double_t aimpactKa = posKKF.GetDistanceFromVertexXY(aprimVtx);
425
426 // calculate Product of Impact Params
427
428 Double_t prodParam = impactPi*impactKa;
429 Double_t aprodParam = aimpactPi*aimpactKa;
430
431 // calculate cosine of pointing angles
432
433 TVector3 mom(d0c.GetPx(),d0c.GetPy(),d0c.GetPz());
434 TVector3 fline(d0c.GetX()-primVtx.GetX(),
435 d0c.GetY()-primVtx.GetY(),
436 d0c.GetZ()-primVtx.GetZ());
437 Double_t pta = mom.Angle(fline);
438 Double_t cosP = TMath::Cos(pta); // cosine of pta for D0 candidate
439
440 TVector3 amom(ad0c.GetPx(),ad0c.GetPy(),ad0c.GetPz());
441 TVector3 afline(ad0c.GetX()-aprimVtx.GetX(),
442 ad0c.GetY()-aprimVtx.GetY(),
443 ad0c.GetZ()-aprimVtx.GetZ());
444 Double_t apta = amom.Angle(afline);
445 Double_t acosP = TMath::Cos(apta); // cosine of pta for D0bar candidate
446
447 // calculate P of Pions at Decay Position of D0 and D0bar candidates
448 negKKF.TransportToParticle(d0c);
449 posPiKF.TransportToParticle(d0c);
450 posKKF.TransportToParticle(ad0c);
451 negPiKF.TransportToParticle(ad0c);
452
453 Double_t pxPi = posPiKF.GetPx();
454 Double_t pyPi = posPiKF.GetPy();
455 Double_t pzPi = posPiKF.GetPz();
456 Double_t ptPi = posPiKF.GetPt();
457
458 Double_t apxPi = negPiKF.GetPx();
459 Double_t apyPi = negPiKF.GetPy();
460 Double_t apzPi = negPiKF.GetPz();
461 Double_t aptPi = negPiKF.GetPt();
462
463 // calculate Pt of Kaons at Decay Position of D0 and D0bar candidates
464
465 Double_t ptK = negKKF.GetPt();
466 Double_t aptK = posKKF.GetPt();
467
468 //calculate cos(thetastar)
469 Double_t massvtx = TDatabasePDG::Instance()->GetParticle(421)->Mass();
470 Double_t massp[2];
471 massp[0] = TDatabasePDG::Instance()->GetParticle(321)->Mass();
472 massp[1] = TDatabasePDG::Instance()->GetParticle(211)->Mass();
473 Double_t pStar = TMath::Sqrt(TMath::Power(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1],2.)
474 -4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx);
475
476 // cos(thetastar) for D0 and Pion
477
478 Double_t d0E = TMath::Sqrt(massvtx*massvtx + d0P*d0P);
479 Double_t beta = d0P/d0E;
480 Double_t gamma = d0E/massvtx;
481 TVector3 momPi(pxPi,pyPi,pzPi);
482 TVector3 momTot(d0Px,d0Py,d0Pz);
483 Double_t q1 = momPi.Dot(momTot)/momTot.Mag();
484 Double_t cts = (q1/gamma-beta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
485
486 // cos(thetastar) for D0bar and Pion
487
488 Double_t ad0E = TMath::Sqrt(massvtx*massvtx + ad0P*ad0P);
489 Double_t abeta = ad0P/ad0E;
490 Double_t agamma = ad0E/massvtx;
491 TVector3 amomPi(apxPi,apyPi,apzPi);
492 TVector3 amomTot(ad0Px,ad0Py,ad0Pz);
493 Double_t aq1 = amomPi.Dot(amomTot)/amomTot.Mag();
494 Double_t acts = (aq1/agamma-abeta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
495
496 // calculate reduced Chi2 for the full D0 fit
497 d0c.SetProductionVertex(primVtx);
498 ad0c.SetProductionVertex(aprimVtx);
499 negKKF.SetProductionVertex(d0c);
500 posPiKF.SetProductionVertex(d0c);
501 posKKF.SetProductionVertex(ad0c);
502 negPiKF.SetProductionVertex(ad0c);
503 d0c.TransportToProductionVertex();
504 ad0c.TransportToProductionVertex();
505
506 // calculate the decay length
507 Double_t decayLengthD0 = d0c.GetDecayLength();
508 Double_t adecayLengthD0 = ad0c.GetDecayLength();
509
510 Double_t chi2D0 = 50.;
511 if(d0c.GetNDF() > 0 && d0c.GetChi2() >= 0) {
512 chi2D0 = d0c.GetChi2()/d0c.GetNDF();
513 }
514
515 Double_t achi2D0 = 50.;
516 if(ad0c.GetNDF() > 0 && ad0c.GetChi2() >= 0) {
517 achi2D0 = ad0c.GetChi2()/ad0c.GetNDF();
518 }
519
520 // Get the Pt-bins
521 Int_t ptbin=PtBin(pt);
522 Int_t aptbin=PtBin(apt);
523
524 if(ptbin < 0) okD0 = 0;
525 if(aptbin < 0) okD0bar = 0;
526 if(!okD0 && !okD0bar) returnvalueCuts=0;
527
528 if(ptK < fCutsRD[GetGlobalIndex(3,ptbin)] || ptPi < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
529 if(aptK < fCutsRD[GetGlobalIndex(3,aptbin)] || aptPi < fCutsRD[GetGlobalIndex(4,aptbin)]) okD0bar = 0;
530 if(!okD0 && !okD0bar) returnvalueCuts=0;
531
532
533 if(TMath::Abs(impactKa) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
534 TMath::Abs(impactPi) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
535
536 if(TMath::Abs(aimpactKa) > fCutsRD[GetGlobalIndex(5,aptbin)] ||
537 TMath::Abs(aimpactPi) > fCutsRD[GetGlobalIndex(6,aptbin)]) okD0bar = 0;
538
539 if(!okD0 && !okD0bar) returnvalueCuts=0;
540
541 // for the moment via the standard method due to bug in AliKF
542 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) okD0 = 0;
543 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,aptbin)]) okD0bar = 0;
544 if(!okD0 && !okD0bar) returnvalueCuts=0;
650b3ced 545
650b3ced 546
5f25117b 547 if(TMath::Abs(d0mass-massvtx) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
548 if(TMath::Abs(ad0mass-massvtx) > fCutsRD[GetGlobalIndex(0,aptbin)]) okD0bar = 0;
549 if(!okD0 && !okD0bar) returnvalueCuts=0;
550
551
552 if(TMath::Abs(cts) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
553 if(TMath::Abs(acts) > fCutsRD[GetGlobalIndex(2,aptbin)]) okD0bar = 0;
554 if(!okD0 && !okD0bar) returnvalueCuts=0;
555
556 if(prodParam > fCutsRD[GetGlobalIndex(7,ptbin)]) okD0 = 0;
557 if(aprodParam > fCutsRD[GetGlobalIndex(7,aptbin)]) okD0bar = 0;
558 if(!okD0 && !okD0bar) returnvalueCuts=0;
650b3ced 559
5f25117b 560 if(cosP < fCutsRD[GetGlobalIndex(8,ptbin)]) okD0 = 0;
561 if(acosP < fCutsRD[GetGlobalIndex(8,aptbin)]) okD0bar = 0;
562 if(!okD0 && !okD0bar) returnvalueCuts=0;
563
564 if(chi2D0 > fCutsRD[GetGlobalIndex(10,ptbin)]) okD0 = 0;
565 if(achi2D0 > fCutsRD[GetGlobalIndex(10,aptbin)]) okD0bar = 0;
566 if(!okD0 && !okD0bar) returnvalueCuts=0;
567
568 if(decayLengthD0 < fCutsRD[GetGlobalIndex(9,ptbin)]) okD0 = 0;
569 if(adecayLengthD0 < fCutsRD[GetGlobalIndex(9,aptbin)]) okD0bar = 0;
570 if(!okD0 && !okD0bar) returnvalueCuts=0;
650b3ced 571
5f25117b 572 if(returnvalueCuts!=0) {
573 if(okD0) returnvalueCuts=1; //cuts passed as D0
574 if(okD0bar) returnvalueCuts=2; //cuts passed as D0bar
575 if(okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
650b3ced 576 }
577
5f25117b 578 return returnvalueCuts;
650b3ced 579}
5f25117b 580
650b3ced 581//---------------------------------------------------------------------------
5f25117b 582
aa8d25fe 583Bool_t AliRDHFCutsD0toKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
584{
585 //
586 // Checking if D0 is in fiducial acceptance region
587 //
588
c96634a2 589 if(pt > 5.) {
aa8d25fe 590 // applying cut for pt > 5 GeV
937e1290 591 AliDebug(2,Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
aa8d25fe 592 if (TMath::Abs(y) > 0.8){
593 return kFALSE;
594 }
595 } else {
596 // appliying smooth cut for pt < 5 GeV
597 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
598 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
937e1290 599 AliDebug(2,Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
aa8d25fe 600 if (y < minFiducialY || y > maxFiducialY){
601 return kFALSE;
602 }
603 }
c96634a2 604
aa8d25fe 605 return kTRUE;
aa8d25fe 606}
c96634a2 607//---------------------------------------------------------------------------
937e1290 608Int_t AliRDHFCutsD0toKpi::IsSelectedPID(AliAODRecoDecayHF* d)
08ea5c32 609{
610 // ############################################################
611 //
612 // Apply PID selection
613 //
614 //
615 // ############################################################
616
617 if(!fUsePID) return 3;
618 if(fDefaultPID) return IsSelectedPIDdefault(d);
619 fWhyRejection=0;
620 Int_t isD0D0barPID[2]={1,2};
621 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
622 // same for prong 2
623 // values convention -1 = discarded
624 // 0 = not identified (but compatible) || No PID (->hasPID flag)
625 // 1 = identified
626 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
627 // Initial hypothesis: unknwon (but compatible)
628 combinedPID[0][0]=0; // prima figlia, Kaon
629 combinedPID[0][1]=0; // prima figlia, pione
630 combinedPID[1][0]=0; // seconda figlia, Kaon
631 combinedPID[1][1]=0; // seconda figlia, pion
632
633 Bool_t checkPIDInfo[2]={kTRUE,kTRUE};
634 Double_t sigma_tmp[3]={fPidHF->GetSigma(0),fPidHF->GetSigma(1),fPidHF->GetSigma(2)};
635 for(Int_t daught=0;daught<2;daught++){
636 //Loop con prongs
637 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
638
639 if(!(fPidHF->CheckStatus(aodtrack,"TPC")) && !(fPidHF->CheckStatus(aodtrack,"TOF"))) {
640 checkPIDInfo[daught]=kFALSE;
641 continue;
642 }
643
644 // identify kaon
645 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
646
647 // identify pion
648
649 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
650 combinedPID[daught][1]=0;
651 }else{
652 fPidHF->SetTOF(kFALSE);
653 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
654 fPidHF->SetTOF(kTRUE);
655 fPidHF->SetCompat(kTRUE);
656 }
657
658
659 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){ // if not a K- and not a pi- both D0 and D0bar excluded
660 isD0D0barPID[0]=0;
661 isD0D0barPID[1]=0;
662 }
663 else if(combinedPID[daught][0]==2&&combinedPID[daught][1]>=1){
664 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
665 else isD0D0barPID[0]=0;// if K+ D0 excluded
666 }
667 else if(combinedPID[daught][0]==1&&combinedPID[daught][1]>=1){
668 isD0D0barPID[0]=0;
669 isD0D0barPID[1]=0;
670 }
671 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
672 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
673 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
674 }
675 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
676 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
677 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
678 }
679
680 if(fLowPt && d->Pt()<2.){
681 Double_t sigmaTPC[3]={3.,2.,0.};
682 fPidHF->SetSigmaForTPC(sigmaTPC);
683 // identify kaon
684 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
685
686 Double_t ptProng=aodtrack->P();
687
688 if(ptProng<0.6){
689 fPidHF->SetCompat(kFALSE);
690 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
691 fPidHF->SetCompat(kTRUE);
692 }
693
694 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
695 combinedPID[daught][1]=0;
696 }else{
697 fPidHF->SetTOF(kFALSE);
698 Double_t sigmaTPCpi[3]={3.,3.,0.};
699 fPidHF->SetSigmaForTPC(sigmaTPCpi);
700 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
701 fPidHF->SetTOF(kTRUE);
702 if(ptProng<0.8){
703 Bool_t isTPCpion=fPidHF->IsPionRaw(aodtrack,"TPC");
704 if(isTPCpion){
705 combinedPID[daught][1]=1;
706 }else{
707 combinedPID[daught][1]=-1;
708 }
709 }
710 }
711
712 }
713 fPidHF->SetSigmaForTPC(sigma_tmp);
714 }// END OF LOOP ON DAUGHTERS
715
716 if(!checkPIDInfo[0] && !checkPIDInfo[1]) {
717 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
718 return 0;
719 }
720
721
722 // FURTHER PID REQUEST (both daughter info is needed)
723 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
724 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
725 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
726 return 0;
727 }
728
729 if(d->Pt()<2.){
730 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
731 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
732 fWhyRejection=32;// reject cases where the Kaon is not identified
733 return 0;
734 }
735 }
736 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
737
738 // cout<<"Why? "<<fWhyRejection<<endl;
739 return isD0D0barPID[0]+isD0D0barPID[1];
740}
741//---------------------------------------------------------------------------
742Int_t AliRDHFCutsD0toKpi::IsSelectedPIDdefault(AliAODRecoDecayHF* d)
937e1290 743{
744 // ############################################################
c96634a2 745 //
746 // Apply PID selection
c96634a2 747 //
937e1290 748 //
749 // temporary selection: PID AS USED FOR D0 by Andrea Rossi (up to 28/06/2010)
750 //
751 // d must be a AliAODRecoDecayHF2Prong object
752 // returns 0 if both D0 and D0bar are rejectecd
753 // 1 if D0 is accepted while D0bar is rejected
754 // 2 if D0bar is accepted while D0 is rejected
755 // 3 if both are accepted
756 // fWhyRejection variable (not returned for the moment, print it if needed)
757 // keeps some information on why a candidate has been
758 // rejected according to the following (unfriendly?) scheme
759 // if more rejection cases are considered interesting, just add numbers
760 //
761 // TO BE CONSIDERED WITH A GRAIN OF SALT (the order in which cut are applied is relevant)
762 // from 20 to 30: "detector" selection (PID acceptance)
763 // 26: TPC refit
764 // 27: ITS refit
765 // 28: no (TOF||TPC) pid information (no kTOFpid,kTOFout,kTIME,kTPCpid,...)
766 //
767 // from 30 to 40: PID selection
768 // 31: no Kaon compatible tracks found between daughters
769 // 32: no Kaon identified tracks found (strong sel. at low momenta)
770 // 33: both mass hypotheses are rejected
771 //
772 // ############################################################
773
774 if(!fUsePID) return 3;
775 fWhyRejection=0;
776 Int_t isD0D0barPID[2]={1,2};
777 Double_t nsigmaTPCpi=-1., nsigmaTPCK=-1.; //used for TPC pid
778 Double_t tofSig,times[5];// used fot TOF pid
779 Int_t hasPID[2]={2,2};// flag to count how many detectors give PID info for the daughters
780 Int_t isKaonPionTOF[2][2],isKaonPionTPC[2][2];
781 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
782 // same for prong 2
783 // values convention -1 = discarded
784 // 0 = not identified (but compatible) || No PID (->hasPID flag)
785 // 1 = identified
786 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
787 // Initial hypothesis: unknwon (but compatible)
788 isKaonPionTOF[0][0]=0;
789 isKaonPionTOF[0][1]=0;
790 isKaonPionTOF[1][0]=0;
791 isKaonPionTOF[1][1]=0;
792
793 isKaonPionTPC[0][0]=0;
794 isKaonPionTPC[0][1]=0;
795 isKaonPionTPC[1][0]=0;
796 isKaonPionTPC[1][1]=0;
797
798 combinedPID[0][0]=0;
799 combinedPID[0][1]=0;
800 combinedPID[1][0]=0;
801 combinedPID[1][1]=0;
802
803
804
805 for(Int_t daught=0;daught<2;daught++){
806 //Loop con prongs
807
808 // ########### Step 0- CHECKING minimal PID "ACCEPTANCE" ####################
809
810 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
811
812 if(!(aodtrack->GetStatus()&AliESDtrack::kTPCrefit)){
813 fWhyRejection=26;
814 return 0;
815 }
816 if(!(aodtrack->GetStatus()&AliESDtrack::kITSrefit)){
817 fWhyRejection=27;
818 return 0;
819 }
820
821 AliAODPid *pid=aodtrack->GetDetPid();
822 if(!pid) {
823 //delete esdtrack;
824 hasPID[daught]--;
825 continue;
826 }
827
828 // ########### Step 1- Check of TPC and TOF response ####################
829
830 Double_t ptrack=aodtrack->P();
831 //#################### TPC PID #######################
832 if (!(aodtrack->GetStatus()&AliESDtrack::kTPCpid )){
833 // NO TPC PID INFO FOR THIS TRACK
834 hasPID[daught]--;
835 }
836 else {
837 static AliTPCPIDResponse theTPCpid;
08ea5c32 838 AliAODPid *pidObj = aodtrack->GetDetPid();
839 Double_t ptProng=pidObj->GetTPCmomentum();
840 nsigmaTPCpi = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kPion);
841 nsigmaTPCK = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kKaon);
842 //if(ptrack<0.6){
843 if(ptProng<0.6){
937e1290 844 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
845 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
846 if(TMath::Abs(nsigmaTPCpi)<2.)isKaonPionTPC[daught][1]=1;
847 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
848 }
08ea5c32 849 //else if(ptrack<.8){
850 else if(ptProng<.8){
937e1290 851 if(TMath::Abs(nsigmaTPCK)<1.)isKaonPionTPC[daught][0]=1;
852 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
853 if(TMath::Abs(nsigmaTPCpi)<1.)isKaonPionTPC[daught][1]=1;
854 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
855 }
856 else {
857 // if(nsigmaTPCK>-2.&&nsigmaTPCK<1.)isKaonPionTPC[daught][0]=1;
858 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
859 //if(nsigmaTPCpi>-1.&&nsigmaTPCpi<2.)isKaonPionTPC[daught][1]=1;
860 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
861 }
862 }
863
864
865 // ##### TOF PID: do not ask nothing for pion/protons ############
866 if(!((aodtrack->GetStatus()&AliESDtrack::kTOFpid)&&(aodtrack->GetStatus()&AliESDtrack::kTOFout)&&(aodtrack->GetStatus()&AliESDtrack::kTIME))){
867 // NO TOF PID INFO FOR THIS TRACK
868 hasPID[daught]--;
869 }
870 else{
871 tofSig=pid->GetTOFsignal();
872 pid->GetIntegratedTimes(times);
b14fe7f1 873 if((tofSig-times[3])>5.*160.)return 0;// PROTON REJECTION
937e1290 874 if(TMath::Abs(tofSig-times[3])>3.*160.){
875 isKaonPionTOF[daught][0]=-1;
876 }
877 else {
878 if(ptrack<1.5){
879 isKaonPionTOF[daught][0]=1;
880 }
881 }
882 }
883
884 //######### Step 2: COMBINE TOF and TPC PID ###############
885 // we apply the following convention: if TPC and TOF disagree (discarded Vs identified) -> unknown
886 combinedPID[daught][0]=isKaonPionTOF[daught][0]+isKaonPionTPC[daught][0];
887 combinedPID[daught][1]=isKaonPionTOF[daught][1]+isKaonPionTPC[daught][1];
888
889
890 //######### Step 3: USE PID INFO
891
892 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){// if not a K- and not a pi- both D0 and D0bar excluded
893 isD0D0barPID[0]=0;
894 isD0D0barPID[1]=0;
895 }
896 else if(combinedPID[daught][0]==2&&combinedPID[daught][1]>=1){// if in conflict (both pi- and K-), if k for both TPC and TOF -> is K
897 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
898 else isD0D0barPID[0]=0;// if K+ D0 excluded
899 }
900 else if(combinedPID[daught][0]==1&&combinedPID[daught][1]>=1){// if in conflict (both pi- and K-) and k- only for TPC or TOF -> reject
901 isD0D0barPID[0]=0;
902 isD0D0barPID[1]=0;
903 }
904 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
905 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
906 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
907 }
908 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
909 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
910 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
911 }
912
913 // ########## ALSO DIFFERENT TPC PID REQUEST FOR LOW pt D0: request of K identification ###############################
914 // ########## more tolerant criteria for single particle ID-> more selective criteria for D0 ##############################
915 // ############### NOT OPTIMIZED YET ###################################
916 if(d->Pt()<2.){
917 isKaonPionTPC[daught][0]=0;
918 isKaonPionTPC[daught][1]=0;
08ea5c32 919 AliAODPid *pidObj = aodtrack->GetDetPid();
920 Double_t ptProng=pidObj->GetTPCmomentum();
921 //if(ptrack<0.6){
922 if(ptProng<0.6){
937e1290 923 if(TMath::Abs(nsigmaTPCK)<3.)isKaonPionTPC[daught][0]=1;
924 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
925 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
926 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
927 }
08ea5c32 928 //else if(ptrack<.8){
929 else if(ptProng<.8){
937e1290 930 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
931 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
932 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
933 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
934 }
935 else {
936 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
937 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
938 }
939 }
940
941 }// END OF LOOP ON DAUGHTERS
942
943 // FURTHER PID REQUEST (both daughter info is needed)
944 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
945 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
946 return 0;
947 }
948 else if(hasPID[0]==0&&hasPID[1]==0){
949 fWhyRejection=28;// reject cases in which no PID info is available
950 return 0;
951 }
952 if(d->Pt()<2.){
953 // request of K identification at low D0 pt
954 combinedPID[0][0]=0;
955 combinedPID[0][1]=0;
956 combinedPID[1][0]=0;
957 combinedPID[1][1]=0;
958
959 combinedPID[0][0]=isKaonPionTOF[0][0]+isKaonPionTPC[0][0];
960 combinedPID[0][1]=isKaonPionTOF[0][1]+isKaonPionTPC[0][1];
aaf00f06 961 combinedPID[1][0]=isKaonPionTOF[1][0]+isKaonPionTPC[1][0];
962 combinedPID[1][1]=isKaonPionTOF[1][1]+isKaonPionTPC[1][1];
937e1290 963
964 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
965 fWhyRejection=32;// reject cases where the Kaon is not identified
966 return 0;
967 }
968 }
969
970 // cout<<"Why? "<<fWhyRejection<<endl;
971 return isD0D0barPID[0]+isD0D0barPID[1];
972}
973
08ea5c32 974
975
937e1290 976//---------------------------------------------------------------------------
977Int_t AliRDHFCutsD0toKpi::CombineSelectionLevels(Int_t selectionvalTrack,
978 Int_t selectionvalCand,
979 Int_t selectionvalPID) const
980{
981 //
982 // This method combines the tracks, PID and cuts selection results
983 //
984 if(selectionvalTrack==0) return 0;
985
986 Int_t returnvalue;
c96634a2 987
937e1290 988 switch(selectionvalPID) {
989 case 0:
990 returnvalue=0;
991 break;
992 case 1:
993 returnvalue=((selectionvalCand==1 || selectionvalCand==3) ? 1 : 0);
994 break;
995 case 2:
996 returnvalue=((selectionvalCand==2 || selectionvalCand==3) ? 2 : 0);
997 break;
998 case 3:
999 returnvalue=selectionvalCand;
1000 break;
1001 default:
1002 returnvalue=0;
1003 break;
1004 }
1005
1006 return returnvalue;
1007}
1008//----------------------------------------------------------------------------
1009Int_t AliRDHFCutsD0toKpi::IsSelectedSpecialCuts(AliAODRecoDecayHF *d) const
1010{
1011 //
1012 // Note: this method is temporary
1013 // Additional cuts on decay lenght and lower cut for d0 norm are applied using vertex without candidate's daughters
1014 //
c96634a2 1015
937e1290 1016 //apply cuts
aa8d25fe 1017
937e1290 1018 Float_t normDecLengthCut=1.,decLengthCut=TMath::Min(d->P()*0.0066+0.01,0.06/*cm*/), normd0Cut=0.5;
1019 // "decay length" expo law with tau' = beta*gamma*ctau= p/m*ctau =p*0.0123/1.864~p*0.0066
1020 // decay lenght > ctau' implies to retain (1-1/e) (for signal without considering detector resolution),
c96634a2 1021
937e1290 1022 Int_t returnvalue=3; //cut passed
1023 for(Int_t i=0;i<2/*prongs*/;i++){
1024 if(TMath::Abs(d->Normalizedd0Prong(i))<normd0Cut) return 0; //normd0Cut not passed
1025 }
be9cad0c 1026 if(d->DecayLength2()<decLengthCut*decLengthCut) return 0; //decLengthCut not passed
1027 if(d->NormalizedDecayLength2()<normDecLengthCut*normDecLengthCut) return 0; //decLengthCut not passed
937e1290 1028
c96634a2 1029
1030 return returnvalue;
1031}
08ea5c32 1032
5f25117b 1033//----------------------------------------------
5f25117b 1034void AliRDHFCutsD0toKpi::SetUseKF(Bool_t useKF)
1035{
1036 //switch on candidate selection via AliKFparticle
1037 if(!useKF) return;
1038 if(useKF){
1039 fUseKF=useKF;
1040 Int_t nvarsKF=11;
1041 SetNVars(nvarsKF);
1042 TString varNamesKF[11]={"inv. mass [GeV]",
1043 "dca [cm]",
1044 "cosThetaStar",
1045 "pTK [GeV/c]",
1046 "pTPi [GeV/c]",
1047 "d0K [cm]",
1048 "d0Pi [cm]",
1049 "d0d0 [cm^2]",
1050 "cosThetaPoint"
1051 "DecayLength[cm]",
1052 "RedChi2"};
1053 Bool_t isUpperCutKF[11]={kTRUE,
1054 kTRUE,
1055 kTRUE,
1056 kFALSE,
1057 kFALSE,
1058 kTRUE,
1059 kTRUE,
1060 kTRUE,
1061 kFALSE,
1062 kFALSE,
1063 kTRUE};
1064 SetVarNames(nvarsKF,varNamesKF,isUpperCutKF);
1065 SetGlobalIndex();
1066 Bool_t forOpt[11]={kFALSE,
1067 kTRUE,
1068 kTRUE,
1069 kFALSE,
1070 kFALSE,
1071 kFALSE,
1072 kFALSE,
1073 kTRUE,
1074 kTRUE,
1075 kFALSE,
1076 kFALSE};
1077 SetVarsForOpt(4,forOpt);
1078 }
1079 return;
1080}
b14fe7f1 1081
1082
73f4ccee 1083void AliRDHFCutsD0toKpi::SetStandardCutsPP2010() {
1084 //
1085 //STANDARD CUTS USED FOR 2010 pp analysis
1086 //dca cut will be enlarged soon to 400 micron
1087 //
b14fe7f1 1088
1089 SetName("D0toKpiCutsStandard");
1090 SetTitle("Standard Cuts for D0 analysis");
1091
1092 // PILE UP REJECTION
1093 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1094
1095 // EVENT CUTS
1096 SetMinVtxContr(1);
1097
1098
1099 // TRACKS ON SINGLE TRACKS
1100 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1101 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1102 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1103 esdTrackCuts->SetRequireITSRefit(kTRUE);
1104 // esdTrackCuts->SetMinNClustersITS(4);
1105 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1106 esdTrackCuts->SetMinDCAToVertexXY(0.);
1107 esdTrackCuts->SetEtaRange(-0.8,0.8);
1108 esdTrackCuts->SetPtRange(0.3,1.e10);
1109
1110 AddTrackCuts(esdTrackCuts);
1111
1112 const Int_t nptbins =13;
1113 const Double_t ptmax = 9999.;
1114 const Int_t nvars=9;
1115 Float_t ptbins[nptbins+1];
1116 ptbins[0]=0.;
1117 ptbins[1]=0.5;
1118 ptbins[2]=1.;
1119 ptbins[3]=2.;
1120 ptbins[4]=3.;
1121 ptbins[5]=4.;
1122 ptbins[6]=5.;
1123 ptbins[7]=6.;
1124 ptbins[8]=8.;
1125 ptbins[9]=12.;
1126 ptbins[10]=16.;
1127 ptbins[11]=20.;
1128 ptbins[12]=24.;
1129 ptbins[13]=ptmax;
1130
1131 SetGlobalIndex(nvars,nptbins);
1132 SetPtBins(nptbins+1,ptbins);
1133
1134 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,300.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-35000.*1E-8,0.73},/* pt<0.5*/
1135 {0.400,300.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-35000.*1E-8,0.73},/* 0.5<pt<1*/
1136 {0.400,200.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-25000.*1E-8,0.75},/* 1<pt<2 */
1137 {0.400,200.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-15000.*1E-8,0.8},/* 2<pt<3 */
1138 {0.400,200.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85},/* 3<pt<4 */
1139 {0.400,200.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85},/* 4<pt<5 */
1140 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85},/* 5<pt<6 */
1141 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85},/* 6<pt<8 */
1142 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85},/* 8<pt<12 */
1143 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.*1E-8,0.85},/* 12<pt<16 */
1144 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.85},/* 16<pt<20 */
1145 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.85},/* 20<pt<24 */
1146 {0.400,150.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.85}};/* pt>24 */
1147
1148
1149 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1150 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1151 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1152
1153 for (Int_t ibin=0;ibin<nptbins;ibin++){
1154 for (Int_t ivar = 0; ivar<nvars; ivar++){
1155 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1156 }
1157 }
1158
1159 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1160 SetUseSpecialCuts(kTRUE);
1161 SetRemoveDaughtersFromPrim(kTRUE);
1162
e11ae259 1163 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1164 delete [] cutsMatrixTransposeStand;
1165 cutsMatrixTransposeStand=NULL;
1166
b14fe7f1 1167 // PID SETTINGS
1168 AliAODPidHF* pidObj=new AliAODPidHF();
1169 //pidObj->SetName("pid4D0");
1170 Int_t mode=1;
1171 const Int_t nlims=2;
1172 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1173 Bool_t compat=kTRUE; //effective only for this mode
1174 Bool_t asym=kTRUE;
1175 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1176 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1177 pidObj->SetMatch(mode);
1178 pidObj->SetPLimit(plims,nlims);
1179 pidObj->SetSigma(sigmas);
1180 pidObj->SetCompat(compat);
1181 pidObj->SetTPC(kTRUE);
1182 pidObj->SetTOF(kTRUE);
1183
1184 SetPidHF(pidObj);
1185 SetUsePID(kTRUE);
1186 SetUseDefaultPID(kFALSE);
1187
1188
1189 PrintAll();
1190
e11ae259 1191 delete pidObj;
1192 pidObj=NULL;
1193
b14fe7f1 1194 return;
1195
1196}
1197
1198
73f4ccee 1199void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010() {
1200 //
1201 //PRELIMINARY CUTS USED FOR 2010 PbPb analysis
1202 //... EVOLVING SOON
1203 //
b14fe7f1 1204
1205 SetName("D0toKpiCutsStandard");
1206 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run");
1207
1208 // PILE UP REJECTION
1209 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1210
1211 // EVENT CUTS
1212 SetMinVtxContr(1);
1213
1214
1215 // TRACKS ON SINGLE TRACKS
1216 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1217 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1218 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1219 esdTrackCuts->SetRequireITSRefit(kTRUE);
1220 // esdTrackCuts->SetMinNClustersITS(4);
1221 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1222 esdTrackCuts->SetMinDCAToVertexXY(0.);
1223 esdTrackCuts->SetEtaRange(-0.8,0.8);
1224 esdTrackCuts->SetPtRange(0.3,1.e10);
1225
1226 AddTrackCuts(esdTrackCuts);
1227
1228 const Int_t nptbins =13;
1229 const Double_t ptmax = 9999.;
1230 const Int_t nvars=9;
1231 Float_t ptbins[nptbins+1];
1232 ptbins[0]=0.;
1233 ptbins[1]=0.5;
1234 ptbins[2]=1.;
1235 ptbins[3]=2.;
1236 ptbins[4]=3.;
1237 ptbins[5]=4.;
1238 ptbins[6]=5.;
1239 ptbins[7]=6.;
1240 ptbins[8]=8.;
1241 ptbins[9]=12.;
1242 ptbins[10]=16.;
1243 ptbins[11]=20.;
1244 ptbins[12]=24.;
1245 ptbins[13]=ptmax;
1246
1247 SetGlobalIndex(nvars,nptbins);
1248 SetPtBins(nptbins+1,ptbins);
1249
1250 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,300.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-40000.*1E-8,0.8},/* pt<0.5*/
1251 {0.400,300.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-40000.*1E-8,0.8},/* 0.5<pt<1*/
1252 {0.400,250.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-32000.*1E-8,0.8},/* 1<pt<2 */
1253 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-26000.*1E-8,0.94},/* 2<pt<3 */
1254 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-1500.*1E-8,0.88},/* 3<pt<4 */
1255 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-1500.*1E-8,0.88},/* 4<pt<5 */
1256 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-10000.*1E-8,0.90},/* 5<pt<6 */
1257 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-10000.*1E-8,0.90},/* 6<pt<8 */
1258 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-10000.*1E-8,0.90},/* 8<pt<12 */
1259 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.90},/* 12<pt<16 */
1260 {0.400,350.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85},/* 16<pt<20 */
1261 {0.400,350.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.*1E-8,0.85},/* 20<pt<24 */
1262 {0.400,350.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.*1E-8,0.82}};/* pt>24 */
1263
1264
1265 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1266 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1267 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1268
1269 for (Int_t ibin=0;ibin<nptbins;ibin++){
1270 for (Int_t ivar = 0; ivar<nvars; ivar++){
1271 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1272 }
1273 }
1274
1275 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1276 SetUseSpecialCuts(kTRUE);
1277 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
e11ae259 1278 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1279 delete [] cutsMatrixTransposeStand;
1280 cutsMatrixTransposeStand=NULL;
b14fe7f1 1281
1282 // PID SETTINGS
1283 AliAODPidHF* pidObj=new AliAODPidHF();
1284 //pidObj->SetName("pid4D0");
1285 Int_t mode=1;
1286 const Int_t nlims=2;
1287 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1288 Bool_t compat=kTRUE; //effective only for this mode
1289 Bool_t asym=kTRUE;
1290 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1291 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1292 pidObj->SetMatch(mode);
1293 pidObj->SetPLimit(plims,nlims);
1294 pidObj->SetSigma(sigmas);
1295 pidObj->SetCompat(compat);
1296 pidObj->SetTPC(kTRUE);
1297 pidObj->SetTOF(kTRUE);
1298
1299 SetPidHF(pidObj);
1300 SetUsePID(kTRUE);
1301 SetUseDefaultPID(kTRUE);// TEMPORARY: PROTON EXCLUSION SET ONLY IN DEFAULT PID
1302
1303
1304 PrintAll();
1305
e11ae259 1306
1307 delete pidObj;
1308 pidObj=NULL;
1309
b14fe7f1 1310 return;
1311
1312}