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 Lc->pKpi
20 // Author: A.Dainese, andrea.dainese@pd.infn.it
21 /////////////////////////////////////////////////////////////
23 #include <TDatabasePDG.h>
24 #include <Riostream.h>
26 #include "AliRDHFCutsLctopKpi.h"
27 #include "AliAODRecoDecayHF3Prong.h"
28 #include "AliRDHFCuts.h"
29 #include "AliAODTrack.h"
30 #include "AliESDtrack.h"
31 #include "AliKFParticle.h"
32 #include "AliESDVertex.h"
34 ClassImp(AliRDHFCutsLctopKpi)
36 //--------------------------------------------------------------------------
37 AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const char* name) :
44 // Default Constructor
48 TString varNames[12]={"inv. mass [GeV]",
51 "d0P [cm] lower limit!",
52 "d0Pi [cm] lower limit!",
56 "pM=Max{pT1,pT2,pT3} (GeV/c)",
60 Bool_t isUpperCut[12]={kTRUE,
72 SetVarNames(nvars,varNames,isUpperCut);
73 Bool_t forOpt[12]={kFALSE,
85 SetVarsForOpt(5,forOpt);
86 Float_t limits[2]={0,999999999.};
89 //--------------------------------------------------------------------------
90 AliRDHFCutsLctopKpi::AliRDHFCutsLctopKpi(const AliRDHFCutsLctopKpi &source) :
99 if(source.fPidObjprot) SetPidprot(source.fPidObjprot);
100 if(source.fPidObjpion) SetPidpion(source.fPidObjpion);
102 //--------------------------------------------------------------------------
103 AliRDHFCutsLctopKpi &AliRDHFCutsLctopKpi::operator=(const AliRDHFCutsLctopKpi &source)
106 // assignment operator
108 if(&source == this) return *this;
110 AliRDHFCuts::operator=(source);
111 SetPidprot(source.GetPidprot());
112 SetPidpion(source.GetPidpion());
116 //---------------------------------------------------------------------------
117 AliRDHFCutsLctopKpi::~AliRDHFCutsLctopKpi() {
119 // // Default Destructor
132 //---------------------------------------------------------------------------
133 void AliRDHFCutsLctopKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
135 // Fills in vars the values of the variables
138 if(nvars!=fnVarsForOpt) {
139 printf("AliRDHFCutsLctopKpi::GetCutsVarsForOpt: wrong number of variables\n");
143 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
148 vars[iter]=dd->InvMassLcpKpi();
152 for(Int_t iprong=0;iprong<3;iprong++){
153 if(TMath::Abs(pdgdaughters[iprong])==2212) {
154 vars[iter]=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 for(Int_t iprong=0;iprong<3;iprong++){
169 if(TMath::Abs(pdgdaughters[iprong])==2212) {
170 vars[iter]=dd->Getd0Prong(iprong);
176 for(Int_t iprong=0;iprong<3;iprong++){
177 if(TMath::Abs(pdgdaughters[iprong])==211) {
178 vars[iter]=dd->Getd0Prong(iprong);
184 vars[iter]=dd->GetDist12toPrim();
188 vars[iter]=dd->GetSigmaVert();
192 vars[iter] = dd->DecayLength();
197 for(Int_t i=0;i<3;i++){
198 if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
204 vars[iter]=dd->CosPointingAngle();
208 vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
212 vars[iter]=dd->GetDCA();
217 //---------------------------------------------------------------------------
218 Int_t AliRDHFCutsLctopKpi::IsSelected(TObject* obj,Int_t selectionLevel,AliAODEvent *aod) {
224 cout<<"Cut matrice not inizialized. Exit..."<<endl;
228 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
231 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
238 Int_t returnvaluePID=3;
241 // selection on candidate
242 if(selectionLevel==AliRDHFCuts::kAll ||
243 selectionLevel==AliRDHFCuts::kCandidate) {
247 Int_t ptbin=PtBin(pt);
249 Double_t mLcpKpi,mLcpiKp;
250 Int_t okLcpKpi=1,okLcpiKp=1;
252 Double_t mLcPDG = TDatabasePDG::Instance()->GetParticle(4122)->Mass();
254 mLcpKpi=d->InvMassLcpKpi();
255 mLcpiKp=d->InvMassLcpiKp();
257 if(TMath::Abs(mLcpKpi-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpKpi = 0;
258 if(TMath::Abs(mLcpiKp-mLcPDG)>fCutsRD[GetGlobalIndex(0,ptbin)]) okLcpiKp = 0;
259 if(!okLcpKpi && !okLcpiKp) return 0;
261 if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)]) return 0;//Kaon
262 //if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;//Proton
263 //if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)]) return 0;//Pion
264 if((TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(2)) < 0.4)) okLcpKpi=0;
265 if((TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)]) || (TMath::Abs(d->PtProng(0)) < 0.4))okLcpiKp=0;
266 if(!okLcpKpi && !okLcpiKp) return 0;
271 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
272 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
273 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
275 Int_t valueTotTmp=CombinePIDCuts(valueTmp,returnvaluePID);
276 Int_t pdgs[3]={2212,321,211};
281 if(!d->GetOwnPrimaryVtx()){
282 AliAODVertex *vtx1 = (AliAODVertex*)aod->GetPrimaryVertex();
283 d->SetOwnPrimaryVtx(vtx1);
285 Double_t field=aod->GetMagneticField();
286 ReconstructKF(d,pdgs,field);
289 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]) return 0;
290 if(d->GetDist12toPrim()>1.) return 0;
291 if(d->GetDist23toPrim()>1.) return 0;
292 if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.) return 0;
295 if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)]) return 0;
297 if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
298 if(d->DecayLength()>0.5) return 0;
300 if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
301 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
302 Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
303 if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)]) return 0;
306 for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
309 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
310 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
311 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
315 if(fUsePID || selectionLevel==AliRDHFCuts::kPID) returnvaluePID = IsSelectedPID(d);
316 if(returnvaluePID==0) return 0;
318 // selection on daughter tracks
319 if(selectionLevel==AliRDHFCuts::kAll ||
320 selectionLevel==AliRDHFCuts::kTracks) {
321 if(!AreDaughtersSelected(d)) return 0;
325 Int_t returnvalueTot=CombinePIDCuts(returnvalue,returnvaluePID);
326 return returnvalueTot;
328 //---------------------------------------------------------------------------
329 Int_t AliRDHFCutsLctopKpi::IsSelectedPID(AliAODRecoDecayHF* obj) {
333 Int_t okLcpKpi=0,okLcpiKp=0;
335 Bool_t isPeriodd=fPidHF->GetOnePad();
336 Bool_t isPbPb=fPidHF->GetPbPb();
337 Bool_t ispion0=kTRUE,ispion2=kTRUE;
338 Bool_t isproton0=kFALSE,isproton2=kFALSE;
339 Bool_t iskaon1=kFALSE;
340 Double_t sigmaTOF=120.;
341 if(isPeriodd) sigmaTOF=160.;
342 if(isPbPb) sigmaTOF=160.;
343 fPidObjprot->SetTofSigma(sigmaTOF);
344 fPidHF->SetTofSigma(sigmaTOF);
346 for(Int_t i=0;i<3;i++){
347 AliAODTrack *track=(AliAODTrack*)obj->GetDaughter(i);
351 Int_t isKaon=fPidHF->MakeRawPid(track,3);
354 if(fPidHF->MakeRawPid(track,2)>=1) iskaon1=kFALSE;
360 Int_t isProton=fPidObjprot->MakeRawPid(track,4);
362 if(fPidHF->MakeRawPid(track,2)>=1) isProton=-1;
363 if(fPidHF->MakeRawPid(track,3)>=1) isProton=-1;
366 Int_t isPion=fPidObjpion->MakeRawPid(track,2);
367 if(fPidHF->MakeRawPid(track,3)>=1) isPion=-1;
368 if(fPidObjprot->MakeRawPid(track,4)>=1) isPion=-1;
372 if(isPion<0) ispion0=kFALSE;
373 if(isProton>=1) isproton0=kTRUE;
377 if(isPion<0) ispion2=kFALSE;
378 if(isProton>=1) isproton2=kTRUE;
384 if(ispion2 && isproton0 && iskaon1) okLcpKpi=1;
385 if(ispion0 && isproton2 && iskaon1) okLcpiKp=1;
386 if(okLcpKpi) returnvalue=1; //cuts passed as Lc->pKpi
387 if(okLcpiKp) returnvalue=2; //cuts passed as Lc->piKp
388 if(okLcpKpi && okLcpiKp) returnvalue=3; //cuts passed as both pKpi and piKp
392 //-----------------------
393 Int_t AliRDHFCutsLctopKpi::CombinePIDCuts(Int_t returnvalue, Int_t returnvaluePID) const {
395 Int_t returnvalueTot=0;
396 Int_t okLcpKpi=0,okLcpiKp=0;
397 if(returnvaluePID==1){
398 if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
400 if(returnvaluePID==2){
401 if(returnvalue>=2) okLcpiKp=1;
403 if(returnvaluePID==3 && returnvalue>0){
404 if(returnvalue==1 || returnvalue==3) okLcpKpi=1;
405 if(returnvalue>=2) okLcpiKp=1;
408 if(okLcpKpi) returnvalueTot=1; //cuts passed as Lc->pKpi
409 if(okLcpiKp) returnvalueTot=2; //cuts passed as Lc->piKp
410 if(okLcpKpi && okLcpiKp) returnvalueTot=3; //cuts passed as both pKpi and piKp
411 return returnvalueTot;
413 //----------------------------------
414 void AliRDHFCutsLctopKpi::SetStandardCutsPP2010() {
416 SetName("LctopKpiProdCuts");
417 SetTitle("Production cuts for Lc analysis");
419 AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts","default");
420 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
421 esdTrackCuts->SetRequireTPCRefit(kTRUE);
422 esdTrackCuts->SetMinNClustersTPC(70);
423 esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,
424 AliESDtrackCuts::kAny);
425 esdTrackCuts->SetRequireITSRefit(kTRUE);
426 esdTrackCuts->SetMinNClustersITS(4);
427 esdTrackCuts->SetMinDCAToVertexXY(0.);
428 esdTrackCuts->SetEtaRange(-0.8,0.8);
429 esdTrackCuts->SetPtRange(0.3,1.e10);
430 AddTrackCuts(esdTrackCuts);
432 const Int_t nptbins=4;
433 const Int_t nvars=12;
435 ptbins=new Float_t[nptbins+1];
443 SetGlobalIndex(nvars,nptbins);
444 SetPtBins(nptbins+1,ptbins);
446 Float_t** prodcutsval;
447 prodcutsval=new Float_t*[nvars];
448 for(Int_t iv=0;iv<nvars;iv++){
449 prodcutsval[iv]=new Float_t[nptbins];
452 for(Int_t ipt=0;ipt<nptbins;ipt++){
453 prodcutsval[0][ipt]=0.18;
454 prodcutsval[1][ipt]=0.4;
455 prodcutsval[2][ipt]=0.5;
456 prodcutsval[3][ipt]=0.;
457 prodcutsval[4][ipt]=0.;
458 prodcutsval[5][ipt]=0.01;
459 prodcutsval[6][ipt]=0.06;
460 prodcutsval[7][ipt]=0.005;
461 prodcutsval[8][ipt]=0.;
462 prodcutsval[9][ipt]=0.;
463 prodcutsval[10][ipt]=0.;
464 prodcutsval[11][ipt]=0.05;
466 SetCuts(nvars,nptbins,prodcutsval);
468 AliAODPidHF* pidObjK=new AliAODPidHF();
469 Double_t sigmasK[5]={3.,1.,1.,3.,2.};
470 pidObjK->SetSigma(sigmasK);
471 pidObjK->SetAsym(kTRUE);
472 pidObjK->SetMatch(1);
473 pidObjK->SetTPC(kTRUE);
474 pidObjK->SetTOF(kTRUE);
475 pidObjK->SetITS(kTRUE);
476 Double_t plimK[2]={0.5,0.8};
477 pidObjK->SetPLimit(plimK,2);
481 AliAODPidHF* pidObjpi=new AliAODPidHF();
482 pidObjpi->SetTPC(kTRUE);
483 Double_t sigmaspi[5]={3.,0.,0.,0.,0.};
484 pidObjpi->SetSigma(sigmaspi);
485 SetPidpion(pidObjpi);
487 AliAODPidHF* pidObjp=new AliAODPidHF();
488 Double_t sigmasp[5]={3.,1.,1.,3.,2.};
489 pidObjp->SetSigma(sigmasp);
490 pidObjp->SetAsym(kTRUE);
491 pidObjp->SetMatch(1);
492 pidObjp->SetTPC(kTRUE);
493 pidObjp->SetTOF(kTRUE);
494 pidObjp->SetITS(kTRUE);
495 Double_t plimp[2]={1.,2.};
496 pidObjp->SetPLimit(plimp,2);
504 for(Int_t iiv=0;iiv<nvars;iiv++){
505 delete [] prodcutsval[iiv];
507 delete [] prodcutsval;
519 Bool_t AliRDHFCutsLctopKpi::ReconstructKF(AliAODRecoDecayHF3Prong *d,Int_t *pdgs,Double_t field) const{
521 Int_t nprongs=d->GetNProngs();
522 Int_t iprongs[nprongs];
523 for(Int_t i=0;i<nprongs;i++) iprongs[i]=i;
525 Double_t mass[2]={0.,0.};
527 AliKFParticle *decay=d->ApplyVertexingKF(iprongs,nprongs,pdgs,kTRUE,field,mass);
528 if(!decay) return kTRUE;
529 AliESDVertex *vertexESD = new AliESDVertex(decay->Parameters(),
530 decay->CovarianceMatrix(),
533 Double_t pos[3],cov[6],chi2perNDF;
534 vertexESD->GetXYZ(pos);
535 vertexESD->GetCovMatrix(cov);
536 chi2perNDF = vertexESD->GetChi2toNDF();
537 delete vertexESD; vertexESD=NULL;
538 AliAODVertex *vertexAOD = new AliAODVertex(pos,cov,chi2perNDF,0x0,-1,AliAODVertex::kUndef,nprongs);
539 d->SetSecondaryVtx(vertexAOD);