From f8df4a622fc9f8f7386889997cfee591cf73ab22 Mon Sep 17 00:00:00 2001
From: Andre Schmidt <schmidt-a@iklx288.ikp.kit.edu>
Date: Wed, 14 Oct 2020 13:34:03 +0200
Subject: [PATCH] moved distance->steplength to TrackingLine

---
 Framework/Cascade/Cascade.h | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h
index 9896259cb..a64298060 100644
--- a/Framework/Cascade/Cascade.h
+++ b/Framework/Cascade/Cascade.h
@@ -408,6 +408,9 @@ namespace corsika::cascade {
 
       // determine steplength for the magnetic field
       // because Steplength should not be min_distance
+	    
+      auto [position, direction, L2] = fTracking.MagneticStep(vParticle, min_distance);
+      
       
       int chargeNumber;
 	    if (corsika::particles::IsNucleus(vParticle.GetPID())) {
@@ -415,25 +418,6 @@ namespace corsika::cascade {
 	    } else {
 	      chargeNumber = corsika::particles::GetChargeNumber(vParticle.GetPID());
 	    }
-	    auto const* currentLogicalVolumeNode = vParticle.GetNode();
-	    auto magneticfield = currentLogicalVolumeNode->GetModelProperties().GetMagneticField(vParticle.GetPosition());
-      geometry::Vector<dimensionless_d> const directionBefore = vParticle.GetMomentum().normalized();
-	    auto c = directionBefore.cross(magneticfield) * chargeNumber * corsika::units::constants::c * 1_eV / 
-               (vParticle.GetMomentum().norm() * 1_V);
-	    LengthType Steplength = min_distance;
-	    if (chargeNumber != 0) {
-	      Steplength = sqrt(2 / c.squaredNorm() * (sqrt(c.squaredNorm() * min_distance * min_distance + 1) -1));
-        std::cout << "Steplength " << Steplength << std::endl;
-	    }
-      if (Steplength == 0_m) {
-        Steplength = min_distance;
-      }
-	    
-	    // This formula hasnt been tested
-	    
-      //auto [position, direction, L2] = fTracking.MagneticStep(vParticle, min_distance);
-      auto [position, direction, L2] = fTracking.MagneticStep(vParticle, Steplength);
-      
       //histL2(L2);
       histLlog2(L2);
       int pdg = static_cast<int>(particles::GetPDG(vParticle.GetPID()));
-- 
GitLab