Class MagneticLens

Class Documentation

class MagneticLens

The lens for the galactic magnetic field. Note that the energies refer to protons (Z=1). To be used with other particles with a different charge number please select the rigidity accordingly.

Public Functions


Default constructor.

MagneticLens(uint8_t healpixorder)

Constructs lens with predefined healpix order.

MagneticLens(const string &filename)

Construct lens and load lens from file.

const Pixelization &getPixelization() const

Returns the pixelization used.


Default destructor.

bool transformCosmicRay(double rigidity, double &phi, double &theta)

Try to transform the comsic ray to a new direction. Returns false and does not change phi and theta if the cosmic ray is lost due to conservation of cosmic ray flux. Rigidity is given in Joule, phi and theta in rad.

bool transformCosmicRay(double rigidity, Vector3d &p)

Tries transform a cosmic ray with momentum vector p.

void transformModelVector(double *model, double rigidity) const

transforms the model array assuming that model points to an array of the correct size. Rigidity is given in Joule

void setLensPart(const ModelMatrixType &M, double rigidityMin, double rigidityMax)

Loads M as part of a lens and use it in given rigidity range with rigidities given in Joule.

void loadLens(const string &filename)

Loads a lens from a given file, containing lines like lensefile.MLDAT rigidityMin rigidityMax rigidities are given in logarithmic units [log10(E / eV)].

void normalizeLens()

Normalizes the lens parts to the maximum of sums of columns of every lenspart. By doing this, the lens won’t distort the spectrum.

void normalizeLensparts()

Normalizes the lens parts individually. Normalized this way, the lens generally distorts the spectrum of the sources, but deflects the UHECR more efficiently.

bool rigidityCovered(double rigidity) const

Checks if rigidity [Joule] is covered by lens.

void normalizeMatrixColumns()

Normalizes all matrix columns - the lens will then create fake anisotropies, but won’t drop particles.

double getMinimumRigidity() const

Returns minimum rigidity covered by lens, in eV.

double getMaximumRigidity() const

Returns maximum rigidity covered by lens, in eV.

double getNorm()
LensPart *getLensPart(double rigidity) const

Returns iterator to the lens part with rigidity Joule.

const std::vector<LensPart *> &getLensParts() const

Returns all lens parts.