IAP GITLAB

Skip to content
Snippets Groups Projects
Commit eb14f7fd authored by André Schmidt's avatar André Schmidt Committed by ralfulrich
Browse files

Replace Cascade.h

parent 65119801
No related branches found
No related tags found
No related merge requests found
...@@ -220,31 +220,36 @@ namespace corsika::cascade { ...@@ -220,31 +220,36 @@ namespace corsika::cascade {
} else { } else {
chargeNumber = corsika::particles::GetChargeNumber(vParticle.GetPID()); chargeNumber = corsika::particles::GetChargeNumber(vParticle.GetPID());
} }
auto magneticfield = corsika::geometry::Vector
(fEnvironment.GetCoordinateSystem(), 0_uT, 50_uT, 0_uT);
geometry::Vector<SpeedType::dimension_type> const velocity = geometry::Vector<SpeedType::dimension_type> const velocity =
vParticle.GetMomentum() / vParticle.GetEnergy() * corsika::units::constants::c; vParticle.GetMomentum() / vParticle.GetEnergy() * corsika::units::constants::c;
geometry::Vector<SpeedType::dimension_type> const velocityVerticalMag = geometry::Vector<dimensionless_d> const directionBefore = velocity / velocity.GetNorm();
velocity - magneticfield * velocity.dot(magneticfield) / (magneticfield.GetSquaredNorm()); auto magMaxLength = 1_m/0;
geometry::Vector<dimensionless_d> const directionBefore = velocity / velocity.GetNorm(); auto directionAfter = directionBefore;
LengthType const gyroradius = vParticle.GetEnergy() * velocityVerticalMag.GetNorm() * 1_V / if(chargeNumber != 0) {
(corsika::units::constants::cSquared * abs(chargeNumber) * auto magneticfield = corsika::geometry::Vector
magneticfield.GetNorm() * 1_eV); (fEnvironment.GetCoordinateSystem(), 0_uT, 50_uT, 0_uT);
LengthType const Steplength = 0.01 * gyroradius; geometry::Vector<SpeedType::dimension_type> const velocityVerticalMag =
// First Movement velocity - magneticfield * velocity.dot(magneticfield) / (magneticfield.GetSquaredNorm());
auto position = vParticle.GetPosition() + directionBefore * Steplength / 2; LengthType const gyroradius = vParticle.GetEnergy() * velocityVerticalMag.GetNorm() * 1_V /
// Change of direction by magnetic field at position (corsika::units::constants::cSquared * abs(chargeNumber) *
magneticfield = corsika::geometry::Vector(fEnvironment.GetCoordinateSystem(), 0_uT, 50_uT, 0_uT); magneticfield.GetNorm() * 1_eV);
geometry::Vector<dimensionless_d> const directionAfter = directionBefore + //steplength depending on how exact it should
velocity.cross(magneticfield) * chargeNumber * LengthType const Steplength = 0.01 * gyroradius;
Steplength * corsika::units::constants::cSquared * 1_eV/ // First Movement
(vParticle.GetEnergy() * velocity.GetSquaredNorm() * 1_V); auto position = vParticle.GetPosition() + directionBefore * Steplength / 2;
// Second Movement // Change of direction by magnetic field at position
position = position + directionAfter * Steplength / 2; magneticfield = corsika::geometry::Vector(fEnvironment.GetCoordinateSystem(), 0_uT, 50_uT, 0_uT);
LengthType const magMaxLength = (position - vParticle.GetPosition()).GetNorm(); directionAfter = directionBefore + velocity.cross(magneticfield) * chargeNumber *
geometry::Vector<dimensionless_d> const direction = (position - vParticle.GetPosition()) / Steplength * corsika::units::constants::cSquared * 1_eV /
magMaxLength; (vParticle.GetEnergy() * velocity.GetSquaredNorm() * 1_V);
vParticle.SetMomentum( direction * vParticle.GetMomentum().GetNorm()); // Second Movement
position = position + directionAfter * Steplength / 2;
magMaxLength = (position - vParticle.GetPosition()).GetNorm();
geometry::Vector<dimensionless_d> const direction = (position - vParticle.GetPosition()) /
magMaxLength;
vParticle.SetMomentum( direction * vParticle.GetMomentum().GetNorm());
std::cout << "New direction because of magnetic field: " << direction.GetComponents() << std::endl;
}
// determine geometric tracking // determine geometric tracking
auto [step, geomMaxLength, nextVol] = fTracking.GetTrack(vParticle); auto [step, geomMaxLength, nextVol] = fTracking.GetTrack(vParticle);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment