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.),
68 fMaxTrackMomForCombinedPID(999999.),
70 fPidCombined(new AliPIDCombined()),
71 fTPCResponse(new AliTPCPIDResponse()),
73 fCombDetectors(kTPCTOF),
77 // Default constructor
79 fPLimit=new Double_t[fnPLimit];
80 fnSigma=new Double_t[fnNSigma];
81 fPriors=new Double_t[fnPriors];
82 fnSigmaCompat=new Double_t[fnNSigmaCompat];
84 for(Int_t i=0;i<fnNSigma;i++){
87 for(Int_t i=0;i<fnPriors;i++){
90 for(Int_t i=0;i<fnPLimit;i++){
93 for(Int_t i=0;i<fnNSigmaCompat;i++){
98 //----------------------
99 AliAODPidHF::~AliAODPidHF()
102 // if(fPLimit) delete fPLimit;
103 // if(fnSigma) delete fnSigma;
104 // if(fPriors) delete fPriors;
106 for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
107 delete fPriorsH[ispecies];
110 //------------------------
111 AliAODPidHF::AliAODPidHF(const AliAODPidHF& pid) :
113 fnNSigma(pid.fnNSigma),
115 fTOFSigma(pid.fTOFSigma),
116 fnPriors(pid.fnPriors),
118 fnPLimit(pid.fnPLimit),
126 fCompat(pid.fCompat),
127 fPCompatTOF(pid.fPCompatTOF),
128 fnNSigmaCompat(pid.fnNSigmaCompat),
129 fnSigmaCompat(pid.fnSigmaCompat),
131 fOnePad(pid.fOnePad),
132 fMCLowEn2011(pid.fMCLowEn2011),
133 fppLowEn2011(pid.fppLowEn2011),
135 fTOFdecide(pid.fTOFdecide),
136 fOldPid(pid.fOldPid),
137 fPtThresholdTPC(pid.fPtThresholdTPC),
138 fMaxTrackMomForCombinedPID(pid.fMaxTrackMomForCombinedPID),
139 fPidResponse(pid.fPidResponse),
140 fPidCombined(pid.fPidCombined),
142 fCombDetectors(pid.fCombDetectors),
143 fUseCombined(pid.fUseCombined)
146 fnSigma = new Double_t[fnNSigma];
147 for(Int_t i=0;i<fnNSigma;i++){
148 fnSigma[i]=pid.fnSigma[i];
150 fPriors = new Double_t[fnPriors];
151 for(Int_t i=0;i<fnPriors;i++){
152 fPriors[i]=pid.fPriors[i];
154 fPLimit = new Double_t[fnPLimit];
155 for(Int_t i=0;i<fnPLimit;i++){
156 fPLimit[i]=pid.fPLimit[i];
158 fPriors = new Double_t[fnPriors];
159 for(Int_t i=0;i<fnPriors;i++){
160 fPriors[i]=pid.fPriors[i];
162 for(Int_t i=0;i<AliPID::kSPECIES;i++){
163 fPriorsH[i]=pid.fPriorsH[i];
166 if(pid.fTPCResponse) fTPCResponse = new AliTPCPIDResponse(*(pid.fTPCResponse));
167 //fPidResponse = new AliPIDResponse(*(pid.fPidResponse));
168 //fPidCombined = new AliPIDCombined(*(pid.fPidCombined));
171 //----------------------
172 Int_t AliAODPidHF::RawSignalPID(AliAODTrack *track, TString detector) const{
173 // raw PID for single detectors, returns the particle type with smaller sigma
175 if(detector.Contains("ITS")) return ApplyPidITSRaw(track,specie);
176 if(detector.Contains("TPC")) return ApplyPidTPCRaw(track,specie);
177 if(detector.Contains("TOF")) return ApplyPidTOFRaw(track,specie);
182 //---------------------------
183 Bool_t AliAODPidHF::IsKaonRaw(AliAODTrack *track, TString detector) const{
184 // checks if the track can be a kaon, raw PID applied for single detectors
187 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,3);
188 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,3);
189 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,3);
191 if(specie==3) return kTRUE;
194 //---------------------------
195 Bool_t AliAODPidHF::IsPionRaw (AliAODTrack *track, TString detector) const{
196 // checks if the track can be a pion, raw PID applied for single detectors
200 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,2);
201 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,2);
202 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,2);
204 if(specie==2) return kTRUE;
207 //---------------------------
208 Bool_t AliAODPidHF::IsProtonRaw (AliAODTrack *track, TString detector) const{
209 // checks if the track can be a proton raw PID applied for single detectors
212 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,4);
213 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,4);
214 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,4);
216 if(specie==4) return kTRUE;
220 //--------------------------
221 Bool_t AliAODPidHF::IsElectronRaw(AliAODTrack *track, TString detector) const{
222 // checks if the track can be an electron raw PID applied for single detectors
225 if(detector.Contains("ITS")) specie=ApplyPidITSRaw(track,0);
226 if(detector.Contains("TPC")) specie=ApplyPidTPCRaw(track,0);
227 if(detector.Contains("TOF")) specie=ApplyPidTOFRaw(track,0);
229 if(specie==0) return kTRUE;
233 //--------------------------
234 Int_t AliAODPidHF::ApplyPidTPCRaw(AliAODTrack *track,Int_t specie) const{
235 // n-sigma cut, TPC PID
240 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
241 Double_t nsigmaMin=999.;
242 for(Int_t ipart=0;ipart<5;ipart++){
243 if(GetnSigmaTPC(track,ipart,nsigma)==1){
244 nsigma=TMath::Abs(nsigma);
245 if((nsigma<nsigmaMin) && (nsigma<fnSigma[0])) {
251 }else{ // asks only for one particle specie
252 if(GetnSigmaTPC(track,specie,nsigma)==1){
253 nsigma=TMath::Abs(nsigma);
254 if (nsigma>fnSigma[0]) pid=-1;
261 //----------------------------
262 Int_t AliAODPidHF::ApplyPidITSRaw(AliAODTrack *track,Int_t specie) const{
263 // truncated mean, ITS PID
265 if(!CheckITSPIDStatus(track)) return 0;
269 Double_t mom=track->P();
270 AliAODPid *pidObj = track->GetDetPid();
272 Double_t dedx=pidObj->GetITSsignal();
273 UChar_t clumap=track->GetITSClusterMap();
274 Int_t nPointsForPid=0;
275 for(Int_t i=2; i<6; i++){
276 if(clumap&(1<<i)) ++nPointsForPid;
280 if(track->GetStatus() & AliESDtrack::kTPCin) isSA = kFALSE;
282 AliITSPIDResponse itsResponse;
283 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
284 Double_t nsigmaMax=fnSigma[4];
285 for(Int_t ipart=0;ipart<5;ipart++){
286 AliPID::EParticleType type=AliPID::EParticleType(ipart);
287 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type,nPointsForPid,isSA));
288 if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) {
293 }else{ // asks only for one particle specie
294 AliPID::EParticleType type=AliPID::EParticleType(specie);
295 Double_t nsigma = TMath::Abs(itsResponse.GetNumberOfSigmas(mom,dedx,type));
296 if (nsigma>fnSigma[4]) {
304 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
305 Double_t nsigmaMax=fnSigma[4];
306 for(Int_t ipart=0;ipart<5;ipart++){
307 AliPID::EParticleType type=AliPID::EParticleType(ipart);
308 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type));
309 if((nsigma<nsigmaMax) && (nsigma<fnSigma[4])) {
314 }else{ // asks only for one particle specie
315 AliPID::EParticleType type=AliPID::EParticleType(specie);
316 Double_t nsigma = TMath::Abs(fPidResponse->NumberOfSigmasITS(track,type));
317 if (nsigma>fnSigma[4]) {
327 //----------------------------
328 Int_t AliAODPidHF::ApplyPidTOFRaw(AliAODTrack *track,Int_t specie) const{
329 // n-sigma cut, TOF PID
335 Double_t nsigmaMin=999.;
336 for(Int_t ipart=0;ipart<5;ipart++){
337 if(GetnSigmaTOF(track,ipart,nsigma)==1){
338 nsigma=TMath::Abs(nsigma);
339 if((nsigma<nsigmaMin)&& (nsigma<fnSigma[3])){
345 }else{ // asks only for one particle specie
346 if(GetnSigmaTOF(track,specie,nsigma)==1){
347 nsigma=TMath::Abs(nsigma);
348 if (nsigma>fnSigma[3]) pid=-1;
354 Double_t time[AliPID::kSPECIESN];
355 Double_t sigmaTOFPid[AliPID::kSPECIES];
356 AliAODPid *pidObj = track->GetDetPid();
357 pidObj->GetIntegratedTimes(time);
358 Double_t sigTOF=pidObj->GetTOFsignal();
360 AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
362 AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
363 if (tofH && fPidResponse) { // reading new AOD with new aliroot
364 AliTOFPIDResponse TOFres = (AliTOFPIDResponse)fPidResponse->GetTOFResponse();
365 sigTOF -= TOFres.GetStartTime(track->P());
367 for (Int_t ipart = 0; ipart<5; ipart++) {
368 sigmaTOFPid[ipart]=TOFres.GetExpectedSigma(track->P(),time[ipart],AliPID::ParticleMass(ipart));
371 else sigmaTOFPid[specie]=TOFres.GetExpectedSigma(track->P(),time[specie],AliPID::ParticleMass(specie)); //fTOFResponse is set in InitialiseEvent
372 } else pidObj->GetTOFpidResolution(sigmaTOFPid); // reading old AOD with new aliroot
373 } else pidObj->GetTOFpidResolution(sigmaTOFPid); //reading old AOD with old aliroot
378 Double_t sigmaTOFtrack;
379 if (sigmaTOFPid[4]>0) sigmaTOFtrack=sigmaTOFPid[4];
380 else sigmaTOFtrack=fTOFSigma;
381 Double_t nsigmaMax=sigmaTOFtrack*fnSigma[3];
382 for(Int_t ipart=0;ipart<5;ipart++){
383 Double_t nsigma=TMath::Abs(sigTOF-time[ipart]);
384 if (sigmaTOFPid[ipart]>0) sigmaTOFtrack=sigmaTOFPid[ipart];
385 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
386 if((nsigma<nsigmaMax) && (nsigma<fnSigma[3]*sigmaTOFtrack)) {
391 }else{ // asks only for one particle specie
392 Double_t nsigma=TMath::Abs(sigTOF-time[specie]);
393 Double_t sigmaTOFtrack;
394 if (sigmaTOFPid[specie]>0) sigmaTOFtrack=sigmaTOFPid[specie];
395 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
396 if (nsigma>fnSigma[3]*sigmaTOFtrack) {
405 //------------------------------
406 void AliAODPidHF::CombinedProbability(AliAODTrack *track,Bool_t *type) const{
407 // combined PID stored inside the AOD track
409 const Double_t *pid=track->PID();
412 for (Int_t i=0; i<10; i++) {
413 if (pid[i]>max) {k=i; max=pid[i];}
416 if(k==2) type[0]=kTRUE;
417 if(k==3) type[1]=kTRUE;
418 if(k==4) type[2]=kTRUE;
422 //--------------------------------
423 Bool_t AliAODPidHF::CheckITSPIDStatus(AliAODTrack *track) const{
424 // ITS PID quality cuts
425 if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE;
426 UChar_t clumap=track->GetITSClusterMap();
427 Int_t nPointsForPid=0;
428 for(Int_t i=2; i<6; i++){
429 if(clumap&(1<<i)) ++nPointsForPid;
431 if(nPointsForPid<3) return kFALSE;
434 //--------------------------------
435 Bool_t AliAODPidHF::CheckTPCPIDStatus(AliAODTrack *track) const{
436 // TPC PID quality cuts
437 if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE;
438 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
439 if (nTPCClus<70) return kFALSE;
442 //--------------------------------
443 Bool_t AliAODPidHF::CheckTOFPIDStatus(AliAODTrack *track) const{
444 // TOF PID quality cuts
445 if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE;
446 if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE;
447 if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE;
448 if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE;
451 //--------------------------------
452 Bool_t AliAODPidHF::CheckTRDPIDStatus(AliAODTrack *track) const{
453 // TRD PID quality cuts
454 if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE;
457 //--------------------------------
458 Bool_t AliAODPidHF::CheckStatus(AliAODTrack *track,TString detectors) const{
460 // Quality cuts on the tracks, detector by detector
462 if(detectors.Contains("ITS")){
463 if ((track->GetStatus()&AliESDtrack::kITSin)==0) return kFALSE;
464 UChar_t clumap=track->GetITSClusterMap();
465 Int_t nPointsForPid=0;
466 for(Int_t i=2; i<6; i++){
467 if(clumap&(1<<i)) ++nPointsForPid;
469 if(nPointsForPid<3) return kFALSE;
472 if(detectors.Contains("TPC")){
473 if ((track->GetStatus()&AliESDtrack::kTPCin )==0) return kFALSE;
474 UShort_t nTPCClus=track->GetTPCClusterMap().CountBits();
475 if (nTPCClus<70) return kFALSE;
478 if(detectors.Contains("TOF")){
479 if ((track->GetStatus()&AliESDtrack::kTOFout )==0) return kFALSE;
480 if ((track->GetStatus()&AliESDtrack::kTIME )==0) return kFALSE;
481 if ((track->GetStatus()&AliESDtrack::kTOFpid )==0) return kFALSE;
482 if (!(track->GetStatus()&AliESDtrack::kTOFmismatch)==0) return kFALSE;
486 if(detectors.Contains("TRD")){
487 if ((track->GetStatus()&AliESDtrack::kTRDout )==0) return kFALSE;
488 //UChar_t ntracklets = track->GetTRDntrackletsPID();
489 //if(ntracklets<4) return kFALSE;
494 //--------------------------------------------
495 Bool_t AliAODPidHF::TPCRawAsym(AliAODTrack* track,Int_t specie) const{
496 // TPC nsigma cut PID, different sigmas in different p bins
498 AliAODPid *pidObj = track->GetDetPid();
499 Double_t mom = pidObj->GetTPCmomentum();
500 if(mom>fPtThresholdTPC) return kTRUE;
503 if(GetnSigmaTPC(track,specie,nsigma)!=1) return kFALSE;
504 nsigma=TMath::Abs(nsigma);
507 if(mom<fPLimit[0] && nsigma<fnSigma[0]) return kTRUE;
508 if(mom<fPLimit[1] && mom>fPLimit[0] && nsigma<fnSigma[1]) return kTRUE;
509 if(mom>fPLimit[1] && nsigma<fnSigma[2]) return kTRUE;
514 Int_t AliAODPidHF::MatchTPCTOF(AliAODTrack *track, Int_t specie){
515 // combination of the PID info coming from TPC and TOF
517 Double_t ptrack=track->P();
518 if(ptrack>fMaxTrackMomForCombinedPID) return 1;
520 Bool_t okTPC=CheckTPCPIDStatus(track);
521 Bool_t okTOF=CheckTOFPIDStatus(track);
522 if(ptrack>fPtThresholdTPC) okTPC=kFALSE;
525 //TOF || TPC (a la' Andrea R.)
527 // for the single detectors: -1 = kFALSE, 1 = kTRUE, 0 = compatible
528 // the method returns the sum of the response of the 2 detectors
531 if(!okTPC && !okTOF) return 0;
538 if(TPCRawAsym(track,specie)) tTPCinfo=1;
540 if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
542 if(fCompat && tTPCinfo<0){
543 Double_t sig0tmp=fnSigma[0];
544 SetSigma(0,fnSigmaCompat[0]);
545 if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=0;
552 if(!okTOF && fTPC) return tTPCinfo;
554 if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
555 if(fCompat && tTOFinfo>0){
556 if(ptrack>fPCompatTOF) {
557 Double_t sig0tmp=fnSigma[3];
558 SetSigma(3,fnSigmaCompat[1]);
559 if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=0;
566 if(tTPCinfo+tTOFinfo==0 && fTOFdecide){
567 if(!okTOF) return tTPCinfo;
571 if(tTPCinfo+tTOFinfo==0 && fITS){
572 if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
574 if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
577 return tTPCinfo+tTOFinfo;
581 //TPC & TOF (a la' Yifei)
582 // convention: -1 = kFALSE, 1 = kTRUE, 0 = not identified
588 if(!TPCRawAsym(track,specie)) tTPCinfo=-1;
590 if(ApplyPidTPCRaw(track,specie)!=specie) tTPCinfo=-1;
596 if(fTPC && !okTOF) return tTPCinfo;
597 if(ApplyPidTPCRaw(track,specie)!=specie) tTOFinfo=-1;
600 if(tTOFinfo==1 && tTPCinfo==1) return 1;
602 if(tTPCinfo+tTOFinfo==0 && fITS){
603 if(!CheckITSPIDStatus(track)) return tTPCinfo+tTOFinfo;
605 if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
612 //TPC for p<fPLimit[0], TOF for p>=fPLimit[0] (a la' Andrea A.)
613 // convention (temporary): -1 = kFALSE, 1 = kTRUE, 0 = not identified
614 if(fTPC && fTOF) if(!okTPC && !okTOF) return 0;
618 if(ptrack>=fPLimit[0] && ptrack<fPLimit[1] && fTPC) {
621 if(TPCRawAsym(track,specie)) tTPCinfo=1;
623 if(ApplyPidTPCRaw(track,specie)==specie) tTPCinfo=1;
629 if(ptrack>=fPLimit[1] && fTOF){
631 if(ApplyPidTOFRaw(track,specie)==specie) tTOFinfo=1;
636 if(ptrack<fPLimit[0] && fITS){
637 if(!CheckITSPIDStatus(track)) return 0;
638 if(ApplyPidITSRaw(track,specie)==specie) tITSinfo=1;
646 //----------------------------------
647 Int_t AliAODPidHF::MakeRawPid(AliAODTrack *track, Int_t specie){
648 // general method to compute PID
650 return MatchTPCTOF(track,specie);
652 if(fTPC && !fTOF && !fITS) {
655 tTPCres=ApplyPidTPCRaw(track,specie);
656 if(tTPCres==specie) return 1;
659 if(TPCRawAsym(track,specie)) tTPCres=1;
663 }else if(fTOF && !fTPC && !fITS) {
664 Int_t tTOFres=ApplyPidTOFRaw(track,specie);
665 if(tTOFres==specie) return 1;
667 }else if(fITS && !fTPC && !fTOF) {
668 Int_t tITSres=ApplyPidITSRaw(track,specie);
669 if(tITSres==specie) return 1;
672 AliError("You should enable just one detector if you don't want to match");
677 //--------------------------------------------
678 void AliAODPidHF::GetTPCBetheBlochParams(Double_t alephParameters[5]) const {
679 // TPC bethe bloch parameters
682 if(fPbPb) { // PbPb MC
684 alephParameters[0] = 1.44405/50.;
685 alephParameters[1] = 2.35409e+01;
686 alephParameters[2] = TMath::Exp(-2.90330e+01);
687 alephParameters[3] = 2.10681e+00;
688 alephParameters[4] = 4.62254e+00;
692 alephParameters[0]=0.0207667;
693 alephParameters[1]=29.9936;
694 alephParameters[2]=3.87866e-11;
695 alephParameters[3]=2.17291;
696 alephParameters[4]=7.1623;
698 alephParameters[0]=0.029021;
699 alephParameters[1]=25.4181;
700 alephParameters[2]=4.66596e-08;
701 alephParameters[3]=1.90008;
702 alephParameters[4]=4.63783;
704 alephParameters[0] = 2.15898/50.;
705 alephParameters[1] = 1.75295e+01;
706 alephParameters[2] = 3.40030e-09;
707 alephParameters[3] = 1.96178e+00;
708 alephParameters[4] = 3.91720e+00;
712 } else { // Real Data
714 if(fOnePad) { // pp 1-pad (since LHC10d)
716 alephParameters[0] =1.34490e+00/50.;
717 alephParameters[1] = 2.69455e+01;
718 alephParameters[2] = TMath::Exp(-2.97552e+01);
719 alephParameters[3] = 2.35339e+00;
720 alephParameters[4] = 5.98079e+00;
722 } else if(fPbPb) { // PbPb
724 // alephParameters[0] = 1.25202/50.;
725 // alephParameters[1] = 2.74992e+01;
726 // alephParameters[2] = TMath::Exp(-3.31517e+01);
727 // alephParameters[3] = 2.46246;
728 // alephParameters[4] = 6.78938;
730 alephParameters[0] = 5.10207e+00/50.;
731 alephParameters[1] = 7.94982e+00;
732 alephParameters[2] = TMath::Exp(-9.07942e+00);
733 alephParameters[3] = 2.38808e+00;
734 alephParameters[4] = 1.68165e+00;
736 } else if(fppLowEn2011){ // pp low energy
738 alephParameters[0]=0.031642;
739 alephParameters[1]=22.353;
740 alephParameters[2]=4.16239e-12;
741 alephParameters[3]=2.61952;
742 alephParameters[4]=5.76086;
744 } else { // pp no 1-pad (LHC10bc)
746 alephParameters[0] = 0.0283086/0.97;
747 alephParameters[1] = 2.63394e+01;
748 alephParameters[2] = 5.04114e-11;
749 alephParameters[3] = 2.12543e+00;
750 alephParameters[4] = 4.88663e+00;
758 //-----------------------
759 void AliAODPidHF::SetBetheBloch() {
760 // Set Bethe Bloch Parameters
762 Double_t alephParameters[5];
763 GetTPCBetheBlochParams(alephParameters);
764 fTPCResponse->SetBetheBlochParameters(alephParameters[0],alephParameters[1],alephParameters[2],alephParameters[3],alephParameters[4]);
768 //-----------------------
769 Bool_t AliAODPidHF::IsTOFPiKexcluded(AliAODTrack *track,Double_t nsigmaK){
770 // TOF proton compatibility
772 if(!CheckTOFPIDStatus(track)) return 0;
775 if(GetnSigmaTOF(track,3,nsigma)==1){
776 if(nsigma>nsigmaK) return kTRUE;
779 /* Double_t time[AliPID::kSPECIESN];
780 Double_t sigmaTOFPid[AliPID::kSPECIES];
781 AliAODPid *pidObj = track->GetDetPid();
782 pidObj->GetIntegratedTimes(time);
783 Double_t sigTOF=pidObj->GetTOFsignal();
785 AliAODEvent *event=(AliAODEvent*)track->GetAODEvent();
787 AliTOFHeader* tofH=(AliTOFHeader*)event->GetTOFHeader();
788 if (tofH && fPidResponse) {
789 AliTOFPIDResponse TOFres = (AliTOFPIDResponse)fPidResponse->GetTOFResponse();
790 sigTOF -= TOFres.GetStartTime(track->P());
791 sigmaTOFPid[3]=TOFres.GetExpectedSigma(track->P(),time[3],AliPID::ParticleMass(3));
793 else pidObj->GetTOFpidResolution(sigmaTOFPid);
794 } else pidObj->GetTOFpidResolution(sigmaTOFPid);
795 Double_t sigmaTOFtrack;
796 if (sigmaTOFPid[3]>0) sigmaTOFtrack=sigmaTOFPid[3];
797 else sigmaTOFtrack=fTOFSigma; // backward compatibility for old AODs
799 if((sigTOF-time[3])>nsigmaK*sigmaTOFtrack)return kTRUE;// K, Pi excluded (->LIKELY A PROTON)
804 //--------------------------------------------------------------------------
805 void AliAODPidHF::SetPriorDistribution(AliPID::EParticleType type,TH1F *prior){
808 // method setting the prior distributions to the AliPIDCombined object of the AliAODPidHF data member
809 // all the checks are done directly in the AliPIDCombined object
812 GetPidCombined()->SetPriorDistribution(type,prior);
814 //--------------------------------------------------------------------------
815 void AliAODPidHF::DrawPrior(AliPID::EParticleType type){
818 // Drawing prior distribution for type "type"
821 GetPidCombined()->GetPriorDistribution(type)->Draw();
824 //--------------------------------------------------------------------------
825 Int_t AliAODPidHF::GetnSigmaTPC(AliAODTrack *track, Int_t species, Double_t &nsigma) const{
826 // get n sigma for TPC
828 if(!CheckTPCPIDStatus(track)) return -1;
830 Double_t nsigmaTPC=-999;
833 AliAODPid *pidObj = track->GetDetPid();
834 Double_t dedx=pidObj->GetTPCsignal();
835 Double_t mom = pidObj->GetTPCmomentum();
836 if(mom>fPtThresholdTPC) return -2;
837 UShort_t nTPCClus=pidObj->GetTPCsignalN();
838 if(nTPCClus==0) {nTPCClus=track->GetTPCNcls();}
839 AliPID::EParticleType type=AliPID::EParticleType(species);
840 nsigmaTPC = fTPCResponse->GetNumberOfSigmas(mom,dedx,nTPCClus,type);
843 if(!fPidResponse) return -1;
844 AliPID::EParticleType type=AliPID::EParticleType(species);
845 nsigmaTPC = fPidResponse->NumberOfSigmasTPC(track,type);
851 //-----------------------------
853 Int_t AliAODPidHF::GetnSigmaTOF(AliAODTrack *track,Int_t species, Double_t &nsigma) const{
854 // get n sigma for TOF
856 if(!CheckTOFPIDStatus(track)) return -1;
859 nsigma = fPidResponse->NumberOfSigmasTOF(track,(AliPID::EParticleType)species);
862 AliFatal("To use TOF PID you need to attach AliPIDResponseTask");
868 //-----------------------
869 Bool_t AliAODPidHF::IsExcluded(AliAODTrack *track, Int_t labelTrack, Double_t nsigmaCut, TString detectors) {
870 // Exclude a given hypothesis (labelTracks) in detector
872 if (detectors.Contains("ITS")) {
874 AliInfo("Nothing to be done");
877 if (GetnSigmaITS(track,labelTrack,nsigma)==1){
878 if(nsigma>nsigmaCut) return kTRUE;
883 } else if (detectors.Contains("TPC")) {
886 if (GetnSigmaTPC(track,labelTrack,nsigma)==1){
887 if(nsigma>nsigmaCut) return kTRUE;
891 } else if (detectors.Contains("TOF")) {
893 if (!(CheckTOFPIDStatus(track))) return kFALSE;
895 if (GetnSigmaTOF(track,labelTrack,nsigma)==1){
896 if(nsigma>nsigmaCut) return kTRUE;
904 //-----------------------------
905 void AliAODPidHF::SetPriorsHistos(TString priorFileName){
906 // Set histograms with priors
908 for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
909 if(fPriorsH[ispecies]) delete fPriorsH[ispecies];
912 nt+=AliPID::ParticleName(ispecies);
914 TDirectory *current = gDirectory;
915 TFile *priorFile=TFile::Open(priorFileName);
917 TH1F* h3=static_cast<TH1F*>(priorFile->Get("priors3step9"));
918 TH1F* h2=static_cast<TH1F*>(priorFile->Get("priors2step9"));
919 TH1F* h1=static_cast<TH1F*>(priorFile->Get("priors1step9"));
921 fPriorsH[AliPID::kProton] = new TH1F(*h3);
922 fPriorsH[AliPID::kKaon ] = new TH1F(*h2);
923 fPriorsH[AliPID::kPion ] = new TH1F(*h1);
926 TF1 *salt=new TF1("salt","1.e-10",0,10);
927 fPriorsH[AliPID::kProton]->Add(salt);
928 fPriorsH[AliPID::kKaon ]->Add(salt);
929 fPriorsH[AliPID::kPion ]->Add(salt);
933 //----------------------------------
934 void AliAODPidHF::SetUpCombinedPID(){
935 // Configuration of combined Bayesian PID
937 fPidCombined->SetSelectedSpecies(AliPID::kSPECIES);
938 for (Int_t ispecies=0;ispecies<AliPID::kSPECIES;++ispecies) {
939 fPidCombined->SetPriorDistribution(static_cast<AliPID::EParticleType>(ispecies),fPriorsH[ispecies]);
941 switch (fCombDetectors){
943 fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetTOF);
946 fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC|AliPIDResponse::kDetITS);
949 fPidCombined->SetDetectorMask(AliPIDResponse::kDetTPC);
952 fPidCombined->SetDetectorMask(AliPIDResponse::kDetTOF);