]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliRDHFCutsD0toKpi.cxx
Added method Misalign() to smear impact parameters and vertex position (Andrea R)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliRDHFCutsD0toKpi.cxx
CommitLineData
650b3ced 1/**************************************************************************
2 * Copyright(c) 1998-2010, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/////////////////////////////////////////////////////////////
17//
18// Class for cuts on AOD reconstructed D0->Kpi
19//
20// Author: A.Dainese, andrea.dainese@pd.infn.it
21/////////////////////////////////////////////////////////////
22
23#include <TDatabasePDG.h>
24#include <Riostream.h>
25
26#include "AliRDHFCutsD0toKpi.h"
27#include "AliAODRecoDecayHF2Prong.h"
28#include "AliAODTrack.h"
29#include "AliESDtrack.h"
30
31ClassImp(AliRDHFCutsD0toKpi)
32
33//--------------------------------------------------------------------------
a9b75906 34AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const char* name) :
35AliRDHFCuts(name)
650b3ced 36{
37 //
38 // Default Constructor
39 //
40 Int_t nvars=9;
41 SetNVars(nvars);
42 TString varNames[9]={"inv. mass [GeV]",
43 "dca [cm]",
44 "cosThetaStar",
45 "pTK [GeV/c]",
46 "pTPi [GeV/c]",
47 "d0K [cm]",
48 "d0Pi [cm]",
49 "d0d0 [cm^2]",
50 "cosThetaPoint"};
51 Bool_t isUpperCut[9]={kTRUE,
52 kTRUE,
53 kTRUE,
54 kFALSE,
55 kFALSE,
56 kTRUE,
57 kTRUE,
58 kTRUE,
59 kFALSE};
60 SetVarNames(nvars,varNames,isUpperCut);
61 Bool_t forOpt[9]={kFALSE,
62 kTRUE,
63 kTRUE,
64 kFALSE,
65 kFALSE,
66 kFALSE,
67 kFALSE,
68 kTRUE,
69 kTRUE};
70 SetVarsForOpt(4,forOpt);
71 Float_t limits[2]={0,999999999.};
72 SetPtBins(2,limits);
73}
74//--------------------------------------------------------------------------
75AliRDHFCutsD0toKpi::AliRDHFCutsD0toKpi(const AliRDHFCutsD0toKpi &source) :
76 AliRDHFCuts(source)
77{
78 //
79 // Copy constructor
80 //
81
82}
83//--------------------------------------------------------------------------
84AliRDHFCutsD0toKpi &AliRDHFCutsD0toKpi::operator=(const AliRDHFCutsD0toKpi &source)
85{
86 //
87 // assignment operator
88 //
89 if(&source == this) return *this;
90
91 AliRDHFCuts::operator=(source);
92
93 return *this;
94}
95
96
97//---------------------------------------------------------------------------
98void AliRDHFCutsD0toKpi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) {
99 //
100 // Fills in vars the values of the variables
101 //
102
650b3ced 103 if(nvars!=fnVarsForOpt) {
104 printf("AliRDHFCutsD0toKpi::GetCutsVarsForOpt: wrong number of variables\n");
105 return;
106 }
107
108 AliAODRecoDecayHF2Prong *dd = (AliAODRecoDecayHF2Prong*)d;
650b3ced 109
650b3ced 110 Int_t iter=-1;
111 if(fVarsForOpt[0]){
112 iter++;
113 if(TMath::Abs(pdgdaughters[0])==211) {
114 vars[iter]=dd->InvMassD0();
115 } else {
116 vars[iter]=dd->InvMassD0bar();
117 }
118 }
119 if(fVarsForOpt[1]){
120 iter++;
121 vars[iter]=dd->GetDCA();
122 }
123 if(fVarsForOpt[2]){
124 iter++;
125 if(TMath::Abs(pdgdaughters[0])==211) {
126 vars[iter] = dd->CosThetaStarD0();
127 } else {
128 vars[iter] = dd->CosThetaStarD0bar();
129 }
130 }
131 if(fVarsForOpt[3]){
132 iter++;
133 if(TMath::Abs(pdgdaughters[0])==321) {
134 vars[iter]=dd->PtProng(0);
135 }
136 else{
137 vars[iter]=dd->PtProng(1);
138 }
139 }
140 if(fVarsForOpt[4]){
141 iter++;
142 if(TMath::Abs(pdgdaughters[0])==211) {
143 vars[iter]=dd->PtProng(0);
144 }
145 else{
146 vars[iter]=dd->PtProng(1);
147 }
148 }
149 if(fVarsForOpt[5]){
150 iter++;
151 if(TMath::Abs(pdgdaughters[0])==321) {
152 vars[iter]=dd->Getd0Prong(0);
153 }
154 else{
155 vars[iter]=dd->Getd0Prong(1);
156 }
157 }
158 if(fVarsForOpt[6]){
159 iter++;
160 if(TMath::Abs(pdgdaughters[0])==211) {
161 vars[iter]=dd->Getd0Prong(0);
162 }
163 else{
164 vars[iter]=dd->Getd0Prong(1);
165 }
166 }
167 if(fVarsForOpt[7]){
168 iter++;
169 vars[iter]= dd->Prodd0d0();
170 }
171 if(fVarsForOpt[8]){
172 iter++;
173 vars[iter]=dd->CosPointingAngle();
174 }
175
176 return;
177}
178//---------------------------------------------------------------------------
179Int_t AliRDHFCutsD0toKpi::IsSelected(TObject* obj,Int_t selectionLevel) {
180 //
181 // Apply selection
182 //
183
184 if(!fCutsRD){
185 cout<<"Cut matrice not inizialized. Exit..."<<endl;
3cbc09cd 186 return 0;
650b3ced 187 }
188 //PrintAll();
3cbc09cd 189 AliAODRecoDecayHF2Prong* d=(AliAODRecoDecayHF2Prong*)obj;
650b3ced 190
650b3ced 191 if(!d){
192 cout<<"AliAODRecoDecayHF2Prong null"<<endl;
193 return 0;
194 }
195
3cbc09cd 196
650b3ced 197 // selection on daughter tracks
198 if(selectionLevel==AliRDHFCuts::kAll ||
199 selectionLevel==AliRDHFCuts::kTracks) {
3cbc09cd 200 if(!AreDaughtersSelected(d)) return 0;
650b3ced 201 }
202
203
c96634a2 204 // returnvalue: 0 not sel, 1 only D0, 2 only D0bar, 3 both
205 Int_t returnvaluePID=3;
206 Int_t returnvalueCuts=3;
207 Int_t returnvalue=3;
208
209 // selection on PID
210 if(selectionLevel==AliRDHFCuts::kAll ||
211 selectionLevel==AliRDHFCuts::kPID) {
212 returnvaluePID = IsSelectedPID(d);
213 }
214
215
650b3ced 216
217 // selection on candidate
218 if(selectionLevel==AliRDHFCuts::kAll ||
219 selectionLevel==AliRDHFCuts::kCandidate) {
220
221 Double_t pt=d->Pt();
222
223 Int_t okD0=0,okD0bar=0;
224
225 Int_t ptbin=PtBin(pt);
226
227 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
228 okD0=1; okD0bar=1;
229
230 Double_t mD0PDG = TDatabasePDG::Instance()->GetParticle(421)->Mass();
231
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;
234
4755453e 235 if(!okD0 && !okD0bar) return 0;
650b3ced 236
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;
4755453e 241 if(!okD0 && !okD0bar) return 0;
650b3ced 242
4755453e 243 if(d->GetDCA() > fCutsRD[GetGlobalIndex(1,ptbin)]) return 0;
650b3ced 244
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;
4755453e 248 if(!okD0 && !okD0bar) return 0;
650b3ced 249
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;
4755453e 253 if(!okD0 && !okD0bar) return 0;
650b3ced 254
4755453e 255 if(d->Prodd0d0() > fCutsRD[GetGlobalIndex(7,ptbin)]) return 0;
650b3ced 256
4755453e 257 if(d->CosPointingAngle() < fCutsRD[GetGlobalIndex(8,ptbin)]) return 0;
650b3ced 258
c96634a2 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
262 }
263
264
265 // combine PID and Cuts results
266 switch(returnvaluePID) {
267 case 0:
268 returnvalue=0;
269 break;
270 case 1:
271 returnvalue=((returnvalueCuts==1 || returnvalueCuts==3) ? 1 : 0);
272 break;
273 case 2:
274 returnvalue=((returnvalueCuts==2 || returnvalueCuts==3) ? 2 : 0);
275 break;
276 case 3:
277 returnvalue=returnvalueCuts;
278 break;
279 default:
280 returnvalue=0;
281 break;
650b3ced 282 }
283
650b3ced 284 return returnvalue;
650b3ced 285}
286//---------------------------------------------------------------------------
aa8d25fe 287Bool_t AliRDHFCutsD0toKpi::IsInFiducialAcceptance(Double_t pt, Double_t y) const
288{
289 //
290 // Checking if D0 is in fiducial acceptance region
291 //
292
c96634a2 293 if(pt > 5.) {
aa8d25fe 294 // applying cut for pt > 5 GeV
8ac644e5 295 AliDebug(4,Form("pt of D0 = %f (> 5), cutting at |y| < 0.8\n",pt));
aa8d25fe 296 if (TMath::Abs(y) > 0.8){
297 return kFALSE;
298 }
299 } else {
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;
8ac644e5 303 AliDebug(4,Form("pt of D0 = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY));
aa8d25fe 304 if (y < minFiducialY || y > maxFiducialY){
305 return kFALSE;
306 }
307 }
c96634a2 308
aa8d25fe 309 return kTRUE;
aa8d25fe 310}
c96634a2 311//---------------------------------------------------------------------------
312Int_t AliRDHFCutsD0toKpi::IsSelectedPID(AliAODRecoDecayHF* rd) const {
313 //
314 // Apply PID selection
315 // (return: 0 not sel, 1 only D0, 2 only D0bar, 3 both)
316 //
317
e4e29de4 318 if(!fUsePID || !rd) return 3;
c96634a2 319
320 Int_t returnvalue=0;
aa8d25fe 321
c96634a2 322 // HERE LOOP ON DAUGHTERS, USE AliAODpidHF CLASS, ETC...
323
324
325 return returnvalue;
326}