Skip to content

[ALICE3] TRK/FT3 digitizer: introduced discretization of the timestamp into digits with the ALMIRA ToA timestamp format - #16137

Open
atriolo wants to merge 9 commits into
AliceO2Group:devfrom
atriolo:timestamp
Open

atriolo wants to merge 9 commits into
AliceO2Group:devfrom
atriolo:timestamp

Conversation

@atriolo

@atriolo atriolo commented Nov 16, 2026

Copy link
Copy Markdown
Contributor
  • The ToA stored in TRK/FT3 digits is no longer a float in ns: it is encoded as it will be in the ALMIRA chip

    • Digit: float mToA -> uint16_t mTimestampToA
    • 12 bits are used: [frame = ROF counter (8 bits) | clock cycle in the ROF (4 bits)]
    • The ROF counter rolls over every 256 ROFs (2^8). In the simulation, the counter restarts at every TF. This may change once the designers give us more details on when the counter is reset. The absolute time is given by the ROFRecord as before.
    • A clock cycle corresponds to 1 BC (24.95 ns) for VD, and 4 BC (99.8 ns) for MLOT/FT3 disks
    • If a signal started in the previous ROF and is still above threshold at the start of the current one, its timestamp refers to the ROF where it started (frame − 1). This will be revisited when edge detection is implemented.
  • The default ROF length is now 16 BC for all layers (it was 18 BC). This value was chosen after discussing with the designers and the tracking experts.

    • It still has to be assessed whether it is feasible for the DAQ: since 16 BC does not divide the orbit (3564 BC), some ROFs span two orbits (HBFs). No ROF spans two TFs as long as the number of orbits per TF is a multiple of 4 (e.g. 32, 128).
    • If the TF length is not a multiple of the ROF length (e.g. 16 BC with a number of orbits per TF not multiple of 4), the last ROF of the TF is truncated and a warning is printed. This is a temporary solution before discussion with DAQ experts.
    • The ROF length can be changed per layer. The designers require powers of 2 in BC; to fit in the 4 bits of the clock cycle this means 16 BC for VD and 16, 32 or 64 BC for ML/OT/FT3.
    • The ROF length can be changed per layer with the syntax:--configKeyValues "TRKAlmiraParam.roFrameLengthInBCPerLayer[0]=16;..."
  • The number of ROFs per TF is now computed from the TF length and rounded up. The previous formula, (3564 / ROFLength) * nOrbitsPerTF, lost the last ROFs of each TF when the ROF length does not divide the orbit (16 BC, 32 orbits: 7104 instead of 7128 ROFs). Results are unchanged for ROF lengths that divide the orbit (e.g. the previous default of 18 BC).

    • Since the exact handling of ROFs across TF boundaries has to be defined, this definition may change again.

…of the ALMIRA timestamp: 12 bits filled as following [frame (8 bits) | clock cycle in the ROF (4 bits)]
…from the TF length and rounded up. This was introduced to cope with the new default ROF length of 16 BC (required by designers) which does not divide exactly the orbit.
njacazio
njacazio previously approved these changes Nov 16, 2026
@atriolo

atriolo commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Hello @shahor02 , @sawenzel , could you please review this PR? Thanks!

Please consider the following formatting changes to AliceO2Group#16137
/// (e.g. ROF 18 BC, clock 4 BC -> 4.5 -> 5 cycles). Tolerance for the float rounding: 18 BC / 24.95 ns must give 18, not 19
static int computeNClockCycles(int rofLengthInBC, float clockPeriod)
{
return std::ceil(rofLengthInBC * o2::constants::lhc::LHCBunchSpacingNS / clockPeriod - 1e-3); // - 1e-3: tolerance for float rounding

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not std::round, w/o custom margin ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for yout comment!

You are right, I overlooked this. This was a leftover from when I did not yet have detailed information on the relation between the ROF and the clock cycles, so I allowed a ROF length not multiple of the clock period, with a shorter last cycle.
In that case the number of cycles has to be rounded up (e.g. 17 BC with a 4 BC clock needs 5 cycles, while std::round would give 4), hence the std::ceil, and the custom margin was there to protect the ceil from float rounding (18 × 24.95 / 24.95 → 18.000001 → 19).

Now that I know from the designers that the ROF length is always a multiple of the clock period, there is no partial cycle and that calculation no longer makes sense.
So I am going to replace it with std::round and add a fatal check in the digitizer that the ROF length should be a multiple of the clock period.
Please let me know if you have other thoughts about this, thanks again!

@atriolo
atriolo requested a review from njacazio November 17, 2026 16:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants