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 **************************************************************************/
16 /////////////////////////////////////////////////////////////
18 // Class for cuts on AOD reconstructed Ds->KKpi
20 // Author: A.Dainese, andrea.dainese@pd.infn.it
21 /////////////////////////////////////////////////////////////
23 #include <TDatabasePDG.h>
24 #include <Riostream.h>
26 #include "AliRDHFCutsDstoKKpi.h"
27 #include "AliAODRecoDecayHF3Prong.h"
28 #include "AliAODTrack.h"
29 #include "AliESDtrack.h"
31 ClassImp(AliRDHFCutsDstoKKpi)
33 //--------------------------------------------------------------------------
34 AliRDHFCutsDstoKKpi::AliRDHFCutsDstoKKpi(const char* name) :
38 // Default Constructor
42 TString varNames[14]={"inv. mass [GeV]",
54 "inv. mass (Mphi-MKK) [GeV]",
55 "inv. mass (MKo*-MKpi) [GeV]"};
56 Bool_t isUpperCut[14]={kTRUE,
70 SetVarNames(14,varNames,isUpperCut);
71 Bool_t forOpt[14]={kFALSE,
85 SetVarsForOpt(7,forOpt);
86 Float_t limits[2]={0,999999999.};
88 if(fPidHF)delete fPidHF;
89 fPidHF=new AliAODPidHF();
90 Double_t plim[2]={0.6,0.8};
91 Double_t nsigma[5]={2.,1.,2.,3.,0.};
93 fPidHF->SetPLimit(plim);
94 fPidHF->SetAsym(kTRUE);
95 fPidHF->SetSigma(nsigma);
101 fPidHF->SetCompat(kTRUE);
104 //--------------------------------------------------------------------------
105 AliRDHFCutsDstoKKpi::AliRDHFCutsDstoKKpi(const AliRDHFCutsDstoKKpi &source) :
113 //--------------------------------------------------------------------------
114 AliRDHFCutsDstoKKpi &AliRDHFCutsDstoKKpi::operator=(const AliRDHFCutsDstoKKpi &source)
117 // assignment operator
119 if(&source == this) return *this;
121 AliRDHFCuts::operator=(source);
127 //---------------------------------------------------------------------------
128 void AliRDHFCutsDstoKKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
130 // Fills in vars the values of the variables
133 if(nvars!=fnVarsForOpt) {
134 printf("AliRDHFCutsDstoKKpi::GetCutsVarsForOpt: wrong number of variables\n");
138 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
143 if(TMath::Abs(pdgdaughters[0]==321)){
144 vars[iter]=dd->InvMassDsKKpi();
146 vars[iter]=dd->InvMassDspiKK();
151 Float_t minPtDau=99999.;
152 for(Int_t iprong=0;iprong<3;iprong++){
153 if(TMath::Abs(pdgdaughters[iprong])==321 &&
154 dd->PtProng(iprong)<minPtDau) minPtDau=dd->PtProng(iprong);
160 for(Int_t iprong=0;iprong<3;iprong++){
161 if(TMath::Abs(pdgdaughters[iprong])==211) {
162 vars[iter]=dd->PtProng(iprong);
168 Float_t minImpParDau=99999.;
169 for(Int_t iprong=0;iprong<3;iprong++){
170 if(TMath::Abs(pdgdaughters[iprong])==321 &&
171 dd->Getd0Prong(iprong)<minImpParDau) minImpParDau=dd->Getd0Prong(iprong);
173 vars[iter]=minImpParDau;
177 for(Int_t iprong=0;iprong<3;iprong++){
178 if(TMath::Abs(pdgdaughters[iprong])==211) {
179 vars[iter]=dd->Getd0Prong(iprong);
185 Float_t minDistPair=TMath::Min(dd->GetDist12toPrim(),dd->GetDist23toPrim());
186 vars[iter]=minDistPair;
190 vars[iter]=dd->GetSigmaVert();
194 vars[iter] = dd->DecayLength();
199 for(Int_t i=0;i<3;i++){
200 if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
206 vars[iter]=dd->CosPointingAngle();
210 vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
215 for(Int_t i=0;i<3;i++){
216 if(d->GetDCA(i)>maxDCA) maxDCA=d->GetDCA(i);
222 Double_t mPDGPhi = TDatabasePDG::Instance()->GetParticle(333)->Mass();
223 if(TMath::Abs(pdgdaughters[0]==321)){
225 Double_t phimass01=d->InvMass2Prongs(0,1,321,321);
226 vars[iter]=TMath::Abs(phimass01-mPDGPhi);
227 // vars[iter]=dd->InvMass2Prongs(0,1,321,321);
229 Double_t phimass12=d->InvMass2Prongs(1,2,321,321);
230 vars[iter]=TMath::Abs(phimass12-mPDGPhi);
231 // vars[iter]=dd->InvMass2Prongs(1,2,321,321);
236 Double_t mPDGK0star = TDatabasePDG::Instance()->GetParticle(313)->Mass();
237 if(TMath::Abs(pdgdaughters[0]==321)){
239 Double_t mass12kpi=d->InvMass2Prongs(1,2,321,211);
240 vars[iter]=TMath::Abs(mass12kpi-mPDGK0star);
241 // vars[iter]=dd->InvMass2Prongs(1,2,321,211);
243 Double_t mass01pik=d->InvMass2Prongs(0,1,211,321);
244 vars[iter]=TMath::Abs(mass01pik-mPDGK0star);
245 // vars[iter]=dd->InvMass2Prongs(0,1,211,321);
252 //---------------------------------------------------------------------------
253 Bool_t AliRDHFCutsDstoKKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
256 // Checking if Ds is in fiducial acceptance region
260 // applying cut for pt > 5 GeV
261 AliDebug(2,Form("pt of Ds = %f (> 5), cutting at |y| < 0.8",pt));
262 if (TMath::Abs(y) > 0.8) return kFALSE;
265 // appliying smooth cut for pt < 5 GeV
266 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
267 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
268 AliDebug(2,Form("pt of Ds = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
269 if (y < minFiducialY || y > maxFiducialY) return kFALSE;
275 //---------------------------------------------------------------------------
276 Int_t AliRDHFCutsDstoKKpi::IsSelectedPID(AliAODRecoDecayHF *rd) {
278 // return values: 0->NOT OK, 1->OK as KKpi, 2->OK as piKK, 3->OK as both
282 if(!fUsePID || !rd) return retCode;
284 AliWarning("AliAODPidHF not created!");
289 Int_t sign= rd->GetCharge();
290 for(Int_t iDaught=0; iDaught<3; iDaught++){
291 AliAODTrack *track=(AliAODTrack*)rd->GetDaughter(iDaught);
292 Int_t isPion=fPidHF->MakeRawPid(track,AliPID::kPion);
293 Int_t isKaon=fPidHF->MakeRawPid(track,AliPID::kKaon);
294 Int_t isProton=fPidHF->MakeRawPid(track,AliPID::kProton);
296 if(isProton>0 && isKaon<0 && isPion<0) return 0;
297 if(sign!=track->Charge()){// must be kaon
298 if(isKaon<0) return 0;
300 if(isKaon>0 && isPion<0) nKaons++;
301 if(isKaon<0) nNotKaons++;
303 if(isKaon<0) okKKpi=kFALSE;
304 if(isPion<0) okpiKK=kFALSE;
307 if(isKaon<0) okpiKK=kFALSE;
308 if(isPion<0) okKKpi=kFALSE;
312 if(nKaons>2)return 0;
313 if(nNotKaons>1) return 0;
315 if(!okKKpi) retCode-=1;
316 if(!okpiKK) retCode-=2;
321 //---------------------------------------------------------------------------
322 Int_t AliRDHFCutsDstoKKpi::IsSelected(TObject* obj,Int_t selectionLevel, AliAODEvent* aod) {
328 cout<<"Cut matrice not inizialized. Exit..."<<endl;
332 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
335 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
339 Double_t ptD=d->Pt();
340 if(ptD<fMinPtCand) return 0;
341 if(ptD>fMaxPtCand) return 0;
343 // selection on daughter tracks
344 if(selectionLevel==AliRDHFCuts::kAll ||
345 selectionLevel==AliRDHFCuts::kTracks) {
346 if(!AreDaughtersSelected(d)) return 0;
352 Int_t returnvaluePID=3;
353 if(selectionLevel==AliRDHFCuts::kAll ||
354 selectionLevel==AliRDHFCuts::kCandidate ||
355 selectionLevel==AliRDHFCuts::kPID) {
356 returnvaluePID = IsSelectedPID(d);
358 if(returnvaluePID==0)return 0;
359 Bool_t okPidDsKKpi=returnvaluePID&1;
360 Bool_t okPidDspiKK=returnvaluePID&2;
362 Int_t returnvalueCuts=15;
363 // selection on candidate
364 if(selectionLevel==AliRDHFCuts::kAll ||
365 selectionLevel==AliRDHFCuts::kCandidate) {
366 //recalculate vertex w/o daughters
367 AliAODVertex *origownvtx=0x0;
368 AliAODVertex *recvtx=0x0;
369 if(fRemoveDaughtersFromPrimary) {
371 AliError("Can not remove daughters from vertex without AOD event");
374 if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx());
375 recvtx=d->RemoveDaughtersFromPrimaryVtx(aod);
377 AliDebug(2,"Removal of daughter tracks failed");
378 //recvtx=d->GetPrimaryVtx();
385 //set recalculed primary vertex
386 d->SetOwnPrimaryVtx(recvtx);
387 delete recvtx; recvtx=NULL;
393 Int_t okMassK0star=0;
396 Int_t ptbin=PtBin(pt);
398 Double_t mDsPDG = TDatabasePDG::Instance()->GetParticle(431)->Mass();
399 Double_t mDsKKpi=d->InvMassDsKKpi();
400 Double_t mDspiKK=d->InvMassDspiKK();
401 if(TMath::Abs(mDsKKpi-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDsKKpi = 0;
402 if(TMath::Abs(mDspiKK-mDsPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okDspiKK = 0;
403 if(!okDsKKpi && !okDspiKK) returnvalueCuts=0;
404 if(okPidDsKKpi && !okDsKKpi) returnvalueCuts=0;
405 if(okPidDspiKK && !okDspiKK) returnvalueCuts=0;
408 if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] ||
409 TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) returnvalueCuts=0;
411 if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(1,ptbin)] ||
412 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDsKKpi=0;
413 if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)] ||
414 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDsKKpi=0;
417 if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)] ||
418 TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) okDspiKK=0;
419 if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(1,ptbin)] ||
420 TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(3,ptbin)]) okDspiKK=0;
422 if(!okDsKKpi && !okDspiKK) returnvalueCuts=0;
424 // cuts on resonant decays (via Phi or K0*)
425 Double_t mPhiPDG = TDatabasePDG::Instance()->GetParticle(333)->Mass();
426 Double_t mK0starPDG = TDatabasePDG::Instance()->GetParticle(313)->Mass();
428 Double_t mass01phi=d->InvMass2Prongs(0,1,321,321);
429 Double_t mass12K0s=d->InvMass2Prongs(1,2,321,211);
430 if(TMath::Abs(mass01phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhi=1;
431 if(TMath::Abs(mass12K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0star = 1;
432 if(!okMassPhi && !okMassK0star) okDsKKpi=0;
435 Double_t mass01K0s=d->InvMass2Prongs(0,1,211,321);
436 Double_t mass12phi=d->InvMass2Prongs(1,2,321,321);
437 if(TMath::Abs(mass01K0s-mK0starPDG)<fCutsRD[GetGlobalIndex(13,ptbin)]) okMassK0star = 1;
438 if(TMath::Abs(mass12phi-mPhiPDG)<fCutsRD[GetGlobalIndex(12,ptbin)]) okMassPhi=1;
439 if(!okMassPhi && !okMassK0star) okDspiKK=0;
441 if(!okDsKKpi && !okDspiKK) returnvalueCuts=0;
443 // Cuts on track pairs
444 for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) returnvalueCuts=0;
445 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)] ||
446 d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) returnvalueCuts=0;
449 // Cuts on candidate triplet
450 if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)]) returnvalueCuts=0;
451 if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) returnvalueCuts=0;
452 if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] &&
453 TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] &&
454 TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)]) returnvalueCuts=0;
455 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)])returnvalueCuts=0;
456 Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
457 if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)])returnvalueCuts=0;
459 // unset recalculated primary vertex when not needed any more
461 d->SetOwnPrimaryVtx(origownvtx);
464 } else if(fRemoveDaughtersFromPrimary) {
465 d->UnsetOwnPrimaryVtx();
466 AliDebug(3,"delete new vertex\n");
469 if(returnvalueCuts == 0) return 0;
471 if(okDsKKpi) returnvalue+=1;
472 if(okDspiKK) returnvalue+=2;
473 if(okMassPhi) returnvalue+=4;
474 if(okMassK0star) returnvalue+=8;
478 return returnvalueCuts;
481 //---------------------------------------------------------------------------