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