Skip to content

Implement a tracking region volume to support Geant4TVUserParticleHandler#1081

Merged
veprbl merged 16 commits intomainfrom
pr/tracking_region_volume
Apr 24, 2026
Merged

Implement a tracking region volume to support Geant4TVUserParticleHandler#1081
veprbl merged 16 commits intomainfrom
pr/tracking_region_volume

Conversation

@veprbl
Copy link
Copy Markdown
Member

@veprbl veprbl commented Apr 16, 2026

To be used with eic/npsim#44
This is needed to resolve eic/npsim#43

@veprbl
Copy link
Copy Markdown
Member Author

veprbl commented Apr 16, 2026

It could use some guidance on what will be the extent of the region. It's currently 10 m in both directions with 1 cm radius.

@veprbl veprbl force-pushed the pr/tracking_region_volume branch from a1a8f07 to 5815d67 Compare April 16, 2026 20:21
Comment thread compact/tracking_region.xml
@DraTeots
Copy link
Copy Markdown
Contributor

I have this rationale to be challenged for the tracking volume

  1. It should be wider than just the beampipe for B0 area as lambdas decaying outside of beampipe has their chance to be detected (very sketchy assumption)
  2. It should be the same as beampipe to ZDC after.

Steps I am doing now:

  1. We have pretty detailed acceptance studies but they all rely on MCParticles (e.g. take lambda daughters and see where they have hits associations) so we need to really save all particles to be reliable (that was not true for the previous data we have). Now we know, that to truly save all particles we switch off Geant4TCUserParticleHandler completely, but all resulting dd4hep outputs bloated from 3gb => 60+gb and the processing is slooow. I will show the results as I have them.

  2. As we have expand the tube to ZDC (or decline this idea), I will run the simulations for this branch and we compare the plots.

@veprbl
Copy link
Copy Markdown
Member Author

veprbl commented Apr 20, 2026

Updated parameters based on suggestions from @ajentsch

@veprbl
Copy link
Copy Markdown
Member Author

veprbl commented Apr 20, 2026

Here is how it looks now:
image

@DraTeots
Copy link
Copy Markdown
Contributor

Thank you! I will now Simul8

@DraTeots
Copy link
Copy Markdown
Contributor

The good part - we now see the normal lambda decay distribution. I will plot all plots tomorrow, but for now:

This is 18x275 lambda end point Z- all particles saved (particle handler switched off)

image

This is 18x275 lambda end point Z from this branch:

image

For some reasons there is no ZDC peak there

This is 18x275 ALL PARTICLES decay types:

image

This is 18x275 this branch decay types

image

So it seems a lot is not captured especially with ZDC

Also interesting. File sizes are smaller than 26.03 image:

THIS BRANCH:

-rw-r--r--. 1 romanov eic 2.5G Apr 21 20:46 k_lambda_10x100_5000evt_0001.edm4hep.root
-rw-r--r--. 1 romanov eic 2.6G Apr 21 20:42 k_lambda_10x100_5000evt_0002.edm4hep.root
-rw-r--r--. 1 romanov eic 2.5G Apr 21 20:26 k_lambda_10x100_5000evt_0003.edm4hep.root
-rw-r--r--. 1 romanov eic 2.6G Apr 21 16:36 k_lambda_10x100_5000evt_0005.edm4hep.root
-rw-r--r--. 1 romanov eic 2.6G Apr 21 19:06 k_lambda_10x100_5000evt_0006.edm4hep.root
-rw-r--r--. 1 romanov eic 2.6G Apr 21 19:11 k_lambda_10x100_5000evt_0007.edm4hep.root
-rw-r--r--. 1 romanov eic 2.6G Apr 21 20:00 k_lambda_10x100_5000evt_0008.edm4hep.root
-rw-r--r--. 1 romanov eic 2.5G Apr 21 20:27 k_lambda_10x100_5000evt_0009.edm4hep.root
-rw-r--r--. 1 romanov eic 2.5G Apr 21 19:54 k_lambda_10x100_5000evt_0010.edm4hep.root

26.03 campaign

-rw-r--r--. 1 romanov eic 3.6G Apr 11 15:58 k_lambda_10x100_5000evt_0001.edm4hep.root
-rw-r--r--. 1 romanov eic 3.6G Apr 11 15:59 k_lambda_10x100_5000evt_0002.edm4hep.root
-rw-r--r--. 1 romanov eic 3.6G Apr 11 16:00 k_lambda_10x100_5000evt_0003.edm4hep.root
-rw-r--r--. 1 romanov eic 3.6G Apr 11 16:01 k_lambda_10x100_5000evt_0004.edm4hep.root
-rw-r--r--. 1 romanov eic 3.6G Apr 11 16:02 k_lambda_10x100_5000evt_0005.edm4hep.root
-rw-r--r--. 1 romanov eic 3.6G Apr 11 16:03 k_lambda_10x100_5000evt_0006.edm4hep.root
-rw-r--r--. 1 romanov eic 3.6G Apr 11 16:04 k_lambda_10x100_5000evt_0007.edm4hep.root
-rw-r--r--. 1 romanov eic 3.7G Apr 11 16:06 k_lambda_10x100_5000evt_0008.edm4hep.root
-rw-r--r--. 1 romanov eic 3.6G Apr 11 16:07 k_lambda_10x100_5000evt_0009.edm4hep.root
-rw-r--r--. 1 romanov eic 3.6G Apr 11 16:08 k_lambda_10x100_5000evt_0010.edm4hep.root

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

