]>
Commit | Line | Data |
---|---|---|
e3d40058 | 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 D+->Kpipi | |
19 | // | |
20 | // Author: R. Bala, bala@to.infn.it | |
21 | // G. Ortona, ortona@to.infn.it | |
22 | ///////////////////////////////////////////////////////////// | |
23 | ||
24 | #include <TDatabasePDG.h> | |
25 | #include <Riostream.h> | |
26 | ||
27 | #include "AliRDHFCutsDplustoKpipi.h" | |
28 | #include "AliAODRecoDecayHF3Prong.h" | |
29 | #include "AliAODTrack.h" | |
30 | #include "AliESDtrack.h" | |
31 | ||
73173a6a | 32 | |
e3d40058 | 33 | ClassImp(AliRDHFCutsDplustoKpipi) |
34 | ||
35 | //-------------------------------------------------------------------------- | |
a9b75906 | 36 | AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi(const char* name) : |
da24b73f | 37 | AliRDHFCuts(name), |
38 | fUseStrongPid(kFALSE) | |
e3d40058 | 39 | { |
40 | // | |
41 | // Default Constructor | |
42 | // | |
43 | Int_t nvars=12; | |
44 | SetNVars(nvars); | |
45 | TString varNames[12]={"inv. mass [GeV]", | |
46 | "pTK [GeV/c]", | |
47 | "pTPi [GeV/c]", | |
48 | "d0K [cm] lower limit!", | |
49 | "d0Pi [cm] lower limit!", | |
50 | "dist12 (cm)", | |
51 | "sigmavert (cm)", | |
52 | "dist prim-sec (cm)", | |
53 | "pM=Max{pT1,pT2,pT3} (GeV/c)", | |
54 | "cosThetaPoint", | |
55 | "Sum d0^2 (cm^2)", | |
56 | "dca cut (cm)"}; | |
57 | Bool_t isUpperCut[12]={kTRUE, | |
58 | kFALSE, | |
59 | kFALSE, | |
60 | kFALSE, | |
61 | kFALSE, | |
62 | kFALSE, | |
63 | kTRUE, | |
64 | kFALSE, | |
65 | kFALSE, | |
66 | kFALSE, | |
67 | kFALSE, | |
68 | kTRUE}; | |
69 | SetVarNames(nvars,varNames,isUpperCut); | |
4755453e | 70 | Bool_t forOpt[12]={kFALSE, |
e3d40058 | 71 | kFALSE, |
72 | kFALSE, | |
73 | kFALSE, | |
74 | kFALSE, | |
75 | kFALSE, | |
76 | kTRUE, | |
77 | kTRUE, | |
78 | kTRUE, | |
79 | kTRUE, | |
80 | kTRUE, | |
81 | kFALSE}; | |
4755453e | 82 | SetVarsForOpt(5,forOpt); |
e3d40058 | 83 | Float_t limits[2]={0,999999999.}; |
84 | SetPtBins(2,limits); | |
73173a6a | 85 | if(fPidHF)delete fPidHF; |
86 | fPidHF=new AliAODPidHF(); | |
87 | Double_t plim[2]={0.6,0.8}; | |
88 | Double_t nsigma[5]={2.,1.,2.,3.,0.}; | |
89 | ||
90 | fPidHF->SetPLimit(plim); | |
91 | fPidHF->SetAsym(kTRUE); | |
92 | fPidHF->SetSigma(nsigma); | |
93 | fPidHF->SetMatch(1); | |
94 | fPidHF->SetTPC(1); | |
95 | fPidHF->SetTOF(1); | |
96 | fPidHF->SetITS(0); | |
97 | fPidHF->SetTRD(0); | |
98 | fPidHF->SetCompat(kTRUE); | |
99 | ||
100 | ||
e3d40058 | 101 | } |
102 | //-------------------------------------------------------------------------- | |
103 | AliRDHFCutsDplustoKpipi::AliRDHFCutsDplustoKpipi(const AliRDHFCutsDplustoKpipi &source) : | |
da24b73f | 104 | AliRDHFCuts(source), |
105 | fUseStrongPid(source.fUseStrongPid) | |
106 | ||
e3d40058 | 107 | { |
108 | // | |
109 | // Copy constructor | |
110 | // | |
111 | ||
112 | } | |
113 | //-------------------------------------------------------------------------- | |
114 | AliRDHFCutsDplustoKpipi &AliRDHFCutsDplustoKpipi::operator=(const AliRDHFCutsDplustoKpipi &source) | |
115 | { | |
116 | // | |
117 | // assignment operator | |
118 | // | |
119 | if(&source == this) return *this; | |
120 | ||
121 | AliRDHFCuts::operator=(source); | |
122 | ||
123 | return *this; | |
124 | } | |
73173a6a | 125 | // |
e3d40058 | 126 | |
127 | ||
128 | //--------------------------------------------------------------------------- | |
129 | void AliRDHFCutsDplustoKpipi::GetCutVarsForOpt(AliAODRecoDecayHF *d,Float_t *vars,Int_t nvars,Int_t *pdgdaughters) { | |
130 | // | |
131 | // Fills in vars the values of the variables | |
132 | // | |
133 | ||
134 | ||
135 | if(nvars!=fnVarsForOpt) { | |
136 | printf("AliRDHFCutsDplustoKpipi::GetCutsVarsForOpt: wrong number of variables\n"); | |
137 | return; | |
138 | } | |
139 | ||
140 | AliAODRecoDecayHF3Prong *dd = (AliAODRecoDecayHF3Prong*)d; | |
e3d40058 | 141 | |
e3d40058 | 142 | Int_t iter=-1; |
143 | if(fVarsForOpt[0]){ | |
144 | iter++; | |
145 | vars[iter]=dd->InvMassDplus(); | |
146 | } | |
147 | if(fVarsForOpt[1]){ | |
148 | iter++; | |
149 | for(Int_t iprong=0;iprong<3;iprong++){ | |
150 | if(TMath::Abs(pdgdaughters[iprong])==321) { | |
151 | vars[iter]=dd->PtProng(iprong); | |
152 | } | |
153 | } | |
154 | } | |
155 | if(fVarsForOpt[2]){ | |
156 | iter++; | |
4755453e | 157 | Float_t minPtDau=1000000.0; |
e3d40058 | 158 | for(Int_t iprong=0;iprong<3;iprong++){ |
159 | if(TMath::Abs(pdgdaughters[iprong])==211) { | |
4755453e | 160 | if(dd->PtProng(iprong)<minPtDau){ |
161 | minPtDau=dd->PtProng(iprong); | |
162 | } | |
e3d40058 | 163 | } |
164 | } | |
4755453e | 165 | vars[iter]=minPtDau; |
e3d40058 | 166 | } |
167 | if(fVarsForOpt[3]){ | |
168 | iter++; | |
169 | for(Int_t iprong=0;iprong<3;iprong++){ | |
170 | if(TMath::Abs(pdgdaughters[iprong])==321) { | |
171 | vars[iter]=dd->Getd0Prong(iprong); | |
172 | } | |
173 | } | |
174 | } | |
175 | if(fVarsForOpt[4]){ | |
176 | iter++; | |
4755453e | 177 | Float_t minImpParDau=1000000.0; |
e3d40058 | 178 | for(Int_t iprong=0;iprong<3;iprong++){ |
179 | if(TMath::Abs(pdgdaughters[iprong])==211) { | |
4755453e | 180 | if(dd->Getd0Prong(iprong)<minImpParDau){ |
181 | minImpParDau=dd->Getd0Prong(iprong); | |
182 | } | |
e3d40058 | 183 | } |
184 | } | |
4755453e | 185 | vars[iter]=minImpParDau; |
e3d40058 | 186 | } |
187 | if(fVarsForOpt[5]){ | |
188 | iter++; | |
4755453e | 189 | Float_t dist12 = dd->GetDist12toPrim(); |
190 | Float_t dist23 = dd->GetDist23toPrim(); | |
191 | if(dist12<dist23)vars[iter]=dist12; | |
192 | else vars[iter]=dist23; | |
e3d40058 | 193 | } |
194 | if(fVarsForOpt[6]){ | |
195 | iter++; | |
196 | vars[iter]=dd->GetSigmaVert(); | |
197 | } | |
198 | if(fVarsForOpt[7]){ | |
199 | iter++; | |
200 | vars[iter] = dd->DecayLength(); | |
201 | } | |
202 | if(fVarsForOpt[8]){ | |
203 | iter++; | |
204 | Float_t ptmax=0; | |
205 | for(Int_t i=0;i<3;i++){ | |
206 | if(dd->PtProng(i)>ptmax)ptmax=dd->PtProng(i); | |
207 | } | |
208 | vars[iter]=ptmax; | |
209 | } | |
210 | if(fVarsForOpt[9]){ | |
211 | iter++; | |
212 | vars[iter]=dd->CosPointingAngle(); | |
213 | } | |
214 | if(fVarsForOpt[10]){ | |
215 | iter++; | |
216 | vars[iter]=dd->Getd0Prong(0)*dd->Getd0Prong(0)+dd->Getd0Prong(1)*dd->Getd0Prong(1)+dd->Getd0Prong(2)*dd->Getd0Prong(2); | |
217 | } | |
218 | if(fVarsForOpt[11]){ | |
219 | iter++; | |
4755453e | 220 | Float_t maxDCA=0; |
221 | for(Int_t iprong=0;iprong<3;iprong++){ | |
222 | if(dd->GetDCA(iprong)<maxDCA){ | |
223 | maxDCA=dd->GetDCA(iprong); | |
224 | } | |
225 | } | |
226 | vars[iter]=maxDCA; | |
e3d40058 | 227 | } |
228 | return; | |
229 | } | |
c1cc7a53 | 230 | //--------------------------------------------------------------------------- |
231 | Bool_t AliRDHFCutsDplustoKpipi::IsInFiducialAcceptance(Double_t pt, Double_t y) const | |
232 | { | |
233 | // | |
234 | // Checking if Dplus is in fiducial acceptance region | |
235 | // | |
236 | ||
237 | if(pt > 5.) { | |
238 | // applying cut for pt > 5 GeV | |
239 | AliDebug(2,Form("pt of D+ = %f (> 5), cutting at |y| < 0.8",pt)); | |
240 | if (TMath::Abs(y) > 0.8) return kFALSE; | |
241 | ||
242 | } else { | |
243 | // appliying smooth cut for pt < 5 GeV | |
244 | Double_t maxFiducialY = -0.2/15*pt*pt+1.9/15*pt+0.5; | |
245 | Double_t minFiducialY = 0.2/15*pt*pt-1.9/15*pt-0.5; | |
246 | AliDebug(2,Form("pt of D+ = %f (< 5), cutting according to the fiducial zone [%f, %f]\n",pt,minFiducialY,maxFiducialY)); | |
247 | if (y < minFiducialY || y > maxFiducialY) return kFALSE; | |
248 | } | |
249 | ||
250 | return kTRUE; | |
251 | } | |
73173a6a | 252 | |
253 | //--------------------------------------------------------------------------- | |
bc116f28 | 254 | Int_t AliRDHFCutsDplustoKpipi::IsSelectedPID(AliAODRecoDecayHF *rd) |
255 | { | |
256 | // | |
595cc7e2 | 257 | // PID selection, returns 3 if accepted, 0 if not accepted |
bc116f28 | 258 | // |
595cc7e2 | 259 | if(!fUsePID || !rd) return 3; |
73173a6a | 260 | //if(fUsePID)printf("i am inside the pid \n"); |
261 | Int_t nkaons=0; | |
262 | Int_t nNotKaons=0; | |
263 | Int_t sign= rd->GetCharge(); | |
264 | for(Int_t daught=0;daught<3;daught++){ | |
265 | AliAODTrack *track=(AliAODTrack*)rd->GetDaughter(daught); | |
266 | Int_t isPion=fPidHF->MakeRawPid(track,AliPID::kPion); | |
267 | Int_t isKaon=fPidHF->MakeRawPid(track,AliPID::kKaon); | |
268 | Int_t isProton=fPidHF->MakeRawPid(track,AliPID::kProton); | |
269 | ||
270 | if(isProton>0 && isKaon<0 && isPion<0) return 0; | |
271 | if(isKaon>0 && isPion<0) nkaons++; | |
272 | if(isKaon<0) nNotKaons++; | |
273 | if(sign==track->Charge()){//pions | |
274 | if(isPion<0)return 0; | |
da24b73f | 275 | if(rd->Pt()<2. && isPion<=0 && fUseStrongPid)return 0; |
73173a6a | 276 | } |
277 | else{//kaons | |
278 | if(isKaon<0)return 0; | |
da24b73f | 279 | if(rd->Pt()<2. && isKaon<=0 && fUseStrongPid)return 0; |
73173a6a | 280 | } |
281 | ||
282 | ||
283 | } | |
284 | ||
285 | if(nkaons>1)return 0; | |
286 | if(nNotKaons==3)return 0; | |
287 | ||
595cc7e2 | 288 | return 3; |
73173a6a | 289 | } |
290 | ||
291 | ||
292 | ||
e3d40058 | 293 | //--------------------------------------------------------------------------- |
c1cc7a53 | 294 | Int_t AliRDHFCutsDplustoKpipi::IsSelected(TObject* obj,Int_t selectionLevel, AliAODEvent* aod) { |
e3d40058 | 295 | // |
595cc7e2 | 296 | // Apply selection, returns 3 if accepted, 0 if not accepted |
e3d40058 | 297 | // |
298 | ||
299 | if(!fCutsRD){ | |
4755453e | 300 | cout<<"Cut matrix not inizialized. Exit..."<<endl; |
e3d40058 | 301 | return 0; |
302 | } | |
303 | //PrintAll(); | |
304 | AliAODRecoDecayHF3Prong* d=(AliAODRecoDecayHF3Prong*)obj; | |
305 | ||
306 | ||
307 | if(!d){ | |
308 | cout<<"AliAODRecoDecayHF3Prong null"<<endl; | |
309 | return 0; | |
310 | } | |
311 | ||
312 | ||
313 | ||
314 | // selection on daughter tracks | |
315 | if(selectionLevel==AliRDHFCuts::kAll || | |
316 | selectionLevel==AliRDHFCuts::kTracks) { | |
317 | if(!AreDaughtersSelected(d)) return 0; | |
318 | } | |
73173a6a | 319 | |
320 | // PID selection | |
595cc7e2 | 321 | Int_t returnvaluePID=3; |
322 | Int_t returnvalueCuts=3; | |
73173a6a | 323 | |
e3d40058 | 324 | |
73173a6a | 325 | //if(selectionLevel==AliRDHFCuts::kAll || |
326 | if(selectionLevel==AliRDHFCuts::kCandidate || | |
c1cc7a53 | 327 | selectionLevel==AliRDHFCuts::kPID) { |
73173a6a | 328 | returnvaluePID = IsSelectedPID(d); |
329 | } | |
330 | if(returnvaluePID==0)return 0; | |
331 | ||
332 | ||
e3d40058 | 333 | // selection on candidate |
334 | if(selectionLevel==AliRDHFCuts::kAll || | |
335 | selectionLevel==AliRDHFCuts::kCandidate) { | |
336 | ||
c1cc7a53 | 337 | //recalculate vertex w/o daughters |
338 | AliAODVertex *origownvtx=0x0; | |
339 | AliAODVertex *recvtx=0x0; | |
340 | if(fRemoveDaughtersFromPrimary) { | |
341 | if(!aod) { | |
342 | AliError("Can not remove daughters from vertex without AOD event"); | |
343 | return 0; | |
344 | } | |
345 | if(d->GetOwnPrimaryVtx()) origownvtx=new AliAODVertex(*d->GetOwnPrimaryVtx()); | |
346 | recvtx=d->RemoveDaughtersFromPrimaryVtx(aod); | |
347 | if(!recvtx){ | |
348 | AliDebug(2,"Removal of daughter tracks failed"); | |
349 | //recvtx=d->GetPrimaryVtx(); | |
350 | if(origownvtx){ | |
351 | delete origownvtx; | |
352 | origownvtx=NULL; | |
353 | } | |
354 | return 0; | |
355 | } | |
356 | //set recalculed primary vertex | |
357 | d->SetOwnPrimaryVtx(recvtx); | |
358 | delete recvtx; recvtx=NULL; | |
359 | } | |
360 | ||
e3d40058 | 361 | Double_t pt=d->Pt(); |
73173a6a | 362 | |
e3d40058 | 363 | Int_t ptbin=PtBin(pt); |
c1cc7a53 | 364 | if (ptbin==-1) { |
365 | if(origownvtx){ | |
366 | d->SetOwnPrimaryVtx(origownvtx); | |
367 | delete origownvtx; | |
368 | origownvtx=NULL; | |
369 | } | |
370 | else d->UnsetOwnPrimaryVtx(); | |
371 | return 0; | |
372 | } | |
73173a6a | 373 | |
e3d40058 | 374 | Double_t mDplusPDG = TDatabasePDG::Instance()->GetParticle(411)->Mass(); |
375 | Double_t mDplus=d->InvMassDplus(); | |
c1cc7a53 | 376 | if(TMath::Abs(mDplus-mDplusPDG)>fCutsRD[GetGlobalIndex(0,ptbin)])returnvalueCuts=0; |
e3d40058 | 377 | // if(d->PtProng(1) < fCutsRD[GetGlobalIndex(3,ptbin)] || d->PtProng(0) < fCutsRD[GetGlobalIndex(4,ptbin)]) okD0 = 0; |
c1cc7a53 | 378 | if(TMath::Abs(d->PtProng(1)) < fCutsRD[GetGlobalIndex(1,ptbin)] || TMath::Abs(d->Getd0Prong(1))<fCutsRD[GetGlobalIndex(3,ptbin)])returnvalueCuts=0;//Kaon |
379 | if(TMath::Abs(d->PtProng(0)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(0))<fCutsRD[GetGlobalIndex(4,ptbin)])returnvalueCuts=0;//Pion1 | |
380 | if(TMath::Abs(d->PtProng(2)) < fCutsRD[GetGlobalIndex(2,ptbin)] || TMath::Abs(d->Getd0Prong(2))<fCutsRD[GetGlobalIndex(4,ptbin)])returnvalueCuts=0;//Pion2 | |
e3d40058 | 381 | |
382 | ||
383 | ||
c1cc7a53 | 384 | //2track cuts |
385 | if(d->GetDist12toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)]|| d->GetDist23toPrim()<fCutsRD[GetGlobalIndex(5,ptbin)])returnvalueCuts=0; | |
386 | if(d->Getd0Prong(0)*d->Getd0Prong(1)<0. && d->Getd0Prong(2)*d->Getd0Prong(1)<0.)returnvalueCuts=0; | |
387 | ||
388 | //sec vert | |
389 | if(d->GetSigmaVert()>fCutsRD[GetGlobalIndex(6,ptbin)])returnvalueCuts=0; | |
390 | ||
391 | if(d->DecayLength()<fCutsRD[GetGlobalIndex(7,ptbin)])returnvalueCuts=0; | |
392 | ||
393 | if(TMath::Abs(d->PtProng(0))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(1))<fCutsRD[GetGlobalIndex(8,ptbin)] && TMath::Abs(d->PtProng(2))<fCutsRD[GetGlobalIndex(8,ptbin)])returnvalueCuts=0; | |
394 | if(d->CosPointingAngle()< fCutsRD[GetGlobalIndex(9,ptbin)])returnvalueCuts=0; | |
395 | Double_t sum2=d->Getd0Prong(0)*d->Getd0Prong(0)+d->Getd0Prong(1)*d->Getd0Prong(1)+d->Getd0Prong(2)*d->Getd0Prong(2); | |
396 | if(sum2<fCutsRD[GetGlobalIndex(10,ptbin)])returnvalueCuts=0; | |
397 | ||
398 | //DCA | |
399 | for(Int_t i=0;i<3;i++) if(d->GetDCA(i)>fCutsRD[GetGlobalIndex(11,ptbin)]) returnvalueCuts=0; | |
400 | // unset recalculated primary vertex when not needed any more | |
401 | if(origownvtx) { | |
402 | d->SetOwnPrimaryVtx(origownvtx); | |
403 | delete origownvtx; | |
404 | origownvtx=NULL; | |
405 | } else if(fRemoveDaughtersFromPrimary) { | |
406 | d->UnsetOwnPrimaryVtx(); | |
407 | AliDebug(3,"delete new vertex\n"); | |
408 | } | |
409 | ||
410 | return returnvalueCuts; | |
e3d40058 | 411 | } |
c1cc7a53 | 412 | |
595cc7e2 | 413 | return 3; |
e3d40058 | 414 | } |
415 | //--------------------------------------------------------------------------- |