IAP GITLAB

Skip to content
Snippets Groups Projects
Commit eb1267f2 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by Felix Riehn
Browse files

coding style

parent d687a903
No related branches found
No related tags found
1 merge request!115Resolve "create ParticleCut process"
......@@ -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();
}
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment