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 "AliAODVertex.h"
33 #include "AliESDVertex.h"
35 ClassImp(AliRDHFCutsDStartoKpipi)
37 //--------------------------------------------------------------------------
38 AliRDHFCutsDStartoKpipi::AliRDHFCutsDStartoKpipi(const char* name) :
43 // Default Constructor
48 TString varNames[14]={
58 "inv. mass half width of D* [GeV]",
59 "half width of (M_Kpipi-M_D0) [GeV]",
60 "PtMin of pi_s [GeV/c]",
61 "PtMax of pi_s [GeV/c]",
62 "theta, angle between the pi_s and decay plane of the D0 [rad]"};
63 Bool_t isUpperCut[14]={
78 SetVarNames(nvars,varNames,isUpperCut);
94 SetVarsForOpt(5,forOpt);
95 Float_t limits[2]={0,999999999.};
98 //--------------------------------------------------------------------------
99 AliRDHFCutsDStartoKpipi::AliRDHFCutsDStartoKpipi(const AliRDHFCutsDStartoKpipi &source) :
107 if(source.GetTrackCutsSoftPi()) AddTrackCutsSoftPi(source.GetTrackCutsSoftPi());
110 //--------------------------------------------------------------------------
111 AliRDHFCutsDStartoKpipi &AliRDHFCutsDStartoKpipi::operator=(const AliRDHFCutsDStartoKpipi &source)
114 // assignment operator
116 if(&source == this) return *this;
118 AliRDHFCuts::operator=(source);
120 if(source.GetTrackCutsSoftPi()) AddTrackCutsSoftPi(source.GetTrackCutsSoftPi());
125 //---------------------------------------------------------------------------
126 void AliRDHFCutsDStartoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
128 // Fills in vars the values of the variables
130 if(nvars!=fnVarsForOpt) {
131 printf("AliRDHFCutsDStartoKpipi::GetCutsVarsForOpt: wrong number of variables\n");
136 AliAODRecoCascadeHF* dstarD0pi = (AliAODRecoCascadeHF*)d;
138 AliAODTrack *softPi = (AliAODTrack*)dstarD0pi->GetBachelor();
140 AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)dstarD0pi->Get2Prong();
145 if(TMath::Abs(pdgdaughters[0])==211) {
146 vars[iter]=dd->InvMassD0();
148 vars[iter]=dd->InvMassD0bar();
153 vars[iter]=dd->GetDCA();
157 if(TMath::Abs(pdgdaughters[0])==211) {
158 vars[iter] = dd->CosThetaStarD0();
160 vars[iter] = dd->CosThetaStarD0bar();
165 if(TMath::Abs(pdgdaughters[0])==321) {
166 vars[iter]=dd->PtProng(0);
169 vars[iter]=dd->PtProng(1);
174 if(TMath::Abs(pdgdaughters[0])==211) {
175 vars[iter]=dd->PtProng(0);
178 vars[iter]=dd->PtProng(1);
183 if(TMath::Abs(pdgdaughters[0])==321) {
184 vars[iter]=dd->Getd0Prong(0);
187 vars[iter]=dd->Getd0Prong(1);
192 if(TMath::Abs(pdgdaughters[0])==211) {
193 vars[iter]=dd->Getd0Prong(0);
196 vars[iter]=dd->Getd0Prong(1);
201 vars[iter]= dd->Prodd0d0();
205 vars[iter]=dd->CosPointingAngle();
209 vars[iter]=dstarD0pi->InvMassDstarKpipi();
213 vars[iter]=dstarD0pi->DeltaInvMass();
217 vars[iter] = softPi->Pt();
221 vars[iter] = softPi->Pt();
225 vars[iter] =dstarD0pi->AngleD0dkpPisoft();
230 //---------------------------------------------------------------------------
231 Int_t AliRDHFCutsDStartoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
233 // Apply selection for D*.
236 cout<<"Cut matrice not inizialized. Exit..."<<endl;
240 AliAODRecoCascadeHF* d = (AliAODRecoCascadeHF*)obj;
242 cout<<"AliAODRecoCascadeHF null"<<endl;
246 AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)d->Get2Prong();
248 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
252 AliAODTrack *b = (AliAODTrack*)d->GetBachelor();
254 // selection on daughter tracks
255 if(selectionLevel==AliRDHFCuts::kAll ||
256 selectionLevel==AliRDHFCuts::kTracks) {
257 if(!AreDaughtersSelected(dd)) return 0;
258 if(fTrackCutsSoftPi) {
259 AliAODVertex *vAOD = d->GetPrimaryVtx();
260 Double_t pos[3],cov[6];
262 vAOD->GetCovarianceMatrix(cov);
263 const AliESDVertex vESD(pos,cov,100.,100);
264 if(!IsDaughterSelected(b,&vESD,fTrackCutsSoftPi)) return 0;
270 // selection on candidate
271 if(selectionLevel==AliRDHFCuts::kAll ||
272 selectionLevel==AliRDHFCuts::kCandidate) {
275 Int_t ptbin=PtBin(pt);
277 // select D0 that passes D* cuts
278 returnvalue = IsD0FromDStarSelected(pt,dd,selectionLevel);
280 // DStarMass and D0mass
281 Double_t mDSPDG = TDatabasePDG::Instance()->GetParticle(413)->Mass();
282 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
284 Double_t deltaPDG = mDSPDG-mD0PDG;
291 okDStarP=1; okDStarM=1;
293 dd->InvMassD0(mD0,mD0bar);
294 // Half width DStar mass
295 if(TMath::Abs((d->InvMassDstarKpipi()-mDSPDG))>fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
296 // Half width Delta mass
298 if(TMath::Abs((d->InvMassDstarKpipi()-mD0)-deltaPDG) > fCutsRD[GetGlobalIndex(10,ptbin)]) okDStarP =0;
299 if(TMath::Abs((d->InvMassDstarKpipi()-mD0bar)-deltaPDG) > fCutsRD[GetGlobalIndex(10,ptbin)]) okDStarM =0;
300 if(!okDStarP && !okDStarM) return 0;
302 // cut on soft pion pt
303 if(b->Pt() < fCutsRD[GetGlobalIndex(11,ptbin)] || b->Pt() > fCutsRD[GetGlobalIndex(12,ptbin)]) return 0;
304 // cut on the angle between D0 decay plane and soft pion
305 if(d->AngleD0dkpPisoft() > fCutsRD[GetGlobalIndex(13,ptbin)]) return 0;
311 //_________________________________________________________________________________________________
312 Int_t AliRDHFCutsDStartoKpipi::IsD0FromDStarSelected(Double_t pt, TObject* obj,Int_t selectionLevel) const {
314 // Apply selection for D0 from D*. The selection in on D0 prongs
318 cout<<"Cut matrice not inizialized. Exit..."<<endl;
322 AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)obj;
325 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
329 // selection on daughter tracks is done in IsSelected()
333 // selection on candidate
334 if(selectionLevel==AliRDHFCuts::kAll ||
335 selectionLevel==AliRDHFCuts::kCandidate) {
338 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
341 Int_t ptbin=PtBin(pt);
343 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
349 if(dd->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
350 if(dd->PtProng(0) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(1) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0bar = 0;
352 if(!okD0 && !okD0bar) return 0;
354 if(TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
355 TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
356 if(TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
357 TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
358 if(!okD0 && !okD0bar) return 0;
360 if(dd->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
362 dd->InvMassD0(mD0,mD0bar);
363 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
364 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
365 if(!okD0 && !okD0bar) return 0;
367 dd->CosThetaStarD0(ctsD0,ctsD0bar);
368 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
369 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
370 if(!okD0 && !okD0bar) return 0;
372 if(dd->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
374 if(dd->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
376 if (okD0) returnvalue=1; //cuts passed as D0
377 if (okD0bar) returnvalue=2; //cuts passed as D0bar
378 if (okD0 && okD0bar) returnvalue=3; //both