Program Listing for File EMTripletPairProduction.h

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

#ifndef CRPROPA_EMTRIPLETPAIRPRODUCTION_H
#define CRPROPA_EMTRIPLETPAIRPRODUCTION_H

#include <fstream>
#include <cmath>

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

namespace crpropa {
class EMTripletPairProduction: public Module {
private:
        ref_ptr<PhotonField> photonField;
        bool haveElectrons;
        double limit;
        double thinning;
        std::string interactionTag = "EMTP";

        // tabulated interaction rate 1/lambda(E)
        std::vector<double> tabEnergy;
        std::vector<double> tabRate;

        // tabulated CDF(s_kin, E) = cumulative differential interaction rate
        std::vector<double> tabE;
        std::vector<double> tabs;
        std::vector< std::vector<double> > tabCDF;

public:
        EMTripletPairProduction(ref_ptr<PhotonField> photonField, bool haveElectrons = false, double thinning = 0, 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 setThinning(double thinning);

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

        void initRate(std::string filename);
        void initCumulativeRate(std::string filename);

        void process(Candidate *candidate) const;
        void performInteraction(Candidate *candidate) const;

};
} // namespace crpropa

#endif // CRPROPA_EMTRIPLETPAIRPRODUCTION_H