-
Notifications
You must be signed in to change notification settings - Fork 114
Fix PhaseSpaceActor scoring in nested attached volumes #975
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,6 +132,14 @@ void GatePhaseSpaceActor::SteppingAction(G4Step *step) { | |
|
|
||
| auto &l = fThreadLocalData.Get(); | ||
|
|
||
| // Check if this SteppingAction was triggered via the sensitive detector | ||
| // attached to the top volume, i.e. the "attached_to" volume | ||
| // if it was triggered by a daughter volume, this is not truely a step | ||
| // at the outer surface, but rather an irrelevant (for the purpose of this | ||
| // actor) internal surface crossing | ||
| if (!IsStepInTopAttachedVolume(step)) | ||
| return; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How can we manage the others policy of the storing: ‘exiting’, ‘first’ or ‘all’ |
||
| // Particle enters the volume if the pre step is at the volume boundary | ||
| const bool entering = | ||
| step->GetPreStepPoint()->GetStepStatus() == fGeomBoundary; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,6 +175,28 @@ bool GateVActor::IsStepEnteringVolume( | |
| return false; | ||
| } | ||
|
|
||
| bool GateVActor::IsStepInTopAttachedVolume(const G4Step *step) const { | ||
| const auto *touchable = step->GetPreStepPoint()->GetTouchable(); | ||
| if (touchable == nullptr) | ||
| return false; | ||
|
|
||
| const auto history_depth = touchable->GetHistoryDepth(); | ||
| int attached_volume_depth = -1; | ||
| for (int i = 0; i <= history_depth; i++) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you do a for loop instead of looking for the name of touchable->GetVolume(0)? |
||
| const auto *volume = touchable->GetVolume(i); | ||
| if (volume == nullptr) | ||
| continue; | ||
| const auto *logical_volume = volume->GetLogicalVolume(); | ||
| if (logical_volume != nullptr && | ||
| logical_volume->GetName() == fAttachedToVolumeName) { | ||
| attached_volume_depth = i; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| return attached_volume_depth == 0; | ||
| } | ||
|
|
||
| bool GateVActor::IsStepExitingAttachedVolume(const G4Step *step) const { | ||
| if (fAttachedToVolumeMotherName == "None") { | ||
| Fatal("Cannot use IsStepExitingAttachedVolume when " | ||
|
|
||
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.
We need to pay attention to daughter volume with same boundary than mother volume when the particle enters.
Or if the particle is created inside a daughter volume like in test058 with iec spheres, the mother volume is the world