diff --git a/Processes/ParticleCut/ParticleCut.cc b/Processes/ParticleCut/ParticleCut.cc index 455a9b8e66ea53e455b797e914ef931d2ff50f47..ca807889446e6ea24ab3819609c4b083b330303e 100644 --- a/Processes/ParticleCut/ParticleCut.cc +++ b/Processes/ParticleCut/ParticleCut.cc @@ -22,44 +22,31 @@ using namespace corsika::setup; namespace corsika::process { namespace particle_cut { - template <typename Particle> - bool ParticleCut::ParticleIsBelowEnergyCut(Particle& vP) const { + template <typename TParticle> + bool ParticleCut::ParticleIsBelowEnergyCut(TParticle const& vP) const { auto const energyLab = vP.GetEnergy(); // nuclei if (vP.GetPID() == particles::Code::Nucleus) { auto const ElabNuc = energyLab / vP.GetNuclearA(); - auto const EcmNN = sqrt(2. * ElabNuc * 0.93827_GeV); - if (ElabNuc < fECut || EcmNN < 10_GeV) - return true; - else - return false; + auto const EcmNN = sqrt(2. * units::constants::nucleonMass * ElabNuc); + return (ElabNuc < fECut || EcmNN < 10_GeV); } else { // TODO: center-of-mass energy hard coded - const HEPEnergyType Ecm = sqrt(2. * energyLab * 0.93827_GeV); - if (energyLab < fECut || Ecm < 10_GeV) - return true; - else - return false; + const HEPEnergyType Ecm = sqrt(2. * units::constants::nucleonMass * energyLab); + return (energyLab < fECut || Ecm < 10_GeV); } } bool ParticleCut::ParticleIsEmParticle(Code vCode) const { - bool is_em = false; // FOR NOW: switch switch (vCode) { + case Code::Gamma: case Code::Electron: - is_em = true; - break; case Code::Positron: - is_em = true; - break; - case Code::Gamma: - is_em = true; - break; + return true; default: - break; + return false; } - return is_em; } bool ParticleCut::ParticleIsInvisible(Code vCode) const { @@ -134,11 +121,11 @@ namespace corsika::process { } void ParticleCut::Init() { - fEmEnergy = 0. * 1_GeV; + fEmEnergy = 0._GeV; fEmCount = 0; - fInvEnergy = 0. * 1_GeV; + fInvEnergy = 0._GeV; fInvCount = 0; - fEnergy = 0. * 1_GeV; + fEnergy = 0._GeV; // defineEmParticles(); } diff --git a/Processes/ParticleCut/ParticleCut.h b/Processes/ParticleCut/ParticleCut.h index e715d85c453969da44b3bdd8a72c95933537267d..0ed8b5a26e8c5972ee95fbe065f0ceaa5e0860d3 100644 --- a/Processes/ParticleCut/ParticleCut.h +++ b/Processes/ParticleCut/ParticleCut.h @@ -15,43 +15,39 @@ #include <corsika/process/SecondariesProcess.h> #include <corsika/units/PhysicalUnits.h> -using namespace corsika; -using namespace corsika::units; -using namespace corsika::units::si; - namespace corsika::process { namespace particle_cut { class ParticleCut : public process::SecondariesProcess<ParticleCut> { - HEPEnergyType fECut; + units::si::HEPEnergyType const fECut; - HEPEnergyType fEnergy = 0_GeV; - HEPEnergyType fEmEnergy = 0_GeV; + units::si::HEPEnergyType fEnergy = 0 * units::si::electronvolt; + units::si::HEPEnergyType fEmEnergy = 0 * units::si::electronvolt; int fEmCount = 0; - HEPEnergyType fInvEnergy = 0_GeV; + units::si::HEPEnergyType fInvEnergy = 0 * units::si::electronvolt; int fInvCount = 0; public: - ParticleCut(const HEPEnergyType vCut) + ParticleCut(const units::si::HEPEnergyType vCut) : fECut(vCut) {} bool ParticleIsInvisible(particles::Code) const; template <typename TSecondaries> EProcessReturn DoSecondaries(TSecondaries&); - template <typename Particle> - bool ParticleIsBelowEnergyCut(Particle&) const; + template <typename TParticle> + bool ParticleIsBelowEnergyCut(TParticle const&) const; bool ParticleIsEmParticle(particles::Code) const; void Init(); void ShowResults(); - HEPEnergyType GetInvEnergy() const { return fInvEnergy; } - HEPEnergyType GetCutEnergy() const { return fEnergy; } - HEPEnergyType GetEmEnergy() const { return fEmEnergy; } + units::si::HEPEnergyType GetInvEnergy() const { return fInvEnergy; } + units::si::HEPEnergyType GetCutEnergy() const { return fEnergy; } + units::si::HEPEnergyType GetEmEnergy() const { return fEmEnergy; } }; - } // namespace particlecut + } // namespace particle_cut } // namespace corsika::process #endif