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 //***********************************************************
30 #include "AliAODPidHF.h"
31 #include "AliAODPid.h"
33 #include "AliPIDResponse.h"
34 #include "AliAODpidUtil.h"
35 #include "AliESDtrack.h"
40 //------------------------------
41 AliAODPidHF::AliAODPidHF():
67 fPtThresholdTPC(999999.),
69 fPidCombined(new AliPIDCombined()),
70 fTPCResponse(new AliTPCPIDResponse()),
72 fCombDetectors(kTPCTOF),
76 // Default constructor
78 fPLimit=new Double_t[fnPLimit];
79 fnSigma=new Double_t[fnNSigma];
80 fPriors=new Double_t[fnPriors];
81 fnSigmaCompat=new Double_t[fnNSigmaCompat];
83 for(Int_t i=0;i<fnNSigma;i++){
86 for(Int_t i=0;i<fnPriors;i++){
89 for(Int_t i=0;i<fnPLimit;i++){
92 for(Int_t i=0;i<fnNSigmaCompat;i++){
97 //----------------------
98 AliAODPidHF::~AliAODPidHF()
101 // if(fPLimit) delete fPLimit;
102 // if(fnSigma) delete fnSigma;
103 // if(fPriors) delete fPriors;
105 for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
106 delete fPriorsH[ispecies];
109 //------------------------
110 AliAODPidHF::AliAODPidHF(const AliAODPidHF& pid) :
112 fnNSigma(pid.fnNSigma),
114 fTOFSigma(pid.fTOFSigma),
115 fnPriors(pid.fnPriors),
117 fnPLimit(pid.fnPLimit),
125 fCompat(pid.fCompat),
126 fPCompatTOF(pid.fPCompatTOF),
127 fnNSigmaCompat(pid.fnNSigmaCompat),
128 fnSigmaCompat(pid.fnSigmaCompat),
130 fOnePad(pid.fOnePad),
131 fMCLowEn2011(pid.fMCLowEn2011),
132 fppLowEn2011(pid.fppLowEn2011),
134 fTOFdecide(pid.fTOFdecide),
135 fOldPid(pid.fOldPid),
136 fPtThresholdTPC(pid.fPtThresholdTPC),
137 fPidResponse(pid.fPidResponse),
138 fPidCombined(pid.fPidCombined),
140 fCombDetectors(pid.fCombDetectors),
141 fUseCombined(pid.fUseCombined)
144 fnSigma = new Double_t[fnNSigma];
145 for(Int_t i=0;i<fnNSigma;i++){
146 fnSigma[i]=pid.fnSigma[i];
148 fPriors = new Double_t[fnPriors];
149 for(Int_t i=0;i<fnPriors;i++){
150 fPriors[i]=pid.fPriors[i];
152 fPLimit = new Double_t[fnPLimit];
153 for(Int_t i=0;i<fnPLimit;i++){
154 fPLimit[i]=pid.fPLimit[i];
156 fPriors = new Double_t[fnPriors];
157 for(Int_t i=0;i<fnPriors;i++){
158 fPriors[i]=pid.fPriors[i];
160 for(Int_t i=0;i<AliPID::kSPECIES;i++){
161 fPriorsH[i]=pid.fPriorsH[i];
164 if(pid.fTPCResponse) fTPCResponse = new AliTPCPIDResponse(*(pid.fTPCResponse));
165 //fPidResponse = new AliPIDResponse(*(pid.fPidResponse));
166 //fPidCombined = new AliPIDCombined(*(pid.fPidCombined));
169 //----------------------
170 Int_t AliAODPidHF::RawSignalPID(AliAODTrack *track, TString detector) const{
171 // raw PID for single detectors, returns the particle type with smaller sigma
173 if(detector.Contains("ITS")) return ApplyPidITSRaw(track,specie);
174 if(detector.Contains("TPC")) return ApplyPidTPCRaw(track,specie);
175 if(detector.Contains("TOF")) return ApplyPidTOFRaw(track,specie);
180 //---------------------------
181 Bool_t AliAODPidHF::IsKaonRaw(AliAODTrack *track, TString detector) const{
182 // checks if the track can be a kaon, raw PID applied for single detectors
185 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,3);
186 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,3);
187 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,3);
189 if(specie==3) return kTRUE;
192 //---------------------------
193 Bool_t AliAODPidHF::IsPionRaw (AliAODTrack *track, TString detector) const{
194 // checks if the track can be a pion, raw PID applied for single detectors
198 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,2);
199 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,2);
200 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,2);
202 if(specie==2) return kTRUE;
205 //---------------------------
206 Bool_t AliAODPidHF::IsProtonRaw (AliAODTrack *track, TString detector) const{
207 // checks if the track can be a proton raw PID applied for single detectors
210 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,4);
211 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,4);
212 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,4);
214 if(specie==4) return kTRUE;
218 //--------------------------
219 Bool_t AliAODPidHF::IsElectronRaw(AliAODTrack *track, TString detector) const{
220 // checks if the track can be an electron raw PID applied for single detectors
223 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,0);
224 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,0);
225 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,0);
227 if(specie==0) return kTRUE;
231 //--------------------------
232 Int_t AliAODPidHF::ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const{
233 // n-sigma cut, TPC PID
238 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
239 Double_t nsigmaMin=999.;
240 for(Int_t ipart=0;ipart<5;ipart++){
241 if(GetnSigmaTPC(track,ipart,nsigma)==1){
242 nsigma=TMath::Abs(nsigma);
243 if((nsigma<nsigmaMin) && (nsigma<fnSigma[0])) {
249 }else{ // asks only for one particle specie
250 if(GetnSigmaTPC(track,specie,nsigma)==1){
251 nsigma=TMath::Abs(nsigma);
252 if (nsigma>fnSigma[0]) pid=-1;
259 //----------------------------
260 Int_t AliAODPidHF::ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const{
261 // truncated mean, ITS PID
263 if(!CheckITSPIDStatus(track)) return 0;
267 Double_t mom=track->P();
268 AliAODPid *pidObj = track->GetDetPid();
270 Double_t dedx=pidObj->GetITSsignal();
271 UChar_t clumap=track->GetITSClusterMap();
272 Int_t nPointsForPid=0;
273 for(Int_t i=2; i<6; i++){
274 if(clumap&(1<<i)) ++nPointsForPid;
278 if(track->GetStatus() & AliESDtrack::kTPCin) isSA = kFALSE;
280 AliITSPIDResponse itsResponse;
281 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
282 Double_t nsigmaMax=fnSigma[4];
283 for(Int_t ipart=0;ipart<5;ipart++){
284 AliPID::EParticleType type=AliPID::EParticleType(ipart);
285 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type,nPointsForPid,isSA));
286 if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) {
291 }else{ // asks only for one particle specie
292 AliPID::EParticleType type=AliPID::EParticleType(specie);
293 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type));
294 if (nsigma>fnSigma[4]) {
302 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
303 Double_t nsigmaMax=fnSigma[4];
304 for(Int_t ipart=0;ipart<5;ipart++){
305 AliPID::EParticleType type=AliPID::EParticleType(ipart);
306 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type));
307 if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) {
312 }else{ // asks only for one particle specie
313 AliPID::EParticleType type=AliPID::EParticleType(specie);
314 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type));
315 if (nsigma>fnSigma[4]) {
325 //----------------------------
326 Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{
327 // n-sigma cut, TOF PID
333 Double_t nsigmaMin=999.;
334 for(Int_t ipart=0;ipart<5;ipart++){
335 if(GetnSigmaTOF(track,ipart,nsigma)==1){
336 nsigma=TMath::Abs(nsigma);
337 if((nsigma<nsigmaMin)&& (nsigma<fnSigma[3])){
343 }else{ // asks only for one particle specie
344 if(GetnSigmaTOF(track,specie,nsigma)==1){
345 nsigma=TMath::Abs(nsigma);
346 if (nsigma>fnSigma[3]) pid=-1;
352 Double_t time[AliPID::kSPECIESN];
353 Double_t sigmaTOFPid[AliPID::kSPECIES];
354 AliAODPid *pidObj = track->GetDetPid();
355 pidObj->GetIntegratedTimes(time);
356 Double_t sigTOF=pidObj->GetTOFsignal();
358 AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
360 AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
361 if (tofH && fPidResponse) { // reading new AOD with new aliroot
362 AliTOFPIDResponse TOFres = (AliTOFPIDResponse)fPidResponse->GetTOFResponse();
363 sigTOF -= TOFres.GetStartTime(track->P());
365 for (Int_t ipart = 0; ipart<5; ipart++) {
366 sigmaTOFPid[ipart]=TOFres.GetExpectedSigma(track->P(),time[ipart],AliPID::ParticleMass(ipart));
369 else sigmaTOFPid[specie]=TOFres.GetExpectedSigma(track->P(),time[specie],AliPID::ParticleMass(specie)); //fTOFResponse is set in InitialiseEvent
370 } else pidObj->GetTOFpidResolution(sigmaTOFPid); // reading old AOD with new aliroot
371 } else pidObj->GetTOFpidResolution(sigmaTOFPid); //reading old AOD with old aliroot
376 Double_t sigmaTOFtrack;
377 if (sigmaTOFPid[4]>0) sigmaTOFtrack=sigmaTOFPid[4];
378 else sigmaTOFtrack=fTOFSigma;
379 Double_t nsigmaMax=sigmaTOFtrack*fnSigma[3];
380 for(Int_t ipart=0;ipart<5;ipart++){
381 Double_t nsigma=TMath::Abs(sigTOF-time[ipart]);
382 if (sigmaTOFPid[ipart]>0) sigmaTOFtrack=sigmaTOFPid[ipart];
383 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
384 if((nsigma<nsigmaMax) && (nsigma<fnSigma[3]*sigmaTOFtrack)) {
389 }else{ // asks only for one particle specie
390 Double_t nsigma=TMath::Abs(sigTOF-time[specie]);
391 Double_t sigmaTOFtrack;
392 if (sigmaTOFPid[specie]>0) sigmaTOFtrack=sigmaTOFPid[specie];
393 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
394 if (nsigma>fnSigma[3]*sigmaTOFtrack) {
403 //------------------------------
404 void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{
405 // combined PID stored inside the AOD track
407 const Double_t *pid=track->PID();
410 for (Int_t i=0; i<10; i++) {
411 if (pid[i]>max) {k=i; max=pid[i];}
414 if(k==2) type[0]=kTRUE;
415 if(k==3) type[1]=kTRUE;
416 if(k==4) type[2]=kTRUE;
420 //--------------------------------
421 Bool_t AliAODPidHF::CheckITSPIDStatus(AliAODTrack *track) const{
422 // ITS PID quality cuts
423 if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE;
424 UChar_t clumap=track->GetITSClusterMap();
425 Int_t nPointsForPid=0;
426 for(Int_t i=2; i<6; i++){
427 if(clumap&(1<<i)) ++nPointsForPid;
429 if(nPointsForPid<3) return kFALSE;
432 //--------------------------------
433 Bool_t AliAODPidHF::CheckTPCPIDStatus(AliAODTrack *track) const{
434 // TPC PID quality cuts
435 if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE;
436 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
437 if (nTPCClus<70) return kFALSE;
440 //--------------------------------
441 Bool_t AliAODPidHF::CheckTOFPIDStatus(AliAODTrack *track) const{
442 // TOF PID quality cuts
443 if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE;
444 if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE;
445 if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE;
446 if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE;
449 //--------------------------------
450 Bool_t AliAODPidHF::CheckTRDPIDStatus(AliAODTrack *track) const{
451 // TRD PID quality cuts
452 if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE;
455 //--------------------------------
456 Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{
458 // Quality cuts on the tracks, detector by detector
460 if(detectors.Contains("ITS")){
461 if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE;
462 UChar_t clumap=track->GetITSClusterMap();
463 Int_t nPointsForPid=0;
464 for(Int_t i=2; i<6; i++){
465 if(clumap&(1<<i)) ++nPointsForPid;
467 if(nPointsForPid<3) return kFALSE;
470 if(detectors.Contains("TPC")){
471 if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE;
472 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
473 if (nTPCClus<70) return kFALSE;
476 if(detectors.Contains("TOF")){
477 if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE;
478 if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE;
479 if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE;
480 if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE;
484 if(detectors.Contains("TRD")){
485 if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE;
486 //UChar_t ntracklets = track->GetTRDntrackletsPID();
487 //if(ntracklets<4) return kFALSE;
492 //--------------------------------------------
493 Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{
494 // TPC nsigma cut PID, different sigmas in different p bins
497 if(GetnSigmaTPC(track,specie,nsigma)!=1) return kFALSE;
498 nsigma=TMath::Abs(nsigma);
500 AliAODPid *pidObj = track->GetDetPid();
501 Double_t mom = pidObj->GetTPCmomentum();
502 if(mom>fPtThresholdTPC) return 0;
504 if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE;
505 if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE;
506 if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE;
511 Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track, Int_t specie){
512 // combination of the PID info coming from TPC and TOF
514 Bool_t okTPC=CheckTPCPIDStatus(track);
515 Bool_t okTOF=CheckTOFPIDStatus(track);
518 //TOF || TPC (a la' Andrea R.)
520 // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible
521 // the method returns the sum of the response of the 2 detectors
524 if(!okTPC && !okTOF) return 0;
531 if(TPCRawAsym(track,specie)) tTPCinfo=1;
533 if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
535 if(fCompat && tTPCinfo<0){
536 Double_t sig0tmp=fnSigma[0];
537 SetSigma(0,fnSigmaCompat[0]);
538 if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=0;
545 if(!okTOF && fTPC) return tTPCinfo;
547 if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
548 if(fCompat && tTOFinfo>0){
549 Double_t ptrack=track->P();
550 if(ptrack>fPCompatTOF) {
551 Double_t sig0tmp=fnSigma[3];
552 SetSigma(3,fnSigmaCompat[1]);
553 if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=0;
560 if(tTPCinfo+tTOFinfo==0 && fTOFdecide){
561 if(!okTOF) return tTPCinfo;
565 if(tTPCinfo+tTOFinfo==0 && fITS){
566 if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
568 if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
571 return tTPCinfo+tTOFinfo;
575 //TPC & TOF (a la' Yifei)
576 // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified
582 if(!TPCRawAsym(track,specie)) tTPCinfo=-1;
584 if(ApplyPidTPCRaw(track,specie)!=specie) tTPCinfo=-1;
590 if(fTPC && !okTOF) return tTPCinfo;
591 if(ApplyPidTPCRaw(track,specie)!=specie) tTOFinfo=-1;
594 if(tTOFinfo==1 && tTPCinfo==1) return 1;
596 if(tTPCinfo+tTOFinfo==0 && fITS){
597 if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
599 if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
606 //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.)
607 // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified
608 if(fTPC && fTOF) if(!okTPC && !okTOF) return 0;
610 Double_t ptrack=track->P();
613 if(ptrack>=fPLimit[0] && ptrack<fPLimit[1] && fTPC) {
616 if(TPCRawAsym(track,specie)) tTPCinfo=1;
618 if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
624 if(ptrack>=fPLimit[1] && fTOF){
626 if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
631 if(ptrack<fPLimit[0] && fITS){
632 if(!CheckITSPIDStatus(track)) return 0;
633 if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
641 //----------------------------------
642 Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){
643 // general method to compute PID
645 return MatchTPCTOF(track,specie);
647 if(fTPC && !fTOF && !fITS) {
650 tTPCres=ApplyPidTPCRaw(track,specie);
651 if(tTPCres==specie) return 1;
654 if(TPCRawAsym(track,specie)) tTPCres=1;
658 }else if(fTOF && !fTPC && !fITS) {
659 Int_t tTOFres=ApplyPidTOFRaw(track,specie);
660 if(tTOFres==specie) return 1;
662 }else if(fITS && !fTPC && !fTOF) {
663 Int_t tITSres=ApplyPidITSRaw(track,specie);
664 if(tITSres==specie) return 1;
667 AliError("You should enable just one detector if you don't want to match");
672 //--------------------------------------------
673 void AliAODPidHF::GetTPCBetheBlochParams(Double_t alephParameters[5]) const {
674 // TPC bethe bloch parameters
677 if(fPbPb) { // PbPb MC
679 alephParameters[0] = 1.44405/50.;
680 alephParameters[1] = 2.35409e+01;
681 alephParameters[2] = TMath::Exp(-2.90330e+01);
682 alephParameters[3] = 2.10681e+00;
683 alephParameters[4] = 4.62254e+00;
687 alephParameters[0]=0.0207667;
688 alephParameters[1]=29.9936;
689 alephParameters[2]=3.87866e-11;
690 alephParameters[3]=2.17291;
691 alephParameters[4]=7.1623;
693 alephParameters[0]=0.029021;
694 alephParameters[1]=25.4181;
695 alephParameters[2]=4.66596e-08;
696 alephParameters[3]=1.90008;
697 alephParameters[4]=4.63783;
699 alephParameters[0] = 2.15898/50.;
700 alephParameters[1] = 1.75295e+01;
701 alephParameters[2] = 3.40030e-09;
702 alephParameters[3] = 1.96178e+00;
703 alephParameters[4] = 3.91720e+00;
707 } else { // Real Data
709 if(fOnePad) { // pp 1-pad (since LHC10d)
711 alephParameters[0] =1.34490e+00/50.;
712 alephParameters[1] = 2.69455e+01;
713 alephParameters[2] = TMath::Exp(-2.97552e+01);
714 alephParameters[3] = 2.35339e+00;
715 alephParameters[4] = 5.98079e+00;
717 } else if(fPbPb) { // PbPb
719 // alephParameters[0] = 1.25202/50.;
720 // alephParameters[1] = 2.74992e+01;
721 // alephParameters[2] = TMath::Exp(-3.31517e+01);
722 // alephParameters[3] = 2.46246;
723 // alephParameters[4] = 6.78938;
725 alephParameters[0] = 5.10207e+00/50.;
726 alephParameters[1] = 7.94982e+00;
727 alephParameters[2] = TMath::Exp(-9.07942e+00);
728 alephParameters[3] = 2.38808e+00;
729 alephParameters[4] = 1.68165e+00;
731 } else if(fppLowEn2011){ // pp low energy
733 alephParameters[0]=0.031642;
734 alephParameters[1]=22.353;
735 alephParameters[2]=4.16239e-12;
736 alephParameters[3]=2.61952;
737 alephParameters[4]=5.76086;
739 } else { // pp no 1-pad (LHC10bc)
741 alephParameters[0] = 0.0283086/0.97;
742 alephParameters[1] = 2.63394e+01;
743 alephParameters[2] = 5.04114e-11;
744 alephParameters[3] = 2.12543e+00;
745 alephParameters[4] = 4.88663e+00;
753 //-----------------------
754 void AliAODPidHF::SetBetheBloch() {
755 // Set Bethe Bloch Parameters
757 Double_t alephParameters[5];
758 GetTPCBetheBlochParams(alephParameters);
759 fTPCResponse->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
763 //-----------------------
764 Bool_t AliAODPidHF::IsTOFPiKexcluded(AliAODTrack *track,Double_t nsigmaK){
765 // TOF proton compatibility
767 if(!CheckTOFPIDStatus(track)) return 0;
770 if(GetnSigmaTOF(track,3,nsigma)==1){
771 if(nsigma>nsigmaK) return kTRUE;
774 /* Double_t time[AliPID::kSPECIESN];
775 Double_t sigmaTOFPid[AliPID::kSPECIES];
776 AliAODPid *pidObj = track->GetDetPid();
777 pidObj->GetIntegratedTimes(time);
778 Double_t sigTOF=pidObj->GetTOFsignal();
780 AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
782 AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
783 if (tofH && fPidResponse) {
784 AliTOFPIDResponse TOFres = (AliTOFPIDResponse)fPidResponse->GetTOFResponse();
785 sigTOF -= TOFres.GetStartTime(track->P());
786 sigmaTOFPid[3]=TOFres.GetExpectedSigma(track->P(),time[3],AliPID::ParticleMass(3));
788 else pidObj->GetTOFpidResolution(sigmaTOFPid);
789 } else pidObj->GetTOFpidResolution(sigmaTOFPid);
790 Double_t sigmaTOFtrack;
791 if (sigmaTOFPid[3]>0) sigmaTOFtrack=sigmaTOFPid[3];
792 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
794 if((sigTOF-time[3])>nsigmaK*sigmaTOFtrack)return kTRUE;// K, Pi excluded (->LIKELY A PROTON)
799 //--------------------------------------------------------------------------
800 void AliAODPidHF::SetPriorDistribution(AliPID::EParticleType type,TH1F *prior){
803 // method setting the prior distributions to the AliPIDCombined object of the AliAODPidHF data member
804 // all the checks are done directly in the AliPIDCombined object
807 GetPidCombined()->SetPriorDistribution(type,prior);
809 //--------------------------------------------------------------------------
810 void AliAODPidHF::DrawPrior(AliPID::EParticleType type){
813 // Drawing prior distribution for type "type"
816 GetPidCombined()->GetPriorDistribution(type)->Draw();
819 //--------------------------------------------------------------------------
820 Int_t AliAODPidHF::GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &nsigma) const{
821 // get n sigma for TPC
823 if(!CheckTPCPIDStatus(track)) return -1;
825 Double_t nsigmaTPC=-999;
828 AliAODPid *pidObj = track->GetDetPid();
829 Double_t dedx=pidObj->GetTPCsignal();
830 Double_t mom = pidObj->GetTPCmomentum();
831 if(mom>fPtThresholdTPC) return -2;
832 UShort_t nTPCClus=pidObj->GetTPCsignalN();
833 if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
834 AliPID::EParticleType type=AliPID::EParticleType(species);
835 nsigmaTPC = fTPCResponse->GetNumberOfSigmas(mom,dedx,nTPCClus,type);
838 if(!fPidResponse) return -1;
839 AliPID::EParticleType type=AliPID::EParticleType(species);
840 nsigmaTPC = fPidResponse->NumberOfSigmasTPC(track,type);
846 //-----------------------------
848 Int_t AliAODPidHF::GetnSigmaTOF(AliAODTrack *track,Int_t species, Double_t &nsigma) const{
849 // get n sigma for TOF
851 if(!CheckTOFPIDStatus(track)) return -1;
854 nsigma = fPidResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)species);
857 AliFatal("To use TOF PID you need to attach AliPIDResponseTask");
863 //-----------------------
864 Bool_t AliAODPidHF::IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detectors) {
865 // Exclude a given hypothesis (labelTracks) in detector
867 if (detectors.Contains("ITS")) {
869 AliInfo("Nothing to be done");
872 if (GetnSigmaITS(track,labelTrack,nsigma)==1){
873 if(nsigma>nsigmaCut) return kTRUE;
878 } else if (detectors.Contains("TPC")) {
881 if (GetnSigmaTPC(track,labelTrack,nsigma)==1){
882 if(nsigma>nsigmaCut) return kTRUE;
886 } else if (detectors.Contains("TOF")) {
888 if (!(CheckTOFPIDStatus(track))) return kFALSE;
890 if (GetnSigmaTOF(track,labelTrack,nsigma)==1){
891 if(nsigma>nsigmaCut) return kTRUE;
899 //-----------------------------
900 void AliAODPidHF::SetPriorsHistos(TString priorFileName){
901 // Set histograms with priors
903 for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
904 if(fPriorsH[ispecies]) delete fPriorsH[ispecies];
907 nt+=AliPID::ParticleName(ispecies);
909 TDirectory *current = gDirectory;
910 TFile *priorFile=TFile::Open(priorFileName);
912 TH1F* h3=static_cast<TH1F*>(priorFile->Get("priors3step9"));
913 TH1F* h2=static_cast<TH1F*>(priorFile->Get("priors2step9"));
914 TH1F* h1=static_cast<TH1F*>(priorFile->Get("priors1step9"));
916 fPriorsH[AliPID::kProton] = new TH1F(*h3);
917 fPriorsH[AliPID::kKaon ] = new TH1F(*h2);
918 fPriorsH[AliPID::kPion ] = new TH1F(*h1);
921 TF1 *salt=new TF1("salt","1.e-10",0,10);
922 fPriorsH[AliPID::kProton]->Add(salt);
923 fPriorsH[AliPID::kKaon ]->Add(salt);
924 fPriorsH[AliPID::kPion ]->Add(salt);
928 //----------------------------------
929 void AliAODPidHF::SetUpCombinedPID(){
930 // Configuration of combined Bayesian PID
932 fPidCombined->SetSelectedSpecies(AliPID::kSPECIES);
933 for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
934 fPidCombined->SetPriorDistribution(static_cast<AliPID::EParticleType>(ispecies),fPriorsH[ispecies]);
936 switch (fCombDetectors){
938 fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
941 fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetITS);
944 fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC);
947 fPidCombined->SetDetectorMask(AliPIDResponse::kDetTOF);