Class ParticleMapsContainer

Class Documentation

class ParticleMapsContainer

A container for particle maps.

The maps are stored with discrete energies on a logarithmic scale. The default energy width is 0.02 with an energy bin from 10**17.99 - 10**18.01 eV.

Public Functions

inline ParticleMapsContainer(double deltaLogE = 0.02, double bin0lowerEdge = 17.99)

Constructor.

Parameters:
  • deltaLogE – width of logarithmic energy bin [in eV]

  • bin0lowerEdge – logarithm of energy of the lower edge of first bin [in log(eV)]

~ParticleMapsContainer()

Destructor.

inline size_t getNumberOfPixels()
double *getMap(const int particleId, double energy)

Get the map for the particleId with the given energy.

Parameters:
  • particleId – id of the particle following the PDG numbering scheme

  • energy – the energy of the particle [in Joules]

Returns:

The map for a given particleId with a given energy

void addParticle(const int particleId, double energy, double galacticLongitude, double galacticLatitude, double weight = 1)

Adds a particle to the map container.

Parameters:
  • particleId – id of the particle following the PDG numbering scheme

  • energy – the energy of the particle [in Joules]

  • galacticLongitude – galactic longitude [radians]

  • galacticLatitude – galactic latitude [radians]

  • weight – relative weight for the specific particle

void addParticle(const int particleId, double energy, const Vector3d &v, double weight = 1)

Adds a particle to the map container.

Parameters:
  • particleId – id of the particle following the PDG numbering scheme

  • energy – the energy of the particle [in Joules]

  • v – vector containing the arrival directions of a particle

  • weight – relative weight for the specific particle

std::vector<int> getParticleIds()

Get all particle ids in the map.

Returns:

Vector of all ids.

std::vector<double> getEnergies(int pid)

Get energies in map.

Parameters:

pid – id of the particle following the PDG numbering scheme

Returns:

Energies are returned in units of eV (unlike in other CRPropa modules) for performance reasons

void applyLens(MagneticLens &lens)
void getRandomParticles(size_t N, vector<int> &particleId, vector<double> &energy, vector<double> &galacticLongitudes, vector<double> &galacticLatitudes)

Get random particles from map. The arguments are the vectors where the information will be stored.

Parameters:
  • N – number of particles to be selected

  • particleId – id of the particle following the PDG numbering scheme

  • energy – energy of interest [in eV]

  • galacticLongitudes – longitude in the interval [-pi, pi] [in radians]

  • galacticLatitudes – latitude in the interval [-pi/2, pi/2] [in radians]

bool placeOnMap(int pid, double energy, double &galacticLongitude, double &galacticLatitude)

Places a particle with given id and energy according to the probability maps.

Parameters:
  • pid – id of the particle following the PDG numbering scheme

  • energy – energy of interest [in eV]

  • galacticLongitude – longitude in the interval [-pi, pi] [in radians]

  • galacticLatitude – latitude in the interval [-pi/2, pi/2] [in radians]

Returns:

Returns false if operation not possible; true otherwise.

void forceWeightUpdate()

Force weight update prior to getting random particles. Only necessary when reusing pointer to maps after calculating weights.

inline double getSumOfWeights()

Get sum of weights of the maps.

Returns:

Sum of all weights.

inline double getWeight(int pid, double energy)

Get weight for a given particle and energy

Parameters:
  • pid – id of the particle following the PDG numbering scheme

  • energy – energy of interest [in eV]

Returns:

Weight for the chosen particle and energy.