-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field Propagation using Runge-Kutta integration and example15 as demo #166
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
65a7551
First version of classes for Runge-Kutta integration of track in field
jonapost 075f84c
Electrons.cu + RK: return iterations; print good & bad steps.
jonapost 3197dd6
Runge-Kutta integration: changes to identify cause of errors. (For de…
jonapost 21e549b
Fix for compilation - due to change to use fieldConstants.h
jonapost cfe68f1
electrons.cu: Adapted to changes in G4HepEM (using Example13)
jonapost fb56e4e
Example15: Fixed multiple parts using changes in Example13
jonapost a00464c
Fix to pass world volume to G4TransporationManager
jonapost 0c54085
15/electrons: Improved printing of differences RK vs helix
jonapost fb4b884
fieldPropagatorRungeKutta: added checks vs Helix
jonapost f40109e
Example15 / magfield : revised prints, new header file.
jonapost 89c3d92
fieldPropagatorRungeKutta: fix update of momentum in substep of Compu…
jonapost d80f073
fieldPropagatorRungeKutta: Refine intersection for comparisons
jonapost 0a43dc1
Example15 / magneticfield: checks first refined, then disabled.
jonapost 287cf68
fieldPropagatorRungeKutta: IntegrateToEnd reports if loopCt > 1
jonapost 299e41b
fieldPropagatorRungeKutta: fix condition for ending - adding conditio…
jonapost 49014e9
Example15: improvements to printing changes (investigating).
jonapost 483bce4
fieldPropagatorRungeKutta: added step reduction for zero steps (copyi…
jonapost 3be869b
example15.cu: fix call to ensure that ClearQueue occurs (not just whe…
jonapost 9713b67
example15/electrons.cu: first cleanup, removed max_step=0.25mm, alway…
jonapost 996e17f
fieldPropagatorRungeKutta.h: sharper step reduction for stuck tracks,…
jonapost fc01ae8
example15.cu: Added optional printing and info printing ; Revised ma…
jonapost fdae177
example15: reset cms2018.gdml as default geometryf
jonapost c36361b
example15.cu: removed most (optional) verbosity
jonapost 114d404
fieldPropagatorConstBz::ComputeNextStepAndVolume: moved slot after sa…
jonapost ee1591f
Example13/electrons.cu : added arguments to ComputeStepAndNextVolume
jonapost 4ea8f40
fieldPropagatorConstBz: After multiple zero steps move to other side of
jonapost 1c5a8b5
fieldPropagatorConstBz: cleaned up several printouts; defaults in Com…
jonapost 4787f69
fieldPropagatorRungeKutta: removed optional prints & cleanup
jonapost 4225101
fieldPropagatorConstBz::ComputeStepAndNextVolume enforce that safety …
jonapost 1b7f554
fieldPropagatorConstBz.h : clean-up; added const in arg
jonapost d033886
fieldPropagatorConstBz: fix vecgeom::Precision; cosmetics
jonapost efa21e6
Example13: set B=3.8T ; electrons.cu: took out slot in args of fieldP…
jonapost 8c11d26
CompareResponces.h: Added Copyright, reuse
jonapost 0d2cc3a
Example15/electrons.cu : cleanup. Fix to remove slot.
jonapost edbb17a
example15.cu: cleanup
jonapost e4cccd5
example15.cpp: Set stack limit to 8K
jonapost File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# SPDX-FileCopyrightText: 2021 CERN | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if(NOT TARGET G4HepEm::g4HepEm) | ||
message(STATUS "Disabling example15 (needs G4HepEm)") | ||
return() | ||
endif() | ||
|
||
if(Geant4_FOUND) | ||
if(NOT Geant4_gdml_FOUND) | ||
message(STATUS "Disabling example15 (needs Geant4 with GDML support)") | ||
return() | ||
endif() | ||
else() | ||
message(STATUS "Disabling example15 (needs Geant4)") | ||
return() | ||
endif() | ||
|
||
# example15 is the AdePT demo example using material cuts as defined in the input gdml file | ||
add_executable(example15 | ||
example15.cpp | ||
example15.cu | ||
electrons.cu | ||
gammas.cu) | ||
target_link_libraries(example15 | ||
PRIVATE | ||
AdePT | ||
CopCore::CopCore | ||
VecGeom::vecgeom | ||
VecGeom::vecgeomcuda_static | ||
VecGeom::vgdml | ||
${Geant4_LIBRARIES} | ||
G4HepEm::g4HepEmData | ||
G4HepEm::g4HepEmInit | ||
G4HepEm::g4HepEmRun | ||
CUDA::cudart) | ||
|
||
set_target_properties(example15 PROPERTIES CUDA_SEPARABLE_COMPILATION ON CUDA_RESOLVE_DEVICE_SYMBOLS ON) | ||
|
||
# Tests | ||
add_test(NAME example15 | ||
COMMAND $<TARGET_FILE:example15> -gdml_file ${CMAKE_BINARY_DIR}/cms2018.gdml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: 2021 CERN | ||
SPDX-License-Identifier: CC-BY-4.0 | ||
--> | ||
|
||
## Example 14 | ||
|
||
Example demonstrating particle transportation on GPUs with a non-uniform magnetic field - in arbitrary geometry read from a GDML file. | ||
|
||
New feature is | ||
- definition of a non-uniform magnetic field | ||
- integration of the equation of motion of charged particles using embedded Runge-Kutta method, Dormand Prince 4(5). | ||
Caveats (at present) : | ||
- fixed accuracy of integration (constant in source) | ||
|
||
The features carried over from Example13 are: | ||
* arbitrary geometry via gdml file (tested with cms2018.gdml from VecGeom persistency/gdml/gdmls folder) and optionally a magnetic field with constant Bz, | ||
* geometry read as Geant4 geometry, reading in regions and cuts, to initialize G4HepEm data | ||
* geometry read then into VecGeom, and synchronized to GPU | ||
* G4HepEm material-cuts couple indices mapped to VecGeom logical volume id's | ||
* physics processes for e-/e+ (including MSC) and gammas using G4HepEm. | ||
* scoring per placed volume, no sensitive detector feature | ||
|
||
Electrons, positrons, and gammas are stored in separate containers in device memory. | ||
Free positions in the storage are handed out with monotonic slot numbers, slots are not reused. | ||
Active tracks are passed via three queues per particle type (see `struct ParticleQueues`). | ||
Results are reproducible using one RANLUX++ state per track. | ||
|
||
Additionally, the kernels score energy deposit and the charged track length per volume. | ||
|
||
### Kernels | ||
|
||
This example uses one stream per particle type to launch kernels asynchronously. | ||
They are synchronized via a fourth stream using CUDA events. | ||
|
||
#### `TransportElectrons<bool IsElectron>` | ||
|
||
1. Obtain safety unless the track is currently on a boundary. | ||
2. Determine physics step limit, including conversion to geometric step length according to MSC. | ||
3. Query geometry (or optionally magnetic field) to get geometry step length. | ||
4. Convert geometry to true step length according to MSC, apply net direction change and discplacement. | ||
5. Apply continuous effects; kill track if stopped. | ||
6. If the particle reaches a boundary, perform relocation. | ||
7. If not, and if there is a discrete process: | ||
1. Sample the final state. | ||
2. Update the primary and produce secondaries. | ||
|
||
#### `TransportGammas` | ||
|
||
1. Determine the physics step limit. | ||
2. Query VecGeom to get geometry step length (no magnetic field for neutral particles!). | ||
3. If the particle reaches a boundary, perform relocation. | ||
4. If not, and if there is a discrete process: | ||
1. Sample the final state. | ||
2. Update the primary and produce secondaries. | ||
|
||
#### `FinishIteration` | ||
|
||
Clear the queues and return the tracks in flight. | ||
This kernel runs after all secondary particles were produced. | ||
|
||
#### `InitPrimaries` and `InitParticleQueues` | ||
|
||
Used to initialize multiple primary particles with separate seeds. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.