MIDSX 0.1
A x-ray transport code system for dosimetry
Loading...
Searching...
No Matches
photon.h
1#ifndef PHOTON_H
2#define PHOTON_H
3
4#include <utility>
5#include "photon_interactions.h"
6#include "particle.h"
7#include "interaction_data.h"
8#include "particle_interaction_behavior.h"
9#include <memory>
10
15 int coherent = 0;
16 int incoherent = 0;
17 int total = 0;
18};
19
25class Photon : public Particle {
26public:
27 Photon() : interaction_behavior_(std::make_shared<PhotoelectricEffect>()) {}
35 Photon(Eigen::Vector3d& position, Eigen::Vector3d& direction, double energy) : Particle(position, direction, energy) {
36 interaction_behavior_ = std::make_shared<PhotoelectricEffect>();
37 }
38
44 double interact(Material& material) {
45 return interaction_behavior_->interact(*this, material);
46 }
47
53 void setInteractionBehavior(std::shared_ptr<ParticleInteractionBehavior> interaction_behavior) {
54 interaction_behavior_ = std::move(interaction_behavior);
55 }
56
61 scattering_history_.coherent++;
62 scattering_history_.total++;
63 }
64
69 scattering_history_.incoherent++;
70 scattering_history_.total++;
71 }
72
79 return scattering_history_.total;
80 }
81
88 return scattering_history_.coherent;
89 }
90
97 return scattering_history_.incoherent;
98 }
99
100
101private:
102 std::shared_ptr<ParticleInteractionBehavior> interaction_behavior_;
103 PhotonScatteringHistory scattering_history_;
104};
105
106#endif
Class which represents a material.
Definition material.h:19
Class which represents a particle.
Definition particle.h:36
Class which represents a photon. Inherits from Particle.
Definition photon.h:25
int getCoherentScatterCount() const
Returns the number of coherent scatters in the scattering history.
Definition photon.h:87
double interact(Material &material)
Performs the current interaction behavior of the photon.
Definition photon.h:44
void setInteractionBehavior(std::shared_ptr< ParticleInteractionBehavior > interaction_behavior)
Sets the interaction behavior of the photon.
Definition photon.h:53
void addIncoherentScatter()
Adds an incoherent scatter to the scattering history.
Definition photon.h:68
int getIncoherentScatterCount() const
Returns the number of incoherent scatters in the scattering history.
Definition photon.h:96
Photon(Eigen::Vector3d &position, Eigen::Vector3d &direction, double energy)
Constructor for the Photon class.
Definition photon.h:35
void addCoherentScatter()
Adds a coherent scatter to the scattering history.
Definition photon.h:60
int getTotalScatterCount() const
Returns to total number of scatters in the scattering history.
Definition photon.h:78
Struct which contains the scattering history of a photon.
Definition photon.h:14