**Table of contents**- GQLink: high-level design aspects

# GQLink: high-level design aspects¶

- Initialization
- Geant4 model mapping
- Accuracy parameters: epsilon <--> dQRel?
- How about other Geant4 parameters?
- Disabling QSS Solver capabilities that might not be needed (output logs, memory store, etc.)

- Simulation
- Volume crossings
- Magnetic/electric fields
- Physics processes
- How to determine the end of the simulation

## Preliminary model¶

model G4_QSS Real y[3], p[N] initial algorithm y = GQL_y0(); p = GQL_p0(); equation der(y) = GQL_template(); algorithm when GQL_TimeNextCross(IDVol, y_pol, delta_t) > time (IDVol, p) = GQL_GetNewVol(IDVol); end when; end model;

`GQL_*`

functions will be part of the GQLink interface and will be called by QSS as the simulation progresses.`GQL_y0`

: provides initial conditions`GQL_p0`

: provides initial parameters that define how the equations of motion will look like`GQL_template`

: instanciates the template of the equation of motion given current parameters`GQL_TimeNextCross`

: given the current volume and a finite polynomial trajectory, determines the time of the next volume crossing (or -1 if no volume will be crossed)`GQL_GetNewVol`

: provides the volume ID of the new current volume and the parameters for it (only called when a new volume is crossed)

## Preliminary sequence diagram¶

### Notes¶

`safety`

is an optional parameter. However, the diagram is general enough to support this (note that the first loop will be executed only if`safety`

is nonzero).

## Geometry crossing: sequence diagram¶

### Usage of Geant4 methods¶

As the sequence diagram shows, the three most important Geant4 methods currently used by GQLink are `G4Navigator::LocateGlobalPointAndSetup`

, `G4PropagatorInField::IntersectChord`

and `G4MultiLevelLocator::EstimateIntersectionPoint`

.

`G4Navigator::LocateGlobalPointAndSetup`

¶

`G4Navigator::LocateGlobalPointAndSetup`

- Called in
**every**QSS substep (i.e., every iteration of the main loop of the QSS integration engine), and also before calling`IntersectChord`

(in order to reconfigure the navigator object's internal state and prepare it for computing the intersection). - Used to find the volume where the current point lies in so as to check if the volume changed.
- Code here.

`G4PropagatorInField::IntersectChord`

¶

`G4PropagatorInField::IntersectChord`

- Called only when a point is found to be in a new volume, according to
`LocateGlobalPointAndSetup`

. - Used to find a first estimation of the intersection point to pass to
`EstimateIntersectionPoint`

(as it is done inside`G4PropagatorInField::ComputeStep`

). - Code here.

`G4MultiLevelLocator::EstimateIntersectionPoint`

¶

`G4MultiLevelLocator::EstimateIntersectionPoint`

- Called only when a point is found to be in a new volume and the call to
`IntersectChord`

returned`true`

. - Used to compute the distance to the intersection point.
- Code here.

## Useful links¶

- A link to the "Geant4 User's Guide for Toolkit Developers" Tracking section:
- Call diagrams: