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 DStar->Kpipi
20 // Author: A.Grelli, alessandro.grelli@uu.nl
21 /////////////////////////////////////////////////////////////
23 #include <TDatabasePDG.h>
24 #include <Riostream.h>
26 #include "AliAODRecoDecayHF2Prong.h"
27 #include "AliAODRecoCascadeHF.h"
28 #include "AliRDHFCutsD0toKpi.h"
29 #include "AliRDHFCutsDStartoKpipi.h"
30 #include "AliAODTrack.h"
31 #include "AliESDtrack.h"
32 #include "AliAODPid.h"
33 #include "AliTPCPIDResponse.h"
34 #include "AliAODVertex.h"
35 #include "AliESDVertex.h"
39 ClassImp(AliRDHFCutsDStartoKpipi)
41 //--------------------------------------------------------------------------
42 AliRDHFCutsDStartoKpipi::AliRDHFCutsDStartoKpipi(const char* name) :
47 // Default Constructor
52 TString varNames[14]={
62 "inv. mass half width of D* [GeV]",
63 "half width of (M_Kpipi-M_D0) [GeV]",
64 "PtMin of pi_s [GeV/c]",
65 "PtMax of pi_s [GeV/c]",
66 "theta, angle between the pi_s and decay plane of the D0 [rad]"};
67 Bool_t isUpperCut[14]={
82 SetVarNames(nvars,varNames,isUpperCut);
98 SetVarsForOpt(5,forOpt);
99 Float_t limits[2]={0,999999999.};
102 //--------------------------------------------------------------------------
103 AliRDHFCutsDStartoKpipi::AliRDHFCutsDStartoKpipi(const AliRDHFCutsDStartoKpipi &source) :
111 if(source.GetTrackCutsSoftPi()) AddTrackCutsSoftPi(source.GetTrackCutsSoftPi());
114 //--------------------------------------------------------------------------
115 AliRDHFCutsDStartoKpipi &AliRDHFCutsDStartoKpipi::operator=(const AliRDHFCutsDStartoKpipi &source)
118 // assignment operator
120 if(&source == this) return *this;
122 AliRDHFCuts::operator=(source);
123 if(source.GetTrackCutsSoftPi()) AddTrackCutsSoftPi(source.GetTrackCutsSoftPi());
129 //---------------------------------------------------------------------------
130 void AliRDHFCutsDStartoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
132 // Fills in vars the values of the variables
134 if(nvars!=fnVarsForOpt) {
135 printf("AliRDHFCutsDStartoKpipi::GetCutsVarsForOpt: wrong number of variables\n");
140 AliAODRecoCascadeHF* dstarD0pi = (AliAODRecoCascadeHF*)d;
142 AliAODTrack *softPi = (AliAODTrack*)dstarD0pi->GetBachelor();
144 AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)dstarD0pi->Get2Prong();
149 if(TMath::Abs(pdgdaughters[0])==211) {
150 vars[iter]=dd->InvMassD0();
152 vars[iter]=dd->InvMassD0bar();
157 vars[iter]=dd->GetDCA();
161 if(TMath::Abs(pdgdaughters[0])==211) {
162 vars[iter] = dd->CosThetaStarD0();
164 vars[iter] = dd->CosThetaStarD0bar();
169 if(TMath::Abs(pdgdaughters[0])==321) {
170 vars[iter]=dd->PtProng(0);
173 vars[iter]=dd->PtProng(1);
178 if(TMath::Abs(pdgdaughters[0])==211) {
179 vars[iter]=dd->PtProng(0);
182 vars[iter]=dd->PtProng(1);
187 if(TMath::Abs(pdgdaughters[0])==321) {
188 vars[iter]=dd->Getd0Prong(0);
191 vars[iter]=dd->Getd0Prong(1);
196 if(TMath::Abs(pdgdaughters[0])==211) {
197 vars[iter]=dd->Getd0Prong(0);
200 vars[iter]=dd->Getd0Prong(1);
205 vars[iter]= dd->Prodd0d0();
209 vars[iter]=dd->CosPointingAngle();
213 vars[iter]=dstarD0pi->InvMassDstarKpipi();
217 vars[iter]=dstarD0pi->DeltaInvMass();
221 vars[iter] = softPi->Pt();
225 vars[iter] = softPi->Pt();
229 vars[iter] =dstarD0pi->AngleD0dkpPisoft();
234 //---------------------------------------------------------------------------
235 Int_t AliRDHFCutsDStartoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
237 // Apply selection for D*.
240 cout<<"Cut matrice not inizialized. Exit..."<<endl;
244 AliAODRecoCascadeHF* d = (AliAODRecoCascadeHF*)obj;
246 cout<<"AliAODRecoCascadeHF null"<<endl;
250 AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)d->Get2Prong();
252 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
256 AliAODTrack *b = (AliAODTrack*)d->GetBachelor();
258 // selection on daughter tracks
259 if(selectionLevel==AliRDHFCuts::kAll ||
260 selectionLevel==AliRDHFCuts::kTracks) {
261 if(!AreDaughtersSelected(dd)) return 0;
262 if(fTrackCutsSoftPi) {
263 AliAODVertex *vAOD = d->GetPrimaryVtx();
264 Double_t pos[3],cov[6];
266 vAOD->GetCovarianceMatrix(cov);
267 const AliESDVertex vESD(pos,cov,100.,100);
268 if(!IsDaughterSelected(b,&vESD,fTrackCutsSoftPi)) return 0;
273 Int_t returnvaluePID=3;
276 if(selectionLevel==AliRDHFCuts::kAll ||
277 selectionLevel==AliRDHFCuts::kCandidate ||
278 selectionLevel==AliRDHFCuts::kPID) {
279 returnvaluePID = IsSelectedPID(dd);
283 // selection on candidate
284 if(selectionLevel==AliRDHFCuts::kAll ||
285 selectionLevel==AliRDHFCuts::kCandidate) {
288 Int_t ptbin=PtBin(pt);
290 // select D0 that passes D* cuts
291 returnvalue = IsD0FromDStarSelected(pt,dd,selectionLevel);
293 if((b->Charge()==+1 && returnvalue==2) || (b->Charge()==-1 && returnvalue==1)) return 0;
295 // DStarMass and D0mass
296 Double_t mDSPDG = TDatabasePDG::Instance()->GetParticle(413)->Mass();
297 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
299 Double_t deltaPDG = mDSPDG-mD0PDG;
301 // Half width DStar mass
302 if(TMath::Abs(mDSPDG - (d->InvMassDstarKpipi()))>fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
303 // Half width Delta mass
305 if(TMath::Abs(deltaPDG-(d->DeltaInvMass())) > fCutsRD[GetGlobalIndex(10,ptbin)]) return 0;
307 // cut on soft pion pt
308 if(b->Pt() < fCutsRD[GetGlobalIndex(11,ptbin)] || b->Pt() > fCutsRD[GetGlobalIndex(12,ptbin)]) return 0;
309 // cut on the angle between D0 decay plane and soft pion
310 if(d->AngleD0dkpPisoft() > fCutsRD[GetGlobalIndex(13,ptbin)]) return 0;
316 //_________________________________________________________________________________________________
317 Int_t AliRDHFCutsDStartoKpipi::IsD0FromDStarSelected(Double_t pt, TObject* obj,Int_t selectionLevel) const {
319 // Apply selection for D0 from D*. The selection in on D0 prongs
323 cout<<"Cut matrice not inizialized. Exit..."<<endl;
327 AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)obj;
330 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
334 // selection on daughter tracks is done in IsSelected()
338 // selection on candidate
339 if(selectionLevel==AliRDHFCuts::kAll ||
340 selectionLevel==AliRDHFCuts::kCandidate) {
343 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
346 Int_t ptbin=PtBin(pt);
348 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
354 if(dd->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
355 if(dd->PtProng(0) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(1) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0bar = 0;
357 if(!okD0 && !okD0bar) return 0;
359 if(TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
360 TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
361 if(TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
362 TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
363 if(!okD0 && !okD0bar) return 0;
365 if(dd->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
367 dd->InvMassD0(mD0,mD0bar);
368 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
369 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
370 if(!okD0 && !okD0bar) return 0;
372 dd->CosThetaStarD0(ctsD0,ctsD0bar);
373 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
374 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
375 if(!okD0 && !okD0bar) return 0;
377 if(dd->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
379 if(dd->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
381 if (okD0) returnvalue=1; //cuts passed as D0
382 if (okD0bar) returnvalue=2; //cuts passed as D0bar
383 if (okD0 && okD0bar) returnvalue=3; //both
388 //----------------------------------------------------------------------------------
389 Bool_t AliRDHFCutsDStartoKpipi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
392 // D* fiducial acceptance region
396 // applying cut for pt > 5 GeV
397 AliDebug(4,Form("pt of D* = %f (> 5), cutting at |y| < 0.8\n",pt));
398 if (TMath::Abs(y) > 0.8){
403 // appliying smooth cut for pt < 5 GeV
404 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
405 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
406 AliDebug(2,Form("pt of D* = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
407 if (y < minFiducialY || y > maxFiducialY){
415 //_______________________________________________________________________________-
416 Int_t AliRDHFCutsDStartoKpipi::IsSelectedPID(AliAODRecoDecayHF* dd)
421 // Double_t cw = dd->Pt();