]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliD0toKpi.cxx
EMCAL geometry can be created independently form anything now
[u/mrichter/AliRoot.git] / ANALYSIS / AliD0toKpi.cxx
CommitLineData
3a9a3487 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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// Implementation of the D0toKpi class
ef0182f7 18// for pp and PbPb interactions
3a9a3487 19// Note: the two decay tracks are labelled: 0 (positive track)
20// 1 (negative track)
ef0182f7 21// Origin: A. Dainese andrea.dainese@lnl.infn.it
3a9a3487 22//----------------------------------------------------------------------------
741f4d30 23
3a9a3487 24#include <TH1.h>
25#include <TH2.h>
26#include <TCanvas.h>
27#include <TPaveLabel.h>
dab957fb 28#include <TVector3.h>
3a9a3487 29
30#include "AliD0toKpi.h"
31
32ClassImp(AliD0toKpi)
33
34//----------------------------------------------------------------------------
35AliD0toKpi::AliD0toKpi() {
36 // Default constructor
37
38 fSignal = kFALSE;
39
40 fEvent = 0;
41
42 fTrkNum[0] = 0;
43 fTrkNum[1] = 0;
44
45 fV1x = 0.;
46 fV1y = 0.;
47 fV1z = 0.;
48 fV2x = 0.;
49 fV2y = 0.;
50 fV2z = 0.;
51 fDCA = 0.;
52
53 fPx[0] = 0.;
54 fPy[0] = 0.;
55 fPz[0] = 0.;
56 fPx[1] = 0.;
57 fPy[1] = 0.;
58 fPz[1] = 0.;
59
60 fd0[0] = 0.;
61 fd0[1] = 0.;
62
63 fPdg[0] = 0;
64 fPdg[1] = 0;
65 fMum[0] = 0;
66 fMum[1] = 0;
67
68 fTagPi[0] = 0.;
69 fTagPi[1] = 0.;
70 fTagKa[0] = 0.;
71 fTagKa[1] = 0.;
72 fTagNid[0] = 0.;
73 fTagNid[1] = 0.;
74
75 fWgtAD0=fWgtAD0bar=fWgtBD0=fWgtBD0bar=fWgtCD0=fWgtCD0bar=fWgtDD0=fWgtDD0bar=0;
76
77}
78//----------------------------------------------------------------------------
79AliD0toKpi::AliD0toKpi(Int_t ev,Int_t trkNum[2],
80 Double_t v1[3],Double_t v2[3],
81 Double_t dca,
82 Double_t mom[6],Double_t d0[2]) {
83 // Constructor
84
85 fSignal = kFALSE;
86
87 fEvent = ev;
88 fTrkNum[0] = trkNum[0];
89 fTrkNum[1] = trkNum[1];
90
91 fV1x = v1[0];
92 fV1y = v1[1];
93 fV1z = v1[2];
94 fV2x = v2[0];
95 fV2y = v2[1];
96 fV2z = v2[2];
97 fDCA = dca;
98
99 fPx[0] = mom[0];
100 fPy[0] = mom[1];
101 fPz[0] = mom[2];
102 fPx[1] = mom[3];
103 fPy[1] = mom[4];
104 fPz[1] = mom[5];
105
106 fd0[0] = d0[0];
107 fd0[1] = d0[1];
108
109 fPdg[0] = 0;
110 fPdg[1] = 0;
111 fMum[0] = 0;
112 fMum[1] = 0;
113
114 fTagPi[0] = 0.;
115 fTagPi[1] = 0.;
116 fTagKa[0] = 0.;
117 fTagKa[1] = 0.;
118 fTagNid[0] = 0.;
119 fTagNid[1] = 0.;
120
121 fWgtAD0=fWgtAD0bar=fWgtBD0=fWgtBD0bar=fWgtCD0=fWgtCD0bar=fWgtDD0=fWgtDD0bar=0;
122}
123//----------------------------------------------------------------------------
124AliD0toKpi::~AliD0toKpi() {}
125//____________________________________________________________________________
126AliD0toKpi::AliD0toKpi( const AliD0toKpi& d0toKpi):TObject(d0toKpi) {
127 // dummy copy constructor
128}
129//----------------------------------------------------------------------------
ef0182f7 130void AliD0toKpi::ApplyPID(TString pidScheme) {
741f4d30 131 // Applies particle identification
3a9a3487 132
ef0182f7 133 if((!pidScheme.CompareTo("TOFparamPbPb") || !pidScheme.CompareTo("TOFparamPP")) && fPdg[0]==0) {
3a9a3487 134 printf("AliD0toKpi::ApplyPID :\n Warning: TOF parameterized PID can be used only for simulation!\n");
135 return;
136 }
137
ef0182f7 138 if(!pidScheme.CompareTo("TOFparamPbPb")) {
3a9a3487 139 // tagging of the positive track
140 if(TMath::Abs(fPdg[0])==211 || TMath::Abs(fPdg[0])==13
141 || TMath::Abs(fPdg[0])==11) { // pion,muon,electron
741f4d30 142 fTagPi[0] = LinearInterpolation(PChild(0),kPiBinsPbPb,kPiBinWidthPbPb,kPiTagPiPbPb);
3a9a3487 143 fTagNid[0] = 1.-fTagPi[0];
144 fTagKa[0] = 0.;
145 fTagPr[0] = 0.;
146 }
147 if(TMath::Abs(fPdg[0])==321) { // kaon
741f4d30 148 fTagKa[0] = LinearInterpolation(PChild(0),kKBinsPbPb,kKBinWidthPbPb,kKTagKPbPb);
149 fTagNid[0] = LinearInterpolation(PChild(0),kKBinsPbPb,kKBinWidthPbPb,kKTagNidPbPb);
3a9a3487 150 if((fTagNid[0]+fTagKa[0])>1.) fTagNid[0] = 1.-fTagKa[0];
151 fTagPi[0] = 1.-fTagNid[0]-fTagKa[0];
152 fTagPr[0] = 0.;
153 }
154 if(TMath::Abs(fPdg[0])==2212) { // proton
741f4d30 155 fTagPr[0] = LinearInterpolation(PChild(0),kPBinsPbPb,kPBinWidthPbPb,kPTagPPbPb);
156 fTagNid[0] = LinearInterpolation(PChild(0),kPBinsPbPb,kPBinWidthPbPb,kPTagNidPbPb);
3a9a3487 157 if((fTagNid[0]+fTagPr[0])>1.) fTagNid[0] = 1.-fTagPr[0];
158 fTagPi[0] = 1.-fTagNid[0]-fTagPr[0];
159 fTagKa[0] = 0.;
160 }
161 // tagging of the negative track
162 if(TMath::Abs(fPdg[1])==211 || TMath::Abs(fPdg[1])==13
163 || TMath::Abs(fPdg[1])==11) { // pion,muon,electron
741f4d30 164 fTagPi[1] = LinearInterpolation(PChild(1),kPiBinsPbPb,kPiBinWidthPbPb,kPiTagPiPbPb);
3a9a3487 165 fTagNid[1] = 1.-fTagPi[1];
166 fTagKa[1] = 0.;
167 fTagPr[1] = 0.;
168 }
169 if(TMath::Abs(fPdg[1])==321) { // kaon
741f4d30 170 fTagKa[1] = LinearInterpolation(PChild(1),kKBinsPbPb,kKBinWidthPbPb,kKTagKPbPb);
171 fTagNid[1] = LinearInterpolation(PChild(1),kKBinsPbPb,kKBinWidthPbPb,kKTagNidPbPb);
3a9a3487 172 if((fTagNid[1]+fTagKa[1])>1.) fTagNid[1] = 1.-fTagKa[1];
173 fTagPi[1] = 1.-fTagNid[1]-fTagKa[1];
174 fTagPr[1] = 0.;
175 }
176 if(TMath::Abs(fPdg[1])==2212) { // proton
741f4d30 177 fTagPr[1] = LinearInterpolation(PChild(1),kPBinsPbPb,kPBinWidthPbPb,kPTagPPbPb);
178 fTagNid[1] = LinearInterpolation(PChild(1),kPBinsPbPb,kPBinWidthPbPb,kPTagNidPbPb);
3a9a3487 179 if((fTagNid[1]+fTagPr[1])>1.) fTagNid[1] = 1.-fTagPr[1];
180 fTagPi[1] = 1.-fTagNid[1]-fTagPr[1];
181 fTagKa[1] = 0.;
182 }
183 }
184
185
ef0182f7 186 if(!pidScheme.CompareTo("TOFparamPP")) {
3a9a3487 187 // tagging of the positive track
188 if(TMath::Abs(fPdg[0])==211 || TMath::Abs(fPdg[0])==13
189 || TMath::Abs(fPdg[0])==11) { // pion,muon,electron
741f4d30 190 fTagPi[0] = LinearInterpolation(PChild(0),kPiBinsPP,kPiBinWidthPP,kPiTagPiPP);
3a9a3487 191 fTagNid[0] = 1.-fTagPi[0];
192 fTagKa[0] = 0.;
193 fTagPr[0] = 0.;
194 }
195 if(TMath::Abs(fPdg[0])==321) { // kaon
741f4d30 196 fTagKa[0] = LinearInterpolation(PChild(0),kKBinsPP,kKBinWidthPP,kKTagKPP);
197 fTagNid[0] = LinearInterpolation(PChild(0),kKBinsPP,kKBinWidthPP,kKTagNidPP);
3a9a3487 198 if((fTagNid[0]+fTagKa[0])>1.) fTagNid[0] = 1.-fTagKa[0];
199 fTagPi[0] = 1.-fTagNid[0]-fTagKa[0];
200 fTagPr[0] = 0.;
201 }
202 if(TMath::Abs(fPdg[0])==2212) { // proton
741f4d30 203 fTagPr[0] = LinearInterpolation(PChild(0),kPBinsPP,kPBinWidthPP,kPTagPPP);
204 fTagNid[0] = LinearInterpolation(PChild(0),kPBinsPP,kPBinWidthPP,kPTagNidPP);
3a9a3487 205 if((fTagNid[0]+fTagPr[0])>1.) fTagNid[0] = 1.-fTagPr[0];
206 fTagPi[0] = 1.-fTagNid[0]-fTagPr[0];
207 fTagKa[0] = 0.;
208 }
209 // tagging of the negative track
210 if(TMath::Abs(fPdg[1])==211 || TMath::Abs(fPdg[1])==13
211 || TMath::Abs(fPdg[1])==11) { // pion,muon,electron
741f4d30 212 fTagPi[1] = LinearInterpolation(PChild(1),kPiBinsPP,kPiBinWidthPP,kPiTagPiPP);
3a9a3487 213 fTagNid[1] = 1.-fTagPi[1];
214 fTagKa[1] = 0.;
215 fTagPr[1] = 0.;
216 }
217 if(TMath::Abs(fPdg[1])==321) { // kaon
741f4d30 218 fTagKa[1] = LinearInterpolation(PChild(1),kKBinsPP,kKBinWidthPP,kKTagKPP);
219 fTagNid[1] = LinearInterpolation(PChild(1),kKBinsPP,kKBinWidthPP,kKTagNidPP);
3a9a3487 220 if((fTagNid[1]+fTagKa[1])>1.) fTagNid[1] = 1.-fTagKa[1];
221 fTagPi[1] = 1.-fTagNid[1]-fTagKa[1];
222 fTagPr[1] = 0.;
223 }
224 if(TMath::Abs(fPdg[1])==2212) { // proton
741f4d30 225 fTagPr[1] = LinearInterpolation(PChild(1),kPBinsPP,kPBinWidthPP,kPTagPPP);
226 fTagNid[1] = LinearInterpolation(PChild(1),kPBinsPP,kPBinWidthPP,kPTagNidPP);
3a9a3487 227 if((fTagNid[1]+fTagPr[1])>1.) fTagNid[1] = 1.-fTagPr[1];
228 fTagPi[1] = 1.-fTagNid[1]-fTagPr[1];
229 fTagKa[1] = 0.;
230 }
231 }
232
233 return;
234}
235//----------------------------------------------------------------------------
236Double_t AliD0toKpi::ChildrenRelAngle() const {
237 // relative angle between K and pi
238
239 TVector3 mom0(fPx[0],fPy[0],fPz[0]);
240 TVector3 mom1(fPx[1],fPy[1],fPz[1]);
241
242 Double_t angle = mom0.Angle(mom1);
243
244 return angle;
245}
246//----------------------------------------------------------------------------
247void AliD0toKpi::ComputeWgts() {
248 // calculate the weights for PID
249
250
251 // assignement of the weights from PID
252 fWgtAD0 = fTagKa[1]*(fTagPi[0]+fTagNid[0]);
253 fWgtAD0bar = fTagKa[0]*(fTagPi[1]+fTagNid[1]);
254 fWgtBD0 = fTagPi[0]*fTagNid[1];
255 fWgtBD0bar = fTagPi[1]*fTagNid[0];
256 fWgtCD0 = fTagNid[0]*fTagNid[1];
257 fWgtCD0bar = fTagNid[0]*fTagNid[1];
258 fWgtDD0 = 1.-fWgtAD0-fWgtBD0-fWgtCD0;
259 fWgtDD0bar = 1.-fWgtAD0bar-fWgtBD0bar-fWgtCD0bar;
260
ef0182f7 261 /*
3a9a3487 262 cerr<<fWgtAD0<<" "<<fWgtAD0bar<<endl;
263 cerr<<fWgtBD0<<" "<<fWgtBD0bar<<endl;
264 cerr<<fWgtCD0<<" "<<fWgtCD0bar<<endl;
ef0182f7 265 cerr<<fWgtDD0<<" "<<fWgtDD0bar<<endl;
266 */
267 /*
3a9a3487 268 if(fWgtAD0<0.) cerr<<"AliD0toKpi::ComputeWgts() Negative weight!!!\n";
269 if(fWgtAD0bar<0.) cerr<<"AliD0toKpi::ComputeWgts() Negative weight!!!\n";
270 if(fWgtBD0<0.) cerr<<"AliD0toKpi::ComputeWgts() Negative weight!!!\n";
271 if(fWgtBD0bar<0.) cerr<<"AliD0toKpi::ComputeWgts() Negative weight!!!\n";
272 if(fWgtCD0<0.) cerr<<"AliD0toKpi::ComputeWgts() Negative weight!!!\n";
273 if(fWgtCD0bar<0.) cerr<<"AliD0toKpi::ComputeWgts() Negative weight!!!\n";
274 */
275
276 return;
277}
278//----------------------------------------------------------------------------
279void AliD0toKpi::CorrectWgt4BR(Double_t factor) {
280 // correct weights of background from charm
281
282 fWgtAD0 *= factor;
283 fWgtAD0bar *= factor;
284 fWgtBD0 *= factor;
285 fWgtBD0bar *= factor;
286 fWgtCD0 *= factor;
287 fWgtCD0bar *= factor;
288 fWgtDD0 *= factor;
289 fWgtDD0bar *= factor;
290
291 return;
292}
293//----------------------------------------------------------------------------
294Double_t AliD0toKpi::CosPointing() const {
295 // cosine of pointing angle in space
296
297 TVector3 mom(Px(),Py(),Pz());
298 TVector3 flight(fV2x-fV1x,fV2y-fV1y,fV2z-fV1z);
299
300 Double_t pta = mom.Angle(flight);
301
302 return TMath::Cos(pta);
303}
304//----------------------------------------------------------------------------
305Double_t AliD0toKpi::CosPointingXY() const {
306 // cosine of pointing angle in transverse plane
307
308 TVector3 momXY(Px(),Py(),0.);
309 TVector3 flightXY(fV2x-fV1x,fV2y-fV1y,0.);
310
311 Double_t ptaXY = momXY.Angle(flightXY);
312
313 return TMath::Cos(ptaXY);
314}
315//----------------------------------------------------------------------------
316void AliD0toKpi::CosThetaStar(Double_t &ctsD0,Double_t &ctsD0bar) const {
317 // cosine of decay angle in the D0 rest frame
318
319 Double_t pStar = TMath::Sqrt(TMath::Power(kMD0*kMD0-kMK*kMK-kMPi*kMPi,2.)-4.*kMK*kMK*kMPi*kMPi)/(2.*kMD0);
320
321 Double_t beta = P()/Energy();
322 Double_t gamma = Energy()/kMD0;
323
324 ctsD0 = (Ql(1)/gamma-beta*TMath::Sqrt(pStar*pStar+kMK*kMK))/pStar;
325 // if(ctsD0 > 1.) { cerr<<"AliD0toKpi::CosThetaStar: > 1 "<<ctsD0<<"!\n"; }
326 // if(ctsD0 < -1.) { cerr<<"AliD0toKpi::CosThetaStar: < -1 "<<ctsD0<<"!\n"; }
327
328 ctsD0bar = (Ql(0)/gamma-beta*TMath::Sqrt(pStar*pStar+kMK*kMK))/pStar;
329 // if(ctsD0bar > 1.) { cerr<<"AliD0toKpi::CosThetaStar: > 1 "<<ctsD0bar<<"!\n"; }
330 // if(ctsD0bar < -1.) { cerr<<"AliD0toKpi::CosThetaStar: < -1 "<<ctsD0bar<<"!\n";}
331
332 return;
333}
334//----------------------------------------------------------------------------
335Double_t AliD0toKpi::Eta() const {
336 // pseudorapidity of the D0
337
338 Double_t theta = TMath::Pi()/2.-TMath::ATan2(Pz(),Pt());
339 Double_t eta = -TMath::Log(TMath::Tan(theta/2.));
340 return eta;
341}
342//----------------------------------------------------------------------------
343Double_t AliD0toKpi::EtaChild(Int_t child) const {
344 // pseudorapidity of the decay tracks
345
346 Double_t theta = TMath::Pi()/2.-TMath::ATan2(fPz[child],PtChild(child));
347 Double_t eta = -TMath::Log(TMath::Tan(theta/2.));
348 return eta;
349}
350//----------------------------------------------------------------------------
351void AliD0toKpi::GetWgts(Double_t &WgtD0,Double_t &WgtD0bar,TString sample)
352 const {
353 // returns the weights for pid
354
ef0182f7 355 if(!sample.CompareTo("A")) { WgtD0 = fWgtAD0; WgtD0bar = fWgtAD0bar; }
356 if(!sample.CompareTo("B")) { WgtD0 = fWgtBD0; WgtD0bar = fWgtBD0bar; }
357 if(!sample.CompareTo("C")) { WgtD0 = fWgtCD0; WgtD0bar = fWgtCD0bar; }
358 if(!sample.CompareTo("D")) { WgtD0 = fWgtDD0; WgtD0bar = fWgtDD0bar; }
359 if(!sample.CompareTo("ABCD")) {
3a9a3487 360 WgtD0 = fWgtAD0+fWgtBD0+fWgtCD0+fWgtDD0;
361 WgtD0bar = fWgtAD0bar+fWgtBD0bar+fWgtCD0bar+fWgtDD0bar;
362 }
ef0182f7 363 if(!sample.CompareTo("ABC")) {
3a9a3487 364 WgtD0 = fWgtAD0+fWgtBD0+fWgtCD0;
365 WgtD0bar = fWgtAD0bar+fWgtBD0bar+fWgtCD0bar;
366 }
ef0182f7 367 if(!sample.CompareTo("BC")) {
3a9a3487 368 WgtD0 = fWgtBD0+fWgtCD0;
369 WgtD0bar = fWgtBD0bar+fWgtCD0bar;
370 }
371
3a9a3487 372 return;
373}
374//----------------------------------------------------------------------------
ef0182f7 375Double_t AliD0toKpi::ImpPar() const {
376 // D0 impact parameter in the bending plane
377
378 Double_t k = -(fV2x-fV1x)*Px()-(fV2y-fV1y)*Py();
379 k /= Pt()*Pt();
380 Double_t dx = fV2x-fV1x+k*Px();
381 Double_t dy = fV2y-fV1y+k*Py();
382 Double_t absDD = TMath::Sqrt(dx*dx+dy*dy);
383 TVector3 mom(Px(),Py(),Pz());
384 TVector3 flight(fV2x-fV1x,fV2y-fV1y,fV2z-fV1z);
385 TVector3 cross = mom.Cross(flight);
386 return (cross.Z()>0. ? absDD : -absDD);
387}
388//----------------------------------------------------------------------------
3a9a3487 389void AliD0toKpi::InvMass(Double_t &mD0,Double_t &mD0bar) const {
390 // invariant mass as D0 and as D0bar
391
392 Double_t energy[2];
393
394 // D0 -> K- Pi+
395 energy[1] = TMath::Sqrt(kMK*kMK+PChild(1)*PChild(1));
396 energy[0] = TMath::Sqrt(kMPi*kMPi+PChild(0)*PChild(0));
397
398 mD0 = TMath::Sqrt((energy[0]+energy[1])*(energy[0]+energy[1])-P()*P());
399
400
401 // D0bar -> K+ Pi-
402 energy[0] = TMath::Sqrt(kMK*kMK+PChild(0)*PChild(0));
403 energy[1] = TMath::Sqrt(kMPi*kMPi+PChild(1)*PChild(1));
404
405 mD0bar = TMath::Sqrt((energy[0]+energy[1])*(energy[0]+energy[1])-P()*P());
406
407 return;
408
409}
410//----------------------------------------------------------------------------
411Double_t AliD0toKpi::Ql(Int_t child) const {
412 // longitudinal momentum of decay tracks w.r.t. to D0 momentum
413
414 Double_t qL;
415 TVector3 mom(fPx[child],fPy[child],fPz[child]);
416 TVector3 momD(Px(),Py(),Pz());
417
418 qL = mom.Dot(momD)/momD.Mag();
419
420 return qL ;
421}
422//----------------------------------------------------------------------------
423Double_t AliD0toKpi::Qt() const {
424 // transverse momentum of decay tracks w.r.t. to D0 momentum
425
426 TVector3 mom0(fPx[0],fPy[0],fPz[0]);
427 TVector3 momD(Px(),Py(),Pz());
428
429 return mom0.Perp(momD);
430}
431//----------------------------------------------------------------------------
432Bool_t AliD0toKpi::Select(const Double_t* cuts,Int_t& okD0,Int_t& okD0bar)
433 const {
434//
435// This function compares the D0 with a set of cuts:
436//
437// cuts[0] = inv. mass half width [GeV]
438// cuts[1] = dca [micron]
439// cuts[2] = cosThetaStar
440// cuts[3] = pTK [GeV/c]
441// cuts[4] = pTPi [GeV/c]
442// cuts[5] = d0K [micron] upper limit!
443// cuts[6] = d0Pi [micron] upper limit!
444// cuts[7] = d0d0 [micron^2]
445// cuts[8] = cosThetaPoint
446//
447// If the D0/D0bar doesn't pass the cuts it sets the weights to 0
448// If neither D0 nor D0bar pass the cuts return kFALSE
449//
450 Double_t mD0,mD0bar,ctsD0,ctsD0bar;
451 okD0=1; okD0bar=1;
452
453 if(PtChild(1) < cuts[3] || PtChild(0) < cuts[4]) okD0 = 0;
454 if(PtChild(0) < cuts[3] || PtChild(1) < cuts[4]) okD0bar = 0;
455 if(!okD0 && !okD0bar) return kFALSE;
456
457 if(TMath::Abs(Getd0Child(1)) > cuts[5] ||
458 TMath::Abs(Getd0Child(0)) > cuts[6]) okD0 = 0;
459 if(TMath::Abs(Getd0Child(0)) > cuts[6] ||
460 TMath::Abs(Getd0Child(1)) > cuts[5]) okD0bar = 0;
461 if(!okD0 && !okD0bar) return kFALSE;
462
463 if(GetDCA() > cuts[1]) { okD0 = okD0bar = 0; return kFALSE; }
464
465 InvMass(mD0,mD0bar);
466 if(TMath::Abs(mD0-kMD0) > cuts[0]) okD0 = 0;
467 if(TMath::Abs(mD0bar-kMD0) > cuts[0]) okD0bar = 0;
468 if(!okD0 && !okD0bar) return kFALSE;
469
470 CosThetaStar(ctsD0,ctsD0bar);
471 if(TMath::Abs(ctsD0) > cuts[2]) okD0 = 0;
472 if(TMath::Abs(ctsD0bar) > cuts[2]) okD0bar = 0;
473 if(!okD0 && !okD0bar) return kFALSE;
474
475 if(ProdImpParams() > cuts[7]) { okD0 = okD0bar = 0; return kFALSE; }
476
477 if(CosPointing() < cuts[8]) { okD0 = okD0bar = 0; return kFALSE; }
478
479 return kTRUE;
480}
481//-----------------------------------------------------------------------------
482void AliD0toKpi::SetPIDresponse(Double_t resp0[5],Double_t resp1[5]) {
483 // Set combined PID detector response probabilities
484
485 fPIDrespEl[0] = resp0[0];
486 fPIDrespEl[1] = resp1[0];
487 fPIDrespMu[0] = resp0[1];
488 fPIDrespMu[1] = resp1[1];
489 fPIDrespPi[0] = resp0[2];
490 fPIDrespPi[1] = resp1[2];
491 fPIDrespKa[0] = resp0[3];
492 fPIDrespKa[1] = resp1[3];
493 fPIDrespPr[0] = resp0[4];
494 fPIDrespPr[1] = resp1[4];
495
496 return;
497}
3a9a3487 498//----------------------------------------------------------------------------
499Double_t AliD0toKpi::LinearInterpolation(Double_t p,Int_t nBins,Double_t Bin,
500 const Double_t *values) const {
501 // a linear interpolation method
502
503 Double_t value=0;
504 Double_t slope;
505
506 if(p<0.5*Bin) {
507 value = values[0];
508 } else if(p>=(nBins-0.5)*Bin) {
509 slope = (2*values[nBins-1]-values[nBins-2]-values[nBins-3])/Bin/2;
510 value = values[nBins-2]+slope*(p-Bin*(nBins-1.5));
511 } else {
512 for(Int_t i=0; i<nBins; i++) {
513 if(p<(i+0.5)*Bin) {
514 slope = (values[i]-values[i-1])/Bin;
515 value = values[i-1]+slope*(p-Bin*(i-0.5));
516 break;
517 }
518 }
519 }
520
521 if(value<0.) value=0.;
522 if(value>1.) value=1.;
523
524 return value;
525}
526//----------------------------------------------------------------------------
527
528
529
530
531
532
3a9a3487 533
534
535