slightly improved the rge handler.

This commit is contained in:
suter_a 2021-04-01 20:37:08 +02:00
parent cab8703f85
commit 56f094dad0
2 changed files with 6 additions and 6 deletions

View File

@ -185,7 +185,7 @@ if (OpenMP_FOUND)
endif (OpenMP_FOUND) endif (OpenMP_FOUND)
target_link_libraries(PUserFcnBase ${ROOT_LIBRARIES}) target_link_libraries(PUserFcnBase ${ROOT_LIBRARIES})
target_link_libraries(PRgeHandler ${ROOT_LIBRARIES}) target_link_libraries(PRgeHandler ${Boost_LIBRARIES} ${ROOT_LIBRARIES})
target_link_libraries(PMusr ${DependOnLibs}) target_link_libraries(PMusr ${DependOnLibs})
#--- install PUserFcnBase solib ----------------------------------------------- #--- install PUserFcnBase solib -----------------------------------------------

View File

@ -536,10 +536,10 @@ Double_t PRgeHandler::Get_n(const Double_t energy, const Double_t z)
break; break;
} }
} }
if (idx != -1) if (idx == -1)
return Get_n(idx, z); return 0.0;
return -1.0; return Get_n(idx, z);
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -555,7 +555,7 @@ Double_t PRgeHandler::Get_n(const Double_t energy, const Double_t z)
Double_t PRgeHandler::Get_n(const Int_t idx, const Double_t z) Double_t PRgeHandler::Get_n(const Int_t idx, const Double_t z)
{ {
if ((idx < 0) || (idx >= fData.size())) if ((idx < 0) || (idx >= fData.size()))
return -1.0; return 0.0;
if ((z < 0.0) || (z > GetZmax(idx))) if ((z < 0.0) || (z > GetZmax(idx)))
return 0.0; return 0.0;
@ -570,7 +570,7 @@ Double_t PRgeHandler::Get_n(const Int_t idx, const Double_t z)
Double_t nn=0.0; Double_t nn=0.0;
if (pos < 0) { if (pos < 0) {
nn = 0.0; nn = fData[idx].nn[0] * z/(fData[idx].depth[1]-fData[idx].depth[0]);
} else { // linear interpolation } else { // linear interpolation
nn = fData[idx].nn[pos] + nn = fData[idx].nn[pos] +
(fData[idx].nn[pos+1] - fData[idx].nn[pos]) * (fData[idx].nn[pos+1] - fData[idx].nn[pos]) *