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()),
66 fTPCResponse(new AliTPCPIDResponse())
69 // Default constructor
71 fPLimit=new Double_t[fnPLimit];
72 fnSigma=new Double_t[fnNSigma];
73 fPriors=new Double_t[fnPriors];
74 fnSigmaCompat=new Double_t[fnNSigmaCompat];
76 for(Int_t i=0;i<fnNSigma;i++){
79 for(Int_t i=0;i<fnPriors;i++){
82 for(Int_t i=0;i<fnPLimit;i++){
85 for(Int_t i=0;i<fnNSigmaCompat;i++){
90 //----------------------
91 AliAODPidHF::~AliAODPidHF()
94 // if(fPLimit) delete fPLimit;
95 // if(fnSigma) delete fnSigma;
96 // if(fPriors) delete fPriors;
99 //------------------------
100 AliAODPidHF::AliAODPidHF(const AliAODPidHF& pid) :
102 fnNSigma(pid.fnNSigma),
104 fTOFSigma(pid.fTOFSigma),
105 fnPriors(pid.fnPriors),
107 fnPLimit(pid.fnPLimit),
115 fCompat(pid.fCompat),
116 fPCompatTOF(pid.fPCompatTOF),
117 fnNSigmaCompat(pid.fnNSigmaCompat),
118 fnSigmaCompat(pid.fnSigmaCompat),
120 fOnePad(pid.fOnePad),
121 fMCLowEn2011(pid.fMCLowEn2011),
122 fppLowEn2011(pid.fppLowEn2011),
124 fTOFdecide(pid.fTOFdecide),
125 fOldPid(pid.fOldPid),
126 fPtThresholdTPC(pid.fPtThresholdTPC),
127 fPidResponse(pid.fPidResponse),
128 fPidCombined(pid.fPidCombined),
132 fnSigma = new Double_t[fnNSigma];
133 for(Int_t i=0;i<fnNSigma;i++){
134 fnSigma[i]=pid.fnSigma[i];
136 fPriors = new Double_t[fnPriors];
137 for(Int_t i=0;i<fnPriors;i++){
138 fPriors[i]=pid.fPriors[i];
140 fPLimit = new Double_t[fnPLimit];
141 for(Int_t i=0;i<fnPLimit;i++){
142 fPLimit[i]=pid.fPLimit[i];
145 if(pid.fTPCResponse) fTPCResponse = new AliTPCPIDResponse(*(pid.fTPCResponse));
146 //fPidResponse = new AliPIDResponse(*(pid.fPidResponse));
147 //fPidCombined = new AliPIDCombined(*(pid.fPidCombined));
150 //----------------------
151 Int_t AliAODPidHF::RawSignalPID(AliAODTrack *track, TString detector) const{
152 // raw PID for single detectors, returns the particle type with smaller sigma
154 if(detector.Contains("ITS")) return ApplyPidITSRaw(track,specie);
155 if(detector.Contains("TPC")) return ApplyPidTPCRaw(track,specie);
156 if(detector.Contains("TOF")) return ApplyPidTOFRaw(track,specie);
161 //---------------------------
162 Bool_t AliAODPidHF::IsKaonRaw(AliAODTrack *track, TString detector) const{
163 // checks if the track can be a kaon, raw PID applied for single detectors
166 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,3);
167 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,3);
168 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,3);
170 if(specie==3) return kTRUE;
173 //---------------------------
174 Bool_t AliAODPidHF::IsPionRaw (AliAODTrack *track, TString detector) const{
175 // checks if the track can be a pion, raw PID applied for single detectors
179 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,2);
180 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,2);
181 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,2);
183 if(specie==2) return kTRUE;
186 //---------------------------
187 Bool_t AliAODPidHF::IsProtonRaw (AliAODTrack *track, TString detector) const{
188 // checks if the track can be a proton raw PID applied for single detectors
191 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,4);
192 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,4);
193 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,4);
195 if(specie==4) return kTRUE;
199 //--------------------------
200 Bool_t AliAODPidHF::IsElectronRaw(AliAODTrack *track, TString detector) const{
201 // checks if the track can be an electron raw PID applied for single detectors
204 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,0);
205 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,0);
206 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,0);
208 if(specie==0) return kTRUE;
212 //--------------------------
213 Int_t AliAODPidHF::ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const{
214 // n-sigma cut, TPC PID
216 if(!CheckTPCPIDStatus(track)) return 0;
219 AliAODPid *pidObj = track->GetDetPid();
221 Double_t dedx=pidObj->GetTPCsignal();
222 Double_t mom = pidObj->GetTPCmomentum();
223 if(mom>fPtThresholdTPC) return 0;
224 UShort_t nTPCClus=pidObj->GetTPCsignalN();
225 if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
227 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
228 Double_t nsigmaMax=fnSigma[0];
229 for(Int_t ipart=0;ipart<5;ipart++){
230 AliPID::EParticleType type=AliPID::EParticleType(ipart);
231 Double_t nsigma = TMath::Abs(fTPCResponse->GetNumberOfSigmas(mom,dedx,nTPCClus,type));
232 if((nsigma<nsigmaMax) && (nsigma<fnSigma[0])) {
237 }else{ // asks only for one particle specie
238 AliPID::EParticleType type=AliPID::EParticleType(specie);
239 Double_t nsigma = TMath::Abs(fTPCResponse->GetNumberOfSigmas(mom,dedx,nTPCClus,type));
240 if (nsigma>fnSigma[0]) {
247 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
248 Double_t nsigmaMax=fnSigma[0];
249 for(Int_t ipart=0;ipart<5;ipart++){
250 AliPID::EParticleType type=AliPID::EParticleType(ipart);
251 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type));
252 if((nsigma<nsigmaMax) && (nsigma<fnSigma[0])) {
257 }else{ // asks only for one particle specie
258 AliPID::EParticleType type=AliPID::EParticleType(specie);
259 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type));
260 if (nsigma>fnSigma[0]) {
272 //----------------------------
273 Int_t AliAODPidHF::ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const{
274 // truncated mean, ITS PID
276 if(!CheckITSPIDStatus(track)) return 0;
280 Double_t mom=track->P();
281 AliAODPid *pidObj = track->GetDetPid();
283 Double_t dedx=pidObj->GetITSsignal();
284 UChar_t clumap=track->GetITSClusterMap();
285 Int_t nPointsForPid=0;
286 for(Int_t i=2; i<6; i++){
287 if(clumap&(1<<i)) ++nPointsForPid;
291 if(track->GetStatus() & AliESDtrack::kTPCin) isSA = kFALSE;
293 AliITSPIDResponse itsResponse;
294 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
295 Double_t nsigmaMax=fnSigma[4];
296 for(Int_t ipart=0;ipart<5;ipart++){
297 AliPID::EParticleType type=AliPID::EParticleType(ipart);
298 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type,nPointsForPid,isSA));
299 if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) {
304 }else{ // asks only for one particle specie
305 AliPID::EParticleType type=AliPID::EParticleType(specie);
306 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type));
307 if (nsigma>fnSigma[4]) {
315 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
316 Double_t nsigmaMax=fnSigma[4];
317 for(Int_t ipart=0;ipart<5;ipart++){
318 AliPID::EParticleType type=AliPID::EParticleType(ipart);
319 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type));
320 if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) {
325 }else{ // asks only for one particle specie
326 AliPID::EParticleType type=AliPID::EParticleType(specie);
327 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type));
328 if (nsigma>fnSigma[4]) {
338 //----------------------------
339 Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{
340 // n-sigma cut, TOF PID
342 if(!CheckTOFPIDStatus(track)) return 0;
344 Double_t time[AliPID::kSPECIESN];
345 Double_t sigmaTOFPid[AliPID::kSPECIES];
346 AliAODPid *pidObj = track->GetDetPid();
347 pidObj->GetIntegratedTimes(time);
348 Double_t sigTOF=pidObj->GetTOFsignal();
349 pidObj->GetTOFpidResolution(sigmaTOFPid);
354 Double_t sigmaTOFtrack;
355 if (sigmaTOFPid[4]>0) sigmaTOFtrack=sigmaTOFPid[4];
356 else sigmaTOFtrack=fTOFSigma;
357 Double_t nsigmaMax=sigmaTOFtrack*fnSigma[3];
358 for(Int_t ipart=0;ipart<5;ipart++){
359 Double_t nsigma=TMath::Abs(sigTOF-time[ipart]);
360 if (sigmaTOFPid[ipart]>0) sigmaTOFtrack=sigmaTOFPid[ipart];
361 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
362 if((nsigma<nsigmaMax) && (nsigma<fnSigma[3]*sigmaTOFtrack)) {
367 }else{ // asks only for one particle specie
368 Double_t nsigma=TMath::Abs(sigTOF-time[specie]);
369 Double_t sigmaTOFtrack;
370 if (sigmaTOFPid[specie]>0) sigmaTOFtrack=sigmaTOFPid[specie];
371 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
372 if (nsigma>fnSigma[3]*sigmaTOFtrack) {
381 //------------------------------
382 void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{
383 // combined PID stored inside the AOD track
385 const Double_t *pid=track->PID();
388 for (Int_t i=0; i<10; i++) {
389 if (pid[i]>max) {k=i; max=pid[i];}
392 if(k==2) type[0]=kTRUE;
393 if(k==3) type[1]=kTRUE;
394 if(k==4) type[2]=kTRUE;
398 //--------------------
399 void AliAODPidHF::BayesianProbability(AliAODTrack *track,Double_t *pid) const{
400 // bayesian PID for single detectors or combined
402 if(fITS && !fTPC && !fTOF) {BayesianProbabilityITS(track,pid);return;}
403 if(fTPC && !fITS && !fTOF) {BayesianProbabilityTPC(track,pid);return;}
404 if(fTOF && !fITS && !fTPC) {BayesianProbabilityTOF(track,pid);return;}
406 Double_t probITS[5]={1.,1.,1.,1.,1.};
407 Double_t probTPC[5]={1.,1.,1.,1.,1.};
408 Double_t probTOF[5]={1.,1.,1.,1.,1.};
409 if(fITS) BayesianProbabilityITS(track,probITS);
410 if(fTPC) BayesianProbabilityTPC(track,probTPC);
411 if(fTOF) BayesianProbabilityTOF(track,probTOF);
412 Double_t probTot[5]={0.,0.,0.,0.,0.};
413 for(Int_t i=0;i<5;i++){
414 probTot[i]=probITS[i]*probTPC[i]*probTOF[i];
416 for(Int_t i2=0;i2<5;i2++){
417 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]);
423 //------------------------------------
424 void AliAODPidHF::BayesianProbabilityITS(AliAODTrack *track,Double_t *prob) const{
426 // bayesian PID for ITS
428 Double_t itspid[AliPID::kSPECIES];
429 pid.MakeITSPID(track,itspid);
430 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
431 if(fTOF || fTPC || fTRD){
432 prob[ind]=itspid[ind];
434 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]);
440 //------------------------------------
441 void AliAODPidHF::BayesianProbabilityTPC(AliAODTrack *track,Double_t *prob) const{
442 // bayesian PID for TPC
445 Double_t tpcpid[AliPID::kSPECIES];
446 pid.MakeTPCPID(track,tpcpid);
447 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
448 if(fTOF || fITS || fTRD){
449 prob[ind]=tpcpid[ind];
451 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]);
457 //------------------------------------
458 void AliAODPidHF::BayesianProbabilityTOF(AliAODTrack *track,Double_t *prob) const{
459 // bayesian PID for TOF
462 Double_t tofpid[AliPID::kSPECIES];
463 pid.MakeTOFPID(track,tofpid);
464 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
465 if(fTPC || fITS || fTRD){
466 prob[ind]=tofpid[ind];
468 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]);
474 //---------------------------------
475 void AliAODPidHF::BayesianProbabilityTRD(AliAODTrack *track,Double_t *prob) const{
476 // bayesian PID for TRD
479 Double_t trdpid[AliPID::kSPECIES];
480 pid.MakeTRDPID(track,trdpid);
481 for(Int_t ind=0;ind<AliPID::kSPECIES;ind++){
482 if(fTPC || fITS || fTOF){
483 prob[ind]=trdpid[ind];
485 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]);
491 //--------------------------------
492 Bool_t AliAODPidHF::CheckITSPIDStatus(AliAODTrack *track) const{
493 // ITS PID quality cuts
494 if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE;
495 UChar_t clumap=track->GetITSClusterMap();
496 Int_t nPointsForPid=0;
497 for(Int_t i=2; i<6; i++){
498 if(clumap&(1<<i)) ++nPointsForPid;
500 if(nPointsForPid<3) return kFALSE;
503 //--------------------------------
504 Bool_t AliAODPidHF::CheckTPCPIDStatus(AliAODTrack *track) const{
505 // TPC PID quality cuts
506 if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE;
507 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
508 if (nTPCClus<70) return kFALSE;
511 //--------------------------------
512 Bool_t AliAODPidHF::CheckTOFPIDStatus(AliAODTrack *track) const{
513 // TOF PID quality cuts
514 if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE;
515 if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE;
516 if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE;
517 if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE;
520 //--------------------------------
521 Bool_t AliAODPidHF::CheckTRDPIDStatus(AliAODTrack *track) const{
522 // TRD PID quality cuts
523 if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE;
526 //--------------------------------
527 Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{
529 // Quality cuts on the tracks, detector by detector
531 if(detectors.Contains("ITS")){
532 if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE;
533 UChar_t clumap=track->GetITSClusterMap();
534 Int_t nPointsForPid=0;
535 for(Int_t i=2; i<6; i++){
536 if(clumap&(1<<i)) ++nPointsForPid;
538 if(nPointsForPid<3) return kFALSE;
541 if(detectors.Contains("TPC")){
542 if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE;
543 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
544 if (nTPCClus<70) return kFALSE;
547 if(detectors.Contains("TOF")){
548 if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE;
549 if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE;
550 if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE;
551 if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE;
555 if(detectors.Contains("TRD")){
556 if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE;
557 //UChar_t ntracklets = track->GetTRDntrackletsPID();
558 //if(ntracklets<4) return kFALSE;
563 //--------------------------------------------
564 Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{
565 // TPC nsigma cut PID, different sigmas in different p bins
567 if(!CheckTPCPIDStatus(track)) return kFALSE;
568 AliAODPid *pidObj = track->GetDetPid();
569 Double_t mom = pidObj->GetTPCmomentum();
570 if(mom>fPtThresholdTPC) return 0;
571 Double_t nsigma=999.;
573 Double_t dedx=pidObj->GetTPCsignal();
574 UShort_t nTPCClus=pidObj->GetTPCsignalN();
575 if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
577 AliPID::EParticleType type=AliPID::EParticleType(specie);
578 nsigma = TMath::Abs(fTPCResponse->GetNumberOfSigmas(mom,dedx,nTPCClus,type));
581 AliPID::EParticleType type=AliPID::EParticleType(specie);
582 nsigma = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type));
585 if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE;
586 if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE;
587 if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE;
592 Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track, Int_t specie){
593 // combination of the PID info coming from TPC and TOF
595 Bool_t okTPC=CheckTPCPIDStatus(track);
596 Bool_t okTOF=CheckTOFPIDStatus(track);
599 //TOF || TPC (a la' Andrea R.)
601 // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible
602 // the method returns the sum of the response of the 2 detectors
605 if(!okTPC && !okTOF) return 0;
612 if(TPCRawAsym(track,specie)) tTPCinfo=1;
614 if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
616 if(fCompat && tTPCinfo<0){
617 Double_t sig0tmp=fnSigma[0];
618 SetSigma(0,fnSigmaCompat[0]);
619 if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=0;
626 if(!okTOF && fTPC) return tTPCinfo;
628 if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
629 if(fCompat && tTOFinfo>0){
630 Double_t ptrack=track->P();
631 if(ptrack>fPCompatTOF) {
632 Double_t sig0tmp=fnSigma[3];
633 SetSigma(3,fnSigmaCompat[1]);
634 if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=0;
641 if(tTPCinfo+tTOFinfo==0 && fTOFdecide){
642 if(!okTOF) return tTPCinfo;
646 if(tTPCinfo+tTOFinfo==0 && fITS){
647 if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
649 if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
652 return tTPCinfo+tTOFinfo;
656 //TPC & TOF (a la' Yifei)
657 // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified
663 if(!TPCRawAsym(track,specie)) tTPCinfo=-1;
665 if(ApplyPidTPCRaw(track,specie)!=specie) tTPCinfo=-1;
671 if(fTPC && !okTOF) return tTPCinfo;
672 if(ApplyPidTPCRaw(track,specie)!=specie) tTOFinfo=-1;
675 if(tTOFinfo==1 && tTPCinfo==1) return 1;
677 if(tTPCinfo+tTOFinfo==0 && fITS){
678 if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
680 if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
687 //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.)
688 // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified
689 if(fTPC && fTOF) if(!okTPC && !okTOF) return 0;
691 Double_t ptrack=track->P();
694 if(ptrack>=fPLimit[0] && ptrack<fPLimit[1] && fTPC) {
697 if(TPCRawAsym(track,specie)) tTPCinfo=1;
699 if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
705 if(ptrack>=fPLimit[1] && fTOF){
707 if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
712 if(ptrack<fPLimit[0] && fITS){
713 if(!CheckITSPIDStatus(track)) return 0;
714 if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
722 //----------------------------------
723 Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){
724 // general method to compute PID
726 return MatchTPCTOF(track,specie);
728 if(fTPC && !fTOF && !fITS) {
731 tTPCres=ApplyPidTPCRaw(track,specie);
732 if(tTPCres==specie) return 1;
735 if(TPCRawAsym(track,specie)) tTPCres=1;
739 }else if(fTOF && !fTPC && !fITS) {
740 Int_t tTOFres=ApplyPidTOFRaw(track,specie);
741 if(tTOFres==specie) return 1;
743 }else if(fITS && !fTPC && !fTOF) {
744 Int_t tITSres=ApplyPidITSRaw(track,specie);
745 if(tITSres==specie) return 1;
748 AliError("You should enable just one detector if you don't want to match");
753 //--------------------------------------------
754 void AliAODPidHF::GetTPCBetheBlochParams(Double_t alephParameters[5]) const {
755 // TPC bethe bloch parameters
758 if(fPbPb) { // PbPb MC
760 alephParameters[0] = 1.44405/50.;
761 alephParameters[1] = 2.35409e+01;
762 alephParameters[2] = TMath::Exp(-2.90330e+01);
763 alephParameters[3] = 2.10681e+00;
764 alephParameters[4] = 4.62254e+00;
768 alephParameters[0]=0.0207667;
769 alephParameters[1]=29.9936;
770 alephParameters[2]=3.87866e-11;
771 alephParameters[3]=2.17291;
772 alephParameters[4]=7.1623;
774 alephParameters[0]=0.029021;
775 alephParameters[1]=25.4181;
776 alephParameters[2]=4.66596e-08;
777 alephParameters[3]=1.90008;
778 alephParameters[4]=4.63783;
780 alephParameters[0] = 2.15898/50.;
781 alephParameters[1] = 1.75295e+01;
782 alephParameters[2] = 3.40030e-09;
783 alephParameters[3] = 1.96178e+00;
784 alephParameters[4] = 3.91720e+00;
788 } else { // Real Data
790 if(fOnePad) { // pp 1-pad (since LHC10d)
792 alephParameters[0] =1.34490e+00/50.;
793 alephParameters[1] = 2.69455e+01;
794 alephParameters[2] = TMath::Exp(-2.97552e+01);
795 alephParameters[3] = 2.35339e+00;
796 alephParameters[4] = 5.98079e+00;
798 } else if(fPbPb) { // PbPb
800 // alephParameters[0] = 1.25202/50.;
801 // alephParameters[1] = 2.74992e+01;
802 // alephParameters[2] = TMath::Exp(-3.31517e+01);
803 // alephParameters[3] = 2.46246;
804 // alephParameters[4] = 6.78938;
806 alephParameters[0] = 5.10207e+00/50.;
807 alephParameters[1] = 7.94982e+00;
808 alephParameters[2] = TMath::Exp(-9.07942e+00);
809 alephParameters[3] = 2.38808e+00;
810 alephParameters[4] = 1.68165e+00;
812 } else if(fppLowEn2011){ // pp low energy
814 alephParameters[0]=0.031642;
815 alephParameters[1]=22.353;
816 alephParameters[2]=4.16239e-12;
817 alephParameters[3]=2.61952;
818 alephParameters[4]=5.76086;
820 } else { // pp no 1-pad (LHC10bc)
822 alephParameters[0] = 0.0283086/0.97;
823 alephParameters[1] = 2.63394e+01;
824 alephParameters[2] = 5.04114e-11;
825 alephParameters[3] = 2.12543e+00;
826 alephParameters[4] = 4.88663e+00;
834 //-----------------------
835 void AliAODPidHF::SetBetheBloch() {
836 // Set Bethe Bloch Parameters
838 Double_t alephParameters[5];
839 GetTPCBetheBlochParams(alephParameters);
840 fTPCResponse->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
844 //-----------------------
845 Bool_t AliAODPidHF::IsTOFPiKexcluded(AliAODTrack *track,Double_t nsigmaK){
848 if(!CheckTOFPIDStatus(track)) return 0;
850 Double_t time[AliPID::kSPECIESN];
851 Double_t sigmaTOFPid[AliPID::kSPECIES];
852 AliAODPid *pidObj = track->GetDetPid();
853 pidObj->GetIntegratedTimes(time);
854 Double_t sigTOF=pidObj->GetTOFsignal();
855 pidObj->GetTOFpidResolution(sigmaTOFPid);
856 Double_t sigmaTOFtrack;
857 if (sigmaTOFPid[3]>0) sigmaTOFtrack=sigmaTOFPid[3];
858 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
860 if((sigTOF-time[3])>nsigmaK*sigmaTOFtrack)return kTRUE;// K, Pi excluded (->LIKELY A PROTON)
865 //--------------------------------------------------------------------------
866 void AliAODPidHF::SetPriorDistribution(AliPID::EParticleType type,TH1F *prior){
869 // method setting the prior distributions to the AliPIDCombined object of the AliAODPidHF data member
870 // all the checks are done directly in the AliPIDCombined object
873 GetPidCombined()->SetPriorDistribution(type,prior);
875 //--------------------------------------------------------------------------
876 void AliAODPidHF::DrawPrior(AliPID::EParticleType type){
879 // Drawing prior distribution for type "type"
882 GetPidCombined()->GetPriorDistribution(type)->Draw();
885 //--------------------------------------------------------------------------
886 Int_t AliAODPidHF::GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &sigma) const{
888 if(!CheckTPCPIDStatus(track)) return -1;
890 Double_t nsigmaTPC=-999;
893 AliAODPid *pidObj = track->GetDetPid();
894 Double_t dedx=pidObj->GetTPCsignal();
895 Double_t mom = pidObj->GetTPCmomentum();
896 if(mom>fPtThresholdTPC) return -2;
897 UShort_t nTPCClus=pidObj->GetTPCsignalN();
898 if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
899 AliPID::EParticleType type=AliPID::EParticleType(species);
900 nsigmaTPC = TMath::Abs(fTPCResponse->GetNumberOfSigmas(mom,dedx,nTPCClus,type));
904 AliPID::EParticleType type=AliPID::EParticleType(species);
905 nsigmaTPC = TMath::Abs(fPidResponse->NumberOfSigmasTPC(track,type));
911 //-----------------------------
913 Int_t AliAODPidHF::GetnSigmaTOF(AliAODTrack *track,Int_t species, Double_t &sigma) const{
915 if(!CheckTOFPIDStatus(track)) return -1;
917 Double_t time[AliPID::kSPECIESN];
918 Double_t sigmaTOFPid[AliPID::kSPECIES];
919 AliAODPid *pidObj = track->GetDetPid();
920 pidObj->GetIntegratedTimes(time);
921 Double_t sigTOF=pidObj->GetTOFsignal();
922 pidObj->GetTOFpidResolution(sigmaTOFPid);
924 if(sigmaTOFPid[species]<1e-99) return -2;
926 Double_t sigmaTOF=TMath::Abs(sigTOF-time[species])/sigmaTOFPid[species];
931 //-----------------------------