Skip to content
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

Generate a unique id for every detector element #28

Open
KrisThielemans opened this issue Oct 5, 2024 · 5 comments
Open

Generate a unique id for every detector element #28

KrisThielemans opened this issue Oct 5, 2024 · 5 comments

Comments

@KrisThielemans
Copy link
Contributor

We need to be able to generate a unique id for every detector element (from the "tuple" of all ids used to specify it). This currently needs to be done outside of yardl.

More discussion in #22 (comment)

@KrisThielemans
Copy link
Contributor Author

Also related in #22

We currently include a explicit identifiers (id) in various places. However, these are redundant, as they could just correspond to the number in the list. Remove?

@KrisThielemans
Copy link
Contributor Author

KrisThielemans commented Dec 4, 2024

For clarity, this relates to the detectorIds used at

TripleEvent: !record
fields:
detectorIds: uint*3

CoincidenceEvent: !record
fields:
# the pair of detector elements
detectorIds: uint*2

From #22 (comment) (marginally edited)

Currently, we can iterate through all detecting elements as

for rep_module in header.scanner.scanner_geometry.replicated_modules:
det_el = rep_module.object.detecting_elements
for mod_transform in rep_module.transforms:
for rep_volume in det_el:
for transform in rep_volume.transforms:
draw_BoxShape(
ax,
transform_BoxShape(
mult_transforms([mod_transform, transform]),
rep_volume.object.shape,
),
)

That could "define" the order. (Having an explicit list of the various [module_type, module_num, det_element, ...] would be possible but tedious).
We could distribute code that constructs a LUT by doing this iteration.

In the previous "data elements" meeting (2024-11-29) we leaned towards adopting this definition (and therefore removing the current lists of ids for every module etc).

@KrisThielemans
Copy link
Contributor Author

KrisThielemans commented Dec 4, 2024

A separate question is then where/how to document this. As the detectorIds are referenced in at least 2 places, we should avoid duplicating that documentation. @rgwells2023 suggests that could be in ScannerInformation. I think it would be better to give a type, with its own documentation, e.g.

% This is the basic type for detector IDs using in `CoincidenceEvent` and `TripleEvent`.
% It is an unsigned integer that runs over all the "crystals". The correspondence between
% this integer and a module/det_el is defined by ...
DetectorID: uint


CoincidenceEvent: !record 
   fields: 
     # the pair of detector elements 
     detectorIds: DetectorID*2
    ...

(obviously, wording, nomenclature (#28) and correspondence TBD)

@sstute1
Copy link
Contributor

sstute1 commented Dec 5, 2024

Having this unique definition of the global detector ID as a type is a good idea, +1

@KrisThielemans
Copy link
Contributor Author

Having this unique definition of the global detector ID as a type is a good idea, +1

See #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants