1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /* $Id: AliPIDResponse.cxx 46193 2010-12-21 09:00:14Z wiechula $ */
18 //-----------------------------------------------------------------
19 // Base class for handling the pid response //
20 // functions of all detectors //
21 // and give access to the nsigmas //
23 // Origin: Jens Wiechula, Uni Tuebingen, jens.wiechula@cern.ch //
24 //-----------------------------------------------------------------
27 #include <TObjArray.h>
33 #include <AliVEvent.h>
34 #include <AliVTrack.h>
37 #include <AliOADBContainer.h>
38 #include <AliTRDPIDParams.h>
39 #include <AliTRDPIDReference.h>
41 #include "AliPIDResponse.h"
43 #include "AliCentrality.h"
45 ClassImp(AliPIDResponse);
47 AliPIDResponse::AliPIDResponse(Bool_t isMC/*=kFALSE*/) :
48 TNamed("PIDResponse","PIDResponse"),
55 fITSPIDmethod(kITSTruncMean),
67 fArrPidResponseMaster(0x0),
68 fResolutionCorrection(0x0),
70 fTRDPIDReference(0x0),
71 fTOFTimeZeroType(kBest_T0),
80 AliLog::SetClassDebugLevel("AliPIDResponse",10);
81 AliLog::SetClassDebugLevel("AliESDpid",10);
82 AliLog::SetClassDebugLevel("AliAODpidUtil",10);
84 memset(fTRDslicesForPID,0,sizeof(UInt_t)*2);
87 //______________________________________________________________________________
88 AliPIDResponse::~AliPIDResponse()
93 delete fArrPidResponseMaster;
95 delete fTRDPIDReference;
98 //______________________________________________________________________________
99 AliPIDResponse::AliPIDResponse(const AliPIDResponse &other) :
101 fITSResponse(other.fITSResponse),
102 fTPCResponse(other.fTPCResponse),
103 fTRDResponse(other.fTRDResponse),
104 fTOFResponse(other.fTOFResponse),
105 fEMCALResponse(other.fEMCALResponse),
106 fRange(other.fRange),
107 fITSPIDmethod(other.fITSPIDmethod),
109 fOADBPath(other.fOADBPath),
113 fMCperiodUser(other.fMCperiodUser),
116 fRecoPassUser(other.fRecoPassUser),
119 fArrPidResponseMaster(0x0),
120 fResolutionCorrection(0x0),
122 fTRDPIDReference(0x0),
123 fTOFTimeZeroType(AliPIDResponse::kBest_T0),
125 fEMCALPIDParams(0x0),
132 memset(fTRDslicesForPID,0,sizeof(UInt_t)*2);
135 //______________________________________________________________________________
136 AliPIDResponse& AliPIDResponse::operator=(const AliPIDResponse &other)
142 delete fArrPidResponseMaster;
143 TNamed::operator=(other);
144 fITSResponse=other.fITSResponse;
145 fTPCResponse=other.fTPCResponse;
146 fTRDResponse=other.fTRDResponse;
147 fTOFResponse=other.fTOFResponse;
148 fEMCALResponse=other.fEMCALResponse;
150 fITSPIDmethod=other.fITSPIDmethod;
151 fOADBPath=other.fOADBPath;
156 fMCperiodUser=other.fMCperiodUser;
159 fRecoPassUser=other.fRecoPassUser;
162 fArrPidResponseMaster=0x0;
163 fResolutionCorrection=0x0;
165 fTRDPIDReference=0x0;
167 memset(fTRDslicesForPID,0,sizeof(UInt_t)*2);
168 fTOFTimeZeroType=AliPIDResponse::kBest_T0;
170 fCurrentEvent=other.fCurrentEvent;
175 //______________________________________________________________________________
176 Float_t AliPIDResponse::NumberOfSigmas(EDetCode detCode, const AliVParticle *track, AliPID::EParticleType type) const
179 // NumberOfSigmas for 'detCode'
183 case kDetITS: return NumberOfSigmasITS(track, type); break;
184 case kDetTPC: return NumberOfSigmasTPC(track, type); break;
185 case kDetTOF: return NumberOfSigmasTOF(track, type); break;
186 // case kDetTRD: return ComputeTRDProbability(track, type); break;
187 // case kDetPHOS: return ComputePHOSProbability(track, type); break;
188 // case kDetEMCAL: return NumberOfSigmasEMCAL(track, type); break;
189 // case kDetHMPID: return ComputeHMPIDProbability(track, type); break;
190 default: return -999.;
195 //______________________________________________________________________________
196 Float_t AliPIDResponse::NumberOfSigmasEMCAL(const AliVTrack *track, AliPID::EParticleType type) const {
198 AliVCluster *matchedClus = NULL;
203 Double_t fClsE = -1.;
205 Int_t nMatchClus = -1;
209 nMatchClus = track->GetEMCALcluster();
214 charge = track->Charge();
216 matchedClus = (AliVCluster*)fCurrentEvent->GetCaloCluster(nMatchClus);
220 // matched cluster is EMCAL
221 if(matchedClus->IsEMCAL()){
223 fClsE = matchedClus->E();
227 // NSigma value really meaningful only for electrons!
228 return fEMCALResponse.GetNumberOfSigmas(pt,EovP,type,charge);
237 //______________________________________________________________________________
238 AliPIDResponse::EDetPidStatus AliPIDResponse::ComputePIDProbability (EDetCode detCode, const AliVTrack *track, Int_t nSpecies, Double_t p[]) const
241 // Compute PID response of 'detCode'
245 case kDetITS: return ComputeITSProbability(track, nSpecies, p); break;
246 case kDetTPC: return ComputeTPCProbability(track, nSpecies, p); break;
247 case kDetTOF: return ComputeTOFProbability(track, nSpecies, p); break;
248 case kDetTRD: return ComputeTRDProbability(track, nSpecies, p); break;
249 case kDetPHOS: return ComputePHOSProbability(track, nSpecies, p); break;
250 case kDetEMCAL: return ComputeEMCALProbability(track, nSpecies, p); break;
251 case kDetHMPID: return ComputeHMPIDProbability(track, nSpecies, p); break;
252 default: return kDetNoSignal;
256 //______________________________________________________________________________
257 AliPIDResponse::EDetPidStatus AliPIDResponse::ComputeITSProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const
260 // Compute PID response for the ITS
263 // set flat distribution (no decision)
264 for (Int_t j=0; j<nSpecies; j++) p[j]=1./nSpecies;
266 if ((track->GetStatus()&AliVTrack::kITSin)==0 &&
267 (track->GetStatus()&AliVTrack::kITSout)==0) return kDetNoSignal;
269 Double_t mom=track->P();
270 Double_t dedx=track->GetITSsignal();
273 ULong_t trStatus=track->GetStatus();
274 if(trStatus&AliVTrack::kTPCin) isSA=kFALSE;
275 UChar_t clumap=track->GetITSClusterMap();
276 Int_t nPointsForPid=0;
277 for(Int_t i=2; i<6; i++){
278 if(clumap&(1<<i)) ++nPointsForPid;
281 if(nPointsForPid<3) { // track not to be used for combined PID purposes
282 // track->ResetStatus(AliVTrack::kITSpid);
286 Bool_t mismatch=kTRUE/*, heavy=kTRUE*/;
287 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
288 Double_t mass=AliPID::ParticleMass(j);//GeV/c^2
289 Double_t bethe=fITSResponse.Bethe(momITS,mass);
290 Double_t sigma=fITSResponse.GetResolution(bethe,nPointsForPid,isSA);
291 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
292 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
294 p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
298 // Check for particles heavier than (AliPID::kSPECIES - 1)
299 // if (dedx < (bethe + fRange*sigma)) heavy=kFALSE;
304 for (Int_t j=0; j<AliPID::kSPECIES; j++) p[j]=1./AliPID::kSPECIES;
311 //______________________________________________________________________________
312 AliPIDResponse::EDetPidStatus AliPIDResponse::ComputeTPCProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const
315 // Compute PID response for the TPC
318 // set flat distribution (no decision)
319 for (Int_t j=0; j<nSpecies; j++) p[j]=1./nSpecies;
321 // check quality of the track
322 if ( (track->GetStatus()&AliVTrack::kTPCin )==0 && (track->GetStatus()&AliVTrack::kTPCout)==0 ) return kDetNoSignal;
324 Double_t mom = track->GetTPCmomentum();
326 Double_t dedx=track->GetTPCsignal();
327 Bool_t mismatch=kTRUE/*, heavy=kTRUE*/;
329 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
330 AliPID::EParticleType type=AliPID::EParticleType(j);
331 Double_t bethe=fTPCResponse.GetExpectedSignal(mom,type);
332 Double_t sigma=fTPCResponse.GetExpectedSigma(mom,track->GetTPCsignalN(),type);
333 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
334 p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
336 p[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
340 // TODO: Light nuclei, also in TPC pid response
342 // Check for particles heavier than (AliPID::kSPECIES - 1)
343 // if (dedx < (bethe + fRange*sigma)) heavy=kFALSE;
348 for (Int_t j=0; j<nSpecies; j++) p[j]=1./nSpecies;
354 //______________________________________________________________________________
355 AliPIDResponse::EDetPidStatus AliPIDResponse::ComputeTOFProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const
358 // Compute PID response for the
361 // set flat distribution (no decision)
362 for (Int_t j=0; j<nSpecies; j++) p[j]=1./nSpecies;
364 if ((track->GetStatus()&AliVTrack::kTOFout)==0) return kDetNoSignal;
365 if ((track->GetStatus()&AliVTrack::kTIME)==0) return kDetNoSignal;
367 Double_t time[AliPID::kSPECIESN];
368 track->GetIntegratedTimes(time);
370 Double_t sigma[AliPID::kSPECIES];
371 for (Int_t iPart = 0; iPart < AliPID::kSPECIES; iPart++) {
372 sigma[iPart] = fTOFResponse.GetExpectedSigma(track->P(),time[iPart],AliPID::ParticleMass(iPart));
375 Bool_t mismatch = kTRUE/*, heavy = kTRUE*/;
376 for (Int_t j=0; j<AliPID::kSPECIES; j++) {
377 AliPID::EParticleType type=AliPID::EParticleType(j);
378 Double_t nsigmas=NumberOfSigmasTOF(track,type);
380 Double_t sig = sigma[j];
381 if (TMath::Abs(nsigmas) > (fRange+2)) {
382 p[j] = TMath::Exp(-0.5*(fRange+2)*(fRange+2))/sig;
384 p[j] = TMath::Exp(-0.5*nsigmas*nsigmas)/sig;
386 if (TMath::Abs(nsigmas)<5.){
387 Double_t nsigmasTPC=NumberOfSigmasTPC(track,type);
388 if (TMath::Abs(nsigmasTPC)<5.) mismatch=kFALSE;
396 // TODO: Light nuclei
400 //______________________________________________________________________________
401 AliPIDResponse::EDetPidStatus AliPIDResponse::ComputeTRDProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const
404 // Compute PID response for the
407 // set flat distribution (no decision)
408 for (Int_t j=0; j<nSpecies; j++) p[j]=1./nSpecies;
409 if((track->GetStatus()&AliVTrack::kTRDout)==0) return kDetNoSignal;
412 Double_t dedx[48]; // Allocate space for the maximum number of TRD slices
413 Int_t nslices = fTRDslicesForPID[1] - fTRDslicesForPID[0] + 1;
414 AliDebug(1, Form("First Slice: %d, Last Slice: %d, Number of slices: %d", fTRDslicesForPID[0], fTRDslicesForPID[1], nslices));
415 for(UInt_t ilayer = 0; ilayer < 6; ilayer++){
416 mom[ilayer] = track->GetTRDmomentum(ilayer);
417 for(UInt_t islice = fTRDslicesForPID[0]; islice <= fTRDslicesForPID[1]; islice++){
418 dedx[ilayer*nslices+islice-fTRDslicesForPID[0]] = track->GetTRDslice(ilayer, islice);
421 fTRDResponse.GetResponse(nslices, dedx, mom, p);
424 //______________________________________________________________________________
425 AliPIDResponse::EDetPidStatus AliPIDResponse::ComputeEMCALProbability (const AliVTrack *track, Int_t nSpecies, Double_t p[]) const
428 // Compute PID response for the EMCAL
431 AliVCluster *matchedClus = NULL;
436 Double_t fClsE = -1.;
438 Int_t nMatchClus = -1;
442 nMatchClus = track->GetEMCALcluster();
448 charge = track->Charge();
450 matchedClus = (AliVCluster*)fCurrentEvent->GetCaloCluster(nMatchClus);
454 // matched cluster is EMCAL
455 if(matchedClus->IsEMCAL()){
457 fClsE = matchedClus->E();
461 // compute the probabilities
462 if( 999 != fEMCALResponse.ComputeEMCALProbability(pt,EovP,charge,p)){
464 // in case everything is OK
472 // in all other cases set flat distribution (no decision)
473 for (Int_t j=0; j<nSpecies; j++) p[j]=1./nSpecies;
477 //______________________________________________________________________________
478 AliPIDResponse::EDetPidStatus AliPIDResponse::ComputePHOSProbability (const AliVTrack */*track*/, Int_t nSpecies, Double_t p[]) const
481 // Compute PID response for the PHOS
484 // set flat distribution (no decision)
485 for (Int_t j=0; j<nSpecies; j++) p[j]=1./nSpecies;
488 //______________________________________________________________________________
489 AliPIDResponse::EDetPidStatus AliPIDResponse::ComputeHMPIDProbability(const AliVTrack *track, Int_t nSpecies, Double_t p[]) const
492 // Compute PID response for the HMPID
495 // set flat distribution (no decision)
496 for (Int_t j=0; j<nSpecies; j++) p[j]=1./nSpecies;
497 if((track->GetStatus()&AliVTrack::kHMPIDpid)==0) return kDetNoSignal;
499 track->GetHMPIDpid(p);
504 //______________________________________________________________________________
505 void AliPIDResponse::InitialiseEvent(AliVEvent *event, Int_t pass)
508 // Apply settings for the current event
515 fRun=event->GetRunNumber();
522 //TPC resolution parametrisation PbPb
523 if ( fResolutionCorrection ){
524 Double_t corrSigma=fResolutionCorrection->Eval(GetTPCMultiplicityBin(event));
525 fTPCResponse.SetSigma(3.79301e-03*corrSigma, 2.21280e+04);
529 SetTOFResponse(event, (AliPIDResponse::EStartTimeType_t)fTOFTimeZeroType);
531 // Get and set centrality
532 AliCentrality *centrality = event->GetCentrality();
534 fCurrCentrality = centrality->GetCentralityPercentile("V0M");
537 fCurrCentrality = -1;
541 //______________________________________________________________________________
542 void AliPIDResponse::ExecNewRun()
545 // Things to Execute upon a new run
549 SetITSParametrisation();
551 SetTPCPidResponseMaster();
552 SetTPCParametrisation();
554 SetTRDPidResponseMaster();
555 InitializeTRDResponse();
557 SetEMCALPidResponseMaster();
558 InitializeEMCALResponse();
560 fTOFResponse.SetTimeResolution(fTOFres);
563 //_____________________________________________________
564 Double_t AliPIDResponse::GetTPCMultiplicityBin(const AliVEvent * const event)
567 // Get TPC multiplicity in bins of 150
570 const AliVVertex* vertexTPC = event->GetPrimaryVertex();
571 Double_t tpcMulti=0.;
573 Double_t vertexContribTPC=vertexTPC->GetNContributors();
574 tpcMulti=vertexContribTPC/150.;
575 if (tpcMulti>20.) tpcMulti=20.;
581 //______________________________________________________________________________
582 void AliPIDResponse::SetRecoInfo()
585 // Set reconstruction information
596 TPRegexp reg(".*(LHC11[a-z]+[0-9]+[a-z_]*)/.*");
597 //find the period by run number (UGLY, but not stored in ESD and AOD... )
598 if (fRun>=114737&&fRun<=117223) { fLHCperiod="LHC10B"; fMCperiodTPC="LHC10D1"; }
599 else if (fRun>=118503&&fRun<=121040) { fLHCperiod="LHC10C"; fMCperiodTPC="LHC10D1"; }
600 else if (fRun>=122195&&fRun<=126437) { fLHCperiod="LHC10D"; fMCperiodTPC="LHC10F6A"; }
601 else if (fRun>=127710&&fRun<=130850) { fLHCperiod="LHC10E"; fMCperiodTPC="LHC10F6A"; }
602 else if (fRun>=133004&&fRun<=135029) { fLHCperiod="LHC10F"; fMCperiodTPC="LHC10F6A"; }
603 else if (fRun>=135654&&fRun<=136377) { fLHCperiod="LHC10G"; fMCperiodTPC="LHC10F6A"; }
604 else if (fRun>=136851&&fRun<=139517) {
606 fMCperiodTPC="LHC10H8";
607 if (reg.MatchB(fCurrentFile)) fMCperiodTPC="LHC11A10";
610 else if (fRun>=139699&&fRun<=146860) { fLHCperiod="LHC11A"; fMCperiodTPC="LHC10F6A"; }
611 //TODO: periods 11B, 11C are not yet treated assume 11d for the moment
612 else if (fRun>=148531&&fRun<=155384) { fLHCperiod="LHC11D"; fMCperiodTPC="LHC10F6A"; }
613 else if (fRun>=156477&&fRun<=159635) { fLHCperiod="LHC11D"; fMCperiodTPC="LHC10F6A"; }
614 else if (fRun>=166529) {
616 fMCperiodTPC="LHC11A10";
621 //exception new pp MC productions from 2011
622 if (fBeamType=="PP" && reg.MatchB(fCurrentFile)) fMCperiodTPC="LHC11B2";
625 //______________________________________________________________________________
626 void AliPIDResponse::SetITSParametrisation()
629 // Set the ITS parametrisation
633 //______________________________________________________________________________
634 void AliPIDResponse::SetTPCPidResponseMaster()
637 // Load the TPC pid response functions from the OADB
639 //don't load twice for the moment
640 if (fArrPidResponseMaster) return;
643 //reset the PID response functions
644 delete fArrPidResponseMaster;
645 fArrPidResponseMaster=0x0;
647 TString fileName(Form("%s/COMMON/PID/data/TPCPIDResponse.root", fOADBPath.Data()));
649 TFile *f=TFile::Open(fileName.Data());
650 if (f && f->IsOpen() && !f->IsZombie()){
651 fArrPidResponseMaster=dynamic_cast<TObjArray*>(f->Get("TPCPIDResponse"));
655 if (!fArrPidResponseMaster){
656 AliFatal(Form("Could not retrieve the TPC pid response from: %s",fileName.Data()));
659 fArrPidResponseMaster->SetOwner();
662 //______________________________________________________________________________
663 void AliPIDResponse::SetTPCParametrisation()
666 // Change BB parametrisation for current run
669 if (fLHCperiod.IsNull()) {
670 AliFatal("No period set, not changing parametrisation");
675 // Set default parametrisations for data and MC
679 TString datatype="DATA";
680 //in case of mc fRecoPass is per default 1
689 for (Int_t ispec=0; ispec<AliPID::kSPECIES; ++ispec){
690 fTPCResponse.SetResponseFunction((AliPID::EParticleType)ispec,0x0);
694 //set the new PID splines
696 TString period=fLHCperiod;
697 if (fArrPidResponseMaster){
699 //for MC don't use period information
700 // if (fIsMC) period="[A-Z0-9]*";
701 //for MC use MC period information
702 if (fIsMC) period=fMCperiodTPC;
703 //pattern for the default entry (valid for all particles)
704 TPRegexp reg(Form("TSPLINE3_%s_([A-Z]*)_%s_PASS%d_%s_MEAN",datatype.Data(),period.Data(),fRecoPass,fBeamType.Data()));
706 //loop over entries and filter them
707 for (Int_t iresp=0; iresp<fArrPidResponseMaster->GetEntriesFast();++iresp){
708 TObject *responseFunction=fArrPidResponseMaster->At(iresp);
709 if (responseFunction==0x0) continue;
710 TString responseName=responseFunction->GetName();
712 if (!reg.MatchB(responseName)) continue;
714 TObjArray *arr=reg.MatchS(responseName);
715 TString particleName=arr->At(1)->GetName();
717 if (particleName.IsNull()) continue;
718 if (particleName=="ALL") grAll=responseFunction;
721 for (Int_t ispec=0; ispec<AliPID::kSPECIES; ++ispec){
722 TString particle=AliPID::ParticleName(ispec);
724 if ( particle == particleName ){
725 fTPCResponse.SetResponseFunction((AliPID::EParticleType)ispec,responseFunction);
726 fTPCResponse.SetUseDatabase(kTRUE);
727 AliInfo(Form("Adding graph: %d - %s",ispec,responseFunction->GetName()));
734 //set default response function to all particles which don't have a specific one
736 for (Int_t ispec=0; ispec<AliPID::kSPECIES; ++ispec){
737 if (!fTPCResponse.GetResponseFunction((AliPID::EParticleType)ispec)){
738 fTPCResponse.SetResponseFunction((AliPID::EParticleType)ispec,grAll);
739 AliInfo(Form("Adding graph: %d - %s",ispec,grAll->GetName()));
746 // Setup resolution parametrisation
750 fTPCResponse.SetSigma(3.79301e-03, 2.21280e+04);
753 fTPCResponse.SetSigma(2.30176e-02, 5.60422e+02);
755 if (fArrPidResponseMaster)
756 fResolutionCorrection=(TF1*)fArrPidResponseMaster->FindObject(Form("TF1_%s_ALL_%s_PASS%d_%s_SIGMA",datatype.Data(),period.Data(),fRecoPass,fBeamType.Data()));
758 if (fResolutionCorrection) AliInfo(Form("Setting multiplicity correction function: %s",fResolutionCorrection->GetName()));
761 //______________________________________________________________________________
762 void AliPIDResponse::SetTRDPidResponseMaster()
765 // Load the TRD pid params and references from the OADB
767 if(fTRDPIDParams) return;
768 AliOADBContainer contParams("contParams");
770 Int_t statusPars = contParams.InitFromFile(Form("%s/COMMON/PID/data/TRDPIDParams.root", fOADBPath.Data()), "AliTRDPIDParams");
772 AliError("Failed initializing PID Params from OADB");
774 AliInfo(Form("Loading TRD Params from %s/COMMON/PID/data/TRDPIDParams.root", fOADBPath.Data()));
775 fTRDPIDParams = dynamic_cast<AliTRDPIDParams *>(contParams.GetObject(fRun));
777 AliError(Form("TRD Params not found in run %d", fRun));
781 AliOADBContainer contRefs("contRefs");
782 Int_t statusRefs = contRefs.InitFromFile(Form("%s/COMMON/PID/data/TRDPIDReferenceLQ1D.root", fOADBPath.Data()), "AliTRDPIDReference");
784 AliInfo("Failed Loading References for TRD");
786 AliInfo(Form("Loading TRD References from %s/COMMON/PID/data/TRDPIDReferenceLQ1D.root", fOADBPath.Data()));
787 fTRDPIDReference = dynamic_cast<AliTRDPIDReference *>(contRefs.GetObject(fRun));
788 if(!fTRDPIDReference){
789 AliError(Form("TRD References not found in OADB Container for run %d", fRun));
794 //______________________________________________________________________________
795 void AliPIDResponse::InitializeTRDResponse(){
797 // Set PID Params and references to the TRD PID response
799 fTRDResponse.SetPIDParams(fTRDPIDParams);
800 fTRDResponse.Load(fTRDPIDReference);
801 if(fLHCperiod == "LHC10b" || fLHCperiod == "LHC10c" || fLHCperiod == "LHC10d" || fLHCperiod == "LHC10e"){
802 fTRDslicesForPID[0] = 0;
803 fTRDslicesForPID[1] = 7;
807 //_________________________________________________________________________
808 Bool_t AliPIDResponse::IdentifiedAsElectronTRD(const AliVTrack *vtrack, Double_t efficiencyLevel) const {
810 // Check whether track is identified as electron under a given electron efficiency hypothesis
812 Double_t probs[AliPID::kSPECIES];
813 ComputeTRDProbability(vtrack, AliPID::kSPECIES, probs);
815 Int_t ntracklets = vtrack->GetTRDntrackletsPID();
816 // Take mean of the TRD momenta in the given tracklets
817 Float_t p = 0, trdmomenta[AliVTrack::kTRDnPlanes];
819 for(Int_t iPl=0;iPl<AliVTrack::kTRDnPlanes;iPl++){
820 if(vtrack->GetTRDmomentum(iPl) > 0.){
821 trdmomenta[nmomenta++] = vtrack->GetTRDmomentum(iPl);
824 p = TMath::Mean(nmomenta, trdmomenta);
826 return fTRDResponse.IdentifiedAsElectron(ntracklets, probs, p, efficiencyLevel);
829 //______________________________________________________________________________
830 void AliPIDResponse::SetEMCALPidResponseMaster()
833 // Load the EMCAL pid response functions from the OADB
835 TObjArray* fEMCALPIDParamsRun = NULL;
836 TObjArray* fEMCALPIDParamsPass = NULL;
838 if(fEMCALPIDParams) return;
839 AliOADBContainer contParams("contParams");
841 Int_t statusPars = contParams.InitFromFile(Form("%s/COMMON/PID/data/EMCALPIDParams.root", fOADBPath.Data()), "AliEMCALPIDParams");
843 AliError("Failed initializing PID Params from OADB");
846 AliInfo(Form("Loading EMCAL Params from %s/COMMON/PID/data/EMCALPIDParams.root", fOADBPath.Data()));
848 fEMCALPIDParamsRun = dynamic_cast<TObjArray *>(contParams.GetObject(fRun));
849 if(fEMCALPIDParamsRun) fEMCALPIDParamsPass = dynamic_cast<TObjArray *>(fEMCALPIDParamsRun->FindObject(Form("pass%d",fRecoPass)));
850 if(fEMCALPIDParamsPass) fEMCALPIDParams = dynamic_cast<TObjArray *>(fEMCALPIDParamsPass->FindObject(Form("EMCALPIDParams_Particles")));
852 if(!fEMCALPIDParams){
853 AliError(Form("EMCAL Params not found in run %d pass %d", fRun, fRecoPass));
854 AliInfo("Will take the standard LHC11d instead ...");
856 fEMCALPIDParamsRun = dynamic_cast<TObjArray *>(contParams.GetObject(156477));
857 if(fEMCALPIDParamsRun) fEMCALPIDParamsPass = dynamic_cast<TObjArray *>(fEMCALPIDParamsRun->FindObject(Form("pass%d",1)));
858 if(fEMCALPIDParamsPass) fEMCALPIDParams = dynamic_cast<TObjArray *>(fEMCALPIDParamsPass->FindObject(Form("EMCALPIDParams_Particles")));
860 if(!fEMCALPIDParams){
861 AliError(Form("DEFAULT EMCAL Params (LHC11d) not found in file %s/COMMON/PID/data/EMCALPIDParams.root", fOADBPath.Data()));
867 //______________________________________________________________________________
868 void AliPIDResponse::InitializeEMCALResponse(){
870 // Set PID Params to the EMCAL PID response
872 fEMCALResponse.SetPIDParams(fEMCALPIDParams);