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) :
40 // Default Constructor
44 TString varNames[14]={"inv. mass [GeV]",
56 "inv. mass (Mphi-MKK) [GeV]",
57 "inv. mass (MKo*-MKpi) [GeV]"};
58 Bool_t isUpperCut[14]={kTRUE,
72 SetVarNames(14,varNames,isUpperCut);
73 Bool_t forOpt[14]={kFALSE,
87 SetVarsForOpt(7,forOpt);
88 Float_t limits[2]={0,999999999.};
90 if(fPidHF)delete fPidHF;
91 fPidHF=new AliAODPidHF();
92 Double_t plim[2]={0.6,0.8};
93 Double_t nsigma[5]={2.,1.,2.,3.,0.};
95 fPidHF->SetPLimit(plim);
96 fPidHF->SetAsym(kTRUE);
97 fPidHF->SetSigma(nsigma);
103 fPidHF->SetCompat(kTRUE);
106 //--------------------------------------------------------------------------
107 AliRDHFCutsDstoKKpi::AliRDHFCutsDstoKKpi(const AliRDHFCutsDstoKKpi &source) :
115 //--------------------------------------------------------------------------
116 AliRDHFCutsDstoKKpi &AliRDHFCutsDstoKKpi::operator=(const AliRDHFCutsDstoKKpi &source)
119 // assignment operator
121 if(&source == this) return *this;
123 AliRDHFCuts::operator=(source);
129 //---------------------------------------------------------------------------
130 void AliRDHFCutsDstoKKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
132 // Fills in vars the values of the variables
135 if(nvars!=fnVarsForOpt) {
136 printf("AliRDHFCutsDstoKKpi::GetCutsVarsForOpt: wrong number of variables\n");
140 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
145 if(TMath::Abs(pdgdaughters[0]==321)){
146 vars[iter]=dd->InvMassDsKKpi();
148 vars[iter]=dd->InvMassDspiKK();
153 Float_t minPtDau=99999.;
154 for(Int_t iprong=0;iprong<3;iprong++){
155 if(TMath::Abs(pdgdaughters[iprong])==321 &&
156 dd->PtProng(iprong)<minPtDau) minPtDau=dd->PtProng(iprong);
162 for(Int_t iprong=0;iprong<3;iprong++){
163 if(TMath::Abs(pdgdaughters[iprong])==211) {
164 vars[iter]=dd->PtProng(iprong);
170 Float_t minImpParDau=99999.;
171 for(Int_t iprong=0;iprong<3;iprong++){
172 if(TMath::Abs(pdgdaughters[iprong])==321 &&
173 dd->Getd0Prong(iprong)<minImpParDau) minImpParDau=dd->Getd0Prong(iprong);
175 vars[iter]=minImpParDau;
179 for(Int_t iprong=0;iprong<3;iprong++){
180 if(TMath::Abs(pdgdaughters[iprong])==211) {
181 vars[iter]=dd->Getd0Prong(iprong);
187 Float_t minDistPair=TMath::Min(dd->GetDist12toPrim(),dd->GetDist23toPrim());
188 vars[iter]=minDistPair;
192 vars[iter]=dd->GetSigmaVert();
196 vars[iter] = dd->DecayLength();
201 for(Int_t i=0;i<3;i++){
202 if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
208 vars[iter]=dd->CosPointingAngle();
212 vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
217 for(Int_t i=0;i<3;i++){
218 if(d->GetDCA(i)>maxDCA) maxDCA=d->GetDCA(i);
224 Double_t mPDGPhi = TDatabasePDG::Instance()->GetParticle(333)->Mass();
225 if(TMath::Abs(pdgdaughters[0]==321)){
227 Double_t phimass01=d->InvMass2Prongs(0,1,321,321);
228 vars[iter]=TMath::Abs(phimass01-mPDGPhi);
229 // vars[iter]=dd->InvMass2Prongs(0,1,321,321);
231 Double_t phimass12=d->InvMass2Prongs(1,2,321,321);
232 vars[iter]=TMath::Abs(phimass12-mPDGPhi);
233 // vars[iter]=dd->InvMass2Prongs(1,2,321,321);
238 Double_t mPDGK0star = TDatabasePDG::Instance()->GetParticle(313)->Mass();
239 if(TMath::Abs(pdgdaughters[0]==321)){
241 Double_t mass12kpi=d->InvMass2Prongs(1,2,321,211);
242 vars[iter]=TMath::Abs(mass12kpi-mPDGK0star);
243 // vars[iter]=dd->InvMass2Prongs(1,2,321,211);
245 Double_t mass01pik=d->InvMass2Prongs(0,1,211,321);
246 vars[iter]=TMath::Abs(mass01pik-mPDGK0star);
247 // vars[iter]=dd->InvMass2Prongs(0,1,211,321);
254 //---------------------------------------------------------------------------
255 Bool_t AliRDHFCutsDstoKKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
258 // Checking if Ds is in fiducial acceptance region
262 // applying cut for pt > 5 GeV
263 AliDebug(2,Form("pt of Ds = %f (> 5), cutting at |y| < 0.8",pt));
264 if (TMath::Abs(y) > 0.8) return kFALSE;
267 // appliying smooth cut for pt < 5 GeV
268 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
269 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
270 AliDebug(2,Form("pt of Ds = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
271 if (y < minFiducialY || y > maxFiducialY) return kFALSE;
277 //---------------------------------------------------------------------------
278 Int_t AliRDHFCutsDstoKKpi::IsSelectedPID(AliAODRecoDecayHF *rd) {
280 // return values: 0->NOT OK, 1->OK as KKpi, 2->OK as piKK, 3->OK as both
284 if(!fUsePID || !rd) return retCode;
286 AliWarning("AliAODPidHF not created!");
291 Int_t sign= rd->GetCharge();
292 for(Int_t iDaught=0; iDaught<3; iDaught++){
293 AliAODTrack *track=(AliAODTrack*)rd->GetDaughter(iDaught);
294 Int_t isPion=fPidHF->MakeRawPid(track,AliPID::kPion);
295 Int_t isKaon=fPidHF->MakeRawPid(track,AliPID::kKaon);
296 Int_t isProton=fPidHF->MakeRawPid(track,AliPID::kProton);
298 if(isProton>0 && isKaon<0 && isPion<0) return 0;
299 if(sign!=track->Charge()){// must be kaon
300 if(isKaon<0) return 0;
302 if(isKaon>0 && isPion<0) nKaons++;
303 if(isKaon<0) nNotKaons++;
305 if(isKaon<0) okKKpi=kFALSE;
306 if(isPion<0) okpiKK=kFALSE;
309 if(isKaon<0) okpiKK=kFALSE;
310 if(isPion<0) okKKpi=kFALSE;
314 if(nKaons>2)return 0;
315 if(nNotKaons>1) return 0;
317 if(!okKKpi) retCode-=1;
318 if(!okpiKK) retCode-=2;
323 //---------------------------------------------------------------------------
324 Int_t AliRDHFCutsDstoKKpi::IsSelected(TObject* obj,Int_t selectionLevel, AliAODEvent* aod) {
330 cout<<"Cut matrice not inizialized. Exit..."<<endl;
334 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
337 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
341 Double_t ptD=d->Pt();
342 if(ptD<fMinPtCand) return 0;
343 if(ptD>fMaxPtCand) return 0;
345 // selection on daughter tracks
346 if(selectionLevel==AliRDHFCuts::kAll ||
347 selectionLevel==AliRDHFCuts::kTracks) {
348 if(!AreDaughtersSelected(d)) return 0;
354 Int_t returnvaluePID=3;
355 if(selectionLevel==AliRDHFCuts::kAll ||
356 selectionLevel==AliRDHFCuts::kCandidate ||
357 selectionLevel==AliRDHFCuts::kPID) {
358 returnvaluePID = IsSelectedPID(d);
360 if(returnvaluePID==0)return 0;
361 Bool_t okPidDsKKpi=returnvaluePID&1;
362 Bool_t okPidDspiKK=returnvaluePID&2;
364 Int_t returnvalueCuts=15;
365 // selection on candidate
366 if(selectionLevel==AliRDHFCuts::kAll ||
367 selectionLevel==AliRDHFCuts::kCandidate) {
368 //recalculate vertex w/o daughters
369 AliAODVertex *origownvtx=0x0;
370 AliAODVertex *recvtx=0x0;
371 if(fRemoveDaughtersFromPrimary) {
373 AliError("Can not remove daughters from vertex without AOD event");
376 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
377 recvtx=d->RemoveDaughtersFromPrimaryVtx(aod);
379 AliDebug(2,"Removal of daughter tracks failed");
380 //recvtx=d->GetPrimaryVtx();
387 //set recalculed primary vertex
388 d->SetOwnPrimaryVtx(recvtx);
389 delete recvtx; recvtx=NULL;
395 Int_t okMassK0star=0;
398 Int_t ptbin=PtBin(pt);
400 Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
401 Double_t mDsKKpi=d->InvMassDsKKpi();
402 Double_t mDspiKK=d->InvMassDspiKK();
403 if(TMath::Abs(mDsKKpi-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDsKKpi = 0;
404 if(TMath::Abs(mDspiKK-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDspiKK = 0;
405 if(!okDsKKpi && !okDspiKK) returnvalueCuts=0;
406 if(okPidDsKKpi && !okDsKKpi) returnvalueCuts=0;
407 if(okPidDspiKK && !okDspiKK) returnvalueCuts=0;
410 if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] ||
411 TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) returnvalueCuts=0;
413 if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(1,ptbin)] ||
414 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDsKKpi=0;
415 if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)] ||
416 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDsKKpi=0;
419 if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)] ||
420 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDspiKK=0;
421 if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(1,ptbin)] ||
422 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDspiKK=0;
424 if(!okDsKKpi && !okDspiKK) returnvalueCuts=0;
426 // cuts on resonant decays (via Phi or K0*)
427 Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
428 Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
430 Double_t mass01phi=d->InvMass2Prongs(0,1,321,321);
431 Double_t mass12K0s=d->InvMass2Prongs(1,2,321,211);
432 if(TMath::Abs(mass01phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhi=1;
433 if(TMath::Abs(mass12K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0star = 1;
434 if(!okMassPhi && !okMassK0star) okDsKKpi=0;
437 Double_t mass01K0s=d->InvMass2Prongs(0,1,211,321);
438 Double_t mass12phi=d->InvMass2Prongs(1,2,321,321);
439 if(TMath::Abs(mass01K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0star = 1;
440 if(TMath::Abs(mass12phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhi=1;
441 if(!okMassPhi && !okMassK0star) okDspiKK=0;
443 if(!okDsKKpi && !okDspiKK) returnvalueCuts=0;
445 // Cuts on track pairs
446 for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) returnvalueCuts=0;
447 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)] ||
448 d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) returnvalueCuts=0;
451 // Cuts on candidate triplet
452 if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)]) returnvalueCuts=0;
453 if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) returnvalueCuts=0;
454 if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] &&
455 TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] &&
456 TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)]) returnvalueCuts=0;
457 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)])returnvalueCuts=0;
458 Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
459 if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)])returnvalueCuts=0;
461 // unset recalculated primary vertex when not needed any more
463 d->SetOwnPrimaryVtx(origownvtx);
466 } else if(fRemoveDaughtersFromPrimary) {
467 d->UnsetOwnPrimaryVtx();
468 AliDebug(3,"delete new vertex\n");
471 if(returnvalueCuts == 0) return 0;
473 if(okDsKKpi) returnvalue+=1;
474 if(okDspiKK) returnvalue+=2;
475 if(okMassPhi) returnvalue+=4;
476 if(okMassK0star) returnvalue+=8;
480 return returnvalueCuts;
483 //---------------------------------------------------------------------------