fixing warnings
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAODPidHF.cxx
CommitLineData
7ce8802c 1/**************************************************************************
2 * Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 * *************************************************************************/
16
17//***********************************************************
18// Class AliAODPidHF
19// class for PID with AliAODRecoDecayHF
228f3aba 20// Authors: D. Caffarri caffarri@pd.infn.it, A.Dainese andrea.dainese@pd.infn.it, S. Dash dash@to.infn.it, F. Prino prino@to.infn.it, R. Romita r.romita@gsi.de, Y. Wang yifei@pi0.physi.uni-heidelberg.de
7ce8802c 21//***********************************************************
22#include "AliAODPidHF.h"
23#include "AliAODPid.h"
24#include "AliAODTrack.h"
25#include "AliPID.h"
26#include "AliTPCPIDResponse.h"
27#include "AliITSPIDResponse.h"
28#include "AliTOFPIDResponse.h"
29#include "AliAODpidUtil.h"
f9e3cf8e 30#include "AliESDtrack.h"
7ce8802c 31
32
33ClassImp(AliAODPidHF)
34
35//------------------------------
36AliAODPidHF::AliAODPidHF():
228f3aba 37 AliAODPid(),
38 fnNSigma(5),
39 fnSigma(),
40 fTOFSigma(160.),
41 fnPriors(5),
42 fPriors(),
43 fnPLimit(2),
44 fPLimit(),
cdac45d3 45 fAsym(kFALSE),
46 fTPC(kFALSE),
47 fTOF(kFALSE),
48 fITS(kFALSE),
49 fTRD(kFALSE),
79f3c225 50 fMatch(0),
cdac45d3 51 fCompat(kFALSE)
7ce8802c 52{
53 //
54 // Default constructor
55 //
228f3aba 56 fPLimit=new Double_t[fnPLimit];
57 fnSigma=new Double_t[fnNSigma];
58 fPriors=new Double_t[fnPriors];
59
60 for(Int_t i=0;i<fnNSigma;i++){
61 fnSigma[i]=0.;
62 }
63 for(Int_t i=0;i<fnPriors;i++){
64 fPriors[i]=0.;
65 }
66 for(Int_t i=0;i<fnPLimit;i++){
67 fPLimit[i]=0.;
68 }
7ce8802c 69
70}
71//----------------------
72AliAODPidHF::~AliAODPidHF()
73{
74 // destructor
228f3aba 75 // if(fPLimit) delete fPLimit;
76 // if(fnSigma) delete fnSigma;
77 // if(fPriors) delete fPriors;
7ce8802c 78}
79//------------------------
80AliAODPidHF::AliAODPidHF(const AliAODPidHF& pid) :
81 AliAODPid(pid),
228f3aba 82 fnNSigma(pid.fnNSigma),
83 fnSigma(pid.fnSigma),
84 fTOFSigma(pid.fTOFSigma),
85 fnPriors(pid.fnPriors),
86 fPriors(pid.fPriors),
87 fnPLimit(pid.fnPLimit),
88 fPLimit(pid.fPLimit),
cdac45d3 89 fAsym(pid.fAsym),
90 fTPC(pid.fTPC),
91 fTOF(pid.fTOF),
92 fITS(pid.fITS),
93 fTRD(pid.fTRD),
94 fMatch(pid.fMatch),
95 fCompat(pid.fCompat)
7ce8802c 96 {
97
98 for(Int_t i=0;i<5;i++){
99 fPriors[i]=pid.fPriors[i];
100 }
101
102 }
103
104//----------------------
228f3aba 105Int_t AliAODPidHF::RawSignalPID(AliAODTrack *track, TString detector) const{
106// raw PID for single detectors, returns the particle type with smaller sigma
f9e3cf8e 107 Int_t specie=-1;
108 if(detector.Contains("ITS")) return ApplyPidITSRaw(track,specie);
109 if(detector.Contains("TPC")) return ApplyPidTPCRaw(track,specie);
110 if(detector.Contains("TOF")) return ApplyPidTOFRaw(track,specie);
7ce8802c 111
f9e3cf8e 112 return specie;
7ce8802c 113
114}
115//---------------------------
228f3aba 116Bool_t AliAODPidHF::IsKaonRaw(AliAODTrack *track, TString detector) const{
117// checks if the track can be a kaon, raw PID applied for single detectors
7ce8802c 118 Int_t specie=0;
119
120 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,3);
121 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,3);
122 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,3);
123
124 if(specie==3) return kTRUE;
125 return kFALSE;
126}
127//---------------------------
228f3aba 128Bool_t AliAODPidHF::IsPionRaw (AliAODTrack *track, TString detector) const{
129// checks if the track can be a pion, raw PID applied for single detectors
7ce8802c 130
131 Int_t specie=0;
132
133 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,2);
134 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,2);
135 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,2);
136
137 if(specie==2) return kTRUE;
138 return kFALSE;
139}
140//---------------------------
228f3aba 141Bool_t AliAODPidHF::IsProtonRaw (AliAODTrack *track, TString detector) const{
142// checks if the track can be a proton raw PID applied for single detectors
7ce8802c 143
144 Int_t specie=0;
145 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,4);
146 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,4);
147 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,4);
148
149 if(specie==4) return kTRUE;
150
151 return kFALSE;
152}
f9e3cf8e 153//--------------------------
228f3aba 154Bool_t AliAODPidHF::IsElectronRaw(AliAODTrack *track, TString detector) const{
155// checks if the track can be an electron raw PID applied for single detectors
f9e3cf8e 156
157 Int_t specie=-1;
158 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,0);
159 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,0);
160 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,0);
161
162 if(specie==0) return kTRUE;
163
164 return kFALSE;
165}
166//--------------------------
228f3aba 167Int_t AliAODPidHF::ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const{
168// n-sigma cut, TPC PID
7ce8802c 169
cdac45d3 170 if(!CheckStatus(track,"TPC")) return 0;
7ce8802c 171 AliAODPid *pidObj = track->GetDetPid();
172
173 Double_t dedx=pidObj->GetTPCsignal();
174 Double_t mom = pidObj->GetTPCmomentum();
175 AliTPCPIDResponse tpcResponse;
f9e3cf8e 176 Int_t pid=-1;
177 if(specie<0){ // from RawSignalPID : should return the particle specie to wich the de/dx is closer to the bethe-block curve -> performance to be checked
228f3aba 178 Double_t nsigmaMax=fnSigma[0];
f9e3cf8e 179 for(Int_t ipart=0;ipart<5;ipart++){
7ce8802c 180 AliPID::EParticleType type=AliPID::EParticleType(ipart);
f9e3cf8e 181 Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,track->GetTPCNcls(),type));
228f3aba 182 if((nsigma<nsigmaMax) && (nsigma<fnSigma[0])) {
7ce8802c 183 pid=ipart;
184 nsigmaMax=nsigma;
185 }
186 }
187 }else{ // asks only for one particle specie
188 AliPID::EParticleType type=AliPID::EParticleType(specie);
f9e3cf8e 189 Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,track->GetTPCNcls(),type));
228f3aba 190 if (nsigma>fnSigma[0]) {
f9e3cf8e 191 pid=-1;
7ce8802c 192 }else{
79f3c225 193 pid=specie;
7ce8802c 194 }
195 }
196
197 return pid;
198
199}
200//----------------------------
228f3aba 201Int_t AliAODPidHF::ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const{
202// truncated mean, ITS PID
f9e3cf8e 203
cdac45d3 204 if(!CheckStatus(track,"ITS")) return 0;
f9e3cf8e 205
7ce8802c 206 Double_t mom=track->P();
207 AliAODPid *pidObj = track->GetDetPid();
208
209 Double_t dedx=pidObj->GetITSsignal();
210 AliITSPIDResponse itsResponse;
f9e3cf8e 211 Int_t pid=-1;
212 if(specie<0){ // from RawSignalPID : should return the particle specie to wich the de/dx is closer to the bethe-block curve -> performance to be checked
228f3aba 213 Double_t nsigmaMax=fnSigma[4];
f9e3cf8e 214 for(Int_t ipart=0;ipart<5;ipart++){
7ce8802c 215 AliPID::EParticleType type=AliPID::EParticleType(ipart);
216 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type));
228f3aba 217 if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) {
7ce8802c 218 pid=ipart;
219 nsigmaMax=nsigma;
220 }
221 }
222 }else{ // asks only for one particle specie
223 AliPID::EParticleType type=AliPID::EParticleType(specie);
224 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type));
228f3aba 225 if (nsigma>fnSigma[4]) {
f9e3cf8e 226 pid=-1;
7ce8802c 227 }else{
79f3c225 228 pid=specie;
7ce8802c 229 }
230 }
231 return pid;
232}
233//----------------------------
228f3aba 234Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{
235// n-sigma cut, TOF PID
f9e3cf8e 236
cdac45d3 237 if(!CheckStatus(track,"TOF")) return 0;
f9e3cf8e 238
7ce8802c 239 Double_t time[AliPID::kSPECIESN];
240 AliAODPid *pidObj = track->GetDetPid();
241 pidObj->GetIntegratedTimes(time);
228f3aba 242 Double_t sigTOF=pidObj->GetTOFsignal();
243// AliTOFPIDResponse tofResponse;
f9e3cf8e 244 Int_t pid=-1;
7ce8802c 245
f9e3cf8e 246 if(specie<0){ // from RawSignalPID : should return the particle specie to wich the de/dx is closer to the bethe-block curve -> performance to be checked
228f3aba 247 Double_t nsigmaMax=fTOFSigma*fnSigma[3];
f9e3cf8e 248 for(Int_t ipart=0;ipart<5;ipart++){
228f3aba 249 //AliPID::EParticleType type=AliPID::EParticleType(ipart);
250 //Double_t nsigma = tofResponse.GetExpectedSigma(track->P(),time[type],AliPID::ParticleMass(type));
251 Double_t nsigma=TMath::Abs(sigTOF-time[ipart]);
252 if((nsigma<nsigmaMax) && (nsigma<fnSigma[3]*fTOFSigma)) {
7ce8802c 253 pid=ipart;
254 nsigmaMax=nsigma;
255 }
256 }
257 }else{ // asks only for one particle specie
228f3aba 258 //AliPID::EParticleType type=AliPID::EParticleType(specie);
259 //Double_t nsigma = TMath::Abs(tofResponse.GetExpectedSigma(track->P(),time[type],AliPID::ParticleMass(type)));
260 Double_t nsigma=TMath::Abs(sigTOF-time[specie]);
261 if (nsigma>fnSigma[3]*fTOFSigma) {
f9e3cf8e 262 pid=-1;
7ce8802c 263 }else{
79f3c225 264 pid=specie;
7ce8802c 265 }
266 }
267 return pid;
268
269}
270//------------------------------
228f3aba 271void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{
272// combined PID stored inside the AOD track
7ce8802c 273
274 const Double_t *pid=track->PID();
275 Float_t max=0.;
276 Int_t k=-1;
277 for (Int_t i=0; i<10; i++) {
278 if (pid[i]>max) {k=i; max=pid[i];}
279 }
280
281 if(k==2) type[0]=kTRUE;
282 if(k==3) type[1]=kTRUE;
283 if(k==4) type[2]=kTRUE;
284
285 return;
286}
287//--------------------
cdac45d3 288void AliAODPidHF::BayesianProbability(AliAODTrack *track,Double_t *pid) const{
228f3aba 289// bayesian PID for single detectors or combined
7ce8802c 290
cdac45d3 291 if(fITS && !fTPC && !fTOF) {BayesianProbabilityITS(track,pid);return;}
292 if(fTPC && !fITS && !fTOF) {BayesianProbabilityTPC(track,pid);return;}
293 if(fTOF && !fITS && !fTPC) {BayesianProbabilityTOF(track,pid);return;}
294
295 Double_t probITS[5]={1.,1.,1.,1.,1.};
296 Double_t probTPC[5]={1.,1.,1.,1.,1.};
297 Double_t probTOF[5]={1.,1.,1.,1.,1.};
298 if(fITS) BayesianProbabilityITS(track,probITS);
299 if(fTPC) BayesianProbabilityTPC(track,probTPC);
300 if(fTOF) BayesianProbabilityTOF(track,probTOF);
7ce8802c 301 Double_t probTot[5]={0.,0.,0.,0.,0.};
302 for(Int_t i=0;i<5;i++){
303 probTot[i]=probITS[i]*probTPC[i]*probTOF[i];
304 }
305 for(Int_t i2=0;i2<5;i2++){
306 pid[i2]=probTot[i2]*fPriors[i2]/(probTot[0]*fPriors[0]+probTot[1]*fPriors[1]+probTot[2]*fPriors[2]+probTot[3]*fPriors[3]+probTot[4]*fPriors[4]);
307 }
7ce8802c 308
309 return;
310
311}
312//------------------------------------
228f3aba 313void AliAODPidHF::BayesianProbabilityITS(AliAODTrack *track,Double_t *prob) const{
7ce8802c 314
228f3aba 315// bayesian PID for ITS
7ce8802c 316 AliAODpidUtil pid;
317 Double_t itspid[AliPID::kSPECIES];
318 pid.MakeITSPID(track,itspid);
319 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
320 prob[ind]=itspid[ind]*fPriors[ind]/(itspid[0]*fPriors[0]+itspid[1]*fPriors[1]+itspid[2]*fPriors[2]+itspid[3]*fPriors[3]+itspid[4]*fPriors[4]);
321 }
322 return;
323
324}
325//------------------------------------
228f3aba 326void AliAODPidHF::BayesianProbabilityTPC(AliAODTrack *track,Double_t *prob) const{
327// bayesian PID for TPC
7ce8802c 328
329 AliAODpidUtil pid;
330 Double_t tpcpid[AliPID::kSPECIES];
331 pid.MakeTPCPID(track,tpcpid);
332 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
333 if(tpcpid[ind]>0.) {
334 prob[ind]=tpcpid[ind]*fPriors[ind]/(tpcpid[0]*fPriors[0]+tpcpid[1]*fPriors[1]+tpcpid[2]*fPriors[2]+tpcpid[3]*fPriors[3]+tpcpid[4]*fPriors[4]);
335 }else{
336 prob[ind]=0.;
337 }
338 }
339 return;
340
341}
342//------------------------------------
228f3aba 343void AliAODPidHF::BayesianProbabilityTOF(AliAODTrack *track,Double_t *prob) const{
344// bayesian PID for TOF
7ce8802c 345
346 AliAODpidUtil pid;
347 Double_t tofpid[AliPID::kSPECIES];
228f3aba 348 pid.MakeTOFPID(track,tofpid);
7ce8802c 349 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
350 prob[ind]=tofpid[ind]*fPriors[ind]/(tofpid[0]*fPriors[0]+tofpid[1]*fPriors[1]+tofpid[2]*fPriors[2]+tofpid[3]*fPriors[3]+tofpid[4]*fPriors[4]);
351 }
352 return;
353
354}
f9e3cf8e 355//---------------------------------
228f3aba 356void AliAODPidHF::BayesianProbabilityTRD(AliAODTrack *track,Double_t *prob) const{
357// bayesian PID for TRD
f9e3cf8e 358
359 AliAODpidUtil pid;
360 Double_t trdpid[AliPID::kSPECIES];
361 pid.MakeTRDPID(track,trdpid);
362 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
363 if(trdpid[ind]>0.) {
364 prob[ind]=trdpid[ind]*fPriors[ind]/(trdpid[0]*fPriors[0]+trdpid[1]*fPriors[1]+trdpid[2]*fPriors[2]+trdpid[3]*fPriors[3]+trdpid[4]*fPriors[4]);
365 }else{
366 prob[ind]=0.;
367 }
368 }
369 return;
370
371 }
372//--------------------------------
228f3aba 373Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{
f9e3cf8e 374
228f3aba 375// Quality cuts on the tracks, detector by detector
f9e3cf8e 376
377 if(detectors.Contains("ITS")){
378 if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE;
379 UChar_t clumap=track->GetITSClusterMap();
380 Int_t nPointsForPid=0;
381 for(Int_t i=2; i<6; i++){
382 if(clumap&(1<<i)) ++nPointsForPid;
383 }
384 if(nPointsForPid<3) return kFALSE;// track not to be used for PID purposes
385 }
386
387 if(detectors.Contains("TPC")){
388 if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE;
389 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
390 if (nTPCClus<70) return kFALSE;
391 }
392
393 if(detectors.Contains("TOF")){
394 if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE;
395 if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE;
396 if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE;
397 }
398
399
400 if(detectors.Contains("TRD")){
401 if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE;
402 AliAODPid *pidObj = track->GetDetPid();
403 Float_t *mom=pidObj->GetTRDmomentum();
404 Int_t ntracklets=0;
405 for(Int_t iPl=0;iPl<6;iPl++){
406 if(mom[iPl]>0.) ntracklets++;
407 }
408 if(ntracklets<4) return kFALSE;
409 }
410
411 return kTRUE;
412}
228f3aba 413//--------------------------------------------
414Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{
415// TPC nsigma cut PID, different sigmas in different p bins
416
417 if(!CheckStatus(track,"TPC")) return kFALSE;
418 AliAODPid *pidObj = track->GetDetPid();
419 Double_t mom = pidObj->GetTPCmomentum();
420 Double_t dedx=pidObj->GetTPCsignal();
421
422 AliTPCPIDResponse tpcResponse;
423 AliPID::EParticleType type=AliPID::EParticleType(specie);
424 Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,track->GetTPCNcls(),type));
425
426 if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE;
427 if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE;
428 if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE;
429
430 return kFALSE;
431}
432//------------------
433Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track,Int_t mode,Int_t specie,Bool_t compat){
434// combination of the PID info coming from TPC and TOF
435 if(mode==1){
436 //TOF || TPC (a la' Andrea R.)
cdac45d3 437 // convention:
228f3aba 438 // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible
439 // the method returns the sum of the response of the 2 detectors
79f3c225 440 if(fTPC && fTOF) {if(!CheckStatus(track,"TPC") && !CheckStatus(track,"TOF")) return 0;}
228f3aba 441
cdac45d3 442
228f3aba 443 Int_t TPCinfo=0;
cdac45d3 444 if(fTPC){
228f3aba 445 if(CheckStatus(track,"TPC")) {
446 if(fAsym) {
3779f50a 447 if(TPCRawAsym(track,specie)) {
448 TPCinfo=1;
449 }else{
450 TPCinfo=-1;
451 }
228f3aba 452 }else{
3779f50a 453 if(specie==2 && IsPionRaw(track,"TPC")) {
454 TPCinfo=1;
455 }else{
456 TPCinfo=-1;
457 }
458 if(specie==3 && IsKaonRaw(track,"TPC")) {
459 TPCinfo=1;
460 }else{
461 TPCinfo=-1;
462 }
463 if(specie==4 && IsProtonRaw(track,"TPC")) {
464 TPCinfo=1;
465 }else{
466 TPCinfo=-1;
467 }
468
228f3aba 469 }
470
471
cdac45d3 472 if(compat && TPCinfo<0){
473 Double_t sig0tmp=fnSigma[0];
474 SetSigma(0,3.);
475 if(specie==2 && IsPionRaw(track,"TPC")) TPCinfo=0;
476 if(specie==3 && IsKaonRaw(track,"TPC")) TPCinfo=0;
477 if(specie==4 && IsProtonRaw(track,"TPC")) TPCinfo=0;
478 SetSigma(0,sig0tmp);
479 }
228f3aba 480
cdac45d3 481 }
228f3aba 482 }
483
cdac45d3 484 Int_t TOFinfo=0;
485 if(fTOF){
486 if(!CheckStatus(track,"TOF") && fTPC) return TPCinfo;
228f3aba 487
cdac45d3 488 TOFinfo=-1;
228f3aba 489
490 if(specie==2 && IsPionRaw(track,"TOF")) TOFinfo=1;
491 if(specie==3 && IsKaonRaw(track,"TOF")) TOFinfo=1;
492 if(specie==4 && IsProtonRaw(track,"TOF")) TOFinfo=1;
493
cdac45d3 494 if(compat && TOFinfo>0){
495 Double_t ptrack=track->P();
496 if(ptrack>1.5) TOFinfo=0;
497 }
79f3c225 498 }
228f3aba 499 return TPCinfo+TOFinfo;
cdac45d3 500}
228f3aba 501 if(mode==2){
502 //TPC & TOF (a la' Yifei)
cdac45d3 503 // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified
504 Int_t TPCinfo=0;
505
506 if(fTPC && CheckStatus(track,"TPC")) {
507 TPCinfo=1;
228f3aba 508 if(fAsym){
509 if(!TPCRawAsym(track,specie)) TPCinfo=-1;
510 }else{
511 if(specie==2 && !IsPionRaw(track,"TPC")) TPCinfo=-1;
512 if(specie==3 && !IsKaonRaw(track,"TPC")) TPCinfo=-1;
513 if(specie==4 && !IsProtonRaw(track,"TPC")) TPCinfo=-1;
514 }
515 }
516
79f3c225 517 Int_t TOFinfo=1;
cdac45d3 518 if(fTOF){
519 if(fTPC && !CheckStatus(track,"TOF")) return TPCinfo;
228f3aba 520
521 if(specie==2 && !IsPionRaw(track,"TOF")) TOFinfo=-1;
522 if(specie==3 && !IsKaonRaw(track,"TOF")) TOFinfo=-1;
523 if(specie==4 && !IsProtonRaw(track,"TOF")) TOFinfo=-1;
cdac45d3 524 }
79f3c225 525 if(TOFinfo==1 && TPCinfo==1) return 1;
228f3aba 526
228f3aba 527 return -1;
528
cdac45d3 529}
228f3aba 530
531 if(mode==3){
532 //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.)
533 // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified
534
cdac45d3 535 if(fTPC && fTOF) if(!CheckStatus(track,"TPC") && !CheckStatus(track,"TOF")) return 0;
228f3aba 536
537 Double_t ptrack=track->P();
538
539
540 Int_t TPCinfo=-1;
541
cdac45d3 542 if(ptrack<fPLimit[0] && fTPC) {
228f3aba 543 if(!CheckStatus(track,"TPC")) return 0;
544 if(fAsym) {
545 if(TPCRawAsym(track,specie)) TPCinfo=1;
546 }else{
547 if(specie==2 && IsPionRaw(track,"TPC")) TPCinfo=1;
548 if(specie==3 && IsKaonRaw(track,"TPC")) TPCinfo=1;
549 if(specie==4 && IsProtonRaw(track,"TPC")) TPCinfo=1;
550 }
551 return TPCinfo;
552 }
553
554 Int_t TOFinfo=-1;
cdac45d3 555 if(ptrack>=fPLimit[0] && fTOF){
228f3aba 556 if(!CheckStatus(track,"TOF")) return 0;
557 if(specie==2 && IsPionRaw(track,"TOF")) TOFinfo=1;
558 if(specie==3 && IsKaonRaw(track,"TOF")) TOFinfo=1;
559 if(specie==4 && IsProtonRaw(track,"TOF")) TOFinfo=1;
560 return TOFinfo;
561 }
562
563 }
564
565 return -1;
cdac45d3 566
567}
568//----------------------------------
569Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){
570 if(fMatch>0){
571 return MatchTPCTOF(track,fMatch,specie,fCompat); //clarify
572 }else{
573 if(fTPC && !fTOF && !fITS) {
79f3c225 574 if(ApplyPidTPCRaw(track,specie)==specie){return 1;}else{return ApplyPidTPCRaw(track,specie);};
cdac45d3 575 }else{
576 AliError("You should enable just one detector if you don't want to match");
577 return 0;
578 }
579 if(fTOF && !fTPC && !fITS) {
79f3c225 580 if(ApplyPidTOFRaw(track,specie)==specie){return 1;}else{return ApplyPidTPCRaw(track,specie);};
cdac45d3 581 }else{
582 AliError("You should enable just one detector if you don't want to match");
583 return 0;
584 }
585
586 if(fITS && !fTPC && !fTOF) {
79f3c225 587 if(ApplyPidITSRaw(track,specie)==specie){return 1;}else{return ApplyPidTPCRaw(track,specie);};
cdac45d3 588 }else{
589 AliError("You should enable just one detector if you don't want to match");
590 return 0;
591 }
592 }
593
228f3aba 594}