Program Listing for File NuclearDecay.h

Return to documentation for file (include/crpropa/module/NuclearDecay.h)

#ifndef CRPROPA_NUCLEARDECAY_H
#define CRPROPA_NUCLEARDECAY_H

#include "crpropa/Module.h"

#include <vector>

namespace crpropa {
class NuclearDecay: public Module {
private:
        double limit;
        bool haveElectrons;
        bool havePhotons;
        bool haveNeutrinos;
        struct DecayMode {
                int channel; // (#beta- #beta+ #alpha #proton #neutron)
                double rate; // decay rate in [1/m]
                std::vector<double> energy; // photon energies of ensuing gamma decays
                std::vector<double> intensity; // probabilities of ensuing gamma decays
        };
        std::vector<std::vector<DecayMode> > decayTable; // decayTable[Z * 31 + N] = vector<DecayMode>
        std::string interactionTag = "ND";

public:
        NuclearDecay(bool electrons = false, bool photons = false, bool neutrinos = false, double limit = 0.1);

        void setLimit(double limit);

        // decide if secondary electrons are added to the simulation
        void setHaveElectrons(bool b);

        // decide if secondary photons are added to the simulation
        void setHavePhotons(bool b);

        // decide if secondary neutrinos are added to the simulation
        void setHaveNeutrinos(bool b);

        void setInteractionTag(std::string tag);
        std::string getInteractionTag() const;

        void process(Candidate *candidate) const;
        void performInteraction(Candidate *candidate, int channel) const;
        void gammaEmission(Candidate *candidate, int channel) const;
        void betaDecay(Candidate *candidate, bool isBetaPlus) const;
        void nucleonEmission(Candidate *candidate, int dA, int dZ) const;

        double meanFreePath(int id, double gamma);
};
} // namespace crpropa

#endif // CRPROPA_NUCLEARDECAY_H