* Fixed mashing for even number of TOF bins. - #1755
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 6 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
|
||
| dp.timing_pos() = std::abs(bin.timing_pos_num()) * this->get_tof_mash_factor(); | ||
| dp.timing_pos() | ||
| = (bin.timing_pos_num() >= 0 ? bin.timing_pos_num() : -bin.timing_pos_num() - (this->get_num_tof_poss() % 2 == 0)) |
There was a problem hiding this comment.
are we sure a bool converts to 1?
probably clearer/safer would be
(this->get_num_tof_poss() % 2 == 0 ? 1 : 0)Or cryptic
(1 - (this->get_num_tof_poss() % 2))
KrisThielemans
left a comment
There was a problem hiding this comment.
As this correct?
You put in changes for even number tof bins, but the number of timing_pos could also be even. Do we cope with this? Same convention?
We want the dp.timing_pos correspond to the centre of the (mashed) TOF bin.
Examples that seem to give undesirable results
- num_tof_bins is even
| bin.timing_pos_num | centred_range for bin | centred_range for dp.timing_pos | actual (asymmetric) range |
|---|---|---|---|
| 0 | 0.5 | 0.5 * mash | 0.5 * mash - 0.5 |
dp.timing_pos wouldn't be integer if mash is even
- num_tof_bins is odd, but mash is even
| bin.timing_pos_num | centred_range for bin | centred_range for dp.timing_pos | actual (asymmetric) range |
|---|---|---|---|
| 0 | 0 | 0 | -0.5 |
Changes in this pull request
This PR fixes #1751. With even number of TOF abs, naive inversion does not work. If even we need to subtract 1.
Now, both -1 and 0 become a mashed TOF bin 0 but they have inverted detectors.
Testing performed
New tests introduced to explicitly check the transformation with even and odd TOF bins, with and without mashing.
Related issues
Checklist before requesting a review
documentation/release_XXX.mdhas been updated with any functionality change (if applicable)Contribution Notes
Please tick the following: