]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG1/TRD/info/AliTRDv0Info.cxx
add suggestions by Markus Heide
[u/mrichter/AliRoot.git] / PWG1 / TRD / info / AliTRDv0Info.cxx
CommitLineData
1ee39b3a 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/* $Id: AliTRDv0Info.cxx 27496 2008-07-22 08:35:45Z cblume $ */
17
18////////////////////////////////////////////////////////////////////////////
19// //
20// Reconstruction QA //
21// //
22// Gathers all information necessary for reference data selection about //
23// the track and (in case) its corresponding V0. //
24// Carries out the selection of electrons (from gamma conversions), //
25// pions (from K0s decays) and protons (from Lambda and Anti-Lambda //
26// decays) by cuts specific for the respective decay and particle //
27// species. //
28// (M.Heide, 2009/10/06) //
29// //
30// Authors: //
31// Alex Bercuci <A.Bercuci@gsi.de> //
32// Alex Wilk <wilka@uni-muenster.de> //
33// Markus Heide <mheide@uni-muenster.de> //
34// //
35////////////////////////////////////////////////////////////////////////////
1ee39b3a 36#include "TMath.h"
37
38#include "AliESDtrack.h"
39#include "AliESDv0.h"
1ee39b3a 40#include "AliLog.h"
41
42#include "AliTRDv0Info.h"
43#include "AliTRDtrackInfo.h"
44#include "AliTRDtrackInfo.h"
45
46ClassImp(AliTRDv0Info)
47
48//_________________________________________________
49AliTRDv0Info::AliTRDv0Info()
50 : TObject()
3d19c1b0 51 ,fQuality(0)
1ee39b3a 52 ,fDCA(10)
53 ,fPointingAngle(10)
54 ,fOpenAngle(10)
55 ,fPsiPair(99)
56 ,fMagField(0)
57 ,fRadius(0)
1ee39b3a 58 ,fV0Momentum(0)
3d19c1b0 59 ,fTrackP(NULL)
60 ,fTrackN(NULL)
1ee39b3a 61 ,fNindex(0)
62 ,fPindex(0)
63{
64 //
65 // Default constructor
66 //
67
68 memset(fPplus, 0, 2*kNlayer*sizeof(Float_t));
69 memset(fPminus, 0, 2*kNlayer*sizeof(Float_t));
70 memset(fDetPID, 0, 2*kNDaughters*kNDetectors*AliPID::kSPECIES*sizeof(Float_t));
8bc8ea55 71 memset(fComPID, 0, 2*kNDaughters*AliPID::kSPECIES*sizeof(Float_t));
1ee39b3a 72 memset(fInvMass, 0, kNMomBins*kNDecays*sizeof(Double_t));
73
74 /////////////////////////////////////////////////////////////////////////////
75 //Set Cut values: First specify decay in brackets, then the actual cut value!
76 /////////////////////////////////////////////////////////////////////////////
77
78 //Upper limit for distance of closest approach of two daughter tracks :
8bc8ea55 79 fUpDCA[kGamma] = 1000.;
80 fUpDCA[kK0s] = 0.08;
81 fUpDCA[kLambda] = 0.2;
82 fUpDCA[kAntiLambda] = 0.2;
1ee39b3a 83
84 //Upper limit for pointing angle (= angle between between vector from primary to secondary vertex and reconstructed momentum of V0 mother particle) :
85 fUpPointingAngle[kGamma] = 0.03;
86 fUpPointingAngle[kK0s] = 0.03;
8bc8ea55 87 fUpPointingAngle[kLambda] = 0.04;
88 fUpPointingAngle[kAntiLambda] = 0.04;
1ee39b3a 89
90 //Upper limit for invariant mass of V0 mother :
8bc8ea55 91 fUpInvMass[kGamma][0] = 0.05;// second pair of brackets is for momentum bin: 0: below mother momentm of 2.5 GeV
1ee39b3a 92 fUpInvMass[kGamma][1] = 0.07;//1: above 2.5 GeV
8bc8ea55 93 fUpInvMass[kK0s][0] = fUpInvMass[kK0s][1] = 0.50265;
94 fUpInvMass[kLambda][0] = fUpInvMass[kLambda][1] = 1.1207;
95 fUpInvMass[kAntiLambda][0] = fUpInvMass[kAntiLambda][1] = 1.1207;
1ee39b3a 96
97 //Lower limit for invariant mass of V0 mother :
98 fDownInvMass[kGamma] = -1.;
8bc8ea55 99 fDownInvMass[kK0s] = 0.49265;
100 fDownInvMass[kLambda] = 1.107;
101 fDownInvMass[kAntiLambda] = 1.107;
1ee39b3a 102
103 //Lower limit for distance from secondary vertex to primary vertex in x-y plane :
8bc8ea55 104 fDownRadius[kGamma] = 6.;
1ee39b3a 105 fDownRadius[kK0s] = 0.;
8bc8ea55 106 fDownRadius[kLambda] = 0.;
107 fDownRadius[kAntiLambda] = 0.;
1ee39b3a 108
109 //Upper limit for distance from secondary vertex to primary vertex in x-y plane :
110 fUpRadius[kGamma] = 1000.;
8bc8ea55 111 fUpRadius[kK0s] = 20.;
1ee39b3a 112 fUpRadius[kLambda] = 1000.;
113 fUpRadius[kAntiLambda] = 1000.;
114
115 //Upper limit for opening angle between two daughter tracks (characteristically near zero for conversions) :
116 fUpOpenAngle[kGamma] = 0.1;
117 fUpOpenAngle[kK0s] = 3.15;
118 fUpOpenAngle[kLambda] = 3.15;
119 fUpOpenAngle[kAntiLambda] = 3.15;
120
121 //Upper limit for angle between daughter momentum plane and plane perpendicular to magnetic field (characteristically around zero for conversions) :
8bc8ea55 122 fUpPsiPair[kGamma] = 0.05;
1ee39b3a 123 fUpPsiPair[kK0s] = 1.6;
124 fUpPsiPair[kLambda] = 1.6;
125 fUpPsiPair[kAntiLambda] = 1.6;
126
127 //Lower limit for likelihood value of TPC PID :
128 fDownTPCPIDneg[AliPID::kElectron] = 0.21;
129 fDownTPCPIDpos[AliPID::kElectron] = 0.21;
130
131 fDownTPCPIDneg[AliPID::kMuon] = 0.21;
132 fDownTPCPIDpos[AliPID::kMuon] = 0.21;
133
134 fDownTPCPIDneg[AliPID::kPion] = 0.21;
135 fDownTPCPIDpos[AliPID::kPion] = 0.21;
136
137 fDownTPCPIDneg[AliPID::kKaon] = 0.21;
138 fDownTPCPIDpos[AliPID::kKaon] = 0.21;
139
140 fDownTPCPIDneg[AliPID::kProton] = 0.21;
141 fDownTPCPIDpos[AliPID::kProton] = 0.21;
8bc8ea55 142
143 //Lower limit for likelihood value of combined PID :
144 fDownComPIDneg[AliPID::kElectron] = 0.21;
145 fDownComPIDpos[AliPID::kElectron] = 0.21;
146
147 fDownComPIDneg[AliPID::kMuon] = 0.21;
148 fDownComPIDpos[AliPID::kMuon] = 0.21;
149
150 fDownComPIDneg[AliPID::kPion] = 0.9;
151 fDownComPIDpos[AliPID::kPion] = 0.9;
152
153 fDownComPIDneg[AliPID::kKaon] = 0.21;
154 fDownComPIDpos[AliPID::kKaon] = 0.21;
155
156 fDownComPIDneg[AliPID::kProton] = 0.9;
157 fDownComPIDpos[AliPID::kProton] = 0.9;
158
159 //Lower limit for likelihood value of combined PID for daughter track which doesn't enter reference data (here: pion daughters from Lambda decays:
160 fDownComPIDnegPart[AliPID::kElectron] = 0.05;
161 fDownComPIDposPart[AliPID::kElectron] = 0.05;
162
163 fDownComPIDnegPart[AliPID::kMuon] = 0.05;
164 fDownComPIDposPart[AliPID::kMuon] = 0.05;
165
166 fDownComPIDnegPart[AliPID::kPion] = 0.05;
167 fDownComPIDposPart[AliPID::kPion] = 0.05;
168
169 fDownComPIDnegPart[AliPID::kKaon] = 0.05;
170 fDownComPIDposPart[AliPID::kKaon] = 0.05;
171
172 fDownComPIDnegPart[AliPID::kProton] = 0.05;
173 fDownComPIDposPart[AliPID::kProton] = 0.05;
3d19c1b0 174}
175
176//_________________________________________________
177AliTRDv0Info::AliTRDv0Info(const AliTRDv0Info &ref)
178 : TObject()
179 ,fQuality(ref.fQuality)
180 ,fDCA(ref.fDCA)
181 ,fPointingAngle(ref.fPointingAngle)
182 ,fOpenAngle(ref.fOpenAngle)
183 ,fPsiPair(ref.fPsiPair)
184 ,fMagField(ref.fMagField)
185 ,fRadius(ref.fMagField)
186 ,fV0Momentum(ref.fV0Momentum)
187 ,fTrackP(ref.fTrackP)
188 ,fTrackN(ref.fTrackN)
189 ,fNindex(ref.fNindex)
190 ,fPindex(ref.fPindex)
191{
192 //
193 // Copy constructor
194 //
8bc8ea55 195
3d19c1b0 196 memcpy(fPplus, ref.fPplus, 2*kNlayer*sizeof(Float_t));
197 memcpy(fPminus, ref.fPminus, 2*kNlayer*sizeof(Float_t));
198 memcpy(fDetPID, ref.fDetPID, 2*kNDaughters*kNDetectors*AliPID::kSPECIES*sizeof(Float_t));
199 memcpy(fComPID, ref.fComPID, 2*kNDaughters*AliPID::kSPECIES*sizeof(Float_t));
200 memcpy(fInvMass, ref.fInvMass, kNMomBins*kNDecays*sizeof(Double_t));
1ee39b3a 201
3d19c1b0 202 //Upper limit for distance of closest approach of two daughter tracks :
203 memcpy(fUpDCA, ref.fUpDCA, kNDecays*sizeof(Float_t));
204 memcpy(fUpPointingAngle, ref.fUpPointingAngle, kNDecays*sizeof(Float_t));
205 memcpy(fUpOpenAngle, ref.fUpOpenAngle, kNDecays*sizeof(Float_t));
206 memcpy(fDownOpenAngle, ref.fDownOpenAngle, kNDecays*sizeof(Float_t));
207 memcpy(fUpPsiPair, ref.fUpPsiPair, kNDecays*sizeof(Float_t));
208 memcpy(fDownPsiPair, ref.fDownPsiPair, kNDecays*sizeof(Float_t));
209 memcpy(fUpInvMass, ref.fUpInvMass, kNDecays*kNMomBins*sizeof(Double_t));
210 memcpy(fDownInvMass, ref.fDownInvMass, kNDecays*sizeof(Double_t));
211 memcpy(fUpRadius, ref.fUpRadius, kNDecays*sizeof(Float_t));
212 memcpy(fDownRadius, ref.fDownRadius, kNDecays*sizeof(Float_t));
213 memcpy(fDownTPCPIDneg, ref.fDownTPCPIDneg, AliPID::kSPECIES*sizeof(Float_t));
214 memcpy(fDownTPCPIDpos, ref.fDownTPCPIDpos, AliPID::kSPECIES*sizeof(Float_t));
215 memcpy(fDownComPIDneg, ref.fDownComPIDneg, AliPID::kSPECIES*sizeof(Float_t));
216 memcpy(fDownComPIDpos, ref.fDownComPIDpos, AliPID::kSPECIES*sizeof(Float_t));
217 memcpy(fDownComPIDnegPart, ref.fDownComPIDnegPart, AliPID::kSPECIES*sizeof(Float_t));
218 memcpy(fDownComPIDposPart, ref.fDownComPIDposPart, AliPID::kSPECIES*sizeof(Float_t));
1ee39b3a 219}
220
221//_________________________________________________
3d19c1b0 222void AliTRDv0Info::SetV0Info(AliESDv0 *esdv0)
1ee39b3a 223{//Gets values of ESDv0 and daughter track properties
224 //See header file for description of variables
225
1ee39b3a 226 fQuality = Quality(esdv0);//Attributes an Int_t to the V0 due to quality cuts (= 1 if V0 is accepted, other integers depending on cut which excludes the vertex)
227
228 fRadius = Radius(esdv0);//distance from secondary vertex to primary vertex in x-y plane
229
230 fDCA = esdv0->GetDcaV0Daughters();//distance of closest approach of two daughter tracks
231
232 fPointingAngle = TMath::ACos(esdv0->GetV0CosineOfPointingAngle());// pointing angle (= angle between between vector from primary to secondary vertex and reconstructed momentum of V0 mother particle)
233
234 fOpenAngle = OpenAngle(esdv0);//Opening angle between two daughter tracks
235
236 fPsiPair = PsiPair(esdv0);//Angle between daughter momentum plane and plane perpendicular to magnetic field
237
238 fV0Momentum = V0Momentum(esdv0);//Reconstructed momentum of the mother particle
239
3d19c1b0 240 //4 decay types : conversions, K0s, Lambda, Anti-Lambda
1ee39b3a 241 //five particle types: electrons, muons, pions, kaons, protons (muons and kaons not involved)
3d19c1b0 242 for(Int_t idecay(0), part1(-1), part2(-1); idecay < kNDecays; idecay++){
243 if(idecay == kLambda){ //protons and pions from Lambda
244 part1 = AliPID::kProton;
245 part2 = AliPID::kPion;
246 } else if(idecay == kAntiLambda) { //antiprotons and pions from Anti-Lambda
247 part1 = AliPID::kPion;
248 part2 = AliPID::kProton;
249 } else if(idecay == kK0s) {//pions from K0s
250 part1 = part2 = AliPID::kPion;
251 } else if(idecay == kGamma) {//electrons from conversions
252 part1 = part2 = AliPID::kElectron;
253 }
254 fInvMass[idecay] = InvMass(part1, part2, esdv0);//Calculate invariant mass for all of our four supposed decays
1ee39b3a 255 }
3d19c1b0 256 //Gets all likelihood values from TPC, TOF and ITS PID for the fDetPID[kNDaughters][kNDetectors][AliPID::kSPECIES] array
257 GetDetectorPID();
258 //Bayesian combination of likelihoods from TPC and TOF
259 CombinePID();
1ee39b3a 260}
261//_________________________________________________
262Float_t AliTRDv0Info::V0Momentum(AliESDv0 *esdv0) const
263{
264 //
265 // Reconstructed momentum of V0 mother particle
266 //
267
268 Double_t mn[3] = {0,0,0};
269 Double_t mp[3] = {0,0,0};
270
271
272 esdv0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter;
273 esdv0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter;
274
275
276 return TMath::Sqrt((mn[0]+mp[0])*(mn[0]+mp[0]) + (mn[1]+mp[1])*(mn[1]+mp[1])+(mn[2]+mp[2])*(mn[2]+mp[2]));
277}
278
279//_________________________________________________
280Double_t AliTRDv0Info::InvMass(Int_t part1, Int_t part2, AliESDv0 *esdv0) const
281{
282 //
283 // Invariant mass of reconstructed V0 mother
284 //
285
286 const Double_t kpmass[5] = {AliPID::ParticleMass(AliPID::kElectron),AliPID::ParticleMass(AliPID::kMuon),AliPID::ParticleMass(AliPID::kPion),AliPID::ParticleMass(AliPID::kKaon),AliPID::ParticleMass(AliPID::kProton)};
287 //Masses of electrons, muons, pions, kaons and protons, as implemented in ROOT
288
289
290 Double_t mn[3] = {0,0,0};
291 Double_t mp[3] = {0,0,0};
292
293 esdv0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter;
294 esdv0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter;
295
296 Double_t mass1 = kpmass[part1];//sets supposed rest masses for both daughters
297 Double_t mass2 = kpmass[part2];
298
299 //Calculate daughters' energies :
300 Double_t e1 = TMath::Sqrt(mass1*mass1+
301 mp[0]*mp[0]+
302 mp[1]*mp[1]+
303 mp[2]*mp[2]);
304 Double_t e2 = TMath::Sqrt(mass2*mass2+
305 mn[0]*mn[0]+
306 mn[1]*mn[1]+
307 mn[2]*mn[2]);
308
309 //Sum of daughter momenta :
310 Double_t momsum =
311 (mn[0]+mp[0])*(mn[0]+mp[0])+
312 (mn[1]+mp[1])*(mn[1]+mp[1])+
313 (mn[2]+mp[2])*(mn[2]+mp[2]);
314
315 //invariant mass :
316 Double_t mInv = TMath::Sqrt((e1+e2)*(e1+e2)-momsum);
317
318 return mInv;
319
320}
321//_________________________________________________
322Float_t AliTRDv0Info::OpenAngle(AliESDv0 *esdv0)
323{//Opening angle between two daughter tracks
324 Double_t mn[3] = {0,0,0};
325 Double_t mp[3] = {0,0,0};
326
327
328 esdv0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter;
329 esdv0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter;
330
331
332 fOpenAngle = TMath::ACos((mp[0]*mn[0] + mp[1]*mn[1] + mp[2]*mn[2])/(TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1] + mp[2]*mp[2])*TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1] + mn[2]*mn[2])));
333
334 return fOpenAngle;
335}
336
337//_________________________________________________
338Float_t AliTRDv0Info::PsiPair(AliESDv0 *esdv0)
339{//Angle between daughter momentum plane and plane perpendicular to magnetic field
340 Double_t x, y, z;
341 esdv0->GetXYZ(x,y,z);//Reconstructed coordinates of V0; to be replaced by Markus Rammler's method in case of conversions!
342
343 Double_t mn[3] = {0,0,0};
344 Double_t mp[3] = {0,0,0};
345
346
347 esdv0->GetNPxPyPz(mn[0],mn[1],mn[2]);//reconstructed cartesian momentum components of negative daughter;
348 esdv0->GetPPxPyPz(mp[0],mp[1],mp[2]);//reconstructed cartesian momentum components of positive daughter;
349
350
351 Double_t deltat = 1.;
352 deltat = TMath::ATan(mp[2]/(TMath::Sqrt(mp[0]*mp[0] + mp[1]*mp[1])+1.e-13)) - TMath::ATan(mn[2]/(TMath::Sqrt(mn[0]*mn[0] + mn[1]*mn[1])+1.e-13));//difference of angles of the two daughter tracks with z-axis
353
354 Double_t radiussum = TMath::Sqrt(x*x + y*y) + 50;//radius to which tracks shall be propagated
355
356 Double_t momPosProp[3];
357 Double_t momNegProp[3];
358
359 AliExternalTrackParam nt(*fTrackN), pt(*fTrackP);
360
361 fPsiPair = 4.;
362
363 if(nt.PropagateTo(radiussum,fMagField) == 0)//propagate tracks to the outside
364 fPsiPair = -5.;
365 if(pt.PropagateTo(radiussum,fMagField) == 0)
366 fPsiPair = -5.;
367 pt.GetPxPyPz(momPosProp);//Get momentum vectors of tracks after propagation
368 nt.GetPxPyPz(momNegProp);
369
370 Double_t pEle =
371 TMath::Sqrt(momNegProp[0]*momNegProp[0]+momNegProp[1]*momNegProp[1]+momNegProp[2]*momNegProp[2]);//absolute momentum value of negative daughter
372 Double_t pPos =
373 TMath::Sqrt(momPosProp[0]*momPosProp[0]+momPosProp[1]*momPosProp[1]+momPosProp[2]*momPosProp[2]);//absolute momentum value of positive daughter
374
375 Double_t scalarproduct =
376 momPosProp[0]*momNegProp[0]+momPosProp[1]*momNegProp[1]+momPosProp[2]*momNegProp[2];//scalar product of propagated positive and negative daughters' momenta
377
378 Double_t chipair = TMath::ACos(scalarproduct/(pEle*pPos));//Angle between propagated daughter tracks
379
380 fPsiPair = TMath::Abs(TMath::ASin(deltat/chipair));
381
382 return fPsiPair;
383
384}
385
386//_________________________________________________
b9ddd472 387Int_t AliTRDv0Info::HasTrack(AliTRDtrackInfo * const track)
3d19c1b0 388{
389//Checks if track is a secondary vertex daughter (due to V0 finder)
1ee39b3a 390
3d19c1b0 391 Int_t trackID(track->GetTrackId());//index of the track
b9ddd472 392 return HasTrack(trackID);
393}
1ee39b3a 394
b9ddd472 395//_________________________________________________
396Int_t AliTRDv0Info::HasTrack(Int_t trackID)
397{
1ee39b3a 398 //comparing index of track with indices of pos./neg. V0 daughter :
b9ddd472 399 if(fNindex==trackID) return -1;
400 else if(fPindex==trackID) return 1;
401 else return 0;
1ee39b3a 402}
3d19c1b0 403
1ee39b3a 404//_________________________________________________
405void AliTRDv0Info::GetDetectorPID()
406{//PID likelihoods from TPC, TOF, and ITS, for all particle species
407
408 fTrackN->GetTPCpid(fDetPID[kNeg][kTPC]);
409 fTrackP->GetTPCpid(fDetPID[kPos][kTPC]);
410 fTrackN->GetTOFpid(fDetPID[kNeg][kTOF]);
411 fTrackP->GetTOFpid(fDetPID[kPos][kTOF]);
412 fTrackN->GetITSpid(fDetPID[kNeg][kITS]);
413 fTrackP->GetITSpid(fDetPID[kPos][kITS]);
414
8bc8ea55 415 Long_t statusN = fTrackN->GetStatus();
416 Long_t statusP = fTrackP->GetStatus();
417
418 if(!(statusN & AliESDtrack::kTPCpid)){
419 for(Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++){
420 fDetPID[kNeg][kTPC][iPart] = 0.2;
421 }
422 }
423 if(!(statusN & AliESDtrack::kTOFpid)){
424 for(Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++){
425 fDetPID[kNeg][kTOF][iPart] = 0.2;
426 }
427
428 }
429 if(!(statusN & AliESDtrack::kITSpid)){
430 for(Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++){
431 fDetPID[kNeg][kITS][iPart] = 0.2;
432 }
433 }
434 if(!(statusP & AliESDtrack::kTPCpid)){
435 for(Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++){
436 fDetPID[kPos][kTPC][iPart] = 0.2;
437 }
438 }
439 if(!(statusP & AliESDtrack::kTOFpid)){
440 for(Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++){
441 fDetPID[kPos][kTOF][iPart] = 0.2;
442 }
443
444 }
445 if(!(statusP & AliESDtrack::kITSpid)){
446 for(Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++){
447 fDetPID[kPos][kITS][iPart] = 0.2;
448 }
449 }
1ee39b3a 450
8bc8ea55 451}
452//____________________________________________________________________________________
453void AliTRDv0Info::CombinePID()
454{
455 Double_t partrat[AliPID::kSPECIES] = {0.208, 0.010, 0.662, 0.019, 0.101};
456
457 for(Int_t iSign = 0; iSign < kNDaughters; iSign++)
458 {
459 for(Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++)
460 {
461 fComPID[iSign][iPart] = (partrat[iPart]*fDetPID[iSign][kTPC][iPart]*fDetPID[iSign][kTOF][iPart])/((partrat[0]*fDetPID[iSign][kTPC][0]*fDetPID[iSign][kTOF][0])+(partrat[1]*fDetPID[iSign][kTPC][1]*fDetPID[iSign][kTOF][1])+(partrat[2]*fDetPID[iSign][kTPC][2]*fDetPID[iSign][kTOF][2])+(partrat[3]*fDetPID[iSign][kTPC][3]*fDetPID[iSign][kTOF][3])+(partrat[4]*fDetPID[iSign][kTPC][4]*fDetPID[iSign][kTOF][4]));
462
463 }
464 }
465}
1ee39b3a 466//_________________________________________________
467Float_t AliTRDv0Info::Radius(AliESDv0 *esdv0)
468{//distance from secondary vertex to primary vertex in x-y plane
469 Double_t x, y, z;
470 esdv0->GetXYZ(x,y,z); //Reconstructed coordinates of V0; to be replaced by Markus Rammler's method in case of conversions!
471 fRadius = TMath::Sqrt(x*x + y*y);
472 return fRadius;
473
474}
475
476//_________________________________________________
477Int_t AliTRDv0Info::Quality(AliESDv0 *const esdv0)
478{
479 //
480 // Checking track and V0 quality status in order to exclude vertices based on poor information
481 //
482
483 Float_t nClsN;
484 nClsN = fTrackN->GetTPCNcls();//number of found clusters in TPC for negative track
485 Float_t nClsFN;
486 nClsFN = fTrackN->GetTPCNclsF();//number of findable clusters in TPC for negative track
487 Float_t nClsP;
488 nClsP = fTrackP->GetTPCNcls();//number of found clusters in TPC for positive track
489 Float_t nClsFP;
490 nClsFP = fTrackP->GetTPCNclsF();//number of findable clusters in TPC for positive track
491
492 fQuality = 0;
493
494
495 Float_t clsRatioN;
496 Float_t clsRatioP;
497
e148d6e6 498 if((nClsFN == 0) || (nClsFP == 0)) return -2;
1ee39b3a 499
500 clsRatioN = nClsN/nClsFN; //ratios of found to findable clusters in TPC
501 clsRatioP = nClsP/nClsFP;
502
503 if (!(esdv0->GetOnFlyStatus()))//accept only vertices from online V0 finder
e148d6e6 504 return -3;
1ee39b3a 505 if (!((fTrackP->GetStatus() &
506 AliESDtrack::kTPCrefit)))//accept only vertices in which both tracks have TPC refit
e148d6e6 507 return -4;
1ee39b3a 508 if (!((fTrackN->GetStatus() &
509 AliESDtrack::kTPCrefit)))
e148d6e6 510 return -5;
1ee39b3a 511 if (fTrackP->GetKinkIndex(0)>0 ||
512 fTrackN->GetKinkIndex(0)>0 )//exclude tracks with kinks
e148d6e6 513 return -6;
1ee39b3a 514 if((clsRatioN < 0.6)||(clsRatioP < 0.6))//exclude tracks with low ratio of found to findable TPC clusters
e148d6e6 515 return -7;
1ee39b3a 516 fQuality = 1;
517 return fQuality;
518}
519//_________________________________________________
3d19c1b0 520Int_t AliTRDv0Info::GetPID(Int_t ipart, AliTRDtrackInfo *track)
521{
522// Decides if track is accepted for one of the reference data samples
1ee39b3a 523
3d19c1b0 524 if(!(track)) {
525 AliError("No track info");
b9ddd472 526 return -1;
3d19c1b0 527 }
528 if(!HasTrack(track)){
529 AliDebug(2, "Track not attached to v0.");
b9ddd472 530 return -1;
3d19c1b0 531 }
3d19c1b0 532
533 //translate ipart to decay (Anti-Lambda will be treated separately)
1ee39b3a 534 Int_t iDecay = -1;
3d19c1b0 535 switch(ipart){
536 case AliPID::kElectron: iDecay = kGamma; break;
537 case AliPID::kPion: iDecay = kK0s; break;
538 case AliPID::kProton: iDecay = kLambda; break;
539 default:
540 AliWarning(Form("Hypothesis \"ipart=%d\" not handled", ipart));
b9ddd472 541 return -1;
3d19c1b0 542 }
1ee39b3a 543
3d19c1b0 544 //... it fulfills our quality criteria
e148d6e6 545 if(!(fQuality == 1)) return 0;
3d19c1b0 546 //... distance of closest approach between daughters is reasonably small
e148d6e6 547 if((fDCA > fUpDCA[iDecay])) return 0;
3d19c1b0 548 //... pointing angle between momentum of mother particle and vector from prim. to sec. vertex is small
e148d6e6 549 if((fPointingAngle > fUpPointingAngle[iDecay])) return 0;
3d19c1b0 550 //... x-y plane distance of decay point to prim. vertex is bigger than a certain minimum value (for conversions)
e148d6e6 551 if((fRadius < fDownRadius[iDecay])) return 0;
3d19c1b0 552 //...or smaller than a maximum value (for K0s)
e148d6e6 553 if((fRadius > fUpRadius[iDecay])) return 0;
3d19c1b0 554 //... opening angle is close enough to zero (for conversions)
e148d6e6 555 if((fOpenAngle > fUpOpenAngle[iDecay])) return 0;
3d19c1b0 556 //... Psi-pair angle is close enough to zero(for conversions)
e148d6e6 557 if((TMath::Abs(fPsiPair) > fUpPsiPair[iDecay])) return 0;
3d19c1b0 558
559
560 //Mother momentum slots above/below 2.5 GeV
561 Int_t iPSlot(fV0Momentum > 2.5);
b9ddd472 562 Int_t trackID(track->GetTrackId());
3d19c1b0 563
564 //specific cut criteria :
565 if(ipart == AliPID::kProton) {
566 if((fInvMass[kK0s] < fUpInvMass[kK0s][iPSlot]) && (fInvMass[kK0s] > fDownInvMass[kK0s])) return 0;//explicit exclusion of K0s decays
567
568 //for proton sample: separate treatment of Lamba and Anti-Lambda decays:
569 //for Anti-Lambda:
570 //Combined PID likelihoods high enough for pi+ and anti-proton ; invariant mass calculated postulating these two particle species...
571 if((fComPID[kNeg][AliPID::kProton] > fDownComPIDneg[AliPID::kProton]) && (fComPID[kPos][AliPID::kPion] > fDownComPIDposPart[AliPID::kPion])) {
572 if(fNindex == trackID) {
573 if((fInvMass[kAntiLambda] < fUpInvMass[kAntiLambda][iPSlot]) && (fInvMass[kAntiLambda] > fDownInvMass[kAntiLambda])) return 1;
574 }
575 }
576 //for Lambda:
577 //TPC PID likelihoods high enough for pi- and proton ; invariant mass calculated accordingly
578 if((fComPID[kNeg][AliPID::kPion] > fDownComPIDnegPart[AliPID::kPion]) && (fComPID[kPos][AliPID::kProton] > fDownComPIDpos[AliPID::kProton])) {
579 if(fPindex == trackID) {
580 if((fInvMass[kLambda] < fUpInvMass[kLambda][iPSlot]) && (fInvMass[kLambda] > fDownInvMass[kLambda])) return 1;
581 }
582 }
583 }
1ee39b3a 584
3d19c1b0 585 //Invariant mass cut for K0s and photons, assuming two pions/two electrons as daughters:
586 if((fInvMass[iDecay] > fUpInvMass[iDecay][iPSlot]) || (fInvMass[iDecay] < fDownInvMass[iDecay])) return 0;
1ee39b3a 587
3d19c1b0 588 //for K0s decays: equal TPC PID likelihood criteria for both daughters ; invariant mass calculated postulating two pions
589 if(ipart == AliPID::kPion) {
590 //explicit exclusion of Lambda decays
591 if((fInvMass[kLambda] < fUpInvMass[kLambda][iPSlot]) && (fInvMass[kLambda] > fDownInvMass[kLambda])) return 0;
592 //explicit exclusion of Anti-Lambda decays
593 if((fInvMass[kAntiLambda] < fUpInvMass[kAntiLambda][iPSlot]) && (fInvMass[kAntiLambda] > fDownInvMass[kAntiLambda])) return 0;
1ee39b3a 594
3d19c1b0 595 if((fDetPID[kNeg][kTPC][ipart] > fDownTPCPIDneg[ipart]) && (fDetPID[kPos][kTPC][ipart] > fDownTPCPIDpos[ipart])) return 1;
596 }
1ee39b3a 597
3d19c1b0 598 //for photon conversions: equal combined PID likelihood criteria for both daughters ; invariant mass calculated postulating two electrons
599 //No Lambda/K0s exclusion is provided, since these contributions hardly ever interfere with gamma invariant mass!
600 Float_t momentum(track->GetESDinfo()->GetOuterParam()->P());
601 if(ipart == AliPID::kElectron) {
602 if(momentum > 1.75) {//since combined PID performs a little worse in simulations than TPC standalone for higher momenta, ONLY TPC PID is used here
603 if((fDetPID[kNeg][kTPC][ipart] > fDownTPCPIDneg[ipart]) && (fDetPID[kPos][kTPC][ipart] > fDownTPCPIDpos[ipart])) return 1;
604 } else {//for low momenta, combined PID from TOF and TPC is used to get rid of proton contamination
605 if((fComPID[kNeg][ipart] > fDownComPIDneg[ipart]) && (fComPID[kPos][ipart] > fDownComPIDpos[ipart])) return 1;
1ee39b3a 606 }
3d19c1b0 607 }
608 return 0;
1ee39b3a 609}
3d19c1b0 610
611
1ee39b3a 612//_________________________________________________
b9ddd472 613void AliTRDv0Info::Print(Option_t *opt) const
1ee39b3a 614{
b9ddd472 615 printf("V0 P[%d] N[%d]\n", fPindex, fNindex);
616 printf(" DCA[%5.3f] Radius[%5.3f]\n", fDCA, fRadius);
617 printf(" Angles : Pointing[%5.3f] Open[%5.3f] Psi[%5.3f]\n", fPointingAngle, fOpenAngle, fPsiPair);
618 if(strcmp(opt, "a")!=0) return;
619 printf(" Reconstructed PID\n"
620 " sgn spec ITS TPC TOF COM\n");
621 for(Int_t idt=0; idt<kNDaughters; idt++){
622 printf(" %c", idt?'-':'+');
623 for(Int_t is(0); is<AliPID::kSPECIES; is++){
624 printf("%s%s%s", is==0?" ":" ", AliPID::ParticleShortName(is), (is==1||is==2)?" ":" ");
625 for(Int_t id(0); id<kNDetectors; id++){
626 printf("%5.1f ", 1.e2*fDetPID[idt][id][is]);
627 }
628 printf("%5.1f\n", 1.e2*fComPID[idt][is]);
629 }
630 }
631}
1ee39b3a 632
b9ddd472 633//_________________________________________________
634void AliTRDv0Info::SetV0tracks(AliESDtrack *p, AliESDtrack *n)
635{
636 fTrackP = p; fPindex = p->GetID();
637 fTrackN = n; fNindex = n->GetID();
1ee39b3a 638}
b9ddd472 639
640