]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/ESD/AliESDpid.cxx
Update timestamp for new data points simulation
[u/mrichter/AliRoot.git] / STEER / ESD / AliESDpid.cxx
CommitLineData
8c6a71ab 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
115179c6 16/* $Id: AliESDpid.cxx 64123 2013-09-05 15:09:53Z morsch $ */
4f679a16 17
8c6a71ab 18//-----------------------------------------------------------------
19// Implementation of the combined PID class
4f679a16 20// For the Event Summary Data Class
21// produced by the reconstruction process
22// and containing information on the particle identification
8c6a71ab 23// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
24//-----------------------------------------------------------------
25
f858b00e 26#include "TArrayI.h"
27#include "TArrayF.h"
28
539a5a59 29#include "TRandom.h"
10d100d4 30#include "AliLog.h"
31#include "AliPID.h"
f858b00e 32#include "AliTOFHeader.h"
8c6a71ab 33#include "AliESDpid.h"
af885e0f 34#include "AliESDEvent.h"
8c6a71ab 35#include "AliESDtrack.h"
539a5a59 36#include "AliMCEvent.h"
c53e310b 37#include "AliTOFPIDParams.h"
539a5a59 38
00a38d07 39#include <AliDetectorPID.h>
8c6a71ab 40
41ClassImp(AliESDpid)
42
03996000 43Int_t AliESDpid::MakePID(AliESDEvent *event, Bool_t TPConly, Float_t /*timeZeroTOF*/) const {
10d100d4 44 //
45 // Calculate probabilities for all detectors, except if TPConly==kTRUE
46 // and combine PID
47 //
48 // Option TPConly==kTRUE is used during reconstruction,
49 // because ITS tracking uses TPC pid
50 // HMPID and TRD pid are done in detector reconstructors
51 //
52
53 /*
f858b00e 54 Float_t timeZeroTOF = 0;
10d100d4 55 if (subtractT0)
f858b00e 56 timeZeroTOF = event->GetT0();
10d100d4 57 */
58 Int_t nTrk=event->GetNumberOfTracks();
59 for (Int_t iTrk=0; iTrk<nTrk; iTrk++) {
60 AliESDtrack *track=event->GetTrack(iTrk);
61 MakeTPCPID(track);
62 if (!TPConly) {
63 MakeITSPID(track);
115179c6 64 //MakeTOFPID(track, timeZeroTOF);
10d100d4 65 //MakeHMPIDPID(track);
ce5d6908 66 //MakeTRDPID(track);
10d100d4 67 }
68 CombinePID(track);
69 }
70 return 0;
71}
8c6a71ab 72//_________________________________________________________________________
539a5a59 73Float_t AliESDpid::GetTPCsignalTunedOnData(const AliVTrack *t) const {
6ff24c60 74// AliESDtrack *track = (AliESDtrack *) t;
75 Float_t dedx = t->GetTPCsignalTunedOnData();
539a5a59 76
77 if(dedx > 0) return dedx;
78
539a5a59 79 dedx = t->GetTPCsignal();
6ff24c60 80 ((AliVTrack*)t)->SetTPCsignalTunedOnData(dedx);
539a5a59 81 if(dedx < 20) return dedx;
82
83 AliPID::EParticleType type = AliPID::kPion;
84
a864479b 85 AliMCEventHandler* eventHandler=dynamic_cast<AliMCEventHandler*>(fEventHandler);
539a5a59 86 if (eventHandler) {
87 AliMCEvent* mcEvent = eventHandler->MCEvent();
88 if(mcEvent){
89 Bool_t kGood = kTRUE;
90 AliMCParticle *MCpart = (AliMCParticle *) mcEvent->GetTrack(TMath::Abs(t->GetLabel()));
ed268b64 91 if (MCpart != NULL) { // protect against label-0 track (initial proton in Pythia events)
92 TParticle *part = MCpart->Particle();
93 Int_t iS = TMath::Abs(part->GetPdgCode());
94
95 if(iS==AliPID::ParticleCode(AliPID::kElectron)){
539a5a59 96 type = AliPID::kElectron;
ed268b64 97 }
98 else if(iS==AliPID::ParticleCode(AliPID::kMuon)){
539a5a59 99 type = AliPID::kMuon;
ed268b64 100 }
101 else if(iS==AliPID::ParticleCode(AliPID::kPion)){
539a5a59 102 type = AliPID::kPion;
ed268b64 103 }
104 else if(iS==AliPID::ParticleCode(AliPID::kKaon)){
539a5a59 105 type = AliPID::kKaon;
ed268b64 106 }
107 else if(iS==AliPID::ParticleCode(AliPID::kProton)){
539a5a59 108 type = AliPID::kProton;
ed268b64 109 }
110 else if(iS==AliPID::ParticleCode(AliPID::kDeuteron)){ // d
539a5a59 111 type = AliPID::kDeuteron;
ed268b64 112 }
113 else if(iS==AliPID::ParticleCode(AliPID::kTriton)){ // t
539a5a59 114 type = AliPID::kTriton;
ed268b64 115 }
116 else if(iS==AliPID::ParticleCode(AliPID::kHe3)){ // 3He
539a5a59 117 type = AliPID::kHe3;
ed268b64 118 }
119 else if(iS==AliPID::ParticleCode(AliPID::kAlpha)){ // 4He
539a5a59 120 type = AliPID::kAlpha;
ed268b64 121 }
122 else
539a5a59 123 kGood = kFALSE;
ed268b64 124 } else kGood = kFALSE;
125
539a5a59 126 if(kGood){
f85a3764 127 //TODO maybe introduce different dEdxSources?
6ff24c60 128 Double_t bethe = fTPCResponse.GetExpectedSignal(t, type, AliTPCPIDResponse::kdEdxDefault, this->UseTPCEtaCorrection(),
87da0205 129 this->UseTPCMultiplicityCorrection());
6ff24c60 130 Double_t sigma = fTPCResponse.GetExpectedSigma(t, type, AliTPCPIDResponse::kdEdxDefault, this->UseTPCEtaCorrection(),
87da0205 131 this->UseTPCMultiplicityCorrection());
539a5a59 132 dedx = gRandom->Gaus(bethe,sigma);
567624b5 133// if(iS == AliPID::ParticleCode(AliPID::kHe3) || iS == AliPID::ParticleCode(AliPID::kAlpha)) dedx *= 5;
539a5a59 134 }
135 }
136 }
137
6ff24c60 138 ((AliVTrack*)t)->SetTPCsignalTunedOnData(dedx);
539a5a59 139 return dedx;
140}
141//_________________________________________________________________________
a2c30af1 142Float_t AliESDpid::GetTOFsignalTunedOnData(const AliVTrack *t) const {
6ff24c60 143// AliESDtrack *track = (AliESDtrack *) t;
144 Double_t tofSignal = t->GetTOFsignalTunedOnData();
a2c30af1 145
146 if(tofSignal < 99999) return (Float_t)tofSignal; // it has been already set
c53e310b 147 // read additional mismatch fraction
148 Float_t addmism = GetTOFPIDParams()->GetTOFadditionalMismForMC();
149 if(addmism > 1.){
150 Float_t centr = GetCurrentCentrality();
151 if(centr > 50) addmism *= 0.1667;
152 else if(centr > 20) addmism *= 0.33;
153 }
a2c30af1 154
c53e310b 155 tofSignal = t->GetTOFsignal() + fTOFResponse.GetTailRandomValue(t->Pt(),t->Eta(),t->GetTOFsignal(),addmism);
6ff24c60 156 ((AliVTrack*)t)->SetTOFsignalTunedOnData(tofSignal);
a2c30af1 157 return (Float_t)tofSignal;
158}
159//_________________________________________________________________________
10d100d4 160void AliESDpid::MakeTPCPID(AliESDtrack *track) const
8c6a71ab 161{
4f679a16 162 //
10d100d4 163 // TPC pid using bethe-bloch and gaussian response
4f679a16 164 //
10d100d4 165 if ((track->GetStatus()&AliESDtrack::kTPCin )==0)
166 if ((track->GetStatus()&AliESDtrack::kTPCout)==0) return;
8c6a71ab 167
10d100d4 168 Double_t mom = track->GetP();
169 const AliExternalTrackParam *in=track->GetInnerParam();
170 if (in) mom = in->GetP();
8c6a71ab 171
10d100d4 172 Double_t p[AliPID::kSPECIES];
173 Double_t dedx=track->GetTPCsignal();
174 Bool_t mismatch=kTRUE, heavy=kTRUE;
8c6a71ab 175
10d100d4 176 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
177 AliPID::EParticleType type=AliPID::EParticleType(j);
178 Double_t bethe=fTPCResponse.GetExpectedSignal(mom,type);
179 Double_t sigma=fTPCResponse.GetExpectedSigma(mom,track->GetTPCsignalN(),type);
180 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
181 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
182 } else {
183 p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
184 mismatch=kFALSE;
185 }
8c6a71ab 186
10d100d4 187 // Check for particles heavier than (AliPID::kSPECIES - 1)
188 if (dedx < (bethe + fRange*sigma)) heavy=kFALSE;
c630aafd 189
4a78b8c5 190 }
191
10d100d4 192 if (mismatch)
77638021 193 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1./AliPID::kSPECIES;
10d100d4 194
195 track->SetTPCpid(p);
196
197 if (heavy) track->ResetStatus(AliESDtrack::kTPCpid);
198
199}
200//_________________________________________________________________________
201void AliESDpid::MakeITSPID(AliESDtrack *track) const
202{
203 //
204 // ITS PID
205 // Two options, depending on fITSPIDmethod:
206 // 1) Truncated mean method
207 // 2) Likelihood, using charges measured in all 4 layers and
208 // Landau+gaus response functions
209 //
210
211 if ((track->GetStatus()&AliESDtrack::kITSin)==0 &&
212 (track->GetStatus()&AliESDtrack::kITSout)==0) return;
213
214 Double_t mom=track->GetP();
215 if (fITSPIDmethod == kITSTruncMean) {
216 Double_t dedx=track->GetITSsignal();
15e979c9 217 Bool_t isSA=kTRUE;
218 Double_t momITS=mom;
219 ULong_t trStatus=track->GetStatus();
99daa709 220 if(trStatus&AliESDtrack::kTPCin) isSA=kFALSE;
15e979c9 221 UChar_t clumap=track->GetITSClusterMap();
222 Int_t nPointsForPid=0;
223 for(Int_t i=2; i<6; i++){
224 if(clumap&(1<<i)) ++nPointsForPid;
225 }
226
227 if(nPointsForPid<3) { // track not to be used for combined PID purposes
228 track->ResetStatus(AliESDtrack::kITSpid);
229 return;
230 }
231
06337330 232 Double_t p[AliPID::kSPECIES];
15e979c9 233
10d100d4 234 Bool_t mismatch=kTRUE, heavy=kTRUE;
235 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
236 Double_t mass=AliPID::ParticleMass(j);//GeV/c^2
15e979c9 237 Double_t bethe=fITSResponse.Bethe(momITS,mass);
238 Double_t sigma=fITSResponse.GetResolution(bethe,nPointsForPid,isSA);
10d100d4 239 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
240 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
241 } else {
242 p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
243 mismatch=kFALSE;
244 }
245
246 // Check for particles heavier than (AliPID::kSPECIES - 1)
247 if (dedx < (bethe + fRange*sigma)) heavy=kFALSE;
248
4a78b8c5 249 }
c630aafd 250
10d100d4 251 if (mismatch)
252 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1./AliPID::kSPECIES;
253
254 track->SetITSpid(p);
255
256 if (heavy) track->ResetStatus(AliESDtrack::kITSpid);
257 }
258 else { // Likelihood method
259 Double_t condprobfun[AliPID::kSPECIES];
260 Double_t qclu[4];
261 track->GetITSdEdxSamples(qclu);
262 fITSResponse.GetITSProbabilities(mom,qclu,condprobfun);
263 track->SetITSpid(condprobfun);
8c6a71ab 264 }
7a8614f3 265
10d100d4 266}
267//_________________________________________________________________________
f858b00e 268void AliESDpid::MakeTOFPID(AliESDtrack *track, Float_t /*timeZeroTOF*/) const
10d100d4 269{
270 //
271 // TOF PID using gaussian response
272 //
f858b00e 273
10d100d4 274 if ((track->GetStatus()&AliESDtrack::kTOFout)==0) return;
275 if ((track->GetStatus()&AliESDtrack::kTIME)==0) return;
a512bf97 276 if ((track->GetStatus()&AliESDtrack::kITSin)==0) return;
10d100d4 277
f858b00e 278 Int_t ibin = fTOFResponse.GetMomBin(track->GetP());
279 Float_t timezero = fTOFResponse.GetT0bin(ibin);
280
d4da4017 281 Double_t time[AliPID::kSPECIESC];
10d100d4 282 track->GetIntegratedTimes(time);
283
284 Double_t sigma[AliPID::kSPECIES];
285 for (Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++) {
286 sigma[iPart] = fTOFResponse.GetExpectedSigma(track->GetP(),time[iPart],AliPID::ParticleMass(iPart));
287 }
288
289 AliDebugGeneral("AliESDpid::MakeTOFPID",2,
290 Form("Expected TOF signals [ps]: %f %f %f %f %f",
291 time[AliPID::kElectron],
292 time[AliPID::kMuon],
293 time[AliPID::kPion],
294 time[AliPID::kKaon],
295 time[AliPID::kProton]));
296
297 AliDebugGeneral("AliESDpid::MakeTOFPID",2,
298 Form("Expected TOF std deviations [ps]: %f %f %f %f %f",
299 sigma[AliPID::kElectron],
300 sigma[AliPID::kMuon],
301 sigma[AliPID::kPion],
302 sigma[AliPID::kKaon],
303 sigma[AliPID::kProton]
304 ));
305
f858b00e 306 Double_t tof = track->GetTOFsignal() - timezero;
10d100d4 307
308 Double_t p[AliPID::kSPECIES];
355b831b 309// Bool_t mismatch = kTRUE;
310 Bool_t heavy = kTRUE;
10d100d4 311 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
312 Double_t sig = sigma[j];
f858b00e 313 if (TMath::Abs(tof-time[j]) > (fRange+2)*sig) {
314 p[j] = TMath::Exp(-0.5*(fRange+2)*(fRange+2))/sig;
10d100d4 315 } else
316 p[j] = TMath::Exp(-0.5*(tof-time[j])*(tof-time[j])/(sig*sig))/sig;
317
318 // Check the mismatching
ee251349 319
355b831b 320// Double_t mass = AliPID::ParticleMass(j);
321// Double_t pm = fTOFResponse.GetMismatchProbability(track->GetP(),mass);
322// if (p[j]>pm) mismatch = kFALSE;
10d100d4 323
324 // Check for particles heavier than (AliPID::kSPECIES - 1)
325 if (tof < (time[j] + fRange*sig)) heavy=kFALSE;
326
327 }
328
ee251349 329 /*
330 if (mismatch)
77638021 331 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1./AliPID::kSPECIES;
ee251349 332 */
10d100d4 333
334 track->SetTOFpid(p);
335
ee251349 336 if (heavy) track->ResetStatus(AliESDtrack::kTOFpid);
f858b00e 337
784e3441 338 // kTOFmismatch flas is not set because deprecated from 18/02/2013
339 // if (!CheckTOFMatching(track)) track->SetStatus(AliESDtrack::kTOFmismatch);
340 // else track->ResetStatus(AliESDtrack::kTOFmismatch);
10d100d4 341}
342//_________________________________________________________________________
b439f460 343void AliESDpid::MakeTRDPID(AliESDtrack *track) const
344{
345 //
346 // Method to recalculate the TRD PID probabilities
347 //
ea235c90 348 Double_t prob[AliPID::kSPECIES];
1c9d11be 349 GetComputeTRDProbability(track, AliPID::kSPECIES, prob);
b439f460 350 track->SetTRDpid(prob);
351}
352//_________________________________________________________________________
10d100d4 353void AliESDpid::CombinePID(AliESDtrack *track) const
354{
355 //
356 // Combine the information of various detectors
357 // to determine the Particle Identification
358 //
06337330 359 Double_t p[AliPID::kSPECIES]={1.};
10d100d4 360
361 if (track->IsOn(AliESDtrack::kITSpid)) {
06337330 362 Double_t d[AliPID::kSPECIES];
10d100d4 363 track->GetITSpid(d);
06337330 364 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]*=d[j];
10d100d4 365 }
366
367 if (track->IsOn(AliESDtrack::kTPCpid)) {
06337330 368 Double_t d[AliPID::kSPECIES];
10d100d4 369 track->GetTPCpid(d);
06337330 370 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]*=d[j];
10d100d4 371 }
372
373 if (track->IsOn(AliESDtrack::kTRDpid)) {
06337330 374 Double_t d[AliPID::kSPECIES];
10d100d4 375 track->GetTRDpid(d);
06337330 376 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]*=d[j];
10d100d4 377 }
378
379 if (track->IsOn(AliESDtrack::kTOFpid)) {
06337330 380 Double_t d[AliPID::kSPECIES];
10d100d4 381 track->GetTOFpid(d);
06337330 382 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]*=d[j];
10d100d4 383 }
384
385 if (track->IsOn(AliESDtrack::kHMPIDpid)) {
06337330 386 Double_t d[AliPID::kSPECIES];
10d100d4 387 track->GetHMPIDpid(d);
06337330 388 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]*=d[j];
10d100d4 389 }
390
391 track->SetESDpid(p);
8c6a71ab 392}
f858b00e 393//_________________________________________________________________________
394Bool_t AliESDpid::CheckTOFMatching(AliESDtrack *track) const{
ea235c90 395 //
396 // Check pid matching of TOF with TPC as reference
397 //
f858b00e 398 Bool_t status = kFALSE;
399
d4da4017 400 Double_t exptimes[AliPID::kSPECIESC];
f858b00e 401 track->GetIntegratedTimes(exptimes);
402
f858b00e 403 Float_t p = track->P();
404
7170298c 405 Float_t dedx = track->GetTPCsignal();
406 Float_t time = track->GetTOFsignal() - fTOFResponse.GetStartTime(p);
407
f858b00e 408 Double_t ptpc[3];
409 track->GetInnerPxPyPz(ptpc);
410 Float_t momtpc=TMath::Sqrt(ptpc[0]*ptpc[0] + ptpc[1]*ptpc[1] + ptpc[2]*ptpc[2]);
411
06337330 412 for(Int_t i=0;i < AliPID::kSPECIES;i++){
f858b00e 413 AliPID::EParticleType type=AliPID::EParticleType(i);
414
415 Float_t resolutionTOF = fTOFResponse.GetExpectedSigma(p, exptimes[i], AliPID::ParticleMass(i));
416 if(TMath::Abs(exptimes[i] - time) < fRange * resolutionTOF){
417 Float_t dedxExp = fTPCResponse.GetExpectedSignal(momtpc,type);
418 Float_t resolutionTPC = fTPCResponse.GetExpectedSigma(momtpc,track->GetTPCsignalN(),type);
419
7170298c 420 if(TMath::Abs(dedx - dedxExp) < fRangeTOFMismatch * resolutionTPC){
f858b00e 421 status = kTRUE;
422 }
423 }
424 }
425
426 // for nuclei
c1252298 427 Float_t resolutionTOFpr = fTOFResponse.GetExpectedSigma(p, exptimes[4], AliPID::ParticleMass(4));
428 if(!status && (exptimes[4] + fRange*resolutionTOFpr < time)) status = kTRUE;
f858b00e 429
430
431 return status;
432}
00a38d07 433
567624b5 434//_________________________________________________________________________
1d59271b 435Float_t AliESDpid::GetSignalDeltaTOFold(const AliVParticle *track, AliPID::EParticleType type, Bool_t ratio/*=kFALSE*/) const
567624b5 436{
437 //
438 // TOF signal - expected
439 //
440 AliVTrack *vtrack=(AliVTrack*)track;
441
1d59271b 442 const Double_t expTime = fTOFResponse.GetExpectedSignal(vtrack,type);
a2c30af1 443 Double_t tofTime = 99999;
444 if (fTuneMConData && ((fTuneMConDataMask & kDetTOF) == kDetTOF) ) tofTime = (Double_t)this->GetTOFsignalTunedOnData((AliVTrack*)vtrack);
445 else tofTime=vtrack->GetTOFsignal();
446 tofTime = tofTime - fTOFResponse.GetStartTime(vtrack->P());
1d59271b 447 Double_t delta=-9999.;
448
449 if (!ratio) delta=tofTime-expTime;
450 else if (expTime>1.e-20) delta=tofTime/expTime;
451
452 return delta;
567624b5 453}
454
455//_________________________________________________________________________
355b831b 456Float_t AliESDpid::GetNumberOfSigmasTOFold(const AliVParticle *track, AliPID::EParticleType type) const
00a38d07 457{
458 //
459 // Number of sigma implementation for the TOF
460 //
355b831b 461
00a38d07 462 AliVTrack *vtrack=(AliVTrack*)track;
a2c30af1 463 Double_t tofTime = 99999;
464 if (fTuneMConData && ((fTuneMConDataMask & kDetTOF) == kDetTOF) ) tofTime = (Double_t)this->GetTOFsignalTunedOnData((AliVTrack*)vtrack);
465 else tofTime=vtrack->GetTOFsignal();
355b831b 466
00a38d07 467 Double_t expTime = fTOFResponse.GetExpectedSignal(vtrack,type);
a2c30af1 468 return (tofTime - fTOFResponse.GetStartTime(vtrack->P()) - expTime)/fTOFResponse.GetExpectedSigma(vtrack->P(),expTime,AliPID::ParticleMassZ(type));
00a38d07 469}
1d26da6d 470
471//_________________________________________________________________________
a3314882 472void AliESDpid::SetPIDForTracking(AliESDtrack *esdtr) const
1d26da6d 473{
474 // assign mass for tracking
475 //
03996000 476
477 // in principle AliPIDCombined could be used to also set priors
478 //AliPIDCombined pidProb;
479 //pidProb.SetDetectorMask(kDetTPC); // use only TPC information, couls also be changed
480 //pidProb.SetSelectedSpecies(AliPID::kSPECIESC); // number of species to use
481 //pidProb.SetDefaultTPCPriors(); // load default priors
482
483 Double_t prob[AliPID::kSPECIESC]={0.};
484 EDetPidStatus pidStatus=ComputePIDProbability(kTPC, esdtr, AliPID::kSPECIESC, prob);
485 // check if a valid signal was found, otherwise return pion mass
fa9153cf 486 if (pidStatus==kDetNoSignal) { //kDetPidOk) {
a3314882 487 esdtr->SetPIDForTracking(AliPID::kPion);
03996000 488 return;
489 }
490
491 // or with AliPIDCombined
492 // pidProb.ComputeProbabilities(esdtr, this, p);
493
494 // find max probability
fa9153cf 495 Float_t max=0.,min=1.e9;
03996000 496 Int_t pid=-1;
fa9153cf 497 for (Int_t i=0; i<AliPID::kSPECIESC; ++i) {
498 if (prob[i]>max) {pid=i; max=prob[i];}
499 if (prob[i]<min) min=prob[i];
500 }
03996000 501
502 //int pid = AliPID::kPion; // this should be substituted by real most probable TPC pid (e,mu -> pion) or poin if no PID possible
503
1d26da6d 504 //
fa9153cf 505 if (pid>AliPID::kSPECIESC-1 || (min>=max)) pid = AliPID::kPion;
1d26da6d 506 //
a3314882 507 esdtr->SetPIDForTracking( pid );
1d26da6d 508 //
509}
510
511
512//_________________________________________________________________________
513void AliESDpid::MakePIDForTracking(AliESDEvent *event) const
514{
515 // assign masses using for tracking
516 Int_t nTrk=event->GetNumberOfTracks();
517 for (Int_t iTrk=nTrk; iTrk--;) {
518 AliESDtrack *track = event->GetTrack(iTrk);
a3314882 519 SetPIDForTracking(track);
1d26da6d 520 }
521
522}