]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/vertexingHF/AliRDHFCutsD0toKpi.cxx
Setter and getter for centrality estimator (Chiara Bianchin)
[u/mrichter/AliRoot.git] / PWGHF / vertexingHF / AliRDHFCutsD0toKpi.cxx
CommitLineData
fc051756 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/* $Id$ */
17
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"
32#include "AliAODPid.h"
33#include "AliTPCPIDResponse.h"
34#include "AliAODVertex.h"
35#include "AliKFVertex.h"
36#include "AliKFParticle.h"
37
c64cb1f6 38using std::cout;
39using std::endl;
40
fc051756 41ClassImp(AliRDHFCutsD0toKpi)
42
43//--------------------------------------------------------------------------
44AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const char* name) :
45AliRDHFCuts(name),
46fUseSpecialCuts(kFALSE),
47fLowPt(kTRUE),
48fDefaultPID(kFALSE),
49fUseKF(kFALSE),
50fPtLowPID(2.),
1d9bf4ef 51fPtMaxSpecialCuts(9999.),
52fmaxPtrackForPID(9999)
fc051756 53{
54 //
55 // Default Constructor
56 //
57 Int_t nvars=11;
58 SetNVars(nvars);
59 TString varNames[11]={"inv. mass [GeV]",
60 "dca [cm]",
61 "cosThetaStar",
62 "pTK [GeV/c]",
63 "pTPi [GeV/c]",
64 "d0K [cm]",
65 "d0Pi [cm]",
66 "d0d0 [cm^2]",
67 "cosThetaPoint",
68 "|cosThetaPointXY|",
69 "NormDecayLenghtXY"};
70 Bool_t isUpperCut[11]={kTRUE,
71 kTRUE,
72 kTRUE,
73 kFALSE,
74 kFALSE,
75 kTRUE,
76 kTRUE,
77 kTRUE,
78 kFALSE,
79 kFALSE,
80 kFALSE};
81 SetVarNames(nvars,varNames,isUpperCut);
82 Bool_t forOpt[11]={kFALSE,
83 kTRUE,
84 kTRUE,
85 kFALSE,
86 kFALSE,
87 kFALSE,
88 kFALSE,
89 kTRUE,
90 kTRUE,
91 kFALSE,
92 kFALSE};
93 SetVarsForOpt(4,forOpt);
94 Float_t limits[2]={0,999999999.};
95 SetPtBins(2,limits);
96
97}
98//--------------------------------------------------------------------------
99AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const AliRDHFCutsD0toKpi &source) :
100 AliRDHFCuts(source),
101 fUseSpecialCuts(source.fUseSpecialCuts),
102 fLowPt(source.fLowPt),
103 fDefaultPID(source.fDefaultPID),
104 fUseKF(source.fUseKF),
105 fPtLowPID(source.fPtLowPID),
1d9bf4ef 106 fPtMaxSpecialCuts(source.fPtMaxSpecialCuts),
107 fmaxPtrackForPID(source.fmaxPtrackForPID)
fc051756 108{
109 //
110 // Copy constructor
111 //
112
113}
114//--------------------------------------------------------------------------
115AliRDHFCutsD0toKpi &AliRDHFCutsD0toKpi::operator=(const AliRDHFCutsD0toKpi &source)
116{
117 //
118 // assignment operator
119 //
120 if(&source == this) return *this;
121
122 AliRDHFCuts::operator=(source);
123 fUseSpecialCuts=source.fUseSpecialCuts;
124 fLowPt=source.fLowPt;
125 fDefaultPID=source.fDefaultPID;
126 fUseKF=source.fUseKF;
127 fPtLowPID=source.fPtLowPID;
128 fPtMaxSpecialCuts=source.fPtMaxSpecialCuts;
1d9bf4ef 129 fmaxPtrackForPID=source.fmaxPtrackForPID;
fc051756 130 return *this;
131}
132
133
134//---------------------------------------------------------------------------
135void AliRDHFCutsD0toKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters,AliAODEvent *aod) {
136 //
137 // Fills in vars the values of the variables
138 //
139
140 if(nvars!=fnVarsForOpt) {
141 printf("AliRDHFCutsD0toKpi::GetCutsVarsForOpt: wrong number of variables\n");
142 return;
143 }
144
145 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
146
147 //recalculate vertex w/o daughters
148 Bool_t cleanvtx=kFALSE;
149 AliAODVertex *origownvtx=0x0;
150 if(fRemoveDaughtersFromPrimary) {
151 if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
152 cleanvtx=kTRUE;
153 if(!RecalcOwnPrimaryVtx(dd,aod)) {
154 CleanOwnPrimaryVtx(dd,aod,origownvtx);
155 cleanvtx=kFALSE;
156 }
157 }
158
159 Int_t iter=-1;
160 if(fVarsForOpt[0]){
161 iter++;
162 if(TMath::Abs(pdgdaughters[0])==211) {
163 vars[iter]=dd->InvMassD0();
164 } else {
165 vars[iter]=dd->InvMassD0bar();
166 }
167 }
168 if(fVarsForOpt[1]){
169 iter++;
170 vars[iter]=dd->GetDCA();
171 }
172 if(fVarsForOpt[2]){
173 iter++;
174 if(TMath::Abs(pdgdaughters[0])==211) {
175 vars[iter] = dd->CosThetaStarD0();
176 } else {
177 vars[iter] = dd->CosThetaStarD0bar();
178 }
179 }
180 if(fVarsForOpt[3]){
181 iter++;
182 if(TMath::Abs(pdgdaughters[0])==321) {
183 vars[iter]=dd->PtProng(0);
184 }
185 else{
186 vars[iter]=dd->PtProng(1);
187 }
188 }
189 if(fVarsForOpt[4]){
190 iter++;
191 if(TMath::Abs(pdgdaughters[0])==211) {
192 vars[iter]=dd->PtProng(0);
193 }
194 else{
195 vars[iter]=dd->PtProng(1);
196 }
197 }
198 if(fVarsForOpt[5]){
199 iter++;
200 if(TMath::Abs(pdgdaughters[0])==321) {
201 vars[iter]=dd->Getd0Prong(0);
202 }
203 else{
204 vars[iter]=dd->Getd0Prong(1);
205 }
206 }
207 if(fVarsForOpt[6]){
208 iter++;
209 if(TMath::Abs(pdgdaughters[0])==211) {
210 vars[iter]=dd->Getd0Prong(0);
211 }
212 else{
213 vars[iter]=dd->Getd0Prong(1);
214 }
215 }
216 if(fVarsForOpt[7]){
217 iter++;
218 vars[iter]= dd->Prodd0d0();
219 }
220 if(fVarsForOpt[8]){
221 iter++;
222 vars[iter]=dd->CosPointingAngle();
223 }
224
225 if(fVarsForOpt[9]){
226 iter++;
227 vars[iter]=TMath::Abs(dd->CosPointingAngleXY());
228 }
229
230 if(fVarsForOpt[10]){
231 iter++;
232 vars[iter]=dd->NormalizedDecayLengthXY();
233 }
234
235 if(cleanvtx)CleanOwnPrimaryVtx(dd,aod,origownvtx);
236
237 return;
238}
239//---------------------------------------------------------------------------
240Int_t AliRDHFCutsD0toKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent* aod) {
241 //
242 // Apply selection
243 //
244
245
246 fIsSelectedCuts=0;
247 fIsSelectedPID=0;
248
249 if(!fCutsRD){
250 cout<<"Cut matrice not inizialized. Exit..."<<endl;
251 return 0;
252 }
253 //PrintAll();
254 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
fc051756 255 if(!d){
256 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
257 return 0;
258 }
259
260 if(fKeepSignalMC) if(IsSignalMC(d,aod,421)) return 3;
261
262 Double_t ptD=d->Pt();
263 if(ptD<fMinPtCand) return 0;
264 if(ptD>fMaxPtCand) return 0;
265
3e075b37 266 if(fUseTrackSelectionWithFilterBits && d->HasBadDaughters()) return 0;
fc051756 267
268 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
269 Int_t returnvaluePID=3;
270 Int_t returnvalueCuts=3;
271
272 // selection on candidate
273 if(selectionLevel==AliRDHFCuts::kAll ||
274 selectionLevel==AliRDHFCuts::kCandidate) {
275
276 if(!fUseKF) {
277
278 //recalculate vertex w/o daughters
279 AliAODVertex *origownvtx=0x0;
280 if(fRemoveDaughtersFromPrimary && !fUseMCVertex) {
281 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
282 if(!RecalcOwnPrimaryVtx(d,aod)) {
283 CleanOwnPrimaryVtx(d,aod,origownvtx);
284 return 0;
285 }
286 }
287
288 if(fUseMCVertex) {
289 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
290 if(!SetMCPrimaryVtx(d,aod)) {
291 CleanOwnPrimaryVtx(d,aod,origownvtx);
292 return 0;
293 }
294 }
295
296 Double_t pt=d->Pt();
297
298 Int_t okD0=0,okD0bar=0;
299
300 Int_t ptbin=PtBin(pt);
301 if (ptbin==-1) {
302 CleanOwnPrimaryVtx(d,aod,origownvtx);
303 return 0;
304 }
305
306 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
307 okD0=1; okD0bar=1;
308
309 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
310
311 d->InvMassD0(mD0,mD0bar);
312 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
313 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
314 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
315
316 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
317
318
319 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;
320 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;
321 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
322
323
324 if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
325 TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
326 if(TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
327 TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
328 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
329
330 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
331
332
333 d->CosThetaStarD0(ctsD0,ctsD0bar);
334 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
335 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
336 if(!okD0 && !okD0bar) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
337
338 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
339
340
341 if(TMath::Abs(d->CosPointingAngleXY()) < fCutsRD[GetGlobalIndex(9,ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
342
343 Double_t normalDecayLengXY=d->NormalizedDecayLengthXY();
344 if (normalDecayLengXY < fCutsRD[GetGlobalIndex(10, ptbin)]) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
345
346 if (returnvalueCuts!=0) {
347 if (okD0) returnvalueCuts=1; //cuts passed as D0
348 if (okD0bar) returnvalueCuts=2; //cuts passed as D0bar
349 if (okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
350 }
351
352 // call special cuts
353 Int_t special=1;
354 if(fUseSpecialCuts && (pt<fPtMaxSpecialCuts)) special=IsSelectedSpecialCuts(d);
355 if(!special) {CleanOwnPrimaryVtx(d,aod,origownvtx); return 0;}
356
357 // unset recalculated primary vertex when not needed any more
358 CleanOwnPrimaryVtx(d,aod,origownvtx);
359
360 } else {
361 // go to selection with Kalman vertexing, if requested
362 returnvalueCuts = IsSelectedKF(d,aod);
363 }
364
365 fIsSelectedCuts=returnvalueCuts;
366 if(!returnvalueCuts) return 0;
367 }
368
369
370 // selection on PID
371 if(selectionLevel==AliRDHFCuts::kAll ||
372 selectionLevel==AliRDHFCuts::kCandidate ||
373 selectionLevel==AliRDHFCuts::kPID) {
374 returnvaluePID = IsSelectedPID(d);
375 fIsSelectedPID=returnvaluePID;
376 if(!returnvaluePID) return 0;
377 }
378
379 Int_t returnvalueComb=CombineSelectionLevels(3,returnvalueCuts,returnvaluePID);
380
381 if(!returnvalueComb) return 0;
382
383 // selection on daughter tracks
384 if(selectionLevel==AliRDHFCuts::kAll ||
385 selectionLevel==AliRDHFCuts::kTracks) {
386 if(!AreDaughtersSelected(d)) return 0;
387 }
388
389 // cout<<"Pid = "<<returnvaluePID<<endl;
390 return returnvalueComb;
391}
392
393//------------------------------------------------------------------------------------------
394Int_t AliRDHFCutsD0toKpi::IsSelectedKF(AliAODRecoDecayHF2Prong *d,
395 AliAODEvent* aod) const {
396 //
397 // Apply selection using KF-vertexing
398 //
399
400 AliAODTrack *track0 = (AliAODTrack*)d->GetDaughter(0);
401 AliAODTrack *track1 = (AliAODTrack*)d->GetDaughter(1);
402
403 if(!track0 || !track1) {
404 cout<<"one or two D0 daughters missing!"<<endl;
405 return 0;
406 }
407
408 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
409 Int_t returnvalueCuts=3;
410
411 // candidate selection with AliKF
412 AliKFParticle::SetField(aod->GetMagneticField()); // set the magnetic field
413
414 Int_t okD0=0,okD0bar=0;
415 okD0=1; okD0bar=1;
416
417 // convert tracks into AliKFParticles
418
419 AliKFParticle negPiKF(*track1,-211); // neg pion kandidate
420 AliKFParticle negKKF(*track1,-321); // neg kaon kandidate
421 AliKFParticle posPiKF(*track0,211); // pos pion kandidate
422 AliKFParticle posKKF(*track0,321); // pos kaon kandidate
423
424 // build D0 candidates
425
426 AliKFParticle d0c(negKKF,posPiKF); // D0 candidate
427 AliKFParticle ad0c(posKKF,negPiKF); // D0bar candidate
428
429 // create kf primary vertices
430
431 AliAODVertex *vtx1 = aod->GetPrimaryVertex();
432 AliKFVertex primVtx(*vtx1);
433 AliKFVertex aprimVtx(*vtx1);
434
435 if(primVtx.GetNContributors()<=0) okD0 = 0;
436 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
437 if(!okD0 && !okD0bar) returnvalueCuts=0;
438
439 // calculate mass
440
441 Double_t d0mass = d0c.GetMass();
442 Double_t ad0mass = ad0c.GetMass();
443
444 // calculate P of D0 and D0bar
445 Double_t d0P = d0c.GetP();
446 Double_t d0Px = d0c.GetPx();
447 Double_t d0Py = d0c.GetPy();
448 Double_t d0Pz = d0c.GetPz();
449 Double_t ad0P = ad0c.GetP();
450 Double_t ad0Px = ad0c.GetPx();
451 Double_t ad0Py = ad0c.GetPy();
452 Double_t ad0Pz = ad0c.GetPz();
453
454 //calculate Pt of D0 and D0bar
455
456 Double_t pt=d0c.GetPt();
457 Double_t apt=ad0c.GetPt();
458
459 // remove D0 daughters from primary vertices (if used in vertex fit) and add D0-candidates
460
461 if(track0->GetUsedForPrimVtxFit()) {
462 primVtx -= posPiKF;
463 aprimVtx -= posKKF;
464 }
465
466 if(track1->GetUsedForPrimVtxFit()) {
467 primVtx -= negKKF;
468 aprimVtx -= negPiKF;
469 }
470
471 primVtx += d0c;
472 aprimVtx += ad0c;
473
474 if(primVtx.GetNContributors()<=0) okD0 = 0;
475 if(aprimVtx.GetNContributors()<=0) okD0bar = 0;
476 if(!okD0 && !okD0bar) returnvalueCuts=0;
477
478 //calculate cut variables
479
480 // calculate impact params of daughters w.r.t recalculated vertices
481
482 Double_t impactPi = posPiKF.GetDistanceFromVertexXY(primVtx);
483 Double_t aimpactPi = negPiKF.GetDistanceFromVertexXY(aprimVtx);
484 Double_t impactKa = negKKF.GetDistanceFromVertexXY(primVtx);
485 Double_t aimpactKa = posKKF.GetDistanceFromVertexXY(aprimVtx);
486
487 // calculate Product of Impact Params
488
489 Double_t prodParam = impactPi*impactKa;
490 Double_t aprodParam = aimpactPi*aimpactKa;
491
492 // calculate cosine of pointing angles
493
494 TVector3 mom(d0c.GetPx(),d0c.GetPy(),d0c.GetPz());
495 TVector3 fline(d0c.GetX()-primVtx.GetX(),
496 d0c.GetY()-primVtx.GetY(),
497 d0c.GetZ()-primVtx.GetZ());
498 Double_t pta = mom.Angle(fline);
499 Double_t cosP = TMath::Cos(pta); // cosine of pta for D0 candidate
500
501 TVector3 amom(ad0c.GetPx(),ad0c.GetPy(),ad0c.GetPz());
502 TVector3 afline(ad0c.GetX()-aprimVtx.GetX(),
503 ad0c.GetY()-aprimVtx.GetY(),
504 ad0c.GetZ()-aprimVtx.GetZ());
505 Double_t apta = amom.Angle(afline);
506 Double_t acosP = TMath::Cos(apta); // cosine of pta for D0bar candidate
507
508 // calculate P of Pions at Decay Position of D0 and D0bar candidates
509 negKKF.TransportToParticle(d0c);
510 posPiKF.TransportToParticle(d0c);
511 posKKF.TransportToParticle(ad0c);
512 negPiKF.TransportToParticle(ad0c);
513
514 Double_t pxPi = posPiKF.GetPx();
515 Double_t pyPi = posPiKF.GetPy();
516 Double_t pzPi = posPiKF.GetPz();
517 Double_t ptPi = posPiKF.GetPt();
518
519 Double_t apxPi = negPiKF.GetPx();
520 Double_t apyPi = negPiKF.GetPy();
521 Double_t apzPi = negPiKF.GetPz();
522 Double_t aptPi = negPiKF.GetPt();
523
524 // calculate Pt of Kaons at Decay Position of D0 and D0bar candidates
525
526 Double_t ptK = negKKF.GetPt();
527 Double_t aptK = posKKF.GetPt();
528
529 //calculate cos(thetastar)
530 Double_t massvtx = TDatabasePDG::Instance()->GetParticle(421)->Mass();
531 Double_t massp[2];
532 massp[0] = TDatabasePDG::Instance()->GetParticle(321)->Mass();
533 massp[1] = TDatabasePDG::Instance()->GetParticle(211)->Mass();
534 Double_t pStar = TMath::Sqrt(TMath::Power(massvtx*massvtx-massp[0]*massp[0]-massp[1]*massp[1],2.)
535 -4.*massp[0]*massp[0]*massp[1]*massp[1])/(2.*massvtx);
536
537 // cos(thetastar) for D0 and Pion
538
539 Double_t d0E = TMath::Sqrt(massvtx*massvtx + d0P*d0P);
540 Double_t beta = d0P/d0E;
541 Double_t gamma = d0E/massvtx;
542 TVector3 momPi(pxPi,pyPi,pzPi);
543 TVector3 momTot(d0Px,d0Py,d0Pz);
544 Double_t q1 = momPi.Dot(momTot)/momTot.Mag();
545 Double_t cts = (q1/gamma-beta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
546
547 // cos(thetastar) for D0bar and Pion
548
549 Double_t ad0E = TMath::Sqrt(massvtx*massvtx + ad0P*ad0P);
550 Double_t abeta = ad0P/ad0E;
551 Double_t agamma = ad0E/massvtx;
552 TVector3 amomPi(apxPi,apyPi,apzPi);
553 TVector3 amomTot(ad0Px,ad0Py,ad0Pz);
554 Double_t aq1 = amomPi.Dot(amomTot)/amomTot.Mag();
555 Double_t acts = (aq1/agamma-abeta*TMath::Sqrt(pStar*pStar+massp[1]*massp[1]))/pStar;
556
557 // calculate reduced Chi2 for the full D0 fit
558 d0c.SetProductionVertex(primVtx);
559 ad0c.SetProductionVertex(aprimVtx);
560 negKKF.SetProductionVertex(d0c);
561 posPiKF.SetProductionVertex(d0c);
562 posKKF.SetProductionVertex(ad0c);
563 negPiKF.SetProductionVertex(ad0c);
564 d0c.TransportToProductionVertex();
565 ad0c.TransportToProductionVertex();
566
567 // calculate the decay length
568 Double_t decayLengthD0 = d0c.GetDecayLength();
569 Double_t adecayLengthD0 = ad0c.GetDecayLength();
570
571 Double_t chi2D0 = 50.;
572 if(d0c.GetNDF() > 0 && d0c.GetChi2() >= 0) {
573 chi2D0 = d0c.GetChi2()/d0c.GetNDF();
574 }
575
576 Double_t achi2D0 = 50.;
577 if(ad0c.GetNDF() > 0 && ad0c.GetChi2() >= 0) {
578 achi2D0 = ad0c.GetChi2()/ad0c.GetNDF();
579 }
580
581 // Get the Pt-bins
582 Int_t ptbin=PtBin(pt);
583 Int_t aptbin=PtBin(apt);
584
585 if(ptbin < 0) okD0 = 0;
586 if(aptbin < 0) okD0bar = 0;
587 if(!okD0 && !okD0bar) returnvalueCuts=0;
588
589 if(ptK < fCutsRD[GetGlobalIndex(3,ptbin)] || ptPi < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
590 if(aptK < fCutsRD[GetGlobalIndex(3,aptbin)] || aptPi < fCutsRD[GetGlobalIndex(4,aptbin)]) okD0bar = 0;
591 if(!okD0 && !okD0bar) returnvalueCuts=0;
592
593
594 if(TMath::Abs(impactKa) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
595 TMath::Abs(impactPi) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
596
597 if(TMath::Abs(aimpactKa) > fCutsRD[GetGlobalIndex(5,aptbin)] ||
598 TMath::Abs(aimpactPi) > fCutsRD[GetGlobalIndex(6,aptbin)]) okD0bar = 0;
599
600 if(!okD0 && !okD0bar) returnvalueCuts=0;
601
602 // for the moment via the standard method due to bug in AliKF
603 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) okD0 = 0;
604 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,aptbin)]) okD0bar = 0;
605 if(!okD0 && !okD0bar) returnvalueCuts=0;
606
607
608 if(TMath::Abs(d0mass-massvtx) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
609 if(TMath::Abs(ad0mass-massvtx) > fCutsRD[GetGlobalIndex(0,aptbin)]) okD0bar = 0;
610 if(!okD0 && !okD0bar) returnvalueCuts=0;
611
612
613 if(TMath::Abs(cts) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
614 if(TMath::Abs(acts) > fCutsRD[GetGlobalIndex(2,aptbin)]) okD0bar = 0;
615 if(!okD0 && !okD0bar) returnvalueCuts=0;
616
617 if(prodParam > fCutsRD[GetGlobalIndex(7,ptbin)]) okD0 = 0;
618 if(aprodParam > fCutsRD[GetGlobalIndex(7,aptbin)]) okD0bar = 0;
619 if(!okD0 && !okD0bar) returnvalueCuts=0;
620
621 if(cosP < fCutsRD[GetGlobalIndex(8,ptbin)]) okD0 = 0;
622 if(acosP < fCutsRD[GetGlobalIndex(8,aptbin)]) okD0bar = 0;
623 if(!okD0 && !okD0bar) returnvalueCuts=0;
624
625 if(chi2D0 > fCutsRD[GetGlobalIndex(10,ptbin)]) okD0 = 0;
626 if(achi2D0 > fCutsRD[GetGlobalIndex(10,aptbin)]) okD0bar = 0;
627 if(!okD0 && !okD0bar) returnvalueCuts=0;
628
629 if(decayLengthD0 < fCutsRD[GetGlobalIndex(9,ptbin)]) okD0 = 0;
630 if(adecayLengthD0 < fCutsRD[GetGlobalIndex(9,aptbin)]) okD0bar = 0;
631 if(!okD0 && !okD0bar) returnvalueCuts=0;
632
633 if(returnvalueCuts!=0) {
634 if(okD0) returnvalueCuts=1; //cuts passed as D0
635 if(okD0bar) returnvalueCuts=2; //cuts passed as D0bar
636 if(okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
637 }
638
639 return returnvalueCuts;
640}
641
642//---------------------------------------------------------------------------
643
644Bool_t AliRDHFCutsD0toKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
645{
646 //
647 // Checking if D0 is in fiducial acceptance region
648 //
649
650 if(pt > 5.) {
651 // applying cut for pt > 5 GeV
652 AliDebug(2,Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
653 if (TMath::Abs(y) > 0.8){
654 return kFALSE;
655 }
656 } else {
657 // appliying smooth cut for pt < 5 GeV
658 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
659 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
660 AliDebug(2,Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
661 if (y < minFiducialY || y > maxFiducialY){
662 return kFALSE;
663 }
664 }
665
666 return kTRUE;
667}
668//---------------------------------------------------------------------------
669Int_t AliRDHFCutsD0toKpi::IsSelectedPID(AliAODRecoDecayHF* d)
670{
671 // ############################################################
672 //
673 // Apply PID selection
674 //
675 //
676 // ############################################################
677
678 if(!fUsePID) return 3;
679 if(fDefaultPID) return IsSelectedPIDdefault(d);
680 fWhyRejection=0;
681 Int_t isD0D0barPID[2]={1,2};
682 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
683 // same for prong 2
684 // values convention -1 = discarded
685 // 0 = not identified (but compatible) || No PID (->hasPID flag)
686 // 1 = identified
687 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
688 // Initial hypothesis: unknwon (but compatible)
689 combinedPID[0][0]=0; // prima figlia, Kaon
690 combinedPID[0][1]=0; // prima figlia, pione
691 combinedPID[1][0]=0; // seconda figlia, Kaon
692 combinedPID[1][1]=0; // seconda figlia, pion
693
694 Bool_t checkPIDInfo[2]={kTRUE,kTRUE};
695 Double_t sigma_tmp[3]={fPidHF->GetSigma(0),fPidHF->GetSigma(1),fPidHF->GetSigma(2)};
696 for(Int_t daught=0;daught<2;daught++){
697 //Loop con prongs
698 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
699 if(fPidHF->IsTOFPiKexcluded(aodtrack,5.)) return 0;
700
701 if(!(fPidHF->CheckStatus(aodtrack,"TPC")) && !(fPidHF->CheckStatus(aodtrack,"TOF"))) {
702 checkPIDInfo[daught]=kFALSE;
703 continue;
704 }
1d9bf4ef 705 Double_t pProng=aodtrack->P();
fc051756 706
707 // identify kaon
1d9bf4ef 708 if(pProng<fmaxPtrackForPID){
709 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
710 }
fc051756 711 // identify pion
1d9bf4ef 712 if(pProng<fmaxPtrackForPID){
713 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
714 combinedPID[daught][1]=0;
715 }else{
716 fPidHF->SetTOF(kFALSE);
717 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
718 fPidHF->SetTOF(kTRUE);
719 fPidHF->SetCompat(kTRUE);
720 }
721 }
fc051756 722
723 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){ // if not a K- and not a pi- both D0 and D0bar excluded
724 isD0D0barPID[0]=0;
725 isD0D0barPID[1]=0;
726 }
727 else if(combinedPID[daught][0]==2&&combinedPID[daught][1]>=1){
728 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
729 else isD0D0barPID[0]=0;// if K+ D0 excluded
730 }
731 /* else if(combinedPID[daught][0]==1&&combinedPID[daught][1]>=1){
732 isD0D0barPID[0]=0;
733 isD0D0barPID[1]=0;
734 }
735 */
736 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
737 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
738 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
739 }
740 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
741 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
742 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
743 }
744
745 if(fLowPt && d->Pt()<fPtLowPID){
746 Double_t sigmaTPC[3]={3.,2.,0.};
747 fPidHF->SetSigmaForTPC(sigmaTPC);
748 // identify kaon
749 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
750
1d9bf4ef 751 if(pProng<0.6){
fc051756 752 fPidHF->SetCompat(kFALSE);
753 combinedPID[daught][0]=fPidHF->MakeRawPid(aodtrack,3);
754 fPidHF->SetCompat(kTRUE);
755 }
756
757 if(!(fPidHF->CheckStatus(aodtrack,"TPC"))) {
758 combinedPID[daught][1]=0;
759 }else{
760 fPidHF->SetTOF(kFALSE);
761 Double_t sigmaTPCpi[3]={3.,3.,0.};
762 fPidHF->SetSigmaForTPC(sigmaTPCpi);
763 combinedPID[daught][1]=fPidHF->MakeRawPid(aodtrack,2);
764 fPidHF->SetTOF(kTRUE);
1d9bf4ef 765 if(pProng<0.8){
fc051756 766 Bool_t isTPCpion=fPidHF->IsPionRaw(aodtrack,"TPC");
767 if(isTPCpion){
768 combinedPID[daught][1]=1;
769 }else{
770 combinedPID[daught][1]=-1;
771 }
772 }
773 }
774
775 }
776 fPidHF->SetSigmaForTPC(sigma_tmp);
777 }// END OF LOOP ON DAUGHTERS
778
779 if(!checkPIDInfo[0] && !checkPIDInfo[1]) {
780 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
781 return 0;
782 }
783
784
785 // FURTHER PID REQUEST (both daughter info is needed)
786 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
787 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
788 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
789 return 0;
790 }
791
792 if(fLowPt && d->Pt()<fPtLowPID){
793 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
794 fWhyRejection=32;// reject cases where the Kaon is not identified
795 fPidHF->SetSigmaForTPC(sigma_tmp);
796 return 0;
797 }
798 }
799 if(fLowPt) fPidHF->SetSigmaForTPC(sigma_tmp);
800
801 // cout<<"Why? "<<fWhyRejection<<endl;
802 return isD0D0barPID[0]+isD0D0barPID[1];
803}
804//---------------------------------------------------------------------------
805Int_t AliRDHFCutsD0toKpi::IsSelectedPIDdefault(AliAODRecoDecayHF* d)
806{
807 // ############################################################
808 //
809 // Apply PID selection
810 //
811 //
812 // temporary selection: PID AS USED FOR D0 by Andrea Rossi (up to 28/06/2010)
813 //
814 // d must be a AliAODRecoDecayHF2Prong object
815 // returns 0 if both D0 and D0bar are rejectecd
816 // 1 if D0 is accepted while D0bar is rejected
817 // 2 if D0bar is accepted while D0 is rejected
818 // 3 if both are accepted
819 // fWhyRejection variable (not returned for the moment, print it if needed)
820 // keeps some information on why a candidate has been
821 // rejected according to the following (unfriendly?) scheme
822 // if more rejection cases are considered interesting, just add numbers
823 //
824 // TO BE CONSIDERED WITH A GRAIN OF SALT (the order in which cut are applied is relevant)
825 // from 20 to 30: "detector" selection (PID acceptance)
826 // 26: TPC refit
827 // 27: ITS refit
828 // 28: no (TOF||TPC) pid information (no kTOFpid,kTOFout,kTIME,kTPCpid,...)
829 //
830 // from 30 to 40: PID selection
831 // 31: no Kaon compatible tracks found between daughters
832 // 32: no Kaon identified tracks found (strong sel. at low momenta)
833 // 33: both mass hypotheses are rejected
834 //
835 // ############################################################
836
837 if(!fUsePID) return 3;
838 fWhyRejection=0;
839 Int_t isD0D0barPID[2]={1,2};
840 Double_t nsigmaTPCpi=-1., nsigmaTPCK=-1.; //used for TPC pid
841 Double_t tofSig,times[5];// used fot TOF pid
842 Int_t hasPID[2]={2,2};// flag to count how many detectors give PID info for the daughters
843 Int_t isKaonPionTOF[2][2],isKaonPionTPC[2][2];
844 Int_t combinedPID[2][2];// CONVENTION: [daught][isK,IsPi]; [0][0]=(prong 1, isK)=value [0][1]=(prong 1, isPi)=value;
845 // same for prong 2
846 // values convention -1 = discarded
847 // 0 = not identified (but compatible) || No PID (->hasPID flag)
848 // 1 = identified
849 // PID search: pion (TPC) or not K (TOF), Kaon hypothesis for both
850 // Initial hypothesis: unknwon (but compatible)
851 isKaonPionTOF[0][0]=0;
852 isKaonPionTOF[0][1]=0;
853 isKaonPionTOF[1][0]=0;
854 isKaonPionTOF[1][1]=0;
855
856 isKaonPionTPC[0][0]=0;
857 isKaonPionTPC[0][1]=0;
858 isKaonPionTPC[1][0]=0;
859 isKaonPionTPC[1][1]=0;
860
861 combinedPID[0][0]=0;
862 combinedPID[0][1]=0;
863 combinedPID[1][0]=0;
864 combinedPID[1][1]=0;
865
866
867
868 for(Int_t daught=0;daught<2;daught++){
869 //Loop con prongs
870
871 // ########### Step 0- CHECKING minimal PID "ACCEPTANCE" ####################
872
873 AliAODTrack *aodtrack=(AliAODTrack*)d->GetDaughter(daught);
874
875 if(!(aodtrack->GetStatus()&AliESDtrack::kTPCrefit)){
876 fWhyRejection=26;
877 return 0;
878 }
879 if(!(aodtrack->GetStatus()&AliESDtrack::kITSrefit)){
880 fWhyRejection=27;
881 return 0;
882 }
883
884 AliAODPid *pid=aodtrack->GetDetPid();
885 if(!pid) {
886 //delete esdtrack;
887 hasPID[daught]--;
888 continue;
889 }
890
891 // ########### Step 1- Check of TPC and TOF response ####################
892
893 Double_t ptrack=aodtrack->P();
894 //#################### TPC PID #######################
895 if (!(aodtrack->GetStatus()&AliESDtrack::kTPCpid )){
896 // NO TPC PID INFO FOR THIS TRACK
897 hasPID[daught]--;
898 }
899 else {
900 static AliTPCPIDResponse theTPCpid;
901 AliAODPid *pidObj = aodtrack->GetDetPid();
902 Double_t ptProng=pidObj->GetTPCmomentum();
903 nsigmaTPCpi = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kPion);
904 nsigmaTPCK = theTPCpid.GetNumberOfSigmas(ptProng,(Float_t)pid->GetTPCsignal(),(Int_t)aodtrack->GetTPCClusterMap().CountBits(),AliPID::kKaon);
905 //if(ptrack<0.6){
906 if(ptProng<0.6){
907 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
908 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
909 if(TMath::Abs(nsigmaTPCpi)<2.)isKaonPionTPC[daught][1]=1;
910 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
911 }
912 //else if(ptrack<.8){
913 else if(ptProng<.8){
914 if(TMath::Abs(nsigmaTPCK)<1.)isKaonPionTPC[daught][0]=1;
915 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
916 if(TMath::Abs(nsigmaTPCpi)<1.)isKaonPionTPC[daught][1]=1;
917 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
918 }
919 else {
920 // if(nsigmaTPCK>-2.&&nsigmaTPCK<1.)isKaonPionTPC[daught][0]=1;
921 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
922 //if(nsigmaTPCpi>-1.&&nsigmaTPCpi<2.)isKaonPionTPC[daught][1]=1;
923 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
924 }
925 }
926
927
928 // ##### TOF PID: do not ask nothing for pion/protons ############
929 if(!((aodtrack->GetStatus()&AliESDtrack::kTOFpid)&&(aodtrack->GetStatus()&AliESDtrack::kTOFout)&&(aodtrack->GetStatus()&AliESDtrack::kTIME))){
930 // NO TOF PID INFO FOR THIS TRACK
931 hasPID[daught]--;
932 }
933 else{
934 tofSig=pid->GetTOFsignal();
935 pid->GetIntegratedTimes(times);
936 if((tofSig-times[3])>5.*160.)return 0;// PROTON REJECTION
937 if(TMath::Abs(tofSig-times[3])>3.*160.){
938 isKaonPionTOF[daught][0]=-1;
939 }
940 else {
941 if(ptrack<1.5){
942 isKaonPionTOF[daught][0]=1;
943 }
944 }
945 }
946
947 //######### Step 2: COMBINE TOF and TPC PID ###############
948 // we apply the following convention: if TPC and TOF disagree (discarded Vs identified) -> unknown
949 combinedPID[daught][0]=isKaonPionTOF[daught][0]+isKaonPionTPC[daught][0];
950 combinedPID[daught][1]=isKaonPionTOF[daught][1]+isKaonPionTPC[daught][1];
951
952
953 //######### Step 3: USE PID INFO
954
955 if(combinedPID[daught][0]<=-1&&combinedPID[daught][1]<=-1){// if not a K- and not a pi- both D0 and D0bar excluded
956 isD0D0barPID[0]=0;
957 isD0D0barPID[1]=0;
958 }
959 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
960 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;//if K- D0bar excluded
961 else isD0D0barPID[0]=0;// if K+ D0 excluded
962 }
963 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
964 isD0D0barPID[0]=0;
965 isD0D0barPID[1]=0;
966 }
967 else if(combinedPID[daught][0]>=1||combinedPID[daught][1]<=-1){
968 if(aodtrack->Charge()==-1)isD0D0barPID[1]=0;// not a D0bar if K- or if pi- excluded
969 else isD0D0barPID[0]=0;// not a D0 if K+ or if pi+ excluded
970 }
971 else if(combinedPID[daught][0]<=-1||combinedPID[daught][1]>=1){
972 if(aodtrack->Charge()==-1)isD0D0barPID[0]=0;// not a D0 if pi- or if K- excluded
973 else isD0D0barPID[1]=0;// not a D0bar if pi+ or if K+ excluded
974 }
975
976 // ########## ALSO DIFFERENT TPC PID REQUEST FOR LOW pt D0: request of K identification ###############################
977 // ########## more tolerant criteria for single particle ID-> more selective criteria for D0 ##############################
978 // ############### NOT OPTIMIZED YET ###################################
979 if(d->Pt()<2.){
980 isKaonPionTPC[daught][0]=0;
981 isKaonPionTPC[daught][1]=0;
982 AliAODPid *pidObj = aodtrack->GetDetPid();
983 Double_t ptProng=pidObj->GetTPCmomentum();
984 //if(ptrack<0.6){
985 if(ptProng<0.6){
986 if(TMath::Abs(nsigmaTPCK)<3.)isKaonPionTPC[daught][0]=1;
987 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
988 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
989 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
990 }
991 //else if(ptrack<.8){
992 else if(ptProng<.8){
993 if(TMath::Abs(nsigmaTPCK)<2.)isKaonPionTPC[daught][0]=1;
994 else if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
995 if(TMath::Abs(nsigmaTPCpi)<3.)isKaonPionTPC[daught][1]=1;
996 else if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
997 }
998 else {
999 if(TMath::Abs(nsigmaTPCK)>3.)isKaonPionTPC[daught][0]=-1;
1000 if(TMath::Abs(nsigmaTPCpi)>3.)isKaonPionTPC[daught][1]=-1;
1001 }
1002 }
1003
1004 }// END OF LOOP ON DAUGHTERS
1005
1006 // FURTHER PID REQUEST (both daughter info is needed)
1007 if(combinedPID[0][0]<=-1&&combinedPID[1][0]<=-1){
1008 fWhyRejection=31;// reject cases in which no kaon-compatible tracks are found
1009 return 0;
1010 }
1011 else if(hasPID[0]==0&&hasPID[1]==0){
1012 fWhyRejection=28;// reject cases in which no PID info is available
1013 return 0;
1014 }
1015 if(d->Pt()<2.){
1016 // request of K identification at low D0 pt
1017 combinedPID[0][0]=0;
1018 combinedPID[0][1]=0;
1019 combinedPID[1][0]=0;
1020 combinedPID[1][1]=0;
1021
1022 combinedPID[0][0]=isKaonPionTOF[0][0]+isKaonPionTPC[0][0];
1023 combinedPID[0][1]=isKaonPionTOF[0][1]+isKaonPionTPC[0][1];
1024 combinedPID[1][0]=isKaonPionTOF[1][0]+isKaonPionTPC[1][0];
1025 combinedPID[1][1]=isKaonPionTOF[1][1]+isKaonPionTPC[1][1];
1026
1027 if(combinedPID[0][0]<=0&&combinedPID[1][0]<=0){
1028 fWhyRejection=32;// reject cases where the Kaon is not identified
1029 return 0;
1030 }
1031 }
1032
1033 // cout<<"Why? "<<fWhyRejection<<endl;
1034 return isD0D0barPID[0]+isD0D0barPID[1];
1035}
1036
1037
1038
1039//---------------------------------------------------------------------------
1040Int_t AliRDHFCutsD0toKpi::CombineSelectionLevels(Int_t selectionvalTrack,
1041 Int_t selectionvalCand,
1042 Int_t selectionvalPID) const
1043{
1044 //
1045 // This method combines the tracks, PID and cuts selection results
1046 //
1047 if(selectionvalTrack==0) return 0;
1048
1049 Int_t returnvalue;
1050
1051 switch(selectionvalPID) {
1052 case 0:
1053 returnvalue=0;
1054 break;
1055 case 1:
1056 returnvalue=((selectionvalCand==1 || selectionvalCand==3) ? 1 : 0);
1057 break;
1058 case 2:
1059 returnvalue=((selectionvalCand==2 || selectionvalCand==3) ? 2 : 0);
1060 break;
1061 case 3:
1062 returnvalue=selectionvalCand;
1063 break;
1064 default:
1065 returnvalue=0;
1066 break;
1067 }
1068
1069 return returnvalue;
1070}
1071//----------------------------------------------------------------------------
1072Int_t AliRDHFCutsD0toKpi::IsSelectedSpecialCuts(AliAODRecoDecayHF *d) const
1073{
1074 //
1075 // Note: this method is temporary
1076 // Additional cuts on decay lenght and lower cut for d0 norm are applied using vertex without candidate's daughters
1077 //
1078
1079 //apply cuts
1080
1081 Float_t normDecLengthCut=1.,decLengthCut=TMath::Min(d->P()*0.0066+0.01,0.06/*cm*/), normd0Cut=0.5;
1082 // "decay length" expo law with tau' = beta*gamma*ctau= p/m*ctau =p*0.0123/1.864~p*0.0066
1083 // decay lenght > ctau' implies to retain (1-1/e) (for signal without considering detector resolution),
1084
1085 Int_t returnvalue=3; //cut passed
1086 for(Int_t i=0;i<2/*prongs*/;i++){
1087 if(TMath::Abs(d->Normalizedd0Prong(i))<normd0Cut) return 0; //normd0Cut not passed
1088 }
1089 if(d->DecayLength2()<decLengthCut*decLengthCut) return 0; //decLengthCut not passed
1090 if(d->NormalizedDecayLength2()<normDecLengthCut*normDecLengthCut) return 0; //decLengthCut not passed
1091
1092 return returnvalue;
1093}
1094
1095//----------------------------------------------
1096void AliRDHFCutsD0toKpi::SetUseKF(Bool_t useKF)
1097{
1098 //switch on candidate selection via AliKFparticle
1099 if(!useKF) return;
1100 if(useKF){
1101 fUseKF=useKF;
1102 Int_t nvarsKF=11;
1103 SetNVars(nvarsKF);
1104 TString varNamesKF[11]={"inv. mass [GeV]",
1105 "dca [cm]",
1106 "cosThetaStar",
1107 "pTK [GeV/c]",
1108 "pTPi [GeV/c]",
1109 "d0K [cm]",
1110 "d0Pi [cm]",
1111 "d0d0 [cm^2]",
1112 "cosThetaPoint"
1113 "DecayLength[cm]",
1114 "RedChi2"};
1115 Bool_t isUpperCutKF[11]={kTRUE,
1116 kTRUE,
1117 kTRUE,
1118 kFALSE,
1119 kFALSE,
1120 kTRUE,
1121 kTRUE,
1122 kTRUE,
1123 kFALSE,
1124 kFALSE,
1125 kTRUE};
1126 SetVarNames(nvarsKF,varNamesKF,isUpperCutKF);
1127 SetGlobalIndex();
1128 Bool_t forOpt[11]={kFALSE,
1129 kTRUE,
1130 kTRUE,
1131 kFALSE,
1132 kFALSE,
1133 kFALSE,
1134 kFALSE,
1135 kTRUE,
1136 kTRUE,
1137 kFALSE,
1138 kFALSE};
1139 SetVarsForOpt(4,forOpt);
1140 }
1141 return;
1142}
1143
1144
1145void AliRDHFCutsD0toKpi::SetStandardCutsPP2010() {
1146 //
1147 //STANDARD CUTS USED FOR 2010 pp analysis
1148 //dca cut will be enlarged soon to 400 micron
1149 //
1150
1151 SetName("D0toKpiCutsStandard");
1152 SetTitle("Standard Cuts for D0 analysis");
1153
1154 // PILE UP REJECTION
1155 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1156
1157 // EVENT CUTS
1158 SetMinVtxContr(1);
1159 // MAX Z-VERTEX CUT
1160 SetMaxVtxZ(10.);
1161
1162 // TRACKS ON SINGLE TRACKS
1163 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1164 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1165 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1166 esdTrackCuts->SetRequireITSRefit(kTRUE);
1167 // esdTrackCuts->SetMinNClustersITS(4);
1168 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1169 esdTrackCuts->SetMinDCAToVertexXY(0.);
1170 esdTrackCuts->SetEtaRange(-0.8,0.8);
1171 esdTrackCuts->SetPtRange(0.3,1.e10);
1172
1173 AddTrackCuts(esdTrackCuts);
1174
1175
1176 const Int_t nptbins =14;
1177 const Double_t ptmax = 9999.;
1178 const Int_t nvars=11;
1179 Float_t ptbins[nptbins+1];
1180 ptbins[0]=0.;
1181 ptbins[1]=0.5;
1182 ptbins[2]=1.;
1183 ptbins[3]=2.;
1184 ptbins[4]=3.;
1185 ptbins[5]=4.;
1186 ptbins[6]=5.;
1187 ptbins[7]=6.;
1188 ptbins[8]=7.;
1189 ptbins[9]=8.;
1190 ptbins[10]=12.;
1191 ptbins[11]=16.;
1192 ptbins[12]=20.;
1193 ptbins[13]=24.;
1194 ptbins[14]=ptmax;
1195
1196 SetGlobalIndex(nvars,nptbins);
1197 SetPtBins(nptbins+1,ptbins);
1198
1199 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,350.*1E-4,0.8,0.5,0.5,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.80,0.,0.},/* pt<0.5*/
1200 {0.400,350.*1E-4,0.8,0.5,0.5,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.80,0.,0.},/* 0.5<pt<1*/
1201 {0.400,300.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-25000.*1E-8,0.80,0.,0.},/* 1<pt<2 */
1202 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-15000.*1E-8,0.85,0.,0.},/* 2<pt<3 */
1203 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85,0.,0.},/* 3<pt<4 */
1204 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85,0.,0.},/* 4<pt<5 */
1205 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85,0.,0.},/* 5<pt<6 */
1206 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-8000.*1E-8,0.85,0.,0.},/* 6<pt<7 */
1207 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-7000.*1E-8,0.85,0.,0.},/* 7<pt<8 */
1208 {0.400,300.*1E-4,0.9,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85,0.,0.},/* 8<pt<12 */
1209 {0.400,300.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,10000.*1E-8,0.85,0.,0.},/* 12<pt<16 */
1210 {0.400,300.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,999999.*1E-8,0.85,0.,0.},/* 16<pt<20 */
1211 {0.400,300.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,999999.*1E-8,0.85,0.,0.},/* 20<pt<24 */
1212 {0.400,300.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,999999.*1E-8,0.85,0.,0.}};/* pt>24 */
1213
1214
1215 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1216 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1217 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1218
1219 for (Int_t ibin=0;ibin<nptbins;ibin++){
1220 for (Int_t ivar = 0; ivar<nvars; ivar++){
1221 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1222 }
1223 }
1224
1225 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1226 SetUseSpecialCuts(kTRUE);
1227 SetRemoveDaughtersFromPrim(kTRUE);
1228
1229 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1230 delete [] cutsMatrixTransposeStand;
1231 cutsMatrixTransposeStand=NULL;
1232
1233 // PID SETTINGS
1234 AliAODPidHF* pidObj=new AliAODPidHF();
1235 //pidObj->SetName("pid4D0");
1236 Int_t mode=1;
1237 const Int_t nlims=2;
1238 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1239 Bool_t compat=kTRUE; //effective only for this mode
1240 Bool_t asym=kTRUE;
1241 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1242 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1243 pidObj->SetMatch(mode);
1244 pidObj->SetPLimit(plims,nlims);
1245 pidObj->SetSigma(sigmas);
1246 pidObj->SetCompat(compat);
1247 pidObj->SetTPC(kTRUE);
1248 pidObj->SetTOF(kTRUE);
1249 pidObj->SetPCompatTOF(1.5);
1250 pidObj->SetSigmaForTPCCompat(3.);
1251 pidObj->SetSigmaForTOFCompat(3.);
ec0f397b 1252 pidObj->SetOldPid(kTRUE);
fc051756 1253
1254 SetPidHF(pidObj);
1255 SetUsePID(kTRUE);
1256 SetUseDefaultPID(kFALSE);
1257
1258 SetLowPt(kFALSE);
1259
1260 PrintAll();
1261
1262 delete pidObj;
1263 pidObj=NULL;
1264
1265 return;
1266
1267}
1268
1269
1270void AliRDHFCutsD0toKpi::SetStandardCutsPP2011_276TeV() {
1271 //
1272 // STANDARD CUTS USED FOR 2011 pp analysis at 2.76TeV
1273 //
1274
1275 SetName("D0toKpiCutsStandard");
1276 SetTitle("Standard Cuts for D0 analysis in pp2011 at 2.76TeV run");
1277
1278 //
1279 // Track cuts
1280 //
1281 AliESDtrackCuts* esdTrackCuts=new AliESDtrackCuts();
1282 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1283 //default
1284 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1285 esdTrackCuts->SetRequireITSRefit(kTRUE);
1286 esdTrackCuts->SetEtaRange(-0.8,0.8);
1287 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1288 AliESDtrackCuts::kAny);
1289 // default is kBoth, otherwise kAny
1290 esdTrackCuts->SetMinDCAToVertexXY(0.);
1291 esdTrackCuts->SetPtRange(0.3,1.e10);
1292
1293 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1294 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1295 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0075*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1296
1297 AddTrackCuts(esdTrackCuts);
1298
1299
1300 const Int_t nvars=11;
1301 const Int_t nptbins=13;
d1029f2b 1302 Float_t ptbins[nptbins+1];
fc051756 1303 ptbins[0]=0.;
1304 ptbins[1]=0.5;
1305 ptbins[2]=1.;
1306 ptbins[3]=2.;
1307 ptbins[4]=3.;
1308 ptbins[5]=4.;
1309 ptbins[6]=5.;
1310 ptbins[7]=6.;
1311 ptbins[8]=8.;
1312 ptbins[9]=12.;
1313 ptbins[10]=16.;
1314 ptbins[11]=20.;
1315 ptbins[12]=24.;
1316 ptbins[13]=9999.;
1317
1318 SetPtBins(nptbins+1,ptbins);
1319
fc051756 1320
1321 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,0.04,0.75,0.3,0.3,1000.*1E-4,1000.*1E-4,0.,0.85,0.,0.},/* pt<0.5*/
1322 {0.400,0.04,0.75,0.3,0.3,1000.*1E-4,1000.*1E-4,0.,0.85,0.,0.},/* 0.5<pt<1*/
1323 {0.400,0.03,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-25000.*1E-8,0.8,0.,0.},/* 1<pt<2 */
1324 {0.400,0.03,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.0003,0.9,0.,0.},/* 2<pt<3 */
1325 {0.400,0.03,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.0002,0.9,0.,0.},/* 3<pt<4 */
1326 {0.400,0.03,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.00015,0.9,0.,0.},/* 4<pt<5 */
1327 {0.400,0.03,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.0001,0.9,0.,0.},/* 5<pt<6 */
1328 {0.400,0.09,0.85,0.7,0.7,1000.*1E-4,1000.*1E-4,0.,0.85,0.,0.},/* 6<pt<8 */
1329 {0.400,0.06,0.85,0.7,0.7,1000.*1E-4,1000.*1E-4,-0.00001,0.85,0.,0.},/* 8<pt<12 */
1330 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.},/* 12<pt<16 */
1331 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.},/* 16<pt<20 */
1332 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.},/* 20<pt<24 */
1333 {0.400,0.09,1.0,0.7,0.7,9999.,9999.,0.,0.,0.,0.}};/* pt>24 */
1334
1335 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1336 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1337 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1338 for (Int_t ibin=0;ibin<nptbins;ibin++){
1339 for (Int_t ivar = 0; ivar<nvars; ivar++){
1340 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1341 }
1342 }
1343 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
d1029f2b 1344 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1345 delete [] cutsMatrixTransposeStand;
fc051756 1346
1347
1348 //pid settings
1349 AliAODPidHF* pidObj=new AliAODPidHF();
1350 Int_t mode=1;
1351 const Int_t nlims=2;
1352 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1353 Bool_t compat=kTRUE; //effective only for this mode
1354 Bool_t asym=kTRUE;
1355 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1356 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1357 pidObj->SetMatch(mode);
1358 pidObj->SetPLimit(plims,nlims);
1359 pidObj->SetSigma(sigmas);
1360 pidObj->SetCompat(compat);
1361 pidObj->SetTPC(kTRUE);
1362 pidObj->SetTOF(kTRUE);
ec0f397b 1363 pidObj->SetOldPid(kTRUE);
fc051756 1364 SetPidHF(pidObj);
1365
1366 SetUseDefaultPID(kFALSE); //to use the AliAODPidHF
1367
1368 SetUsePID(kTRUE);
1369
1370 //activate pileup rejection (for pp)
1371 SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1372
1373 //Do recalculate the vertex
1374 SetRemoveDaughtersFromPrim(kTRUE);
1375
1376 // Cut on the zvtx
1377 SetMaxVtxZ(10.);
1378
1379 // Use the kFirst selection for tracks with candidate D with pt<2
1380 SetSelectCandTrackSPDFirst(kTRUE,2.);
1381
1382 // Use special cuts for D candidates with pt<2
1383 SetUseSpecialCuts(kTRUE);
1384 SetMaximumPtSpecialCuts(2.);
1385
1386 PrintAll();
1387
1388 delete pidObj;
1389 pidObj=NULL;
1390
1391 return;
1392}
1393
1394
1395void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010() {
1396 //
1397 // Final CUTS USED FOR 2010 PbPb analysis of central events
1398 // REMEMBER TO EVENTUALLY SWITCH ON
1399 // SetUseAOD049(kTRUE);
1400 //
1401
1402 SetName("D0toKpiCutsStandard");
1403 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run");
1404
1405
1406 // CENTRALITY SELECTION
1407 SetMinCentrality(0.);
1408 SetMaxCentrality(80.);
1409 SetUseCentrality(AliRDHFCuts::kCentV0M);
1410
1411
1412
1413 // EVENT CUTS
1414 SetMinVtxContr(1);
1415 // MAX Z-VERTEX CUT
1416 SetMaxVtxZ(10.);
1417 // PILE UP
1418 SetOptPileup(AliRDHFCuts::kNoPileupSelection);
1419 // PILE UP REJECTION
1420 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1421
1422 // TRACKS ON SINGLE TRACKS
1423 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1424 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1425 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1426 esdTrackCuts->SetRequireITSRefit(kTRUE);
1427 // esdTrackCuts->SetMinNClustersITS(4);
1428 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1429 esdTrackCuts->SetMinDCAToVertexXY(0.);
1430 esdTrackCuts->SetEtaRange(-0.8,0.8);
1431 esdTrackCuts->SetPtRange(0.7,1.e10);
1432
1433 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1434 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1435 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0075*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1436
1437
1438 AddTrackCuts(esdTrackCuts);
1439 // SPD k FIRST for Pt<3 GeV/c
1440 SetSelectCandTrackSPDFirst(kTRUE, 3);
1441
1442 // CANDIDATE CUTS
1443 const Int_t nptbins =13;
1444 const Double_t ptmax = 9999.;
1445 const Int_t nvars=11;
1446 Float_t ptbins[nptbins+1];
1447 ptbins[0]=0.;
1448 ptbins[1]=0.5;
1449 ptbins[2]=1.;
1450 ptbins[3]=2.;
1451 ptbins[4]=3.;
1452 ptbins[5]=4.;
1453 ptbins[6]=5.;
1454 ptbins[7]=6.;
1455 ptbins[8]=8.;
1456 ptbins[9]=12.;
1457 ptbins[10]=16.;
1458 ptbins[11]=20.;
1459 ptbins[12]=24.;
1460 ptbins[13]=ptmax;
1461
1462 SetGlobalIndex(nvars,nptbins);
1463 SetPtBins(nptbins+1,ptbins);
1464 SetMinPtCandidate(2.);
1465
1466 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,400.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-10000.*1E-8,0.85,0.99,2.},/* pt<0.5*/
1467 {0.400,400.*1E-4,0.8,0.3,0.3,1000.*1E-4,1000.*1E-4,-35000.*1E-8,0.9,0.99,2.},/* 0.5<pt<1*/
dab01ae7 1468 {0.400,400.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-43000.*1E-8,0.85,0.995,8.},/* 1<pt<2 */
fc051756 1469 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-45000.*1E-8,0.95,0.998,7.},/* 2<pt<3 */
1470 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-36000.*1E-8,0.95,0.998,5.},/* 3<pt<4 */
1471 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-27000.*1E-8,0.95,0.998,5.},/* 4<pt<5 */
1472 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-21000.*1E-8,0.92,0.998,5.},/* 5<pt<6 */
1473 {0.400,270.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-14000.*1E-8,0.88,0.998,5.},/* 6<pt<8 */
1474 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85,0.998,5.},/* 8<pt<12 */
1475 {0.400,350.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,-1000.*1E-8,0.83,0.998,8.},/* 12<pt<16 */
1476 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,-1000.*1E-8,0.82,0.995,6.},/* 16<pt<20 */
1477 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,-1000.*1E-8,0.81,0.995,6.},/* 20<pt<24 */
1478 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,-1000.*1E-8,0.8,0.99,2.}};/* pt>24 */
1479
1480
1481 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1482 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1483 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1484
1485 for (Int_t ibin=0;ibin<nptbins;ibin++){
1486 for (Int_t ivar = 0; ivar<nvars; ivar++){
1487 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1488 }
1489 }
1490
1491 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1492 SetUseSpecialCuts(kTRUE);
1493 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
1494 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1495 delete [] cutsMatrixTransposeStand;
1496 cutsMatrixTransposeStand=NULL;
1497
1498 // PID SETTINGS
1499 AliAODPidHF* pidObj=new AliAODPidHF();
1500 //pidObj->SetName("pid4D0");
1501 Int_t mode=1;
1502 const Int_t nlims=2;
1503 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1504 Bool_t compat=kTRUE; //effective only for this mode
1505 Bool_t asym=kTRUE;
1506 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1507 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1508 pidObj->SetMatch(mode);
1509 pidObj->SetPLimit(plims,nlims);
1510 pidObj->SetSigma(sigmas);
1511 pidObj->SetCompat(compat);
1512 pidObj->SetTPC(kTRUE);
1513 pidObj->SetTOF(kTRUE);
1514 pidObj->SetPCompatTOF(2.);
1515 pidObj->SetSigmaForTPCCompat(3.);
1516 pidObj->SetSigmaForTOFCompat(3.);
ec0f397b 1517 pidObj->SetOldPid(kTRUE);
fc051756 1518
1519
1520 SetPidHF(pidObj);
1521 SetUsePID(kTRUE);
1522 SetUseDefaultPID(kFALSE);
1523
1524
1525 PrintAll();
1526
1527
1528 delete pidObj;
1529 pidObj=NULL;
1530
1531 return;
1532
1533}
1534
1535void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2010Peripherals() {
1536 // CUTS USED FOR D0 RAA for the CENTRALITY RANGE 20-80%
1537
1538
1539 SetName("D0toKpiCutsStandard");
1540 SetTitle("Standard Cuts for D0 analysis in PbPb2010 run, for peripheral events");
1541
1542
1543 // CENTRALITY SELECTION
1544 SetMinCentrality(40.);
1545 SetMaxCentrality(80.);
1546 SetUseCentrality(AliRDHFCuts::kCentV0M);
1547
1548 // EVENT CUTS
1549 SetMinVtxContr(1);
1550 // MAX Z-VERTEX CUT
1551 SetMaxVtxZ(10.);
1552 // PILE UP
1553 SetOptPileup(AliRDHFCuts::kNoPileupSelection);
1554 // PILE UP REJECTION
1555 //SetOptPileup(AliRDHFCuts::kRejectPileupEvent);
1556
1557 // TRACKS ON SINGLE TRACKS
1558 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
1559 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
1560 esdTrackCuts->SetRequireTPCRefit(kTRUE);
1561 esdTrackCuts->SetRequireITSRefit(kTRUE);
1562 // esdTrackCuts->SetMinNClustersITS(4);
1563 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
1564 esdTrackCuts->SetMinDCAToVertexXY(0.);
1565 esdTrackCuts->SetEtaRange(-0.8,0.8);
1566 esdTrackCuts->SetPtRange(0.5,1.e10);
1567
1568 esdTrackCuts->SetMaxDCAToVertexXY(1.);
1569 esdTrackCuts->SetMaxDCAToVertexZ(1.);
1570 esdTrackCuts->SetMinDCAToVertexXYPtDep("0.0025*TMath::Max(0.,(1-TMath::Floor(TMath::Abs(pt)/2.)))");
1571
1572
1573 AddTrackCuts(esdTrackCuts);
1574 // SPD k FIRST for Pt<3 GeV/c
1575 SetSelectCandTrackSPDFirst(kTRUE, 3);
1576
1577 // CANDIDATE CUTS
1578 const Int_t nptbins =13;
1579 const Double_t ptmax = 9999.;
1580 const Int_t nvars=11;
1581 Float_t ptbins[nptbins+1];
1582 ptbins[0]=0.;
1583 ptbins[1]=0.5;
1584 ptbins[2]=1.;
1585 ptbins[3]=2.;
1586 ptbins[4]=3.;
1587 ptbins[5]=4.;
1588 ptbins[6]=5.;
1589 ptbins[7]=6.;
1590 ptbins[8]=8.;
1591 ptbins[9]=12.;
1592 ptbins[10]=16.;
1593 ptbins[11]=20.;
1594 ptbins[12]=24.;
1595 ptbins[13]=ptmax;
1596
1597 SetGlobalIndex(nvars,nptbins);
1598 SetPtBins(nptbins+1,ptbins);
1599 SetMinPtCandidate(0.);
1600
1601 Float_t cutsMatrixD0toKpiStand[nptbins][nvars]={{0.400,400.*1E-4,0.8,0.5,0.5,1000.*1E-4,1000.*1E-4,-20000.*1E-8,0.7,0.993,2.},/* pt<0.5*/
1602 {0.400,400.*1E-4,0.8,0.5,0.5,1000.*1E-4,1000.*1E-4,-25000.*1E-8,0.85,0.993,2.},/* 0.5<pt<1*/
1603 {0.400,400.*1E-4,0.8,0.4,0.4,1000.*1E-4,1000.*1E-4,-40000.*1E-8,0.85,0.995,6.},/* 1<pt<2 */
1604 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-40000.*1E-8,0.95,0.991,5.},/* 2<pt<3 */
1605 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-36000.*1E-8,0.95,0.993,5.},/* 3<pt<4 */
1606 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-27000.*1E-8,0.95,0.995,5.},/* 4<pt<5 */
1607 {0.400,250.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-21000.*1E-8,0.92,0.998,5.},/* 5<pt<6 */
1608 {0.400,270.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-14000.*1E-8,0.88,0.998,5.},/* 6<pt<8 */
1609 {0.400,300.*1E-4,0.8,0.7,0.7,1000.*1E-4,1000.*1E-4,-5000.*1E-8,0.85,0.995,5.},/* 8<pt<12 */
1610 {0.400,350.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.83,0.995,4.},/* 12<pt<16 */
1611 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.82,0.995,4.},/* 16<pt<20 */
1612 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.81,0.995,4.},/* 20<pt<24 */
1613 {0.400,400.*1E-4,1.0,0.7,0.7,1000.*1E-4,1000.*1E-4,0.*1E-8,0.8,0.995,4.}};/* pt>24 */
1614
1615
1616 //CREATE TRANSPOSE MATRIX...REVERSE INDICES as required by AliRDHFCuts
1617 Float_t **cutsMatrixTransposeStand=new Float_t*[nvars];
1618 for(Int_t iv=0;iv<nvars;iv++)cutsMatrixTransposeStand[iv]=new Float_t[nptbins];
1619
1620 for (Int_t ibin=0;ibin<nptbins;ibin++){
1621 for (Int_t ivar = 0; ivar<nvars; ivar++){
1622 cutsMatrixTransposeStand[ivar][ibin]=cutsMatrixD0toKpiStand[ibin][ivar];
1623 }
1624 }
1625
1626 SetCuts(nvars,nptbins,cutsMatrixTransposeStand);
1627 SetUseSpecialCuts(kTRUE);
1628 SetRemoveDaughtersFromPrim(kFALSE);// THIS IS VERY IMPORTANT! TOO SLOW IN PbPb
1629 for(Int_t iv=0;iv<nvars;iv++) delete [] cutsMatrixTransposeStand[iv];
1630 delete [] cutsMatrixTransposeStand;
1631 cutsMatrixTransposeStand=NULL;
1632
1633 // PID SETTINGS
1634 AliAODPidHF* pidObj=new AliAODPidHF();
1635 //pidObj->SetName("pid4D0");
1636 Int_t mode=1;
1637 const Int_t nlims=2;
1638 Double_t plims[nlims]={0.6,0.8}; //TPC limits in momentum [GeV/c]
1639 Bool_t compat=kTRUE; //effective only for this mode
1640 Bool_t asym=kTRUE;
1641 Double_t sigmas[5]={2.,1.,0.,3.,0.}; //to be checked and to be modified with new implementation of setters by Rossella
1642 pidObj->SetAsym(asym);// if you want to use the asymmetric bands in TPC
1643 pidObj->SetMatch(mode);
1644 pidObj->SetPLimit(plims,nlims);
1645 pidObj->SetSigma(sigmas);
1646 pidObj->SetCompat(compat);
1647 pidObj->SetTPC(kTRUE);
1648 pidObj->SetTOF(kTRUE);
1649 pidObj->SetPCompatTOF(2.);
1650 pidObj->SetSigmaForTPCCompat(3.);
1651 pidObj->SetSigmaForTOFCompat(3.);
ec0f397b 1652 pidObj->SetOldPid(kTRUE);
fc051756 1653
1654 SetPidHF(pidObj);
1655 SetUsePID(kTRUE);
1656 SetUseDefaultPID(kFALSE);
1657
1658 SetLowPt(kTRUE,2.);
1659
1660 PrintAll();
1661
1662
1663 delete pidObj;
1664 pidObj=NULL;
1665
1666 return;
1667
1668}
1669
1670
1671void AliRDHFCutsD0toKpi::SetStandardCutsPbPb2011() {
1672
1673 // Default 2010 PbPb cut object
1674 SetStandardCutsPbPb2010();
0ebb13ca 1675 AliAODPidHF *pidobj=GetPidHF();
1676
1677 pidobj->SetOldPid(kFALSE);
fc051756 1678
1679 //
1680 // Enable all 2011 PbPb run triggers
1681 //
1682 SetTriggerClass("");
1683 ResetMaskAndEnableMBTrigger();
1684 EnableCentralTrigger();
1685 EnableSemiCentralTrigger();
1686
1687}