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"
33 ClassImp(AliRDHFCutsDStartoKpipi)
35 //--------------------------------------------------------------------------
36 AliRDHFCutsDStartoKpipi::AliRDHFCutsDStartoKpipi() :
40 // Default Constructor
45 TString varNames[14]={
55 "inv. mass half width of D* [GeV]",
56 "half width of (M_Kpipi-M_D0) [GeV]",
57 "PtMin of pi_s [GeV/c]",
58 "PtMax of pi_s [GeV/c]",
59 "theta, angle between the pi_s and decay plane of the D0 [rad]"};
60 Bool_t isUpperCut[14]={
75 SetVarNames(nvars,varNames,isUpperCut);
91 SetVarsForOpt(5,forOpt);
92 Float_t limits[2]={0,999999999.};
95 //--------------------------------------------------------------------------
96 AliRDHFCutsDStartoKpipi::AliRDHFCutsDStartoKpipi(const AliRDHFCutsDStartoKpipi &source) :
104 //--------------------------------------------------------------------------
105 AliRDHFCutsDStartoKpipi &AliRDHFCutsDStartoKpipi::operator=(const AliRDHFCutsDStartoKpipi &source)
108 // assignment operator
110 if(&source == this) return *this;
112 AliRDHFCuts::operator=(source);
118 //---------------------------------------------------------------------------
119 void AliRDHFCutsDStartoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
121 // Fills in vars the values of the variables
123 if(nvars!=fnVarsForOpt) {
124 printf("AliRDHFCutsDStartoKpipi::GetCutsVarsForOpt: wrong number of variables\n");
129 AliAODRecoCascadeHF* dstarD0pi = (AliAODRecoCascadeHF*)d;
131 AliAODTrack *softPi = (AliAODTrack*)dstarD0pi->GetBachelor();
133 AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)dstarD0pi->Get2Prong();
138 if(TMath::Abs(pdgdaughters[0])==211) {
139 vars[iter]=dd->InvMassD0();
141 vars[iter]=dd->InvMassD0bar();
146 vars[iter]=dd->GetDCA();
150 if(TMath::Abs(pdgdaughters[0])==211) {
151 vars[iter] = dd->CosThetaStarD0();
153 vars[iter] = dd->CosThetaStarD0bar();
158 if(TMath::Abs(pdgdaughters[0])==321) {
159 vars[iter]=dd->PtProng(0);
162 vars[iter]=dd->PtProng(1);
167 if(TMath::Abs(pdgdaughters[0])==211) {
168 vars[iter]=dd->PtProng(0);
171 vars[iter]=dd->PtProng(1);
176 if(TMath::Abs(pdgdaughters[0])==321) {
177 vars[iter]=dd->Getd0Prong(0);
180 vars[iter]=dd->Getd0Prong(1);
185 if(TMath::Abs(pdgdaughters[0])==211) {
186 vars[iter]=dd->Getd0Prong(0);
189 vars[iter]=dd->Getd0Prong(1);
194 vars[iter]= dd->Prodd0d0();
198 vars[iter]=dd->CosPointingAngle();
202 vars[iter]=dstarD0pi->InvMassDstarKpipi();
206 vars[iter]=dstarD0pi->DeltaInvMass();
210 vars[iter] = softPi->Pt();
214 vars[iter] = softPi->Pt();
218 vars[iter] =dstarD0pi->AngleD0dkpPisoft();
223 //---------------------------------------------------------------------------
224 Int_t AliRDHFCutsDStartoKpipi::IsSelected(TObject* obj,Int_t selectionLevel) {
226 // Apply selection for D*.
229 cout<<"Cut matrice not inizialized. Exit..."<<endl;
233 AliAODRecoCascadeHF* d = (AliAODRecoCascadeHF*)obj;
235 cout<<"AliAODRecoCascadeHF null"<<endl;
239 AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)d->Get2Prong();
241 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
245 AliAODTrack *b = (AliAODTrack*)d->GetBachelor();
247 // selection on daughter tracks
248 if(selectionLevel==AliRDHFCuts::kAll ||
249 selectionLevel==AliRDHFCuts::kTracks) {
250 if(!AreDaughtersSelected(d)) return 0;
255 // selection on candidate
256 if(selectionLevel==AliRDHFCuts::kAll ||
257 selectionLevel==AliRDHFCuts::kCandidate) {
260 Int_t ptbin=PtBin(pt);
262 // select D0 that passes D* cuts
263 returnvalue = IsD0FromDStarSelected(pt,dd,selectionLevel);
265 // DStarMass and D0mass
266 Double_t mDSPDG = TDatabasePDG::Instance()->GetParticle(413)->Mass();
267 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
269 Double_t deltaPDG = mDSPDG-mD0PDG;
276 okDStarP=1; okDStarM=1;
278 dd->InvMassD0(mD0,mD0bar);
279 // Half width DStar mass
280 if(TMath::Abs((d->InvMassDstarKpipi()-mDSPDG))>fCutsRD[GetGlobalIndex(9,ptbin)]) return 0;
281 // Half width Delta mass
283 if(TMath::Abs((d->InvMassDstarKpipi()-mD0)-deltaPDG) > fCutsRD[GetGlobalIndex(10,ptbin)]) okDStarP =0;
284 if(TMath::Abs((d->InvMassDstarKpipi()-mD0bar)-deltaPDG) > fCutsRD[GetGlobalIndex(10,ptbin)]) okDStarM =0;
285 if(!okDStarP && !okDStarM) return 0;
287 // cut on soft pion pt
288 if(b->Pt() < fCutsRD[GetGlobalIndex(11,ptbin)] || b->Pt() > fCutsRD[GetGlobalIndex(12,ptbin)]) return 0;
289 // cut on the angle between D0 decay plane and soft pion
290 if(d->AngleD0dkpPisoft() > fCutsRD[GetGlobalIndex(13,ptbin)]) return 0;
296 //_________________________________________________________________________________________________
297 Int_t AliRDHFCutsDStartoKpipi::IsD0FromDStarSelected(Double_t pt, TObject* obj,Int_t selectionLevel) {
299 // Apply selection for D0 from D*. The selection in on D0 prongs
303 cout<<"Cut matrice not inizialized. Exit..."<<endl;
307 AliAODRecoDecayHF2Prong* dd = (AliAODRecoDecayHF2Prong*)obj;
310 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
314 // selection on daughter tracks
315 if(selectionLevel==AliRDHFCuts::kAll ||
316 selectionLevel==AliRDHFCuts::kTracks) {
317 if(!AreDaughtersSelected(dd)) return 0;
322 // selection on candidate
323 if(selectionLevel==AliRDHFCuts::kAll ||
324 selectionLevel==AliRDHFCuts::kCandidate) {
327 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
330 Int_t ptbin=PtBin(pt);
332 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
338 if(dd->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
339 if(dd->PtProng(0) < fCutsRD[GetGlobalIndex(3,ptbin)] || dd->PtProng(1) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0bar = 0;
341 if(!okD0 && !okD0bar) return 0;
343 if(TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
344 TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
345 if(TMath::Abs(dd->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
346 TMath::Abs(dd->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
347 if(!okD0 && !okD0bar) return 0;
349 if(dd->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
351 dd->InvMassD0(mD0,mD0bar);
352 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
353 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
354 if(!okD0 && !okD0bar) return 0;
356 dd->CosThetaStarD0(ctsD0,ctsD0bar);
357 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
358 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
359 if(!okD0 && !okD0bar) return 0;
361 if(dd->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
363 if(dd->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
365 if (okD0) returnvalue=1; //cuts passed as D0
366 if (okD0bar) returnvalue=2; //cuts passed as D0bar
367 if (okD0 && okD0bar) returnvalue=3; //both