-
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
Adding new example21 which uses G4VTrackingManager #266
Conversation
Can one of the admins verify this patch? |
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.
I've made some comments, in particular we are copying over data files that are common for example14,17 and now 21. I think we need to run the validation before merging, and a quick speed test, to see what changes compared to example17.
@WitekPokorski is there a way to enable/disable the integration, to be able to run the same app with G4 only? |
Yes, to run without AdePT you add the --no_AdePT argument when you call the example, like this: /example21 -m example21.mac --no_AdePT |
examples/Example21/CMakeLists.txt
Outdated
if(NOT Geant4_flush_FOUND) | ||
message(STATUS "Disabling example21 (needs G4VFastSimulationModel::Flush interface available starting with geant4-11-00-ref-01)") | ||
return() | ||
endif() |
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.
This example doesn't use G4VFastSimulationModel::Flush
but G4VTrackingManager
, which is available since Geant4 11.0
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.
fixed
|
||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... | ||
|
||
void AdePTTrackingManager::BuildPhysicsTable(const G4ParticleDefinition &part) { |
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.
This function is called once per particle type (e-/+/gamma); it needs a protection to only initialize once.
examples/Example21/example21.cpp
Outdated
AdePTTrackingManager* trackingManager = nullptr; | ||
|
||
if(useAdePT){ | ||
trackingManager = new AdePTTrackingManager; |
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.
The example currently only works with one thread. The reason is that we need one tracking manager per thread (the same way we had one fast simulation model per thread)...
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.
Argh... I new it was too easy... ;-) OK, I won't be able to look into it this week. If anybody has some time to touch this code, please go ahead. Otherwise, I am back next week...
* Reduced the size of the scoring arrays to just the number of sensitive PVols * G4 Physical Volume ID to Hit mapping in geant4 * VecGeom Placed Volume ID to Hit mapping + VecGeom PV to Geant4 PV ID mapping in AdePT * Removed unused code * Fixes for initialization issues in multithreaded mode
Modified scoring on CPU and GPU
New example21 demonstrates integration of AdePT into Geant4 using the G4VTrackingManager instead of Fast Simulation hook. In this case all e+,-, gammas are immediately handed over to AdePT (in the entire detector). No particles ever come back from AdePT. It seems to run OK with example21.mac, but certainly further polishing may be needed (and further bugs may be present due to limited testing so far).