Radiator trasparency calculation updated
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDPid.cxx
index 25f8af6..aa558c0 100644 (file)
@@ -46,10 +46,17 @@ void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Int_t nsp,Double_t *prob)
   
   if(thetaCerExp<=0){                                         //HMPID does not find anything reasonable for this track, assign 0.2 for all species
     for(Int_t iPart=0;iPart<nsp;iPart++) prob[iPart]=1.0/(Float_t)nsp;
-    return;
+    delete pPid ; pPid=0x0; return;
   } 
-
-  Double_t pmod = pTrk->GetP();                  // Momentum of the charged particle
+  
+  Double_t p[3] = {0}, pmod = 0;
+  if(pTrk->GetOuterHmpPxPyPz(p))  pmod = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);  // Momentum of the charged particle
+  
+  else {                                         
+    for(Int_t iPart=0;iPart<nsp;iPart++) prob[iPart]=1.0/(Float_t)nsp;
+    delete pPid ; pPid=0x0; return;
+  } 
+  
   Double_t hTot=0;                               // Initialize the total height of the amplitude method
   Double_t *h = new Double_t [nsp];              // number of charged particles to be considered
 
@@ -66,7 +73,7 @@ void AliHMPIDPid::FindPid(AliESDtrack *pTrk,Int_t nsp,Double_t *prob)
     
     if(sigmaRing==0) {
       for(Int_t jPart=0;jPart<nsp;jPart++) prob[jPart]=1.0/(Float_t)nsp;
-      return;
+      delete pPid ; pPid=0x0; delete [] h; return;
     } 
     
     if(TMath::Abs(thetaCerExp-thetaCerTh)<4*sigmaRing) desert = kFALSE;                                                                //