Project

General

Profile

Meeting 2015 10 23

Objectives Proposed during last meeting

  1. (DONE) Complete last meeting's wiki page with all the discussed information (Nico had some unexpected issues before the meeting with my computer).
  2. (DONE) Decide on a way to time simulations without taking into account initialization (and output, of course).
    How can we do this in the Solver? Is there an internal way of doing it? Maybe simulating with 0 time or 0 steps?
    Check if this is already done in Geant4 (TimeEvent)
  3. (DONE, MISSING RESULTS PRESENTATION) For each simulation with a certain number of planes, calculate the error of the simulation.
  4. (DONE) Plot simulation times as ratios taking the Geant4 time as baseline.
  5. New Experiment: varying stepMax (from 0.1mm to 100mm) calculate the error in the first step (in the position and in the velocity)
  6. New Experiment: study impact of deltaInt parameter in Geant4 when changing the number of planes.
    Has the 'safety' parameter any effect on the error?
  7. Make some experiments with a different magnetic field:
    B(x,y) = (B/R) sqrt( x*x + (y+R)*(y+R)) zhat (where B= constant, zhat is the directional vector along the z axis, R is the radius of the circle)
    This field will keep the problem same as it is, but will give a deviation if the particle is off the circle
    (due to the error of the stepper).
  8. (DONE) Add calculation of velocity/momentum errors. First identify what error Geant4 uses to validate a step. Also do it for DOPRI5. Calculate this error in Experiment 1 (varying epsilon).

Posterior Objectives

  1. Write parameters for the Geant4 baseline in the wiki
  2. Format issues with the figures (scales, line colors, etc.)
  3. Make statistic on many (10?) simulations for the points and add {simulationTime, simulationTimeError} for each number of planes.
  4. How does DOPRI5 find the intersection with the planes?

Accomplished objectives

  1. Measuring simulation times
    • On the QSS side, Federico Bergero recently confirmed by email that the QSS solver does not take into account any time regarding initialization nor I/O operations when it informs the total simulation time. It is thus safe to use this time in the experiments and plots.
    • Regarding Geant4, we investigated how the G4UserEventAction class is used inside the N02 example.
      • As this document explains, this class can be used to perform certain actions before and after a simulation event is processed.
      • In particular, the N02 example is already using a timer to measure the simulation time. This time is printed to standard output using the prefix TimeEvent>.
      • More precisely, the fourth column seems to be the actual simulation time that we are interested in, as it is the user time plus the system time.
      • The fifth column equals the fourth in these cases, as we are usually simulating just one event. If the beamOn argument were increased in the macro files, this column would show increasing numbers that correspond to the total simulation time of every event.
      • In conclusion, we do not seem to require any further action to ensure measuring simulation times excluding the initialization of Geant4's kernel.
  2. Output momentum in Geant4. Understand relation coefficient between momentum and velocity. Calculate the velocity error in Experiment 1.
  3. Nico reviewed in detail ~90% of the transportation chain.

Solver source code

Solver Source code

Simulation Time vs #Planes comparison


Fig 1: Simulation Time vs #Planes comparison for QSS3, DOPRI5 and Geant4

Fig 2: log(Simulation Time) vs #Planes comparison for QSS3, DOPRI5 and Geant4

Fig 3: Simulation Time Ratio (using Geant4 as baseline) vs #Planes comparison for QSS3 and DOPRI5

Fig 4: log(Simulation Time Ratio) (using Geant4 as baseline) vs #Planes comparison for QSS3 and DOPRI5

Simulation Time vs #Planes comparison - More efficient modeling in the Solver


Fig 5: Simulation Time vs #Planes comparison for QSS3, DOPRI5 and Geant4

Fig 6: log(Simulation Time) vs #Planes comparison for QSS3, DOPRI5 and Geant4

Fig 7: Simulation Time Ratio (using Geant4 as baseline) vs #Planes comparison for QSS3 and DOPRI5

Fig 8: log(Simulation Time Ratio) (using Geant4 as baseline) vs #Planes comparison for QSS3 and DOPRI5

Comparison Conclusions

  • We acknowledge in DOPRI5 the simulation with Tolerance 1E-5 takes less time than the one with 1E-3 but we can't explain why.
  • We acknowledge a strange discontinuity in the first points for DOPRI5. Why is this happening? Will this be solved when we perform many simulations?

