Program Listing for File EMPairProduction.h

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

#ifndef CRPROPA_EMPAIRPRODUCTION_H
#define CRPROPA_EMPAIRPRODUCTION_H

#include <string>

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


namespace crpropa {
class EMPairProduction: public Module {
private:
        ref_ptr<PhotonField> photonField;       // target photon field
        bool haveElectrons;                                     // add secondary electrons to simulation
        double limit;                                           // limit the step to a fraction of the mean free path
        double thinning;                                        // factor of the thinning (0: no thinning, 1: maximum thinning)
        ref_ptr<Surface> surface; // surface that includes the nodes in the photonField grid to be included
        std::string interactionTag = "EMPP";
        ref_ptr<InteractionRates> interactionRates;
public:
        EMPairProduction(ref_ptr<PhotonField> photonField, bool haveElectrons = false, double thinning = 0, double limit = 0.1, ref_ptr<Surface> surface = nullptr);

        // 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 setSurface(ref_ptr<Surface> surface);
        ref_ptr<Surface> getSurface() const;

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

        void setInteractionRates(ref_ptr<InteractionRates> intRates);
        ref_ptr<InteractionRates> getInteractionRates() const;

        void initRate(std::string path);

        void initCumulativeRate(std::string path);

        double getRate(double E, const Vector3d &position = Vector3d(0.), double z = 0) const;

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

} // namespace crpropa

#endif // CRPROPA_EMPAIRPRODUCTION_H