@DraTeots
Copy link
Copy Markdown
Contributor

DraTeots commented Apr 23, 2026

And we see this on z decay plot above. The plot captures decay Z only of lambda with daughters. You can see like initially the histogram is identical with the histogram where everything is saved. But then differences increase with Z. So on the plot we see how more and more lambdas start decaying outside of the tracking volume, not being saved and vanish from the histogram. Finally there is no peak corresponding to ZDC as ZDC is completely outside of the tracking volume.

I believe the best solution would be to add yet another tracking volume arm, so there are 2 arms - one going straight to zdc and the second one going along ion beam.

The rules for saving particles are:

  1. Particle decays in tracking volume or one of daughters return to tracking volume
  2. Particle hits tracking sensitive volume (even outside of TV).

So if we leave just one arm going straight to ZDC we should be fine in general as charged particles going into ion pipe will be saved as there are trackers. But with only one hand we may miss rare something (doesn't come to mind instantly what). But if we still want to be careful two arms are optimal physics wise.

I will now run simulations of the TW without rotation going directly to ZDC and post here how it compares.

@DraTeots
Copy link
Copy Markdown
Contributor

DraTeots commented Apr 23, 2026

image Reverting my change. Lets say "it was evening". But the question about why "Finally there is no peak corresponding to ZDC as ZDC is completely outside of the tracking volume." needs more analysis now.

@veprbl veprbl marked this pull request as ready for review April 23, 2026 13:20
Copilot AI review requested due to automatic review settings April 23, 2026 13:20
@veprbl
Copy link
Copy Markdown
Member Author

veprbl commented Apr 23, 2026

If this is working, we should merge ASAP to allow for some grace period before rolling out the npsim change that depends on this.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a dedicated “tracking region” parallel-world volume to support Geant4TVUserParticleHandler usage (needed by npsim integration), and relocates the legacy tracker-region constants into a dedicated compact include.

Changes:

  • Include compact/tracking_region.xml from the master templates/epic.xml.jinja2 geometry template.
  • Add compact/tracking_region.xml defining tracker-region constants and a parallelworld_volume (tracking_volume) with an ion-beamline extrusion.
  • Remove the legacy tracker_region_* constants from compact/definitions.xml (now provided by tracking_region.xml).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
templates/epic.xml.jinja2 Adds an include for the new tracking-region compact file.
compact/tracking_region.xml New compact fragment defining tracker-region constants and the tracking parallel-world volume.
compact/definitions.xml Removes tracker-region constants that were moved into the new tracking-region file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread templates/epic.xml.jinja2
Comment thread compact/tracking_region.xml Outdated
@DraTeots
Copy link
Copy Markdown
Contributor

Not fully fixed yet. I am working on understanding where is our ZDC peak. Will give the update later today.

veprbl and others added 2 commits April 23, 2026 09:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DraTeots
Copy link
Copy Markdown
Contributor

Lets merge this to main (as appropriate). It is much better than was before and we'll create a separate issue as we have a better understanding what else needs to be changed

@veprbl
Copy link
Copy Markdown
Member Author

veprbl commented Apr 23, 2026

I agree. Let's merge to get some version of epic with TV to the users ASAP. Not having TV is a fatal error in Geant4TVUserParticleHandler, so once we enable it by default users will have to take actions. Hence I'd like to separate those changes in time as much as possible.

Do you have any estimate on file size impact?

@DraTeots
Copy link
Copy Markdown
Contributor

Do you have any estimate on file size impact?

No significant impact. It is only MCParticles change but the hits and associations stay the same (maybe pointing to another particles but the number is the same).

@veprbl veprbl requested a review from DraTeots April 23, 2026 21:17
DraTeots
DraTeots previously approved these changes Apr 23, 2026
Comment thread compact/tracking_region.xml Outdated
@veprbl veprbl enabled auto-merge (squash) April 24, 2026 00:24
@veprbl veprbl disabled auto-merge April 24, 2026 01:40
@veprbl veprbl merged commit 308efb3 into main Apr 24, 2026
98 of 99 checks passed
@veprbl veprbl deleted the pr/tracking_region_volume branch April 24, 2026 01:40
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.

Extend tracking region to include far forward decays

4 participants