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 D+->Kpipi
20 // Author: R. Bala, bala@to.infn.it
21 // G. Ortona, ortona@to.infn.it
22 /////////////////////////////////////////////////////////////
24 #include <TDatabasePDG.h>
25 #include <Riostream.h>
27 #include "AliRDHFCutsDplustoKpipi.h"
28 #include "AliAODRecoDecayHF3Prong.h"
29 #include "AliAODTrack.h"
30 #include "AliESDtrack.h"
33 ClassImp(AliRDHFCutsDplustoKpipi)
35 //--------------------------------------------------------------------------
36 AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi(const char* name) :
40 // Default Constructor
44 TString varNames[12]={"inv. mass [GeV]",
47 "d0K [cm] lower limit!",
48 "d0Pi [cm] lower limit!",
52 "pM=Max{pT1,pT2,pT3} (GeV/c)",
56 Bool_t isUpperCut[12]={kTRUE,
68 SetVarNames(nvars,varNames,isUpperCut);
69 Bool_t forOpt[12]={kFALSE,
81 SetVarsForOpt(5,forOpt);
82 Float_t limits[2]={0,999999999.};
84 if(fPidHF)delete fPidHF;
85 fPidHF=new AliAODPidHF();
86 Double_t plim[2]={0.6,0.8};
87 Double_t nsigma[5]={2.,1.,2.,3.,0.};
89 fPidHF->SetPLimit(plim);
90 fPidHF->SetAsym(kTRUE);
91 fPidHF->SetSigma(nsigma);
97 fPidHF->SetCompat(kTRUE);
101 //--------------------------------------------------------------------------
102 AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi(const AliRDHFCutsDplustoKpipi &source) :
110 //--------------------------------------------------------------------------
111 AliRDHFCutsDplustoKpipi &AliRDHFCutsDplustoKpipi::operator=(const AliRDHFCutsDplustoKpipi &source)
114 // assignment operator
116 if(&source == this) return *this;
118 AliRDHFCuts::operator=(source);
125 //---------------------------------------------------------------------------
126 void AliRDHFCutsDplustoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
128 // Fills in vars the values of the variables
132 if(nvars!=fnVarsForOpt) {
133 printf("AliRDHFCutsDplustoKpipi::GetCutsVarsForOpt: wrong number of variables\n");
137 AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d;
142 vars[iter]=dd->InvMassDplus();
146 for(Int_t iprong=0;iprong<3;iprong++){
147 if(TMath::Abs(pdgdaughters[iprong])==321) {
148 vars[iter]=dd->PtProng(iprong);
154 Float_t minPtDau=1000000.0;
155 for(Int_t iprong=0;iprong<3;iprong++){
156 if(TMath::Abs(pdgdaughters[iprong])==211) {
157 if(dd->PtProng(iprong)<minPtDau){
158 minPtDau=dd->PtProng(iprong);
166 for(Int_t iprong=0;iprong<3;iprong++){
167 if(TMath::Abs(pdgdaughters[iprong])==321) {
168 vars[iter]=dd->Getd0Prong(iprong);
174 Float_t minImpParDau=1000000.0;
175 for(Int_t iprong=0;iprong<3;iprong++){
176 if(TMath::Abs(pdgdaughters[iprong])==211) {
177 if(dd->Getd0Prong(iprong)<minImpParDau){
178 minImpParDau=dd->Getd0Prong(iprong);
182 vars[iter]=minImpParDau;
186 Float_t dist12 = dd->GetDist12toPrim();
187 Float_t dist23 = dd->GetDist23toPrim();
188 if(dist12<dist23)vars[iter]=dist12;
189 else vars[iter]=dist23;
193 vars[iter]=dd->GetSigmaVert();
197 vars[iter] = dd->DecayLength();
202 for(Int_t i=0;i<3;i++){
203 if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i);
209 vars[iter]=dd->CosPointingAngle();
213 vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2);
218 for(Int_t iprong=0;iprong<3;iprong++){
219 if(dd->GetDCA(iprong)<maxDCA){
220 maxDCA=dd->GetDCA(iprong);
228 //---------------------------------------------------------------------------
229 Int_t AliRDHFCutsDplustoKpipi::IsSelectedPID(AliAODRecoDecayHF *rd)
234 if(!fUsePID || !rd) return 1;
235 //if(fUsePID)printf("i am inside the pid \n");
238 Int_t sign= rd->GetCharge();
239 for(Int_t daught=0;daught<3;daught++){
240 AliAODTrack *track=(AliAODTrack*)rd->GetDaughter(daught);
241 Int_t isPion=fPidHF->MakeRawPid(track,AliPID::kPion);
242 Int_t isKaon=fPidHF->MakeRawPid(track,AliPID::kKaon);
243 Int_t isProton=fPidHF->MakeRawPid(track,AliPID::kProton);
245 if(isProton>0 && isKaon<0 && isPion<0) return 0;
246 if(isKaon>0 && isPion<0) nkaons++;
247 if(isKaon<0) nNotKaons++;
248 if(sign==track->Charge()){//pions
249 if(isPion<0)return 0;
252 if(isKaon<0)return 0;
258 if(nkaons>1)return 0;
259 if(nNotKaons==3)return 0;
266 //---------------------------------------------------------------------------
267 Int_t AliRDHFCutsDplustoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
273 cout<<"Cut matrix not inizialized. Exit..."<<endl;
277 AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj;
281 cout<<"AliAODRecoDecayHF3Prong null"<<endl;
287 // selection on daughter tracks
288 if(selectionLevel==AliRDHFCuts::kAll ||
289 selectionLevel==AliRDHFCuts::kTracks) {
290 if(!AreDaughtersSelected(d)) return 0;
294 Int_t returnvaluePID=1;
297 //if(selectionLevel==AliRDHFCuts::kAll ||
298 if(selectionLevel==AliRDHFCuts::kCandidate ||
299 selectionLevel==AliRDHFCuts::kPID) {
300 returnvaluePID = IsSelectedPID(d);
302 if(returnvaluePID==0)return 0;
305 // selection on candidate
306 if(selectionLevel==AliRDHFCuts::kAll ||
307 selectionLevel==AliRDHFCuts::kCandidate) {
311 Int_t ptbin=PtBin(pt);
313 Double_t mDplusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass();
314 Double_t mDplus=d->InvMassDplus();
315 if(TMath::Abs(mDplus-mDplusPDG)>fCutsRD[GetGlobalIndex(0,ptbin)])return 0;
316 // if(d->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || d->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
317 if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)])return 0;//Kaon
318 if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)])return 0;//Pion1
319 if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)])return 0;//Pion2
324 if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)])return 0;
325 if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.)return 0;
328 if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)])return 0;
330 if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)])return 0;
332 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;
333 if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)])return 0;
334 Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2);
335 if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)])return 0;
338 for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) return 0;
344 //---------------------------------------------------------------------------