1 /**************************************************************************
2 * Copyright(c) 1998-2006, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
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 * *************************************************************************/
19 //***********************************************************
21 // class for PID with AliAODRecoDecayHF
22 // 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 P. Antonioli pietro.antonioli@bo.infn.it
23 //***********************************************************
26 #include "AliAODPidHF.h"
27 #include "AliAODPid.h"
29 #include "AliPIDResponse.h"
30 #include "AliAODpidUtil.h"
31 #include "AliESDtrack.h"
36 //------------------------------
37 AliAODPidHF::AliAODPidHF():
63 fPtThresholdTPC(999999.),
65 fPidCombined(new AliPIDCombined())
68 // Default constructor
70 fPLimit=new Double_t[fnPLimit];
71 fnSigma=new Double_t[fnNSigma];
72 fPriors=new Double_t[fnPriors];
73 fnSigmaCompat=new Double_t[fnNSigmaCompat];
75 for(Int_t i=0;i<fnNSigma;i++){
78 for(Int_t i=0;i<fnPriors;i++){
81 for(Int_t i=0;i<fnPLimit;i++){
84 for(Int_t i=0;i<fnNSigmaCompat;i++){
89 //----------------------
90 AliAODPidHF::~AliAODPidHF()
93 // if(fPLimit) delete fPLimit;
94 // if(fnSigma) delete fnSigma;
95 // if(fPriors) delete fPriors;
97 //------------------------
98 AliAODPidHF::AliAODPidHF(const AliAODPidHF& pid) :
100 fnNSigma(pid.fnNSigma),
102 fTOFSigma(pid.fTOFSigma),
103 fnPriors(pid.fnPriors),
105 fnPLimit(pid.fnPLimit),
113 fCompat(pid.fCompat),
114 fPCompatTOF(pid.fPCompatTOF),
115 fnNSigmaCompat(pid.fnNSigmaCompat),
116 fnSigmaCompat(pid.fnSigmaCompat),
118 fOnePad(pid.fOnePad),
119 fMCLowEn2011(pid.fMCLowEn2011),
120 fppLowEn2011(pid.fppLowEn2011),
122 fTOFdecide(pid.fTOFdecide),
123 fOldPid(pid.fOldPid),
124 fPtThresholdTPC(pid.fPtThresholdTPC),
125 fPidResponse(pid.fPidResponse),
126 fPidCombined(pid.fPidCombined)
129 fnSigma = new Double_t[fnNSigma];
130 for(Int_t i=0;i<fnNSigma;i++){
131 fnSigma[i]=pid.fnSigma[i];
133 fPriors = new Double_t[fnPriors];
134 for(Int_t i=0;i<fnPriors;i++){
135 fPriors[i]=pid.fPriors[i];
137 fPLimit = new Double_t[fnPLimit];
138 for(Int_t i=0;i<fnPLimit;i++){
139 fPLimit[i]=pid.fPLimit[i];
143 //fPidResponse = new AliPIDResponse(*(pid.fPidResponse));
144 //fPidCombined = new AliPIDCombined(*(pid.fPidCombined));
147 //----------------------
148 Int_t AliAODPidHF::RawSignalPID(AliAODTrack *track, TString detector) const{
149 // raw PID for single detectors, returns the particle type with smaller sigma
151 if(detector.Contains("ITS")) return ApplyPidITSRaw(track,specie);
152 if(detector.Contains("TPC")) return ApplyPidTPCRaw(track,specie);
153 if(detector.Contains("TOF")) return ApplyPidTOFRaw(track,specie);
158 //---------------------------
159 Bool_t AliAODPidHF::IsKaonRaw(AliAODTrack *track, TString detector) const{
160 // checks if the track can be a kaon, raw PID applied for single detectors
163 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,3);
164 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,3);
165 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,3);
167 if(specie==3) return kTRUE;
170 //---------------------------
171 Bool_t AliAODPidHF::IsPionRaw (AliAODTrack *track, TString detector) const{
172 // checks if the track can be a pion, raw PID applied for single detectors
176 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,2);
177 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,2);
178 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,2);
180 if(specie==2) return kTRUE;
183 //---------------------------
184 Bool_t AliAODPidHF::IsProtonRaw (AliAODTrack *track, TString detector) const{
185 // checks if the track can be a proton raw PID applied for single detectors
188 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,4);
189 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,4);
190 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,4);
192 if(specie==4) return kTRUE;
196 //--------------------------
197 Bool_t AliAODPidHF::IsElectronRaw(AliAODTrack *track, TString detector) const{
198 // checks if the track can be an electron raw PID applied for single detectors
201 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,0);
202 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,0);
203 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,0);
205 if(specie==0) return kTRUE;
209 //--------------------------
210 Int_t AliAODPidHF::ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const{
211 // n-sigma cut, TPC PID
213 if(!CheckStatus(track,"TPC")) return 0;
216 AliAODPid *pidObj = track->GetDetPid();
218 Double_t dedx=pidObj->GetTPCsignal();
219 Double_t mom = pidObj->GetTPCmomentum();
220 if(mom>fPtThresholdTPC) return 0;
221 AliTPCPIDResponse tpcResponse;
222 SetBetheBloch(tpcResponse);
223 UShort_t nTPCClus=pidObj->GetTPCsignalN();
224 if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
226 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
227 Double_t nsigmaMax=fnSigma[0];
228 for(Int_t ipart=0;ipart<5;ipart++){
229 AliPID::EParticleType type=AliPID::EParticleType(ipart);
230 Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,nTPCClus,type));
231 if((nsigma<nsigmaMax) && (nsigma<fnSigma[0])) {
236 }else{ // asks only for one particle specie
237 AliPID::EParticleType type=AliPID::EParticleType(specie);
238 Double_t nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,nTPCClus,type));
239 if (nsigma>fnSigma[0]) {
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
247 Double_t nsigmaMax=fnSigma[0];
248 for(Int_t ipart=0;ipart<5;ipart++){
249 AliPID::EParticleType type=AliPID::EParticleType(ipart);
250 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type));
251 if((nsigma<nsigmaMax) && (nsigma<fnSigma[0])) {
256 }else{ // asks only for one particle specie
257 AliPID::EParticleType type=AliPID::EParticleType(specie);
258 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type));
259 if (nsigma>fnSigma[0]) {
271 //----------------------------
272 Int_t AliAODPidHF::ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const{
273 // truncated mean, ITS PID
275 if(!CheckStatus(track,"ITS")) return 0;
279 Double_t mom=track->P();
280 AliAODPid *pidObj = track->GetDetPid();
282 Double_t dedx=pidObj->GetITSsignal();
283 UChar_t clumap=track->GetITSClusterMap();
284 Int_t nPointsForPid=0;
285 for(Int_t i=2; i<6; i++){
286 if(clumap&(1<<i)) ++nPointsForPid;
290 if(track->GetStatus() & AliESDtrack::kTPCin) isSA = kFALSE;
292 AliITSPIDResponse itsResponse;
293 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
294 Double_t nsigmaMax=fnSigma[4];
295 for(Int_t ipart=0;ipart<5;ipart++){
296 AliPID::EParticleType type=AliPID::EParticleType(ipart);
297 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type,nPointsForPid,isSA));
298 if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) {
303 }else{ // asks only for one particle specie
304 AliPID::EParticleType type=AliPID::EParticleType(specie);
305 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type));
306 if (nsigma>fnSigma[4]) {
314 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
315 Double_t nsigmaMax=fnSigma[4];
316 for(Int_t ipart=0;ipart<5;ipart++){
317 AliPID::EParticleType type=AliPID::EParticleType(ipart);
318 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type));
319 if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) {
324 }else{ // asks only for one particle specie
325 AliPID::EParticleType type=AliPID::EParticleType(specie);
326 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type));
327 if (nsigma>fnSigma[4]) {
337 //----------------------------
338 Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{
339 // n-sigma cut, TOF PID
341 if(!CheckStatus(track,"TOF")) return 0;
343 Double_t time[AliPID::kSPECIESN];
344 Double_t sigmaTOFPid[AliPID::kSPECIES];
345 AliAODPid *pidObj = track->GetDetPid();
346 pidObj->GetIntegratedTimes(time);
347 Double_t sigTOF=pidObj->GetTOFsignal();
348 pidObj->GetTOFpidResolution(sigmaTOFPid);
353 Double_t sigmaTOFtrack;
354 if (sigmaTOFPid[4]>0) sigmaTOFtrack=sigmaTOFPid[4];
355 else sigmaTOFtrack=fTOFSigma;
356 Double_t nsigmaMax=sigmaTOFtrack*fnSigma[3];
357 for(Int_t ipart=0;ipart<5;ipart++){
358 Double_t nsigma=TMath::Abs(sigTOF-time[ipart]);
359 if (sigmaTOFPid[ipart]>0) sigmaTOFtrack=sigmaTOFPid[ipart];
360 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
361 if((nsigma<nsigmaMax) && (nsigma<fnSigma[3]*sigmaTOFtrack)) {
366 }else{ // asks only for one particle specie
367 Double_t nsigma=TMath::Abs(sigTOF-time[specie]);
368 Double_t sigmaTOFtrack;
369 if (sigmaTOFPid[specie]>0) sigmaTOFtrack=sigmaTOFPid[specie];
370 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
371 if (nsigma>fnSigma[3]*sigmaTOFtrack) {
380 //------------------------------
381 void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{
382 // combined PID stored inside the AOD track
384 const Double_t *pid=track->PID();
387 for (Int_t i=0; i<10; i++) {
388 if (pid[i]>max) {k=i; max=pid[i];}
391 if(k==2) type[0]=kTRUE;
392 if(k==3) type[1]=kTRUE;
393 if(k==4) type[2]=kTRUE;
397 //--------------------
398 void AliAODPidHF::BayesianProbability(AliAODTrack *track,Double_t *pid) const{
399 // bayesian PID for single detectors or combined
401 if(fITS && !fTPC && !fTOF) {BayesianProbabilityITS(track,pid);return;}
402 if(fTPC && !fITS && !fTOF) {BayesianProbabilityTPC(track,pid);return;}
403 if(fTOF && !fITS && !fTPC) {BayesianProbabilityTOF(track,pid);return;}
405 Double_t probITS[5]={1.,1.,1.,1.,1.};
406 Double_t probTPC[5]={1.,1.,1.,1.,1.};
407 Double_t probTOF[5]={1.,1.,1.,1.,1.};
408 if(fITS) BayesianProbabilityITS(track,probITS);
409 if(fTPC) BayesianProbabilityTPC(track,probTPC);
410 if(fTOF) BayesianProbabilityTOF(track,probTOF);
411 Double_t probTot[5]={0.,0.,0.,0.,0.};
412 for(Int_t i=0;i<5;i++){
413 probTot[i]=probITS[i]*probTPC[i]*probTOF[i];
415 for(Int_t i2=0;i2<5;i2++){
416 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]);
422 //------------------------------------
423 void AliAODPidHF::BayesianProbabilityITS(AliAODTrack *track,Double_t *prob) const{
425 // bayesian PID for ITS
427 Double_t itspid[AliPID::kSPECIES];
428 pid.MakeITSPID(track,itspid);
429 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
430 if(fTOF || fTPC || fTRD){
431 prob[ind]=itspid[ind];
433 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]);
439 //------------------------------------
440 void AliAODPidHF::BayesianProbabilityTPC(AliAODTrack *track,Double_t *prob) const{
441 // bayesian PID for TPC
444 Double_t tpcpid[AliPID::kSPECIES];
445 pid.MakeTPCPID(track,tpcpid);
446 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
447 if(fTOF || fITS || fTRD){
448 prob[ind]=tpcpid[ind];
450 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]);
456 //------------------------------------
457 void AliAODPidHF::BayesianProbabilityTOF(AliAODTrack *track,Double_t *prob) const{
458 // bayesian PID for TOF
461 Double_t tofpid[AliPID::kSPECIES];
462 pid.MakeTOFPID(track,tofpid);
463 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
464 if(fTPC || fITS || fTRD){
465 prob[ind]=tofpid[ind];
467 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]);
473 //---------------------------------
474 void AliAODPidHF::BayesianProbabilityTRD(AliAODTrack *track,Double_t *prob) const{
475 // bayesian PID for TRD
478 Double_t trdpid[AliPID::kSPECIES];
479 pid.MakeTRDPID(track,trdpid);
480 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
481 if(fTPC || fITS || fTOF){
482 prob[ind]=trdpid[ind];
484 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]);
490 //--------------------------------
491 Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{
493 // Quality cuts on the tracks, detector by detector
495 if(detectors.Contains("ITS")){
496 if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE;
497 UChar_t clumap=track->GetITSClusterMap();
498 Int_t nPointsForPid=0;
499 for(Int_t i=2; i<6; i++){
500 if(clumap&(1<<i)) ++nPointsForPid;
502 if(nPointsForPid<3) return kFALSE;
505 if(detectors.Contains("TPC")){
506 if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE;
507 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
508 if (nTPCClus<70) return kFALSE;
511 if(detectors.Contains("TOF")){
512 if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE;
513 if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE;
514 if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE;
515 if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE;
519 if(detectors.Contains("TRD")){
520 if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE;
521 //UChar_t ntracklets = track->GetTRDntrackletsPID();
522 //if(ntracklets<4) return kFALSE;
527 //--------------------------------------------
528 Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{
529 // TPC nsigma cut PID, different sigmas in different p bins
531 if(!CheckStatus(track,"TPC")) return kFALSE;
532 AliAODPid *pidObj = track->GetDetPid();
533 Double_t mom = pidObj->GetTPCmomentum();
534 if(mom>fPtThresholdTPC) return 0;
535 Double_t nsigma=999.;
537 Double_t dedx=pidObj->GetTPCsignal();
538 UShort_t nTPCClus=pidObj->GetTPCsignalN();
539 if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
541 AliTPCPIDResponse tpcResponse;
542 SetBetheBloch(tpcResponse);
543 AliPID::EParticleType type=AliPID::EParticleType(specie);
544 nsigma = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,nTPCClus,type));
547 AliPID::EParticleType type=AliPID::EParticleType(specie);
548 nsigma = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type));
551 if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE;
552 if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE;
553 if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE;
558 Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track,Int_t mode,Int_t specie,Bool_t compat){
559 // combination of the PID info coming from TPC and TOF
561 //TOF || TPC (a la' Andrea R.)
563 // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible
564 // the method returns the sum of the response of the 2 detectors
565 if(fTPC && fTOF) {if(!CheckStatus(track,"TPC") && !CheckStatus(track,"TOF")) return 0;}
570 if(CheckStatus(track,"TPC")) {
572 if(TPCRawAsym(track,specie)) {
578 if(specie==2 && IsPionRaw(track,"TPC")) {
583 if(specie==3 && IsKaonRaw(track,"TPC")) {
588 if(specie==4 && IsProtonRaw(track,"TPC")) {
597 if(compat && tTPCinfo<0){
598 Double_t sig0tmp=fnSigma[0];
599 SetSigma(0,fnSigmaCompat[0]);
600 if(specie==2 && IsPionRaw(track,"TPC")) tTPCinfo=0;
601 if(specie==3 && IsKaonRaw(track,"TPC")) tTPCinfo=0;
602 if(specie==4 && IsProtonRaw(track,"TPC")) tTPCinfo=0;
611 if(!CheckStatus(track,"TOF") && fTPC) return tTPCinfo;
615 if(specie==2 && IsPionRaw(track,"TOF")) tTOFinfo=1;
616 if(specie==3 && IsKaonRaw(track,"TOF")) tTOFinfo=1;
617 if(specie==4 && IsProtonRaw(track,"TOF")) tTOFinfo=1;
619 if(compat && tTOFinfo>0){
620 Double_t ptrack=track->P();
621 if(ptrack>fPCompatTOF) {
622 Double_t sig0tmp=fnSigma[3];
623 SetSigma(3,fnSigmaCompat[1]);
624 if(specie==2 && IsPionRaw(track,"TOF")) tTOFinfo=0;
625 if(specie==3 && IsKaonRaw(track,"TOF")) tTOFinfo=0;
626 if(specie==4 && IsProtonRaw(track,"TOF")) tTOFinfo=0;
633 if(tTPCinfo+tTOFinfo==0 && fTOFdecide){
634 if(!CheckStatus(track,"TOF")) return tTPCinfo;
638 if(tTPCinfo+tTOFinfo==0 && fITS){
639 if(!CheckStatus(track,"ITS")) return tTPCinfo+tTOFinfo;
641 if(specie==2 && IsPionRaw(track,"ITS")) tITSinfo=1;
642 if(specie==3 && IsKaonRaw(track,"ITS")) tITSinfo=1;
643 if(specie==4 && IsProtonRaw(track,"ITS")) tITSinfo=1;
647 return tTPCinfo+tTOFinfo;
650 //TPC & TOF (a la' Yifei)
651 // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified
654 if(fTPC && CheckStatus(track,"TPC")) {
657 if(!TPCRawAsym(track,specie)) tTPCinfo=-1;
659 if(specie==2 && !IsPionRaw(track,"TPC")) tTPCinfo=-1;
660 if(specie==3 && !IsKaonRaw(track,"TPC")) tTPCinfo=-1;
661 if(specie==4 && !IsProtonRaw(track,"TPC")) tTPCinfo=-1;
667 if(fTPC && !CheckStatus(track,"TOF")) return tTPCinfo;
669 if(specie==2 && !IsPionRaw(track,"TOF")) tTOFinfo=-1;
670 if(specie==3 && !IsKaonRaw(track,"TOF")) tTOFinfo=-1;
671 if(specie==4 && !IsProtonRaw(track,"TOF")) tTOFinfo=-1;
674 if(tTOFinfo==1 && tTPCinfo==1) return 1;
676 if(tTPCinfo+tTOFinfo==0 && fITS){
677 if(!CheckStatus(track,"ITS")) return tTPCinfo+tTOFinfo;
679 if(specie==2 && IsPionRaw(track,"ITS")) tITSinfo=1;
680 if(specie==3 && IsKaonRaw(track,"ITS")) tITSinfo=1;
681 if(specie==4 && IsProtonRaw(track,"ITS")) tITSinfo=1;
690 //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.)
691 // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified
693 if(fTPC && fTOF) if(!CheckStatus(track,"TPC") && !CheckStatus(track,"TOF")) return 0;
695 Double_t ptrack=track->P();
700 if(ptrack>=fPLimit[0] && ptrack<fPLimit[1] && fTPC) {
701 if(!CheckStatus(track,"TPC")) return 0;
703 if(TPCRawAsym(track,specie)) tTPCinfo=1;
705 if(specie==2 && IsPionRaw(track,"TPC")) tTPCinfo=1;
706 if(specie==3 && IsKaonRaw(track,"TPC")) tTPCinfo=1;
707 if(specie==4 && IsProtonRaw(track,"TPC")) tTPCinfo=1;
713 if(ptrack>=fPLimit[1] && fTOF){
714 if(!CheckStatus(track,"TOF")) return 0;
715 if(specie==2 && IsPionRaw(track,"TOF")) tTOFinfo=1;
716 if(specie==3 && IsKaonRaw(track,"TOF")) tTOFinfo=1;
717 if(specie==4 && IsProtonRaw(track,"TOF")) tTOFinfo=1;
722 if(ptrack<fPLimit[0] && fITS){
723 if(!CheckStatus(track,"ITS")) return 0;
724 if(specie==2 && IsPionRaw(track,"ITS")) tITSinfo=1;
725 if(specie==3 && IsKaonRaw(track,"ITS")) tITSinfo=1;
726 if(specie==4 && IsProtonRaw(track,"ITS")) tITSinfo=1;
735 //----------------------------------
736 Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){
737 // general method to compute PID
739 return MatchTPCTOF(track,fMatch,specie,fCompat);
741 if(fTPC && !fTOF && !fITS) {
744 tTPCres=ApplyPidTPCRaw(track,specie);
746 if(TPCRawAsym(track,specie)) {
752 if(tTPCres==specie){return 1;}else{return tTPCres;};
754 AliError("You should enable just one detector if you don't want to match");
757 if(fTOF && !fTPC && !fITS) {
758 Int_t tTOFres=ApplyPidTOFRaw(track,specie);
759 if(tTOFres==specie){return 1;}else{return tTOFres;};
761 AliError("You should enable just one detector if you don't want to match");
765 if(fITS && !fTPC && !fTOF) {
766 Int_t tITSres=ApplyPidITSRaw(track,specie);
767 if(tITSres==specie){return 1;}else{return tITSres;};
769 AliError("You should enable just one detector if you don't want to match");
775 //--------------------------------------------
776 void AliAODPidHF::SetBetheBloch(AliTPCPIDResponse &tpcResp) const{
778 Double_t alephParameters[5];
782 if(fPbPb) { // PbPb MC
784 alephParameters[0] = 1.44405/50.;
785 alephParameters[1] = 2.35409e+01;
786 alephParameters[2] = TMath::Exp(-2.90330e+01);
787 alephParameters[3] = 2.10681e+00;
788 alephParameters[4] = 4.62254e+00;
792 alephParameters[0]=0.0207667;
793 alephParameters[1]=29.9936;
794 alephParameters[2]=3.87866e-11;
795 alephParameters[3]=2.17291;
796 alephParameters[4]=7.1623;
798 alephParameters[0]=0.029021;
799 alephParameters[1]=25.4181;
800 alephParameters[2]=4.66596e-08;
801 alephParameters[3]=1.90008;
802 alephParameters[4]=4.63783;
804 alephParameters[0] = 2.15898/50.;
805 alephParameters[1] = 1.75295e+01;
806 alephParameters[2] = 3.40030e-09;
807 alephParameters[3] = 1.96178e+00;
808 alephParameters[4] = 3.91720e+00;
812 } else { // Real Data
814 if(fOnePad) { // pp 1-pad (since LHC10d)
816 alephParameters[0] =1.34490e+00/50.;
817 alephParameters[1] = 2.69455e+01;
818 alephParameters[2] = TMath::Exp(-2.97552e+01);
819 alephParameters[3] = 2.35339e+00;
820 alephParameters[4] = 5.98079e+00;
822 } else if(fPbPb) { // PbPb
824 // alephParameters[0] = 1.25202/50.;
825 // alephParameters[1] = 2.74992e+01;
826 // alephParameters[2] = TMath::Exp(-3.31517e+01);
827 // alephParameters[3] = 2.46246;
828 // alephParameters[4] = 6.78938;
830 alephParameters[0] = 5.10207e+00/50.;
831 alephParameters[1] = 7.94982e+00;
832 alephParameters[2] = TMath::Exp(-9.07942e+00);
833 alephParameters[3] = 2.38808e+00;
834 alephParameters[4] = 1.68165e+00;
836 } else if(fppLowEn2011){ // pp low energy
838 alephParameters[0]=0.031642;
839 alephParameters[1]=22.353;
840 alephParameters[2]=4.16239e-12;
841 alephParameters[3]=2.61952;
842 alephParameters[4]=5.76086;
844 } else { // pp no 1-pad (LHC10bc)
846 alephParameters[0] = 0.0283086/0.97;
847 alephParameters[1] = 2.63394e+01;
848 alephParameters[2] = 5.04114e-11;
849 alephParameters[3] = 2.12543e+00;
850 alephParameters[4] = 4.88663e+00;
856 tpcResp.SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
862 //-----------------------
863 Bool_t AliAODPidHF::IsTOFPiKexcluded(AliAODTrack *track,Double_t nsigmaK){
866 if(!CheckStatus(track,"TOF")) return 0;
868 Double_t time[AliPID::kSPECIESN];
869 Double_t sigmaTOFPid[AliPID::kSPECIES];
870 AliAODPid *pidObj = track->GetDetPid();
871 pidObj->GetIntegratedTimes(time);
872 Double_t sigTOF=pidObj->GetTOFsignal();
873 pidObj->GetTOFpidResolution(sigmaTOFPid);
874 Double_t sigmaTOFtrack;
875 if (sigmaTOFPid[3]>0) sigmaTOFtrack=sigmaTOFPid[3];
876 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
878 if((sigTOF-time[3])>nsigmaK*sigmaTOFtrack)return kTRUE;// K, Pi excluded (->LIKELY A PROTON)
883 //--------------------------------------------------------------------------
884 void AliAODPidHF::SetPriorDistribution(AliPID::EParticleType type,TH1F *prior){
887 // method setting the prior distributions to the AliPIDCombined object of the AliAODPidHF data member
888 // all the checks are done directly in the AliPIDCombined object
891 GetPidCombined()->SetPriorDistribution(type,prior);
893 //--------------------------------------------------------------------------
894 void AliAODPidHF::DrawPrior(AliPID::EParticleType type){
897 // Drawing prior distribution for type "type"
900 GetPidCombined()->GetPriorDistribution(type)->Draw();
903 //--------------------------------------------------------------------------
904 Int_t AliAODPidHF::GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &sigma) const{
906 if(!CheckStatus(track,"TPC")) return -1;
908 Double_t nsigmaTPC=-999;
911 AliAODPid *pidObj = track->GetDetPid();
912 Double_t dedx=pidObj->GetTPCsignal();
913 Double_t mom = pidObj->GetTPCmomentum();
914 if(mom>fPtThresholdTPC) return -2;
915 AliTPCPIDResponse tpcResponse;
916 SetBetheBloch(tpcResponse);
917 UShort_t nTPCClus=pidObj->GetTPCsignalN();
918 if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
919 AliPID::EParticleType type=AliPID::EParticleType(species);
920 nsigmaTPC = TMath::Abs(tpcResponse.GetNumberOfSigmas(mom,dedx,nTPCClus,type));
924 AliPID::EParticleType type=AliPID::EParticleType(species);
925 nsigmaTPC = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type));
931 //-----------------------------
933 Int_t AliAODPidHF::GetnSigmaTOF(AliAODTrack *track,Int_t species, Double_t &sigma) const{
935 if(!CheckStatus(track,"TOF")) return -1.;
937 Double_t time[AliPID::kSPECIESN];
938 Double_t sigmaTOFPid[AliPID::kSPECIES];
939 AliAODPid *pidObj = track->GetDetPid();
940 pidObj->GetIntegratedTimes(time);
941 Double_t sigTOF=pidObj->GetTOFsignal();
942 pidObj->GetTOFpidResolution(sigmaTOFPid);
944 if(sigmaTOFPid[species]<1e-99) return -2;
946 Double_t sigmaTOF=TMath::Abs(sigTOF-time[species])/sigmaTOFPid[species];
951 //-----------------------------