#ifndef __JPHYSICS__JRADIATIONSOURCE__ #define __JPHYSICS__JRADIATIONSOURCE__ #include "JLang/JSharedPointer.hh" #include "JPhysics/JRadiation.hh" #include "JPhysics/JDIS.hh" #include "JPhysics/JConstants.hh" /** * \author mdejong */ namespace JPHYSICS {} namespace JPP { using namespace JPHYSICS; } namespace JPHYSICS { using JLANG::JSharedPointer; /** * Interface for calculation of inverse interaction length and shower energy. */ class JRadiationInterface { public: /** * Constructor. * * \param id radiation identifier */ JRadiationInterface(const int id) : id(id) {} /** * Virtual destructor. */ virtual ~JRadiationInterface() {} /** * Get radiation identifer. * * \return identifier */ int getID() const { return id; } /** * Get inverse interaction length. * * \param E muon energy [GeV] * \return inverse interaction length [m^-1] */ virtual double getInverseInteractionLength(const double E) const = 0; /** * Get energy of shower. * * \param E muon energy [GeV] * \return shower energy [GeV] */ virtual double getEnergyOfShower(const double E) const = 0; /** * Get RMS of scattering angle. * * \param E muon energy [GeV] * \param Es shower energy [GeV] * \return RMS scattering angle [rad] */ virtual double getThetaRMS(const double E, const double Es) const = 0; private: const int id; }; /** * Implementation for calculation of inverse interaction length and shower energy. * * This class implements the JRadiationInterface interface.\n * N.B: This class owns the object pointed to using JLANG::JSharedPointer. */ class JRadiationSource : public JRadiationInterface, public JSharedPointer, public JRadiationSource_t { public: /** * Constructor. * * \param id radiation identifier * \param radiation pointer to valid JRadition object * \param density mass density of radiation material [gr/cm³] * \param source pointers to member methods of JRadiation */ JRadiationSource(const int id, const JSharedPointer& radiation, const double density, const JRadiationSource_t source) : JRadiationInterface(id), JSharedPointer(radiation), JRadiationSource_t(source), rho(density) {} /** * Get inverse interaction length. * * \param E muon energy [GeV] * \return inverse interaction length [m^-1] */ virtual double getInverseInteractionLength(const double E) const override { return ((*this)->*sigma)(E) * rho * 1.0e6; } /** * Get energy of shower. * * \param E muon energy [GeV] * \return shower energy [GeV] */ virtual double getEnergyOfShower(const double E) const override { return ((*this)->*eloss)(E); } /** * Get RMS of scattering angle. * * \param E muon energy [GeV] * \param Es shower energy [GeV] * \return RMS scattering angle [rad] */ virtual double getThetaRMS(const double E, const double Es) const override { return ((*this)->*theta)(E, Es/E); } protected: const double rho; }; /** * Implementation for calculation of inverse interaction length and shower energy due to deep-inelastic muon-nucleon scattering. * * This class implements the JRadiationInterface interface. */ class JDISSource : public JRadiationInterface, public JDIS { public: /** * Constructor. * * \param id radiation identifier * \param density mass density of radiation material [gr/cm³] */ JDISSource(const int id, const double density) : JRadiationInterface(id), rho(density) {} /** * Get inverse interaction length. * * \param E muon energy [GeV] * \return inverse interaction length [m^-1] */ virtual double getInverseInteractionLength(const double E) const override { return this->getCrossSection(E) * (rho / NUCLEON_MOLAR_MASS) * AVOGADRO * 1.0e2; } /** * Get energy of shower. * * \param E muon energy [GeV] * \return shower energy [GeV] */ virtual double getEnergyOfShower(const double E) const override { return this->getE(E); } /** * Get RMS of scattering angle. * * \param E muon energy [GeV] * \param Es shower energy [GeV] * \return RMS scattering angle [rad] */ virtual double getThetaRMS(const double E, const double Es) const override { return static_cast(this)->getThetaRMS(E, Es/E); } protected: const double rho; }; } #endif