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