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

ddsim: support non-cylindrical tracking region #1302

Closed
Zehvogel opened this issue Jul 24, 2024 · 5 comments · Fixed by #1303
Closed

ddsim: support non-cylindrical tracking region #1302

Zehvogel opened this issue Jul 24, 2024 · 5 comments · Fixed by #1303
Assignees

Comments

@Zehvogel
Copy link
Contributor

I would like to have a non-cylindrical tracking region as introduced in #384, particularly because in the naive cylindrical approach the lumi cal of my detector is inside the tracking volume.

When I add such a tracking region to my detector and remove the previous definition of the tracking region:

        <constant name="tracker_region_zmax" value="OuterTracker_half_length"/>
        <constant name="tracker_region_rmax" value="OuterTracker_outer_radius"/>

ddsim stops here:

if self.userParticleHandler == "Geant4TCUserParticleHandler":
user = DDG4.Action(kernel, "%s/UserParticleHandler" % self.userParticleHandler)
try:
user.TrackingVolume_Zmax = DDG4.tracker_region_zmax
user.TrackingVolume_Rmax = DDG4.tracker_region_rmax
except AttributeError as e:
logger.error("Attribute of tracker region missing in detector model %s", e)
logger.error(" make sure to specify the global constants tracker_region_zmax and tracker_region_rmax ")
logger.error(" this is needed for the MC-truth link of created sim-hits ! ")
logger.error(" Or Disable the User Particle Handler with --part.userParticleHandler=''")
exit(1)

(If I don't remove it the cylinder is still used as the tracking region as far as I can tell.)

The TrackingRegion example in the examples/ClientTests seems to not use ddsim:
https://github.com/AIDASoft/DD4hep/blob/master/examples/ClientTests/scripts/TrackingRegion.py

@andresailer
Copy link
Member

I think one would need to implement a Geant4TVUserParticleHandler, where TV is for tracking_volume? (Or TR for tracking region?). Maybe I missed the use of the tracking_volume?

@Zehvogel
Copy link
Contributor Author

Aaah ok, the TC in Geant4TCUserParticleHandler stands for tracking cylinder... so there is no way yet to use this feature?

@andresailer
Copy link
Member

As far as I saw there isn't one yet.
Do you want to give it a go to implement the new handler?

@Zehvogel
Copy link
Contributor Author

In principle that looks simple. I just don't know how I would retrieve that volume in ParticleHandler.py to pass it to the handler... and I don't really know where to look to figure that out in this interesting c++ and python mixture :(

@Zehvogel
Copy link
Contributor Author

nvm. I think I found a way :) I will prepare a PR

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

Successfully merging a pull request may close this issue.

2 participants