Program Listing for File ElectronPairProduction.h

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

#ifndef CRPROPA_ELECTRONPAIRPRODUCTION_H
#define CRPROPA_ELECTRONPAIRPRODUCTION_H

#include "crpropa/Module.h"
#include "crpropa/PhotonBackground.h"

namespace crpropa {

class ElectronPairProduction: public Module {
private:
        ref_ptr<PhotonField> photonField;
        std::vector<double> tabLossRate; /*< tabulated energy loss rate in [J/m] for protons at z = 0 */
        std::vector<double> tabLorentzFactor; /*< tabulated Lorentz factor */
        std::vector<std::vector<double> > tabSpectrum; /*< electron/positron cdf(Ee|log10(gamma)) for log10(Ee/eV)=7-24 in 170 steps and log10(gamma)=6-13 in 70 steps and*/
        double limit;
        bool haveElectrons; /*< if true, secondary electrons will be added to the simulation */
        std::string interactionTag = "EPP";

public:
        ElectronPairProduction(ref_ptr<PhotonField> photonField, bool haveElectrons =
                        false, double limit = 0.1);

        // set the target photon field
        void setPhotonField(ref_ptr<PhotonField> photonField);

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

        void setLimit(double limit);

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

        void initRate(std::string filename);
        void initSpectrum(std::string filename);
        void process(Candidate *candidate) const;

        double lossLength(int id, double lf, double z=0) const;

};
} // namespace crpropa

#endif // CRPROPA_ELECTRONPAIRPRODUCTION_H