Skip to content

Commit

Permalink
Geometry update
Browse files Browse the repository at this point in the history
  • Loading branch information
DraTeots committed Nov 5, 2024
1 parent 94a4506 commit 686443f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,29 @@ tdis
-pacts:geometry=/mnt/data/
/mnt/data/g4sbsout_EPCEvents_200000.txt
```


# Geometry IDs

The geometry description is gives us that each pad is identified by `plane`, `ring`, `pad`:

- `plane` The mTPC will consist of 10 separate TPC volumes. Numbered 0 - 9 from upstream to downstream.
- `ring` The pads are arranged into 21 concentric rings, The rings are numbered from 0 to 20 sequentially, with 0 being the innermost ring.
- `pad` Each ring has 122 pads, 0 is at or closest to phi=0 and numbering is clockwise

This is convenient to encode in a singe uint32_t ID. We assign 8 bits each to plane and ring, and 16 bits to pad.
The encodePadID function packs these three values into a single uint32_t using bitwise shifts and OR operations.

```python
def encode_pad_id(plane, ring, pad):
"""Encode values into a single uint32_t: 8 bits for plane, 8 bits for ring, 16 bits for pad"""
return (plane << 24) | (ring << 16) | pad

def decode_pad_id(pad_id):
"""decodes pad_id into plane, ring, pad """
plane = (pad_id >> 24) & 0xFF # Get the upper 8 bits
ring = (pad_id >> 16) & 0xFF # Get the next 8 bits
pad = pad_id & 0xFFFF # Get the lower 16 bits
return plane, ring, pad

```

0 comments on commit 686443f

Please sign in to comment.