12 #include <corsika/framework/geometry/RootCoordinateSystem.hpp> 13 #include <corsika/framework/geometry/Vector.hpp> 15 #include <corsika/modules/epos/ParticleConversion.hpp> 28 void clear() { ::epos::cptl_.nptl = 0; }
29 unsigned int getSize()
const { return ::epos::cptl_.nptl; }
30 unsigned int getCapacity()
const { return ::epos::mxptl; }
32 void setId(
const unsigned int i,
const int v) { ::epos::cptl_.idptl[i] = v; }
34 ::epos::cptl_.pptl[i][3] = v / 1_GeV;
36 void setMass(
const unsigned int i,
const HEPMassType v) {
37 ::epos::cptl_.pptl[i][4] = v / 1_GeV;
39 void setMomentum(
const unsigned int i,
const MomentumVector& v) {
41 for (
int idx = 0; idx < 3; ++idx) ::epos::cptl_.pptl[i][idx] = tmp[idx] / 1_GeV;
43 void setState(
const unsigned int i,
const int v) { ::epos::cptl_.istptl[i] = v; }
45 int getId(
const unsigned int i)
const { return ::epos::cptl_.idptl[i]; }
46 int getState(
const unsigned int i)
const { return ::epos::cptl_.istptl[i]; }
48 return ::epos::cptl_.pptl[i][3] * 1_GeV;
51 return ::epos::cptl_.pptl[i][4] * 1_GeV;
53 MomentumVector getMomentum(
const unsigned int i)
const {
56 ::epos::cptl_.pptl[i][1] * 1_GeV,
57 ::epos::cptl_.pptl[i][2] * 1_GeV};
61 MomentumVector getMomentum(
const unsigned int i,
64 ::epos::cptl_.pptl[i][1] * 1_GeV,
65 ::epos::cptl_.pptl[i][2] * 1_GeV};
69 void copy(
const unsigned int i1,
const unsigned int i2) {
70 ::epos::cptl_.idptl[i2] = ::epos::cptl_.idptl[i1];
71 ::epos::cptl_.iorptl[i2] = ::epos::cptl_.iorptl[i1];
72 ::epos::cptl_.jorptl[i2] = ::epos::cptl_.jorptl[i1];
73 ::epos::cptl_.istptl[i2] = ::epos::cptl_.istptl[i1];
74 ::epos::cptl_.ityptl[i2] = ::epos::cptl_.ityptl[i1];
75 for (
unsigned int i = 0; i < 5; ++i)
76 ::epos::cptl_.pptl[i2][i] = ::epos::cptl_.pptl[i1][i];
77 for (
unsigned int i = 0; i < 2; ++i) {
78 ::epos::cptl_.tivptl[i2][i] = ::epos::cptl_.tivptl[i1][i];
79 ::epos::cptl_.ifrptl[i2][i] = ::epos::cptl_.ifrptl[i1][i];
81 for (
unsigned int i = 0; i < 4; ++i) {
82 ::epos::cptl_.xorptl[i2][i] = ::epos::cptl_.xorptl[i1][i];
83 ::epos::cptl_.ibptl[i2][i] = ::epos::cptl_.ibptl[i1][i];
87 void swap(
const unsigned int i1,
const unsigned int i2) {
88 std::swap(::epos::cptl_.idptl[i2], ::epos::cptl_.idptl[i1]);
89 std::swap(::epos::cptl_.iorptl[i2], ::epos::cptl_.iorptl[i1]);
90 std::swap(::epos::cptl_.jorptl[i2], ::epos::cptl_.jorptl[i1]);
91 std::swap(::epos::cptl_.istptl[i2], ::epos::cptl_.istptl[i1]);
92 std::swap(::epos::cptl_.ityptl[i2], ::epos::cptl_.ityptl[i1]);
93 for (
unsigned int i = 0; i < 5; ++i)
94 std::swap(::epos::cptl_.pptl[i2][i], ::epos::cptl_.pptl[i1][i]);
95 for (
unsigned int i = 0; i < 2; ++i) {
96 std::swap(::epos::cptl_.tivptl[i2][i], ::epos::cptl_.tivptl[i1][i]);
97 std::swap(::epos::cptl_.ifrptl[i2][i], ::epos::cptl_.ifrptl[i1][i]);
99 for (
unsigned int i = 0; i < 4; ++i) {
100 std::swap(::epos::cptl_.xorptl[i2][i], ::epos::cptl_.xorptl[i1][i]);
101 std::swap(::epos::cptl_.ibptl[i2][i], ::epos::cptl_.ibptl[i1][i]);
105 void incrementSize() { ::epos::cptl_.nptl++; }
106 void decrementSize() {
107 if (::epos::cptl_.nptl > 0) { ::epos::cptl_.nptl--; }
111 template <
typename StackIteratorInterface>
118 void setParticleData(
const int vID,
139 void setEnergy(
const HEPEnergyType v) { getStackData().setEnergy(getIndex(), v); }
141 HEPEnergyType getEnergy()
const {
return getStackData().getEnergy(getIndex()); }
143 bool isFinal()
const {
return getStackData().getState(getIndex()) == 0; }
145 void setMass(
const HEPMassType v) { getStackData().setMass(getIndex(), v); }
147 HEPEnergyType getMass()
const {
return getStackData().getMass(getIndex()); }
149 void setPID(
const int v) { getStackData().setId(getIndex(), v); }
151 corsika::epos::EposCode getPID()
const {
152 return static_cast<corsika::epos::EposCode
>(getStackData().getId(getIndex()));
155 void setState(
const int v) { getStackData().setState(getIndex(), v); }
157 corsika::epos::EposCode getState()
const {
158 return static_cast<corsika::epos::EposCode
>(getStackData().getState(getIndex()));
161 MomentumVector getMomentum()
const {
return getStackData().getMomentum(getIndex()); }
164 return getStackData().getMomentum(getIndex(), CS);
167 void setMomentum(
const MomentumVector& v) {
168 getStackData().setMomentum(getIndex(), v);
Import and extend the phys::units package.
The Stack class provides (and connects) the main particle data storage machinery. ...
Vector< hepmomentum_d > MomentumVector
A 3D vector defined in a specific coordinate system with units HEPMomentumType.
CoordinateSystemPtr const & get_root_CoordinateSystem()
this is the only way to create ONE unique root CS
Description of particle stacks.
std::shared_ptr< CoordinateSystem const > CoordinateSystemPtr
To refer to CoordinateSystems, only the CoordinateSystemPtr must be used.
The base class to define the readout of particle properties from a particle stack.
QuantityVector< TDimension > const & getComponents() const