1 /**************************************************************************
2 * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /////////////////////////////////////////////////////////////
20 // Class for cuts on AOD reconstructed Ds->KKpi
22 // Author: A.Dainese, andrea.dainese@pd.infn.it
23 /////////////////////////////////////////////////////////////
25 #include <TDatabasePDG.h>
26 #include <Riostream.h>
28 #include "AliRDHFCutsDstoKKpi.h"
29 #include "AliAODRecoDecayHF3Prong.h"
30 #include "AliAODTrack.h"
31 #include "AliESDtrack.h"
33 ClassImp(AliRDHFCutsDstoKKpi)
35 //--------------------------------------------------------------------------
36 AliRDHFCutsDstoKKpi::AliRDHFCutsDstoKKpi(const char* name) :
41 // Default Constructor
45 TString varNames[16]={"inv. mass [GeV]",
57 "inv. mass (Mphi-MKK) [GeV]",
58 "inv. mass (MKo*-MKpi) [GeV]",
59 "Abs(CosineKpiPhiRFrame)^3",
62 Bool_t isUpperCut[16]={kTRUE,
78 SetVarNames(16,varNames,isUpperCut);
79 Bool_t forOpt[16]={kFALSE,
95 SetVarsForOpt(7,forOpt);
96 Float_t limits[2]={0,999999999.};
98 if(fPidHF)delete fPidHF;
99 fPidHF=new AliAODPidHF();
100 Double_t plim[2]={0.6,0.8};
101 Double_t nsigma[5]={2.,1.,2.,3.,0.};
103 fPidHF->SetPLimit(plim);
104 fPidHF->SetAsym(kTRUE);
105 fPidHF->SetSigma(nsigma);
111 fPidHF->SetCompat(kTRUE);
114 //--------------------------------------------------------------------------
115 AliRDHFCutsDstoKKpi::AliRDHFCutsDstoKKpi(const AliRDHFCutsDstoKKpi &source) :
117 fPidOption(source.fPidOption)
124 //--------------------------------------------------------------------------
125 AliRDHFCutsDstoKKpi &AliRDHFCutsDstoKKpi::operator=(const AliRDHFCutsDstoKKpi &source)
128 // assignment operator
130 if(&source == this) return *this;
132 AliRDHFCuts::operator=(source);
138 //---------------------------------------------------------------------------
139 void AliRDHFCutsDstoKKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters,AliAODEvent *aod) {
141 // Fills in vars the values of the variables
144 if(nvars!=fnVarsForOpt) {
145 printf("AliRDHFCutsDstoKKpi::GetCutsVarsForOpt: wrong number of variables\n");
149 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
151 //recalculate vertex w/o daughters
152 Bool_t cleanvtx=kFALSE;
153 AliAODVertex *origownvtx=0x0;
154 if(fRemoveDaughtersFromPrimary) {
155 if(dd->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*dd->GetOwnPrimaryVtx());
157 if(!RecalcOwnPrimaryVtx(dd,aod)) {
158 CleanOwnPrimaryVtx(dd,aod,origownvtx);
166 if(TMath::Abs(pdgdaughters[0])==321){
167 vars[iter]=dd->InvMassDsKKpi();
169 vars[iter]=dd->InvMassDspiKK();
174 Float_t minPtDau=99999.;
175 for(Int_t iprong=0;iprong<3;iprong++){
176 if(TMath::Abs(pdgdaughters[iprong])==321 &&
177 dd->PtProng(iprong)<minPtDau) minPtDau=dd->PtProng(iprong);
183 for(Int_t iprong=0;iprong<3;iprong++){
184 if(TMath::Abs(pdgdaughters[iprong])==211) {
185 vars[iter]=dd->PtProng(iprong);
191 Float_t minImpParDau=99999.;
192 for(Int_t iprong=0;iprong<3;iprong++){
193 if(TMath::Abs(pdgdaughters[iprong])==321 &&
194 dd->Getd0Prong(iprong)<minImpParDau) minImpParDau=dd->Getd0Prong(iprong);
196 vars[iter]=minImpParDau;
200 for(Int_t iprong=0;iprong<3;iprong++){
201 if(TMath::Abs(pdgdaughters[iprong])==211) {
202 vars[iter]=dd->Getd0Prong(iprong);
208 Float_t minDistPair=TMath::Min(dd->GetDist12toPrim(),dd->GetDist23toPrim());
209 vars[iter]=minDistPair;
213 vars[iter]=dd->GetSigmaVert();
217 vars[iter] = dd->DecayLength();
222 for(Int_t i=0;i<3;i++){
223 if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
229 vars[iter]=dd->CosPointingAngle();
233 vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
238 for(Int_t i=0;i<3;i++){
239 if(d->GetDCA(i)>maxDCA) maxDCA=d->GetDCA(i);
245 Double_t mPDGPhi = TDatabasePDG::Instance()->GetParticle(333)->Mass();
246 if(TMath::Abs(pdgdaughters[0])==321){
248 Double_t phimass01=d->InvMass2Prongs(0,1,321,321);
249 vars[iter]=TMath::Abs(phimass01-mPDGPhi);
250 // vars[iter]=dd->InvMass2Prongs(0,1,321,321);
252 Double_t phimass12=d->InvMass2Prongs(1,2,321,321);
253 vars[iter]=TMath::Abs(phimass12-mPDGPhi);
254 // vars[iter]=dd->InvMass2Prongs(1,2,321,321);
259 Double_t mPDGK0star = TDatabasePDG::Instance()->GetParticle(313)->Mass();
260 if(TMath::Abs(pdgdaughters[0])==321){
262 Double_t mass12kpi=d->InvMass2Prongs(1,2,321,211);
263 vars[iter]=TMath::Abs(mass12kpi-mPDGK0star);
264 // vars[iter]=dd->InvMass2Prongs(1,2,321,211);
266 Double_t mass01pik=d->InvMass2Prongs(0,1,211,321);
267 vars[iter]=TMath::Abs(mass01pik-mPDGK0star);
268 // vars[iter]=dd->InvMass2Prongs(0,1,211,321);
273 if(TMath::Abs(pdgdaughters[0])==321){
274 vars[iter]=dd->CosPiKPhiRFrameKKpi();
276 vars[iter]=dd->CosPiKPhiRFramepiKK();
281 if(TMath::Abs(pdgdaughters[0])==321){
282 vars[iter]=dd->CosPiDsLabFrameKKpi();
284 vars[iter]=dd->CosPiDsLabFramepiKK();
288 if(cleanvtx)CleanOwnPrimaryVtx(dd,aod,origownvtx);
291 //---------------------------------------------------------------------------
292 Bool_t AliRDHFCutsDstoKKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
295 // Checking if Ds is in fiducial acceptance region
299 // applying cut for pt > 5 GeV
300 AliDebug(2,Form("pt of Ds = %f (> 5), cutting at |y| < 0.8",pt));
301 if (TMath::Abs(y) > 0.8) return kFALSE;
304 // appliying smooth cut for pt < 5 GeV
305 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
306 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
307 AliDebug(2,Form("pt of Ds = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
308 if (y < minFiducialY || y > maxFiducialY) return kFALSE;
314 //---------------------------------------------------------------------------
315 Int_t AliRDHFCutsDstoKKpi::IsSelectedPID(AliAODRecoDecayHF *rd) {
317 // return values: 0->NOT OK, 1->OK as KKpi, 2->OK as piKK, 3->OK as both
321 if(!fUsePID || !rd) return retCode;
323 AliWarning("AliAODPidHF not created!");
327 Double_t origCompatTOF=fPidHF->GetPCompatTOF();
328 Double_t origThreshTPC=fPidHF->GetPtThresholdTPC();
329 if(fPidOption==kStrong){
330 fPidHF->SetPCompatTOF(999999.);
331 fPidHF->SetPtThresholdTPC(999999.);
337 Int_t sign= rd->GetCharge();
338 for(Int_t iDaught=0; iDaught<3; iDaught++){
339 AliAODTrack *track=(AliAODTrack*)rd->GetDaughter(iDaught);
340 Int_t isPion=fPidHF->MakeRawPid(track,AliPID::kPion);
341 Int_t isKaon=fPidHF->MakeRawPid(track,AliPID::kKaon);
342 Int_t isProton=fPidHF->MakeRawPid(track,AliPID::kProton);
344 if(isProton>0 && isKaon<0 && isPion<0){
345 fPidHF->SetPCompatTOF(origCompatTOF);
346 fPidHF->SetPtThresholdTPC(origThreshTPC);
349 if(sign!=track->Charge()){// must be kaon
351 fPidHF->SetPCompatTOF(origCompatTOF);
352 fPidHF->SetPtThresholdTPC(origThreshTPC);
355 if(fPidOption==kStrong && isKaon<=0){
356 fPidHF->SetPCompatTOF(origCompatTOF);
357 fPidHF->SetPtThresholdTPC(origThreshTPC);
361 if(isKaon>0 && isPion<0) nKaons++;
362 if(isKaon<0) nNotKaons++;
364 if(isKaon<0) okKKpi=kFALSE;
365 if(isPion<0) okpiKK=kFALSE;
366 if(fPidOption==kStrong){
367 if(isKaon<=0) okKKpi=kFALSE;
368 if(isPion<=0) okpiKK=kFALSE;
372 if(isKaon<0) okpiKK=kFALSE;
373 if(isPion<0) okKKpi=kFALSE;
374 if(fPidOption==kStrong){
375 if(isKaon<=0) okpiKK=kFALSE;
376 if(isPion<=0) okKKpi=kFALSE;
381 fPidHF->SetPCompatTOF(origCompatTOF);
382 fPidHF->SetPtThresholdTPC(origThreshTPC);
384 if(nKaons>2)return 0;
385 if(nNotKaons>1) return 0;
387 if(!okKKpi) retCode-=1;
388 if(!okpiKK) retCode-=2;
393 //---------------------------------------------------------------------------
394 Int_t AliRDHFCutsDstoKKpi::IsSelected(TObject* obj,Int_t selectionLevel, AliAODEvent* aod) {
400 cout<<"Cut matrix not inizialized. Exit..."<<endl;
404 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
407 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
411 if(fKeepSignalMC) if(IsSignalMC(d,aod,431)) return 3;
413 Double_t ptD=d->Pt();
414 if(ptD<fMinPtCand) return 0;
415 if(ptD>fMaxPtCand) return 0;
417 // selection on daughter tracks
418 if(selectionLevel==AliRDHFCuts::kAll ||
419 selectionLevel==AliRDHFCuts::kTracks) {
420 if(!AreDaughtersSelected(d)) return 0;
426 // selection on candidate
427 if(selectionLevel==AliRDHFCuts::kAll ||
428 selectionLevel==AliRDHFCuts::kCandidate) {
429 //recalculate vertex w/o daughters
430 AliAODVertex *origownvtx=0x0;
431 if(fRemoveDaughtersFromPrimary) {
432 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
433 if(!RecalcOwnPrimaryVtx(d,aod)) {
434 CleanOwnPrimaryVtx(d,aod,origownvtx);
441 Int_t okMassPhiKKpi=0;
442 Int_t okMassPhipiKK=0;
443 Int_t okMassK0starKKpi=0;
444 Int_t okMassK0starpiKK=0;
447 Int_t okDsK0starKKpi=0;
448 Int_t okDsK0starpiKK=0;
451 Int_t ptbin=PtBin(pt);
453 CleanOwnPrimaryVtx(d,aod,origownvtx);
457 Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
458 Double_t mDsKKpi=d->InvMassDsKKpi();
459 Double_t mDspiKK=d->InvMassDspiKK();
460 if(TMath::Abs(mDsKKpi-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDsKKpi = 0;
461 if(TMath::Abs(mDspiKK-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDspiKK = 0;
462 if(!okDsKKpi && !okDspiKK){
463 CleanOwnPrimaryVtx(d,aod,origownvtx);
469 // cuts on resonant decays (via Phi or K0*)
470 Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
471 Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
473 Double_t mass01phi=d->InvMass2Prongs(0,1,321,321);
474 Double_t mass12K0s=d->InvMass2Prongs(1,2,321,211);
475 if(TMath::Abs(mass01phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhiKKpi=1;
476 if(TMath::Abs(mass12K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starKKpi = 1;
477 if(!okMassPhiKKpi && !okMassK0starKKpi) okDsKKpi=0;
478 if(okMassPhiKKpi) okDsPhiKKpi=1;
479 if(okMassK0starKKpi) okDsK0starKKpi=1;
482 Double_t mass01K0s=d->InvMass2Prongs(0,1,211,321);
483 Double_t mass12phi=d->InvMass2Prongs(1,2,321,321);
484 if(TMath::Abs(mass01K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0starpiKK = 1;
485 if(TMath::Abs(mass12phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhipiKK=1;
486 if(!okMassPhipiKK && !okMassK0starpiKK) okDspiKK=0;
487 if(okMassPhipiKK) okDsPhipiKK=1;
488 if(okMassK0starpiKK) okDsK0starpiKK=1;
490 if(!okDsKKpi && !okDspiKK){
491 CleanOwnPrimaryVtx(d,aod,origownvtx);
495 // Cuts on track pairs
496 for(Int_t i=0;i<3;i++){
497 if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]){
498 CleanOwnPrimaryVtx(d,aod,origownvtx);
502 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)] ||
503 d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]){
504 CleanOwnPrimaryVtx(d,aod,origownvtx);
511 if(TMath::Abs(d->Pt2Prong(1)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
512 TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]){
513 CleanOwnPrimaryVtx(d,aod,origownvtx);
518 if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
519 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDsKKpi=0;
520 if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
521 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDsKKpi=0;
524 if(TMath::Abs(d->Pt2Prong(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]*fCutsRD[GetGlobalIndex(2,ptbin)] ||
525 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDspiKK=0;
526 if(TMath::Abs(d->Pt2Prong(2)) < fCutsRD[GetGlobalIndex(1,ptbin)]*fCutsRD[GetGlobalIndex(1,ptbin)] ||
527 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDspiKK=0;
529 if(!okDsKKpi && !okDspiKK){
530 CleanOwnPrimaryVtx(d,aod,origownvtx);
534 // Cuts on candidate triplet
536 if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)]){
537 CleanOwnPrimaryVtx(d,aod,origownvtx);
541 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]){
542 CleanOwnPrimaryVtx(d,aod,origownvtx);
546 if(d->Pt2Prong(0)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
547 d->Pt2Prong(1)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)] &&
548 d->Pt2Prong(2)<fCutsRD[GetGlobalIndex(8,ptbin)]*fCutsRD[GetGlobalIndex(8,ptbin)]) {
549 CleanOwnPrimaryVtx(d,aod,origownvtx);
553 if(d->DecayLength2()<fCutsRD[GetGlobalIndex(7,ptbin)]*fCutsRD[GetGlobalIndex(7,ptbin)]){
554 CleanOwnPrimaryVtx(d,aod,origownvtx);
559 Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
560 if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)]){
561 CleanOwnPrimaryVtx(d,aod,origownvtx);
567 Double_t cosPiKPhiRFKKpi=d->CosPiKPhiRFrameKKpi();
568 Double_t kincutPiKPhiKKpi=TMath::Abs(cosPiKPhiRFKKpi*cosPiKPhiRFKKpi*cosPiKPhiRFKKpi);
569 if(kincutPiKPhiKKpi<fCutsRD[GetGlobalIndex(14,ptbin)]) okDsKKpi=0;
572 Double_t cosPiKPhiRFpiKK=d->CosPiKPhiRFramepiKK();
573 Double_t kincutPiKPhipiKK=TMath::Abs(cosPiKPhiRFpiKK*cosPiKPhiRFpiKK*cosPiKPhiRFpiKK);
574 if(kincutPiKPhipiKK<fCutsRD[GetGlobalIndex(14,ptbin)]) okDspiKK=0;
576 if(!okDsKKpi && !okDspiKK){
577 CleanOwnPrimaryVtx(d,aod,origownvtx);
584 Double_t cosPiDsLabFrameKKpi=d->CosPiDsLabFrameKKpi();
585 if(TMath::Abs(cosPiDsLabFrameKKpi)>fCutsRD[GetGlobalIndex(15,ptbin)]) okDsKKpi=0;
588 Double_t cosPiDsLabFramepiKK=d->CosPiDsLabFramepiKK();
589 if(TMath::Abs(cosPiDsLabFramepiKK)>fCutsRD[GetGlobalIndex(15,ptbin)]) okDspiKK=0;
591 if(!okDsKKpi && !okDspiKK){
592 CleanOwnPrimaryVtx(d,aod,origownvtx);
596 // unset recalculated primary vertex when not needed any more
597 CleanOwnPrimaryVtx(d,aod,origownvtx);
611 Int_t returnvaluePID=3;
612 if(selectionLevel==AliRDHFCuts::kAll ||
613 selectionLevel==AliRDHFCuts::kCandidate ||
614 selectionLevel==AliRDHFCuts::kPID) {
615 returnvaluePID = IsSelectedPID(d);
616 fIsSelectedPID=returnvaluePID;
618 if(returnvaluePID==0)return 0;
620 Bool_t okPidDsKKpi=returnvaluePID&1;
621 Bool_t okPidDspiKK=returnvaluePID&2;
631 if((okPidDsKKpi && okDsKKpi)||(okPidDspiKK && okDspiKK)){
633 if(okDsKKpi) returnvalue+=1;
634 if(okDspiKK) returnvalue+=2;
635 if(okDsPhiKKpi) returnvalue+=4;
636 if(okDsPhipiKK) returnvalue+=8;
637 if(okDsK0starKKpi) returnvalue+=16;
638 if(okDsK0starpiKK) returnvalue+=32;
647 //---------------------------------------------------------------------------