Class Candidate

Inheritance Relationships

Base Type

Class Documentation

class Candidate : public Referenced

All information about the cosmic ray.

The Candidate is a passive object, that holds the information about the state of the cosmic ray and the simulation itself.

Public Types

typedef Loki::AssocVector<std::string, Variant> PropertyMap

Public Functions

Candidate(int id = 0, double energy = 0, Vector3d position = Vector3d(0, 0, 0), Vector3d direction = Vector3d(-1, 0, 0), double z = 0, double weight = 1., std::string tagOrigin = "PRIM")
Candidate(const ParticleState &state)

Creates a candidate, initializing the Candidate::source, Candidate::created, Candidate::previous and Candidate::current state with the argument.

bool isActive() const
void setActive(bool b)
void setTrajectoryLength(double length)
double getTrajectoryLength() const
void setRedshift(double z)
double getRedshift() const
void setWeight(double weight)

Sets weight of each candidate. Weights are calculated for each tracked secondary.

void updateWeight(double weight)
double getWeight() const
void setCurrentStep(double step)

Sets the current step and increases the trajectory length accordingly. Only the propagation module should use this.

double getCurrentStep() const
void setNextStep(double step)

Sets the proposed next step. Only the propagation module should use this.

double getNextStep() const
void setTagOrigin(std::string tagOrigin)

Sets the tagOrigin of the candidate. Can be used to trace back the interactions

std::string getTagOrigin() const
void limitNextStep(double step)

Make a bid for the next step size: the lowest wins.

void setProperty(const std::string &name, const Variant &value)
const Variant &getProperty(const std::string &name) const
bool removeProperty(const std::string &name)
bool hasProperty(const std::string &name) const
void addSecondary(Candidate *c)

Add a new candidate to the list of secondaries.

Adds a new candidate to the list of secondaries of this candidate. The secondaries

Candidate::source and Candidate::previous state are set to the source and previous state of its parent. The secondaries Candidate::created and Candidate::current state are set to the current state of its parent, except for the secondaries current energy and particle id. Trajectory length and redshift are copied from the parent.

Parameters:

cCandidate

inline void addSecondary(ref_ptr<Candidate> c)
void addSecondary(int id, double energy, double w = 1., std::string tagOrigin = "SEC")

Add a new candidate to the list of secondaries.

Parameters:
  • id – particle ID of the secondary

  • energy – energy of the secondary

  • w – weight of the secondary

  • tagOrigin – tag of the secondary

void addSecondary(int id, double energy, Vector3d position, double w = 1., std::string tagOrigin = "SEC")

Add a new candidate to the list of secondaries.

Parameters:
  • id – particle ID of the secondary

  • energy – energy of the secondary

  • position – start position of the secondary

  • w – weight of the secondary

  • tagOrigin – tag of the secondary

void clearSecondaries()
std::string getDescription() const
uint64_t getSerialNumber() const

Unique (inside process) serial number (id) of candidate

void setSerialNumber(const uint64_t snr)
uint64_t getSourceSerialNumber() const

Serial number of candidate at source

uint64_t getCreatedSerialNumber() const

Serial number of candidate at creation

ref_ptr<Candidate> clone(bool recursive = false) const

Create an exact clone of candidate

Parameters:

recursive – recursively clone and add the secondaries

void restart()

Copy the source particle state to the current state and activate it if inactive, e.g. restart it

inline size_t addReference() const
inline size_t removeReference() const
inline int removeReferenceNoDelete() const
inline size_t getReferenceCount() const

Public Members

ParticleState source

Particle state at the source

ParticleState created

Particle state of parent particle at the time of creation

ParticleState current

Current particle state

ParticleState previous

Particle state at the end of the previous step

std::vector<ref_ptr<Candidate>> secondaries

Secondary particles from interactions

PropertyMap properties

Map of property names and their values.

Candidate *parent

Parent candidate. 0 if no parent (initial particle). Must not be a ref_ptr to prevent circular referencing.

Public Static Functions

static void setNextSerialNumber(uint64_t snr)

Set the next serial number to use

static uint64_t getNextSerialNumber()

Get the next serial number that will be assigned

Protected Attributes

mutable size_t _referenceCount