From 45423eeb43aa007f5ca4251922184790b3156cff Mon Sep 17 00:00:00 2001 From: Michael Duehrssen <michael.duehrssen@cern.ch> Date: Thu, 2 Apr 2020 16:11:45 +0200 Subject: [PATCH] FastCaloSim: use keV unit in TFCSEnergyInterpolationSpline --- .../src/TFCSEnergyInterpolationSpline.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyInterpolationSpline.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyInterpolationSpline.cxx index ac49ab471e9..27ab68aebe5 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyInterpolationSpline.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyInterpolationSpline.cxx @@ -13,6 +13,19 @@ #include <iostream> #include <vector> +#ifdef __FastCaloSimStandAlone__ +namespace Gaudi { + namespace Units { + constexpr double megaelectronvolt = 1.; + constexpr double kiloelectronvolt = 1.e-3 * megaelectronvolt; + constexpr double keV = kiloelectronvolt; + } +} +#else +#include "GaudiKernel/SystemOfUnits.h" +#endif + + //============================================= //======= TFCSEnergyInterpolation ========= //============================================= @@ -42,7 +55,7 @@ FCSReturnCode TFCSEnergyInterpolationSpline::simulate(TFCSSimulationState& simul if(OnlyScaleEnergy()) Einit=simulstate.E(); else Einit=Ekin; //catch very small values of Ekin (use 1 keV here) and fix the spline lookup to the 1keV value - const float logEkin=(Ekin>0.001?TMath::Log(Ekin):TMath::Log(0.001)); + const float logEkin=(Ekin>Gaudi::Units::keV?TMath::Log(Ekin):TMath::Log(Gaudi::Units::keV)); if(logEkin<m_spline.GetXmin()) { Emean=m_spline.Eval(m_spline.GetXmin())*Einit; } else { -- GitLab