#ifndef __JPHYSICS__JACOEFFSOURCE__ #define __JPHYSICS__JACOEFFSOURCE__ #include "JLang/JSharedPointer.hh" #include "JPhysics/JRadiation.hh" /** * \author mdejong */ namespace JPHYSICS {} namespace JPP { using namespace JPHYSICS; } namespace JPHYSICS { using JLANG::JSharedPointer; /** * Interface for calculation of ionization constant. */ class JACoeffInterface { public: /** * Virtual destructor. */ virtual ~JACoeffInterface() {} /** * Get ionization constant a. * * \param E muon energy [GeV] * \return ionization constant [GeV/m] */ virtual double getA(const double E) const = 0; }; /** * Implementation for calculation of ionization constant. * This class implements the JACoeffInterface interface.\n * N.B: This class owns the object pointed to using JLANG::JSharedPointer. */ class JACoeffSource : public JACoeffInterface, public JSharedPointer { public: /** * Constructor. * * \param radiation pointer to valid JRadition object * \param density mass density of radiation material [gr/cm³] */ JACoeffSource(const JSharedPointer& radiation, const double density) : JSharedPointer(radiation), rho(density) {} /** * Get ionization constant a. * * \param E muon energy [GeV] * \return ionization constant [GeV/m] */ virtual double getA(const double E) const override { return (*this)->CalculateACoeff(E) * rho * 1.0e6; } protected: const double rho; }; } #endif