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 D0->Kpi
20 // Author: A.Dainese, andrea.dainese@pd.infn.it
21 /////////////////////////////////////////////////////////////
23 #include <TDatabasePDG.h>
24 #include <Riostream.h>
26 #include "AliRDHFCutsD0toKpi.h"
27 #include "AliAODRecoDecayHF2Prong.h"
28 #include "AliAODTrack.h"
29 #include "AliESDtrack.h"
31 ClassImp(AliRDHFCutsD0toKpi)
33 //--------------------------------------------------------------------------
34 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const char* name) :
38 // Default Constructor
42 TString varNames[9]={"inv. mass [GeV]",
51 Bool_t isUpperCut[9]={kTRUE,
60 SetVarNames(nvars,varNames,isUpperCut);
61 Bool_t forOpt[9]={kFALSE,
70 SetVarsForOpt(4,forOpt);
71 Float_t limits[2]={0,999999999.};
74 //--------------------------------------------------------------------------
75 AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const AliRDHFCutsD0toKpi &source) :
83 //--------------------------------------------------------------------------
84 AliRDHFCutsD0toKpi &AliRDHFCutsD0toKpi::operator=(const AliRDHFCutsD0toKpi &source)
87 // assignment operator
89 if(&source == this) return *this;
91 AliRDHFCuts::operator=(source);
97 //---------------------------------------------------------------------------
98 void AliRDHFCutsD0toKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
100 // Fills in vars the values of the variables
103 if(nvars!=fnVarsForOpt) {
104 printf("AliRDHFCutsD0toKpi::GetCutsVarsForOpt: wrong number of variables\n");
108 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
113 if(TMath::Abs(pdgdaughters[0])==211) {
114 vars[iter]=dd->InvMassD0();
116 vars[iter]=dd->InvMassD0bar();
121 vars[iter]=dd->GetDCA();
125 if(TMath::Abs(pdgdaughters[0])==211) {
126 vars[iter] = dd->CosThetaStarD0();
128 vars[iter] = dd->CosThetaStarD0bar();
133 if(TMath::Abs(pdgdaughters[0])==321) {
134 vars[iter]=dd->PtProng(0);
137 vars[iter]=dd->PtProng(1);
142 if(TMath::Abs(pdgdaughters[0])==211) {
143 vars[iter]=dd->PtProng(0);
146 vars[iter]=dd->PtProng(1);
151 if(TMath::Abs(pdgdaughters[0])==321) {
152 vars[iter]=dd->Getd0Prong(0);
155 vars[iter]=dd->Getd0Prong(1);
160 if(TMath::Abs(pdgdaughters[0])==211) {
161 vars[iter]=dd->Getd0Prong(0);
164 vars[iter]=dd->Getd0Prong(1);
169 vars[iter]= dd->Prodd0d0();
173 vars[iter]=dd->CosPointingAngle();
178 //---------------------------------------------------------------------------
179 Int_t AliRDHFCutsD0toKpi::IsSelected(TObject* obj,Int_t selectionLevel) {
185 cout<<"Cut matrice not inizialized. Exit..."<<endl;
189 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
192 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
197 // selection on daughter tracks
198 if(selectionLevel==AliRDHFCuts::kAll ||
199 selectionLevel==AliRDHFCuts::kTracks) {
200 if(!AreDaughtersSelected(d)) return 0;
204 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
205 Int_t returnvaluePID=3;
206 Int_t returnvalueCuts=3;
210 if(selectionLevel==AliRDHFCuts::kAll ||
211 selectionLevel==AliRDHFCuts::kPID) {
212 returnvaluePID = IsSelectedPID(d);
217 // selection on candidate
218 if(selectionLevel==AliRDHFCuts::kAll ||
219 selectionLevel==AliRDHFCuts::kCandidate) {
223 Int_t okD0=0,okD0bar=0;
225 Int_t ptbin=PtBin(pt);
227 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
230 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
232 if(d->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || d->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0;
233 if(d->PtProng(0) < fCutsRD[GetGlobalIndex(3,ptbin)] || d->PtProng(1) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0bar = 0;
235 if(!okD0 && !okD0bar) return 0;
237 if(TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)] ||
238 TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)]) okD0 = 0;
239 if(TMath::Abs(d->Getd0Prong(0)) > fCutsRD[GetGlobalIndex(6,ptbin)] ||
240 TMath::Abs(d->Getd0Prong(1)) > fCutsRD[GetGlobalIndex(5,ptbin)]) okD0bar = 0;
241 if(!okD0 && !okD0bar) return 0;
243 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
245 d->InvMassD0(mD0,mD0bar);
246 if(TMath::Abs(mD0-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0 = 0;
247 if(TMath::Abs(mD0bar-mD0PDG) > fCutsRD[GetGlobalIndex(0,ptbin)]) okD0bar = 0;
248 if(!okD0 && !okD0bar) return 0;
250 d->CosThetaStarD0(ctsD0,ctsD0bar);
251 if(TMath::Abs(ctsD0) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0 = 0;
252 if(TMath::Abs(ctsD0bar) > fCutsRD[GetGlobalIndex(2,ptbin)]) okD0bar = 0;
253 if(!okD0 && !okD0bar) return 0;
255 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
257 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
259 if (okD0) returnvalueCuts=1; //cuts passed as D0
260 if (okD0bar) returnvalueCuts=2; //cuts passed as D0bar
261 if (okD0 && okD0bar) returnvalueCuts=3; //cuts passed as D0 and D0bar
265 // combine PID and Cuts results
266 switch(returnvaluePID) {
271 returnvalue=((returnvalueCuts==1 || returnvalueCuts==3) ? 1 : 0);
274 returnvalue=((returnvalueCuts==2 || returnvalueCuts==3) ? 2 : 0);
277 returnvalue=returnvalueCuts;
286 //---------------------------------------------------------------------------
287 Bool_t AliRDHFCutsD0toKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
290 // Checking if D0 is in fiducial acceptance region
294 // applying cut for pt > 5 GeV
295 AliInfo(Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
296 if (TMath::Abs(y) > 0.8){
300 // appliying smooth cut for pt < 5 GeV
301 Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5;
302 Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5;
303 AliInfo(Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
304 if (y < minFiducialY || y > maxFiducialY){
311 //---------------------------------------------------------------------------
312 Int_t AliRDHFCutsD0toKpi::IsSelectedPID(AliAODRecoDecayHF* rd) const {
314 // Apply PID selection
315 // (return: 0 not sel, 1 only D0, 2 only D0bar, 3 both)
318 if(!fUsePID) return 3;
322 // HERE LOOP ON DAUGHTERS, USE AliAODpidHF CLASS, ETC...