Experiment 1.2 - Velocity Error

In Geant4, the velocity error is also considered when deciding if a step is valid or not. We had never looked yet how this error looked like, so we decided to calculate it and redo Experiment 1.

To check if a step is valid in Geant4, the following comparison is done:

max(Delta_r, h_step * Delta_p / |p|) (1)

Where
Delta_r = sqrt(Delta_x^2 + Delta_y^2 + Delta_z^2)
Delta_v = sqrt(Delta_px^2 + Delta_py^2 + Delta_pz^2)

|p| = sqrt(px^2 + py^2 + pz^2)
h_step = stepMax

Also, as p = alpha * v, in (1) it would be the same to do all the calculations with the v or p values.
In any case, alpha = M_e * gamma * v0 * c^2 / c (the last c is useful so that p has energy units).

Plots


Fig 9: v_x vs distance


Fig 10: v_x vs distance (First oscillations)


Fig 11: v_y vs distance


Fig 12: v_y vs distance (First oscillations)


Fig 13: max(vx_Error) vs distance

Summary of results

TODO: summarize results in a table.
First column is 1km, then 100m, ..., 1mm

eps = 1e-3
Vx_max_error:
2.46E+01 | 2.42E+00 | 2.34E-01 | 2.06E-02 | 1.46E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.36E+01 | 1.36E+00 | 1.36E-01 | 1.35E-02 | 1.56E-03 | 1.08E-03 | 1.08E-03 |

eps = 1e-4
Vx_max_error:
2.46E+01 | 2.42E+00 | 2.34E-01 | 2.06E-02 | 1.46E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.36E+01 | 1.36E+00 | 1.36E-01 | 1.35E-02 | 1.56E-03 | 1.08E-03 | 1.08E-03 |

eps = 1e-5
Vx_max_error:
2.46E+01 | 2.42E+00 | 2.34E-01 | 2.06E-02 | 1.46E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.36E+01 | 1.36E+00 | 1.36E-01 | 1.35E-02 | 1.56E-03 | 1.08E-03 | 1.08E-03 |

eps = 1e-6
Vx_max_error:
2.47E+01 | 2.43E+00 | 2.35E-01 | 2.08E-02 | 1.47E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.37E+01 | 1.37E+00 | 1.37E-01 | 1.35E-02 | 1.57E-03 | 1.08E-03 | 1.08E-03 |

eps = 1e-7
Vx_max_error:
2.47E+01 | 2.43E+00 | 2.35E-01 | 2.08E-02 | 1.47E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.37E+01 | 1.37E+00 | 1.37E-01 | 1.36E-02 | 1.57E-03 | 1.08E-03 | 1.08E-03 |

eps = 1e-8
Vx_max_error:
2.47E+01 | 2.43E+00 | 2.35E-01 | 2.08E-02 | 1.47E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.37E+01 | 1.37E+00 | 1.37E-01 | 1.36E-02 | 1.57E-03 | 1.08E-03 | 1.08E-03 |

eps = 1e-9
Vx_max_error:
2.47E+01 | 2.43E+00 | 2.35E-01 | 2.08E-02 | 1.47E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.37E+01 | 1.37E+00 | 1.37E-01 | 1.36E-02 | 1.57E-03 | 1.08E-03 | 1.08E-03 |

eps = 1e-10
Vx_max_error:
2.47E+01 | 2.43E+00 | 2.35E-01 | 2.08E-02 | 1.47E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.37E+01 | 1.37E+00 | 1.37E-01 | 1.36E-02 | 1.57E-03 | 1.08E-03 | 1.08E-03 |

eps = 1e-11
Vx_max_error:
2.47E+01 | 2.43E+00 | 2.35E-01 | 2.08E-02 | 1.47E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.37E+01 | 1.37E+00 | 1.37E-01 | 1.36E-02 | 1.57E-03 | 1.08E-03 | 1.08E-03 |

eps = 1e-12
Vx_max_error:
2.47E+01 | 2.43E+00 | 2.35E-01 | 2.08E-02 | 1.47E-03 | 1.08E-03 | 1.08E-03 |
Vx_MSE:
1.37E+01 | 1.37E+00 | 1.37E-01 | 1.36E-02 | 1.57E-03 | 1.08E-03 | 1.08E-03 |

Conclusion from Results

The error associated with velocity is not changing either with the value of epsilon.