Skip to content

Adjust crossing to center of crossing clock, include global phase adj… - #104

Merged
johnlajoie merged 10 commits into
mainfrom
lajoie
Nov 12, 2026
Merged

johnlajoie merged 10 commits into
mainfrom
lajoie

Conversation

@johnlajoie

Copy link
Copy Markdown
Contributor

…ustment

Briefly, what does this PR introduce? Please link to any relevant presentations or discussions.

What is the urgency of this PR?

  • High (please describe reason below)
  • Medium
  • Low

What kind of change does this PR introduce?

  • Bug fix (issue #__)
  • New feature (issue #__)
  • Optimization (issue #__)
  • Updated documentation
  • other: __

Please check if any of the following apply

  • This PR introduces breaking changes. Please describe changes users need to make below.
  • This PR changes default behavior. Please describe changes below.
  • AI was used in preparing this PR. Please describe usage below.

When an input source is configured with use_bunch_crossing, the event will be at the center of the crossing period. A global phase adjustment is included to allow you to move the event within the crossing window. The old behavior is recovered by setting the global phase to -(bunch_crossing_period/2.0)

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

TimeframeBuilder reports for PR #104

Last updated 2026-11-11T18:23-05:00 e5468f7

@johnlajoie

Copy link
Copy Markdown
Contributor Author

Will post some results Monday 9 Nov

Comment thread src/DataHandler.cc Resolved
Comment thread src/DataSource.cc Resolved
johnlajoie and others added 2 commits November 10, 2026 04:23
Co-authored-by: Wouter Deconinck <wdconinc@gmail.com>

@simonge simonge left a comment

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.

Thanks John.

While this hasn't been deployed yet so this change won't effect analysis in a meaningful way, I would still like to get some extra thoughts from outside, e.g. DAQ experts on what the intention is.

Shouldn't block this PR however.

Comment thread src/DataSource.cc Outdated
// Apply bunch crossing if enabled
if (config.use_bunch_crossing) {
time_offset = std::floor(time_offset / bunch_crossing_period) * bunch_crossing_period;
time_offset = std::floor(time_offset / bunch_crossing_period) * bunch_crossing_period + 0.5*bunch_crossing_period + global_phase;

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.

I would perhaps have the phase in units of bunch crossing period and instead of ns then replace the 0.5 with the phase. The phase would then be set to 0.5 in the configuration. A configuration could also then simply be added to randomize the phase between 0 and 1 in case this is the way forward.

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.

I like the idea to make the phase in units of the crossing clock, I'll change that later today. Randomizing it could be interesting for the future as a tool for testing how an event tagger would handle things in a poorly aligned state. However, TimeframeBuilder already implicitly makes some alignment assumptions - like the different detector streams are aligned on the same clock. We'll need to think about how to incorporate that (and handle it) in the future as well - but for a later day.

Comment thread include/DataHandler.h Resolved
Comment thread include/DataSource.h Resolved
Comment thread include/DataSource.h Resolved
Co-authored-by: Simon Gardner <simon.gardner@glasgow.ac.uk>
@johnlajoie

Copy link
Copy Markdown
Contributor Author

Here's some plots of the true collision time using the modified TimeframeBuilder - the default behavior with no global shift showing the change in default behavior to put the collision in the center of the crossing clock:

truth_time_crossing_0gs

And here is the same thing with a -2ns global shift:

truth_time_crossing_-2gs

In the updates I removed the global phase time shift from the beam effects and it is only applied when to streams where the crossing clock is applied. This is because the global phase represents the relative phase between the two beams crossing in the IP, or a relative time shift between on beam and the other. A time shift for a continuous (single beam) stream doesn't really make sense.

I can make the changes to change the global_phase parameter to be in units of the crossing clock later today.

@johnlajoie

Copy link
Copy Markdown
Contributor Author

Latest commit changes global_phase to a fraction of a crossing period, per Simon's suggestion. This should be ready to merge.

@johnlajoie
johnlajoie requested a review from simonge November 11, 2026 16:12

@simonge simonge left a comment

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.

Looks good. I have added the offset to the example configs.

@johnlajoie
johnlajoie merged commit 7cc2522 into main Nov 12, 2026
12 checks passed
@johnlajoie
johnlajoie deleted the lajoie branch November 12, 2026 16:30

This branch was previously deployed

1 inactive deployment
github-pages — 6890a9a3 Deployed Nov 11, 2026 by simonge via deploy-docs #185
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

Successfully merging this pull request may close these issues.

3 participants